Go to the documentation of this file.
46 bool doInitialization(
Module &M)
override;
68 GCMachineCodeAnalysis();
91 StringRef LowerIntrinsics::getPassName()
const {
92 return "Lower Garbage Collection Instructions";
95 void LowerIntrinsics::getAnalysisUsage(
AnalysisUsage &AU)
const {
96 FunctionPass::getAnalysisUsage(AU);
102 bool LowerIntrinsics::doInitialization(
Module &
M) {
104 assert(
MI &&
"LowerIntrinsics didn't require GCModuleInfo!?");
106 if (!
F.isDeclaration() &&
F.hasGC())
107 MI->getFunctionInfo(
F);
126 if (isa<AllocaInst>(
I) || isa<GetElementPtrInst>(
I) || isa<StoreInst>(
I) ||
131 if (
CallInst *CI = dyn_cast<CallInst>(
I))
132 if (
Function *
F = CI->getCalledFunction())
134 if (IID == Intrinsic::gcroot)
143 while (isa<AllocaInst>(
IP))
151 dyn_cast<AllocaInst>(
SI->getOperand(1)->stripPointerCasts()))
155 bool MadeChange =
false;
158 if (!InitedRoots.
count(Root)) {
161 Root, Root->getNextNode());
178 return DoLowering(
F,
S);
191 bool MadeChange =
false;
199 switch (
F->getIntrinsicID()) {
201 case Intrinsic::gcwrite: {
210 case Intrinsic::gcread: {
219 case Intrinsic::gcroot: {
241 "Analyze Machine Code For Garbage Collection",
false,
false)
245 void GCMachineCodeAnalysis::getAnalysisUsage(
AnalysisUsage &AU)
const {
246 MachineFunctionPass::getAnalysisUsage(AU);
265 MCSymbol *
Label = InsertLabel(*CI->getParent(), RAI, CI->getDebugLoc());
277 if (
MI.isTerminator())
285 assert(TFI &&
"TargetRegisterInfo not available!");
296 assert(!FrameOffset.getScalable() &&
297 "Frame offsets with a scalable component are not supported");
298 RI->StackOffset = FrameOffset.getFixed();
304 bool GCMachineCodeAnalysis::runOnMachineFunction(
MachineFunction &MF) {
309 FI = &getAnalysis<GCModuleInfo>().getFunctionInfo(MF.
getFunction());
316 const bool DynamicFrameSize =
325 FindStackOffsets(MF);
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
This is an optimization pass for GlobalISel generic memory operations.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
INITIALIZE_PASS(GCMachineCodeAnalysis, "gc-analysis", "Analyze Machine Code For Garbage Collection", false, false) GCMachineCodeAnalysis
Information about stack frame layout on the target.
GCStrategy describes a garbage collector algorithm's code generation requirements,...
InstListType::iterator iterator
Instruction iterators...
MCContext & getContext() const
virtual const TargetInstrInfo * getInstrInfo() const
void addSafePoint(MCSymbol *Label, const DebugLoc &DL)
addSafePoint - Notes the existence of a safe point.
INITIALIZE_PASS_BEGIN(LowerIntrinsics, "gc-lowering", "GC Lowering", false, false) FunctionPass *llvm
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Garbage collection metadata for a single function.
void initializeLowerIntrinsicsPass(PassRegistry &)
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
roots_iterator roots_begin()
roots_begin/roots_end - Iterators for all roots in the function.
GCStrategy & getStrategy()
getStrategy - Return the GC strategy for the function.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
LLVM Basic Block Representation.
bool needsSafePoints() const
True if safe points need to be inferred on call sites.
TargetInstrInfo - Interface to description of machine instruction set.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
static bool CouldBecomeSafePoint(Instruction *I)
CouldBecomeSafePoint - Predicate to conservatively determine whether the instruction could introduce ...
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation or the function signa...
char & GCMachineCodeAnalysisID
GCMachineCodeAnalysis - Target-independent pass to mark safe points in machine code.
void setFrameSize(uint64_t S)
Represent the analysis usage information of a pass.
const HexagonInstrInfo * TII
Legacy analysis pass which computes a DominatorTree.
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
bool isDeadObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a dead object.
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
char & GCLoweringID
GCLowering Pass - Used by gc.root to perform its default lowering operations.
An instruction for storing to memory.
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
Representation of each machine instruction.
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
bool hasGC() const
hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm to use during code generatio...
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
StandardInstrumentations SI(Debug, VerifyEach)
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
FunctionPass * createGCLoweringPass()
GCLowering Pass - Used by gc.root to perform its default lowering operations.
A Module instance is used to store all the information related to an LLVM module.
rewrite statepoints for gc
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
Type * getType() const
All values are typed, get the type of this value.
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
An instruction for reading from memory.
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs and address space casts.
Wrapper class representing virtual and physical registers.
static bool runOnFunction(Function &F, bool PostInlining)
Function & getFunction()
Return the LLVM function that this machine code represents.
virtual const TargetFrameLowering * getFrameLowering() const
void setPreservesAll()
Set by analyses that do not transform their input at all.
Should compile to something r4 addze r3 instead we get
virtual StackOffset getFrameIndexReference(const MachineFunction &MF, int FI, Register &FrameReg) const
getFrameIndexReference - This method should return the base register and offset used to reference a f...
static bool InsertRootInitializers(Function &F, ArrayRef< AllocaInst * > Roots)
A wrapper class for inspecting calls to intrinsic functions.
bool hasStackRealignment(const MachineFunction &MF) const
True if stack realignment is required and still possible.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
const MachineInstrBuilder & addSym(MCSymbol *Sym, unsigned char TargetFlags=0) const
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
Value * getArgOperand(unsigned i) const
roots_iterator removeStackRoot(roots_iterator position)
removeStackRoot - Removes a root.
amdgpu printf runtime AMDGPU Printf lowering
FunctionPass class - This class is used to implement most global optimizations.
This class represents a function call, abstracting a target machine's calling convention.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
std::vector< GCRoot >::iterator roots_iterator
AnalysisUsage & addRequired()
void takeName(Value *V)
Transfer the name from V to this value.
an instruction to allocate memory on the stack
roots_iterator roots_end()
An analysis pass which caches information about the entire Module.
LLVM Value Representation.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.