Go to the documentation of this file.
50 bool doInitialization(
Module &M)
override;
72 GCMachineCodeAnalysis();
94 StringRef LowerIntrinsics::getPassName()
const {
95 return "Lower Garbage Collection Instructions";
98 void LowerIntrinsics::getAnalysisUsage(
AnalysisUsage &AU)
const {
99 FunctionPass::getAnalysisUsage(AU);
105 bool LowerIntrinsics::doInitialization(
Module &
M) {
107 assert(
MI &&
"LowerIntrinsics didn't require GCModuleInfo!?");
109 if (!
F.isDeclaration() &&
F.hasGC())
110 MI->getFunctionInfo(
F);
129 if (isa<AllocaInst>(
I) || isa<GetElementPtrInst>(
I) || isa<StoreInst>(
I) ||
134 if (
CallInst *CI = dyn_cast<CallInst>(
I))
135 if (
Function *
F = CI->getCalledFunction())
137 if (IID == Intrinsic::gcroot)
146 while (isa<AllocaInst>(IP))
154 dyn_cast<AllocaInst>(
SI->getOperand(1)->stripPointerCasts()))
158 bool MadeChange =
false;
161 if (!InitedRoots.
count(Root)) {
164 Root, Root->getNextNode());
181 return DoLowering(
F,
S);
194 bool MadeChange =
false;
202 switch (
F->getIntrinsicID()) {
204 case Intrinsic::gcwrite: {
213 case Intrinsic::gcread: {
222 case Intrinsic::gcroot: {
244 "Analyze Machine Code For Garbage Collection",
false,
false)
248 void GCMachineCodeAnalysis::getAnalysisUsage(
AnalysisUsage &AU)
const {
249 MachineFunctionPass::getAnalysisUsage(AU);
268 MCSymbol *
Label = InsertLabel(*CI->getParent(), RAI, CI->getDebugLoc());
281 if (
MI->isTerminator())
289 assert(TFI &&
"TargetRegisterInfo not available!");
300 assert(!FrameOffset.getScalable() &&
301 "Frame offsets with a scalable component are not supported");
302 RI->StackOffset = FrameOffset.getFixed();
308 bool GCMachineCodeAnalysis::runOnMachineFunction(
MachineFunction &MF) {
313 FI = &getAnalysis<GCModuleInfo>().getFunctionInfo(MF.
getFunction());
329 FindStackOffsets(MF);
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
This class represents lattice values for constants.
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.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
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 bool CouldBecomeSafePoint(Instruction *I)
CouldBecomeSafePoint - Predicate to conservatively determine whether the instruction could introduce ...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation.
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.
bool isDeadObjectIndex(int ObjectIdx) const
Returns true if the specified index corresponds to a dead object.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
An instruction for storing to memory.
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
bool hasGC() const
hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm to use during code generatio...
bool needsStackRealignment(const MachineFunction &MF) const
True if storage within the function requires the stack pointer to be aligned more than the normal cal...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
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.
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.