remove the now-redundant MMI pointer in SelectionDAG.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100419 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-04-05 06:19:28 +00:00
parent d2c4f19a9f
commit 512063dd0f
4 changed files with 33 additions and 54 deletions

View File

@ -32,7 +32,6 @@ class AliasAnalysis;
class FunctionLoweringInfo; class FunctionLoweringInfo;
class MachineConstantPoolValue; class MachineConstantPoolValue;
class MachineFunction; class MachineFunction;
class MachineModuleInfo;
class MDNode; class MDNode;
class SDNodeOrdering; class SDNodeOrdering;
class SDDbgValue; class SDDbgValue;
@ -121,8 +120,7 @@ class SelectionDAG {
TargetLowering &TLI; TargetLowering &TLI;
MachineFunction *MF; MachineFunction *MF;
FunctionLoweringInfo &FLI; FunctionLoweringInfo &FLI;
MachineModuleInfo *MMI; LLVMContext *Context;
LLVMContext* Context;
/// EntryNode - The starting token. /// EntryNode - The starting token.
SDNode EntryNode; SDNode EntryNode;
@ -191,7 +189,6 @@ public:
const TargetMachine &getTarget() const; const TargetMachine &getTarget() const;
TargetLowering &getTargetLoweringInfo() const { return TLI; } TargetLowering &getTargetLoweringInfo() const { return TLI; }
FunctionLoweringInfo &getFunctionLoweringInfo() const { return FLI; } FunctionLoweringInfo &getFunctionLoweringInfo() const { return FLI; }
MachineModuleInfo *getMachineModuleInfo() const { return MMI; }
LLVMContext *getContext() const {return Context; } LLVMContext *getContext() const {return Context; }
/// viewGraph - Pop up a GraphViz/gv window with the DAG rendered using 'dot'. /// viewGraph - Pop up a GraphViz/gv window with the DAG rendered using 'dot'.

View File

@ -803,7 +803,6 @@ SelectionDAG::SelectionDAG(TargetLowering &tli, FunctionLoweringInfo &fli)
void SelectionDAG::init(MachineFunction &mf) { void SelectionDAG::init(MachineFunction &mf) {
MF = &mf; MF = &mf;
MMI = &mf.getMMI();
Context = &mf.getFunction()->getContext(); Context = &mf.getFunction()->getContext();
} }
@ -2256,7 +2255,7 @@ bool SelectionDAG::isVerifiedDebugInfoDesc(SDValue Op) const {
if (GA->getOffset() != 0) return false; if (GA->getOffset() != 0) return false;
GlobalVariable *GV = dyn_cast<GlobalVariable>(GA->getGlobal()); GlobalVariable *GV = dyn_cast<GlobalVariable>(GA->getGlobal());
if (!GV) return false; if (!GV) return false;
return MMI->hasDebugInfo(); return MF->getMMI().hasDebugInfo();
} }

View File

@ -3817,9 +3817,9 @@ SelectionDAGBuilder::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
return 0; // VLAs. return 0; // VLAs.
int FI = SI->second; int FI = SI->second;
if (MachineModuleInfo *MMI = DAG.getMachineModuleInfo()) MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI();
if (!DI.getDebugLoc().isUnknown() && MMI->hasDebugInfo()) if (!DI.getDebugLoc().isUnknown() && MMI.hasDebugInfo())
MMI->setVariableDbgInfo(Variable, FI, DI.getDebugLoc()); MMI.setVariableDbgInfo(Variable, FI, DI.getDebugLoc());
return 0; return 0;
} }
case Intrinsic::dbg_value: { case Intrinsic::dbg_value: {
@ -3867,9 +3867,9 @@ SelectionDAGBuilder::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
return 0; // VLAs. return 0; // VLAs.
int FI = SI->second; int FI = SI->second;
if (MachineModuleInfo *MMI = DAG.getMachineModuleInfo()) MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI();
if (!DI.getDebugLoc().isUnknown() && MMI->hasDebugInfo()) if (!DI.getDebugLoc().isUnknown() && MMI.hasDebugInfo())
MMI->setVariableDbgInfo(Variable, FI, DI.getDebugLoc()); MMI.setVariableDbgInfo(Variable, FI, DI.getDebugLoc());
return 0; return 0;
} }
case Intrinsic::eh_exception: { case Intrinsic::eh_exception: {
@ -3885,10 +3885,9 @@ SelectionDAGBuilder::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
} }
case Intrinsic::eh_selector: { case Intrinsic::eh_selector: {
MachineModuleInfo *MMI = DAG.getMachineModuleInfo(); MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI();
if (CurMBB->isLandingPad()) if (CurMBB->isLandingPad())
AddCatchInfo(I, MMI, CurMBB); AddCatchInfo(I, &MMI, CurMBB);
else { else {
#ifndef NDEBUG #ifndef NDEBUG
FuncInfo.CatchInfoLost.insert(&I); FuncInfo.CatchInfoLost.insert(&I);
@ -3910,40 +3909,25 @@ SelectionDAGBuilder::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
} }
case Intrinsic::eh_typeid_for: { case Intrinsic::eh_typeid_for: {
MachineModuleInfo *MMI = DAG.getMachineModuleInfo();
if (MMI) {
// Find the type id for the given typeinfo. // Find the type id for the given typeinfo.
GlobalVariable *GV = ExtractTypeInfo(I.getOperand(1)); GlobalVariable *GV = ExtractTypeInfo(I.getOperand(1));
unsigned TypeID = MMI->getTypeIDFor(GV); unsigned TypeID = DAG.getMachineFunction().getMMI().getTypeIDFor(GV);
Res = DAG.getConstant(TypeID, MVT::i32); Res = DAG.getConstant(TypeID, MVT::i32);
} else {
// Return something different to eh_selector.
Res = DAG.getConstant(1, MVT::i32);
}
setValue(&I, Res); setValue(&I, Res);
return 0; return 0;
} }
case Intrinsic::eh_return_i32: case Intrinsic::eh_return_i32:
case Intrinsic::eh_return_i64: case Intrinsic::eh_return_i64:
if (MachineModuleInfo *MMI = DAG.getMachineModuleInfo()) { DAG.getMachineFunction().getMMI().setCallsEHReturn(true);
MMI->setCallsEHReturn(true);
DAG.setRoot(DAG.getNode(ISD::EH_RETURN, dl, DAG.setRoot(DAG.getNode(ISD::EH_RETURN, dl,
MVT::Other, MVT::Other,
getControlRoot(), getControlRoot(),
getValue(I.getOperand(1)), getValue(I.getOperand(1)),
getValue(I.getOperand(2)))); getValue(I.getOperand(2))));
} else {
setValue(&I, DAG.getConstant(0, TLI.getPointerTy()));
}
return 0; return 0;
case Intrinsic::eh_unwind_init: case Intrinsic::eh_unwind_init:
if (MachineModuleInfo *MMI = DAG.getMachineModuleInfo()) { DAG.getMachineFunction().getMMI().setCallsUnwindInit(true);
MMI->setCallsUnwindInit(true);
}
return 0; return 0;
case Intrinsic::eh_dwarf_cfa: { case Intrinsic::eh_dwarf_cfa: {
EVT VT = getValue(I.getOperand(1)).getValueType(); EVT VT = getValue(I.getOperand(1)).getValueType();
@ -3962,12 +3946,12 @@ SelectionDAGBuilder::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
return 0; return 0;
} }
case Intrinsic::eh_sjlj_callsite: { case Intrinsic::eh_sjlj_callsite: {
MachineModuleInfo *MMI = DAG.getMachineModuleInfo(); MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI();
ConstantInt *CI = dyn_cast<ConstantInt>(I.getOperand(1)); ConstantInt *CI = dyn_cast<ConstantInt>(I.getOperand(1));
assert(CI && "Non-constant call site value in eh.sjlj.callsite!"); assert(CI && "Non-constant call site value in eh.sjlj.callsite!");
assert(MMI->getCurrentCallSite() == 0 && "Overlapping call sites!"); assert(MMI.getCurrentCallSite() == 0 && "Overlapping call sites!");
MMI->setCurrentCallSite(CI->getZExtValue()); MMI.setCurrentCallSite(CI->getZExtValue());
return 0; return 0;
} }
@ -4352,7 +4336,7 @@ void SelectionDAGBuilder::LowerCallTo(CallSite CS, SDValue Callee,
const PointerType *PT = cast<PointerType>(CS.getCalledValue()->getType()); const PointerType *PT = cast<PointerType>(CS.getCalledValue()->getType());
const FunctionType *FTy = cast<FunctionType>(PT->getElementType()); const FunctionType *FTy = cast<FunctionType>(PT->getElementType());
const Type *RetTy = FTy->getReturnType(); const Type *RetTy = FTy->getReturnType();
MachineModuleInfo *MMI = DAG.getMachineModuleInfo(); MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI();
MCSymbol *BeginLabel = 0; MCSymbol *BeginLabel = 0;
TargetLowering::ArgListTy Args; TargetLowering::ArgListTy Args;
@ -4410,18 +4394,18 @@ void SelectionDAGBuilder::LowerCallTo(CallSite CS, SDValue Callee,
Args.push_back(Entry); Args.push_back(Entry);
} }
if (LandingPad && MMI) { if (LandingPad) {
// Insert a label before the invoke call to mark the try range. This can be // Insert a label before the invoke call to mark the try range. This can be
// used to detect deletion of the invoke via the MachineModuleInfo. // used to detect deletion of the invoke via the MachineModuleInfo.
BeginLabel = MMI->getContext().CreateTempSymbol(); BeginLabel = MMI.getContext().CreateTempSymbol();
// For SjLj, keep track of which landing pads go with which invokes // For SjLj, keep track of which landing pads go with which invokes
// so as to maintain the ordering of pads in the LSDA. // so as to maintain the ordering of pads in the LSDA.
unsigned CallSiteIndex = MMI->getCurrentCallSite(); unsigned CallSiteIndex = MMI.getCurrentCallSite();
if (CallSiteIndex) { if (CallSiteIndex) {
MMI->setCallSiteBeginLabel(BeginLabel, CallSiteIndex); MMI.setCallSiteBeginLabel(BeginLabel, CallSiteIndex);
// Now that the call site is handled, stop tracking it. // Now that the call site is handled, stop tracking it.
MMI->setCurrentCallSite(0); MMI.setCurrentCallSite(0);
} }
// Both PendingLoads and PendingExports must be flushed here; // Both PendingLoads and PendingExports must be flushed here;
@ -4512,14 +4496,14 @@ void SelectionDAGBuilder::LowerCallTo(CallSite CS, SDValue Callee,
else else
HasTailCall = true; HasTailCall = true;
if (LandingPad && MMI) { if (LandingPad) {
// Insert a label at the end of the invoke call to mark the try range. This // Insert a label at the end of the invoke call to mark the try range. This
// can be used to detect deletion of the invoke via the MachineModuleInfo. // can be used to detect deletion of the invoke via the MachineModuleInfo.
MCSymbol *EndLabel = MMI->getContext().CreateTempSymbol(); MCSymbol *EndLabel = MMI.getContext().CreateTempSymbol();
DAG.setRoot(DAG.getEHLabel(getCurDebugLoc(), getRoot(), EndLabel)); DAG.setRoot(DAG.getEHLabel(getCurDebugLoc(), getRoot(), EndLabel));
// Inform MachineModuleInfo of range. // Inform MachineModuleInfo of range.
MMI->addInvoke(LandingPad, BeginLabel, EndLabel); MMI.addInvoke(LandingPad, BeginLabel, EndLabel);
} }
} }

View File

@ -56,7 +56,6 @@ class InsertValueInst;
class Instruction; class Instruction;
class LoadInst; class LoadInst;
class MachineBasicBlock; class MachineBasicBlock;
class MachineFunction;
class MachineInstr; class MachineInstr;
class MachineRegisterInfo; class MachineRegisterInfo;
class PHINode; class PHINode;