| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#ifndef LLVM_CODEGEN_MACHINEFUNCTION_H |
| 18 |
#define LLVM_CODEGEN_MACHINEFUNCTION_H |
| 19 |
|
| 20 |
#include "llvm/ADT/ArrayRef.h" |
| 21 |
#include "llvm/ADT/BitVector.h" |
| 22 |
#include "llvm/ADT/DenseMap.h" |
| 23 |
#include "llvm/ADT/GraphTraits.h" |
| 24 |
#include "llvm/ADT/SmallVector.h" |
| 25 |
#include "llvm/ADT/ilist.h" |
| 26 |
#include "llvm/ADT/iterator.h" |
| 27 |
#include "llvm/Analysis/EHPersonalities.h" |
| 28 |
#include "llvm/CodeGen/MachineBasicBlock.h" |
| 29 |
#include "llvm/CodeGen/MachineInstr.h" |
| 30 |
#include "llvm/CodeGen/MachineMemOperand.h" |
| 31 |
#include "llvm/Support/Allocator.h" |
| 32 |
#include "llvm/Support/ArrayRecycler.h" |
| 33 |
#include "llvm/Support/AtomicOrdering.h" |
| 34 |
#include "llvm/Support/Compiler.h" |
| 35 |
#include "llvm/Support/Recycler.h" |
| 36 |
#include "llvm/Target/TargetOptions.h" |
| 37 |
#include <cassert> |
| 38 |
#include <cstdint> |
| 39 |
#include <memory> |
| 40 |
#include <utility> |
| 41 |
#include <vector> |
| 42 |
|
| 43 |
namespace llvm { |
| 44 |
|
| 45 |
class BasicBlock; |
| 46 |
class BlockAddress; |
| 47 |
class DataLayout; |
| 48 |
class DebugLoc; |
| 49 |
struct DenormalMode; |
| 50 |
class DIExpression; |
| 51 |
class DILocalVariable; |
| 52 |
class DILocation; |
| 53 |
class Function; |
| 54 |
class GISelChangeObserver; |
| 55 |
class GlobalValue; |
| 56 |
class LLVMTargetMachine; |
| 57 |
class MachineConstantPool; |
| 58 |
class MachineFrameInfo; |
| 59 |
class MachineFunction; |
| 60 |
class MachineJumpTableInfo; |
| 61 |
class MachineModuleInfo; |
| 62 |
class MachineRegisterInfo; |
| 63 |
class MCContext; |
| 64 |
class MCInstrDesc; |
| 65 |
class MCSymbol; |
| 66 |
class MCSection; |
| 67 |
class Pass; |
| 68 |
class PseudoSourceValueManager; |
| 69 |
class raw_ostream; |
| 70 |
class SlotIndexes; |
| 71 |
class StringRef; |
| 72 |
class TargetRegisterClass; |
| 73 |
class TargetSubtargetInfo; |
| 74 |
struct WasmEHFuncInfo; |
| 75 |
struct WinEHFuncInfo; |
| 76 |
|
| 77 |
template <> struct ilist_alloc_traits<MachineBasicBlock> { |
| 78 |
void deleteNode(MachineBasicBlock *MBB); |
| 79 |
}; |
| 80 |
|
| 81 |
template <> struct ilist_callback_traits<MachineBasicBlock> { |
| 82 |
void addNodeToList(MachineBasicBlock* N); |
| 83 |
void removeNodeFromList(MachineBasicBlock* N); |
| 84 |
|
| 85 |
template <class Iterator> |
| 86 |
void transferNodesFromList(ilist_callback_traits &OldList, Iterator, Iterator) { |
| 87 |
assert(this == &OldList && "never transfer MBBs between functions"); |
| 88 |
} |
| 89 |
}; |
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
struct MachineFunctionInfo { |
| 96 |
virtual ~MachineFunctionInfo(); |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
template<typename Ty> |
| 103 |
static Ty *create(BumpPtrAllocator &Allocator, MachineFunction &MF) { |
| 104 |
return new (Allocator.Allocate<Ty>()) Ty(MF); |
| 105 |
} |
| 106 |
}; |
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
class MachineFunctionProperties { |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
public: |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
enum class Property : unsigned { |
| 162 |
IsSSA, |
| 163 |
NoPHIs, |
| 164 |
TracksLiveness, |
| 165 |
NoVRegs, |
| 166 |
FailedISel, |
| 167 |
Legalized, |
| 168 |
RegBankSelected, |
| 169 |
Selected, |
| 170 |
TiedOpsRewritten, |
| 171 |
FailsVerification, |
| 172 |
TracksDebugUserValues, |
| 173 |
LastProperty = TracksDebugUserValues, |
| 174 |
}; |
| 175 |
|
| 176 |
bool hasProperty(Property P) const { |
| 177 |
return Properties[static_cast<unsigned>(P)]; |
| 178 |
} |
| 179 |
|
| 180 |
MachineFunctionProperties &set(Property P) { |
| 181 |
Properties.set(static_cast<unsigned>(P)); |
| 182 |
return *this; |
| 183 |
} |
| 184 |
|
| 185 |
MachineFunctionProperties &reset(Property P) { |
| 186 |
Properties.reset(static_cast<unsigned>(P)); |
| 187 |
return *this; |
| 188 |
} |
| 189 |
|
| 190 |
|
| 191 |
MachineFunctionProperties &reset() { |
| 192 |
Properties.reset(); |
| 193 |
return *this; |
| 194 |
} |
| 195 |
|
| 196 |
MachineFunctionProperties &set(const MachineFunctionProperties &MFP) { |
| 197 |
Properties |= MFP.Properties; |
| 198 |
return *this; |
| 199 |
} |
| 200 |
|
| 201 |
MachineFunctionProperties &reset(const MachineFunctionProperties &MFP) { |
| 202 |
Properties.reset(MFP.Properties); |
| 203 |
return *this; |
| 204 |
} |
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
bool verifyRequiredProperties(const MachineFunctionProperties &V) const { |
| 209 |
return !V.Properties.test(Properties); |
| 210 |
} |
| 211 |
|
| 212 |
|
| 213 |
void print(raw_ostream &OS) const; |
| 214 |
|
| 215 |
private: |
| 216 |
BitVector Properties = |
| 217 |
BitVector(static_cast<unsigned>(Property::LastProperty)+1); |
| 218 |
}; |
| 219 |
|
| 220 |
struct SEHHandler { |
| 221 |
|
| 222 |
const Function *FilterOrFinally; |
| 223 |
|
| 224 |
|
| 225 |
const BlockAddress *RecoverBA; |
| 226 |
}; |
| 227 |
|
| 228 |
|
| 229 |
struct LandingPadInfo { |
| 230 |
MachineBasicBlock *LandingPadBlock; |
| 231 |
SmallVector<MCSymbol *, 1> BeginLabels; |
| 232 |
SmallVector<MCSymbol *, 1> EndLabels; |
| 233 |
SmallVector<SEHHandler, 1> SEHHandlers; |
| 234 |
MCSymbol *LandingPadLabel = nullptr; |
| 235 |
std::vector<int> TypeIds; |
| 236 |
|
| 237 |
explicit LandingPadInfo(MachineBasicBlock *MBB) |
| 238 |
: LandingPadBlock(MBB) {} |
| 239 |
}; |
| 240 |
|
| 241 |
class LLVM_EXTERNAL_VISIBILITY MachineFunction { |
| 242 |
Function &F; |
| 243 |
const LLVMTargetMachine &Target; |
| 244 |
const TargetSubtargetInfo *STI; |
| 245 |
MCContext &Ctx; |
| 246 |
MachineModuleInfo &MMI; |
| 247 |
|
| 248 |
|
| 249 |
MachineRegisterInfo *RegInfo; |
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
MachineFunctionInfo *MFInfo; |
| 254 |
|
| 255 |
|
| 256 |
MachineFrameInfo *FrameInfo; |
| 257 |
|
| 258 |
|
| 259 |
MachineConstantPool *ConstantPool; |
| 260 |
|
| 261 |
|
| 262 |
MachineJumpTableInfo *JumpTableInfo; |
| 263 |
|
| 264 |
|
| 265 |
MCSection *Section = nullptr; |
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
WasmEHFuncInfo *WasmEHInfo = nullptr; |
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
WinEHFuncInfo *WinEHInfo = nullptr; |
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
std::vector<MachineBasicBlock*> MBBNumbering; |
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
std::vector<char> BBSectionsSymbolPrefix; |
| 285 |
|
| 286 |
|
| 287 |
BumpPtrAllocator Allocator; |
| 288 |
|
| 289 |
|
| 290 |
Recycler<MachineInstr> InstructionRecycler; |
| 291 |
|
| 292 |
|
| 293 |
ArrayRecycler<MachineOperand> OperandRecycler; |
| 294 |
|
| 295 |
|
| 296 |
Recycler<MachineBasicBlock> BasicBlockRecycler; |
| 297 |
|
| 298 |
|
| 299 |
using BasicBlockListType = ilist<MachineBasicBlock>; |
| 300 |
BasicBlockListType BasicBlocks; |
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
unsigned FunctionNumber; |
| 306 |
|
| 307 |
|
| 308 |
Align Alignment; |
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
bool ExposesReturnsTwice = false; |
| 316 |
|
| 317 |
|
| 318 |
bool HasInlineAsm = false; |
| 319 |
|
| 320 |
|
| 321 |
bool HasWinCFI = false; |
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
MachineFunctionProperties Properties; |
| 326 |
|
| 327 |
|
| 328 |
std::unique_ptr<PseudoSourceValueManager> PSVManager; |
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
std::vector<MCCFIInstruction> FrameInstructions; |
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
std::vector<MCSymbol *> LongjmpTargets; |
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
std::vector<MCSymbol *> CatchretTargets; |
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
std::vector<LandingPadInfo> LandingPads; |
| 347 |
|
| 348 |
|
| 349 |
DenseMap<MCSymbol*, SmallVector<unsigned, 4>> LPadToCallSiteMap; |
| 350 |
|
| 351 |
|
| 352 |
DenseMap<const MachineBasicBlock *, unsigned> WasmLPadToIndexMap; |
| 353 |
|
| 354 |
|
| 355 |
DenseMap<MCSymbol*, unsigned> CallSiteMap; |
| 356 |
|
| 357 |
|
| 358 |
std::vector<std::pair<MCSymbol *, MDNode *>> CodeViewAnnotations; |
| 359 |
|
| 360 |
bool CallsEHReturn = false; |
| 361 |
bool CallsUnwindInit = false; |
| 362 |
bool HasEHCatchret = false; |
| 363 |
bool HasEHScopes = false; |
| 364 |
bool HasEHFunclets = false; |
| 365 |
|
| 366 |
|
| 367 |
BasicBlockSection BBSectionsType = BasicBlockSection::None; |
| 368 |
|
| 369 |
|
| 370 |
std::vector<const GlobalValue *> TypeInfos; |
| 371 |
|
| 372 |
|
| 373 |
std::vector<unsigned> FilterIds; |
| 374 |
|
| 375 |
|
| 376 |
std::vector<unsigned> FilterEnds; |
| 377 |
|
| 378 |
EHPersonality PersonalityTypeCache = EHPersonality::Unknown; |
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
void clear(); |
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
void init(); |
| 392 |
|
| 393 |
public: |
| 394 |
struct VariableDbgInfo { |
| 395 |
const DILocalVariable *Var; |
| 396 |
const DIExpression *Expr; |
| 397 |
|
| 398 |
int Slot; |
| 399 |
const DILocation *Loc; |
| 400 |
|
| 401 |
VariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, |
| 402 |
int Slot, const DILocation *Loc) |
| 403 |
: Var(Var), Expr(Expr), Slot(Slot), Loc(Loc) {} |
| 404 |
}; |
| 405 |
|
| 406 |
class Delegate { |
| 407 |
virtual void anchor(); |
| 408 |
|
| 409 |
public: |
| 410 |
virtual ~Delegate() = default; |
| 411 |
|
| 412 |
virtual void MF_HandleInsertion(MachineInstr &MI) = 0; |
| 413 |
|
| 414 |
virtual void MF_HandleRemoval(MachineInstr &MI) = 0; |
| 415 |
}; |
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
struct ArgRegPair { |
| 422 |
Register Reg; |
| 423 |
uint16_t ArgNo; |
| 424 |
ArgRegPair(Register R, unsigned Arg) : Reg(R), ArgNo(Arg) { |
| 425 |
assert(Arg < (1 << 16) && "Arg out of range"); |
| 426 |
} |
| 427 |
}; |
| 428 |
|
| 429 |
using CallSiteInfo = SmallVector<ArgRegPair, 1>; |
| 430 |
using CallSiteInfoImpl = SmallVectorImpl<ArgRegPair>; |
| 431 |
|
| 432 |
private: |
| 433 |
Delegate *TheDelegate = nullptr; |
| 434 |
GISelChangeObserver *Observer = nullptr; |
| 435 |
|
| 436 |
using CallSiteInfoMap = DenseMap<const MachineInstr *, CallSiteInfo>; |
| 437 |
|
| 438 |
CallSiteInfoMap CallSitesInfo; |
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
CallSiteInfoMap::iterator getCallSiteInfo(const MachineInstr *MI); |
| 443 |
|
| 444 |
|
| 445 |
void handleInsertion(MachineInstr &MI); |
| 446 |
void handleRemoval(MachineInstr &MI); |
| 447 |
friend struct ilist_traits<MachineInstr>; |
| 448 |
|
| 449 |
public: |
| 450 |
using VariableDbgInfoMapTy = SmallVector<VariableDbgInfo, 4>; |
| 451 |
VariableDbgInfoMapTy VariableDbgInfos; |
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
unsigned DebugInstrNumberingCount = 0; |
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
void setDebugInstrNumberingCount(unsigned Num); |
| 461 |
|
| 462 |
|
| 463 |
using DebugInstrOperandPair = std::pair<unsigned, unsigned>; |
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
class DebugSubstitution { |
| 475 |
public: |
| 476 |
DebugInstrOperandPair Src; |
| 477 |
DebugInstrOperandPair Dest; |
| 478 |
unsigned Subreg; |
| 479 |
|
| 480 |
DebugSubstitution(const DebugInstrOperandPair &Src, |
| 481 |
const DebugInstrOperandPair &Dest, unsigned Subreg) |
| 482 |
: Src(Src), Dest(Dest), Subreg(Subreg) {} |
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
bool operator<(const DebugSubstitution &Other) const { |
| 487 |
return Src < Other.Src; |
| 488 |
} |
| 489 |
}; |
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
SmallVector<DebugSubstitution, 8> DebugValueSubstitutions; |
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
|
| 501 |
|
| 502 |
class DebugPHIRegallocPos { |
| 503 |
public: |
| 504 |
MachineBasicBlock *MBB; |
| 505 |
Register Reg; |
| 506 |
unsigned SubReg; |
| 507 |
DebugPHIRegallocPos(MachineBasicBlock *MBB, Register Reg, unsigned SubReg) |
| 508 |
: MBB(MBB), Reg(Reg), SubReg(SubReg) {} |
| 509 |
}; |
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
DenseMap<unsigned, DebugPHIRegallocPos> DebugPHIPositions; |
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
void makeDebugValueSubstitution(DebugInstrOperandPair, DebugInstrOperandPair, |
| 518 |
unsigned SubReg = 0); |
| 519 |
|
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
void substituteDebugValuesForInst(const MachineInstr &Old, MachineInstr &New, |
| 529 |
unsigned MaxOperand = UINT_MAX); |
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
DebugInstrOperandPair salvageCopySSA(MachineInstr &MI); |
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
void finalizeDebugInstrRefs(); |
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
bool useDebugInstrRef() const; |
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
const static unsigned int DebugOperandMemNumber; |
| 557 |
|
| 558 |
MachineFunction(Function &F, const LLVMTargetMachine &Target, |
| 559 |
const TargetSubtargetInfo &STI, unsigned FunctionNum, |
| 560 |
MachineModuleInfo &MMI); |
| 561 |
MachineFunction(const MachineFunction &) = delete; |
| 562 |
MachineFunction &operator=(const MachineFunction &) = delete; |
| 563 |
~MachineFunction(); |
| 564 |
|
| 565 |
|
| 566 |
void reset() { |
| 567 |
clear(); |
| 568 |
init(); |
| 569 |
} |
| 570 |
|
| 571 |
|
| 572 |
void resetDelegate(Delegate *delegate) { |
| 573 |
assert(TheDelegate == delegate && |
| 574 |
"Only the current delegate can perform reset!"); |
| 575 |
TheDelegate = nullptr; |
| 576 |
} |
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
void setDelegate(Delegate *delegate) { |
| 581 |
assert(delegate && !TheDelegate && |
| 582 |
"Attempted to set delegate to null, or to change it without " |
| 583 |
"first resetting it!"); |
| 584 |
|
| 585 |
TheDelegate = delegate; |
| 586 |
} |
| 587 |
|
| 588 |
void setObserver(GISelChangeObserver *O) { Observer = O; } |
| 589 |
|
| 590 |
GISelChangeObserver *getObserver() const { return Observer; } |
| 591 |
|
| 592 |
MachineModuleInfo &getMMI() const { return MMI; } |
| 593 |
MCContext &getContext() const { return Ctx; } |
| 594 |
|
| 595 |
|
| 596 |
MCSection *getSection() const { return Section; } |
| 597 |
|
| 598 |
|
| 599 |
void setSection(MCSection *S) { Section = S; } |
| 600 |
|
| 601 |
PseudoSourceValueManager &getPSVManager() const { return *PSVManager; } |
| 602 |
|
| 603 |
|
| 604 |
const DataLayout &getDataLayout() const; |
| 605 |
|
| 606 |
|
| 607 |
Function &getFunction() { return F; } |
| 608 |
|
| 609 |
|
| 610 |
const Function &getFunction() const { return F; } |
| 611 |
|
| 612 |
|
| 613 |
StringRef getName() const; |
| 614 |
|
| 615 |
|
| 616 |
unsigned getFunctionNumber() const { return FunctionNumber; } |
| 617 |
|
| 618 |
|
| 619 |
bool hasBBSections() const { |
| 620 |
return (BBSectionsType == BasicBlockSection::All || |
| 621 |
BBSectionsType == BasicBlockSection::List || |
| 622 |
BBSectionsType == BasicBlockSection::Preset); |
| 623 |
} |
| 624 |
|
| 625 |
|
| 626 |
bool hasBBLabels() const { |
| 627 |
return BBSectionsType == BasicBlockSection::Labels; |
| 628 |
} |
| 629 |
|
| 630 |
void setBBSectionsType(BasicBlockSection V) { BBSectionsType = V; } |
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
void assignBeginEndSections(); |
| 635 |
|
| 636 |
|
| 637 |
const LLVMTargetMachine &getTarget() const { return Target; } |
| 638 |
|
| 639 |
|
| 640 |
|
| 641 |
const TargetSubtargetInfo &getSubtarget() const { return *STI; } |
| 642 |
|
| 643 |
|
| 644 |
|
| 645 |
|
| 646 |
template<typename STC> const STC &getSubtarget() const { |
| 647 |
return *static_cast<const STC *>(STI); |
| 648 |
} |
| 649 |
|
| 650 |
|
| 651 |
MachineRegisterInfo &getRegInfo() { return *RegInfo; } |
| 652 |
const MachineRegisterInfo &getRegInfo() const { return *RegInfo; } |
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
MachineFrameInfo &getFrameInfo() { return *FrameInfo; } |
| 658 |
const MachineFrameInfo &getFrameInfo() const { return *FrameInfo; } |
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
const MachineJumpTableInfo *getJumpTableInfo() const { return JumpTableInfo; } |
| 665 |
MachineJumpTableInfo *getJumpTableInfo() { return JumpTableInfo; } |
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
MachineJumpTableInfo *getOrCreateJumpTableInfo(unsigned JTEntryKind); |
| 670 |
|
| 671 |
|
| 672 |
|
| 673 |
MachineConstantPool *getConstantPool() { return ConstantPool; } |
| 674 |
const MachineConstantPool *getConstantPool() const { return ConstantPool; } |
| 675 |
|
| 676 |
|
| 677 |
|
| 678 |
|
| 679 |
const WasmEHFuncInfo *getWasmEHFuncInfo() const { return WasmEHInfo; } |
| 680 |
WasmEHFuncInfo *getWasmEHFuncInfo() { return WasmEHInfo; } |
| 681 |
|
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
const WinEHFuncInfo *getWinEHFuncInfo() const { return WinEHInfo; } |
| 686 |
WinEHFuncInfo *getWinEHFuncInfo() { return WinEHInfo; } |
| 687 |
|
| 688 |
|
| 689 |
Align getAlignment() const { return Alignment; } |
| 690 |
|
| 691 |
|
| 692 |
void setAlignment(Align A) { Alignment = A; } |
| 693 |
|
| 694 |
|
| 695 |
void ensureAlignment(Align A) { |
| 696 |
if (Alignment < A) |
| 697 |
Alignment = A; |
| 698 |
} |
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
bool exposesReturnsTwice() const { |
| 704 |
return ExposesReturnsTwice; |
| 705 |
} |
| 706 |
|
| 707 |
|
| 708 |
|
| 709 |
void setExposesReturnsTwice(bool B) { |
| 710 |
ExposesReturnsTwice = B; |
| 711 |
} |
| 712 |
|
| 713 |
|
| 714 |
bool hasInlineAsm() const { |
| 715 |
return HasInlineAsm; |
| 716 |
} |
| 717 |
|
| 718 |
|
| 719 |
void setHasInlineAsm(bool B) { |
| 720 |
HasInlineAsm = B; |
| 721 |
} |
| 722 |
|
| 723 |
bool hasWinCFI() const { |
| 724 |
return HasWinCFI; |
| 725 |
} |
| 726 |
void setHasWinCFI(bool v) { HasWinCFI = v; } |
| 727 |
|
| 728 |
|
| 729 |
bool needsFrameMoves() const; |
| 730 |
|
| 731 |
|
| 732 |
const MachineFunctionProperties &getProperties() const { return Properties; } |
| 733 |
MachineFunctionProperties &getProperties() { return Properties; } |
| 734 |
|
| 735 |
|
| 736 |
|
| 737 |
|
| 738 |
template<typename Ty> |
| 739 |
Ty *getInfo() { |
| 740 |
if (!MFInfo) |
| 741 |
MFInfo = Ty::template create<Ty>(Allocator, *this); |
| 742 |
return static_cast<Ty*>(MFInfo); |
| 743 |
} |
| 744 |
|
| 745 |
template<typename Ty> |
| 746 |
const Ty *getInfo() const { |
| 747 |
return const_cast<MachineFunction*>(this)->getInfo<Ty>(); |
| 748 |
} |
| 749 |
|
| 750 |
|
| 751 |
|
| 752 |
DenormalMode getDenormalMode(const fltSemantics &FPType) const; |
| 753 |
|
| 754 |
|
| 755 |
|
| 756 |
|
| 757 |
|
| 758 |
MachineBasicBlock *getBlockNumbered(unsigned N) const { |
| 759 |
assert(N < MBBNumbering.size() && "Illegal block number"); |
| 760 |
assert(MBBNumbering[N] && "Block was removed from the machine function!"); |
| 761 |
return MBBNumbering[N]; |
| 762 |
} |
| 763 |
|
| 764 |
|
| 765 |
bool shouldSplitStack() const; |
| 766 |
|
| 767 |
|
| 768 |
unsigned getNumBlockIDs() const { return (unsigned)MBBNumbering.size(); } |
| 769 |
|
| 770 |
|
| 771 |
|
| 772 |
|
| 773 |
|
| 774 |
|
| 775 |
void RenumberBlocks(MachineBasicBlock *MBBFrom = nullptr); |
| 776 |
|
| 777 |
|
| 778 |
|
| 779 |
void print(raw_ostream &OS, const SlotIndexes* = nullptr) const; |
| 780 |
|
| 781 |
|
| 782 |
|
| 783 |
|
| 784 |
|
| 785 |
|
| 786 |
void viewCFG() const; |
| 787 |
|
| 788 |
|
| 789 |
|
| 790 |
|
| 791 |
|
| 792 |
|
| 793 |
void viewCFGOnly() const; |
| 794 |
|
| 795 |
|
| 796 |
void dump() const; |
| 797 |
|
| 798 |
|
| 799 |
|
| 800 |
|
| 801 |
bool verify(Pass *p = nullptr, const char *Banner = nullptr, |
| 802 |
bool AbortOnError = true) const; |
| 803 |
|
| 804 |
|
| 805 |
using iterator = BasicBlockListType::iterator; |
| 806 |
using const_iterator = BasicBlockListType::const_iterator; |
| 807 |
using const_reverse_iterator = BasicBlockListType::const_reverse_iterator; |
| 808 |
using reverse_iterator = BasicBlockListType::reverse_iterator; |
| 809 |
|
| 810 |
|
| 811 |
static BasicBlockListType MachineFunction::* |
| 812 |
getSublistAccess(MachineBasicBlock *) { |
| 813 |
return &MachineFunction::BasicBlocks; |
| 814 |
} |
| 815 |
|
| 816 |
|
| 817 |
|
| 818 |
Register addLiveIn(MCRegister PReg, const TargetRegisterClass *RC); |
| 819 |
|
| 820 |
|
| 821 |
|
| 822 |
|
| 823 |
iterator begin() { return BasicBlocks.begin(); } |
| 824 |
const_iterator begin() const { return BasicBlocks.begin(); } |
| 825 |
iterator end () { return BasicBlocks.end(); } |
| 826 |
const_iterator end () const { return BasicBlocks.end(); } |
| 827 |
|
| 828 |
reverse_iterator rbegin() { return BasicBlocks.rbegin(); } |
| 829 |
const_reverse_iterator rbegin() const { return BasicBlocks.rbegin(); } |
| 830 |
reverse_iterator rend () { return BasicBlocks.rend(); } |
| 831 |
const_reverse_iterator rend () const { return BasicBlocks.rend(); } |
| 832 |
|
| 833 |
unsigned size() const { return (unsigned)BasicBlocks.size();} |
| 834 |
bool empty() const { return BasicBlocks.empty(); } |
| 835 |
const MachineBasicBlock &front() const { return BasicBlocks.front(); } |
| 836 |
MachineBasicBlock &front() { return BasicBlocks.front(); } |
| 837 |
const MachineBasicBlock & back() const { return BasicBlocks.back(); } |
| 838 |
MachineBasicBlock & back() { return BasicBlocks.back(); } |
| 839 |
|
| 840 |
void push_back (MachineBasicBlock *MBB) { BasicBlocks.push_back (MBB); } |
| 841 |
void push_front(MachineBasicBlock *MBB) { BasicBlocks.push_front(MBB); } |
| 842 |
void insert(iterator MBBI, MachineBasicBlock *MBB) { |
| 843 |
BasicBlocks.insert(MBBI, MBB); |
| 844 |
} |
| 845 |
void splice(iterator InsertPt, iterator MBBI) { |
| 846 |
BasicBlocks.splice(InsertPt, BasicBlocks, MBBI); |
| 847 |
} |
| 848 |
void splice(iterator InsertPt, MachineBasicBlock *MBB) { |
| 849 |
BasicBlocks.splice(InsertPt, BasicBlocks, MBB); |
| 850 |
} |
| 851 |
void splice(iterator InsertPt, iterator MBBI, iterator MBBE) { |
| 852 |
BasicBlocks.splice(InsertPt, BasicBlocks, MBBI, MBBE); |
| 853 |
} |
| 854 |
|
| 855 |
void remove(iterator MBBI) { BasicBlocks.remove(MBBI); } |
| 856 |
void remove(MachineBasicBlock *MBBI) { BasicBlocks.remove(MBBI); } |
| 857 |
void erase(iterator MBBI) { BasicBlocks.erase(MBBI); } |
| 858 |
void erase(MachineBasicBlock *MBBI) { BasicBlocks.erase(MBBI); } |
| 859 |
|
| 860 |
template <typename Comp> |
| 861 |
void sort(Comp comp) { |
| 862 |
BasicBlocks.sort(comp); |
| 863 |
} |
| 864 |
|
| 865 |
|
| 866 |
unsigned getInstructionCount() const { |
| 867 |
unsigned InstrCount = 0; |
| 868 |
for (const MachineBasicBlock &MBB : BasicBlocks) |
| 869 |
InstrCount += MBB.size(); |
| 870 |
return InstrCount; |
| 871 |
} |
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
|
| 877 |
|
| 878 |
unsigned addToMBBNumbering(MachineBasicBlock *MBB) { |
| 879 |
MBBNumbering.push_back(MBB); |
| 880 |
return (unsigned)MBBNumbering.size()-1; |
| 881 |
} |
| 882 |
|
| 883 |
|
| 884 |
|
| 885 |
|
| 886 |
void removeFromMBBNumbering(unsigned N) { |
| 887 |
assert(N < MBBNumbering.size() && "Illegal basic block #"); |
| 888 |
MBBNumbering[N] = nullptr; |
| 889 |
} |
| 890 |
|
| 891 |
|
| 892 |
|
| 893 |
MachineInstr *CreateMachineInstr(const MCInstrDesc &MCID, DebugLoc DL, |
| 894 |
bool NoImplicit = false); |
| 895 |
|
| 896 |
|
| 897 |
|
| 898 |
|
| 899 |
|
| 900 |
|
| 901 |
|
| 902 |
|
| 903 |
MachineInstr *CloneMachineInstr(const MachineInstr *Orig); |
| 904 |
|
| 905 |
|
| 906 |
|
| 907 |
|
| 908 |
|
| 909 |
|
| 910 |
MachineInstr & |
| 911 |
cloneMachineInstrBundle(MachineBasicBlock &MBB, |
| 912 |
MachineBasicBlock::iterator InsertBefore, |
| 913 |
const MachineInstr &Orig); |
| 914 |
|
| 915 |
|
| 916 |
void deleteMachineInstr(MachineInstr *MI); |
| 917 |
|
| 918 |
|
| 919 |
|
| 920 |
MachineBasicBlock *CreateMachineBasicBlock(const BasicBlock *bb = nullptr); |
| 921 |
|
| 922 |
|
| 923 |
void deleteMachineBasicBlock(MachineBasicBlock *MBB); |
| 924 |
|
| 925 |
|
| 926 |
|
| 927 |
|
| 928 |
MachineMemOperand *getMachineMemOperand( |
| 929 |
MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, |
| 930 |
Align base_alignment, const AAMDNodes &AAInfo = AAMDNodes(), |
| 931 |
const MDNode *Ranges = nullptr, SyncScope::ID SSID = SyncScope::System, |
| 932 |
AtomicOrdering Ordering = AtomicOrdering::NotAtomic, |
| 933 |
AtomicOrdering FailureOrdering = AtomicOrdering::NotAtomic); |
| 934 |
|
| 935 |
MachineMemOperand *getMachineMemOperand( |
| 936 |
MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, LLT MemTy, |
| 937 |
Align base_alignment, const AAMDNodes &AAInfo = AAMDNodes(), |
| 938 |
const MDNode *Ranges = nullptr, SyncScope::ID SSID = SyncScope::System, |
| 939 |
AtomicOrdering Ordering = AtomicOrdering::NotAtomic, |
| 940 |
AtomicOrdering FailureOrdering = AtomicOrdering::NotAtomic); |
| 941 |
|
| 942 |
|
| 943 |
|
| 944 |
|
| 945 |
|
| 946 |
MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO, |
| 947 |
int64_t Offset, LLT Ty); |
| 948 |
MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO, |
| 949 |
int64_t Offset, uint64_t Size) { |
| 950 |
return getMachineMemOperand( |
| 951 |
MMO, Offset, Size == ~UINT64_C(0) ? LLT() : LLT::scalar(8 * Size)); |
| 952 |
} |
| 953 |
|
| 954 |
|
| 955 |
|
| 956 |
|
| 957 |
|
| 958 |
MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO, |
| 959 |
const MachinePointerInfo &PtrInfo, |
| 960 |
uint64_t Size); |
| 961 |
MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO, |
| 962 |
const MachinePointerInfo &PtrInfo, |
| 963 |
LLT Ty); |
| 964 |
|
| 965 |
|
| 966 |
|
| 967 |
|
| 968 |
MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO, |
| 969 |
const AAMDNodes &AAInfo); |
| 970 |
|
| 971 |
|
| 972 |
|
| 973 |
|
| 974 |
MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO, |
| 975 |
MachineMemOperand::Flags Flags); |
| 976 |
|
| 977 |
using OperandCapacity = ArrayRecycler<MachineOperand>::Capacity; |
| 978 |
|
| 979 |
|
| 980 |
|
| 981 |
MachineOperand *allocateOperandArray(OperandCapacity Cap) { |
| 982 |
return OperandRecycler.allocate(Cap, Allocator); |
| 983 |
} |
| 984 |
|
| 985 |
|
| 986 |
|
| 987 |
|
| 988 |
void deallocateOperandArray(OperandCapacity Cap, MachineOperand *Array) { |
| 989 |
OperandRecycler.deallocate(Cap, Array); |
| 990 |
} |
| 991 |
|
| 992 |
|
| 993 |
uint32_t *allocateRegMask(); |
| 994 |
|
| 995 |
ArrayRef<int> allocateShuffleMask(ArrayRef<int> Mask); |
| 996 |
|
| 997 |
|
| 998 |
|
| 999 |
|
| 1000 |
|
| 1001 |
MachineInstr::ExtraInfo *createMIExtraInfo( |
| 1002 |
ArrayRef<MachineMemOperand *> MMOs, MCSymbol *PreInstrSymbol = nullptr, |
| 1003 |
MCSymbol *PostInstrSymbol = nullptr, MDNode *HeapAllocMarker = nullptr); |
| 1004 |
|
| 1005 |
|
| 1006 |
const char *createExternalSymbolName(StringRef Name); |
| 1007 |
|
| 1008 |
|
| 1009 |
|
| 1010 |
|
| 1011 |
|
| 1012 |
|
| 1013 |
|
| 1014 |
MCSymbol *getJTISymbol(unsigned JTI, MCContext &Ctx, |
| 1015 |
bool isLinkerPrivate = false) const; |
| 1016 |
|
| 1017 |
|
| 1018 |
|
| 1019 |
MCSymbol *getPICBaseSymbol() const; |
| 1020 |
|
| 1021 |
|
| 1022 |
|
| 1023 |
|
| 1024 |
const std::vector<MCCFIInstruction> &getFrameInstructions() const { |
| 1025 |
return FrameInstructions; |
| 1026 |
} |
| 1027 |
|
| 1028 |
LLVM_NODISCARD unsigned addFrameInst(const MCCFIInstruction &Inst); |
| 1029 |
|
| 1030 |
|
| 1031 |
|
| 1032 |
|
| 1033 |
const std::vector<MCSymbol *> &getLongjmpTargets() const { |
| 1034 |
return LongjmpTargets; |
| 1035 |
} |
| 1036 |
|
| 1037 |
|
| 1038 |
|
| 1039 |
void addLongjmpTarget(MCSymbol *Target) { LongjmpTargets.push_back(Target); } |
| 1040 |
|
| 1041 |
|
| 1042 |
|
| 1043 |
const std::vector<MCSymbol *> &getCatchretTargets() const { |
| 1044 |
return CatchretTargets; |
| 1045 |
} |
| 1046 |
|
| 1047 |
|
| 1048 |
|
| 1049 |
void addCatchretTarget(MCSymbol *Target) { |
| 1050 |
CatchretTargets.push_back(Target); |
| 1051 |
} |
| 1052 |
|
| 1053 |
|
| 1054 |
|
| 1055 |
|
| 1056 |
bool callsEHReturn() const { return CallsEHReturn; } |
| 1057 |
void setCallsEHReturn(bool b) { CallsEHReturn = b; } |
| 1058 |
|
| 1059 |
bool callsUnwindInit() const { return CallsUnwindInit; } |
| 1060 |
void setCallsUnwindInit(bool b) { CallsUnwindInit = b; } |
| 1061 |
|
| 1062 |
bool hasEHCatchret() const { return HasEHCatchret; } |
| 1063 |
void setHasEHCatchret(bool V) { HasEHCatchret = V; } |
| 1064 |
|
| 1065 |
bool hasEHScopes() const { return HasEHScopes; } |
| 1066 |
void setHasEHScopes(bool V) { HasEHScopes = V; } |
| 1067 |
|
| 1068 |
bool hasEHFunclets() const { return HasEHFunclets; } |
| 1069 |
void setHasEHFunclets(bool V) { HasEHFunclets = V; } |
| 1070 |
|
| 1071 |
|
| 1072 |
LandingPadInfo &getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad); |
| 1073 |
|
| 1074 |
|
| 1075 |
void tidyLandingPads(DenseMap<MCSymbol *, uintptr_t> *LPMap = nullptr, |
| 1076 |
bool TidyIfNoBeginLabels = true); |
| 1077 |
|
| 1078 |
|
| 1079 |
const std::vector<LandingPadInfo> &getLandingPads() const { |
| 1080 |
return LandingPads; |
| 1081 |
} |
| 1082 |
|
| 1083 |
|
| 1084 |
|
| 1085 |
void addInvoke(MachineBasicBlock *LandingPad, |
| 1086 |
MCSymbol *BeginLabel, MCSymbol *EndLabel); |
| 1087 |
|
| 1088 |
|
| 1089 |
|
| 1090 |
|
| 1091 |
MCSymbol *addLandingPad(MachineBasicBlock *LandingPad); |
| 1092 |
|
| 1093 |
|
| 1094 |
void addCatchTypeInfo(MachineBasicBlock *LandingPad, |
| 1095 |
ArrayRef<const GlobalValue *> TyInfo); |
| 1096 |
|
| 1097 |
|
| 1098 |
void addFilterTypeInfo(MachineBasicBlock *LandingPad, |
| 1099 |
ArrayRef<const GlobalValue *> TyInfo); |
| 1100 |
|
| 1101 |
|
| 1102 |
void addCleanup(MachineBasicBlock *LandingPad); |
| 1103 |
|
| 1104 |
void addSEHCatchHandler(MachineBasicBlock *LandingPad, const Function *Filter, |
| 1105 |
const BlockAddress *RecoverBA); |
| 1106 |
|
| 1107 |
void addSEHCleanupHandler(MachineBasicBlock *LandingPad, |
| 1108 |
const Function *Cleanup); |
| 1109 |
|
| 1110 |
|
| 1111 |
unsigned getTypeIDFor(const GlobalValue *TI); |
| 1112 |
|
| 1113 |
|
| 1114 |
int getFilterIDFor(std::vector<unsigned> &TyIds); |
| 1115 |
|
| 1116 |
|
| 1117 |
void setCallSiteLandingPad(MCSymbol *Sym, ArrayRef<unsigned> Sites); |
| 1118 |
|
| 1119 |
|
| 1120 |
void setWasmLandingPadIndex(const MachineBasicBlock *LPad, unsigned Index) { |
| 1121 |
WasmLPadToIndexMap[LPad] = Index; |
| 1122 |
} |
| 1123 |
|
| 1124 |
|
| 1125 |
bool hasWasmLandingPadIndex(const MachineBasicBlock *LPad) const { |
| 1126 |
return WasmLPadToIndexMap.count(LPad); |
| 1127 |
} |
| 1128 |
|
| 1129 |
|
| 1130 |
unsigned getWasmLandingPadIndex(const MachineBasicBlock *LPad) const { |
| 1131 |
assert(hasWasmLandingPadIndex(LPad)); |
| 1132 |
return WasmLPadToIndexMap.lookup(LPad); |
| 1133 |
} |
| 1134 |
|
| 1135 |
|
| 1136 |
SmallVectorImpl<unsigned> &getCallSiteLandingPad(MCSymbol *Sym) { |
| 1137 |
assert(hasCallSiteLandingPad(Sym) && |
| 1138 |
"missing call site number for landing pad!"); |
| 1139 |
return LPadToCallSiteMap[Sym]; |
| 1140 |
} |
| 1141 |
|
| 1142 |
|
| 1143 |
bool hasCallSiteLandingPad(MCSymbol *Sym) { |
| 1144 |
return !LPadToCallSiteMap[Sym].empty(); |
| 1145 |
} |
| 1146 |
|
| 1147 |
|
| 1148 |
void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site) { |
| 1149 |
CallSiteMap[BeginLabel] = Site; |
| 1150 |
} |
| 1151 |
|
| 1152 |
|
| 1153 |
unsigned getCallSiteBeginLabel(MCSymbol *BeginLabel) const { |
| 1154 |
assert(hasCallSiteBeginLabel(BeginLabel) && |
| 1155 |
"Missing call site number for EH_LABEL!"); |
| 1156 |
return CallSiteMap.lookup(BeginLabel); |
| 1157 |
} |
| 1158 |
|
| 1159 |
|
| 1160 |
bool hasCallSiteBeginLabel(MCSymbol *BeginLabel) const { |
| 1161 |
return CallSiteMap.count(BeginLabel); |
| 1162 |
} |
| 1163 |
|
| 1164 |
|
| 1165 |
void addCodeViewAnnotation(MCSymbol *Label, MDNode *MD) { |
| 1166 |
CodeViewAnnotations.push_back({Label, MD}); |
| 1167 |
} |
| 1168 |
|
| 1169 |
ArrayRef<std::pair<MCSymbol *, MDNode *>> getCodeViewAnnotations() const { |
| 1170 |
return CodeViewAnnotations; |
| 1171 |
} |
| 1172 |
|
| 1173 |
|
| 1174 |
const std::vector<const GlobalValue *> &getTypeInfos() const { |
| 1175 |
return TypeInfos; |
| 1176 |
} |
| 1177 |
|
| 1178 |
|
| 1179 |
|
| 1180 |
const std::vector<unsigned> &getFilterIds() const { |
| 1181 |
return FilterIds; |
| 1182 |
} |
| 1183 |
|
| 1184 |
|
| 1185 |
|
| 1186 |
|
| 1187 |
void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, |
| 1188 |
int Slot, const DILocation *Loc) { |
| 1189 |
VariableDbgInfos.emplace_back(Var, Expr, Slot, Loc); |
| 1190 |
} |
| 1191 |
|
| 1192 |
VariableDbgInfoMapTy &getVariableDbgInfo() { return VariableDbgInfos; } |
| 1193 |
const VariableDbgInfoMapTy &getVariableDbgInfo() const { |
| 1194 |
return VariableDbgInfos; |
| 1195 |
} |
| 1196 |
|
| 1197 |
|
| 1198 |
void addCallArgsForwardingRegs(const MachineInstr *CallI, |
| 1199 |
CallSiteInfoImpl &&CallInfo) { |
| 1200 |
assert(CallI->isCandidateForCallSiteEntry()); |
| 1201 |
bool Inserted = |
| 1202 |
CallSitesInfo.try_emplace(CallI, std::move(CallInfo)).second; |
| 1203 |
(void)Inserted; |
| 1204 |
assert(Inserted && "Call site info not unique"); |
| 1205 |
} |
| 1206 |
|
| 1207 |
const CallSiteInfoMap &getCallSitesInfo() const { |
| 1208 |
return CallSitesInfo; |
| 1209 |
} |
| 1210 |
|
| 1211 |
|
| 1212 |
|
| 1213 |
|
| 1214 |
|
| 1215 |
|
| 1216 |
void eraseCallSiteInfo(const MachineInstr *MI); |
| 1217 |
|
| 1218 |
|
| 1219 |
|
| 1220 |
void copyCallSiteInfo(const MachineInstr *Old, |
| 1221 |
const MachineInstr *New); |
| 1222 |
|
| 1223 |
const std::vector<char> &getBBSectionsSymbolPrefix() const { |
| 1224 |
return BBSectionsSymbolPrefix; |
| 1225 |
} |
| 1226 |
|
| 1227 |
|
| 1228 |
|
| 1229 |
|
| 1230 |
void moveCallSiteInfo(const MachineInstr *Old, |
| 1231 |
const MachineInstr *New); |
| 1232 |
|
| 1233 |
unsigned getNewDebugInstrNum() { |
| 1234 |
return ++DebugInstrNumberingCount; |
| 1235 |
} |
| 1236 |
}; |
| 1237 |
|
| 1238 |
|
| 1239 |
|
| 1240 |
|
| 1241 |
|
| 1242 |
|
| 1243 |
|
| 1244 |
|
| 1245 |
|
| 1246 |
|
| 1247 |
template <> struct GraphTraits<MachineFunction*> : |
| 1248 |
public GraphTraits<MachineBasicBlock*> { |
| 1249 |
static NodeRef getEntryNode(MachineFunction *F) { return &F->front(); } |
| 1250 |
|
| 1251 |
|
| 1252 |
using nodes_iterator = pointer_iterator<MachineFunction::iterator>; |
| 1253 |
|
| 1254 |
static nodes_iterator nodes_begin(MachineFunction *F) { |
| 1255 |
return nodes_iterator(F->begin()); |
| 1256 |
} |
| 1257 |
|
| 1258 |
static nodes_iterator nodes_end(MachineFunction *F) { |
| 1259 |
return nodes_iterator(F->end()); |
| 1260 |
} |
| 1261 |
|
| 1262 |
static unsigned size (MachineFunction *F) { return F->size(); } |
| 1263 |
}; |
| 1264 |
template <> struct GraphTraits<const MachineFunction*> : |
| 1265 |
public GraphTraits<const MachineBasicBlock*> { |
| 1266 |
static NodeRef getEntryNode(const MachineFunction *F) { return &F->front(); } |
| 1267 |
|
| 1268 |
|
| 1269 |
using nodes_iterator = pointer_iterator<MachineFunction::const_iterator>; |
| 1270 |
|
| 1271 |
static nodes_iterator nodes_begin(const MachineFunction *F) { |
| 1272 |
return nodes_iterator(F->begin()); |
| 1273 |
} |
| 1274 |
|
| 1275 |
static nodes_iterator nodes_end (const MachineFunction *F) { |
| 1276 |
return nodes_iterator(F->end()); |
| 1277 |
} |
| 1278 |
|
| 1279 |
static unsigned size (const MachineFunction *F) { |
| 1280 |
return F->size(); |
| 1281 |
} |
| 1282 |
}; |
| 1283 |
|
| 1284 |
|
| 1285 |
|
| 1286 |
|
| 1287 |
|
| 1288 |
|
| 1289 |
template <> struct GraphTraits<Inverse<MachineFunction*>> : |
| 1290 |
public GraphTraits<Inverse<MachineBasicBlock*>> { |
| 1291 |
static NodeRef getEntryNode(Inverse<MachineFunction *> G) { |
| 1292 |
return &G.Graph->front(); |
| 1293 |
} |
| 1294 |
}; |
| 1295 |
template <> struct GraphTraits<Inverse<const MachineFunction*>> : |
| 1296 |
public GraphTraits<Inverse<const MachineBasicBlock*>> { |
| 1297 |
static NodeRef getEntryNode(Inverse<const MachineFunction *> G) { |
| 1298 |
return &G.Graph->front(); |
| 1299 |
} |
| 1300 |
}; |
| 1301 |
|
| 1302 |
class MachineFunctionAnalysisManager; |
| 1303 |
void verifyMachineFunction(MachineFunctionAnalysisManager *, |
| 1304 |
const std::string &Banner, |
| 1305 |
const MachineFunction &MF); |
| 1306 |
|
| 1307 |
} |
| 1308 |
|
| 1309 |
#endif |