LLVM API Documentation
#include "X86FrameLowering.h"
#include "X86InstrBuilder.h"
#include "X86InstrInfo.h"
#include "X86MachineFunctionInfo.h"
#include "X86Subtarget.h"
#include "X86TargetMachine.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Function.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/Debug.h"
Go to the source code of this file.
static void emitSPUpdate | ( | MachineBasicBlock & | MBB, |
MachineBasicBlock::iterator & | MBBI, | ||
unsigned | StackPtr, | ||
int64_t | NumBytes, | ||
bool | Is64BitTarget, | ||
bool | Is64BitStackPtr, | ||
bool | UseLEA, | ||
const TargetInstrInfo & | TII, | ||
const TargetRegisterInfo & | TRI | ||
) | [static] |
emitSPUpdate - Emit a series of instructions to increment / decrement the stack pointer by a constant value.
Definition at line 149 of file X86FrameLowering.cpp.
References llvm::MachineInstrBuilder::addImm(), llvm::addRegOffset(), llvm::BuildMI(), llvm::N86::EAX, findDeadCallerSavedReg(), llvm::MachineBasicBlock::findDebugLoc(), llvm::MachineInstr::FrameSetup, llvm::MCInstrInfo::get(), getADDriOpcode(), llvm::getDefRegState(), getLEArOpcode(), llvm::MachineInstr::getOperand(), getSUBriOpcode(), llvm::getUndefRegState(), llvm::AArch64CC::MI, llvm::MachineInstr::setFlag(), and llvm::MachineOperand::setIsDead().
Referenced by llvm::X86FrameLowering::emitEpilogue(), and llvm::X86FrameLowering::emitPrologue().
static unsigned findDeadCallerSavedReg | ( | MachineBasicBlock & | MBB, |
MachineBasicBlock::iterator & | MBBI, | ||
const TargetRegisterInfo & | TRI, | ||
bool | Is64Bit | ||
) | [static] |
findDeadCallerSavedReg - Return a caller-saved register that isn't live when it reaches the "return" instruction. We can then pop a stack object to this register without worry about clobbering it.
Definition at line 90 of file X86FrameLowering.cpp.
References llvm::MachineModuleInfo::callsEHReturn(), llvm::SmallSet< T, N, C >::count(), llvm::N86::EAX, llvm::N86::ECX, llvm::N86::EDX, llvm::ISD::EH_RETURN, F(), llvm::MachineFunction::getFunction(), llvm::MachineFunction::getMMI(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), llvm::SmallSet< T, N, C >::insert(), llvm::MachineOperand::isDef(), llvm::MachineOperand::isReg(), and llvm::MCRegAliasIterator::isValid().
Referenced by emitSPUpdate().
static unsigned getADDriOpcode | ( | unsigned | IsLP64, |
int64_t | Imm | ||
) | [static] |
Definition at line 71 of file X86FrameLowering.cpp.
References llvm::isInt< 8 >().
Referenced by llvm::X86FrameLowering::eliminateCallFramePseudoInstr(), and emitSPUpdate().
static unsigned getLEArOpcode | ( | unsigned | IsLP64 | ) | [static] |
Definition at line 83 of file X86FrameLowering.cpp.
Referenced by llvm::X86FrameLowering::emitEpilogue(), and emitSPUpdate().
static unsigned GetScratchRegister | ( | bool | Is64Bit, |
const MachineFunction & | MF, | ||
bool | Primary | ||
) | [static] |
GetScratchRegister - Get a temp register for performing work in the segmented stack and the Erlang/HiPE stack prologue. Depending on platform and the properties of the function either one or two registers will be needed. Set primary to true for the first register, false for the second.
Definition at line 1318 of file X86FrameLowering.cpp.
References llvm::N86::EAX, llvm::N86::EBX, llvm::N86::ECX, llvm::N86::EDI, llvm::N86::EDX, llvm::CallingConv::Fast, llvm::Function::getCallingConv(), llvm::MachineFunction::getFunction(), HasNestArgument(), llvm::CallingConv::HiPE, llvm::report_fatal_error(), and llvm::CallingConv::X86_FastCall.
Referenced by llvm::X86FrameLowering::adjustForHiPEPrologue(), and llvm::X86FrameLowering::adjustForSegmentedStacks().
static unsigned getSUBriOpcode | ( | unsigned | IsLP64, |
int64_t | Imm | ||
) | [static] |
Definition at line 59 of file X86FrameLowering.cpp.
References llvm::isInt< 8 >().
Referenced by llvm::X86FrameLowering::eliminateCallFramePseudoInstr(), llvm::X86FrameLowering::emitPrologue(), and emitSPUpdate().
static bool HasNestArgument | ( | const MachineFunction * | MF | ) | [static] |
Definition at line 1303 of file X86FrameLowering.cpp.
References llvm::Function::arg_begin(), llvm::Function::arg_end(), F(), llvm::MachineFunction::getFunction(), and I.
Referenced by llvm::X86FrameLowering::adjustForSegmentedStacks(), and GetScratchRegister().
static bool isEAXLiveIn | ( | MachineFunction & | MF | ) | [static] |
Definition at line 296 of file X86FrameLowering.cpp.
References llvm::AArch64CC::AL, llvm::N86::EAX, llvm::MachineFunction::getRegInfo(), llvm::MachineRegisterInfo::livein_begin(), and llvm::MachineRegisterInfo::livein_end().
Referenced by llvm::X86FrameLowering::emitPrologue().
static int mergeSPUpdates | ( | MachineBasicBlock & | MBB, |
MachineBasicBlock::iterator & | MBBI, | ||
unsigned | StackPtr, | ||
bool | doMergeWithPrevious | ||
) | [static] |
mergeSPUpdates - Checks the instruction before/after the passed instruction. If it is an ADD/SUB/LEA instruction it is deleted argument and the stack adjustment is returned as a positive value for ADD/LEA and a negative for SUB.
Definition at line 265 of file X86FrameLowering.cpp.
References llvm::MachineBasicBlock::begin(), llvm::MachineBasicBlock::end(), and llvm::MachineBasicBlock::erase().
Referenced by llvm::X86FrameLowering::emitEpilogue(), and llvm::X86FrameLowering::emitPrologue().
static void mergeSPUpdatesDown | ( | MachineBasicBlock & | MBB, |
MachineBasicBlock::iterator & | MBBI, | ||
unsigned | StackPtr, | ||
uint64_t * | NumBytes = nullptr |
||
) | [static] |
mergeSPUpdatesDown - Merge two stack-manipulating instructions lower iterator.
Definition at line 232 of file X86FrameLowering.cpp.
References llvm::MachineBasicBlock::end(), and llvm::MachineBasicBlock::erase().
Referenced by llvm::X86FrameLowering::emitPrologue().
static void mergeSPUpdatesUp | ( | MachineBasicBlock & | MBB, |
MachineBasicBlock::iterator & | MBBI, | ||
unsigned | StackPtr, | ||
uint64_t * | NumBytes = nullptr |
||
) | [static] |
mergeSPUpdatesUp - Merge two stack-manipulating instructions upper iterator.
Definition at line 207 of file X86FrameLowering.cpp.
References llvm::MachineBasicBlock::begin(), and llvm::MachineBasicBlock::erase().
Referenced by llvm::X86FrameLowering::emitEpilogue().
static bool usesTheStack | ( | const MachineFunction & | MF | ) | [static] |
usesTheStack - This function checks if any of the users of EFLAGS copies the EFLAGS. We know that the code that lowers COPY of EFLAGS has to use the stack, and if we don't adjust the stack we clobber the first frame index. See X86InstrInfo::copyPhysReg.
Definition at line 343 of file X86FrameLowering.cpp.
References llvm::MachineFunction::getRegInfo(), llvm::MachineRegisterInfo::reg_instr_begin(), and llvm::MachineRegisterInfo::reg_instr_end().
Referenced by llvm::X86FrameLowering::emitPrologue().
cl::opt<bool> ForceStackAlign |
Referenced by llvm::X86FrameLowering::emitEpilogue(), and llvm::X86FrameLowering::emitPrologue().
const uint64_t kSplitStackAvailable = 256 [static] |
Definition at line 1348 of file X86FrameLowering.cpp.
Referenced by llvm::X86FrameLowering::adjustForSegmentedStacks().