LLVM 22.0.0git
CFIInstrInserter.cpp
Go to the documentation of this file.
1//===------ CFIInstrInserter.cpp - Insert additional CFI instructions -----===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9/// \file This pass verifies incoming and outgoing CFA information of basic
10/// blocks. CFA information is information about offset and register set by CFI
11/// directives, valid at the start and end of a basic block. This pass checks
12/// that outgoing information of predecessors matches incoming information of
13/// their successors. Then it checks if blocks have correct CFA calculation rule
14/// set and inserts additional CFI instruction at their beginnings if they
15/// don't. CFI instructions are inserted if basic blocks have incorrect offset
16/// or register set by previous blocks, as a result of a non-linear layout of
17/// blocks in a function.
18//===----------------------------------------------------------------------===//
19
23#include "llvm/CodeGen/Passes.h"
28#include "llvm/MC/MCContext.h"
29#include "llvm/MC/MCDwarf.h"
30using namespace llvm;
31
32static cl::opt<bool> VerifyCFI("verify-cfiinstrs",
33 cl::desc("Verify Call Frame Information instructions"),
34 cl::init(false),
36
37namespace {
38class CFIInstrInserter : public MachineFunctionPass {
39 public:
40 static char ID;
41
42 CFIInstrInserter() : MachineFunctionPass(ID) {
44 }
45
46 void getAnalysisUsage(AnalysisUsage &AU) const override {
47 AU.setPreservesAll();
49 }
50
51 bool runOnMachineFunction(MachineFunction &MF) override {
52 if (!MF.needsFrameMoves())
53 return false;
54
55 MBBVector.resize(MF.getNumBlockIDs());
56 calculateCFAInfo(MF);
57
58 if (VerifyCFI) {
59 if (unsigned ErrorNum = verify(MF))
60 report_fatal_error("Found " + Twine(ErrorNum) +
61 " in/out CFI information errors.");
62 }
63 bool insertedCFI = insertCFIInstrs(MF);
64 MBBVector.clear();
65 return insertedCFI;
66 }
67
68 private:
69 struct MBBCFAInfo {
70 MachineBasicBlock *MBB;
71 /// Value of cfa offset valid at basic block entry.
72 int64_t IncomingCFAOffset = -1;
73 /// Value of cfa offset valid at basic block exit.
74 int64_t OutgoingCFAOffset = -1;
75 /// Value of cfa register valid at basic block entry.
76 unsigned IncomingCFARegister = 0;
77 /// Value of cfa register valid at basic block exit.
78 unsigned OutgoingCFARegister = 0;
79 /// Set of callee saved registers saved at basic block entry.
80 BitVector IncomingCSRSaved;
81 /// Set of callee saved registers saved at basic block exit.
82 BitVector OutgoingCSRSaved;
83 /// If in/out cfa offset and register values for this block have already
84 /// been set or not.
85 bool Processed = false;
86 };
87
88#define INVALID_REG UINT_MAX
89#define INVALID_OFFSET INT_MAX
90 /// contains the location where CSR register is saved.
91 struct CSRSavedLocation {
92 CSRSavedLocation(std::optional<unsigned> R, std::optional<int> O)
93 : Reg(R), Offset(O) {
94 assert((Reg.has_value() ^ Offset.has_value()) &&
95 "Register and offset can not both be valid");
96 }
97 std::optional<unsigned> Reg;
98 std::optional<int> Offset;
99
100 bool operator==(const CSRSavedLocation &RHS) const {
101 return Reg == RHS.Reg && Offset == RHS.Offset;
102 }
103
104 bool operator!=(const CSRSavedLocation &RHS) const {
105 return !(*this == RHS);
106 }
107 };
108
109 /// Contains cfa offset and register values valid at entry and exit of basic
110 /// blocks.
111 std::vector<MBBCFAInfo> MBBVector;
112
113 /// Map the callee save registers to the locations where they are saved.
114 SmallDenseMap<unsigned, CSRSavedLocation, 16> CSRLocMap;
115
116 /// Calculate cfa offset and register values valid at entry and exit for all
117 /// basic blocks in a function.
118 void calculateCFAInfo(MachineFunction &MF);
119 /// Calculate cfa offset and register values valid at basic block exit by
120 /// checking the block for CFI instructions. Block's incoming CFA info remains
121 /// the same.
122 void calculateOutgoingCFAInfo(MBBCFAInfo &MBBInfo);
123 /// Update in/out cfa offset and register values for successors of the basic
124 /// block.
125 void updateSuccCFAInfo(MBBCFAInfo &MBBInfo);
126
127 /// Check if incoming CFA information of a basic block matches outgoing CFA
128 /// information of the previous block. If it doesn't, insert CFI instruction
129 /// at the beginning of the block that corrects the CFA calculation rule for
130 /// that block.
131 bool insertCFIInstrs(MachineFunction &MF);
132 /// Return the cfa offset value that should be set at the beginning of a MBB
133 /// if needed. The negated value is needed when creating CFI instructions that
134 /// set absolute offset.
135 int64_t getCorrectCFAOffset(MachineBasicBlock *MBB) {
136 return MBBVector[MBB->getNumber()].IncomingCFAOffset;
137 }
138
139 void reportCFAError(const MBBCFAInfo &Pred, const MBBCFAInfo &Succ);
140 void reportCSRError(const MBBCFAInfo &Pred, const MBBCFAInfo &Succ);
141 /// Go through each MBB in a function and check that outgoing offset and
142 /// register of its predecessors match incoming offset and register of that
143 /// MBB, as well as that incoming offset and register of its successors match
144 /// outgoing offset and register of the MBB.
145 unsigned verify(MachineFunction &MF);
146};
147} // namespace
148
149char CFIInstrInserter::ID = 0;
150INITIALIZE_PASS(CFIInstrInserter, "cfi-instr-inserter",
151 "Check CFA info and insert CFI instructions if needed", false,
152 false)
153FunctionPass *llvm::createCFIInstrInserter() { return new CFIInstrInserter(); }
154
155void CFIInstrInserter::calculateCFAInfo(MachineFunction &MF) {
156 const TargetRegisterInfo &TRI = *MF.getSubtarget().getRegisterInfo();
157 // Initial CFA offset value i.e. the one valid at the beginning of the
158 // function.
159 int InitialOffset =
161 // Initial CFA register value i.e. the one valid at the beginning of the
162 // function.
163 Register InitialRegister =
165 unsigned DwarfInitialRegister = TRI.getDwarfRegNum(InitialRegister, true);
166 unsigned NumRegs = TRI.getNumSupportedRegs(MF);
167
168 // Initialize MBBMap.
169 for (MachineBasicBlock &MBB : MF) {
170 MBBCFAInfo &MBBInfo = MBBVector[MBB.getNumber()];
171 MBBInfo.MBB = &MBB;
172 MBBInfo.IncomingCFAOffset = InitialOffset;
173 MBBInfo.OutgoingCFAOffset = InitialOffset;
174 MBBInfo.IncomingCFARegister = DwarfInitialRegister;
175 MBBInfo.OutgoingCFARegister = DwarfInitialRegister;
176 MBBInfo.IncomingCSRSaved.resize(NumRegs);
177 MBBInfo.OutgoingCSRSaved.resize(NumRegs);
178 }
179 CSRLocMap.clear();
180
181 // Set in/out cfa info for all blocks in the function. This traversal is based
182 // on the assumption that the first block in the function is the entry block
183 // i.e. that it has initial cfa offset and register values as incoming CFA
184 // information.
185 updateSuccCFAInfo(MBBVector[MF.front().getNumber()]);
186}
187
188void CFIInstrInserter::calculateOutgoingCFAInfo(MBBCFAInfo &MBBInfo) {
189 // Outgoing cfa offset set by the block.
190 int64_t SetOffset = MBBInfo.IncomingCFAOffset;
191 // Outgoing cfa register set by the block.
192 unsigned SetRegister = MBBInfo.IncomingCFARegister;
193 MachineFunction *MF = MBBInfo.MBB->getParent();
194 const std::vector<MCCFIInstruction> &Instrs = MF->getFrameInstructions();
195 const TargetRegisterInfo &TRI = *MF->getSubtarget().getRegisterInfo();
196 unsigned NumRegs = TRI.getNumSupportedRegs(*MF);
197 BitVector CSRSaved(NumRegs), CSRRestored(NumRegs);
198
199#ifndef NDEBUG
200 int RememberState = 0;
201#endif
202
203 // Determine cfa offset and register set by the block.
204 for (MachineInstr &MI : *MBBInfo.MBB) {
205 if (MI.isCFIInstruction()) {
206 std::optional<unsigned> CSRReg;
207 std::optional<int64_t> CSROffset;
208 unsigned CFIIndex = MI.getOperand(0).getCFIIndex();
209 const MCCFIInstruction &CFI = Instrs[CFIIndex];
210 switch (CFI.getOperation()) {
212 SetRegister = CFI.getRegister();
213 break;
215 SetOffset = CFI.getOffset();
216 break;
218 SetOffset += CFI.getOffset();
219 break;
221 SetRegister = CFI.getRegister();
222 SetOffset = CFI.getOffset();
223 break;
225 CSROffset = CFI.getOffset();
226 break;
228 CSRReg = CFI.getRegister2();
229 break;
231 CSROffset = CFI.getOffset() - SetOffset;
232 break;
234 CSRRestored.set(CFI.getRegister());
235 break;
237 // TODO: Add support for handling cfi_def_aspace_cfa.
238#ifndef NDEBUG
240 "Support for cfi_llvm_def_aspace_cfa not implemented! Value of CFA "
241 "may be incorrect!\n");
242#endif
243 break;
245 // TODO: Add support for handling cfi_remember_state.
246#ifndef NDEBUG
247 // Currently we need cfi_remember_state and cfi_restore_state to be in
248 // the same BB, so it will not impact outgoing CFA.
249 ++RememberState;
250 if (RememberState != 1)
252 SMLoc(),
253 "Support for cfi_remember_state not implemented! Value of CFA "
254 "may be incorrect!\n");
255#endif
256 break;
258 // TODO: Add support for handling cfi_restore_state.
259#ifndef NDEBUG
260 --RememberState;
261 if (RememberState != 0)
263 SMLoc(),
264 "Support for cfi_restore_state not implemented! Value of CFA may "
265 "be incorrect!\n");
266#endif
267 break;
268 // Other CFI directives do not affect CFA value.
278 break;
279 }
280 if (CSRReg || CSROffset) {
281 CSRSavedLocation Loc(CSRReg, CSROffset);
282 auto [It, Inserted] = CSRLocMap.insert({CFI.getRegister(), Loc});
283 if (!Inserted && It->second != Loc) {
285 "Different saved locations for the same CSR");
286 }
287 CSRSaved.set(CFI.getRegister());
288 }
289 }
290 }
291
292#ifndef NDEBUG
293 if (RememberState != 0)
295 SMLoc(),
296 "Support for cfi_remember_state not implemented! Value of CFA may be "
297 "incorrect!\n");
298#endif
299
300 MBBInfo.Processed = true;
301
302 // Update outgoing CFA info.
303 MBBInfo.OutgoingCFAOffset = SetOffset;
304 MBBInfo.OutgoingCFARegister = SetRegister;
305
306 // Update outgoing CSR info.
307 BitVector::apply([](auto x, auto y, auto z) { return (x | y) & ~z; },
308 MBBInfo.OutgoingCSRSaved, MBBInfo.IncomingCSRSaved, CSRSaved,
309 CSRRestored);
310}
311
312void CFIInstrInserter::updateSuccCFAInfo(MBBCFAInfo &MBBInfo) {
313 SmallVector<MachineBasicBlock *, 4> Stack;
314 Stack.push_back(MBBInfo.MBB);
315
316 do {
317 MachineBasicBlock *Current = Stack.pop_back_val();
318 MBBCFAInfo &CurrentInfo = MBBVector[Current->getNumber()];
319 calculateOutgoingCFAInfo(CurrentInfo);
320 for (auto *Succ : CurrentInfo.MBB->successors()) {
321 MBBCFAInfo &SuccInfo = MBBVector[Succ->getNumber()];
322 if (!SuccInfo.Processed) {
323 SuccInfo.IncomingCFAOffset = CurrentInfo.OutgoingCFAOffset;
324 SuccInfo.IncomingCFARegister = CurrentInfo.OutgoingCFARegister;
325 SuccInfo.IncomingCSRSaved = CurrentInfo.OutgoingCSRSaved;
326 Stack.push_back(Succ);
327 }
328 }
329 } while (!Stack.empty());
330}
331
332bool CFIInstrInserter::insertCFIInstrs(MachineFunction &MF) {
333 const MBBCFAInfo *PrevMBBInfo = &MBBVector[MF.front().getNumber()];
334 const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo();
335 bool InsertedCFIInstr = false;
336
337 BitVector SetDifference;
338 for (MachineBasicBlock &MBB : MF) {
339 // Skip the first MBB in a function
340 if (MBB.getNumber() == MF.front().getNumber()) continue;
341
342 const MBBCFAInfo &MBBInfo = MBBVector[MBB.getNumber()];
343 auto MBBI = MBBInfo.MBB->begin();
344 DebugLoc DL = MBBInfo.MBB->findDebugLoc(MBBI);
345
346 // If the current MBB will be placed in a unique section, a full DefCfa
347 // must be emitted.
348 const bool ForceFullCFA = MBB.isBeginSection();
349
350 if ((PrevMBBInfo->OutgoingCFAOffset != MBBInfo.IncomingCFAOffset &&
351 PrevMBBInfo->OutgoingCFARegister != MBBInfo.IncomingCFARegister) ||
352 ForceFullCFA) {
353 // If both outgoing offset and register of a previous block don't match
354 // incoming offset and register of this block, or if this block begins a
355 // section, add a def_cfa instruction with the correct offset and
356 // register for this block.
357 unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::cfiDefCfa(
358 nullptr, MBBInfo.IncomingCFARegister, getCorrectCFAOffset(&MBB)));
359 BuildMI(*MBBInfo.MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
360 .addCFIIndex(CFIIndex);
361 InsertedCFIInstr = true;
362 } else if (PrevMBBInfo->OutgoingCFAOffset != MBBInfo.IncomingCFAOffset) {
363 // If outgoing offset of a previous block doesn't match incoming offset
364 // of this block, add a def_cfa_offset instruction with the correct
365 // offset for this block.
366 unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::cfiDefCfaOffset(
367 nullptr, getCorrectCFAOffset(&MBB)));
368 BuildMI(*MBBInfo.MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
369 .addCFIIndex(CFIIndex);
370 InsertedCFIInstr = true;
371 } else if (PrevMBBInfo->OutgoingCFARegister !=
372 MBBInfo.IncomingCFARegister) {
373 unsigned CFIIndex =
375 nullptr, MBBInfo.IncomingCFARegister));
376 BuildMI(*MBBInfo.MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
377 .addCFIIndex(CFIIndex);
378 InsertedCFIInstr = true;
379 }
380
381 if (ForceFullCFA) {
382 MF.getSubtarget().getFrameLowering()->emitCalleeSavedFrameMovesFullCFA(
383 *MBBInfo.MBB, MBBI);
384 InsertedCFIInstr = true;
385 PrevMBBInfo = &MBBInfo;
386 continue;
387 }
388
389 BitVector::apply([](auto x, auto y) { return x & ~y; }, SetDifference,
390 PrevMBBInfo->OutgoingCSRSaved, MBBInfo.IncomingCSRSaved);
391 for (int Reg : SetDifference.set_bits()) {
392 unsigned CFIIndex =
393 MF.addFrameInst(MCCFIInstruction::createRestore(nullptr, Reg));
394 BuildMI(*MBBInfo.MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
395 .addCFIIndex(CFIIndex);
396 InsertedCFIInstr = true;
397 }
398
399 BitVector::apply([](auto x, auto y) { return x & ~y; }, SetDifference,
400 MBBInfo.IncomingCSRSaved, PrevMBBInfo->OutgoingCSRSaved);
401 for (int Reg : SetDifference.set_bits()) {
402 auto it = CSRLocMap.find(Reg);
403 assert(it != CSRLocMap.end() && "Reg should have an entry in CSRLocMap");
404 unsigned CFIIndex;
405 CSRSavedLocation RO = it->second;
406 if (!RO.Reg && RO.Offset) {
407 CFIIndex = MF.addFrameInst(
408 MCCFIInstruction::createOffset(nullptr, Reg, *RO.Offset));
409 } else {
410 assert((RO.Reg && !RO.Offset) &&
411 "Reg and Offset cannot both be valid/invalid");
412 CFIIndex = MF.addFrameInst(
413 MCCFIInstruction::createRegister(nullptr, Reg, *RO.Reg));
414 }
415 BuildMI(*MBBInfo.MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
416 .addCFIIndex(CFIIndex);
417 InsertedCFIInstr = true;
418 }
419
420 PrevMBBInfo = &MBBInfo;
421 }
422 return InsertedCFIInstr;
423}
424
425void CFIInstrInserter::reportCFAError(const MBBCFAInfo &Pred,
426 const MBBCFAInfo &Succ) {
427 errs() << "*** Inconsistent CFA register and/or offset between pred and succ "
428 "***\n";
429 errs() << "Pred: " << Pred.MBB->getName() << " #" << Pred.MBB->getNumber()
430 << " in " << Pred.MBB->getParent()->getName()
431 << " outgoing CFA Reg:" << Pred.OutgoingCFARegister << "\n";
432 errs() << "Pred: " << Pred.MBB->getName() << " #" << Pred.MBB->getNumber()
433 << " in " << Pred.MBB->getParent()->getName()
434 << " outgoing CFA Offset:" << Pred.OutgoingCFAOffset << "\n";
435 errs() << "Succ: " << Succ.MBB->getName() << " #" << Succ.MBB->getNumber()
436 << " incoming CFA Reg:" << Succ.IncomingCFARegister << "\n";
437 errs() << "Succ: " << Succ.MBB->getName() << " #" << Succ.MBB->getNumber()
438 << " incoming CFA Offset:" << Succ.IncomingCFAOffset << "\n";
439}
440
441void CFIInstrInserter::reportCSRError(const MBBCFAInfo &Pred,
442 const MBBCFAInfo &Succ) {
443 errs() << "*** Inconsistent CSR Saved between pred and succ in function "
444 << Pred.MBB->getParent()->getName() << " ***\n";
445 errs() << "Pred: " << Pred.MBB->getName() << " #" << Pred.MBB->getNumber()
446 << " outgoing CSR Saved: ";
447 for (int Reg : Pred.OutgoingCSRSaved.set_bits())
448 errs() << Reg << " ";
449 errs() << "\n";
450 errs() << "Succ: " << Succ.MBB->getName() << " #" << Succ.MBB->getNumber()
451 << " incoming CSR Saved: ";
452 for (int Reg : Succ.IncomingCSRSaved.set_bits())
453 errs() << Reg << " ";
454 errs() << "\n";
455}
456
457unsigned CFIInstrInserter::verify(MachineFunction &MF) {
458 unsigned ErrorNum = 0;
459 for (auto *CurrMBB : depth_first(&MF)) {
460 const MBBCFAInfo &CurrMBBInfo = MBBVector[CurrMBB->getNumber()];
461 for (MachineBasicBlock *Succ : CurrMBB->successors()) {
462 const MBBCFAInfo &SuccMBBInfo = MBBVector[Succ->getNumber()];
463 // Check that incoming offset and register values of successors match the
464 // outgoing offset and register values of CurrMBB
465 if (SuccMBBInfo.IncomingCFAOffset != CurrMBBInfo.OutgoingCFAOffset ||
466 SuccMBBInfo.IncomingCFARegister != CurrMBBInfo.OutgoingCFARegister) {
467 // Inconsistent offsets/registers are ok for 'noreturn' blocks because
468 // we don't generate epilogues inside such blocks.
469 if (SuccMBBInfo.MBB->succ_empty() && !SuccMBBInfo.MBB->isReturnBlock())
470 continue;
471 reportCFAError(CurrMBBInfo, SuccMBBInfo);
472 ErrorNum++;
473 }
474 // Check that IncomingCSRSaved of every successor matches the
475 // OutgoingCSRSaved of CurrMBB
476 if (SuccMBBInfo.IncomingCSRSaved != CurrMBBInfo.OutgoingCSRSaved) {
477 reportCSRError(CurrMBBInfo, SuccMBBInfo);
478 ErrorNum++;
479 }
480 }
481 }
482 return ErrorNum;
483}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
static cl::opt< bool > VerifyCFI("verify-cfiinstrs", cl::desc("Verify Call Frame Information instructions"), cl::init(false), cl::Hidden)
This file builds on the ADT/GraphTraits.h file to build generic depth first graph iterator.
const HexagonInstrInfo * TII
IRTranslator LLVM IR MI
Register Reg
Register const TargetRegisterInfo * TRI
Promote Memory to Register
Definition Mem2Reg.cpp:110
ppc ctr loops verify
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition PassSupport.h:56
SmallVector< MachineBasicBlock *, 4 > MBBVector
Value * RHS
void setPreservesAll()
Set by analyses that do not transform their input at all.
iterator_range< const_set_bits_iterator > set_bits() const
Definition BitVector.h:159
static BitVector & apply(F &&f, BitVector &Out, BitVector const &Arg, ArgTys const &...Args)
Definition BitVector.h:571
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:314
static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register, SMLoc Loc={})
.cfi_def_cfa_register modifies a rule for computing CFA.
Definition MCDwarf.h:592
static MCCFIInstruction createRestore(MCSymbol *L, unsigned Register, SMLoc Loc={})
.cfi_restore says that the rule for Register is now the same as it was at the beginning of the functi...
Definition MCDwarf.h:666
unsigned getRegister2() const
Definition MCDwarf.h:735
unsigned getRegister() const
Definition MCDwarf.h:723
static MCCFIInstruction createRegister(MCSymbol *L, unsigned Register1, unsigned Register2, SMLoc Loc={})
.cfi_register Previous value of Register1 is saved in register Register2.
Definition MCDwarf.h:642
static MCCFIInstruction cfiDefCfa(MCSymbol *L, unsigned Register, int64_t Offset, SMLoc Loc={})
.cfi_def_cfa defines a rule for computing CFA as: take address from Register and add Offset to it.
Definition MCDwarf.h:585
static MCCFIInstruction createOffset(MCSymbol *L, unsigned Register, int64_t Offset, SMLoc Loc={})
.cfi_offset Previous value of Register is saved at offset Offset from CFA.
Definition MCDwarf.h:627
OpType getOperation() const
Definition MCDwarf.h:720
static MCCFIInstruction cfiDefCfaOffset(MCSymbol *L, int64_t Offset, SMLoc Loc={})
.cfi_def_cfa_offset modifies a rule for computing CFA.
Definition MCDwarf.h:600
int64_t getOffset() const
Definition MCDwarf.h:745
LLVM_ABI void reportError(SMLoc L, const Twine &Msg)
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
bool isBeginSection() const
Returns true if this block begins any section.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
const std::vector< MCCFIInstruction > & getFrameInstructions() const
Returns a reference to a list of cfi instructions in the function's prologue.
bool needsFrameMoves() const
True if this function needs frame moves for debug or exceptions.
MCContext & getContext() const
unsigned getNumBlockIDs() const
getNumBlockIDs - Return the number of MBB ID's allocated.
const MachineBasicBlock & front() const
const MachineInstrBuilder & addCFIIndex(unsigned CFIIndex) const
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
virtual Register getInitialCFARegister(const MachineFunction &MF) const
Return initial CFA register value i.e.
virtual int getInitialCFAOffset(const MachineFunction &MF) const
Return initial CFA offset value i.e.
virtual const TargetFrameLowering * getFrameLowering() const
virtual const TargetInstrInfo * getInstrInfo() const
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:532
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
bool operator!=(uint64_t V1, const APInt &V2)
Definition APInt.h:2114
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)
LLVM_ABI void reportFatalInternalError(Error Err)
Report a fatal error that indicates a bug in LLVM.
Definition Error.cpp:177
LLVM_ABI void initializeCFIInstrInserterPass(PassRegistry &)
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
Definition Error.cpp:167
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
iterator_range< df_iterator< T > > depth_first(const T &G)
LLVM_ABI FunctionPass * createCFIInstrInserter()
Creates CFI Instruction Inserter pass.