| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
#ifndef LLVM_CODEGEN_MACHINEINSTR_H |
| 16 |
#define LLVM_CODEGEN_MACHINEINSTR_H |
| 17 |
|
| 18 |
#include "llvm/ADT/DenseMapInfo.h" |
| 19 |
#include "llvm/ADT/PointerSumType.h" |
| 20 |
#include "llvm/ADT/SmallSet.h" |
| 21 |
#include "llvm/ADT/ilist.h" |
| 22 |
#include "llvm/ADT/ilist_node.h" |
| 23 |
#include "llvm/ADT/iterator_range.h" |
| 24 |
#include "llvm/CodeGen/MachineMemOperand.h" |
| 25 |
#include "llvm/CodeGen/MachineOperand.h" |
| 26 |
#include "llvm/CodeGen/TargetOpcodes.h" |
| 27 |
#include "llvm/IR/DebugLoc.h" |
| 28 |
#include "llvm/IR/InlineAsm.h" |
| 29 |
#include "llvm/IR/PseudoProbe.h" |
| 30 |
#include "llvm/MC/MCInstrDesc.h" |
| 31 |
#include "llvm/MC/MCSymbol.h" |
| 32 |
#include "llvm/Support/ArrayRecycler.h" |
| 33 |
#include "llvm/Support/TrailingObjects.h" |
| 34 |
#include <algorithm> |
| 35 |
#include <cassert> |
| 36 |
#include <cstdint> |
| 37 |
#include <utility> |
| 38 |
|
| 39 |
namespace llvm { |
| 40 |
|
| 41 |
class AAResults; |
| 42 |
template <typename T> class ArrayRef; |
| 43 |
class DIExpression; |
| 44 |
class DILocalVariable; |
| 45 |
class MachineBasicBlock; |
| 46 |
class MachineFunction; |
| 47 |
class MachineRegisterInfo; |
| 48 |
class ModuleSlotTracker; |
| 49 |
class raw_ostream; |
| 50 |
template <typename T> class SmallVectorImpl; |
| 51 |
class SmallBitVector; |
| 52 |
class StringRef; |
| 53 |
class TargetInstrInfo; |
| 54 |
class TargetRegisterClass; |
| 55 |
class TargetRegisterInfo; |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
class MachineInstr |
| 65 |
: public ilist_node_with_parent<MachineInstr, MachineBasicBlock, |
| 66 |
ilist_sentinel_tracking<true>> { |
| 67 |
public: |
| 68 |
using mmo_iterator = ArrayRef<MachineMemOperand *>::iterator; |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
enum CommentFlag { |
| 75 |
ReloadReuse = 0x1, |
| 76 |
NoSchedComment = 0x2, |
| 77 |
TAsmComments = 0x4 |
| 78 |
}; |
| 79 |
|
| 80 |
enum MIFlag { |
| 81 |
NoFlags = 0, |
| 82 |
FrameSetup = 1 << 0, |
| 83 |
|
| 84 |
FrameDestroy = 1 << 1, |
| 85 |
|
| 86 |
BundledPred = 1 << 2, |
| 87 |
BundledSucc = 1 << 3, |
| 88 |
FmNoNans = 1 << 4, |
| 89 |
|
| 90 |
FmNoInfs = 1 << 5, |
| 91 |
|
| 92 |
FmNsz = 1 << 6, |
| 93 |
|
| 94 |
FmArcp = 1 << 7, |
| 95 |
|
| 96 |
FmContract = 1 << 8, |
| 97 |
|
| 98 |
FmAfn = 1 << 9, |
| 99 |
|
| 100 |
FmReassoc = 1 << 10, |
| 101 |
|
| 102 |
NoUWrap = 1 << 11, |
| 103 |
|
| 104 |
NoSWrap = 1 << 12, |
| 105 |
|
| 106 |
IsExact = 1 << 13, |
| 107 |
|
| 108 |
NoFPExcept = 1 << 14, |
| 109 |
|
| 110 |
NoMerge = 1 << 15, |
| 111 |
|
| 112 |
|
| 113 |
}; |
| 114 |
|
| 115 |
private: |
| 116 |
const MCInstrDesc *MCID; |
| 117 |
MachineBasicBlock *Parent = nullptr; |
| 118 |
|
| 119 |
|
| 120 |
MachineOperand *Operands = nullptr; |
| 121 |
unsigned NumOperands = 0; |
| 122 |
|
| 123 |
uint16_t Flags = 0; |
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
uint8_t AsmPrinterFlags = 0; |
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
using OperandCapacity = ArrayRecycler<MachineOperand>::Capacity; |
| 137 |
OperandCapacity CapOperands; |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
class ExtraInfo final |
| 146 |
: TrailingObjects<ExtraInfo, MachineMemOperand *, MCSymbol *, MDNode *> { |
| 147 |
public: |
| 148 |
static ExtraInfo *create(BumpPtrAllocator &Allocator, |
| 149 |
ArrayRef<MachineMemOperand *> MMOs, |
| 150 |
MCSymbol *PreInstrSymbol = nullptr, |
| 151 |
MCSymbol *PostInstrSymbol = nullptr, |
| 152 |
MDNode *HeapAllocMarker = nullptr) { |
| 153 |
bool HasPreInstrSymbol = PreInstrSymbol != nullptr; |
| 154 |
bool HasPostInstrSymbol = PostInstrSymbol != nullptr; |
| 155 |
bool HasHeapAllocMarker = HeapAllocMarker != nullptr; |
| 156 |
auto *Result = new (Allocator.Allocate( |
| 157 |
totalSizeToAlloc<MachineMemOperand *, MCSymbol *, MDNode *>( |
| 158 |
MMOs.size(), HasPreInstrSymbol + HasPostInstrSymbol, |
| 159 |
HasHeapAllocMarker), |
| 160 |
alignof(ExtraInfo))) |
| 161 |
ExtraInfo(MMOs.size(), HasPreInstrSymbol, HasPostInstrSymbol, |
| 162 |
HasHeapAllocMarker); |
| 163 |
|
| 164 |
|
| 165 |
std::copy(MMOs.begin(), MMOs.end(), |
| 166 |
Result->getTrailingObjects<MachineMemOperand *>()); |
| 167 |
|
| 168 |
if (HasPreInstrSymbol) |
| 169 |
Result->getTrailingObjects<MCSymbol *>()[0] = PreInstrSymbol; |
| 170 |
if (HasPostInstrSymbol) |
| 171 |
Result->getTrailingObjects<MCSymbol *>()[HasPreInstrSymbol] = |
| 172 |
PostInstrSymbol; |
| 173 |
if (HasHeapAllocMarker) |
| 174 |
Result->getTrailingObjects<MDNode *>()[0] = HeapAllocMarker; |
| 175 |
|
| 176 |
return Result; |
| 177 |
} |
| 178 |
|
| 179 |
ArrayRef<MachineMemOperand *> getMMOs() const { |
| 180 |
return makeArrayRef(getTrailingObjects<MachineMemOperand *>(), NumMMOs); |
| 181 |
} |
| 182 |
|
| 183 |
MCSymbol *getPreInstrSymbol() const { |
| 184 |
return HasPreInstrSymbol ? getTrailingObjects<MCSymbol *>()[0] : nullptr; |
| 185 |
} |
| 186 |
|
| 187 |
MCSymbol *getPostInstrSymbol() const { |
| 188 |
return HasPostInstrSymbol |
| 189 |
? getTrailingObjects<MCSymbol *>()[HasPreInstrSymbol] |
| 190 |
: nullptr; |
| 191 |
} |
| 192 |
|
| 193 |
MDNode *getHeapAllocMarker() const { |
| 194 |
return HasHeapAllocMarker ? getTrailingObjects<MDNode *>()[0] : nullptr; |
| 195 |
} |
| 196 |
|
| 197 |
private: |
| 198 |
friend TrailingObjects; |
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
const int NumMMOs; |
| 206 |
const bool HasPreInstrSymbol; |
| 207 |
const bool HasPostInstrSymbol; |
| 208 |
const bool HasHeapAllocMarker; |
| 209 |
|
| 210 |
|
| 211 |
size_t numTrailingObjects(OverloadToken<MachineMemOperand *>) const { |
| 212 |
return NumMMOs; |
| 213 |
} |
| 214 |
size_t numTrailingObjects(OverloadToken<MCSymbol *>) const { |
| 215 |
return HasPreInstrSymbol + HasPostInstrSymbol; |
| 216 |
} |
| 217 |
size_t numTrailingObjects(OverloadToken<MDNode *>) const { |
| 218 |
return HasHeapAllocMarker; |
| 219 |
} |
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
ExtraInfo(int NumMMOs, bool HasPreInstrSymbol, bool HasPostInstrSymbol, |
| 224 |
bool HasHeapAllocMarker) |
| 225 |
: NumMMOs(NumMMOs), HasPreInstrSymbol(HasPreInstrSymbol), |
| 226 |
HasPostInstrSymbol(HasPostInstrSymbol), |
| 227 |
HasHeapAllocMarker(HasHeapAllocMarker) {} |
| 228 |
}; |
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
enum ExtraInfoInlineKinds { |
| 234 |
EIIK_MMO = 0, |
| 235 |
EIIK_PreInstrSymbol, |
| 236 |
EIIK_PostInstrSymbol, |
| 237 |
EIIK_OutOfLine |
| 238 |
}; |
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
PointerSumType<ExtraInfoInlineKinds, |
| 246 |
PointerSumTypeMember<EIIK_MMO, MachineMemOperand *>, |
| 247 |
PointerSumTypeMember<EIIK_PreInstrSymbol, MCSymbol *>, |
| 248 |
PointerSumTypeMember<EIIK_PostInstrSymbol, MCSymbol *>, |
| 249 |
PointerSumTypeMember<EIIK_OutOfLine, ExtraInfo *>> |
| 250 |
Info; |
| 251 |
|
| 252 |
DebugLoc DbgLoc; |
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
unsigned DebugInstrNum; |
| 257 |
|
| 258 |
|
| 259 |
friend struct ilist_traits<MachineInstr>; |
| 260 |
friend struct ilist_callback_traits<MachineBasicBlock>; |
| 261 |
void setParent(MachineBasicBlock *P) { Parent = P; } |
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
MachineInstr(MachineFunction &, const MachineInstr &); |
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
MachineInstr(MachineFunction &, const MCInstrDesc &TID, DebugLoc DL, |
| 271 |
bool NoImp = false); |
| 272 |
|
| 273 |
|
| 274 |
friend class MachineFunction; |
| 275 |
|
| 276 |
void |
| 277 |
dumprImpl(const MachineRegisterInfo &MRI, unsigned Depth, unsigned MaxDepth, |
| 278 |
SmallPtrSetImpl<const MachineInstr *> &AlreadySeenInstrs) const; |
| 279 |
|
| 280 |
public: |
| 281 |
MachineInstr(const MachineInstr &) = delete; |
| 282 |
MachineInstr &operator=(const MachineInstr &) = delete; |
| 283 |
|
| 284 |
~MachineInstr() = delete; |
| 285 |
|
| 286 |
const MachineBasicBlock* getParent() const { return Parent; } |
| 287 |
MachineBasicBlock* getParent() { return Parent; } |
| 288 |
|
| 289 |
|
| 290 |
void moveBefore(MachineInstr *MovePos); |
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
const MachineFunction *getMF() const; |
| 298 |
MachineFunction *getMF() { |
| 299 |
return const_cast<MachineFunction *>( |
| 300 |
static_cast<const MachineInstr *>(this)->getMF()); |
| 301 |
} |
| 302 |
|
| 303 |
|
| 304 |
uint8_t getAsmPrinterFlags() const { return AsmPrinterFlags; } |
| 305 |
|
| 306 |
|
| 307 |
void clearAsmPrinterFlags() { AsmPrinterFlags = 0; } |
| 308 |
|
| 309 |
|
| 310 |
bool getAsmPrinterFlag(CommentFlag Flag) const { |
| 311 |
return AsmPrinterFlags & Flag; |
| 312 |
} |
| 313 |
|
| 314 |
|
| 315 |
void setAsmPrinterFlag(uint8_t Flag) { |
| 316 |
AsmPrinterFlags |= Flag; |
| 317 |
} |
| 318 |
|
| 319 |
|
| 320 |
void clearAsmPrinterFlag(CommentFlag Flag) { |
| 321 |
AsmPrinterFlags &= ~Flag; |
| 322 |
} |
| 323 |
|
| 324 |
|
| 325 |
uint16_t getFlags() const { |
| 326 |
return Flags; |
| 327 |
} |
| 328 |
|
| 329 |
|
| 330 |
bool getFlag(MIFlag Flag) const { |
| 331 |
return Flags & Flag; |
| 332 |
} |
| 333 |
|
| 334 |
|
| 335 |
void setFlag(MIFlag Flag) { |
| 336 |
Flags |= (uint16_t)Flag; |
| 337 |
} |
| 338 |
|
| 339 |
void setFlags(unsigned flags) { |
| 340 |
|
| 341 |
unsigned Mask = BundledPred | BundledSucc; |
| 342 |
Flags = (Flags & Mask) | (flags & ~Mask); |
| 343 |
} |
| 344 |
|
| 345 |
|
| 346 |
void clearFlag(MIFlag Flag) { |
| 347 |
Flags &= ~((uint16_t)Flag); |
| 348 |
} |
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
bool isInsideBundle() const { |
| 386 |
return getFlag(BundledPred); |
| 387 |
} |
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
bool isBundled() const { |
| 392 |
return isBundledWithPred() || isBundledWithSucc(); |
| 393 |
} |
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
bool isBundledWithPred() const { return getFlag(BundledPred); } |
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
bool isBundledWithSucc() const { return getFlag(BundledSucc); } |
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
void bundleWithPred(); |
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
void bundleWithSucc(); |
| 410 |
|
| 411 |
|
| 412 |
void unbundleFromPred(); |
| 413 |
|
| 414 |
|
| 415 |
void unbundleFromSucc(); |
| 416 |
|
| 417 |
|
| 418 |
const DebugLoc &getDebugLoc() const { return DbgLoc; } |
| 419 |
|
| 420 |
|
| 421 |
|
| 422 |
|
| 423 |
const MachineOperand &getDebugOffset() const { |
| 424 |
assert(isNonListDebugValue() && "not a DBG_VALUE"); |
| 425 |
return getOperand(1); |
| 426 |
} |
| 427 |
MachineOperand &getDebugOffset() { |
| 428 |
assert(isNonListDebugValue() && "not a DBG_VALUE"); |
| 429 |
return getOperand(1); |
| 430 |
} |
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
const MachineOperand &getDebugVariableOp() const; |
| 435 |
MachineOperand &getDebugVariableOp(); |
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
const DILocalVariable *getDebugVariable() const; |
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
const MachineOperand &getDebugExpressionOp() const; |
| 444 |
MachineOperand &getDebugExpressionOp(); |
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
const DIExpression *getDebugExpression() const; |
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
const DILabel *getDebugLabel() const; |
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
unsigned getDebugInstrNum(); |
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
unsigned getDebugInstrNum(MachineFunction &MF); |
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
unsigned peekDebugInstrNum() const { return DebugInstrNum; } |
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
void setDebugInstrNum(unsigned Num) { DebugInstrNum = Num; } |
| 470 |
|
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
void dropDebugNumber() { DebugInstrNum = 0; } |
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
void emitError(StringRef Msg) const; |
| 484 |
|
| 485 |
|
| 486 |
const MCInstrDesc &getDesc() const { return *MCID; } |
| 487 |
|
| 488 |
|
| 489 |
unsigned getOpcode() const { return MCID->Opcode; } |
| 490 |
|
| 491 |
|
| 492 |
unsigned getNumOperands() const { return NumOperands; } |
| 493 |
|
| 494 |
|
| 495 |
unsigned getNumDebugOperands() const { |
| 496 |
return std::distance(debug_operands().begin(), debug_operands().end()); |
| 497 |
} |
| 498 |
|
| 499 |
const MachineOperand& getOperand(unsigned i) const { |
| 500 |
assert(i < getNumOperands() && "getOperand() out of range!"); |
| 501 |
return Operands[i]; |
| 502 |
} |
| 503 |
MachineOperand& getOperand(unsigned i) { |
| 504 |
assert(i < getNumOperands() && "getOperand() out of range!"); |
| 505 |
return Operands[i]; |
| 506 |
} |
| 507 |
|
| 508 |
MachineOperand &getDebugOperand(unsigned Index) { |
| 509 |
assert(Index < getNumDebugOperands() && "getDebugOperand() out of range!"); |
| 510 |
return *(debug_operands().begin() + Index); |
| 511 |
} |
| 512 |
const MachineOperand &getDebugOperand(unsigned Index) const { |
| 513 |
assert(Index < getNumDebugOperands() && "getDebugOperand() out of range!"); |
| 514 |
return *(debug_operands().begin() + Index); |
| 515 |
} |
| 516 |
|
| 517 |
SmallSet<Register, 4> getUsedDebugRegs() const { |
| 518 |
assert(isDebugValue() && "not a DBG_VALUE*"); |
| 519 |
SmallSet<Register, 4> UsedRegs; |
| 520 |
for (const auto &MO : debug_operands()) |
| 521 |
if (MO.isReg() && MO.getReg()) |
| 522 |
UsedRegs.insert(MO.getReg()); |
| 523 |
return UsedRegs; |
| 524 |
} |
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
bool hasDebugOperandForReg(Register Reg) const { |
| 529 |
return any_of(debug_operands(), [Reg](const MachineOperand &Op) { |
| 530 |
return Op.isReg() && Op.getReg() == Reg; |
| 531 |
}); |
| 532 |
} |
| 533 |
|
| 534 |
|
| 535 |
|
| 536 |
template <typename Operand, typename Instruction> |
| 537 |
static iterator_range< |
| 538 |
filter_iterator<Operand *, std::function<bool(Operand &Op)>>> |
| 539 |
getDebugOperandsForReg(Instruction *MI, Register Reg) { |
| 540 |
std::function<bool(Operand & Op)> OpUsesReg( |
| 541 |
[Reg](Operand &Op) { return Op.isReg() && Op.getReg() == Reg; }); |
| 542 |
return make_filter_range(MI->debug_operands(), OpUsesReg); |
| 543 |
} |
| 544 |
iterator_range<filter_iterator<const MachineOperand *, |
| 545 |
std::function<bool(const MachineOperand &Op)>>> |
| 546 |
getDebugOperandsForReg(Register Reg) const { |
| 547 |
return MachineInstr::getDebugOperandsForReg<const MachineOperand, |
| 548 |
const MachineInstr>(this, Reg); |
| 549 |
} |
| 550 |
iterator_range<filter_iterator<MachineOperand *, |
| 551 |
std::function<bool(MachineOperand &Op)>>> |
| 552 |
getDebugOperandsForReg(Register Reg) { |
| 553 |
return MachineInstr::getDebugOperandsForReg<MachineOperand, MachineInstr>( |
| 554 |
this, Reg); |
| 555 |
} |
| 556 |
|
| 557 |
bool isDebugOperand(const MachineOperand *Op) const { |
| 558 |
return Op >= adl_begin(debug_operands()) && Op <= adl_end(debug_operands()); |
| 559 |
} |
| 560 |
|
| 561 |
unsigned getDebugOperandIndex(const MachineOperand *Op) const { |
| 562 |
assert(isDebugOperand(Op) && "Expected a debug operand."); |
| 563 |
return std::distance(adl_begin(debug_operands()), Op); |
| 564 |
} |
| 565 |
|
| 566 |
|
| 567 |
unsigned getNumDefs() const { |
| 568 |
return getNumExplicitDefs() + MCID->getNumImplicitDefs(); |
| 569 |
} |
| 570 |
|
| 571 |
|
| 572 |
bool hasImplicitDef() const { |
| 573 |
for (unsigned I = getNumExplicitOperands(), E = getNumOperands(); |
| 574 |
I != E; ++I) { |
| 575 |
const MachineOperand &MO = getOperand(I); |
| 576 |
if (MO.isDef() && MO.isImplicit()) |
| 577 |
return true; |
| 578 |
} |
| 579 |
return false; |
| 580 |
} |
| 581 |
|
| 582 |
|
| 583 |
unsigned getNumImplicitOperands() const { |
| 584 |
return getNumOperands() - getNumExplicitOperands(); |
| 585 |
} |
| 586 |
|
| 587 |
|
| 588 |
bool isOperandSubregIdx(unsigned OpIdx) const { |
| 589 |
assert(getOperand(OpIdx).getType() == MachineOperand::MO_Immediate && |
| 590 |
"Expected MO_Immediate operand type."); |
| 591 |
if (isExtractSubreg() && OpIdx == 2) |
| 592 |
return true; |
| 593 |
if (isInsertSubreg() && OpIdx == 3) |
| 594 |
return true; |
| 595 |
if (isRegSequence() && OpIdx > 1 && (OpIdx % 2) == 0) |
| 596 |
return true; |
| 597 |
if (isSubregToReg() && OpIdx == 3) |
| 598 |
return true; |
| 599 |
return false; |
| 600 |
} |
| 601 |
|
| 602 |
|
| 603 |
unsigned getNumExplicitOperands() const; |
| 604 |
|
| 605 |
|
| 606 |
unsigned getNumExplicitDefs() const; |
| 607 |
|
| 608 |
|
| 609 |
using mop_iterator = MachineOperand *; |
| 610 |
using const_mop_iterator = const MachineOperand *; |
| 611 |
|
| 612 |
mop_iterator operands_begin() { return Operands; } |
| 613 |
mop_iterator operands_end() { return Operands + NumOperands; } |
| 614 |
|
| 615 |
const_mop_iterator operands_begin() const { return Operands; } |
| 616 |
const_mop_iterator operands_end() const { return Operands + NumOperands; } |
| 617 |
|
| 618 |
iterator_range<mop_iterator> operands() { |
| 619 |
return make_range(operands_begin(), operands_end()); |
| 620 |
} |
| 621 |
iterator_range<const_mop_iterator> operands() const { |
| 622 |
return make_range(operands_begin(), operands_end()); |
| 623 |
} |
| 624 |
iterator_range<mop_iterator> explicit_operands() { |
| 625 |
return make_range(operands_begin(), |
| 626 |
operands_begin() + getNumExplicitOperands()); |
| 627 |
} |
| 628 |
iterator_range<const_mop_iterator> explicit_operands() const { |
| 629 |
return make_range(operands_begin(), |
| 630 |
operands_begin() + getNumExplicitOperands()); |
| 631 |
} |
| 632 |
iterator_range<mop_iterator> implicit_operands() { |
| 633 |
return make_range(explicit_operands().end(), operands_end()); |
| 634 |
} |
| 635 |
iterator_range<const_mop_iterator> implicit_operands() const { |
| 636 |
return make_range(explicit_operands().end(), operands_end()); |
| 637 |
} |
| 638 |
|
| 639 |
|
| 640 |
iterator_range<mop_iterator> debug_operands() { |
| 641 |
assert(isDebugValue() && "Must be a debug value instruction."); |
| 642 |
return isDebugValueList() |
| 643 |
? make_range(operands_begin() + 2, operands_end()) |
| 644 |
: make_range(operands_begin(), operands_begin() + 1); |
| 645 |
} |
| 646 |
|
| 647 |
iterator_range<const_mop_iterator> debug_operands() const { |
| 648 |
assert(isDebugValue() && "Must be a debug value instruction."); |
| 649 |
return isDebugValueList() |
| 650 |
? make_range(operands_begin() + 2, operands_end()) |
| 651 |
: make_range(operands_begin(), operands_begin() + 1); |
| 652 |
} |
| 653 |
|
| 654 |
|
| 655 |
iterator_range<mop_iterator> defs() { |
| 656 |
return make_range(operands_begin(), |
| 657 |
operands_begin() + getNumExplicitDefs()); |
| 658 |
} |
| 659 |
|
| 660 |
iterator_range<const_mop_iterator> defs() const { |
| 661 |
return make_range(operands_begin(), |
| 662 |
operands_begin() + getNumExplicitDefs()); |
| 663 |
} |
| 664 |
|
| 665 |
|
| 666 |
iterator_range<mop_iterator> uses() { |
| 667 |
return make_range(operands_begin() + getNumExplicitDefs(), operands_end()); |
| 668 |
} |
| 669 |
|
| 670 |
iterator_range<const_mop_iterator> uses() const { |
| 671 |
return make_range(operands_begin() + getNumExplicitDefs(), operands_end()); |
| 672 |
} |
| 673 |
iterator_range<mop_iterator> explicit_uses() { |
| 674 |
return make_range(operands_begin() + getNumExplicitDefs(), |
| 675 |
operands_begin() + getNumExplicitOperands()); |
| 676 |
} |
| 677 |
iterator_range<const_mop_iterator> explicit_uses() const { |
| 678 |
return make_range(operands_begin() + getNumExplicitDefs(), |
| 679 |
operands_begin() + getNumExplicitOperands()); |
| 680 |
} |
| 681 |
|
| 682 |
|
| 683 |
unsigned getOperandNo(const_mop_iterator I) const { |
| 684 |
return I - operands_begin(); |
| 685 |
} |
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
ArrayRef<MachineMemOperand *> memoperands() const { |
| 691 |
if (!Info) |
| 692 |
return {}; |
| 693 |
|
| 694 |
if (Info.is<EIIK_MMO>()) |
| 695 |
return makeArrayRef(Info.getAddrOfZeroTagPointer(), 1); |
| 696 |
|
| 697 |
if (ExtraInfo *EI = Info.get<EIIK_OutOfLine>()) |
| 698 |
return EI->getMMOs(); |
| 699 |
|
| 700 |
return {}; |
| 701 |
} |
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
|
| 707 |
|
| 708 |
mmo_iterator memoperands_begin() const { return memoperands().begin(); } |
| 709 |
|
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
mmo_iterator memoperands_end() const { return memoperands().end(); } |
| 716 |
|
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
bool memoperands_empty() const { return memoperands().empty(); } |
| 721 |
|
| 722 |
|
| 723 |
bool hasOneMemOperand() const { return memoperands().size() == 1; } |
| 724 |
|
| 725 |
|
| 726 |
unsigned getNumMemOperands() const { return memoperands().size(); } |
| 727 |
|
| 728 |
|
| 729 |
MCSymbol *getPreInstrSymbol() const { |
| 730 |
if (!Info) |
| 731 |
return nullptr; |
| 732 |
if (MCSymbol *S = Info.get<EIIK_PreInstrSymbol>()) |
| 733 |
return S; |
| 734 |
if (ExtraInfo *EI = Info.get<EIIK_OutOfLine>()) |
| 735 |
return EI->getPreInstrSymbol(); |
| 736 |
|
| 737 |
return nullptr; |
| 738 |
} |
| 739 |
|
| 740 |
|
| 741 |
MCSymbol *getPostInstrSymbol() const { |
| 742 |
if (!Info) |
| 743 |
return nullptr; |
| 744 |
if (MCSymbol *S = Info.get<EIIK_PostInstrSymbol>()) |
| 745 |
return S; |
| 746 |
if (ExtraInfo *EI = Info.get<EIIK_OutOfLine>()) |
| 747 |
return EI->getPostInstrSymbol(); |
| 748 |
|
| 749 |
return nullptr; |
| 750 |
} |
| 751 |
|
| 752 |
|
| 753 |
MDNode *getHeapAllocMarker() const { |
| 754 |
if (!Info) |
| 755 |
return nullptr; |
| 756 |
if (ExtraInfo *EI = Info.get<EIIK_OutOfLine>()) |
| 757 |
return EI->getHeapAllocMarker(); |
| 758 |
|
| 759 |
return nullptr; |
| 760 |
} |
| 761 |
|
| 762 |
|
| 763 |
|
| 764 |
|
| 765 |
enum QueryType { |
| 766 |
IgnoreBundle, |
| 767 |
AnyInBundle, |
| 768 |
AllInBundle |
| 769 |
}; |
| 770 |
|
| 771 |
|
| 772 |
|
| 773 |
|
| 774 |
|
| 775 |
|
| 776 |
bool hasProperty(unsigned MCFlag, QueryType Type = AnyInBundle) const { |
| 777 |
assert(MCFlag < 64 && |
| 778 |
"MCFlag out of range for bit mask in getFlags/hasPropertyInBundle."); |
| 779 |
|
| 780 |
if (Type == IgnoreBundle || !isBundled() || isBundledWithPred()) |
| 781 |
return getDesc().getFlags() & (1ULL << MCFlag); |
| 782 |
|
| 783 |
|
| 784 |
return hasPropertyInBundle(1ULL << MCFlag, Type); |
| 785 |
} |
| 786 |
|
| 787 |
|
| 788 |
|
| 789 |
bool isPreISelOpcode(QueryType Type = IgnoreBundle) const { |
| 790 |
return hasProperty(MCID::PreISelOpcode, Type); |
| 791 |
} |
| 792 |
|
| 793 |
|
| 794 |
|
| 795 |
|
| 796 |
|
| 797 |
bool isVariadic(QueryType Type = IgnoreBundle) const { |
| 798 |
return hasProperty(MCID::Variadic, Type); |
| 799 |
} |
| 800 |
|
| 801 |
|
| 802 |
|
| 803 |
bool hasOptionalDef(QueryType Type = IgnoreBundle) const { |
| 804 |
return hasProperty(MCID::HasOptionalDef, Type); |
| 805 |
} |
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
bool isPseudo(QueryType Type = IgnoreBundle) const { |
| 810 |
return hasProperty(MCID::Pseudo, Type); |
| 811 |
} |
| 812 |
|
| 813 |
bool isReturn(QueryType Type = AnyInBundle) const { |
| 814 |
return hasProperty(MCID::Return, Type); |
| 815 |
} |
| 816 |
|
| 817 |
|
| 818 |
|
| 819 |
bool isEHScopeReturn(QueryType Type = AnyInBundle) const { |
| 820 |
return hasProperty(MCID::EHScopeReturn, Type); |
| 821 |
} |
| 822 |
|
| 823 |
bool isCall(QueryType Type = AnyInBundle) const { |
| 824 |
return hasProperty(MCID::Call, Type); |
| 825 |
} |
| 826 |
|
| 827 |
|
| 828 |
|
| 829 |
bool isCandidateForCallSiteEntry(QueryType Type = IgnoreBundle) const; |
| 830 |
|
| 831 |
|
| 832 |
|
| 833 |
bool shouldUpdateCallSiteInfo() const; |
| 834 |
|
| 835 |
|
| 836 |
|
| 837 |
|
| 838 |
bool isBarrier(QueryType Type = AnyInBundle) const { |
| 839 |
return hasProperty(MCID::Barrier, Type); |
| 840 |
} |
| 841 |
|
| 842 |
|
| 843 |
|
| 844 |
|
| 845 |
|
| 846 |
|
| 847 |
bool isTerminator(QueryType Type = AnyInBundle) const { |
| 848 |
return hasProperty(MCID::Terminator, Type); |
| 849 |
} |
| 850 |
|
| 851 |
|
| 852 |
|
| 853 |
|
| 854 |
|
| 855 |
bool isBranch(QueryType Type = AnyInBundle) const { |
| 856 |
return hasProperty(MCID::Branch, Type); |
| 857 |
} |
| 858 |
|
| 859 |
|
| 860 |
|
| 861 |
bool isIndirectBranch(QueryType Type = AnyInBundle) const { |
| 862 |
return hasProperty(MCID::IndirectBranch, Type); |
| 863 |
} |
| 864 |
|
| 865 |
|
| 866 |
|
| 867 |
|
| 868 |
|
| 869 |
bool isConditionalBranch(QueryType Type = AnyInBundle) const { |
| 870 |
return isBranch(Type) && !isBarrier(Type) && !isIndirectBranch(Type); |
| 871 |
} |
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
|
| 877 |
bool isUnconditionalBranch(QueryType Type = AnyInBundle) const { |
| 878 |
return isBranch(Type) && isBarrier(Type) && !isIndirectBranch(Type); |
| 879 |
} |
| 880 |
|
| 881 |
|
| 882 |
|
| 883 |
|
| 884 |
|
| 885 |
bool isPredicable(QueryType Type = AllInBundle) const { |
| 886 |
|
| 887 |
|
| 888 |
return hasProperty(MCID::Predicable, Type); |
| 889 |
} |
| 890 |
|
| 891 |
|
| 892 |
bool isCompare(QueryType Type = IgnoreBundle) const { |
| 893 |
return hasProperty(MCID::Compare, Type); |
| 894 |
} |
| 895 |
|
| 896 |
|
| 897 |
|
| 898 |
bool isMoveImmediate(QueryType Type = IgnoreBundle) const { |
| 899 |
return hasProperty(MCID::MoveImm, Type); |
| 900 |
} |
| 901 |
|
| 902 |
|
| 903 |
|
| 904 |
bool isMoveReg(QueryType Type = IgnoreBundle) const { |
| 905 |
return hasProperty(MCID::MoveReg, Type); |
| 906 |
} |
| 907 |
|
| 908 |
|
| 909 |
bool isBitcast(QueryType Type = IgnoreBundle) const { |
| 910 |
return hasProperty(MCID::Bitcast, Type); |
| 911 |
} |
| 912 |
|
| 913 |
|
| 914 |
bool isSelect(QueryType Type = IgnoreBundle) const { |
| 915 |
return hasProperty(MCID::Select, Type); |
| 916 |
} |
| 917 |
|
| 918 |
|
| 919 |
|
| 920 |
|
| 921 |
bool isNotDuplicable(QueryType Type = AnyInBundle) const { |
| 922 |
return hasProperty(MCID::NotDuplicable, Type); |
| 923 |
} |
| 924 |
|
| 925 |
|
| 926 |
|
| 927 |
|
| 928 |
bool isConvergent(QueryType Type = AnyInBundle) const { |
| 929 |
if (isInlineAsm()) { |
| 930 |
unsigned ExtraInfo = getOperand(InlineAsm::MIOp_ExtraInfo).getImm(); |
| 931 |
if (ExtraInfo & InlineAsm::Extra_IsConvergent) |
| 932 |
return true; |
| 933 |
} |
| 934 |
return hasProperty(MCID::Convergent, Type); |
| 935 |
} |
| 936 |
|
| 937 |
|
| 938 |
|
| 939 |
bool hasDelaySlot(QueryType Type = AnyInBundle) const { |
| 940 |
return hasProperty(MCID::DelaySlot, Type); |
| 941 |
} |
| 942 |
|
| 943 |
|
| 944 |
|
| 945 |
|
| 946 |
|
| 947 |
|
| 948 |
|
| 949 |
|
| 950 |
|
| 951 |
bool canFoldAsLoad(QueryType Type = IgnoreBundle) const { |
| 952 |
return hasProperty(MCID::FoldableAsLoad, Type); |
| 953 |
} |
| 954 |
|
| 955 |
|
| 956 |
|
| 957 |
|
| 958 |
|
| 959 |
|
| 960 |
|
| 961 |
|
| 962 |
|
| 963 |
|
| 964 |
|
| 965 |
bool isRegSequenceLike(QueryType Type = IgnoreBundle) const { |
| 966 |
return hasProperty(MCID::RegSequence, Type); |
| 967 |
} |
| 968 |
|
| 969 |
|
| 970 |
|
| 971 |
|
| 972 |
|
| 973 |
|
| 974 |
|
| 975 |
|
| 976 |
|
| 977 |
|
| 978 |
|
| 979 |
|
| 980 |
bool isExtractSubregLike(QueryType Type = IgnoreBundle) const { |
| 981 |
return hasProperty(MCID::ExtractSubreg, Type); |
| 982 |
} |
| 983 |
|
| 984 |
|
| 985 |
|
| 986 |
|
| 987 |
|
| 988 |
|
| 989 |
|
| 990 |
|
| 991 |
|
| 992 |
|
| 993 |
|
| 994 |
bool isInsertSubregLike(QueryType Type = IgnoreBundle) const { |
| 995 |
return hasProperty(MCID::InsertSubreg, Type); |
| 996 |
} |
| 997 |
|
| 998 |
|
| 999 |
|
| 1000 |
|
| 1001 |
|
| 1002 |
|
| 1003 |
|
| 1004 |
|
| 1005 |
bool mayLoad(QueryType Type = AnyInBundle) const { |
| 1006 |
if (isInlineAsm()) { |
| 1007 |
unsigned ExtraInfo = getOperand(InlineAsm::MIOp_ExtraInfo).getImm(); |
| 1008 |
if (ExtraInfo & InlineAsm::Extra_MayLoad) |
| 1009 |
return true; |
| 1010 |
} |
| 1011 |
return hasProperty(MCID::MayLoad, Type); |
| 1012 |
} |
| 1013 |
|
| 1014 |
|
| 1015 |
|
| 1016 |
|
| 1017 |
|
| 1018 |
bool mayStore(QueryType Type = AnyInBundle) const { |
| 1019 |
if (isInlineAsm()) { |
| 1020 |
unsigned ExtraInfo = getOperand(InlineAsm::MIOp_ExtraInfo).getImm(); |
| 1021 |
if (ExtraInfo & InlineAsm::Extra_MayStore) |
| 1022 |
return true; |
| 1023 |
} |
| 1024 |
return hasProperty(MCID::MayStore, Type); |
| 1025 |
} |
| 1026 |
|
| 1027 |
|
| 1028 |
bool mayLoadOrStore(QueryType Type = AnyInBundle) const { |
| 1029 |
return mayLoad(Type) || mayStore(Type); |
| 1030 |
} |
| 1031 |
|
| 1032 |
|
| 1033 |
|
| 1034 |
|
| 1035 |
|
| 1036 |
|
| 1037 |
|
| 1038 |
bool mayRaiseFPException() const { |
| 1039 |
return hasProperty(MCID::MayRaiseFPException) && |
| 1040 |
!getFlag(MachineInstr::MIFlag::NoFPExcept); |
| 1041 |
} |
| 1042 |
|
| 1043 |
|
| 1044 |
|
| 1045 |
|
| 1046 |
|
| 1047 |
|
| 1048 |
|
| 1049 |
|
| 1050 |
|
| 1051 |
|
| 1052 |
|
| 1053 |
|
| 1054 |
|
| 1055 |
|
| 1056 |
|
| 1057 |
bool isCommutable(QueryType Type = IgnoreBundle) const { |
| 1058 |
return hasProperty(MCID::Commutable, Type); |
| 1059 |
} |
| 1060 |
|
| 1061 |
|
| 1062 |
|
| 1063 |
|
| 1064 |
|
| 1065 |
|
| 1066 |
|
| 1067 |
|
| 1068 |
|
| 1069 |
|
| 1070 |
|
| 1071 |
|
| 1072 |
|
| 1073 |
|
| 1074 |
|
| 1075 |
bool isConvertibleTo3Addr(QueryType Type = IgnoreBundle) const { |
| 1076 |
return hasProperty(MCID::ConvertibleTo3Addr, Type); |
| 1077 |
} |
| 1078 |
|
| 1079 |
|
| 1080 |
|
| 1081 |
|
| 1082 |
|
| 1083 |
|
| 1084 |
|
| 1085 |
|
| 1086 |
|
| 1087 |
bool usesCustomInsertionHook(QueryType Type = IgnoreBundle) const { |
| 1088 |
return hasProperty(MCID::UsesCustomInserter, Type); |
| 1089 |
} |
| 1090 |
|
| 1091 |
|
| 1092 |
|
| 1093 |
|
| 1094 |
|
| 1095 |
bool hasPostISelHook(QueryType Type = IgnoreBundle) const { |
| 1096 |
return hasProperty(MCID::HasPostISelHook, Type); |
| 1097 |
} |
| 1098 |
|
| 1099 |
|
| 1100 |
|
| 1101 |
|
| 1102 |
|
| 1103 |
bool isRematerializable(QueryType Type = AllInBundle) const { |
| 1104 |
|
| 1105 |
|
| 1106 |
return hasProperty(MCID::Rematerializable, Type); |
| 1107 |
} |
| 1108 |
|
| 1109 |
|
| 1110 |
|
| 1111 |
|
| 1112 |
|
| 1113 |
|
| 1114 |
|
| 1115 |
bool isAsCheapAsAMove(QueryType Type = AllInBundle) const { |
| 1116 |
|
| 1117 |
return hasProperty(MCID::CheapAsAMove, Type); |
| 1118 |
} |
| 1119 |
|
| 1120 |
|
| 1121 |
|
| 1122 |
|
| 1123 |
|
| 1124 |
|
| 1125 |
|
| 1126 |
bool hasExtraSrcRegAllocReq(QueryType Type = AnyInBundle) const { |
| 1127 |
return hasProperty(MCID::ExtraSrcRegAllocReq, Type); |
| 1128 |
} |
| 1129 |
|
| 1130 |
|
| 1131 |
|
| 1132 |
|
| 1133 |
|
| 1134 |
|
| 1135 |
|
| 1136 |
bool hasExtraDefRegAllocReq(QueryType Type = AnyInBundle) const { |
| 1137 |
return hasProperty(MCID::ExtraDefRegAllocReq, Type); |
| 1138 |
} |
| 1139 |
|
| 1140 |
enum MICheckType { |
| 1141 |
CheckDefs, |
| 1142 |
CheckKillDead, |
| 1143 |
IgnoreDefs, |
| 1144 |
IgnoreVRegDefs |
| 1145 |
}; |
| 1146 |
|
| 1147 |
|
| 1148 |
|
| 1149 |
|
| 1150 |
|
| 1151 |
|
| 1152 |
bool isIdenticalTo(const MachineInstr &Other, |
| 1153 |
MICheckType Check = CheckDefs) const; |
| 1154 |
|
| 1155 |
|
| 1156 |
|
| 1157 |
|
| 1158 |
|
| 1159 |
|
| 1160 |
MachineInstr *removeFromParent(); |
| 1161 |
|
| 1162 |
|
| 1163 |
|
| 1164 |
|
| 1165 |
|
| 1166 |
|
| 1167 |
MachineInstr *removeFromBundle(); |
| 1168 |
|
| 1169 |
|
| 1170 |
|
| 1171 |
|
| 1172 |
|
| 1173 |
|
| 1174 |
void eraseFromParent(); |
| 1175 |
|
| 1176 |
|
| 1177 |
|
| 1178 |
|
| 1179 |
|
| 1180 |
void eraseFromBundle(); |
| 1181 |
|
| 1182 |
bool isEHLabel() const { return getOpcode() == TargetOpcode::EH_LABEL; } |
| 1183 |
bool isGCLabel() const { return getOpcode() == TargetOpcode::GC_LABEL; } |
| 1184 |
bool isAnnotationLabel() const { |
| 1185 |
return getOpcode() == TargetOpcode::ANNOTATION_LABEL; |
| 1186 |
} |
| 1187 |
|
| 1188 |
|
| 1189 |
bool isLabel() const { |
| 1190 |
return isEHLabel() || isGCLabel() || isAnnotationLabel(); |
| 1191 |
} |
| 1192 |
|
| 1193 |
bool isCFIInstruction() const { |
| 1194 |
return getOpcode() == TargetOpcode::CFI_INSTRUCTION; |
| 1195 |
} |
| 1196 |
|
| 1197 |
bool isPseudoProbe() const { |
| 1198 |
return getOpcode() == TargetOpcode::PSEUDO_PROBE; |
| 1199 |
} |
| 1200 |
|
| 1201 |
|
| 1202 |
bool isPosition() const { return isLabel() || isCFIInstruction(); } |
| 1203 |
|
| 1204 |
bool isNonListDebugValue() const { |
| 1205 |
return getOpcode() == TargetOpcode::DBG_VALUE; |
| 1206 |
} |
| 1207 |
bool isDebugValueList() const { |
| 1208 |
return getOpcode() == TargetOpcode::DBG_VALUE_LIST; |
| 1209 |
} |
| 1210 |
bool isDebugValue() const { |
| 1211 |
return isNonListDebugValue() || isDebugValueList(); |
| 1212 |
} |
| 1213 |
bool isDebugLabel() const { return getOpcode() == TargetOpcode::DBG_LABEL; } |
| 1214 |
bool isDebugRef() const { return getOpcode() == TargetOpcode::DBG_INSTR_REF; } |
| 1215 |
bool isDebugPHI() const { return getOpcode() == TargetOpcode::DBG_PHI; } |
| 1216 |
bool isDebugInstr() const { |
| 1217 |
return isDebugValue() || isDebugLabel() || isDebugRef() || isDebugPHI(); |
| 1218 |
} |
| 1219 |
bool isDebugOrPseudoInstr() const { |
| 1220 |
return isDebugInstr() || isPseudoProbe(); |
| 1221 |
} |
| 1222 |
|
| 1223 |
bool isDebugOffsetImm() const { |
| 1224 |
return isNonListDebugValue() && getDebugOffset().isImm(); |
| 1225 |
} |
| 1226 |
|
| 1227 |
|
| 1228 |
|
| 1229 |
bool isIndirectDebugValue() const { |
| 1230 |
return isDebugOffsetImm() && getDebugOperand(0).isReg(); |
| 1231 |
} |
| 1232 |
|
| 1233 |
|
| 1234 |
|
| 1235 |
bool isDebugEntryValue() const; |
| 1236 |
|
| 1237 |
|
| 1238 |
|
| 1239 |
bool isUndefDebugValue() const { |
| 1240 |
if (!isDebugValue()) |
| 1241 |
return false; |
| 1242 |
|
| 1243 |
for (const MachineOperand &Op : debug_operands()) |
| 1244 |
if (Op.isReg() && !Op.getReg().isValid()) |
| 1245 |
return true; |
| 1246 |
return false; |
| 1247 |
} |
| 1248 |
|
| 1249 |
bool isPHI() const { |
| 1250 |
return getOpcode() == TargetOpcode::PHI || |
| 1251 |
getOpcode() == TargetOpcode::G_PHI; |
| 1252 |
} |
| 1253 |
bool isKill() const { return getOpcode() == TargetOpcode::KILL; } |
| 1254 |
bool isImplicitDef() const { return getOpcode()==TargetOpcode::IMPLICIT_DEF; } |
| 1255 |
bool isInlineAsm() const { |
| 1256 |
return getOpcode() == TargetOpcode::INLINEASM || |
| 1257 |
getOpcode() == TargetOpcode::INLINEASM_BR; |
| 1258 |
} |
| 1259 |
|
| 1260 |
|
| 1261 |
|
| 1262 |
bool isMSInlineAsm() const { |
| 1263 |
return isInlineAsm() && getInlineAsmDialect() == InlineAsm::AD_Intel; |
| 1264 |
} |
| 1265 |
|
| 1266 |
bool isStackAligningInlineAsm() const; |
| 1267 |
InlineAsm::AsmDialect getInlineAsmDialect() const; |
| 1268 |
|
| 1269 |
bool isInsertSubreg() const { |
| 1270 |
return getOpcode() == TargetOpcode::INSERT_SUBREG; |
| 1271 |
} |
| 1272 |
|
| 1273 |
bool isSubregToReg() const { |
| 1274 |
return getOpcode() == TargetOpcode::SUBREG_TO_REG; |
| 1275 |
} |
| 1276 |
|
| 1277 |
bool isRegSequence() const { |
| 1278 |
return getOpcode() == TargetOpcode::REG_SEQUENCE; |
| 1279 |
} |
| 1280 |
|
| 1281 |
bool isBundle() const { |
| 1282 |
return getOpcode() == TargetOpcode::BUNDLE; |
| 1283 |
} |
| 1284 |
|
| 1285 |
bool isCopy() const { |
| 1286 |
return getOpcode() == TargetOpcode::COPY; |
| 1287 |
} |
| 1288 |
|
| 1289 |
bool isFullCopy() const { |
| 1290 |
return isCopy() && !getOperand(0).getSubReg() && !getOperand(1).getSubReg(); |
| 1291 |
} |
| 1292 |
|
| 1293 |
bool isExtractSubreg() const { |
| 1294 |
return getOpcode() == TargetOpcode::EXTRACT_SUBREG; |
| 1295 |
} |
| 1296 |
|
| 1297 |
|
| 1298 |
|
| 1299 |
bool isCopyLike() const { |
| 1300 |
return isCopy() || isSubregToReg(); |
| 1301 |
} |
| 1302 |
|
| 1303 |
|
| 1304 |
bool isIdentityCopy() const { |
| 1305 |
return isCopy() && getOperand(0).getReg() == getOperand(1).getReg() && |
| 1306 |
getOperand(0).getSubReg() == getOperand(1).getSubReg(); |
| 1307 |
} |
| 1308 |
|
| 1309 |
|
| 1310 |
|
| 1311 |
bool isMetaInstruction() const { |
| 1312 |
switch (getOpcode()) { |
| 1313 |
default: |
| 1314 |
return false; |
| 1315 |
case TargetOpcode::IMPLICIT_DEF: |
| 1316 |
case TargetOpcode::KILL: |
| 1317 |
case TargetOpcode::CFI_INSTRUCTION: |
| 1318 |
case TargetOpcode::EH_LABEL: |
| 1319 |
case TargetOpcode::GC_LABEL: |
| 1320 |
case TargetOpcode::DBG_VALUE: |
| 1321 |
case TargetOpcode::DBG_VALUE_LIST: |
| 1322 |
case TargetOpcode::DBG_INSTR_REF: |
| 1323 |
case TargetOpcode::DBG_PHI: |
| 1324 |
case TargetOpcode::DBG_LABEL: |
| 1325 |
case TargetOpcode::LIFETIME_START: |
| 1326 |
case TargetOpcode::LIFETIME_END: |
| 1327 |
case TargetOpcode::PSEUDO_PROBE: |
| 1328 |
case TargetOpcode::ARITH_FENCE: |
| 1329 |
return true; |
| 1330 |
} |
| 1331 |
} |
| 1332 |
|
| 1333 |
|
| 1334 |
|
| 1335 |
|
| 1336 |
bool isTransient() const { |
| 1337 |
switch (getOpcode()) { |
| 1338 |
default: |
| 1339 |
return isMetaInstruction(); |
| 1340 |
|
| 1341 |
case TargetOpcode::PHI: |
| 1342 |
case TargetOpcode::G_PHI: |
| 1343 |
case TargetOpcode::COPY: |
| 1344 |
case TargetOpcode::INSERT_SUBREG: |
| 1345 |
case TargetOpcode::SUBREG_TO_REG: |
| 1346 |
case TargetOpcode::REG_SEQUENCE: |
| 1347 |
return true; |
| 1348 |
} |
| 1349 |
} |
| 1350 |
|
| 1351 |
|
| 1352 |
|
| 1353 |
|
| 1354 |
|
| 1355 |
|
| 1356 |
unsigned getBundleSize() const; |
| 1357 |
|
| 1358 |
|
| 1359 |
|
| 1360 |
|
| 1361 |
|
| 1362 |
|
| 1363 |
bool readsRegister(Register Reg, |
| 1364 |
const TargetRegisterInfo *TRI = nullptr) const { |
| 1365 |
return findRegisterUseOperandIdx(Reg, false, TRI) != -1; |
| 1366 |
} |
| 1367 |
|
| 1368 |
|
| 1369 |
|
| 1370 |
|
| 1371 |
bool readsVirtualRegister(Register Reg) const { |
| 1372 |
return readsWritesVirtualRegister(Reg).first; |
| 1373 |
} |
| 1374 |
|
| 1375 |
|
| 1376 |
|
| 1377 |
|
| 1378 |
std::pair<bool,bool> readsWritesVirtualRegister(Register Reg, |
| 1379 |
SmallVectorImpl<unsigned> *Ops = nullptr) const; |
| 1380 |
|
| 1381 |
|
| 1382 |
|
| 1383 |
|
| 1384 |
bool killsRegister(Register Reg, |
| 1385 |
const TargetRegisterInfo *TRI = nullptr) const { |
| 1386 |
return findRegisterUseOperandIdx(Reg, true, TRI) != -1; |
| 1387 |
} |
| 1388 |
|
| 1389 |
|
| 1390 |
|
| 1391 |
|
| 1392 |
|
| 1393 |
bool definesRegister(Register Reg, |
| 1394 |
const TargetRegisterInfo *TRI = nullptr) const { |
| 1395 |
return findRegisterDefOperandIdx(Reg, false, false, TRI) != -1; |
| 1396 |
} |
| 1397 |
|
| 1398 |
|
| 1399 |
|
| 1400 |
|
| 1401 |
bool modifiesRegister(Register Reg, |
| 1402 |
const TargetRegisterInfo *TRI = nullptr) const { |
| 1403 |
return findRegisterDefOperandIdx(Reg, false, true, TRI) != -1; |
| 1404 |
} |
| 1405 |
|
| 1406 |
|
| 1407 |
|
| 1408 |
|
| 1409 |
bool registerDefIsDead(Register Reg, |
| 1410 |
const TargetRegisterInfo *TRI = nullptr) const { |
| 1411 |
return findRegisterDefOperandIdx(Reg, true, false, TRI) != -1; |
| 1412 |
} |
| 1413 |
|
| 1414 |
|
| 1415 |
|
| 1416 |
bool hasRegisterImplicitUseOperand(Register Reg) const; |
| 1417 |
|
| 1418 |
|
| 1419 |
|
| 1420 |
|
| 1421 |
int findRegisterUseOperandIdx(Register Reg, bool isKill = false, |
| 1422 |
const TargetRegisterInfo *TRI = nullptr) const; |
| 1423 |
|
| 1424 |
|
| 1425 |
|
| 1426 |
MachineOperand *findRegisterUseOperand(Register Reg, bool isKill = false, |
| 1427 |
const TargetRegisterInfo *TRI = nullptr) { |
| 1428 |
int Idx = findRegisterUseOperandIdx(Reg, isKill, TRI); |
| 1429 |
return (Idx == -1) ? nullptr : &getOperand(Idx); |
| 1430 |
} |
| 1431 |
|
| 1432 |
const MachineOperand *findRegisterUseOperand( |
| 1433 |
Register Reg, bool isKill = false, |
| 1434 |
const TargetRegisterInfo *TRI = nullptr) const { |
| 1435 |
return const_cast<MachineInstr *>(this)-> |
| 1436 |
findRegisterUseOperand(Reg, isKill, TRI); |
| 1437 |
} |
| 1438 |
|
| 1439 |
|
| 1440 |
|
| 1441 |
|
| 1442 |
|
| 1443 |
|
| 1444 |
|
| 1445 |
int findRegisterDefOperandIdx(Register Reg, |
| 1446 |
bool isDead = false, bool Overlap = false, |
| 1447 |
const TargetRegisterInfo *TRI = nullptr) const; |
| 1448 |
|
| 1449 |
|
| 1450 |
|
| 1451 |
MachineOperand * |
| 1452 |
findRegisterDefOperand(Register Reg, bool isDead = false, |
| 1453 |
bool Overlap = false, |
| 1454 |
const TargetRegisterInfo *TRI = nullptr) { |
| 1455 |
int Idx = findRegisterDefOperandIdx(Reg, isDead, Overlap, TRI); |
| 1456 |
return (Idx == -1) ? nullptr : &getOperand(Idx); |
| 1457 |
} |
| 1458 |
|
| 1459 |
const MachineOperand * |
| 1460 |
findRegisterDefOperand(Register Reg, bool isDead = false, |
| 1461 |
bool Overlap = false, |
| 1462 |
const TargetRegisterInfo *TRI = nullptr) const { |
| 1463 |
return const_cast<MachineInstr *>(this)->findRegisterDefOperand( |
| 1464 |
Reg, isDead, Overlap, TRI); |
| 1465 |
} |
| 1466 |
|
| 1467 |
|
| 1468 |
|
| 1469 |
|
| 1470 |
int findFirstPredOperandIdx() const; |
| 1471 |
|
| 1472 |
|
| 1473 |
|
| 1474 |
|
| 1475 |
|
| 1476 |
|
| 1477 |
|
| 1478 |
int findInlineAsmFlagIdx(unsigned OpIdx, unsigned *GroupNo = nullptr) const; |
| 1479 |
|
| 1480 |
|
| 1481 |
|
| 1482 |
|
| 1483 |
|
| 1484 |
|
| 1485 |
|
| 1486 |
const TargetRegisterClass* |
| 1487 |
getRegClassConstraint(unsigned OpIdx, |
| 1488 |
const TargetInstrInfo *TII, |
| 1489 |
const TargetRegisterInfo *TRI) const; |
| 1490 |
|
| 1491 |
|
| 1492 |
|
| 1493 |
|
| 1494 |
|
| 1495 |
|
| 1496 |
|
| 1497 |
|
| 1498 |
|
| 1499 |
|
| 1500 |
|
| 1501 |
|
| 1502 |
|
| 1503 |
const TargetRegisterClass *getRegClassConstraintEffectForVReg( |
| 1504 |
Register Reg, const TargetRegisterClass *CurRC, |
| 1505 |
const TargetInstrInfo *TII, const TargetRegisterInfo *TRI, |
| 1506 |
bool ExploreBundle = false) const; |
| 1507 |
|
| 1508 |
|
| 1509 |
|
| 1510 |
|
| 1511 |
|
| 1512 |
|
| 1513 |
|
| 1514 |
|
| 1515 |
|
| 1516 |
|
| 1517 |
const TargetRegisterClass * |
| 1518 |
getRegClassConstraintEffect(unsigned OpIdx, const TargetRegisterClass *CurRC, |
| 1519 |
const TargetInstrInfo *TII, |
| 1520 |
const TargetRegisterInfo *TRI) const; |
| 1521 |
|
| 1522 |
|
| 1523 |
|
| 1524 |
|
| 1525 |
|
| 1526 |
|
| 1527 |
|
| 1528 |
void tieOperands(unsigned DefIdx, unsigned UseIdx); |
| 1529 |
|
| 1530 |
|
| 1531 |
|
| 1532 |
|
| 1533 |
unsigned findTiedOperandIdx(unsigned OpIdx) const; |
| 1534 |
|
| 1535 |
|
| 1536 |
|
| 1537 |
|
| 1538 |
|
| 1539 |
bool isRegTiedToUseOperand(unsigned DefOpIdx, |
| 1540 |
unsigned *UseOpIdx = nullptr) const { |
| 1541 |
const MachineOperand &MO = getOperand(DefOpIdx); |
| 1542 |
if (!MO.isReg() || !MO.isDef() || !MO.isTied()) |
| 1543 |
return false; |
| 1544 |
if (UseOpIdx) |
| 1545 |
*UseOpIdx = findTiedOperandIdx(DefOpIdx); |
| 1546 |
return true; |
| 1547 |
} |
| 1548 |
|
| 1549 |
|
| 1550 |
|
| 1551 |
|
| 1552 |
bool isRegTiedToDefOperand(unsigned UseOpIdx, |
| 1553 |
unsigned *DefOpIdx = nullptr) const { |
| 1554 |
const MachineOperand &MO = getOperand(UseOpIdx); |
| 1555 |
if (!MO.isReg() || !MO.isUse() || !MO.isTied()) |
| 1556 |
return false; |
| 1557 |
if (DefOpIdx) |
| 1558 |
*DefOpIdx = findTiedOperandIdx(UseOpIdx); |
| 1559 |
return true; |
| 1560 |
} |
| 1561 |
|
| 1562 |
|
| 1563 |
void clearKillInfo(); |
| 1564 |
|
| 1565 |
|
| 1566 |
|
| 1567 |
void substituteRegister(Register FromReg, Register ToReg, unsigned SubIdx, |
| 1568 |
const TargetRegisterInfo &RegInfo); |
| 1569 |
|
| 1570 |
|
| 1571 |
|
| 1572 |
|
| 1573 |
|
| 1574 |
bool addRegisterKilled(Register IncomingReg, |
| 1575 |
const TargetRegisterInfo *RegInfo, |
| 1576 |
bool AddIfNotFound = false); |
| 1577 |
|
| 1578 |
|
| 1579 |
|
| 1580 |
void clearRegisterKills(Register Reg, const TargetRegisterInfo *RegInfo); |
| 1581 |
|
| 1582 |
|
| 1583 |
|
| 1584 |
|
| 1585 |
|
| 1586 |
bool addRegisterDead(Register Reg, const TargetRegisterInfo *RegInfo, |
| 1587 |
bool AddIfNotFound = false); |
| 1588 |
|
| 1589 |
|
| 1590 |
void clearRegisterDeads(Register Reg); |
| 1591 |
|
| 1592 |
|
| 1593 |
|
| 1594 |
|
| 1595 |
void setRegisterDefReadUndef(Register Reg, bool IsUndef = true); |
| 1596 |
|
| 1597 |
|
| 1598 |
|
| 1599 |
void addRegisterDefined(Register Reg, |
| 1600 |
const TargetRegisterInfo *RegInfo = nullptr); |
| 1601 |
|
| 1602 |
|
| 1603 |
|
| 1604 |
|
| 1605 |
|
| 1606 |
|
| 1607 |
void setPhysRegsDeadExcept(ArrayRef<Register> UsedRegs, |
| 1608 |
const TargetRegisterInfo &TRI); |
| 1609 |
|
| 1610 |
|
| 1611 |
|
| 1612 |
|
| 1613 |
bool isSafeToMove(AAResults *AA, bool &SawStore) const; |
| 1614 |
|
| 1615 |
|
| 1616 |
|
| 1617 |
|
| 1618 |
|
| 1619 |
|
| 1620 |
|
| 1621 |
|
| 1622 |
|
| 1623 |
|
| 1624 |
|
| 1625 |
bool mayAlias(AAResults *AA, const MachineInstr &Other, bool UseTBAA) const; |
| 1626 |
|
| 1627 |
|
| 1628 |
|
| 1629 |
|
| 1630 |
|
| 1631 |
bool hasOrderedMemoryRef() const; |
| 1632 |
|
| 1633 |
|
| 1634 |
|
| 1635 |
|
| 1636 |
|
| 1637 |
|
| 1638 |
|
| 1639 |
|
| 1640 |
bool isDereferenceableInvariantLoad(AAResults *AA) const; |
| 1641 |
|
| 1642 |
|
| 1643 |
|
| 1644 |
unsigned isConstantValuePHI() const; |
| 1645 |
|
| 1646 |
|
| 1647 |
|
| 1648 |
|
| 1649 |
|
| 1650 |
|
| 1651 |
|
| 1652 |
|
| 1653 |
bool hasUnmodeledSideEffects() const; |
| 1654 |
|
| 1655 |
|
| 1656 |
bool isLoadFoldBarrier() const; |
| 1657 |
|
| 1658 |
|
| 1659 |
bool allDefsAreDead() const; |
| 1660 |
|
| 1661 |
|
| 1662 |
Optional<unsigned> getSpillSize(const TargetInstrInfo *TII) const; |
| 1663 |
|
| 1664 |
|
| 1665 |
Optional<unsigned> getFoldedSpillSize(const TargetInstrInfo *TII) const; |
| 1666 |
|
| 1667 |
|
| 1668 |
Optional<unsigned> getRestoreSize(const TargetInstrInfo *TII) const; |
| 1669 |
|
| 1670 |
|
| 1671 |
Optional<unsigned> |
| 1672 |
getFoldedRestoreSize(const TargetInstrInfo *TII) const; |
| 1673 |
|
| 1674 |
|
| 1675 |
|
| 1676 |
void copyImplicitOps(MachineFunction &MF, const MachineInstr &MI); |
| 1677 |
|
| 1678 |
|
| 1679 |
|
| 1680 |
|
| 1681 |
LLT getTypeToPrint(unsigned OpIdx, SmallBitVector &PrintedTypes, |
| 1682 |
const MachineRegisterInfo &MRI) const; |
| 1683 |
|
| 1684 |
|
| 1685 |
|
| 1686 |
|
| 1687 |
bool hasComplexRegisterTies() const; |
| 1688 |
|
| 1689 |
|
| 1690 |
|
| 1691 |
|
| 1692 |
|
| 1693 |
|
| 1694 |
|
| 1695 |
|
| 1696 |
|
| 1697 |
|
| 1698 |
void print(raw_ostream &OS, bool IsStandalone = true, bool SkipOpers = false, |
| 1699 |
bool SkipDebugLoc = false, bool AddNewLine = true, |
| 1700 |
const TargetInstrInfo *TII = nullptr) const; |
| 1701 |
void print(raw_ostream &OS, ModuleSlotTracker &MST, bool IsStandalone = true, |
| 1702 |
bool SkipOpers = false, bool SkipDebugLoc = false, |
| 1703 |
bool AddNewLine = true, |
| 1704 |
const TargetInstrInfo *TII = nullptr) const; |
| 1705 |
void dump() const; |
| 1706 |
|
| 1707 |
|
| 1708 |
void dumpr(const MachineRegisterInfo &MRI, |
| 1709 |
unsigned MaxDepth = UINT_MAX) const; |
| 1710 |
|
| 1711 |
|
| 1712 |
|
| 1713 |
|
| 1714 |
|
| 1715 |
|
| 1716 |
|
| 1717 |
|
| 1718 |
|
| 1719 |
|
| 1720 |
|
| 1721 |
|
| 1722 |
|
| 1723 |
|
| 1724 |
|
| 1725 |
void addOperand(MachineFunction &MF, const MachineOperand &Op); |
| 1726 |
|
| 1727 |
|
| 1728 |
|
| 1729 |
|
| 1730 |
|
| 1731 |
|
| 1732 |
void addOperand(const MachineOperand &Op); |
| 1733 |
|
| 1734 |
|
| 1735 |
|
| 1736 |
void setDesc(const MCInstrDesc &TID) { MCID = &TID; } |
| 1737 |
|
| 1738 |
|
| 1739 |
|
| 1740 |
void setDebugLoc(DebugLoc DL) { |
| 1741 |
DbgLoc = std::move(DL); |
| 1742 |
assert(DbgLoc.hasTrivialDestructor() && "Expected trivial destructor"); |
| 1743 |
} |
| 1744 |
|
| 1745 |
|
| 1746 |
|
| 1747 |
void RemoveOperand(unsigned OpNo); |
| 1748 |
|
| 1749 |
|
| 1750 |
|
| 1751 |
|
| 1752 |
|
| 1753 |
void dropMemRefs(MachineFunction &MF); |
| 1754 |
|
| 1755 |
|
| 1756 |
|
| 1757 |
|
| 1758 |
|
| 1759 |
void setMemRefs(MachineFunction &MF, ArrayRef<MachineMemOperand *> MemRefs); |
| 1760 |
|
| 1761 |
|
| 1762 |
|
| 1763 |
|
| 1764 |
void addMemOperand(MachineFunction &MF, MachineMemOperand *MO); |
| 1765 |
|
| 1766 |
|
| 1767 |
|
| 1768 |
|
| 1769 |
|
| 1770 |
|
| 1771 |
|
| 1772 |
|
| 1773 |
void cloneMemRefs(MachineFunction &MF, const MachineInstr &MI); |
| 1774 |
|
| 1775 |
|
| 1776 |
|
| 1777 |
|
| 1778 |
|
| 1779 |
|
| 1780 |
|
| 1781 |
|
| 1782 |
void cloneMergedMemRefs(MachineFunction &MF, |
| 1783 |
ArrayRef<const MachineInstr *> MIs); |
| 1784 |
|
| 1785 |
|
| 1786 |
|
| 1787 |
|
| 1788 |
|
| 1789 |
|
| 1790 |
void setPreInstrSymbol(MachineFunction &MF, MCSymbol *Symbol); |
| 1791 |
|
| 1792 |
|
| 1793 |
|
| 1794 |
|
| 1795 |
|
| 1796 |
|
| 1797 |
void setPostInstrSymbol(MachineFunction &MF, MCSymbol *Symbol); |
| 1798 |
|
| 1799 |
|
| 1800 |
|
| 1801 |
void cloneInstrSymbols(MachineFunction &MF, const MachineInstr &MI); |
| 1802 |
|
| 1803 |
|
| 1804 |
|
| 1805 |
|
| 1806 |
|
| 1807 |
void setHeapAllocMarker(MachineFunction &MF, MDNode *MD); |
| 1808 |
|
| 1809 |
|
| 1810 |
|
| 1811 |
|
| 1812 |
uint16_t mergeFlagsWith(const MachineInstr& Other) const; |
| 1813 |
|
| 1814 |
static uint16_t copyFlagsFromInstruction(const Instruction &I); |
| 1815 |
|
| 1816 |
|
| 1817 |
void copyIRFlags(const Instruction &I); |
| 1818 |
|
| 1819 |
|
| 1820 |
void untieRegOperand(unsigned OpIdx) { |
| 1821 |
MachineOperand &MO = getOperand(OpIdx); |
| 1822 |
if (MO.isReg() && MO.isTied()) { |
| 1823 |
getOperand(findTiedOperandIdx(OpIdx)).TiedTo = 0; |
| 1824 |
MO.TiedTo = 0; |
| 1825 |
} |
| 1826 |
} |
| 1827 |
|
| 1828 |
|
| 1829 |
void addImplicitDefUseOperands(MachineFunction &MF); |
| 1830 |
|
| 1831 |
|
| 1832 |
|
| 1833 |
void collectDebugValues(SmallVectorImpl<MachineInstr *> &DbgValues); |
| 1834 |
|
| 1835 |
|
| 1836 |
|
| 1837 |
void changeDebugValuesDefReg(Register Reg); |
| 1838 |
|
| 1839 |
|
| 1840 |
|
| 1841 |
unsigned getIntrinsicID() const { |
| 1842 |
return getOperand(getNumExplicitDefs()).getIntrinsicID(); |
| 1843 |
} |
| 1844 |
|
| 1845 |
|
| 1846 |
|
| 1847 |
void setDebugValueUndef() { |
| 1848 |
assert(isDebugValue() && "Must be a debug value instruction."); |
| 1849 |
for (MachineOperand &MO : debug_operands()) { |
| 1850 |
if (MO.isReg()) { |
| 1851 |
MO.setReg(0); |
| 1852 |
MO.setSubReg(0); |
| 1853 |
} |
| 1854 |
} |
| 1855 |
} |
| 1856 |
|
| 1857 |
private: |
| 1858 |
|
| 1859 |
|
| 1860 |
|
| 1861 |
MachineRegisterInfo *getRegInfo(); |
| 1862 |
|
| 1863 |
|
| 1864 |
|
| 1865 |
|
| 1866 |
void RemoveRegOperandsFromUseLists(MachineRegisterInfo&); |
| 1867 |
|
| 1868 |
|
| 1869 |
|
| 1870 |
|
| 1871 |
void AddRegOperandsToUseLists(MachineRegisterInfo&); |
| 1872 |
|
| 1873 |
|
| 1874 |
bool hasPropertyInBundle(uint64_t Mask, QueryType Type) const; |
| 1875 |
|
| 1876 |
|
| 1877 |
|
| 1878 |
|
| 1879 |
const TargetRegisterClass *getRegClassConstraintEffectForVRegImpl( |
| 1880 |
unsigned OpIdx, Register Reg, const TargetRegisterClass *CurRC, |
| 1881 |
const TargetInstrInfo *TII, const TargetRegisterInfo *TRI) const; |
| 1882 |
|
| 1883 |
|
| 1884 |
|
| 1885 |
void setExtraInfo(MachineFunction &MF, ArrayRef<MachineMemOperand *> MMOs, |
| 1886 |
MCSymbol *PreInstrSymbol, MCSymbol *PostInstrSymbol, |
| 1887 |
MDNode *HeapAllocMarker); |
| 1888 |
}; |
| 1889 |
|
| 1890 |
|
| 1891 |
|
| 1892 |
|
| 1893 |
|
| 1894 |
struct MachineInstrExpressionTrait : DenseMapInfo<MachineInstr*> { |
| 1895 |
static inline MachineInstr *getEmptyKey() { |
| 1896 |
return nullptr; |
| 1897 |
} |
| 1898 |
|
| 1899 |
static inline MachineInstr *getTombstoneKey() { |
| 1900 |
return reinterpret_cast<MachineInstr*>(-1); |
| 1901 |
} |
| 1902 |
|
| 1903 |
static unsigned getHashValue(const MachineInstr* const &MI); |
| 1904 |
|
| 1905 |
static bool isEqual(const MachineInstr* const &LHS, |
| 1906 |
const MachineInstr* const &RHS) { |
| 1907 |
if (RHS == getEmptyKey() || RHS == getTombstoneKey() || |
| 1908 |
LHS == getEmptyKey() || LHS == getTombstoneKey()) |
| 1909 |
return LHS == RHS; |
| 1910 |
return LHS->isIdenticalTo(*RHS, MachineInstr::IgnoreVRegDefs); |
| 1911 |
} |
| 1912 |
}; |
| 1913 |
|
| 1914 |
|
| 1915 |
|
| 1916 |
|
| 1917 |
inline raw_ostream& operator<<(raw_ostream &OS, const MachineInstr &MI) { |
| 1918 |
MI.print(OS); |
| 1919 |
return OS; |
| 1920 |
} |
| 1921 |
|
| 1922 |
} |
| 1923 |
|
| 1924 |
#endif |