LLVM  14.0.0git
Thumb1FrameLowering.cpp
Go to the documentation of this file.
1 //===- Thumb1FrameLowering.cpp - Thumb1 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 Thumb1 implementation of TargetFrameLowering class.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "Thumb1FrameLowering.h"
14 #include "ARMBaseInstrInfo.h"
15 #include "ARMBaseRegisterInfo.h"
16 #include "ARMMachineFunctionInfo.h"
17 #include "ARMSubtarget.h"
18 #include "Thumb1InstrInfo.h"
19 #include "ThumbRegisterInfo.h"
20 #include "Utils/ARMBaseInfo.h"
21 #include "llvm/ADT/BitVector.h"
22 #include "llvm/ADT/STLExtras.h"
23 #include "llvm/ADT/SmallVector.h"
36 #include "llvm/IR/DebugLoc.h"
37 #include "llvm/MC/MCContext.h"
38 #include "llvm/MC/MCDwarf.h"
39 #include "llvm/MC/MCRegisterInfo.h"
40 #include "llvm/Support/Compiler.h"
43 #include <bitset>
44 #include <cassert>
45 #include <iterator>
46 #include <vector>
47 
48 using namespace llvm;
49 
51  : ARMFrameLowering(sti) {}
52 
54  const MachineFrameInfo &MFI = MF.getFrameInfo();
55  unsigned CFSize = MFI.getMaxCallFrameSize();
56  // It's not always a good idea to include the call frame as part of the
57  // stack frame. ARM (especially Thumb) has small immediate offset to
58  // address the stack frame. So a large call frame can cause poor codegen
59  // and may even makes it impossible to scavenge a register.
60  if (CFSize >= ((1 << 8) - 1) * 4 / 2) // Half of imm8 * 4
61  return false;
62 
63  return !MFI.hasVarSizedObjects();
64 }
65 
66 static void
69  const TargetInstrInfo &TII, const DebugLoc &dl,
70  const ThumbRegisterInfo &MRI, int NumBytes,
71  unsigned ScratchReg, unsigned MIFlags) {
72  // If it would take more than three instructions to adjust the stack pointer
73  // using tADDspi/tSUBspi, load an immediate instead.
74  if (std::abs(NumBytes) > 508 * 3) {
75  // We use a different codepath here from the normal
76  // emitThumbRegPlusImmediate so we don't have to deal with register
77  // scavenging. (Scavenging could try to use the emergency spill slot
78  // before we've actually finished setting up the stack.)
79  if (ScratchReg == ARM::NoRegister)
80  report_fatal_error("Failed to emit Thumb1 stack adjustment");
81  MachineFunction &MF = *MBB.getParent();
83  if (ST.genExecuteOnly()) {
84  BuildMI(MBB, MBBI, dl, TII.get(ARM::t2MOVi32imm), ScratchReg)
85  .addImm(NumBytes).setMIFlags(MIFlags);
86  } else {
87  MRI.emitLoadConstPool(MBB, MBBI, dl, ScratchReg, 0, NumBytes, ARMCC::AL,
88  0, MIFlags);
89  }
90  BuildMI(MBB, MBBI, dl, TII.get(ARM::tADDhirr), ARM::SP)
91  .addReg(ARM::SP)
92  .addReg(ScratchReg, RegState::Kill)
94  .setMIFlags(MIFlags);
95  return;
96  }
97  // FIXME: This is assuming the heuristics in emitThumbRegPlusImmediate
98  // won't change.
99  emitThumbRegPlusImmediate(MBB, MBBI, dl, ARM::SP, ARM::SP, NumBytes, TII,
100  MRI, MIFlags);
101 
102 }
103 
106  const TargetInstrInfo &TII, const DebugLoc &dl,
107  const ThumbRegisterInfo &MRI, int NumBytes,
108  unsigned MIFlags = MachineInstr::NoFlags) {
109  emitThumbRegPlusImmediate(MBB, MBBI, dl, ARM::SP, ARM::SP, NumBytes, TII,
110  MRI, MIFlags);
111 }
112 
113 
117  const Thumb1InstrInfo &TII =
118  *static_cast<const Thumb1InstrInfo *>(STI.getInstrInfo());
119  const ThumbRegisterInfo *RegInfo =
120  static_cast<const ThumbRegisterInfo *>(STI.getRegisterInfo());
121  if (!hasReservedCallFrame(MF)) {
122  // If we have alloca, convert as follows:
123  // ADJCALLSTACKDOWN -> sub, sp, sp, amount
124  // ADJCALLSTACKUP -> add, sp, sp, amount
125  MachineInstr &Old = *I;
126  DebugLoc dl = Old.getDebugLoc();
127  unsigned Amount = TII.getFrameSize(Old);
128  if (Amount != 0) {
129  // We need to keep the stack aligned properly. To do this, we round the
130  // amount of space needed for the outgoing arguments up to the next
131  // alignment boundary.
132  Amount = alignTo(Amount, getStackAlign());
133 
134  // Replace the pseudo instruction with a new instruction...
135  unsigned Opc = Old.getOpcode();
136  if (Opc == ARM::ADJCALLSTACKDOWN || Opc == ARM::tADJCALLSTACKDOWN) {
137  emitCallSPUpdate(MBB, I, TII, dl, *RegInfo, -Amount);
138  } else {
139  assert(Opc == ARM::ADJCALLSTACKUP || Opc == ARM::tADJCALLSTACKUP);
140  emitCallSPUpdate(MBB, I, TII, dl, *RegInfo, Amount);
141  }
142  }
143  }
144  return MBB.erase(I);
145 }
146 
148  MachineBasicBlock &MBB) const {
150  MachineFrameInfo &MFI = MF.getFrameInfo();
152  MachineModuleInfo &MMI = MF.getMMI();
153  const MCRegisterInfo *MRI = MMI.getContext().getRegisterInfo();
154  const ThumbRegisterInfo *RegInfo =
155  static_cast<const ThumbRegisterInfo *>(STI.getRegisterInfo());
156  const Thumb1InstrInfo &TII =
157  *static_cast<const Thumb1InstrInfo *>(STI.getInstrInfo());
158 
159  unsigned ArgRegsSaveSize = AFI->getArgRegsSaveSize();
160  unsigned NumBytes = MFI.getStackSize();
161  assert(NumBytes >= ArgRegsSaveSize &&
162  "ArgRegsSaveSize is included in NumBytes");
163  const std::vector<CalleeSavedInfo> &CSI = MFI.getCalleeSavedInfo();
164 
165  // Debug location must be unknown since the first debug location is used
166  // to determine the end of the prologue.
167  DebugLoc dl;
168 
169  Register FramePtr = RegInfo->getFrameRegister(MF);
170  Register BasePtr = RegInfo->getBaseRegister();
171  int CFAOffset = 0;
172 
173  // Thumb add/sub sp, imm8 instructions implicitly multiply the offset by 4.
174  NumBytes = (NumBytes + 3) & ~3;
175  MFI.setStackSize(NumBytes);
176 
177  // Determine the sizes of each callee-save spill areas and record which frame
178  // belongs to which callee-save spill areas.
179  unsigned GPRCS1Size = 0, GPRCS2Size = 0, DPRCSSize = 0;
180  int FramePtrSpillFI = 0;
181 
182  if (ArgRegsSaveSize) {
183  emitPrologueEpilogueSPUpdate(MBB, MBBI, TII, dl, *RegInfo, -ArgRegsSaveSize,
184  ARM::NoRegister, MachineInstr::FrameSetup);
185  CFAOffset += ArgRegsSaveSize;
186  unsigned CFIIndex =
187  MF.addFrameInst(MCCFIInstruction::cfiDefCfaOffset(nullptr, CFAOffset));
188  BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
189  .addCFIIndex(CFIIndex)
191  }
192 
193  if (!AFI->hasStackFrame()) {
194  if (NumBytes - ArgRegsSaveSize != 0) {
195  emitPrologueEpilogueSPUpdate(MBB, MBBI, TII, dl, *RegInfo,
196  -(NumBytes - ArgRegsSaveSize),
197  ARM::NoRegister, MachineInstr::FrameSetup);
198  CFAOffset += NumBytes - ArgRegsSaveSize;
199  unsigned CFIIndex = MF.addFrameInst(
200  MCCFIInstruction::cfiDefCfaOffset(nullptr, CFAOffset));
201  BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
202  .addCFIIndex(CFIIndex)
204  }
205  return;
206  }
207 
208  for (const CalleeSavedInfo &I : CSI) {
209  Register Reg = I.getReg();
210  int FI = I.getFrameIdx();
211  switch (Reg) {
212  case ARM::R8:
213  case ARM::R9:
214  case ARM::R10:
215  case ARM::R11:
216  if (STI.splitFramePushPop(MF)) {
217  GPRCS2Size += 4;
218  break;
219  }
221  case ARM::R4:
222  case ARM::R5:
223  case ARM::R6:
224  case ARM::R7:
225  case ARM::LR:
226  if (Reg == FramePtr)
227  FramePtrSpillFI = FI;
228  GPRCS1Size += 4;
229  break;
230  default:
231  DPRCSSize += 8;
232  }
233  }
234 
235  if (MBBI != MBB.end() && MBBI->getOpcode() == ARM::tPUSH) {
236  ++MBBI;
237  }
238 
239  // Determine starting offsets of spill areas.
240  unsigned DPRCSOffset = NumBytes - ArgRegsSaveSize - (GPRCS1Size + GPRCS2Size + DPRCSSize);
241  unsigned GPRCS2Offset = DPRCSOffset + DPRCSSize;
242  unsigned GPRCS1Offset = GPRCS2Offset + GPRCS2Size;
243  bool HasFP = hasFP(MF);
244  if (HasFP)
245  AFI->setFramePtrSpillOffset(MFI.getObjectOffset(FramePtrSpillFI) +
246  NumBytes);
247  AFI->setGPRCalleeSavedArea1Offset(GPRCS1Offset);
248  AFI->setGPRCalleeSavedArea2Offset(GPRCS2Offset);
249  AFI->setDPRCalleeSavedAreaOffset(DPRCSOffset);
250  NumBytes = DPRCSOffset;
251 
252  int FramePtrOffsetInBlock = 0;
253  unsigned adjustedGPRCS1Size = GPRCS1Size;
254  if (GPRCS1Size > 0 && GPRCS2Size == 0 &&
255  tryFoldSPUpdateIntoPushPop(STI, MF, &*std::prev(MBBI), NumBytes)) {
256  FramePtrOffsetInBlock = NumBytes;
257  adjustedGPRCS1Size += NumBytes;
258  NumBytes = 0;
259  }
260 
261  if (adjustedGPRCS1Size) {
262  CFAOffset += adjustedGPRCS1Size;
263  unsigned CFIIndex =
264  MF.addFrameInst(MCCFIInstruction::cfiDefCfaOffset(nullptr, CFAOffset));
265  BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
266  .addCFIIndex(CFIIndex)
268  }
269  for (const CalleeSavedInfo &I : CSI) {
270  Register Reg = I.getReg();
271  int FI = I.getFrameIdx();
272  switch (Reg) {
273  case ARM::R8:
274  case ARM::R9:
275  case ARM::R10:
276  case ARM::R11:
277  case ARM::R12:
278  if (STI.splitFramePushPop(MF))
279  break;
281  case ARM::R0:
282  case ARM::R1:
283  case ARM::R2:
284  case ARM::R3:
285  case ARM::R4:
286  case ARM::R5:
287  case ARM::R6:
288  case ARM::R7:
289  case ARM::LR:
290  unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createOffset(
291  nullptr, MRI->getDwarfRegNum(Reg, true), MFI.getObjectOffset(FI)));
292  BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
293  .addCFIIndex(CFIIndex)
295  break;
296  }
297  }
298 
299  // Adjust FP so it point to the stack slot that contains the previous FP.
300  if (HasFP) {
301  FramePtrOffsetInBlock +=
302  MFI.getObjectOffset(FramePtrSpillFI) + GPRCS1Size + ArgRegsSaveSize;
303  BuildMI(MBB, MBBI, dl, TII.get(ARM::tADDrSPi), FramePtr)
304  .addReg(ARM::SP)
305  .addImm(FramePtrOffsetInBlock / 4)
307  .add(predOps(ARMCC::AL));
308  if(FramePtrOffsetInBlock) {
309  CFAOffset -= FramePtrOffsetInBlock;
310  unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::cfiDefCfa(
311  nullptr, MRI->getDwarfRegNum(FramePtr, true), CFAOffset));
312  BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
313  .addCFIIndex(CFIIndex)
315  } else {
316  unsigned CFIIndex =
318  nullptr, MRI->getDwarfRegNum(FramePtr, true)));
319  BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
320  .addCFIIndex(CFIIndex)
322  }
323  if (NumBytes > 508)
324  // If offset is > 508 then sp cannot be adjusted in a single instruction,
325  // try restoring from fp instead.
326  AFI->setShouldRestoreSPFromFP(true);
327  }
328 
329  // Skip past the spilling of r8-r11, which could consist of multiple tPUSH
330  // and tMOVr instructions. We don't need to add any call frame information
331  // in-between these instructions, because they do not modify the high
332  // registers.
333  while (true) {
335  // Skip a run of tMOVr instructions
336  while (MBBI != MBB.end() && MBBI->getOpcode() == ARM::tMOVr)
337  MBBI++;
338  if (MBBI != MBB.end() && MBBI->getOpcode() == ARM::tPUSH) {
339  MBBI++;
340  } else {
341  // We have reached an instruction which is not a push, so the previous
342  // run of tMOVr instructions (which may have been empty) was not part of
343  // the prologue. Reset MBBI back to the last PUSH of the prologue.
344  MBBI = OldMBBI;
345  break;
346  }
347  }
348 
349  // Emit call frame information for the callee-saved high registers.
350  for (auto &I : CSI) {
351  Register Reg = I.getReg();
352  int FI = I.getFrameIdx();
353  switch (Reg) {
354  case ARM::R8:
355  case ARM::R9:
356  case ARM::R10:
357  case ARM::R11:
358  case ARM::R12: {
359  unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createOffset(
360  nullptr, MRI->getDwarfRegNum(Reg, true), MFI.getObjectOffset(FI)));
361  BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
362  .addCFIIndex(CFIIndex)
364  break;
365  }
366  default:
367  break;
368  }
369  }
370 
371  if (NumBytes) {
372  // Insert it after all the callee-save spills.
373  //
374  // For a large stack frame, we might need a scratch register to store
375  // the size of the frame. We know all callee-save registers are free
376  // at this point in the prologue, so pick one.
377  unsigned ScratchRegister = ARM::NoRegister;
378  for (auto &I : CSI) {
379  Register Reg = I.getReg();
380  if (isARMLowRegister(Reg) && !(HasFP && Reg == FramePtr)) {
381  ScratchRegister = Reg;
382  break;
383  }
384  }
385  emitPrologueEpilogueSPUpdate(MBB, MBBI, TII, dl, *RegInfo, -NumBytes,
386  ScratchRegister, MachineInstr::FrameSetup);
387  if (!HasFP) {
388  CFAOffset += NumBytes;
389  unsigned CFIIndex = MF.addFrameInst(
390  MCCFIInstruction::cfiDefCfaOffset(nullptr, CFAOffset));
391  BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
392  .addCFIIndex(CFIIndex)
394  }
395  }
396 
397  if (STI.isTargetELF() && HasFP)
399  AFI->getFramePtrSpillOffset());
400 
401  AFI->setGPRCalleeSavedArea1Size(GPRCS1Size);
402  AFI->setGPRCalleeSavedArea2Size(GPRCS2Size);
403  AFI->setDPRCalleeSavedAreaSize(DPRCSSize);
404 
405  if (RegInfo->hasStackRealignment(MF)) {
406  const unsigned NrBitsToZero = Log2(MFI.getMaxAlign());
407  // Emit the following sequence, using R4 as a temporary, since we cannot use
408  // SP as a source or destination register for the shifts:
409  // mov r4, sp
410  // lsrs r4, r4, #NrBitsToZero
411  // lsls r4, r4, #NrBitsToZero
412  // mov sp, r4
413  BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVr), ARM::R4)
414  .addReg(ARM::SP, RegState::Kill)
415  .add(predOps(ARMCC::AL));
416 
417  BuildMI(MBB, MBBI, dl, TII.get(ARM::tLSRri), ARM::R4)
418  .addDef(ARM::CPSR)
420  .addImm(NrBitsToZero)
421  .add(predOps(ARMCC::AL));
422 
423  BuildMI(MBB, MBBI, dl, TII.get(ARM::tLSLri), ARM::R4)
424  .addDef(ARM::CPSR)
426  .addImm(NrBitsToZero)
427  .add(predOps(ARMCC::AL));
428 
429  BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVr), ARM::SP)
431  .add(predOps(ARMCC::AL));
432 
433  AFI->setShouldRestoreSPFromFP(true);
434  }
435 
436  // If we need a base pointer, set it up here. It's whatever the value
437  // of the stack pointer is at this point. Any variable size objects
438  // will be allocated after this, so we can still use the base pointer
439  // to reference locals.
440  if (RegInfo->hasBasePointer(MF))
441  BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVr), BasePtr)
442  .addReg(ARM::SP)
443  .add(predOps(ARMCC::AL));
444 
445  // If the frame has variable sized objects then the epilogue must restore
446  // the sp from fp. We can assume there's an FP here since hasFP already
447  // checks for hasVarSizedObjects.
448  if (MFI.hasVarSizedObjects())
449  AFI->setShouldRestoreSPFromFP(true);
450 
451  // In some cases, virtual registers have been introduced, e.g. by uses of
452  // emitThumbRegPlusImmInReg.
454 }
455 
456 static bool isCSRestore(MachineInstr &MI, const MCPhysReg *CSRegs) {
457  if (MI.getOpcode() == ARM::tLDRspi && MI.getOperand(1).isFI() &&
458  isCalleeSavedRegister(MI.getOperand(0).getReg(), CSRegs))
459  return true;
460  else if (MI.getOpcode() == ARM::tPOP) {
461  return true;
462  } else if (MI.getOpcode() == ARM::tMOVr) {
463  Register Dst = MI.getOperand(0).getReg();
464  Register Src = MI.getOperand(1).getReg();
465  return ((ARM::tGPRRegClass.contains(Src) || Src == ARM::LR) &&
466  ARM::hGPRRegClass.contains(Dst));
467  }
468  return false;
469 }
470 
472  MachineBasicBlock &MBB) const {
474  DebugLoc dl = MBBI != MBB.end() ? MBBI->getDebugLoc() : DebugLoc();
475  MachineFrameInfo &MFI = MF.getFrameInfo();
477  const ThumbRegisterInfo *RegInfo =
478  static_cast<const ThumbRegisterInfo *>(STI.getRegisterInfo());
479  const Thumb1InstrInfo &TII =
480  *static_cast<const Thumb1InstrInfo *>(STI.getInstrInfo());
481 
482  unsigned ArgRegsSaveSize = AFI->getArgRegsSaveSize();
483  int NumBytes = (int)MFI.getStackSize();
484  assert((unsigned)NumBytes >= ArgRegsSaveSize &&
485  "ArgRegsSaveSize is included in NumBytes");
486  const MCPhysReg *CSRegs = RegInfo->getCalleeSavedRegs(&MF);
487  Register FramePtr = RegInfo->getFrameRegister(MF);
488 
489  if (!AFI->hasStackFrame()) {
490  if (NumBytes - ArgRegsSaveSize != 0)
491  emitPrologueEpilogueSPUpdate(MBB, MBBI, TII, dl, *RegInfo,
492  NumBytes - ArgRegsSaveSize, ARM::NoRegister,
494  } else {
495  // Unwind MBBI to point to first LDR / VLDRD.
496  if (MBBI != MBB.begin()) {
497  do
498  --MBBI;
499  while (MBBI != MBB.begin() && isCSRestore(*MBBI, CSRegs));
500  if (!isCSRestore(*MBBI, CSRegs))
501  ++MBBI;
502  }
503 
504  // Move SP to start of FP callee save spill area.
505  NumBytes -= (AFI->getGPRCalleeSavedArea1Size() +
508  ArgRegsSaveSize);
509 
510  if (AFI->shouldRestoreSPFromFP()) {
511  NumBytes = AFI->getFramePtrSpillOffset() - NumBytes;
512  // Reset SP based on frame pointer only if the stack frame extends beyond
513  // frame pointer stack slot, the target is ELF and the function has FP, or
514  // the target uses var sized objects.
515  if (NumBytes) {
516  assert(!MFI.getPristineRegs(MF).test(ARM::R4) &&
517  "No scratch register to restore SP from FP!");
519  TII, *RegInfo);
520  BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVr), ARM::SP)
521  .addReg(ARM::R4)
522  .add(predOps(ARMCC::AL));
523  } else
524  BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVr), ARM::SP)
525  .addReg(FramePtr)
526  .add(predOps(ARMCC::AL));
527  } else {
528  // For a large stack frame, we might need a scratch register to store
529  // the size of the frame. We know all callee-save registers are free
530  // at this point in the epilogue, so pick one.
531  unsigned ScratchRegister = ARM::NoRegister;
532  bool HasFP = hasFP(MF);
533  for (auto &I : MFI.getCalleeSavedInfo()) {
534  Register Reg = I.getReg();
535  if (isARMLowRegister(Reg) && !(HasFP && Reg == FramePtr)) {
536  ScratchRegister = Reg;
537  break;
538  }
539  }
540  if (MBBI != MBB.end() && MBBI->getOpcode() == ARM::tBX_RET &&
541  &MBB.front() != &*MBBI && std::prev(MBBI)->getOpcode() == ARM::tPOP) {
542  MachineBasicBlock::iterator PMBBI = std::prev(MBBI);
543  if (!tryFoldSPUpdateIntoPushPop(STI, MF, &*PMBBI, NumBytes))
544  emitPrologueEpilogueSPUpdate(MBB, PMBBI, TII, dl, *RegInfo, NumBytes,
545  ScratchRegister, MachineInstr::NoFlags);
546  } else if (!tryFoldSPUpdateIntoPushPop(STI, MF, &*MBBI, NumBytes))
547  emitPrologueEpilogueSPUpdate(MBB, MBBI, TII, dl, *RegInfo, NumBytes,
548  ScratchRegister, MachineInstr::NoFlags);
549  }
550  }
551 
552  if (needPopSpecialFixUp(MF)) {
553  bool Done = emitPopSpecialFixUp(MBB, /* DoIt */ true);
554  (void)Done;
555  assert(Done && "Emission of the special fixup failed!?");
556  }
557 }
558 
560  if (!needPopSpecialFixUp(*MBB.getParent()))
561  return true;
562 
563  MachineBasicBlock *TmpMBB = const_cast<MachineBasicBlock *>(&MBB);
564  return emitPopSpecialFixUp(*TmpMBB, /* DoIt */ false);
565 }
566 
567 bool Thumb1FrameLowering::needPopSpecialFixUp(const MachineFunction &MF) const {
568  ARMFunctionInfo *AFI =
569  const_cast<MachineFunction *>(&MF)->getInfo<ARMFunctionInfo>();
570  if (AFI->getArgRegsSaveSize())
571  return true;
572 
573  // LR cannot be encoded with Thumb1, i.e., it requires a special fix-up.
574  for (const CalleeSavedInfo &CSI : MF.getFrameInfo().getCalleeSavedInfo())
575  if (CSI.getReg() == ARM::LR)
576  return true;
577 
578  return false;
579 }
580 
581 static void findTemporariesForLR(const BitVector &GPRsNoLRSP,
582  const BitVector &PopFriendly,
583  const LivePhysRegs &UsedRegs, unsigned &PopReg,
584  unsigned &TmpReg, MachineRegisterInfo &MRI) {
585  PopReg = TmpReg = 0;
586  for (auto Reg : GPRsNoLRSP.set_bits()) {
587  if (UsedRegs.available(MRI, Reg)) {
588  // Remember the first pop-friendly register and exit.
589  if (PopFriendly.test(Reg)) {
590  PopReg = Reg;
591  TmpReg = 0;
592  break;
593  }
594  // Otherwise, remember that the register will be available to
595  // save a pop-friendly register.
596  TmpReg = Reg;
597  }
598  }
599 }
600 
601 bool Thumb1FrameLowering::emitPopSpecialFixUp(MachineBasicBlock &MBB,
602  bool DoIt) const {
603  MachineFunction &MF = *MBB.getParent();
605  unsigned ArgRegsSaveSize = AFI->getArgRegsSaveSize();
606  const TargetInstrInfo &TII = *STI.getInstrInfo();
607  const ThumbRegisterInfo *RegInfo =
608  static_cast<const ThumbRegisterInfo *>(STI.getRegisterInfo());
609 
610  // If MBBI is a return instruction, or is a tPOP followed by a return
611  // instruction in the successor BB, we may be able to directly restore
612  // LR in the PC.
613  // This is only possible with v5T ops (v4T can't change the Thumb bit via
614  // a POP PC instruction), and only if we do not need to emit any SP update.
615  // Otherwise, we need a temporary register to pop the value
616  // and copy that value into LR.
617  auto MBBI = MBB.getFirstTerminator();
618  bool CanRestoreDirectly = STI.hasV5TOps() && !ArgRegsSaveSize;
619  if (CanRestoreDirectly) {
620  if (MBBI != MBB.end() && MBBI->getOpcode() != ARM::tB)
621  CanRestoreDirectly = (MBBI->getOpcode() == ARM::tBX_RET ||
622  MBBI->getOpcode() == ARM::tPOP_RET);
623  else {
624  auto MBBI_prev = MBBI;
625  MBBI_prev--;
626  assert(MBBI_prev->getOpcode() == ARM::tPOP);
627  assert(MBB.succ_size() == 1);
628  if ((*MBB.succ_begin())->begin()->getOpcode() == ARM::tBX_RET)
629  MBBI = MBBI_prev; // Replace the final tPOP with a tPOP_RET.
630  else
631  CanRestoreDirectly = false;
632  }
633  }
634 
635  if (CanRestoreDirectly) {
636  if (!DoIt || MBBI->getOpcode() == ARM::tPOP_RET)
637  return true;
638  MachineInstrBuilder MIB =
639  BuildMI(MBB, MBBI, MBBI->getDebugLoc(), TII.get(ARM::tPOP_RET))
640  .add(predOps(ARMCC::AL));
641  // Copy implicit ops and popped registers, if any.
642  for (auto MO: MBBI->operands())
643  if (MO.isReg() && (MO.isImplicit() || MO.isDef()))
644  MIB.add(MO);
645  MIB.addReg(ARM::PC, RegState::Define);
646  // Erase the old instruction (tBX_RET or tPOP).
647  MBB.erase(MBBI);
648  return true;
649  }
650 
651  // Look for a temporary register to use.
652  // First, compute the liveness information.
654  LivePhysRegs UsedRegs(TRI);
655  UsedRegs.addLiveOuts(MBB);
656  // The semantic of pristines changed recently and now,
657  // the callee-saved registers that are touched in the function
658  // are not part of the pristines set anymore.
659  // Add those callee-saved now.
660  const MCPhysReg *CSRegs = TRI.getCalleeSavedRegs(&MF);
661  for (unsigned i = 0; CSRegs[i]; ++i)
662  UsedRegs.addReg(CSRegs[i]);
663 
664  DebugLoc dl = DebugLoc();
665  if (MBBI != MBB.end()) {
666  dl = MBBI->getDebugLoc();
667  auto InstUpToMBBI = MBB.end();
668  while (InstUpToMBBI != MBBI)
669  // The pre-decrement is on purpose here.
670  // We want to have the liveness right before MBBI.
671  UsedRegs.stepBackward(*--InstUpToMBBI);
672  }
673 
674  // Look for a register that can be directly use in the POP.
675  unsigned PopReg = 0;
676  // And some temporary register, just in case.
677  unsigned TemporaryReg = 0;
678  BitVector PopFriendly =
679  TRI.getAllocatableSet(MF, TRI.getRegClass(ARM::tGPRRegClassID));
680  // R7 may be used as a frame pointer, hence marked as not generally
681  // allocatable, however there's no reason to not use it as a temporary for
682  // restoring LR.
683  if (STI.getFramePointerReg() == ARM::R7)
684  PopFriendly.set(ARM::R7);
685 
686  assert(PopFriendly.any() && "No allocatable pop-friendly register?!");
687  // Rebuild the GPRs from the high registers because they are removed
688  // form the GPR reg class for thumb1.
689  BitVector GPRsNoLRSP =
690  TRI.getAllocatableSet(MF, TRI.getRegClass(ARM::hGPRRegClassID));
691  GPRsNoLRSP |= PopFriendly;
692  GPRsNoLRSP.reset(ARM::LR);
693  GPRsNoLRSP.reset(ARM::SP);
694  GPRsNoLRSP.reset(ARM::PC);
695  findTemporariesForLR(GPRsNoLRSP, PopFriendly, UsedRegs, PopReg, TemporaryReg,
696  MF.getRegInfo());
697 
698  // If we couldn't find a pop-friendly register, try restoring LR before
699  // popping the other callee-saved registers, so we could use one of them as a
700  // temporary.
701  bool UseLDRSP = false;
702  if (!PopReg && MBBI != MBB.begin()) {
703  auto PrevMBBI = MBBI;
704  PrevMBBI--;
705  if (PrevMBBI->getOpcode() == ARM::tPOP) {
706  UsedRegs.stepBackward(*PrevMBBI);
707  findTemporariesForLR(GPRsNoLRSP, PopFriendly, UsedRegs, PopReg,
708  TemporaryReg, MF.getRegInfo());
709  if (PopReg) {
710  MBBI = PrevMBBI;
711  UseLDRSP = true;
712  }
713  }
714  }
715 
716  if (!DoIt && !PopReg && !TemporaryReg)
717  return false;
718 
719  assert((PopReg || TemporaryReg) && "Cannot get LR");
720 
721  if (UseLDRSP) {
722  assert(PopReg && "Do not know how to get LR");
723  // Load the LR via LDR tmp, [SP, #off]
724  BuildMI(MBB, MBBI, dl, TII.get(ARM::tLDRspi))
725  .addReg(PopReg, RegState::Define)
726  .addReg(ARM::SP)
727  .addImm(MBBI->getNumExplicitOperands() - 2)
728  .add(predOps(ARMCC::AL));
729  // Move from the temporary register to the LR.
730  BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVr))
731  .addReg(ARM::LR, RegState::Define)
732  .addReg(PopReg, RegState::Kill)
733  .add(predOps(ARMCC::AL));
734  // Advance past the pop instruction.
735  MBBI++;
736  // Increment the SP.
737  emitPrologueEpilogueSPUpdate(MBB, MBBI, TII, dl, *RegInfo,
738  ArgRegsSaveSize + 4, ARM::NoRegister,
740  return true;
741  }
742 
743  if (TemporaryReg) {
744  assert(!PopReg && "Unnecessary MOV is about to be inserted");
745  PopReg = PopFriendly.find_first();
746  BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVr))
747  .addReg(TemporaryReg, RegState::Define)
748  .addReg(PopReg, RegState::Kill)
749  .add(predOps(ARMCC::AL));
750  }
751 
752  if (MBBI != MBB.end() && MBBI->getOpcode() == ARM::tPOP_RET) {
753  // We couldn't use the direct restoration above, so
754  // perform the opposite conversion: tPOP_RET to tPOP.
755  MachineInstrBuilder MIB =
756  BuildMI(MBB, MBBI, MBBI->getDebugLoc(), TII.get(ARM::tPOP))
757  .add(predOps(ARMCC::AL));
758  bool Popped = false;
759  for (auto MO: MBBI->operands())
760  if (MO.isReg() && (MO.isImplicit() || MO.isDef()) &&
761  MO.getReg() != ARM::PC) {
762  MIB.add(MO);
763  if (!MO.isImplicit())
764  Popped = true;
765  }
766  // Is there anything left to pop?
767  if (!Popped)
768  MBB.erase(MIB.getInstr());
769  // Erase the old instruction.
770  MBB.erase(MBBI);
771  MBBI = BuildMI(MBB, MBB.end(), dl, TII.get(ARM::tBX_RET))
772  .add(predOps(ARMCC::AL));
773  }
774 
775  assert(PopReg && "Do not know how to get LR");
776  BuildMI(MBB, MBBI, dl, TII.get(ARM::tPOP))
778  .addReg(PopReg, RegState::Define);
779 
780  emitPrologueEpilogueSPUpdate(MBB, MBBI, TII, dl, *RegInfo, ArgRegsSaveSize,
781  ARM::NoRegister, MachineInstr::NoFlags);
782 
783  BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVr))
784  .addReg(ARM::LR, RegState::Define)
785  .addReg(PopReg, RegState::Kill)
786  .add(predOps(ARMCC::AL));
787 
788  if (TemporaryReg)
789  BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVr))
790  .addReg(PopReg, RegState::Define)
791  .addReg(TemporaryReg, RegState::Kill)
792  .add(predOps(ARMCC::AL));
793 
794  return true;
795 }
796 
797 using ARMRegSet = std::bitset<ARM::NUM_TARGET_REGS>;
798 
799 // Return the first iteraror after CurrentReg which is present in EnabledRegs,
800 // or OrderEnd if no further registers are in that set. This does not advance
801 // the iterator fiorst, so returns CurrentReg if it is in EnabledRegs.
802 static const unsigned *findNextOrderedReg(const unsigned *CurrentReg,
803  const ARMRegSet &EnabledRegs,
804  const unsigned *OrderEnd) {
805  while (CurrentReg != OrderEnd && !EnabledRegs[*CurrentReg])
806  ++CurrentReg;
807  return CurrentReg;
808 }
809 
813  if (CSI.empty())
814  return false;
815 
816  DebugLoc DL;
817  const TargetInstrInfo &TII = *STI.getInstrInfo();
818  MachineFunction &MF = *MBB.getParent();
819  const ARMBaseRegisterInfo *RegInfo = static_cast<const ARMBaseRegisterInfo *>(
821 
822  ARMRegSet LoRegsToSave; // r0-r7, lr
823  ARMRegSet HiRegsToSave; // r8-r11
824  ARMRegSet CopyRegs; // Registers which can be used after pushing
825  // LoRegs for saving HiRegs.
826 
827  for (const CalleeSavedInfo &I : llvm::reverse(CSI)) {
828  Register Reg = I.getReg();
829 
830  if (ARM::tGPRRegClass.contains(Reg) || Reg == ARM::LR) {
831  LoRegsToSave[Reg] = true;
832  } else if (ARM::hGPRRegClass.contains(Reg) && Reg != ARM::LR) {
833  HiRegsToSave[Reg] = true;
834  } else {
835  llvm_unreachable("callee-saved register of unexpected class");
836  }
837 
838  if ((ARM::tGPRRegClass.contains(Reg) || Reg == ARM::LR) &&
839  !MF.getRegInfo().isLiveIn(Reg) &&
840  !(hasFP(MF) && Reg == RegInfo->getFrameRegister(MF)))
841  CopyRegs[Reg] = true;
842  }
843 
844  // Unused argument registers can be used for the high register saving.
845  for (unsigned ArgReg : {ARM::R0, ARM::R1, ARM::R2, ARM::R3})
846  if (!MF.getRegInfo().isLiveIn(ArgReg))
847  CopyRegs[ArgReg] = true;
848 
849  // Push the low registers and lr
850  const MachineRegisterInfo &MRI = MF.getRegInfo();
851  if (!LoRegsToSave.none()) {
852  MachineInstrBuilder MIB =
853  BuildMI(MBB, MI, DL, TII.get(ARM::tPUSH)).add(predOps(ARMCC::AL));
854  for (unsigned Reg : {ARM::R4, ARM::R5, ARM::R6, ARM::R7, ARM::LR}) {
855  if (LoRegsToSave[Reg]) {
856  bool isKill = !MRI.isLiveIn(Reg);
857  if (isKill && !MRI.isReserved(Reg))
858  MBB.addLiveIn(Reg);
859 
860  MIB.addReg(Reg, getKillRegState(isKill));
861  }
862  }
864  }
865 
866  // Push the high registers. There are no store instructions that can access
867  // these registers directly, so we have to move them to low registers, and
868  // push them. This might take multiple pushes, as it is possible for there to
869  // be fewer low registers available than high registers which need saving.
870 
871  // These are in reverse order so that in the case where we need to use
872  // multiple PUSH instructions, the order of the registers on the stack still
873  // matches the unwind info. They need to be swicthed back to ascending order
874  // before adding to the PUSH instruction.
875  static const unsigned AllCopyRegs[] = {ARM::LR, ARM::R7, ARM::R6,
876  ARM::R5, ARM::R4, ARM::R3,
877  ARM::R2, ARM::R1, ARM::R0};
878  static const unsigned AllHighRegs[] = {ARM::R11, ARM::R10, ARM::R9, ARM::R8};
879 
880  const unsigned *AllCopyRegsEnd = std::end(AllCopyRegs);
881  const unsigned *AllHighRegsEnd = std::end(AllHighRegs);
882 
883  // Find the first register to save.
884  const unsigned *HiRegToSave = findNextOrderedReg(
885  std::begin(AllHighRegs), HiRegsToSave, AllHighRegsEnd);
886 
887  while (HiRegToSave != AllHighRegsEnd) {
888  // Find the first low register to use.
889  const unsigned *CopyReg =
890  findNextOrderedReg(std::begin(AllCopyRegs), CopyRegs, AllCopyRegsEnd);
891 
892  // Create the PUSH, but don't insert it yet (the MOVs need to come first).
893  MachineInstrBuilder PushMIB = BuildMI(MF, DL, TII.get(ARM::tPUSH))
896 
897  SmallVector<unsigned, 4> RegsToPush;
898  while (HiRegToSave != AllHighRegsEnd && CopyReg != AllCopyRegsEnd) {
899  if (HiRegsToSave[*HiRegToSave]) {
900  bool isKill = !MRI.isLiveIn(*HiRegToSave);
901  if (isKill && !MRI.isReserved(*HiRegToSave))
902  MBB.addLiveIn(*HiRegToSave);
903 
904  // Emit a MOV from the high reg to the low reg.
905  BuildMI(MBB, MI, DL, TII.get(ARM::tMOVr))
906  .addReg(*CopyReg, RegState::Define)
907  .addReg(*HiRegToSave, getKillRegState(isKill))
910 
911  // Record the register that must be added to the PUSH.
912  RegsToPush.push_back(*CopyReg);
913 
914  CopyReg = findNextOrderedReg(++CopyReg, CopyRegs, AllCopyRegsEnd);
915  HiRegToSave =
916  findNextOrderedReg(++HiRegToSave, HiRegsToSave, AllHighRegsEnd);
917  }
918  }
919 
920  // Add the low registers to the PUSH, in ascending order.
921  for (unsigned Reg : llvm::reverse(RegsToPush))
922  PushMIB.addReg(Reg, RegState::Kill);
923 
924  // Insert the PUSH instruction after the MOVs.
925  MBB.insert(MI, PushMIB);
926  }
927 
928  return true;
929 }
930 
934  if (CSI.empty())
935  return false;
936 
937  MachineFunction &MF = *MBB.getParent();
939  const TargetInstrInfo &TII = *STI.getInstrInfo();
940  const ARMBaseRegisterInfo *RegInfo = static_cast<const ARMBaseRegisterInfo *>(
942 
943  bool isVarArg = AFI->getArgRegsSaveSize() > 0;
944  DebugLoc DL = MI != MBB.end() ? MI->getDebugLoc() : DebugLoc();
945 
946  ARMRegSet LoRegsToRestore;
947  ARMRegSet HiRegsToRestore;
948  // Low registers (r0-r7) which can be used to restore the high registers.
949  ARMRegSet CopyRegs;
950 
951  for (CalleeSavedInfo I : CSI) {
952  Register Reg = I.getReg();
953 
954  if (ARM::tGPRRegClass.contains(Reg) || Reg == ARM::LR) {
955  LoRegsToRestore[Reg] = true;
956  } else if (ARM::hGPRRegClass.contains(Reg) && Reg != ARM::LR) {
957  HiRegsToRestore[Reg] = true;
958  } else {
959  llvm_unreachable("callee-saved register of unexpected class");
960  }
961 
962  // If this is a low register not used as the frame pointer, we may want to
963  // use it for restoring the high registers.
964  if ((ARM::tGPRRegClass.contains(Reg)) &&
965  !(hasFP(MF) && Reg == RegInfo->getFrameRegister(MF)))
966  CopyRegs[Reg] = true;
967  }
968 
969  // If this is a return block, we may be able to use some unused return value
970  // registers for restoring the high regs.
972  if (Terminator != MBB.end() && Terminator->getOpcode() == ARM::tBX_RET) {
973  CopyRegs[ARM::R0] = true;
974  CopyRegs[ARM::R1] = true;
975  CopyRegs[ARM::R2] = true;
976  CopyRegs[ARM::R3] = true;
977  for (auto Op : Terminator->implicit_operands()) {
978  if (Op.isReg())
979  CopyRegs[Op.getReg()] = false;
980  }
981  }
982 
983  static const unsigned AllCopyRegs[] = {ARM::R0, ARM::R1, ARM::R2, ARM::R3,
984  ARM::R4, ARM::R5, ARM::R6, ARM::R7};
985  static const unsigned AllHighRegs[] = {ARM::R8, ARM::R9, ARM::R10, ARM::R11};
986 
987  const unsigned *AllCopyRegsEnd = std::end(AllCopyRegs);
988  const unsigned *AllHighRegsEnd = std::end(AllHighRegs);
989 
990  // Find the first register to restore.
991  auto HiRegToRestore = findNextOrderedReg(std::begin(AllHighRegs),
992  HiRegsToRestore, AllHighRegsEnd);
993 
994  while (HiRegToRestore != AllHighRegsEnd) {
995  assert(!CopyRegs.none());
996  // Find the first low register to use.
997  auto CopyReg =
998  findNextOrderedReg(std::begin(AllCopyRegs), CopyRegs, AllCopyRegsEnd);
999 
1000  // Create the POP instruction.
1001  MachineInstrBuilder PopMIB =
1002  BuildMI(MBB, MI, DL, TII.get(ARM::tPOP)).add(predOps(ARMCC::AL));
1003 
1004  while (HiRegToRestore != AllHighRegsEnd && CopyReg != AllCopyRegsEnd) {
1005  // Add the low register to the POP.
1006  PopMIB.addReg(*CopyReg, RegState::Define);
1007 
1008  // Create the MOV from low to high register.
1009  BuildMI(MBB, MI, DL, TII.get(ARM::tMOVr))
1010  .addReg(*HiRegToRestore, RegState::Define)
1011  .addReg(*CopyReg, RegState::Kill)
1012  .add(predOps(ARMCC::AL));
1013 
1014  CopyReg = findNextOrderedReg(++CopyReg, CopyRegs, AllCopyRegsEnd);
1015  HiRegToRestore =
1016  findNextOrderedReg(++HiRegToRestore, HiRegsToRestore, AllHighRegsEnd);
1017  }
1018  }
1019 
1020  MachineInstrBuilder MIB =
1021  BuildMI(MF, DL, TII.get(ARM::tPOP)).add(predOps(ARMCC::AL));
1022 
1023  bool NeedsPop = false;
1024  for (CalleeSavedInfo &Info : llvm::reverse(CSI)) {
1025  Register Reg = Info.getReg();
1026 
1027  // High registers (excluding lr) have already been dealt with
1028  if (!(ARM::tGPRRegClass.contains(Reg) || Reg == ARM::LR))
1029  continue;
1030 
1031  if (Reg == ARM::LR) {
1032  Info.setRestored(false);
1033  if (!MBB.succ_empty() ||
1034  MI->getOpcode() == ARM::TCRETURNdi ||
1035  MI->getOpcode() == ARM::TCRETURNri)
1036  // LR may only be popped into PC, as part of return sequence.
1037  // If this isn't the return sequence, we'll need emitPopSpecialFixUp
1038  // to restore LR the hard way.
1039  // FIXME: if we don't pass any stack arguments it would be actually
1040  // advantageous *and* correct to do the conversion to an ordinary call
1041  // instruction here.
1042  continue;
1043  // Special epilogue for vararg functions. See emitEpilogue
1044  if (isVarArg)
1045  continue;
1046  // ARMv4T requires BX, see emitEpilogue
1047  if (!STI.hasV5TOps())
1048  continue;
1049 
1050  // CMSE entry functions must return via BXNS, see emitEpilogue.
1051  if (AFI->isCmseNSEntryFunction())
1052  continue;
1053 
1054  // Pop LR into PC.
1055  Reg = ARM::PC;
1056  (*MIB).setDesc(TII.get(ARM::tPOP_RET));
1057  if (MI != MBB.end())
1058  MIB.copyImplicitOps(*MI);
1059  MI = MBB.erase(MI);
1060  }
1061  MIB.addReg(Reg, getDefRegState(true));
1062  NeedsPop = true;
1063  }
1064 
1065  // It's illegal to emit pop instruction without operands.
1066  if (NeedsPop)
1067  MBB.insert(MI, &*MIB);
1068  else
1069  MF.deleteMachineInstr(MIB);
1070 
1071  return true;
1072 }
llvm::Thumb1FrameLowering::restoreCalleeSavedRegisters
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...
Definition: Thumb1FrameLowering.cpp:931
i
i
Definition: README.txt:29
ARMSubtarget.h
llvm::alignTo
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition: Alignment.h:148
llvm::MachineFrameInfo::hasVarSizedObjects
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
Definition: MachineFrameInfo.h:353
llvm::MachineBasicBlock::succ_size
unsigned succ_size() const
Definition: MachineBasicBlock.h:348
llvm::ARMFunctionInfo
ARMFunctionInfo - This class is derived from MachineFunctionInfo and contains private ARM-specific in...
Definition: ARMMachineFunctionInfo.h:27
MCDwarf.h
MI
IRTranslator LLVM IR MI
Definition: IRTranslator.cpp:105
MachineInstr.h
llvm::ARMSubtarget::hasV5TOps
bool hasV5TOps() const
Definition: ARMSubtarget.h:627
MathExtras.h
llvm::MachineInstrBuilder::addImm
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Definition: MachineInstrBuilder.h:131
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::MachineInstrBuilder::copyImplicitOps
const MachineInstrBuilder & copyImplicitOps(const MachineInstr &OtherMI) const
Copy all the implicit operands from OtherMI onto this one.
Definition: MachineInstrBuilder.h:315
Reg
unsigned Reg
Definition: MachineSink.cpp:1563
llvm::ARMFunctionInfo::setGPRCalleeSavedArea2Size
void setGPRCalleeSavedArea2Size(unsigned s)
Definition: ARMMachineFunctionInfo.h:208
llvm::ARMSubtarget
Definition: ARMSubtarget.h:47
llvm::MachineRegisterInfo
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Definition: MachineRegisterInfo.h:52
llvm::MachineInstrBuilder::add
const MachineInstrBuilder & add(const MachineOperand &MO) const
Definition: MachineInstrBuilder.h:224
llvm::ARMFunctionInfo::shouldRestoreSPFromFP
bool shouldRestoreSPFromFP() const
Definition: ARMMachineFunctionInfo.h:180
llvm::BitVector::set
BitVector & set()
Definition: BitVector.h:343
llvm::ARMFunctionInfo::setGPRCalleeSavedArea1Size
void setGPRCalleeSavedArea1Size(unsigned s)
Definition: ARMMachineFunctionInfo.h:207
llvm::Thumb1FrameLowering::Thumb1FrameLowering
Thumb1FrameLowering(const ARMSubtarget &sti)
Definition: Thumb1FrameLowering.cpp:50
llvm::MachineInstrBuilder::addCFIIndex
const MachineInstrBuilder & addCFIIndex(unsigned CFIIndex) const
Definition: MachineInstrBuilder.h:247
contains
return AArch64::GPR64RegClass contains(Reg)
llvm::SmallVector< unsigned, 4 >
ErrorHandling.h
llvm::TargetRegisterInfo::getAllocatableSet
BitVector getAllocatableSet(const MachineFunction &MF, const TargetRegisterClass *RC=nullptr) const
Returns a bitset indexed by register number indicating if a register is allocatable or not.
Definition: TargetRegisterInfo.cpp:255
llvm::ARMFunctionInfo::getGPRCalleeSavedArea1Size
unsigned getGPRCalleeSavedArea1Size() const
Definition: ARMMachineFunctionInfo.h:201
ARMMachineFunctionInfo.h
emitPrologueEpilogueSPUpdate
static void emitPrologueEpilogueSPUpdate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, const TargetInstrInfo &TII, const DebugLoc &dl, const ThumbRegisterInfo &MRI, int NumBytes, unsigned ScratchReg, unsigned MIFlags)
Definition: Thumb1FrameLowering.cpp:67
llvm::BitVector::set_bits
iterator_range< const_set_bits_iterator > set_bits() const
Definition: BitVector.h:132
llvm::MachineFrameInfo::getOffsetAdjustment
int getOffsetAdjustment() const
Return the correction for frame offsets.
Definition: MachineFrameInfo.h:562
llvm::ARMFunctionInfo::getGPRCalleeSavedArea2Size
unsigned getGPRCalleeSavedArea2Size() const
Definition: ARMMachineFunctionInfo.h:202
MachineBasicBlock.h
llvm::LivePhysRegs
A set of physical registers with utility functions to track liveness when walking backward/forward th...
Definition: LivePhysRegs.h:48
llvm::TargetSubtargetInfo::getRegisterInfo
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
Definition: TargetSubtargetInfo.h:124
R4
#define R4(n)
llvm::TargetRegisterInfo
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Definition: TargetRegisterInfo.h:233
llvm::Thumb1FrameLowering::canUseAsEpilogue
bool canUseAsEpilogue(const MachineBasicBlock &MBB) const override
Check whether or not the given MBB can be used as a epilogue for the target.
Definition: Thumb1FrameLowering.cpp:559
llvm::MachineFrameInfo::setStackSize
void setStackSize(uint64_t Size)
Set the size of the stack.
Definition: MachineFrameInfo.h:556
llvm::reverse
auto reverse(ContainerTy &&C, std::enable_if_t< has_rbegin< ContainerTy >::value > *=nullptr)
Definition: STLExtras.h:414
TargetInstrInfo.h
llvm::sys::path::end
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:236
llvm::sys::path::begin
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:227
llvm::ARMSubtarget::getInstrInfo
const ARMBaseInstrInfo * getInstrInfo() const override
Definition: ARMSubtarget.h:583
Thumb1InstrInfo.h
llvm::RegState::Kill
@ Kill
The last use of a register.
Definition: MachineInstrBuilder.h:48
Thumb1FrameLowering.h
STLExtras.h
TRI
unsigned const TargetRegisterInfo * TRI
Definition: MachineSink.cpp:1564
llvm::MachineFrameInfo::getMaxCallFrameSize
unsigned getMaxCallFrameSize() const
Return the maximum size of a call frame that must be allocated for an outgoing function call.
Definition: MachineFrameInfo.h:622
llvm::ArrayRef::empty
bool empty() const
empty - Check if the array is empty.
Definition: ArrayRef.h:158
llvm::MCCFIInstruction::cfiDefCfaOffset
static MCCFIInstruction cfiDefCfaOffset(MCSymbol *L, int Offset)
.cfi_def_cfa_offset modifies a rule for computing CFA.
Definition: MCDwarf.h:538
MachineRegisterInfo.h
llvm::ARMBaseRegisterInfo::getBaseRegister
Register getBaseRegister() const
Definition: ARMBaseRegisterInfo.h:182
llvm::MachineBasicBlock::erase
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
Definition: MachineBasicBlock.cpp:1298
llvm::ARMFunctionInfo::getDPRCalleeSavedAreaSize
unsigned getDPRCalleeSavedAreaSize() const
Definition: ARMMachineFunctionInfo.h:204
llvm::ARMFunctionInfo::isCmseNSEntryFunction
bool isCmseNSEntryFunction() const
Definition: ARMMachineFunctionInfo.h:165
llvm::TargetRegisterInfo::getCalleeSavedRegs
virtual const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const =0
Return a null-terminated list of all of the callee-saved registers on this target.
findTemporariesForLR
static void findTemporariesForLR(const BitVector &GPRsNoLRSP, const BitVector &PopFriendly, const LivePhysRegs &UsedRegs, unsigned &PopReg, unsigned &TmpReg, MachineRegisterInfo &MRI)
Definition: Thumb1FrameLowering.cpp:581
llvm::MachineInstrBuilder::addDef
const MachineInstrBuilder & addDef(Register RegNo, unsigned Flags=0, unsigned SubReg=0) const
Add a virtual register definition operand.
Definition: MachineInstrBuilder.h:116
llvm::ARMSubtarget::splitFramePushPop
bool splitFramePushPop(const MachineFunction &MF) const
Returns true if the frame setup is split into two separate pushes (first r0-r7,lr then r8-r11),...
Definition: ARMSubtarget.h:853
llvm::getDefRegState
unsigned getDefRegState(bool B)
Definition: MachineInstrBuilder.h:502
R2
#define R2(n)
llvm::Thumb1FrameLowering::emitPrologue
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
Definition: Thumb1FrameLowering.cpp:147
llvm::MachineFunction::getRegInfo
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Definition: MachineFunction.h:651
llvm::TargetInstrInfo
TargetInstrInfo - Interface to description of machine instruction set.
Definition: TargetInstrInfo.h:97
llvm::ARMFunctionInfo::setShouldRestoreSPFromFP
void setShouldRestoreSPFromFP(bool s)
Definition: ARMMachineFunctionInfo.h:181
llvm::MutableArrayRef
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition: ArrayRef.h:305
llvm::Thumb1FrameLowering::emitEpilogue
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
Definition: Thumb1FrameLowering.cpp:471
llvm::MachineFunction::getInfo
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
Definition: MachineFunction.h:739
llvm::TargetFrameLowering::getStackAlign
Align getStackAlign() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
Definition: TargetFrameLowering.h:100
llvm::ARMBaseRegisterInfo::getFrameRegister
Register getFrameRegister(const MachineFunction &MF) const override
Definition: ARMBaseRegisterInfo.cpp:479
llvm::MachineRegisterInfo::isReserved
bool isReserved(MCRegister PhysReg) const
isReserved - Returns true when PhysReg is a reserved register.
Definition: MachineRegisterInfo.h:928
llvm::ARMFunctionInfo::setDPRCalleeSavedAreaSize
void setDPRCalleeSavedAreaSize(unsigned s)
Definition: ARMMachineFunctionInfo.h:210
llvm::Log2
unsigned Log2(Align A)
Returns the log2 of the alignment.
Definition: Alignment.h:207
int
Clang compiles this i1 i64 store i64 i64 store i64 i64 store i64 i64 store i64 align Which gets codegen d xmm0 movaps rbp movaps rbp movaps rbp movaps rbp rbp rbp rbp rbp It would be better to have movq s of instead of the movaps s LLVM produces ret int
Definition: README.txt:536
MCContext.h
llvm::MachineFunction::deleteMachineInstr
void deleteMachineInstr(MachineInstr *MI)
DeleteMachineInstr - Delete the given MachineInstr.
Definition: MachineFunction.cpp:399
llvm::MachineFunction::getProperties
const MachineFunctionProperties & getProperties() const
Get the function properties.
Definition: MachineFunction.h:732
emitCallSPUpdate
static void emitCallSPUpdate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, const TargetInstrInfo &TII, const DebugLoc &dl, const ThumbRegisterInfo &MRI, int NumBytes, unsigned MIFlags=MachineInstr::NoFlags)
Definition: Thumb1FrameLowering.cpp:104
FramePtr
static const unsigned FramePtr
Definition: XCoreFrameLowering.cpp:34
TargetOpcodes.h
TII
const HexagonInstrInfo * TII
Definition: HexagonCopyToCombine.cpp:127
llvm::ARMFunctionInfo::getFramePtrSpillOffset
unsigned getFramePtrSpillOffset() const
Definition: ARMMachineFunctionInfo.h:186
llvm::MachineInstr::FrameSetup
@ FrameSetup
Definition: MachineInstr.h:82
ARMBaseInfo.h
llvm::MachineModuleInfo
This class contains meta information specific to a module.
Definition: MachineModuleInfo.h:77
llvm::report_fatal_error
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:143
BitVector.h
llvm::MachineFrameInfo::getStackSize
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects.
Definition: MachineFrameInfo.h:553
DebugLoc.h
llvm::MachineFrameInfo::getObjectOffset
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
Definition: MachineFrameInfo.h:494
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
ThumbRegisterInfo.h
llvm::BitVector
Definition: BitVector.h:74
llvm::MCCFIInstruction::createDefCfaRegister
static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register)
.cfi_def_cfa_register modifies a rule for computing CFA.
Definition: MCDwarf.h:531
llvm::MachineBasicBlock
Definition: MachineBasicBlock.h:95
llvm::MachineFunctionProperties::Property::NoVRegs
@ NoVRegs
llvm::ARMFrameLowering::hasFP
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register.
Definition: ARMFrameLowering.cpp:200
llvm::ARMCC::AL
@ AL
Definition: ARMBaseInfo.h:45
llvm::MachineFunction::getMMI
MachineModuleInfo & getMMI() const
Definition: MachineFunction.h:592
llvm::MachineFunction::getSubtarget
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Definition: MachineFunction.h:641
llvm::MachineInstr::getDebugLoc
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
Definition: MachineInstr.h:418
ARMBaseRegisterInfo.h
llvm::TargetRegisterInfo::getRegClass
const TargetRegisterClass * getRegClass(unsigned i) const
Returns the register class associated with the enumeration value.
Definition: TargetRegisterInfo.h:739
llvm::MachineInstr
Representation of each machine instruction.
Definition: MachineInstr.h:64
llvm::MachineInstrBuilder
Definition: MachineInstrBuilder.h:69
llvm::BitVector::any
bool any() const
any - Returns true if any bit is set.
Definition: BitVector.h:162
llvm::ARM_MB::ST
@ ST
Definition: ARMBaseInfo.h:73
llvm::LivePhysRegs::available
bool available(const MachineRegisterInfo &MRI, MCPhysReg Reg) const
Returns true if register Reg and no aliasing register is in the set.
Definition: LivePhysRegs.cpp:141
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::MCPhysReg
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
Definition: MCRegister.h:21
llvm::ARMSubtarget::getFramePointerReg
MCPhysReg getFramePointerReg() const
Definition: ARMSubtarget.h:843
MCRegisterInfo.h
llvm::ARMSubtarget::isTargetELF
bool isTargetELF() const
Definition: ARMSubtarget.h:781
llvm::isCalleeSavedRegister
static bool isCalleeSavedRegister(unsigned Reg, const MCPhysReg *CSRegs)
Definition: ARMBaseRegisterInfo.h:92
llvm::MachineInstr::NoFlags
@ NoFlags
Definition: MachineInstr.h:81
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::ARMFrameLowering
Definition: ARMFrameLowering.h:21
llvm::MachineBasicBlock::succ_begin
succ_iterator succ_begin()
Definition: MachineBasicBlock.h:336
llvm::MachineFunction::getFrameInfo
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Definition: MachineFunction.h:657
llvm::MachineBasicBlock::getParent
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
Definition: MachineBasicBlock.h:229
ARMBaseInstrInfo.h
llvm::tryFoldSPUpdateIntoPushPop
bool tryFoldSPUpdateIntoPushPop(const ARMSubtarget &Subtarget, MachineFunction &MF, MachineInstr *MI, unsigned NumBytes)
Tries to add registers to the reglist of a given base-updating push/pop instruction to adjust the sta...
Definition: ARMBaseInstrInfo.cpp:2516
llvm::MCCFIInstruction::cfiDefCfa
static MCCFIInstruction cfiDefCfa(MCSymbol *L, unsigned Register, int Offset)
.cfi_def_cfa defines a rule for computing CFA as: take address from Register and add Offset to it.
Definition: MCDwarf.h:524
MachineModuleInfo.h
llvm::MachineInstrBuilder::addReg
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
Definition: MachineInstrBuilder.h:97
R6
#define R6(n)
llvm::MachineFunction
Definition: MachineFunction.h:241
llvm::ARMFunctionInfo::setFramePtrSpillOffset
void setFramePtrSpillOffset(unsigned o)
Definition: ARMMachineFunctionInfo.h:187
llvm::MachineBasicBlock::succ_empty
bool succ_empty() const
Definition: MachineBasicBlock.h:351
llvm::MachineFrameInfo::getCalleeSavedInfo
const std::vector< CalleeSavedInfo > & getCalleeSavedInfo() const
Returns a reference to call saved info vector for the current function.
Definition: MachineFrameInfo.h:755
llvm::MachineBasicBlock::getFirstTerminator
iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
Definition: MachineBasicBlock.cpp:241
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::ARMSubtarget::getRegisterInfo
const ARMBaseRegisterInfo * getRegisterInfo() const override
Definition: ARMSubtarget.h:595
MBBI
MachineBasicBlock MachineBasicBlock::iterator MBBI
Definition: AArch64SLSHardening.cpp:75
llvm::MachineInstr::getOpcode
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
Definition: MachineInstr.h:489
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
Compiler.h
TargetSubtargetInfo.h
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::RegState::Define
@ Define
Register definition.
Definition: MachineInstrBuilder.h:44
llvm::ARMFunctionInfo::setGPRCalleeSavedArea2Offset
void setGPRCalleeSavedArea2Offset(unsigned o)
Definition: ARMMachineFunctionInfo.h:197
llvm::MachineFrameInfo::getPristineRegs
BitVector getPristineRegs(const MachineFunction &MF) const
Return a set of physical registers that are pristine.
Definition: MachineFrameInfo.cpp:115
llvm::MachineFunctionProperties::reset
MachineFunctionProperties & reset(Property P)
Definition: MachineFunction.h:185
llvm::MCRegisterInfo
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Definition: MCRegisterInfo.h:135
LLVM_FALLTHROUGH
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
Definition: Compiler.h:290
llvm::MachineInstrBuilder::getInstr
MachineInstr * getInstr() const
If conversion operators fail, use this method to get the MachineInstr explicitly.
Definition: MachineInstrBuilder.h:89
MRI
unsigned const MachineRegisterInfo * MRI
Definition: AArch64AdvSIMDScalarPass.cpp:105
llvm::ARMFunctionInfo::setGPRCalleeSavedArea1Offset
void setGPRCalleeSavedArea1Offset(unsigned o)
Definition: ARMMachineFunctionInfo.h:196
llvm::MachineFrameInfo::getMaxAlign
Align getMaxAlign() const
Return the alignment in bytes that this function must be aligned to, which is greater than the defaul...
Definition: MachineFrameInfo.h:569
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
llvm::MachineBasicBlock::addLiveIn
void addLiveIn(MCRegister PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
Definition: MachineBasicBlock.h:371
llvm::ARMBaseRegisterInfo
Definition: ARMBaseRegisterInfo.h:100
MBB
MachineBasicBlock & MBB
Definition: AArch64SLSHardening.cpp:74
llvm::BitVector::test
bool test(unsigned Idx) const
Definition: BitVector.h:447
llvm::MachineRegisterInfo::isLiveIn
bool isLiveIn(Register Reg) const
Definition: MachineRegisterInfo.cpp:434
ARMRegSet
std::bitset< ARM::NUM_TARGET_REGS > ARMRegSet
Definition: Thumb1FrameLowering.cpp:797
llvm::CalleeSavedInfo
The CalleeSavedInfo class tracks the information need to locate where a callee saved register is in t...
Definition: MachineFrameInfo.h:34
uint16_t
llvm::AMDGPU::SendMsg::Op
Op
Definition: SIDefines.h:325
llvm::MachineBasicBlock::insert
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
Definition: MachineBasicBlock.cpp:1311
MachineFrameInfo.h
llvm::Thumb1InstrInfo
Definition: Thumb1InstrInfo.h:22
llvm::ARMFunctionInfo::setDPRCalleeSavedAreaOffset
void setDPRCalleeSavedAreaOffset(unsigned o)
Definition: ARMMachineFunctionInfo.h:198
llvm::MachineBasicBlock::front
MachineInstr & front()
Definition: MachineBasicBlock.h:251
llvm::Thumb1FrameLowering::hasReservedCallFrame
bool hasReservedCallFrame(const MachineFunction &MF) const override
hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required,...
Definition: Thumb1FrameLowering.cpp:53
isCSRestore
static bool isCSRestore(MachineInstr &MI, const MCPhysReg *CSRegs)
Definition: Thumb1FrameLowering.cpp:456
llvm::BitVector::reset
BitVector & reset()
Definition: BitVector.h:384
llvm::getKillRegState
unsigned getKillRegState(bool B)
Definition: MachineInstrBuilder.h:508
llvm::MachineFunction::addFrameInst
LLVM_NODISCARD unsigned addFrameInst(const MCCFIInstruction &Inst)
Definition: MachineFunction.cpp:291
llvm::MachineFrameInfo
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Definition: MachineFrameInfo.h:107
SmallVector.h
llvm::ARMFrameLowering::STI
const ARMSubtarget & STI
Definition: ARMFrameLowering.h:23
llvm::Thumb1FrameLowering::eliminateCallFramePseudoInstr
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...
Definition: Thumb1FrameLowering.cpp:115
llvm::MachineBasicBlock::begin
iterator begin()
Definition: MachineBasicBlock.h:272
MachineInstrBuilder.h
llvm::ARMFunctionInfo::hasStackFrame
bool hasStackFrame() const
Definition: ARMMachineFunctionInfo.h:177
llvm::MachineInstrBuilder::setMIFlags
const MachineInstrBuilder & setMIFlags(unsigned Flags) const
Definition: MachineInstrBuilder.h:273
llvm::BuildMI
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
Definition: MachineInstrBuilder.h:328
llvm::BitVector::find_first
int find_first() const
find_first - Returns the index of the first set bit, -1 if none of the bits are set.
Definition: BitVector.h:292
llvm::ThumbRegisterInfo
Definition: ThumbRegisterInfo.h:25
llvm::emitThumbRegPlusImmediate
void emitThumbRegPlusImmediate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, const DebugLoc &dl, Register DestReg, Register BaseReg, int NumBytes, const TargetInstrInfo &TII, const ARMBaseRegisterInfo &MRI, unsigned MIFlags=0)
emitThumbRegPlusImmediate - Emits a series of instructions to materialize a destreg = basereg + immed...
Definition: ThumbRegisterInfo.cpp:185
llvm::ARMFunctionInfo::getArgRegsSaveSize
unsigned getArgRegsSaveSize() const
Definition: ARMMachineFunctionInfo.h:171
MachineOperand.h
llvm::ARMBaseRegisterInfo::hasBasePointer
bool hasBasePointer(const MachineFunction &MF) const
Definition: ARMBaseRegisterInfo.cpp:410
llvm::isARMLowRegister
static bool isARMLowRegister(unsigned Reg)
isARMLowRegister - Returns true if the register is a low register (r0-r7).
Definition: ARMBaseInfo.h:160
llvm::MachineFrameInfo::setOffsetAdjustment
void setOffsetAdjustment(int Adj)
Set the correction for frame offsets.
Definition: MachineFrameInfo.h:565
llvm::MCCFIInstruction::createOffset
static MCCFIInstruction createOffset(MCSymbol *L, unsigned Register, int Offset)
.cfi_offset Previous value of Register is saved at offset Offset from CFA.
Definition: MCDwarf.h:562
llvm::predOps
static std::array< MachineOperand, 2 > predOps(ARMCC::CondCodes Pred, unsigned PredReg=0)
Get the operands corresponding to the given Pred value.
Definition: ARMBaseInstrInfo.h:537
llvm::DebugLoc
A debug info location.
Definition: DebugLoc.h:33
llvm::Thumb1FrameLowering::spillCalleeSavedRegisters
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...
Definition: Thumb1FrameLowering.cpp:810
MachineFunction.h
llvm::MachineInstrBundleIterator< MachineInstr >
llvm::abs
APFloat abs(APFloat X)
Returns the absolute value of the argument.
Definition: APFloat.h:1282
findNextOrderedReg
static const unsigned * findNextOrderedReg(const unsigned *CurrentReg, const ARMRegSet &EnabledRegs, const unsigned *OrderEnd)
Definition: Thumb1FrameLowering.cpp:802
llvm::MCID::Terminator
@ Terminator
Definition: MCInstrDesc.h:155
llvm::MachineBasicBlock::end
iterator end()
Definition: MachineBasicBlock.h:274
LivePhysRegs.h