62 return X86::SUB64ri32;
74 return X86::ADD64ri32;
83 return IsLP64 ? X86::LEA64r : X86::LEA32r;
98 static const uint16_t CallerSavedRegs32Bit[] = {
102 static const uint16_t CallerSavedRegs64Bit[] = {
103 X86::RAX, X86::RDX, X86::RCX, X86::RSI, X86::RDI,
104 X86::R8, X86::R9, X86::R10, X86::R11, 0
107 unsigned Opc = MBBI->getOpcode();
112 case X86::TCRETURNdi:
113 case X86::TCRETURNri:
114 case X86::TCRETURNmi:
115 case X86::TCRETURNdi64:
116 case X86::TCRETURNri64:
117 case X86::TCRETURNmi64:
119 case X86::EH_RETURN64: {
121 for (
unsigned i = 0, e = MBBI->getNumOperands(); i != e; ++i) {
132 const uint16_t *CS = Is64Bit ? CallerSavedRegs64Bit : CallerSavedRegs32Bit;
134 if (!Uses.
count(*CS))
147 unsigned StackPtr, int64_t NumBytes,
148 bool Is64Bit,
bool IsLP64,
bool UseLEA,
150 bool isSub = NumBytes < 0;
151 uint64_t Offset = isSub ? -NumBytes : NumBytes;
160 uint64_t Chunk = (1LL << 31) - 1;
164 uint64_t ThisVal = (Offset > Chunk) ? Chunk : Offset;
165 if (ThisVal == (Is64Bit ? 8 : 4)) {
172 ? (Is64Bit ? X86::PUSH64r : X86::PUSH32r)
173 : (Is64Bit ? X86::POP64r : X86::POP32r);
187 StackPtr,
false, isSub ? -ThisVal : ThisVal);
189 MI =
BuildMI(MBB, MBBI, DL, TII.
get(Opc), StackPtr)
205 unsigned StackPtr, uint64_t *NumBytes = NULL) {
206 if (MBBI == MBB.
begin())
return;
209 unsigned Opc = PI->getOpcode();
210 if ((Opc == X86::ADD64ri32 || Opc == X86::ADD64ri8 ||
211 Opc == X86::ADD32ri || Opc == X86::ADD32ri8 ||
212 Opc == X86::LEA32r || Opc == X86::LEA64_32r) &&
213 PI->getOperand(0).getReg() == StackPtr) {
215 *NumBytes += PI->getOperand(2).getImm();
217 }
else if ((Opc == X86::SUB64ri32 || Opc == X86::SUB64ri8 ||
218 Opc == X86::SUB32ri || Opc == X86::SUB32ri8) &&
219 PI->getOperand(0).getReg() == StackPtr) {
221 *NumBytes -= PI->getOperand(2).getImm();
230 unsigned StackPtr, uint64_t *NumBytes = NULL) {
234 if (MBBI == MBB.
end())
return;
237 if (NI == MBB.
end())
return;
239 unsigned Opc = NI->getOpcode();
240 if ((Opc == X86::ADD64ri32 || Opc == X86::ADD64ri8 ||
241 Opc == X86::ADD32ri || Opc == X86::ADD32ri8) &&
242 NI->getOperand(0).getReg() == StackPtr) {
244 *NumBytes -= NI->getOperand(2).getImm();
247 }
else if ((Opc == X86::SUB64ri32 || Opc == X86::SUB64ri8 ||
248 Opc == X86::SUB32ri || Opc == X86::SUB32ri8) &&
249 NI->getOperand(0).getReg() == StackPtr) {
251 *NumBytes += NI->getOperand(2).getImm();
264 bool doMergeWithPrevious) {
265 if ((doMergeWithPrevious && MBBI == MBB.
begin()) ||
266 (!doMergeWithPrevious && MBBI == MBB.
end()))
271 unsigned Opc = PI->getOpcode();
274 if ((Opc == X86::ADD64ri32 || Opc == X86::ADD64ri8 ||
275 Opc == X86::ADD32ri || Opc == X86::ADD32ri8 ||
276 Opc == X86::LEA32r || Opc == X86::LEA64_32r) &&
277 PI->getOperand(0).getReg() == StackPtr){
278 Offset += PI->getOperand(2).getImm();
280 if (!doMergeWithPrevious) MBBI = NI;
281 }
else if ((Opc == X86::SUB64ri32 || Opc == X86::SUB64ri8 ||
282 Opc == X86::SUB32ri || Opc == X86::SUB32ri8) &&
283 PI->getOperand(0).getReg() == StackPtr) {
284 Offset -= PI->getOperand(2).getImm();
286 if (!doMergeWithPrevious) MBBI = NI;
295 unsigned Reg = II->first;
297 if (Reg ==
X86::EAX || Reg == X86::AX ||
298 Reg == X86::AH || Reg ==
X86::AL)
307 unsigned FramePtr)
const {
314 if (CSI.empty())
return;
317 bool HasFP =
hasFP(MF);
327 for (std::vector<CalleeSavedInfo>::const_iterator
328 I = CSI.begin(), E = CSI.end();
I != E; ++
I)
329 MaxOffset = std::min(MaxOffset,
333 int64_t saveAreaOffset = (HasFP ? 3 : 2) * stackGrowth;
334 for (std::vector<CalleeSavedInfo>::const_iterator
335 I = CSI.begin(), E = CSI.end();
I != E; ++
I) {
337 unsigned Reg =
I->getReg();
338 Offset = MaxOffset - Offset + saveAreaOffset;
360 if (HasFP && FramePtr == Reg)
377 re = MRI.
reg_end(); ri != re; ++ri)
401 bool HasFP =
hasFP(MF);
419 MaxAlign = (StackAlign > MaxAlign) ? StackAlign : MaxAlign;
420 else if (MaxAlign < SlotSize)
426 if (TailCallReturnAddrDelta < 0)
444 if (HasFP) MinSize += SlotSize;
445 StackSize = std::max(MinSize, StackSize > 128 ? StackSize - 128 : 0);
452 if (TailCallReturnAddrDelta < 0) {
458 .
addImm(-TailCallReturnAddrDelta)
477 uint64_t NumBytes = 0;
478 int stackGrowth = -SlotSize;
482 uint64_t FrameSize = StackSize - SlotSize;
487 NumBytes = (FrameSize + MaxAlign - 1) / MaxAlign * MaxAlign;
498 BuildMI(MBB, MBBI, DL, TII.get(Is64Bit ? X86::PUSH64r : X86::PUSH32r))
502 if (needsFrameMoves) {
514 unsigned DwarfFramePtr = RegInfo->getDwarfRegNum(FramePtr,
true);
521 TII.get(Is64Bit ? X86::MOV64rr : X86::MOV32rr), FramePtr)
525 if (needsFrameMoves) {
532 unsigned DwarfFramePtr = RegInfo->getDwarfRegNum(FramePtr,
true);
540 I->addLiveIn(FramePtr);
546 bool PushedRegs =
false;
547 int StackOffset = 2 * stackGrowth;
549 while (MBBI != MBB.
end() &&
550 (MBBI->getOpcode() == X86::PUSH32r ||
551 MBBI->getOpcode() == X86::PUSH64r)) {
556 if (!HasFP && needsFrameMoves) {
565 StackOffset += stackGrowth;
578 assert(HasFP &&
"There should be a frame pointer if stack is realigned.");
581 TII.get(Is64Bit ? X86::AND64ri32 : X86::AND32ri), StackPtr)
610 const char *StackProbeSymbol;
611 bool isSPUpdateNeeded =
false;
615 StackProbeSymbol =
"___chkstk";
617 StackProbeSymbol =
"__chkstk";
618 isSPUpdateNeeded =
true;
621 StackProbeSymbol =
"_alloca";
623 StackProbeSymbol =
"_chkstk";
631 assert(!Is64Bit &&
"EAX is livein in x64 case!");
634 BuildMI(MBB, MBBI, DL, TII.get(X86::PUSH32r))
642 BuildMI(MBB, MBBI, DL, TII.get(X86::MOV64ri), X86::RAX)
649 .addImm(isEAXAlive ? NumBytes - 4 : NumBytes)
654 TII.get(Is64Bit ? X86::W64ALLOCA : X86::CALLpcrel32))
655 .addExternalSymbol(StackProbeSymbol)
662 if (isSPUpdateNeeded) {
663 BuildMI(MBB, MBBI, DL, TII.get(X86::SUB64rr), StackPtr)
673 StackPtr,
false, NumBytes - 4);
678 emitSPUpdate(MBB, MBBI, StackPtr, -(int64_t)NumBytes, Is64Bit, IsLP64,
679 UseLEA, TII, *RegInfo);
687 unsigned Opc = Is64Bit ? X86::MOV64rr : X86::MOV32rr;
688 BuildMI(MBB, MBBI, DL, TII.get(Opc), BasePtr)
693 if (( (!HasFP && NumBytes) || PushedRegs) && needsFrameMoves) {
699 if (!HasFP && NumBytes) {
703 Label, -StackSize + stackGrowth));
719 assert(MBBI != MBB.
end() &&
"Returning block has no instructions");
720 unsigned RetOpcode = MBBI->getOpcode();
726 unsigned SlotSize = RegInfo->getSlotSize();
727 unsigned FramePtr = RegInfo->getFrameRegister(MF);
728 unsigned StackPtr = RegInfo->getStackRegister();
735 case X86::TCRETURNdi:
736 case X86::TCRETURNri:
737 case X86::TCRETURNmi:
738 case X86::TCRETURNdi64:
739 case X86::TCRETURNri64:
740 case X86::TCRETURNmi64:
742 case X86::EH_RETURN64:
750 uint64_t NumBytes = 0;
758 MaxAlign = (StackAlign > MaxAlign) ? StackAlign : MaxAlign;
760 MaxAlign = MaxAlign ? MaxAlign : 4;
765 uint64_t FrameSize = StackSize - SlotSize;
766 if (RegInfo->needsStackRealignment(MF)) {
770 NumBytes = (FrameSize + MaxAlign - 1) / MaxAlign * MaxAlign;
772 NumBytes = FrameSize - CSSize;
777 TII.get(Is64Bit ? X86::POP64r : X86::POP32r), FramePtr);
779 NumBytes = StackSize - CSSize;
783 while (MBBI != MBB.
begin()) {
785 unsigned Opc = PI->getOpcode();
787 if (Opc != X86::POP32r && Opc != X86::POP64r && Opc !=
X86::DBG_VALUE &&
795 DL = MBBI->getDebugLoc();
806 if (RegInfo->needsStackRealignment(MF))
811 FramePtr,
false, -CSSize);
813 unsigned Opc = (Is64Bit ? X86::MOV64rr : X86::MOV32rr);
814 BuildMI(MBB, MBBI, DL, TII.get(Opc), StackPtr)
817 }
else if (NumBytes) {
819 emitSPUpdate(MBB, MBBI, StackPtr, NumBytes, Is64Bit, IsLP64, UseLEA,
824 if (RetOpcode ==
X86::EH_RETURN || RetOpcode == X86::EH_RETURN64) {
827 assert(DestAddr.
isReg() &&
"Offset should be in register!");
829 TII.get(Is64Bit ? X86::MOV64rr : X86::MOV32rr),
830 StackPtr).addReg(DestAddr.
getReg());
831 }
else if (RetOpcode == X86::TCRETURNri || RetOpcode == X86::TCRETURNdi ||
832 RetOpcode == X86::TCRETURNmi ||
833 RetOpcode == X86::TCRETURNri64 || RetOpcode == X86::TCRETURNdi64 ||
834 RetOpcode == X86::TCRETURNmi64) {
835 bool isMem = RetOpcode == X86::TCRETURNmi || RetOpcode == X86::TCRETURNmi64;
840 assert(StackAdjust.
isImm() &&
"Expecting immediate value.");
843 int StackAdj = StackAdjust.
getImm();
846 assert(MaxTCDelta <= 0 &&
"MaxTCDelta should never be positive");
849 Offset = StackAdj-MaxTCDelta;
850 assert(Offset >= 0 &&
"Offset should never be negative");
855 emitSPUpdate(MBB, MBBI, StackPtr, Offset, Is64Bit, IsLP64,
856 UseLEA, TII, *RegInfo);
860 if (RetOpcode == X86::TCRETURNdi || RetOpcode == X86::TCRETURNdi64) {
862 BuildMI(MBB, MBBI, DL, TII.get((RetOpcode == X86::TCRETURNdi)
863 ? X86::TAILJMPd : X86::TAILJMPd64));
872 }
else if (RetOpcode == X86::TCRETURNmi || RetOpcode == X86::TCRETURNmi64) {
874 BuildMI(MBB, MBBI, DL, TII.get((RetOpcode == X86::TCRETURNmi)
875 ? X86::TAILJMPm : X86::TAILJMPm64));
876 for (
unsigned i = 0; i != 5; ++i)
878 }
else if (RetOpcode == X86::TCRETURNri64) {
879 BuildMI(MBB, MBBI, DL, TII.get(X86::TAILJMPr64)).
882 BuildMI(MBB, MBBI, DL, TII.get(X86::TAILJMPr)).
891 }
else if ((RetOpcode == X86::RET || RetOpcode == X86::RETI) &&
899 emitSPUpdate(MBB, MBBI, StackPtr, delta, Is64Bit, IsLP64, UseLEA, TII,
912 assert (
hasFP(MF) &&
"VLAs and dynamic stack realign, but no FP?!");
918 return Offset + StackSize;
926 return Offset + StackSize;
931 return Offset + StackSize;
939 if (TailCallReturnAddrDelta < 0)
940 Offset -= TailCallReturnAddrDelta;
947 unsigned &FrameReg)
const {
964 const std::vector<CalleeSavedInfo> &CSI,
973 unsigned SlotSize = STI.
is64Bit() ? 8 : 4;
975 unsigned CalleeFrameSize = 0;
981 unsigned Opc = STI.
is64Bit() ? X86::PUSH64r : X86::PUSH32r;
982 for (
unsigned i = CSI.size(); i != 0; --i) {
983 unsigned Reg = CSI[i-1].getReg();
984 if (!X86::GR64RegClass.contains(Reg) &&
985 !X86::GR32RegClass.contains(Reg))
992 CalleeFrameSize += SlotSize;
1002 for (
unsigned i = CSI.size(); i != 0; --i) {
1003 unsigned Reg = CSI[i-1].getReg();
1004 if (X86::GR64RegClass.contains(Reg) ||
1005 X86::GR32RegClass.contains(Reg))
1019 const std::vector<CalleeSavedInfo> &CSI,
1030 for (
unsigned i = 0, e = CSI.size(); i != e; ++i) {
1031 unsigned Reg = CSI[i].getReg();
1032 if (X86::GR64RegClass.contains(Reg) ||
1033 X86::GR32RegClass.contains(Reg))
1042 unsigned Opc = STI.
is64Bit() ? X86::POP64r : X86::POP32r;
1043 for (
unsigned i = 0, e = CSI.size(); i != e; ++i) {
1044 unsigned Reg = CSI[i].getReg();
1045 if (!X86::GR64RegClass.contains(Reg) &&
1046 !X86::GR32RegClass.contains(Reg))
1066 if (TailCallReturnAddrDelta < 0) {
1077 TailCallReturnAddrDelta - SlotSize,
true);
1081 assert((TailCallReturnAddrDelta <= 0) &&
1082 "The Delta should always be zero or negative");
1089 TailCallReturnAddrDelta,
1092 "Slot for EBP register must be last in order to be found!");
1106 if (
I->hasNestAttr())
1123 return Primary ? X86::R14 : X86::R13;
1129 return Primary ? X86::R11 : X86::R12;
1137 "nested function.");
1156 unsigned TlsReg, TlsOffset;
1161 "Scratch register is live-in");
1172 bool IsNested =
false;
1209 TlsOffset = 0x60 + 90*8;
1217 if (CompareStackPointer)
1218 ScratchReg = X86::RSP;
1220 BuildMI(checkMBB, DL, TII.get(X86::LEA64r), ScratchReg).addReg(X86::RSP)
1223 BuildMI(checkMBB, DL, TII.get(X86::CMP64rm)).addReg(ScratchReg)
1231 TlsOffset = 0x48 + 90*4;
1241 if (CompareStackPointer)
1244 BuildMI(checkMBB, DL, TII.get(X86::LEA32r), ScratchReg).addReg(
X86::ESP)
1248 BuildMI(checkMBB, DL, TII.get(X86::CMP32rm)).addReg(ScratchReg)
1253 unsigned ScratchReg2;
1255 if (CompareStackPointer) {
1258 SaveScratch2 =
false;
1269 "Scratch register is live-in and not saved");
1272 BuildMI(checkMBB, DL, TII.get(X86::PUSH32r))
1275 BuildMI(checkMBB, DL, TII.get(X86::MOV32ri), ScratchReg2)
1277 BuildMI(checkMBB, DL, TII.get(X86::CMP32rm))
1284 BuildMI(checkMBB, DL, TII.get(X86::POP32r), ScratchReg2);
1290 BuildMI(checkMBB, DL, TII.get(X86::JA_4)).addMBB(&prologueMBB);
1299 BuildMI(allocMBB, DL, TII.get(X86::MOV64rr), X86::RAX).addReg(X86::R10);
1301 BuildMI(allocMBB, DL, TII.get(X86::MOV64ri), X86::R10)
1303 BuildMI(allocMBB, DL, TII.get(X86::MOV64ri), X86::R11)
1308 BuildMI(allocMBB, DL, TII.get(X86::PUSHi32))
1310 BuildMI(allocMBB, DL, TII.get(X86::PUSHi32))
1316 BuildMI(allocMBB, DL, TII.get(X86::CALL64pcrel32))
1317 .addExternalSymbol(
"__morestack");
1319 BuildMI(allocMBB, DL, TII.get(X86::CALLpcrel32))
1320 .addExternalSymbol(
"__morestack");
1323 BuildMI(allocMBB, DL, TII.get(X86::MORESTACK_RET_RESTORE_R10));
1325 BuildMI(allocMBB, DL, TII.get(X86::MORESTACK_RET));
1356 const bool Is64Bit = STI.
is64Bit();
1359 const unsigned HipeLeafWords = 24;
1360 const unsigned CCRegisteredArgs = Is64Bit ? 6 : 5;
1361 const unsigned Guaranteed = HipeLeafWords * SlotSize;
1364 unsigned MaxStack = MFI->
getStackSize() + CallerStkArity*SlotSize + SlotSize;
1367 "HiPE prologue is only supported on Linux operating systems.");
1377 unsigned MoreStackForCalls = 0;
1380 MBBI != MBBE; ++MBBI)
1407 unsigned CalleeStkArity =
1409 if (HipeLeafWords - 1 > CalleeStkArity)
1410 MoreStackForCalls = std::max(MoreStackForCalls,
1411 (HipeLeafWords - 1 - CalleeStkArity) * SlotSize);
1413 MaxStack += MoreStackForCalls;
1418 if (MaxStack > Guaranteed) {
1432 unsigned ScratchReg, SPReg, PReg, SPLimitOffset;
1433 unsigned LEAop, CMPop, CALLop;
1437 LEAop = X86::LEA64r;
1438 CMPop = X86::CMP64rm;
1439 CALLop = X86::CALL64pcrel32;
1440 SPLimitOffset = 0x90;
1444 LEAop = X86::LEA32r;
1445 CMPop = X86::CMP32rm;
1446 CALLop = X86::CALLpcrel32;
1447 SPLimitOffset = 0x4c;
1452 "HiPE prologue scratch register is live-in");
1456 SPReg,
false, -MaxStack);
1459 .addReg(ScratchReg), PReg,
false, SPLimitOffset);
1460 BuildMI(stackCheckMBB, DL, TII.get(X86::JAE_4)).addMBB(&prologueMBB);
1463 BuildMI(incStackMBB, DL, TII.get(CALLop)).
1464 addExternalSymbol(
"inc_stack_0");
1466 SPReg,
false, -MaxStack);
1468 .addReg(ScratchReg), PReg,
false, SPLimitOffset);
1469 BuildMI(incStackMBB, DL, TII.get(X86::JLE_4)).addMBB(incStackMBB);
1488 int Opcode = I->getOpcode();
1489 bool isDestroy = Opcode == TII.getCallFrameDestroyOpcode();
1492 uint64_t Amount = !reseveCallFrame ? I->getOperand(0).getImm() : 0;
1493 uint64_t CalleeAmt = isDestroy ? I->getOperand(1).getImm() : 0;
1496 if (!reseveCallFrame) {
1508 Amount = (Amount + StackAlign - 1) / StackAlign * StackAlign;
1511 if (Opcode == TII.getCallFrameSetupOpcode()) {
1517 assert(Opcode == TII.getCallFrameDestroyOpcode());
1520 Amount -= CalleeAmt;
1524 New =
BuildMI(MF, DL, TII.get(Opc), StackPtr)
1525 .addReg(StackPtr).
addImm(Amount);
1540 if (Opcode == TII.getCallFrameDestroyOpcode() && CalleeAmt) {
1546 .addReg(StackPtr).
addImm(CalleeAmt);
void push_front(MachineBasicBlock *MBB)
unsigned getStackAlignment() const
const MachineFunction * getParent() const
int getFrameIndexReference(const MachineFunction &MF, int FI, unsigned &FrameReg) const
instr_iterator erase(instr_iterator I)
void setPhysRegUsed(unsigned Reg)
int getDwarfRegNum(unsigned RegNum, bool isEH) const
Map a target register to an equivalent dwarf register number. Returns -1 if there is no equivalent va...
const GlobalValue * getGlobal() const
const TargetRegisterClass * getMinimalPhysRegClass(unsigned Reg, EVT VT=MVT::Other) const
livein_iterator livein_end() const
static bool isEAXLiveIn(MachineFunction &MF)
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF, RegScavenger *RS=NULL) const
bool isTargetCygMing() const
void verify(Pass *p=NULL, const char *Banner=NULL) const
bool hasBasePointer(const MachineFunction &MF) const
enable_if_c<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
size_t find(char C, size_t From=0) const
std::vector< unsigned >::const_iterator livein_iterator
cl::opt< bool > ForceStackAlign
static unsigned getLEArOpcode(unsigned IsLP64)
static MCCFIInstruction createOffset(MCSymbol *L, unsigned Register, int Offset)
.cfi_offset Previous value of Register is saved at offset Offset from CFA.
unsigned getArgumentStackSize() const
bool adjustsStack() const
void addLiveIn(unsigned Reg)
unsigned getCalleeSavedFrameSize() const
void setCalleeSavedFrameSize(unsigned bytes)
void eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const
const char * getSymbolName() const
void setIsDead(bool Val=true)
const Function * getFunction() const
static unsigned findDeadCallerSavedReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, const TargetRegisterInfo &TRI, bool Is64Bit)
unsigned getFrameRegister(const MachineFunction &MF) const
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
static MCCFIInstruction createDefCfaOffset(MCSymbol *L, int Offset)
.cfi_def_cfa_offset modifies a rule for computing CFA. Register remains the same, but offset is new...
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
CallingConv::ID getCallingConv() const
StringRef getName() const
unsigned getMaxAlignment() const
const std::vector< CalleeSavedInfo > & getCalleeSavedInfo() const
uint64_t getStackSize() const
livein_iterator livein_begin() const
int getTCReturnAddrDelta() const
MCSymbol * CreateTempSymbol()
const HexagonInstrInfo * TII
bool isTargetDarwin() const
bool callsUnwindInit() const
static bool usesTheStack(const MachineFunction &MF)
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
#define llvm_unreachable(msg)
bool DisableFramePointerElim(const MachineFunction &MF) const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
bool isInt< 8 >(int64_t x)
Abstract Stack Frame Information.
static void mergeSPUpdatesUp(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, unsigned StackPtr, uint64_t *NumBytes=NULL)
mergeSPUpdatesUp - Merge two stack-manipulating instructions upper iterator.
bool isFrameAddressTaken() const
static const uint64_t kSplitStackAvailable
bool hasDebugInfo() const
bool needsStackRealignment(const MachineFunction &MF) const
virtual unsigned getFrameRegister(const MachineFunction &MF) const =0
Debug information queries.
ID
LLVM Calling Convention Representation.
const MachineInstrBuilder & addImm(int64_t Val) const
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
const MachineBasicBlock & front() const
int getObjectIndexBegin() const
bool isLiveIn(unsigned Reg) const
bool is64Bit() const
Is this x86_64? (disregarding specific ABI / programming model)
static int mergeSPUpdates(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, unsigned StackPtr, bool doMergeWithPrevious)
iterator getLastNonDebugInstr()
static void mergeSPUpdatesDown(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI, unsigned StackPtr, uint64_t *NumBytes=NULL)
mergeSPUpdatesDown - Merge two stack-manipulating instructions lower iterator.
void adjustForHiPEPrologue(MachineFunction &MF) const
unsigned getUndefRegState(bool B)
bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector< CalleeSavedInfo > &CSI, const TargetRegisterInfo *TRI) const
unsigned getDefRegState(bool B)
bundle_iterator< MachineInstr, instr_iterator > iterator
virtual const X86RegisterInfo * getRegisterInfo() const
void emitSPUpdate(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, DebugLoc dl, const TargetInstrInfo &TII, unsigned ScratchReg, int64_t NumBytes, MachineInstr::MIFlag MIFlags=MachineInstr::NoFlags)
void adjustForSegmentedStacks(MachineFunction &MF) const
unsigned getTargetFlags() const
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=0)
virtual bool needsStackRealignment(const MachineFunction &MF) const
static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register)
.cfi_def_cfa_register modifies a rule for computing CFA. From now on Register will be used instead of...
void setStackSize(uint64_t Size)
livein_iterator livein_end() const
const MachineOperand & getOperand(unsigned i) const
bool isTargetWin32() const
virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned DestReg, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const
void setFlag(MIFlag Flag)
setFlag - Set a MI flag.
static const MachineInstrBuilder & addRegOffset(const MachineInstrBuilder &MIB, unsigned Reg, bool isKill, int Offset)
ItTy next(ItTy it, Dist n)
bool isSymbol() const
isSymbol - Tests if this is a MO_ExternalSymbol operand.
int64_t getOffset() const
MachineInstrBuilder BuildMI(MachineFunction &MF, DebugLoc DL, const MCInstrDesc &MCID)
virtual void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const
virtual const TargetFrameLowering * getFrameLowering() const
unsigned getBaseRegister() const
const MCInstrDesc & get(unsigned Opcode) const
int getFrameIndexOffset(const MachineFunction &MF, int FI) const
unsigned getStackRegister() const
static unsigned getSUBriOpcode(unsigned IsLP64, int64_t Imm)
int64_t getObjectOffset(int ObjectIdx) const
bool callsEHReturn() const
static unsigned getADDriOpcode(unsigned IsLP64, int64_t Imm)
DebugLoc findDebugLoc(instr_iterator MBBI)
bool hasCalls() const
hasCalls - Return true if the current function has any function calls.
virtual const TargetInstrInfo * getInstrInfo() const
const MCContext & getContext() const
bool hasFP(const MachineFunction &MF) const
unsigned getObjectAlignment(int ObjectIdx) const
getObjectAlignment - Return the alignment of the specified stack object.
int getOffsetOfLocalArea() const
bool isTargetLinux() const
bool needsUnwindTableEntry() const
True if this function needs an unwind table.
livein_iterator livein_begin() const
void setOffsetAdjustment(int Adj)
MachineFrameInfo * getFrameInfo()
AttributeSet getAttributes() const
Return the attribute list for this Function.
static unsigned GetScratchRegister(bool Is64Bit, const MachineFunction &MF, bool Primary)
const MachineInstrBuilder & addGlobalAddress(const GlobalValue *GV, int64_t Offset=0, unsigned char TargetFlags=0) const
const MCRegisterInfo * getRegisterInfo() const
bool count(const T &V) const
count - Return true if the element is in the set.
virtual const TargetFrameLowering * getFrameLowering() const
void copyImplicitOps(MachineFunction &MF, const MachineInstr *MI)
MachineRegisterInfo & getRegInfo()
const MachineInstrBuilder & addExternalSymbol(const char *FnName, unsigned char TargetFlags=0) const
bool isTarget64BitLP64() const
Is this x86_64 with the LP64 programming model (standard AMD64, no x32)?
DBG_VALUE - a mapping of the llvm.dbg.value intrinsic.
void emitCalleeSavedFrameMoves(MachineFunction &MF, MCSymbol *Label, unsigned FramePtr) const
bool hasMSInlineAsm() const
Returns true if the function contains any MS-style inline assembly.
void addFrameInst(const MCCFIInstruction &Inst)
const TargetMachine & getTarget() const
unsigned getSlotSize() const
instr_iterator insert(instr_iterator I, MachineInstr *M)
virtual const TargetRegisterInfo * getRegisterInfo() const
static bool isMem(const MachineInstr *MI, unsigned Op)
bool hasVarSizedObjects() const
size_t find_first_of(char C, size_t From=0) const
std::vector< std::pair< unsigned, unsigned > >::const_iterator livein_iterator
unsigned EnableSegmentedStacks
unsigned getReg() const
getReg - Returns the register number.
void emitPrologue(MachineFunction &MF) const
bool isTargetWin64() const
bool isTargetFreeBSD() const
const MachineInstrBuilder & addOperand(const MachineOperand &MO) const
BasicBlockListType::iterator iterator
ItTy prior(ItTy it, Dist n)
MachineModuleInfo & getMMI() const
reg_iterator reg_begin(unsigned RegNo) const
const MCRegisterInfo & MRI
const MachineInstrBuilder & setMIFlag(MachineInstr::MIFlag Flag) const
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool Immutable)
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const
static reg_iterator reg_end()
static bool HasNestArgument(const MachineFunction *MF)
bool hasReservedCallFrame(const MachineFunction &MF) const
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
void addSuccessor(MachineBasicBlock *succ, uint32_t weight=0)
bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector< CalleeSavedInfo > &CSI, const TargetRegisterInfo *TRI) const
bool isTargetEnvMacho() const
virtual const X86InstrInfo * getInstrInfo() const