[llvm-branch-commits] [llvm-branch] r109968 - in /llvm/branches/wendling/eh: include/llvm/CodeGen/MachineFunction.h include/llvm/CodeGen/MachineModuleInfo.h lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/MachineFunction.cpp lib/CodeGen/MachineModuleInfo.cpp lib/CodeGen/SelectionDAG/FastISel.cpp lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Bill Wendling
isanbard at gmail.com
Sat Jul 31 19:38:15 PDT 2010
Author: void
Date: Sat Jul 31 21:38:15 2010
New Revision: 109968
URL: http://llvm.org/viewvc/llvm-project?rev=109968&view=rev
Log:
Clean up a bit how filter IDs are stored. The filter ID for a function applies
to the whole function, not just to a specific landing pad. There's no need to
record this information as an association with a landing pad.
Modified:
llvm/branches/wendling/eh/include/llvm/CodeGen/MachineFunction.h
llvm/branches/wendling/eh/include/llvm/CodeGen/MachineModuleInfo.h
llvm/branches/wendling/eh/lib/CodeGen/AsmPrinter/DwarfException.cpp
llvm/branches/wendling/eh/lib/CodeGen/MachineFunction.cpp
llvm/branches/wendling/eh/lib/CodeGen/MachineModuleInfo.cpp
llvm/branches/wendling/eh/lib/CodeGen/SelectionDAG/FastISel.cpp
llvm/branches/wendling/eh/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
llvm/branches/wendling/eh/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Modified: llvm/branches/wendling/eh/include/llvm/CodeGen/MachineFunction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/include/llvm/CodeGen/MachineFunction.h?rev=109968&r1=109967&r2=109968&view=diff
==============================================================================
--- llvm/branches/wendling/eh/include/llvm/CodeGen/MachineFunction.h (original)
+++ llvm/branches/wendling/eh/include/llvm/CodeGen/MachineFunction.h Sat Jul 31 21:38:15 2010
@@ -91,10 +91,6 @@
// Keep track of jump tables for switch instructions
MachineJumpTableInfo *JumpTableInfo;
- // Keep track of any exception handling filter IDs.
- // EH-FIXME: This is pretty gross. Can we put this information somewhere else?
- std::vector<const Value*> EHFilters;
-
// Function-level unique numbering for MachineBasicBlocks. When a
// MachineBasicBlock is inserted into a MachineFunction is it automatically
// numbered and this vector keeps track of the mapping from ID's to MBB's.
@@ -244,20 +240,6 @@
/// it are renumbered.
void RenumberBlocks(MachineBasicBlock *MBBFrom = 0);
- /// addFilterID - Add the given filter ID to the list of types that the
- /// function can throw.
- void addFilterID(const Value *V) {
- EHFilters.push_back(V);
- }
-
- // Accessors for the exception handling filters.
- typedef std::vector<const Value*>::const_iterator filter_iterator;
-
- filter_iterator filter_begin() const { return EHFilters.begin(); }
- filter_iterator filter_end() const { return EHFilters.end(); }
-
- bool filter_empty() const { return EHFilters.empty(); }
-
/// print - Print out the MachineFunction in a format suitable for debugging
/// to the specified stream.
///
Modified: llvm/branches/wendling/eh/include/llvm/CodeGen/MachineModuleInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/include/llvm/CodeGen/MachineModuleInfo.h?rev=109968&r1=109967&r2=109968&view=diff
==============================================================================
--- llvm/branches/wendling/eh/include/llvm/CodeGen/MachineModuleInfo.h (original)
+++ llvm/branches/wendling/eh/include/llvm/CodeGen/MachineModuleInfo.h Sat Jul 31 21:38:15 2010
@@ -58,6 +58,7 @@
class PointerType;
class StructType;
+//===----------------------------------------------------------------------===//
/// MachineModuleInfoImpl - This class can be derived from and used by targets
/// to hold private target-specific information for each Module. Objects of
/// type are accessed/created with MMI::getInfo and destroyed when the
@@ -70,8 +71,6 @@
protected:
static SymbolListTy GetSortedStubs(const DenseMap<MCSymbol*, StubValueTy>&);
};
-
-
//===----------------------------------------------------------------------===//
/// LandingPadInfo - This structure is used to retain landing pad info for
@@ -152,7 +151,12 @@
bool CallsEHReturn;
bool CallsUnwindInit;
-
+
+ /// FilterMap - Map of filter IDs for a function.
+ typedef SmallPtrSet<const Value*, 2> FilterListTy;
+ typedef DenseMap<const MachineFunction*, FilterListTy> FilterMapTy;
+ FilterMapTy FilterMap;
+
/// DbgInfoAvailable - True if debugging information is available
/// in this module.
bool DbgInfoAvailable;
@@ -237,10 +241,12 @@
//===- EH ---------------------------------------------------------------===//
+private:
/// getOrCreateLandingPadInfo - Find or create an LandingPadInfo for the
/// specified MachineBasicBlock.
LandingPadInfo &getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad);
+public:
/// addInvoke - Provide the begin and end labels of an invoke style call and
/// associate it with a try landing pad block.
void addInvoke(MachineBasicBlock *LandingPad,
@@ -260,7 +266,7 @@
unsigned getPersonalityIndex() const;
/// getPersonalities - Return array of personality functions ever seen.
- const std::vector<const Function *>& getPersonalities() const {
+ const std::vector<const Function*> &getPersonalities() const {
return Personalities;
}
@@ -276,10 +282,11 @@
void addCatchTypeInfo(MachineBasicBlock *LandingPad,
std::vector<const GlobalVariable *> &TyInfo);
- /// addFilterTypeInfo - Provide the filter typeinfo for a landing pad.
+ /// addFilterTypeInfo - Provide the filter typeinfo for a machine function.
///
- void addFilterTypeInfo(MachineBasicBlock *LandingPad,
- std::vector<const GlobalVariable *> &TyInfo);
+ void addFilterTypeInfo(const MachineFunction *MF, const Value *V) {
+ FilterMap[MF].insert(V);
+ }
/// addCleanup - Add a cleanup action for a landing pad.
///
Modified: llvm/branches/wendling/eh/lib/CodeGen/AsmPrinter/DwarfException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=109968&r1=109967&r2=109968&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/CodeGen/AsmPrinter/DwarfException.cpp (original)
+++ llvm/branches/wendling/eh/lib/CodeGen/AsmPrinter/DwarfException.cpp Sat Jul 31 21:38:15 2010
@@ -46,7 +46,7 @@
/// EmitCIE - Emit a Common Information Entry (CIE). This holds information that
/// is shared among many Frame Description Entries. There is at least one CIE
-/// in every non-empty .debug_frame section.
+/// in every non-empty `.debug_frame' section.
void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
// Size and sign of stack growth.
int stackGrowth = Asm->getTargetData().getPointerSize();
@@ -116,6 +116,7 @@
}
if (APtr != Augmentation + 1)
+ // A uleb128 is present to size the augmentation section.
Augmentation[0] = 'z';
Asm->OutStreamer.AddComment("CIE Augmentation");
@@ -150,8 +151,8 @@
Asm->EmitFrameMoves(Moves, 0, true);
// On Darwin the linker honors the alignment of eh_frame, which means it must
- // be 8-byte on 64-bit targets to match what gcc does. Otherwise you get
- // holes which confuse readers of eh_frame.
+ // be 8-byte on 64-bit targets to match what gcc does. Otherwise you get holes
+ // which confuse readers of eh_frame.
Asm->EmitAlignment(Asm->getTargetData().getPointerSize() == 4 ? 2 : 3);
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_frame_common_end", Index));
}
@@ -888,18 +889,16 @@
/// EndModule - Emit all exception information that should come after the
/// content.
void DwarfException::EndModule() {
- if (Asm->MAI->getExceptionHandlingType() != ExceptionHandling::Dwarf)
+ if (Asm->MAI->getExceptionHandlingType() != ExceptionHandling::Dwarf ||
+ (!shouldEmitMovesModule && !shouldEmitTableModule))
return;
- if (!shouldEmitMovesModule && !shouldEmitTableModule)
- return;
-
- const std::vector<const Function *> Personalities = MMI->getPersonalities();
+ const std::vector<const Function*> &Personalities = MMI->getPersonalities();
for (unsigned I = 0, E = Personalities.size(); I < E; ++I)
EmitCIE(Personalities[I], I);
- for (std::vector<FunctionEHFrameInfo>::iterator
+ for (std::vector<FunctionEHFrameInfo>::const_iterator
I = EHFrames.begin(), E = EHFrames.end(); I != E; ++I)
EmitFDE(*I);
}
Modified: llvm/branches/wendling/eh/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/CodeGen/MachineFunction.cpp?rev=109968&r1=109967&r2=109968&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/branches/wendling/eh/lib/CodeGen/MachineFunction.cpp Sat Jul 31 21:38:15 2010
@@ -330,18 +330,7 @@
OS << '\n';
}
- if (!filter_empty()) {
- OS << "Function Filter IDs: ";
-
- for (filter_iterator I = filter_begin(), E = filter_end(); I != E; ++I) {
- OS << (*I)->getName();
-
- if (llvm::next(I) != E)
- OS << ", ";
- }
-
- OS << '\n';
- }
+ /// EH-FIXME: Emit filter IDs for the function.
for (const_iterator BB = begin(), E = end(); BB != E; ++BB) {
OS << '\n';
Modified: llvm/branches/wendling/eh/lib/CodeGen/MachineModuleInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/CodeGen/MachineModuleInfo.cpp?rev=109968&r1=109967&r2=109968&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/CodeGen/MachineModuleInfo.cpp (original)
+++ llvm/branches/wendling/eh/lib/CodeGen/MachineModuleInfo.cpp Sat Jul 31 21:38:15 2010
@@ -371,8 +371,8 @@
/// getOrCreateLandingPadInfo - Find or create an LandingPadInfo for the
/// specified MachineBasicBlock.
-LandingPadInfo &MachineModuleInfo::getOrCreateLandingPadInfo
- (MachineBasicBlock *LandingPad) {
+LandingPadInfo &MachineModuleInfo::
+getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad) {
unsigned N = LandingPads.size();
for (unsigned i = 0; i < N; ++i) {
LandingPadInfo &LP = LandingPads[i];
@@ -430,17 +430,6 @@
LP.TypeIds.push_back(getTypeIDFor(TyInfo[N - 1]));
}
-/// addFilterTypeInfo - Provide the filter typeinfo for a landing pad.
-///
-void MachineModuleInfo::addFilterTypeInfo(MachineBasicBlock *LandingPad,
- std::vector<const GlobalVariable *> &TyInfo) {
- LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
- std::vector<unsigned> IdsInFilter(TyInfo.size());
- for (unsigned I = 0, E = TyInfo.size(); I != E; ++I)
- IdsInFilter[I] = getTypeIDFor(TyInfo[I]);
- LP.TypeIds.push_back(getFilterIDFor(IdsInFilter));
-}
-
/// addCleanup - Add a cleanup action for a landing pad.
///
void MachineModuleInfo::addCleanup(MachineBasicBlock *LandingPad) {
Modified: llvm/branches/wendling/eh/lib/CodeGen/SelectionDAG/FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=109968&r1=109967&r2=109968&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/branches/wendling/eh/lib/CodeGen/SelectionDAG/FastISel.cpp Sat Jul 31 21:38:15 2010
@@ -515,8 +515,11 @@
case Intrinsic::eh_filter: {
// Add the filter IDs to the machine function.
const IntrinsicInst *II = cast<IntrinsicInst>(I);
+ MachineModuleInfo &MMI = FuncInfo.MF->getMMI();
for (unsigned i = 0, e = II->getNumArgOperands(); i != e; ++i)
- FuncInfo.MF->addFilterID(II->getArgOperand(i)->stripPointerCasts());
+ MMI.addFilterTypeInfo(FuncInfo.MF,
+ II->getArgOperand(i)->stripPointerCasts());
+
return true;
}
Modified: llvm/branches/wendling/eh/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp?rev=109968&r1=109967&r2=109968&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp (original)
+++ llvm/branches/wendling/eh/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Sat Jul 31 21:38:15 2010
@@ -288,13 +288,6 @@
if (!FilterLength) {
// Cleanup.
MMI->addCleanup(MBB);
- } else {
- // Filter.
- TyInfo.reserve(FilterLength - 1);
- for (unsigned j = i + 1; j < FirstCatch; ++j)
- TyInfo.push_back(ExtractTypeInfo(I.getArgOperand(j)));
- MMI->addFilterTypeInfo(MBB, TyInfo);
- TyInfo.clear();
}
N = i;
Modified: llvm/branches/wendling/eh/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/wendling/eh/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=109968&r1=109967&r2=109968&view=diff
==============================================================================
--- llvm/branches/wendling/eh/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/branches/wendling/eh/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Sat Jul 31 21:38:15 2010
@@ -4124,8 +4124,9 @@
case Intrinsic::eh_filter: {
// Add the filter IDs to the machine function.
MachineFunction &MF = DAG.getMachineFunction();
+ MachineModuleInfo &MMI = MF.getMMI();
for (unsigned i = 0, e = I.getNumArgOperands(); i != e; ++i)
- MF.addFilterID(I.getArgOperand(i)->stripPointerCasts());
+ MMI.addFilterTypeInfo(&MF, I.getArgOperand(i)->stripPointerCasts());
return 0;
}
More information about the llvm-branch-commits
mailing list