LLVM 24.0.0git
AVRFrameLowering.cpp
Go to the documentation of this file.
1//===-- AVRFrameLowering.cpp - AVR Frame Information ----------------------===//
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// This file contains the AVR implementation of TargetFrameLowering class.
10//
11//===----------------------------------------------------------------------===//
12
13#include "AVRFrameLowering.h"
14
15#include "AVR.h"
16#include "AVRInstrInfo.h"
18#include "AVRTargetMachine.h"
20
29
30namespace llvm {
31
34
36 const MachineFunction &MF) const {
37 // Always simplify call frame pseudo instructions, even when
38 // hasReservedCallFrame is false.
39 return true;
40}
41
43 // Reserve call frame memory in function prologue under the following
44 // conditions:
45 // - Y pointer is reserved to be the frame pointer.
46 // - The function does not contain variable sized objects.
47
48 const MachineFrameInfo &MFI = MF.getFrameInfo();
49 return hasFP(MF) && !MFI.hasVarSizedObjects();
50}
51
53 MachineBasicBlock &MBB) const {
55 DebugLoc DL = (MBBI != MBB.end()) ? MBBI->getDebugLoc() : DebugLoc();
56 const AVRSubtarget &STI = MF.getSubtarget<AVRSubtarget>();
57 const AVRInstrInfo &TII = *STI.getInstrInfo();
59 const MachineRegisterInfo &MRI = MF.getRegInfo();
60 bool HasFP = hasFP(MF);
61
62 // Interrupt handlers re-enable interrupts in function entry.
63 if (AFI->isInterruptHandler()) {
64 BuildMI(MBB, MBBI, DL, TII.get(AVR::BSETs))
65 .addImm(0x07)
67 }
68
69 // Emit special prologue code to save R1, R0 and SREG in interrupt/signal
70 // handlers before saving any other registers.
71 if (AFI->isInterruptOrSignalHandler()) {
72 BuildMI(MBB, MBBI, DL, TII.get(AVR::PUSHRr))
75
76 BuildMI(MBB, MBBI, DL, TII.get(AVR::INRdA), STI.getTmpRegister())
77 .addImm(STI.getIORegSREG())
79 BuildMI(MBB, MBBI, DL, TII.get(AVR::PUSHRr))
82 if (!MRI.reg_empty(STI.getZeroRegister())) {
83 BuildMI(MBB, MBBI, DL, TII.get(AVR::PUSHRr))
86 BuildMI(MBB, MBBI, DL, TII.get(AVR::EORRdRr))
91 }
92 }
93
94 // Early exit if the frame pointer is not needed in this function.
95 if (!HasFP) {
96 return;
97 }
98
99 const MachineFrameInfo &MFI = MF.getFrameInfo();
100 unsigned FrameSize = MFI.getStackSize() - AFI->getCalleeSavedFrameSize();
101
102 // Skip the callee-saved push instructions.
103 while (
104 (MBBI != MBB.end()) && MBBI->getFlag(MachineInstr::FrameSetup) &&
105 (MBBI->getOpcode() == AVR::PUSHRr || MBBI->getOpcode() == AVR::PUSHWRr)) {
106 ++MBBI;
107 }
108
109 // Update Y with the new base value.
110 BuildMI(MBB, MBBI, DL, TII.get(AVR::SPREAD), AVR::R29R28)
111 .addReg(AVR::SP)
113
114 // Mark the FramePtr as live-in in every block except the entry.
115 for (MachineBasicBlock &MBBJ : llvm::drop_begin(MF)) {
116 MBBJ.addLiveIn(AVR::R29R28);
117 }
118
119 if (!FrameSize) {
120 return;
121 }
122
123 // Reserve the necessary frame memory by doing FP -= <size>.
124 unsigned Opcode = (isUInt<6>(FrameSize) && STI.hasADDSUBIW()) ? AVR::SBIWRdK
125 : AVR::SUBIWRdK;
126
127 MachineInstr *MI = BuildMI(MBB, MBBI, DL, TII.get(Opcode), AVR::R29R28)
128 .addReg(AVR::R29R28, RegState::Kill)
129 .addImm(FrameSize)
131 // The SREG implicit def is dead.
132 MI->getOperand(3).setIsDead();
133
134 // Write back R29R28 to SP and temporarily disable interrupts.
135 BuildMI(MBB, MBBI, DL, TII.get(AVR::SPWRITE), AVR::SP)
136 .addReg(AVR::R29R28)
138}
139
142 const MachineRegisterInfo &MRI = MF.getRegInfo();
143
144 MachineBasicBlock::iterator MBBI = MBB.getLastNonDebugInstr();
145
146 DebugLoc DL = MBBI->getDebugLoc();
147 const AVRSubtarget &STI = MF.getSubtarget<AVRSubtarget>();
148 const AVRInstrInfo &TII = *STI.getInstrInfo();
149
150 // Emit special epilogue code to restore R1, R0 and SREG in interrupt/signal
151 // handlers at the very end of the function, just before reti.
152 if (AFI->isInterruptOrSignalHandler()) {
153 if (!MRI.reg_empty(STI.getZeroRegister())) {
154 BuildMI(MBB, MBBI, DL, TII.get(AVR::POPRd), STI.getZeroRegister());
155 }
156 BuildMI(MBB, MBBI, DL, TII.get(AVR::POPRd), STI.getTmpRegister());
157 BuildMI(MBB, MBBI, DL, TII.get(AVR::OUTARr))
158 .addImm(STI.getIORegSREG())
160 BuildMI(MBB, MBBI, DL, TII.get(AVR::POPRd), STI.getTmpRegister());
161 }
162}
163
165 MachineBasicBlock &MBB) const {
167
168 // Early exit if the frame pointer is not needed in this function except for
169 // signal/interrupt handlers where special code generation is required.
170 if (!hasFP(MF) && !AFI->isInterruptOrSignalHandler()) {
171 return;
172 }
173
174 MachineBasicBlock::iterator MBBI = MBB.getLastNonDebugInstr();
175 assert(MBBI->getDesc().isReturn() &&
176 "Can only insert epilog into returning blocks");
177
178 DebugLoc DL = MBBI->getDebugLoc();
179 const MachineFrameInfo &MFI = MF.getFrameInfo();
180 unsigned FrameSize = MFI.getStackSize() - AFI->getCalleeSavedFrameSize();
181 const AVRSubtarget &STI = MF.getSubtarget<AVRSubtarget>();
182 const AVRInstrInfo &TII = *STI.getInstrInfo();
183
184 // Early exit if there is no need to restore the frame pointer.
185 if (!FrameSize && !MF.getFrameInfo().hasVarSizedObjects()) {
187 return;
188 }
189
190 // Skip the callee-saved pop instructions.
191 while (MBBI != MBB.begin()) {
192 MachineBasicBlock::iterator PI = std::prev(MBBI);
193 int Opc = PI->getOpcode();
194
195 if (Opc != AVR::POPRd && Opc != AVR::POPWRd && !PI->isTerminator()) {
196 break;
197 }
198
199 --MBBI;
200 }
201
202 if (FrameSize) {
203 // Restore the frame pointer by doing FP += <size>.
204 BuildMI(MBB, MBBI, DL, TII.get(AVR::ADIWRdKP), AVR::R29R28)
205 .addReg(AVR::R29R28, RegState::Kill)
206 .addImm(FrameSize)
207 .setOperandDead(3); // implicit-def $sreg
208 }
209
210 // Write back R29R28 to SP and temporarily disable interrupts.
211 BuildMI(MBB, MBBI, DL, TII.get(AVR::SPWRITE), AVR::SP)
212 .addReg(AVR::R29R28, RegState::Kill);
213
215}
216
218 int FI,
219 Register &FrameReg) const {
220 int64_t Offset;
221 const MachineFrameInfo &MFI = MF.getFrameInfo();
222
223 switch (MFI.getStackID(FI)) {
225 Offset = MFI.getObjectOffset(FI) + MFI.getOffsetAdjustment() +
227
228 assert(Offset > 0);
229 break;
230
232 Offset = MFI.getObjectOffset(FI);
233 assert(Offset >= 0);
234 break;
235
236 default:
237 llvm_unreachable("Unsupported stack!");
238 }
239
240 // Frame indices are addressed relative to the frame register (see
241 // AVRRegisterInfo::eliminateFrameIndex); callers such as the DWARF
242 // debug info emitter rely on it being reported back here.
243 FrameReg = MF.getSubtarget().getRegisterInfo()->getFrameRegister(MF);
244
246}
247
248// Return true if the specified function should have a dedicated frame
249// pointer register. This is true if the function meets any of the following
250// conditions:
251// - a register has been spilled
252// - has allocas
253// - input arguments are passed using the stack
254// - has variable sized objects
255// - the frame address is taken (llvm.frameaddress)
256// - the return address is taken (llvm.returnaddress)
257//
258// Notice that strictly this is not a frame pointer because it contains SP after
259// frame allocation instead of having the original SP in function entry.
261 const MachineFrameInfo &MFI = MF.getFrameInfo();
263
264 // Note that reading the return address requires a frame index, and that frame
265 // indexes are always referenced through Y (see
266 // AVRRegisterInfo::eliminateFrameIndex).
267 return (FuncInfo->getHasSpills() || FuncInfo->getHasAllocas() ||
268 FuncInfo->getHasStackArgs() || MFI.hasVarSizedObjects() ||
270}
271
275 if (CSI.empty()) {
276 return false;
277 }
278
279 unsigned CalleeFrameSize = 0;
280 DebugLoc DL = MBB.findDebugLoc(MI);
281 MachineFunction &MF = *MBB.getParent();
282 const AVRSubtarget &STI = MF.getSubtarget<AVRSubtarget>();
283 const TargetInstrInfo &TII = *STI.getInstrInfo();
285
286 for (const CalleeSavedInfo &I : llvm::reverse(CSI)) {
287 MCRegister Reg = I.getReg();
288 bool IsNotLiveIn = !MBB.isLiveIn(Reg);
289
290 // Check if Reg is a sub register of a 16-bit livein register, and then
291 // add it to the livein list.
292 if (IsNotLiveIn)
293 for (const auto &LiveIn : MBB.liveins())
294 if (STI.getRegisterInfo()->isSubRegister(LiveIn.PhysReg, Reg)) {
295 IsNotLiveIn = false;
296 MBB.addLiveIn(Reg);
297 break;
298 }
299
300 assert(TRI->getRegSizeInBits(*TRI->getMinimalPhysRegClass(Reg)) == 8 &&
301 "Invalid register size");
302
303 // Add the callee-saved register as live-in only if it is not already a
304 // live-in register, this usually happens with arguments that are passed
305 // through callee-saved registers.
306 if (IsNotLiveIn) {
307 MBB.addLiveIn(Reg);
308 }
309
310 // Do not kill the register when it is an input argument.
311 BuildMI(MBB, MI, DL, TII.get(AVR::PUSHRr))
312 .addReg(Reg, getKillRegState(IsNotLiveIn))
314 ++CalleeFrameSize;
315 }
316
317 AVRFI->setCalleeSavedFrameSize(CalleeFrameSize);
318
319 return true;
320}
321
325 if (CSI.empty()) {
326 return false;
327 }
328
329 DebugLoc DL = MBB.findDebugLoc(MI);
330 const MachineFunction &MF = *MBB.getParent();
331 const AVRSubtarget &STI = MF.getSubtarget<AVRSubtarget>();
332 const TargetInstrInfo &TII = *STI.getInstrInfo();
333
334 for (const CalleeSavedInfo &CCSI : CSI) {
335 MCRegister Reg = CCSI.getReg();
336
337 assert(TRI->getRegSizeInBits(*TRI->getMinimalPhysRegClass(Reg)) == 8 &&
338 "Invalid register size");
339
340 BuildMI(MBB, MI, DL, TII.get(AVR::POPRd), Reg);
341 }
342
343 return true;
344}
345
346/// Replace pseudo store instructions that pass arguments through the stack with
347/// real instructions.
350 const TargetInstrInfo &TII) {
351 // Iterate through the BB until we hit a call instruction or we reach the end.
352 for (MachineInstr &MI :
354 if (MI.isCall())
355 break;
356
357 unsigned Opcode = MI.getOpcode();
358
359 // Only care of pseudo store instructions where SP is the base pointer.
360 if (Opcode != AVR::STDSPQRr && Opcode != AVR::STDWSPQRr)
361 continue;
362
363 assert(MI.getOperand(0).getReg() == AVR::SP &&
364 "SP is expected as base pointer");
365
366 // Replace this instruction with a regular store. Use Y as the base
367 // pointer since it is guaranteed to contain a copy of SP.
368 unsigned STOpc =
369 (Opcode == AVR::STDWSPQRr) ? AVR::STDWPtrQRr : AVR::STDPtrQRr;
370
371 MI.setDesc(TII.get(STOpc));
372 MI.getOperand(0).setReg(AVR::R31R30);
373 }
374}
375
379 const AVRSubtarget &STI = MF.getSubtarget<AVRSubtarget>();
380 const AVRInstrInfo &TII = *STI.getInstrInfo();
381
382 if (hasReservedCallFrame(MF)) {
383 return MBB.erase(MI);
384 }
385
386 DebugLoc DL = MI->getDebugLoc();
387 unsigned int Opcode = MI->getOpcode();
388 int Amount = TII.getFrameSize(*MI);
389
390 if (Amount == 0) {
391 return MBB.erase(MI);
392 }
393
394 assert(getStackAlign() == Align(1) && "Unsupported stack alignment");
395
396 if (Opcode == TII.getCallFrameSetupOpcode()) {
397 // Update the stack pointer.
398 // In many cases this can be done far more efficiently by pushing the
399 // relevant values directly to the stack. However, doing that correctly
400 // (in the right order, possibly skipping some empty space for undef
401 // values, etc) is tricky and thus left to be optimized in the future.
402 BuildMI(MBB, MI, DL, TII.get(AVR::SPREAD), AVR::R31R30).addReg(AVR::SP);
403
404 MachineInstr *New =
405 BuildMI(MBB, MI, DL, TII.get(AVR::SUBIWRdK), AVR::R31R30)
406 .addReg(AVR::R31R30, RegState::Kill)
407 .addImm(Amount);
408 New->getOperand(3).setIsDead();
409
410 BuildMI(MBB, MI, DL, TII.get(AVR::SPWRITE), AVR::SP).addReg(AVR::R31R30);
411
412 // Make sure the remaining stack stores are converted to real store
413 // instructions.
415 } else {
416 assert(Opcode == TII.getCallFrameDestroyOpcode());
417
418 // Note that small stack changes could be implemented more efficiently
419 // with a few pop instructions instead of the 8-9 instructions now
420 // required.
421
422 BuildMI(MBB, MI, DL, TII.get(AVR::SPREAD), AVR::R31R30).addReg(AVR::SP);
423
424 BuildMI(MBB, MI, DL, TII.get(AVR::ADIWRdKP), AVR::R31R30)
425 .addReg(AVR::R31R30, RegState::Kill)
426 .addImm(Amount)
427 .setOperandDead(3); // implicit-def $sreg
428
429 BuildMI(MBB, MI, DL, TII.get(AVR::SPWRITE), AVR::SP)
430 .addReg(AVR::R31R30, RegState::Kill);
431 }
432
433 return MBB.erase(MI);
434}
435
437 BitVector &SavedRegs,
438 RegScavenger *RS) const {
440
441 // If we have a frame pointer, the Y register needs to be saved as well.
442 if (hasFP(MF)) {
443 SavedRegs.set(AVR::R29);
444 SavedRegs.set(AVR::R28);
445 }
446}
447
448/// The frame analyzer pass.
449///
450/// Scans the function for allocas and used arguments
451/// that are passed through the stack.
453 static char ID;
455
457 const MachineFrameInfo &MFI = MF.getFrameInfo();
459
460 // If there are no fixed frame indexes during this stage it means there
461 // are allocas present in the function.
462 if (MFI.getNumObjects() != MFI.getNumFixedObjects()) {
463 // Check for the type of allocas present in the function. We only care
464 // about fixed size allocas so do not give false positives if only
465 // variable sized allocas are present.
466 for (unsigned i = 0, e = MFI.getObjectIndexEnd(); i != e; ++i) {
467 if (!MFI.isVariableSizedObjectIndex(i) && !MFI.isDeadObjectIndex(i)) {
468 AFI->setHasAllocas(true);
469 break;
470 }
471 }
472 }
473
474 // If there are fixed frame indexes present, scan the function to see if
475 // they are really being used.
476 if (MFI.getNumFixedObjects() == 0) {
477 return false;
478 }
479
480 // Ok fixed frame indexes present, now scan the function to see if they
481 // are really being used, otherwise we can ignore them.
482 for (const MachineBasicBlock &BB : MF) {
483 for (const MachineInstr &MI : BB) {
484 int Opcode = MI.getOpcode();
485
486 if ((Opcode != AVR::LDDRdPtrQ) && (Opcode != AVR::LDDWRdPtrQ) &&
487 (Opcode != AVR::STDPtrQRr) && (Opcode != AVR::STDWPtrQRr) &&
488 (Opcode != AVR::FRMIDX)) {
489 continue;
490 }
491
492 for (const MachineOperand &MO : MI.operands()) {
493 if (!MO.isFI()) {
494 continue;
495 }
496
497 if (MFI.isFixedObjectIndex(MO.getIndex())) {
498 AFI->setHasStackArgs(true);
499 return false;
500 }
501 }
502 }
503 }
504
505 return false;
506 }
507
508 StringRef getPassName() const override { return "AVR Frame Analyzer"; }
509};
510
511char AVRFrameAnalyzer::ID = 0;
512
513/// Creates instance of the frame analyzer pass.
515
516} // end of namespace llvm
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
const HexagonInstrInfo * TII
IRTranslator LLVM IR MI
#define I(x, y, z)
Definition MD5.cpp:57
Register Reg
Register const TargetRegisterInfo * TRI
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
MachineBasicBlock::iterator eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const override
This method is called during prolog/epilog code insertion to eliminate call frame setup and destroy p...
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
bool hasReservedCallFrame(const MachineFunction &MF) const override
hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required,...
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, MutableArrayRef< CalleeSavedInfo > CSI, const TargetRegisterInfo *TRI) const override
restoreCalleeSavedRegisters - Issues instruction(s) to restore all callee saved registers and returns...
bool canSimplifyCallFramePseudos(const MachineFunction &MF) const override
canSimplifyCallFramePseudos - When possible, it's best to simplify the call frame pseudo ops before d...
StackOffset getFrameIndexReference(const MachineFunction &MF, int FI, Register &FrameReg) const override
getFrameIndexReference - This method should return the base register and offset used to reference a f...
bool hasFPImpl(const MachineFunction &MF) const override
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const override
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, ArrayRef< CalleeSavedInfo > CSI, const TargetRegisterInfo *TRI) const override
spillCalleeSavedRegisters - Issues instruction(s) to spill all callee saved registers and returns tru...
Utilities related to the AVR instruction set.
Contains AVR-specific information for each MachineFunction.
void setCalleeSavedFrameSize(unsigned Bytes)
bool isInterruptOrSignalHandler() const
Checks if the function is some form of interrupt service routine.
A specific AVR target MCU.
Register getTmpRegister() const
Register getZeroRegister() const
const AVRInstrInfo * getInstrInfo() const override
int getIORegSREG() const
const AVRRegisterInfo * getRegisterInfo() const override
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
bool empty() const
Check if the array is empty.
Definition ArrayRef.h:136
BitVector & set()
Set all bits in the bitvector.
Definition BitVector.h:366
The CalleeSavedInfo class tracks the information need to locate where a callee saved register is in t...
A debug info location.
Definition DebugLoc.h:126
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:312
Wrapper class representing physical registers. Should be passed by value.
Definition MCRegister.h:41
MachineInstrBundleIterator< MachineInstr > iterator
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects.
bool isReturnAddressTaken() const
This method may be called any time after instruction selection is complete to determine if there is a...
bool isFrameAddressTaken() const
This method may be called any time after instruction selection is complete to determine if there is a...
int64_t getOffsetAdjustment() const
Return the correction for frame offsets.
unsigned getNumObjects() const
Return the number of objects.
bool isVariableSizedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a variable sized object.
int getObjectIndexEnd() const
Return one past the maximum frame object index.
uint8_t getStackID(int ObjectIdx) const
unsigned getNumFixedObjects() const
Return the number of fixed objects.
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
bool isFixedObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a fixed stack object.
bool isDeadObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a dead object.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
const MachineInstrBuilder & setOperandDead(unsigned OpIdx) const
const MachineInstrBuilder & addReg(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & setMIFlag(MachineInstr::MIFlag Flag) const
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Represent a mutable reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:294
Wrapper class representing virtual and physical registers.
Definition Register.h:20
StackOffset holds a fixed and a scalable offset in bytes.
Definition TypeSize.h:31
int64_t getFixed() const
Returns the fixed component of the stack.
Definition TypeSize.h:47
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
bool hasFP(const MachineFunction &MF) const
hasFP - Return true if the specified function should have a dedicated frame pointer register.
virtual void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
int getOffsetOfLocalArea() const
getOffsetOfLocalArea - This method returns the offset of the local area from the stack pointer on ent...
TargetFrameLowering(StackDirection D, Align StackAl, int LAO, Align TransAl=Align(1), bool StackReal=true)
Align getStackAlign() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
virtual Register getFrameRegister(const MachineFunction &MF) const =0
Debug information queries.
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
Definition STLExtras.h:316
@ Offset
Definition DWP.cpp:577
static void fixStackStores(MachineBasicBlock &MBB, MachineBasicBlock::iterator StartMI, const TargetInstrInfo &TII)
Replace pseudo store instructions that pass arguments through the stack with real instructions.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
@ Kill
The last use of a register.
@ Define
Register definition.
constexpr RegState getKillRegState(bool B)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
Definition STLExtras.h:649
FunctionPass * createAVRFrameAnalyzerPass()
Creates instance of the frame analyzer pass.
auto reverse(ContainerTy &&C)
Definition STLExtras.h:408
constexpr bool isUInt(uint64_t x)
Checks if an unsigned integer fits into the given bit width.
Definition MathExtras.h:190
static void restoreStatusRegister(MachineFunction &MF, MachineBasicBlock &MBB)
The frame analyzer pass.
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39