LLVM 20.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
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);
65 return insertedCFI;
66 }
67
68 private:
69 struct MBBCFAInfo {
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 std::optional<unsigned> Reg;
95 std::optional<int> Offset;
96 };
97
98 /// Contains cfa offset and register values valid at entry and exit of basic
99 /// blocks.
100 std::vector<MBBCFAInfo> MBBVector;
101
102 /// Map the callee save registers to the locations where they are saved.
104
105 /// Calculate cfa offset and register values valid at entry and exit for all
106 /// basic blocks in a function.
107 void calculateCFAInfo(MachineFunction &MF);
108 /// Calculate cfa offset and register values valid at basic block exit by
109 /// checking the block for CFI instructions. Block's incoming CFA info remains
110 /// the same.
111 void calculateOutgoingCFAInfo(MBBCFAInfo &MBBInfo);
112 /// Update in/out cfa offset and register values for successors of the basic
113 /// block.
114 void updateSuccCFAInfo(MBBCFAInfo &MBBInfo);
115
116 /// Check if incoming CFA information of a basic block matches outgoing CFA
117 /// information of the previous block. If it doesn't, insert CFI instruction
118 /// at the beginning of the block that corrects the CFA calculation rule for
119 /// that block.
120 bool insertCFIInstrs(MachineFunction &MF);
121 /// Return the cfa offset value that should be set at the beginning of a MBB
122 /// if needed. The negated value is needed when creating CFI instructions that
123 /// set absolute offset.
124 int64_t getCorrectCFAOffset(MachineBasicBlock *MBB) {
125 return MBBVector[MBB->getNumber()].IncomingCFAOffset;
126 }
127
128 void reportCFAError(const MBBCFAInfo &Pred, const MBBCFAInfo &Succ);
129 void reportCSRError(const MBBCFAInfo &Pred, const MBBCFAInfo &Succ);
130 /// Go through each MBB in a function and check that outgoing offset and
131 /// register of its predecessors match incoming offset and register of that
132 /// MBB, as well as that incoming offset and register of its successors match
133 /// outgoing offset and register of the MBB.
134 unsigned verify(MachineFunction &MF);
135};
136} // namespace
137
138char CFIInstrInserter::ID = 0;
139INITIALIZE_PASS(CFIInstrInserter, "cfi-instr-inserter",
140 "Check CFA info and insert CFI instructions if needed", false,
141 false)
142FunctionPass *llvm::createCFIInstrInserter() { return new CFIInstrInserter(); }
143
144void CFIInstrInserter::calculateCFAInfo(MachineFunction &MF) {
146 // Initial CFA offset value i.e. the one valid at the beginning of the
147 // function.
148 int InitialOffset =
150 // Initial CFA register value i.e. the one valid at the beginning of the
151 // function.
152 Register InitialRegister =
154 InitialRegister = TRI.getDwarfRegNum(InitialRegister, true);
155 unsigned NumRegs = TRI.getNumSupportedRegs(MF);
156
157 // Initialize MBBMap.
158 for (MachineBasicBlock &MBB : MF) {
159 MBBCFAInfo &MBBInfo = MBBVector[MBB.getNumber()];
160 MBBInfo.MBB = &MBB;
161 MBBInfo.IncomingCFAOffset = InitialOffset;
162 MBBInfo.OutgoingCFAOffset = InitialOffset;
163 MBBInfo.IncomingCFARegister = InitialRegister;
164 MBBInfo.OutgoingCFARegister = InitialRegister;
165 MBBInfo.IncomingCSRSaved.resize(NumRegs);
166 MBBInfo.OutgoingCSRSaved.resize(NumRegs);
167 }
168 CSRLocMap.clear();
169
170 // Set in/out cfa info for all blocks in the function. This traversal is based
171 // on the assumption that the first block in the function is the entry block
172 // i.e. that it has initial cfa offset and register values as incoming CFA
173 // information.
174 updateSuccCFAInfo(MBBVector[MF.front().getNumber()]);
175}
176
177void CFIInstrInserter::calculateOutgoingCFAInfo(MBBCFAInfo &MBBInfo) {
178 // Outgoing cfa offset set by the block.
179 int64_t SetOffset = MBBInfo.IncomingCFAOffset;
180 // Outgoing cfa register set by the block.
181 unsigned SetRegister = MBBInfo.IncomingCFARegister;
182 MachineFunction *MF = MBBInfo.MBB->getParent();
183 const std::vector<MCCFIInstruction> &Instrs = MF->getFrameInstructions();
185 unsigned NumRegs = TRI.getNumSupportedRegs(*MF);
186 BitVector CSRSaved(NumRegs), CSRRestored(NumRegs);
187
188#ifndef NDEBUG
189 int RememberState = 0;
190#endif
191
192 // Determine cfa offset and register set by the block.
193 for (MachineInstr &MI : *MBBInfo.MBB) {
194 if (MI.isCFIInstruction()) {
195 std::optional<unsigned> CSRReg;
196 std::optional<int64_t> CSROffset;
197 unsigned CFIIndex = MI.getOperand(0).getCFIIndex();
198 const MCCFIInstruction &CFI = Instrs[CFIIndex];
199 switch (CFI.getOperation()) {
201 SetRegister = CFI.getRegister();
202 break;
204 SetOffset = CFI.getOffset();
205 break;
207 SetOffset += CFI.getOffset();
208 break;
210 SetRegister = CFI.getRegister();
211 SetOffset = CFI.getOffset();
212 break;
214 CSROffset = CFI.getOffset();
215 break;
217 CSRReg = CFI.getRegister2();
218 break;
220 CSROffset = CFI.getOffset() - SetOffset;
221 break;
223 CSRRestored.set(CFI.getRegister());
224 break;
226 // TODO: Add support for handling cfi_def_aspace_cfa.
227#ifndef NDEBUG
229 "Support for cfi_llvm_def_aspace_cfa not implemented! Value of CFA "
230 "may be incorrect!\n");
231#endif
232 break;
234 // TODO: Add support for handling cfi_remember_state.
235#ifndef NDEBUG
236 // Currently we need cfi_remember_state and cfi_restore_state to be in
237 // the same BB, so it will not impact outgoing CFA.
238 ++RememberState;
239 if (RememberState != 1)
241 SMLoc(),
242 "Support for cfi_remember_state not implemented! Value of CFA "
243 "may be incorrect!\n");
244#endif
245 break;
247 // TODO: Add support for handling cfi_restore_state.
248#ifndef NDEBUG
249 --RememberState;
250 if (RememberState != 0)
252 SMLoc(),
253 "Support for cfi_restore_state not implemented! Value of CFA may "
254 "be incorrect!\n");
255#endif
256 break;
257 // Other CFI directives do not affect CFA value.
267 break;
268 }
269 if (CSRReg || CSROffset) {
270 auto It = CSRLocMap.find(CFI.getRegister());
271 if (It == CSRLocMap.end()) {
272 CSRLocMap.insert(
273 {CFI.getRegister(), CSRSavedLocation(CSRReg, CSROffset)});
274 } else if (It->second.Reg != CSRReg || It->second.Offset != CSROffset) {
275 llvm_unreachable("Different saved locations for the same CSR");
276 }
277 CSRSaved.set(CFI.getRegister());
278 }
279 }
280 }
281
282#ifndef NDEBUG
283 if (RememberState != 0)
285 SMLoc(),
286 "Support for cfi_remember_state not implemented! Value of CFA may be "
287 "incorrect!\n");
288#endif
289
290 MBBInfo.Processed = true;
291
292 // Update outgoing CFA info.
293 MBBInfo.OutgoingCFAOffset = SetOffset;
294 MBBInfo.OutgoingCFARegister = SetRegister;
295
296 // Update outgoing CSR info.
297 BitVector::apply([](auto x, auto y, auto z) { return (x | y) & ~z; },
298 MBBInfo.OutgoingCSRSaved, MBBInfo.IncomingCSRSaved, CSRSaved,
299 CSRRestored);
300}
301
302void CFIInstrInserter::updateSuccCFAInfo(MBBCFAInfo &MBBInfo) {
304 Stack.push_back(MBBInfo.MBB);
305
306 do {
307 MachineBasicBlock *Current = Stack.pop_back_val();
308 MBBCFAInfo &CurrentInfo = MBBVector[Current->getNumber()];
309 calculateOutgoingCFAInfo(CurrentInfo);
310 for (auto *Succ : CurrentInfo.MBB->successors()) {
311 MBBCFAInfo &SuccInfo = MBBVector[Succ->getNumber()];
312 if (!SuccInfo.Processed) {
313 SuccInfo.IncomingCFAOffset = CurrentInfo.OutgoingCFAOffset;
314 SuccInfo.IncomingCFARegister = CurrentInfo.OutgoingCFARegister;
315 SuccInfo.IncomingCSRSaved = CurrentInfo.OutgoingCSRSaved;
316 Stack.push_back(Succ);
317 }
318 }
319 } while (!Stack.empty());
320}
321
322bool CFIInstrInserter::insertCFIInstrs(MachineFunction &MF) {
323 const MBBCFAInfo *PrevMBBInfo = &MBBVector[MF.front().getNumber()];
325 bool InsertedCFIInstr = false;
326
327 BitVector SetDifference;
328 for (MachineBasicBlock &MBB : MF) {
329 // Skip the first MBB in a function
330 if (MBB.getNumber() == MF.front().getNumber()) continue;
331
332 const MBBCFAInfo &MBBInfo = MBBVector[MBB.getNumber()];
333 auto MBBI = MBBInfo.MBB->begin();
334 DebugLoc DL = MBBInfo.MBB->findDebugLoc(MBBI);
335
336 // If the current MBB will be placed in a unique section, a full DefCfa
337 // must be emitted.
338 const bool ForceFullCFA = MBB.isBeginSection();
339
340 if ((PrevMBBInfo->OutgoingCFAOffset != MBBInfo.IncomingCFAOffset &&
341 PrevMBBInfo->OutgoingCFARegister != MBBInfo.IncomingCFARegister) ||
342 ForceFullCFA) {
343 // If both outgoing offset and register of a previous block don't match
344 // incoming offset and register of this block, or if this block begins a
345 // section, add a def_cfa instruction with the correct offset and
346 // register for this block.
347 unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::cfiDefCfa(
348 nullptr, MBBInfo.IncomingCFARegister, getCorrectCFAOffset(&MBB)));
349 BuildMI(*MBBInfo.MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
350 .addCFIIndex(CFIIndex);
351 InsertedCFIInstr = true;
352 } else if (PrevMBBInfo->OutgoingCFAOffset != MBBInfo.IncomingCFAOffset) {
353 // If outgoing offset of a previous block doesn't match incoming offset
354 // of this block, add a def_cfa_offset instruction with the correct
355 // offset for this block.
356 unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::cfiDefCfaOffset(
357 nullptr, getCorrectCFAOffset(&MBB)));
358 BuildMI(*MBBInfo.MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
359 .addCFIIndex(CFIIndex);
360 InsertedCFIInstr = true;
361 } else if (PrevMBBInfo->OutgoingCFARegister !=
362 MBBInfo.IncomingCFARegister) {
363 unsigned CFIIndex =
365 nullptr, MBBInfo.IncomingCFARegister));
366 BuildMI(*MBBInfo.MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
367 .addCFIIndex(CFIIndex);
368 InsertedCFIInstr = true;
369 }
370
371 if (ForceFullCFA) {
372 MF.getSubtarget().getFrameLowering()->emitCalleeSavedFrameMovesFullCFA(
373 *MBBInfo.MBB, MBBI);
374 InsertedCFIInstr = true;
375 PrevMBBInfo = &MBBInfo;
376 continue;
377 }
378
379 BitVector::apply([](auto x, auto y) { return x & ~y; }, SetDifference,
380 PrevMBBInfo->OutgoingCSRSaved, MBBInfo.IncomingCSRSaved);
381 for (int Reg : SetDifference.set_bits()) {
382 unsigned CFIIndex =
383 MF.addFrameInst(MCCFIInstruction::createRestore(nullptr, Reg));
384 BuildMI(*MBBInfo.MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
385 .addCFIIndex(CFIIndex);
386 InsertedCFIInstr = true;
387 }
388
389 BitVector::apply([](auto x, auto y) { return x & ~y; }, SetDifference,
390 MBBInfo.IncomingCSRSaved, PrevMBBInfo->OutgoingCSRSaved);
391 for (int Reg : SetDifference.set_bits()) {
392 auto it = CSRLocMap.find(Reg);
393 assert(it != CSRLocMap.end() && "Reg should have an entry in CSRLocMap");
394 unsigned CFIIndex;
395 CSRSavedLocation RO = it->second;
396 if (!RO.Reg && RO.Offset) {
397 CFIIndex = MF.addFrameInst(
398 MCCFIInstruction::createOffset(nullptr, Reg, *RO.Offset));
399 } else if (RO.Reg && !RO.Offset) {
400 CFIIndex = MF.addFrameInst(
401 MCCFIInstruction::createRegister(nullptr, Reg, *RO.Reg));
402 } else {
403 llvm_unreachable("RO.Reg and RO.Offset cannot both be valid/invalid");
404 }
405 BuildMI(*MBBInfo.MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
406 .addCFIIndex(CFIIndex);
407 InsertedCFIInstr = true;
408 }
409
410 PrevMBBInfo = &MBBInfo;
411 }
412 return InsertedCFIInstr;
413}
414
415void CFIInstrInserter::reportCFAError(const MBBCFAInfo &Pred,
416 const MBBCFAInfo &Succ) {
417 errs() << "*** Inconsistent CFA register and/or offset between pred and succ "
418 "***\n";
419 errs() << "Pred: " << Pred.MBB->getName() << " #" << Pred.MBB->getNumber()
420 << " in " << Pred.MBB->getParent()->getName()
421 << " outgoing CFA Reg:" << Pred.OutgoingCFARegister << "\n";
422 errs() << "Pred: " << Pred.MBB->getName() << " #" << Pred.MBB->getNumber()
423 << " in " << Pred.MBB->getParent()->getName()
424 << " outgoing CFA Offset:" << Pred.OutgoingCFAOffset << "\n";
425 errs() << "Succ: " << Succ.MBB->getName() << " #" << Succ.MBB->getNumber()
426 << " incoming CFA Reg:" << Succ.IncomingCFARegister << "\n";
427 errs() << "Succ: " << Succ.MBB->getName() << " #" << Succ.MBB->getNumber()
428 << " incoming CFA Offset:" << Succ.IncomingCFAOffset << "\n";
429}
430
431void CFIInstrInserter::reportCSRError(const MBBCFAInfo &Pred,
432 const MBBCFAInfo &Succ) {
433 errs() << "*** Inconsistent CSR Saved between pred and succ in function "
434 << Pred.MBB->getParent()->getName() << " ***\n";
435 errs() << "Pred: " << Pred.MBB->getName() << " #" << Pred.MBB->getNumber()
436 << " outgoing CSR Saved: ";
437 for (int Reg : Pred.OutgoingCSRSaved.set_bits())
438 errs() << Reg << " ";
439 errs() << "\n";
440 errs() << "Succ: " << Succ.MBB->getName() << " #" << Succ.MBB->getNumber()
441 << " incoming CSR Saved: ";
442 for (int Reg : Succ.IncomingCSRSaved.set_bits())
443 errs() << Reg << " ";
444 errs() << "\n";
445}
446
447unsigned CFIInstrInserter::verify(MachineFunction &MF) {
448 unsigned ErrorNum = 0;
449 for (auto *CurrMBB : depth_first(&MF)) {
450 const MBBCFAInfo &CurrMBBInfo = MBBVector[CurrMBB->getNumber()];
451 for (MachineBasicBlock *Succ : CurrMBB->successors()) {
452 const MBBCFAInfo &SuccMBBInfo = MBBVector[Succ->getNumber()];
453 // Check that incoming offset and register values of successors match the
454 // outgoing offset and register values of CurrMBB
455 if (SuccMBBInfo.IncomingCFAOffset != CurrMBBInfo.OutgoingCFAOffset ||
456 SuccMBBInfo.IncomingCFARegister != CurrMBBInfo.OutgoingCFARegister) {
457 // Inconsistent offsets/registers are ok for 'noreturn' blocks because
458 // we don't generate epilogues inside such blocks.
459 if (SuccMBBInfo.MBB->succ_empty() && !SuccMBBInfo.MBB->isReturnBlock())
460 continue;
461 reportCFAError(CurrMBBInfo, SuccMBBInfo);
462 ErrorNum++;
463 }
464 // Check that IncomingCSRSaved of every successor matches the
465 // OutgoingCSRSaved of CurrMBB
466 if (SuccMBBInfo.IncomingCSRSaved != CurrMBBInfo.OutgoingCSRSaved) {
467 reportCSRError(CurrMBBInfo, SuccMBBInfo);
468 ErrorNum++;
469 }
470 }
471 }
472 return ErrorNum;
473}
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
unsigned const TargetRegisterInfo * TRI
ppc ctr loops verify
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:38
SmallVector< MachineBasicBlock *, 4 > MBBVector
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Represent the analysis usage information of a pass.
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:140
static BitVector & apply(F &&f, BitVector &Out, BitVector const &Arg, ArgTys const &...Args)
Definition: BitVector.h:552
A debug info location.
Definition: DebugLoc.h:33
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:310
static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register, SMLoc Loc={})
.cfi_def_cfa_register modifies a rule for computing CFA.
Definition: MCDwarf.h:582
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:656
unsigned getRegister2() const
Definition: MCDwarf.h:725
unsigned getRegister() const
Definition: MCDwarf.h:713
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:632
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:575
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:617
OpType getOperation() const
Definition: MCDwarf.h:710
static MCCFIInstruction cfiDefCfaOffset(MCSymbol *L, int64_t Offset, SMLoc Loc={})
.cfi_def_cfa_offset modifies a rule for computing CFA.
Definition: MCDwarf.h:590
int64_t getOffset() const
Definition: MCDwarf.h:735
void reportError(SMLoc L, const Twine &Msg)
Definition: MCContext.cpp:1072
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
DebugLoc findDebugLoc(instr_iterator MBBI)
Find the next valid DebugLoc starting at MBBI, skipping any debug instructions.
bool isBeginSection() const
Returns true if this block begins any section.
iterator_range< succ_iterator > successors()
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.
virtual bool runOnMachineFunction(MachineFunction &MF)=0
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
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
Representation of each machine instruction.
Definition: MachineInstr.h:69
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
Represents a location in source code.
Definition: SMLoc.h:23
void resize(size_type N)
Definition: SmallVector.h:638
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1196
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.
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
virtual const TargetFrameLowering * getFrameLowering() const
virtual const TargetInstrInfo * getInstrInfo() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
Reg
All possible values of the reg field in the ModR/M byte.
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:443
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:167
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
FunctionPass * createCFIInstrInserter()
Creates CFI Instruction Inserter pass.
iterator_range< df_iterator< T > > depth_first(const T &G)
void initializeCFIInstrInserterPass(PassRegistry &)