Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/CodeGen/GCRootLowering.cpp
Show First 20 Lines • Show All 243 Lines • ▼ Show 20 Lines | |||||
INITIALIZE_PASS(GCMachineCodeAnalysis, "gc-analysis", | INITIALIZE_PASS(GCMachineCodeAnalysis, "gc-analysis", | ||||
"Analyze Machine Code For Garbage Collection", false, false) | "Analyze Machine Code For Garbage Collection", false, false) | ||||
GCMachineCodeAnalysis::GCMachineCodeAnalysis() : MachineFunctionPass(ID) {} | GCMachineCodeAnalysis::GCMachineCodeAnalysis() : MachineFunctionPass(ID) {} | ||||
void GCMachineCodeAnalysis::getAnalysisUsage(AnalysisUsage &AU) const { | void GCMachineCodeAnalysis::getAnalysisUsage(AnalysisUsage &AU) const { | ||||
MachineFunctionPass::getAnalysisUsage(AU); | MachineFunctionPass::getAnalysisUsage(AU); | ||||
AU.setPreservesAll(); | AU.setPreservesAll(); | ||||
AU.addRequired<MachineModuleInfo>(); | AU.addRequired<MachineModuleInfoWrapperPass>(); | ||||
AU.addRequired<GCModuleInfo>(); | AU.addRequired<GCModuleInfo>(); | ||||
} | } | ||||
MCSymbol *GCMachineCodeAnalysis::InsertLabel(MachineBasicBlock &MBB, | MCSymbol *GCMachineCodeAnalysis::InsertLabel(MachineBasicBlock &MBB, | ||||
MachineBasicBlock::iterator MI, | MachineBasicBlock::iterator MI, | ||||
const DebugLoc &DL) const { | const DebugLoc &DL) const { | ||||
MCSymbol *Label = MBB.getParent()->getContext().createTempSymbol(); | MCSymbol *Label = MBB.getParent()->getContext().createTempSymbol(); | ||||
BuildMI(MBB, MI, DL, TII->get(TargetOpcode::GC_LABEL)).addSym(Label); | BuildMI(MBB, MI, DL, TII->get(TargetOpcode::GC_LABEL)).addSym(Label); | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
bool GCMachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) { | bool GCMachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) { | ||||
// Quick exit for functions that do not use GC. | // Quick exit for functions that do not use GC. | ||||
if (!MF.getFunction().hasGC()) | if (!MF.getFunction().hasGC()) | ||||
return false; | return false; | ||||
FI = &getAnalysis<GCModuleInfo>().getFunctionInfo(MF.getFunction()); | FI = &getAnalysis<GCModuleInfo>().getFunctionInfo(MF.getFunction()); | ||||
MMI = &getAnalysis<MachineModuleInfo>(); | MMI = &getAnalysis<MachineModuleInfoWrapperPass>().getMMI(); | ||||
TII = MF.getSubtarget().getInstrInfo(); | TII = MF.getSubtarget().getInstrInfo(); | ||||
// Find the size of the stack frame. There may be no correct static frame | // Find the size of the stack frame. There may be no correct static frame | ||||
// size, we use UINT64_MAX to represent this. | // size, we use UINT64_MAX to represent this. | ||||
const MachineFrameInfo &MFI = MF.getFrameInfo(); | const MachineFrameInfo &MFI = MF.getFrameInfo(); | ||||
const TargetRegisterInfo *RegInfo = MF.getSubtarget().getRegisterInfo(); | const TargetRegisterInfo *RegInfo = MF.getSubtarget().getRegisterInfo(); | ||||
const bool DynamicFrameSize = MFI.hasVarSizedObjects() || | const bool DynamicFrameSize = MFI.hasVarSizedObjects() || | ||||
RegInfo->needsStackRealignment(MF); | RegInfo->needsStackRealignment(MF); | ||||
Show All 11 Lines |