Skip to content

Commit bdca64b

Browse files
committed
CodeGen: Move current call site out of MachineModuleInfo
I do not know understand what this is for, but it's only used in SelectionDAGBuilder, so move it to FunctionLoweringInfo like other function scope DAG builder state. The intrinsics are not documented in the LangRef or Intrinsics.td. This removes the last piece of codegen state from MachineModuleInfo.
1 parent 3921900 commit bdca64b

File tree

4 files changed

+21
-32
lines changed

4 files changed

+21
-32
lines changed

llvm/include/llvm/CodeGen/FunctionLoweringInfo.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,28 @@ class FunctionLoweringInfo {
183183
std::vector<std::pair<MachineInstr*, unsigned> > PHINodesToUpdate;
184184
unsigned OrigNumPHINodesToUpdate;
185185

186+
/// \name Exception Handling
187+
/// \{
188+
186189
/// If the current MBB is a landing pad, the exception pointer and exception
187190
/// selector registers are copied into these virtual registers by
188191
/// SelectionDAGISel::PrepareEHLandingPad().
189192
unsigned ExceptionPointerVirtReg, ExceptionSelectorVirtReg;
190193

194+
/// The current call site index being processed, if any. 0 if none.
195+
unsigned CurCallSite = 0;
196+
// TODO: Ideally, what we'd like is to have a switch that allows emitting
197+
// synchronous (precise at call-sites only) CFA into .eh_frame. However,
198+
// even under this switch, we'd like .debug_frame to be precise when using
199+
// -g. At this moment, there's no way to specify that some CFI directives
200+
// go into .eh_frame only, while others go into .debug_frame only.
201+
202+
/// Set the call site currently being processed.
203+
void setCurrentCallSite(unsigned Site) { CurCallSite = Site; }
204+
205+
/// Get the call site currently being processed, if any. Return zero if none.
206+
unsigned getCurrentCallSite() { return CurCallSite; }
207+
191208
/// Collection of dbg.declare instructions handled after argument
192209
/// lowering and before ISel proper.
193210
SmallPtrSet<const DbgDeclareInst *, 8> PreprocessedDbgDeclares;

llvm/include/llvm/CodeGen/MachineModuleInfo.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,6 @@ class MachineModuleInfo {
9999
/// want.
100100
MachineModuleInfoImpl *ObjFileMMI;
101101

102-
/// \name Exception Handling
103-
/// \{
104-
105-
/// The current call site index being processed, if any. 0 if none.
106-
unsigned CurCallSite = 0;
107-
108-
/// \}
109-
110-
// TODO: Ideally, what we'd like is to have a switch that allows emitting
111-
// synchronous (precise at call-sites only) CFA into .eh_frame. However,
112-
// even under this switch, we'd like .debug_frame to be precise when using
113-
// -g. At this moment, there's no way to specify that some CFI directives
114-
// go into .eh_frame only, while others go into .debug_frame only.
115-
116102
/// True if debugging information is available in this module.
117103
bool DbgInfoAvailable = false;
118104

@@ -185,16 +171,6 @@ class MachineModuleInfo {
185171
/// Returns true if valid debug info is present.
186172
bool hasDebugInfo() const { return DbgInfoAvailable; }
187173

188-
/// \name Exception Handling
189-
/// \{
190-
191-
/// Set the call site currently being processed.
192-
void setCurrentCallSite(unsigned Site) { CurCallSite = Site; }
193-
194-
/// Get the call site currently being processed, if any. return zero if
195-
/// none.
196-
unsigned getCurrentCallSite() { return CurCallSite; }
197-
198174
/// \}
199175
}; // End class MachineModuleInfo
200176

llvm/lib/CodeGen/MachineModuleInfo.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ MachineModuleInfoImpl::~MachineModuleInfoImpl() = default;
2626

2727
void MachineModuleInfo::initialize() {
2828
ObjFileMMI = nullptr;
29-
CurCallSite = 0;
3029
NextFnNum = 0;
3130
DbgInfoAvailable = false;
3231
}
@@ -46,7 +45,6 @@ MachineModuleInfo::MachineModuleInfo(MachineModuleInfo &&MMI)
4645
MachineFunctions(std::move(MMI.MachineFunctions)) {
4746
Context.setObjectFileInfo(TM.getObjFileLowering());
4847
ObjFileMMI = MMI.ObjFileMMI;
49-
CurCallSite = MMI.CurCallSite;
5048
ExternalContext = MMI.ExternalContext;
5149
TheModule = MMI.TheModule;
5250
}

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6708,10 +6708,9 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
67086708
return;
67096709
case Intrinsic::eh_sjlj_callsite: {
67106710
ConstantInt *CI = cast<ConstantInt>(I.getArgOperand(0));
6711-
assert(DAG.getMMI()->getCurrentCallSite() == 0 &&
6712-
"Overlapping call sites!");
6711+
assert(FuncInfo.getCurrentCallSite() == 0 && "Overlapping call sites!");
67136712

6714-
DAG.getMMI()->setCurrentCallSite(CI->getZExtValue());
6713+
FuncInfo.setCurrentCallSite(CI->getZExtValue());
67156714
return;
67166715
}
67176716
case Intrinsic::eh_sjlj_functioncontext: {
@@ -8619,21 +8618,20 @@ SDValue SelectionDAGBuilder::lowerStartEH(SDValue Chain,
86198618
const BasicBlock *EHPadBB,
86208619
MCSymbol *&BeginLabel) {
86218620
MachineFunction &MF = DAG.getMachineFunction();
8622-
MachineModuleInfo &MMI = MF.getMMI();
86238621

86248622
// Insert a label before the invoke call to mark the try range. This can be
86258623
// used to detect deletion of the invoke via the MachineModuleInfo.
86268624
BeginLabel = MF.getContext().createTempSymbol();
86278625

86288626
// For SjLj, keep track of which landing pads go with which invokes
86298627
// so as to maintain the ordering of pads in the LSDA.
8630-
unsigned CallSiteIndex = MMI.getCurrentCallSite();
8628+
unsigned CallSiteIndex = FuncInfo.getCurrentCallSite();
86318629
if (CallSiteIndex) {
86328630
MF.setCallSiteBeginLabel(BeginLabel, CallSiteIndex);
86338631
LPadToCallSiteMap[FuncInfo.MBBMap[EHPadBB]].push_back(CallSiteIndex);
86348632

86358633
// Now that the call site is handled, stop tracking it.
8636-
MMI.setCurrentCallSite(0);
8634+
FuncInfo.setCurrentCallSite(0);
86378635
}
86388636

86398637
return DAG.getEHLabel(getCurSDLoc(), Chain, BeginLabel);

0 commit comments

Comments
 (0)