<div dir="ltr">Hi Matthias,<div><br></div><div>I've temporarily reverted this since it seems to be breaking global isel:</div><div><br></div><div> <a href="http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-globalisel_build/5174/console">http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-globalisel_build/5174/console</a><br class="inbox-inbox-Apple-interchange-newline"></div><div><br></div><div>Feel free to recommit when you've fixed up that side of things :)</div><div><br></div><div>Thanks!</div><div><br></div><div>-eric</div><div><br></div><div><div>Author: Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>></div><div>Date: Thu Dec 1 07:50:12 2016 +0000</div><div><br></div><div> Temporarily Revert "Move most EH from MachineModuleInfo to MachineFunction"</div><div><br></div><div> This apprears to have broken the global isel bot:</div><div><div> <a href="http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-globalisel_build/5174/console">http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-globalisel_build/5174/console</a></div><br class="inbox-inbox-Apple-interchange-newline"></div><div> This reverts commit r288293.</div><div><br></div><div> git-svn-id: <a href="https://llvm.org/svn/llvm-project/llvm/trunk@288322">https://llvm.org/svn/llvm-project/llvm/trunk@288322</a> 91177308-0d34-0410-b5e6-96231b3b80d8</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Nov 30, 2016 at 3:59 PM Matthias Braun via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: matze<br class="gmail_msg">
Date: Wed Nov 30 17:49:01 2016<br class="gmail_msg">
New Revision: 288293<br class="gmail_msg">
<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=288293&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project?rev=288293&view=rev</a><br class="gmail_msg">
Log:<br class="gmail_msg">
Move most EH from MachineModuleInfo to MachineFunction<br class="gmail_msg">
<br class="gmail_msg">
Most of the exception handling members in MachineModuleInfo is actually<br class="gmail_msg">
per function data (talks about the "current function") so it is better<br class="gmail_msg">
to keep it at the function instead of the module.<br class="gmail_msg">
<br class="gmail_msg">
This is a necessary step to have machine module passes work properly.<br class="gmail_msg">
<br class="gmail_msg">
Also:<br class="gmail_msg">
- Rename TidyLandingPads() to tidyLandingPads()<br class="gmail_msg">
- Use doxygen member groups instead of "//===- EH ---"... so it is clear<br class="gmail_msg">
where a group ends.<br class="gmail_msg">
- I had to add an ugly const_cast at two places in the AsmPrinter<br class="gmail_msg">
because the available MachineFunction pointers are const, but the code<br class="gmail_msg">
wants to call tidyLandingPads() in between<br class="gmail_msg">
(markFunctionEnd()/endFunction()).<br class="gmail_msg">
<br class="gmail_msg">
Differential Revision: <a href="https://reviews.llvm.org/D27227" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D27227</a><br class="gmail_msg">
<br class="gmail_msg">
Modified:<br class="gmail_msg">
llvm/trunk/include/llvm/CodeGen/MachineFunction.h<br class="gmail_msg">
llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h<br class="gmail_msg">
llvm/trunk/lib/CodeGen/Analysis.cpp<br class="gmail_msg">
llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp<br class="gmail_msg">
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp<br class="gmail_msg">
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp<br class="gmail_msg">
llvm/trunk/lib/CodeGen/AsmPrinter/EHStreamer.cpp<br class="gmail_msg">
llvm/trunk/lib/CodeGen/AsmPrinter/WinException.cpp<br class="gmail_msg">
llvm/trunk/lib/CodeGen/MachineFunction.cpp<br class="gmail_msg">
llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp<br class="gmail_msg">
llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp<br class="gmail_msg">
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp<br class="gmail_msg">
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp<br class="gmail_msg">
llvm/trunk/lib/CodeGen/TargetFrameLoweringImpl.cpp<br class="gmail_msg">
llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp<br class="gmail_msg">
llvm/trunk/lib/Target/SystemZ/SystemZFrameLowering.cpp<br class="gmail_msg">
llvm/trunk/lib/Target/X86/X86CallFrameOptimization.cpp<br class="gmail_msg">
llvm/trunk/lib/Target/X86/X86FrameLowering.cpp<br class="gmail_msg">
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp<br class="gmail_msg">
llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp<br class="gmail_msg">
llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original)<br class="gmail_msg">
+++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -21,11 +21,13 @@<br class="gmail_msg">
#include "llvm/ADT/BitVector.h"<br class="gmail_msg">
#include "llvm/ADT/ilist.h"<br class="gmail_msg">
#include "llvm/ADT/Optional.h"<br class="gmail_msg">
+#include "llvm/Analysis/EHPersonalities.h"<br class="gmail_msg">
#include "llvm/CodeGen/MachineBasicBlock.h"<br class="gmail_msg">
#include "llvm/CodeGen/MachineMemOperand.h"<br class="gmail_msg">
#include "llvm/IR/DebugLoc.h"<br class="gmail_msg">
#include "llvm/IR/Metadata.h"<br class="gmail_msg">
#include "llvm/MC/MCDwarf.h"<br class="gmail_msg">
+#include "llvm/MC/MCSymbol.h"<br class="gmail_msg">
#include "llvm/Support/Allocator.h"<br class="gmail_msg">
#include "llvm/Support/ArrayRecycler.h"<br class="gmail_msg">
#include "llvm/Support/Compiler.h"<br class="gmail_msg">
@@ -170,6 +172,28 @@ private:<br class="gmail_msg">
BitVector(static_cast<unsigned>(Property::LastProperty)+1);<br class="gmail_msg">
};<br class="gmail_msg">
<br class="gmail_msg">
+struct SEHHandler {<br class="gmail_msg">
+ /// Filter or finally function. Null indicates a catch-all.<br class="gmail_msg">
+ const Function *FilterOrFinally;<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Address of block to recover at. Null for a finally handler.<br class="gmail_msg">
+ const BlockAddress *RecoverBA;<br class="gmail_msg">
+};<br class="gmail_msg">
+<br class="gmail_msg">
+<br class="gmail_msg">
+/// This structure is used to retain landing pad info for the current function.<br class="gmail_msg">
+struct LandingPadInfo {<br class="gmail_msg">
+ MachineBasicBlock *LandingPadBlock; // Landing pad block.<br class="gmail_msg">
+ SmallVector<MCSymbol *, 1> BeginLabels; // Labels prior to invoke.<br class="gmail_msg">
+ SmallVector<MCSymbol *, 1> EndLabels; // Labels after invoke.<br class="gmail_msg">
+ SmallVector<SEHHandler, 1> SEHHandlers; // SEH handlers active at this lpad.<br class="gmail_msg">
+ MCSymbol *LandingPadLabel; // Label at beginning of landing pad.<br class="gmail_msg">
+ std::vector<int> TypeIds; // List of type ids (filters negative).<br class="gmail_msg">
+<br class="gmail_msg">
+ explicit LandingPadInfo(MachineBasicBlock *MBB)<br class="gmail_msg">
+ : LandingPadBlock(MBB), LandingPadLabel(nullptr) {}<br class="gmail_msg">
+};<br class="gmail_msg">
+<br class="gmail_msg">
class MachineFunction {<br class="gmail_msg">
const Function *Fn;<br class="gmail_msg">
const TargetMachine &Target;<br class="gmail_msg">
@@ -250,6 +274,35 @@ class MachineFunction {<br class="gmail_msg">
/// by debug and exception handling consumers.<br class="gmail_msg">
std::vector<MCCFIInstruction> FrameInstructions;<br class="gmail_msg">
<br class="gmail_msg">
+ /// \name Exception Handling<br class="gmail_msg">
+ /// \{<br class="gmail_msg">
+<br class="gmail_msg">
+ /// List of LandingPadInfo describing the landing pad information.<br class="gmail_msg">
+ std::vector<LandingPadInfo> LandingPads;<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Map a landing pad's EH symbol to the call site indexes.<br class="gmail_msg">
+ DenseMap<MCSymbol*, SmallVector<unsigned, 4> > LPadToCallSiteMap;<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Map of invoke call site index values to associated begin EH_LABEL.<br class="gmail_msg">
+ DenseMap<MCSymbol*, unsigned> CallSiteMap;<br class="gmail_msg">
+<br class="gmail_msg">
+ bool CallsEHReturn = false;<br class="gmail_msg">
+ bool CallsUnwindInit = false;<br class="gmail_msg">
+ bool HasEHFunclets = false;<br class="gmail_msg">
+<br class="gmail_msg">
+ /// List of C++ TypeInfo used.<br class="gmail_msg">
+ std::vector<const GlobalValue *> TypeInfos;<br class="gmail_msg">
+<br class="gmail_msg">
+ /// List of typeids encoding filters used.<br class="gmail_msg">
+ std::vector<unsigned> FilterIds;<br class="gmail_msg">
+<br class="gmail_msg">
+ /// List of the indices in FilterIds corresponding to filter terminators.<br class="gmail_msg">
+ std::vector<unsigned> FilterEnds;<br class="gmail_msg">
+<br class="gmail_msg">
+ EHPersonality PersonalityTypeCache = EHPersonality::Unknown;<br class="gmail_msg">
+<br class="gmail_msg">
+ /// \}<br class="gmail_msg">
+<br class="gmail_msg">
MachineFunction(const MachineFunction &) = delete;<br class="gmail_msg">
void operator=(const MachineFunction&) = delete;<br class="gmail_msg">
<br class="gmail_msg">
@@ -672,6 +725,105 @@ public:<br class="gmail_msg">
return FrameInstructions.size() - 1;<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
+ /// \name Exception Handling<br class="gmail_msg">
+ /// \{<br class="gmail_msg">
+<br class="gmail_msg">
+ bool callsEHReturn() const { return CallsEHReturn; }<br class="gmail_msg">
+ void setCallsEHReturn(bool b) { CallsEHReturn = b; }<br class="gmail_msg">
+<br class="gmail_msg">
+ bool callsUnwindInit() const { return CallsUnwindInit; }<br class="gmail_msg">
+ void setCallsUnwindInit(bool b) { CallsUnwindInit = b; }<br class="gmail_msg">
+<br class="gmail_msg">
+ bool hasEHFunclets() const { return HasEHFunclets; }<br class="gmail_msg">
+ void setHasEHFunclets(bool V) { HasEHFunclets = V; }<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Find or create an LandingPadInfo for the specified MachineBasicBlock.<br class="gmail_msg">
+ LandingPadInfo &getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad);<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Remap landing pad labels and remove any deleted landing pads.<br class="gmail_msg">
+ void tidyLandingPads(DenseMap<MCSymbol*, uintptr_t> *LPMap = nullptr);<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Return a reference to the landing pad info for the current function.<br class="gmail_msg">
+ const std::vector<LandingPadInfo> &getLandingPads() const {<br class="gmail_msg">
+ return LandingPads;<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Provide the begin and end labels of an invoke style call and associate it<br class="gmail_msg">
+ /// with a try landing pad block.<br class="gmail_msg">
+ void addInvoke(MachineBasicBlock *LandingPad,<br class="gmail_msg">
+ MCSymbol *BeginLabel, MCSymbol *EndLabel);<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Add a new panding pad. Returns the label ID for the landing pad entry.<br class="gmail_msg">
+ MCSymbol *addLandingPad(MachineBasicBlock *LandingPad);<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Provide the catch typeinfo for a landing pad.<br class="gmail_msg">
+ void addCatchTypeInfo(MachineBasicBlock *LandingPad,<br class="gmail_msg">
+ ArrayRef<const GlobalValue *> TyInfo);<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Provide the filter typeinfo for a landing pad.<br class="gmail_msg">
+ void addFilterTypeInfo(MachineBasicBlock *LandingPad,<br class="gmail_msg">
+ ArrayRef<const GlobalValue *> TyInfo);<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Add a cleanup action for a landing pad.<br class="gmail_msg">
+ void addCleanup(MachineBasicBlock *LandingPad);<br class="gmail_msg">
+<br class="gmail_msg">
+ void addSEHCatchHandler(MachineBasicBlock *LandingPad, const Function *Filter,<br class="gmail_msg">
+ const BlockAddress *RecoverLabel);<br class="gmail_msg">
+<br class="gmail_msg">
+ void addSEHCleanupHandler(MachineBasicBlock *LandingPad,<br class="gmail_msg">
+ const Function *Cleanup);<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Return the type id for the specified typeinfo. This is function wide.<br class="gmail_msg">
+ unsigned getTypeIDFor(const GlobalValue *TI);<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Return the id of the filter encoded by TyIds. This is function wide.<br class="gmail_msg">
+ int getFilterIDFor(std::vector<unsigned> &TyIds);<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Map the landing pad's EH symbol to the call site indexes.<br class="gmail_msg">
+ void setCallSiteLandingPad(MCSymbol *Sym, ArrayRef<unsigned> Sites);<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Get the call site indexes for a landing pad EH symbol.<br class="gmail_msg">
+ SmallVectorImpl<unsigned> &getCallSiteLandingPad(MCSymbol *Sym) {<br class="gmail_msg">
+ assert(hasCallSiteLandingPad(Sym) &&<br class="gmail_msg">
+ "missing call site number for landing pad!");<br class="gmail_msg">
+ return LPadToCallSiteMap[Sym];<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Return true if the landing pad Eh symbol has an associated call site.<br class="gmail_msg">
+ bool hasCallSiteLandingPad(MCSymbol *Sym) {<br class="gmail_msg">
+ return !LPadToCallSiteMap[Sym].empty();<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Map the begin label for a call site.<br class="gmail_msg">
+ void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site) {<br class="gmail_msg">
+ CallSiteMap[BeginLabel] = Site;<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Get the call site number for a begin label.<br class="gmail_msg">
+ unsigned getCallSiteBeginLabel(MCSymbol *BeginLabel) const {<br class="gmail_msg">
+ assert(hasCallSiteBeginLabel(BeginLabel) &&<br class="gmail_msg">
+ "Missing call site number for EH_LABEL!");<br class="gmail_msg">
+ return CallSiteMap.lookup(BeginLabel);<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Return true if the begin label has a call site number associated with it.<br class="gmail_msg">
+ bool hasCallSiteBeginLabel(MCSymbol *BeginLabel) const {<br class="gmail_msg">
+ return CallSiteMap.count(BeginLabel);<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Return a reference to the C++ typeinfo for the current function.<br class="gmail_msg">
+ const std::vector<const GlobalValue *> &getTypeInfos() const {<br class="gmail_msg">
+ return TypeInfos;<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
+ /// Return a reference to the typeids encoding filters used in the current<br class="gmail_msg">
+ /// function.<br class="gmail_msg">
+ const std::vector<unsigned> &getFilterIds() const {<br class="gmail_msg">
+ return FilterIds;<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
+ /// \}<br class="gmail_msg">
+<br class="gmail_msg">
/// Collect information used to emit debugging information of a variable.<br class="gmail_msg">
void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr,<br class="gmail_msg">
unsigned Slot, const DILocation *Loc) {<br class="gmail_msg">
@@ -684,6 +836,15 @@ public:<br class="gmail_msg">
}<br class="gmail_msg">
};<br class="gmail_msg">
<br class="gmail_msg">
+/// \name Exception Handling<br class="gmail_msg">
+/// \{<br class="gmail_msg">
+<br class="gmail_msg">
+/// Extract the exception handling information from the landingpad instruction<br class="gmail_msg">
+/// and add them to the specified machine module info.<br class="gmail_msg">
+void addLandingPadInfo(const LandingPadInst &I, MachineBasicBlock &MBB);<br class="gmail_msg">
+<br class="gmail_msg">
+/// \}<br class="gmail_msg">
+<br class="gmail_msg">
//===--------------------------------------------------------------------===//<br class="gmail_msg">
// GraphTraits specializations for function basic block graphs (CFGs)<br class="gmail_msg">
//===--------------------------------------------------------------------===//<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original)<br class="gmail_msg">
+++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -35,7 +35,6 @@<br class="gmail_msg">
#include "llvm/ADT/PointerIntPair.h"<br class="gmail_msg">
#include "llvm/ADT/SmallPtrSet.h"<br class="gmail_msg">
#include "llvm/ADT/SmallVector.h"<br class="gmail_msg">
-#include "llvm/Analysis/EHPersonalities.h"<br class="gmail_msg">
#include "llvm/IR/DebugLoc.h"<br class="gmail_msg">
#include "llvm/IR/ValueHandle.h"<br class="gmail_msg">
#include "llvm/MC/MCContext.h"<br class="gmail_msg">
@@ -62,29 +61,6 @@ class Module;<br class="gmail_msg">
class PointerType;<br class="gmail_msg">
class StructType;<br class="gmail_msg">
<br class="gmail_msg">
-struct SEHHandler {<br class="gmail_msg">
- // Filter or finally function. Null indicates a catch-all.<br class="gmail_msg">
- const Function *FilterOrFinally;<br class="gmail_msg">
-<br class="gmail_msg">
- // Address of block to recover at. Null for a finally handler.<br class="gmail_msg">
- const BlockAddress *RecoverBA;<br class="gmail_msg">
-};<br class="gmail_msg">
-<br class="gmail_msg">
-//===----------------------------------------------------------------------===//<br class="gmail_msg">
-/// This structure is used to retain landing pad info for the current function.<br class="gmail_msg">
-///<br class="gmail_msg">
-struct LandingPadInfo {<br class="gmail_msg">
- MachineBasicBlock *LandingPadBlock; // Landing pad block.<br class="gmail_msg">
- SmallVector<MCSymbol *, 1> BeginLabels; // Labels prior to invoke.<br class="gmail_msg">
- SmallVector<MCSymbol *, 1> EndLabels; // Labels after invoke.<br class="gmail_msg">
- SmallVector<SEHHandler, 1> SEHHandlers; // SEH handlers active at this lpad.<br class="gmail_msg">
- MCSymbol *LandingPadLabel; // Label at beginning of landing pad.<br class="gmail_msg">
- std::vector<int> TypeIds; // List of type ids (filters negative).<br class="gmail_msg">
-<br class="gmail_msg">
- explicit LandingPadInfo(MachineBasicBlock *MBB)<br class="gmail_msg">
- : LandingPadBlock(MBB), LandingPadLabel(nullptr) {}<br class="gmail_msg">
-};<br class="gmail_msg">
-<br class="gmail_msg">
//===----------------------------------------------------------------------===//<br class="gmail_msg">
/// This class can be derived from and used by targets to hold private<br class="gmail_msg">
/// target-specific information for each Module. Objects of type are<br class="gmail_msg">
@@ -122,41 +98,22 @@ class MachineModuleInfo : public Immutab<br class="gmail_msg">
/// want.<br class="gmail_msg">
MachineModuleInfoImpl *ObjFileMMI;<br class="gmail_msg">
<br class="gmail_msg">
- /// List of LandingPadInfo describing the landing pad information in the<br class="gmail_msg">
- /// current function.<br class="gmail_msg">
- std::vector<LandingPadInfo> LandingPads;<br class="gmail_msg">
-<br class="gmail_msg">
- /// Map a landing pad's EH symbol to the call site indexes.<br class="gmail_msg">
- DenseMap<MCSymbol*, SmallVector<unsigned, 4> > LPadToCallSiteMap;<br class="gmail_msg">
-<br class="gmail_msg">
- /// Map of invoke call site index values to associated begin EH_LABEL for the<br class="gmail_msg">
- /// current function.<br class="gmail_msg">
- DenseMap<MCSymbol*, unsigned> CallSiteMap;<br class="gmail_msg">
-<br class="gmail_msg">
- /// The current call site index being processed, if any. 0 if none.<br class="gmail_msg">
- unsigned CurCallSite;<br class="gmail_msg">
-<br class="gmail_msg">
- /// List of C++ TypeInfo used in the current function.<br class="gmail_msg">
- std::vector<const GlobalValue *> TypeInfos;<br class="gmail_msg">
-<br class="gmail_msg">
- /// List of typeids encoding filters used in the current function.<br class="gmail_msg">
- std::vector<unsigned> FilterIds;<br class="gmail_msg">
-<br class="gmail_msg">
- /// List of the indices in FilterIds corresponding to filter terminators.<br class="gmail_msg">
- std::vector<unsigned> FilterEnds;<br class="gmail_msg">
+ /// \name Exception Handling<br class="gmail_msg">
+ /// \{<br class="gmail_msg">
<br class="gmail_msg">
/// Vector of all personality functions ever seen. Used to emit common EH<br class="gmail_msg">
/// frames.<br class="gmail_msg">
std::vector<const Function *> Personalities;<br class="gmail_msg">
<br class="gmail_msg">
+ /// The current call site index being processed, if any. 0 if none.<br class="gmail_msg">
+ unsigned CurCallSite;<br class="gmail_msg">
+<br class="gmail_msg">
+ /// \}<br class="gmail_msg">
+<br class="gmail_msg">
/// This map keeps track of which symbol is being used for the specified<br class="gmail_msg">
/// basic block's address of label.<br class="gmail_msg">
MMIAddrLabelMap *AddrLabelSymbols;<br class="gmail_msg">
<br class="gmail_msg">
- bool CallsEHReturn;<br class="gmail_msg">
- bool CallsUnwindInit;<br class="gmail_msg">
- bool HasEHFunclets;<br class="gmail_msg">
-<br class="gmail_msg">
// TODO: Ideally, what we'd like is to have a switch that allows emitting<br class="gmail_msg">
// synchronous (precise at call-sites only) CFA into .eh_frame. However,<br class="gmail_msg">
// even under this switch, we'd like .debug_frame to be precise when using.<br class="gmail_msg">
@@ -177,8 +134,6 @@ class MachineModuleInfo : public Immutab<br class="gmail_msg">
/// comments in lib/Target/X86/X86FrameLowering.cpp for more details.<br class="gmail_msg">
bool UsesMorestackAddr;<br class="gmail_msg">
<br class="gmail_msg">
- EHPersonality PersonalityTypeCache;<br class="gmail_msg">
-<br class="gmail_msg">
MachineFunctionInitializer *MFInitializer;<br class="gmail_msg">
/// Maps IR Functions to their corresponding MachineFunctions.<br class="gmail_msg">
DenseMap<const Function*, std::unique_ptr<MachineFunction>> MachineFunctions;<br class="gmail_msg">
@@ -197,9 +152,6 @@ public:<br class="gmail_msg">
bool doInitialization(Module &) override;<br class="gmail_msg">
bool doFinalization(Module &) override;<br class="gmail_msg">
<br class="gmail_msg">
- /// Discard function meta information.<br class="gmail_msg">
- void EndFunction();<br class="gmail_msg">
-<br class="gmail_msg">
const MCContext &getContext() const { return Context; }<br class="gmail_msg">
MCContext &getContext() { return Context; }<br class="gmail_msg">
<br class="gmail_msg">
@@ -237,15 +189,6 @@ public:<br class="gmail_msg">
bool hasDebugInfo() const { return DbgInfoAvailable; }<br class="gmail_msg">
void setDebugInfoAvailability(bool avail) { DbgInfoAvailable = avail; }<br class="gmail_msg">
<br class="gmail_msg">
- bool callsEHReturn() const { return CallsEHReturn; }<br class="gmail_msg">
- void setCallsEHReturn(bool b) { CallsEHReturn = b; }<br class="gmail_msg">
-<br class="gmail_msg">
- bool callsUnwindInit() const { return CallsUnwindInit; }<br class="gmail_msg">
- void setCallsUnwindInit(bool b) { CallsUnwindInit = b; }<br class="gmail_msg">
-<br class="gmail_msg">
- bool hasEHFunclets() const { return HasEHFunclets; }<br class="gmail_msg">
- void setHasEHFunclets(bool V) { HasEHFunclets = V; }<br class="gmail_msg">
-<br class="gmail_msg">
bool usesVAFloatArgument() const {<br class="gmail_msg">
return UsesVAFloatArgument;<br class="gmail_msg">
}<br class="gmail_msg">
@@ -281,90 +224,8 @@ public:<br class="gmail_msg">
void takeDeletedSymbolsForFunction(const Function *F,<br class="gmail_msg">
std::vector<MCSymbol*> &Result);<br class="gmail_msg">
<br class="gmail_msg">
-<br class="gmail_msg">
- //===- EH ---------------------------------------------------------------===//<br class="gmail_msg">
-<br class="gmail_msg">
- /// Find or create an LandingPadInfo for the specified MachineBasicBlock.<br class="gmail_msg">
- LandingPadInfo &getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad);<br class="gmail_msg">
-<br class="gmail_msg">
- /// Provide the begin and end labels of an invoke style call and associate it<br class="gmail_msg">
- /// with a try landing pad block.<br class="gmail_msg">
- void addInvoke(MachineBasicBlock *LandingPad,<br class="gmail_msg">
- MCSymbol *BeginLabel, MCSymbol *EndLabel);<br class="gmail_msg">
-<br class="gmail_msg">
- /// Add a new panding pad. Returns the label ID for the landing pad entry.<br class="gmail_msg">
- MCSymbol *addLandingPad(MachineBasicBlock *LandingPad);<br class="gmail_msg">
-<br class="gmail_msg">
- /// Provide the personality function for the exception information.<br class="gmail_msg">
- void addPersonality(const Function *Personality);<br class="gmail_msg">
-<br class="gmail_msg">
- /// Return array of personality functions ever seen.<br class="gmail_msg">
- const std::vector<const Function *>& getPersonalities() const {<br class="gmail_msg">
- return Personalities;<br class="gmail_msg">
- }<br class="gmail_msg">
-<br class="gmail_msg">
- /// Provide the catch typeinfo for a landing pad.<br class="gmail_msg">
- void addCatchTypeInfo(MachineBasicBlock *LandingPad,<br class="gmail_msg">
- ArrayRef<const GlobalValue *> TyInfo);<br class="gmail_msg">
-<br class="gmail_msg">
- /// Provide the filter typeinfo for a landing pad.<br class="gmail_msg">
- void addFilterTypeInfo(MachineBasicBlock *LandingPad,<br class="gmail_msg">
- ArrayRef<const GlobalValue *> TyInfo);<br class="gmail_msg">
-<br class="gmail_msg">
- /// Add a cleanup action for a landing pad.<br class="gmail_msg">
- void addCleanup(MachineBasicBlock *LandingPad);<br class="gmail_msg">
-<br class="gmail_msg">
- void addSEHCatchHandler(MachineBasicBlock *LandingPad, const Function *Filter,<br class="gmail_msg">
- const BlockAddress *RecoverLabel);<br class="gmail_msg">
-<br class="gmail_msg">
- void addSEHCleanupHandler(MachineBasicBlock *LandingPad,<br class="gmail_msg">
- const Function *Cleanup);<br class="gmail_msg">
-<br class="gmail_msg">
- /// Return the type id for the specified typeinfo. This is function wide.<br class="gmail_msg">
- unsigned getTypeIDFor(const GlobalValue *TI);<br class="gmail_msg">
-<br class="gmail_msg">
- /// Return the id of the filter encoded by TyIds. This is function wide.<br class="gmail_msg">
- int getFilterIDFor(std::vector<unsigned> &TyIds);<br class="gmail_msg">
-<br class="gmail_msg">
- /// Remap landing pad labels and remove any deleted landing pads.<br class="gmail_msg">
- void TidyLandingPads(DenseMap<MCSymbol*, uintptr_t> *LPMap = nullptr);<br class="gmail_msg">
-<br class="gmail_msg">
- /// Return a reference to the landing pad info for the current function.<br class="gmail_msg">
- const std::vector<LandingPadInfo> &getLandingPads() const {<br class="gmail_msg">
- return LandingPads;<br class="gmail_msg">
- }<br class="gmail_msg">
-<br class="gmail_msg">
- /// Map the landing pad's EH symbol to the call site indexes.<br class="gmail_msg">
- void setCallSiteLandingPad(MCSymbol *Sym, ArrayRef<unsigned> Sites);<br class="gmail_msg">
-<br class="gmail_msg">
- /// Get the call site indexes for a landing pad EH symbol.<br class="gmail_msg">
- SmallVectorImpl<unsigned> &getCallSiteLandingPad(MCSymbol *Sym) {<br class="gmail_msg">
- assert(hasCallSiteLandingPad(Sym) &&<br class="gmail_msg">
- "missing call site number for landing pad!");<br class="gmail_msg">
- return LPadToCallSiteMap[Sym];<br class="gmail_msg">
- }<br class="gmail_msg">
-<br class="gmail_msg">
- /// Return true if the landing pad Eh symbol has an associated call site.<br class="gmail_msg">
- bool hasCallSiteLandingPad(MCSymbol *Sym) {<br class="gmail_msg">
- return !LPadToCallSiteMap[Sym].empty();<br class="gmail_msg">
- }<br class="gmail_msg">
-<br class="gmail_msg">
- /// Map the begin label for a call site.<br class="gmail_msg">
- void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site) {<br class="gmail_msg">
- CallSiteMap[BeginLabel] = Site;<br class="gmail_msg">
- }<br class="gmail_msg">
-<br class="gmail_msg">
- /// Get the call site number for a begin label.<br class="gmail_msg">
- unsigned getCallSiteBeginLabel(MCSymbol *BeginLabel) {<br class="gmail_msg">
- assert(hasCallSiteBeginLabel(BeginLabel) &&<br class="gmail_msg">
- "Missing call site number for EH_LABEL!");<br class="gmail_msg">
- return CallSiteMap[BeginLabel];<br class="gmail_msg">
- }<br class="gmail_msg">
-<br class="gmail_msg">
- /// Return true if the begin label has a call site number associated with it.<br class="gmail_msg">
- bool hasCallSiteBeginLabel(MCSymbol *BeginLabel) {<br class="gmail_msg">
- return CallSiteMap[BeginLabel] != 0;<br class="gmail_msg">
- }<br class="gmail_msg">
+ /// \name Exception Handling<br class="gmail_msg">
+ /// \{<br class="gmail_msg">
<br class="gmail_msg">
/// Set the call site currently being processed.<br class="gmail_msg">
void setCurrentCallSite(unsigned Site) { CurCallSite = Site; }<br class="gmail_msg">
@@ -373,16 +234,14 @@ public:<br class="gmail_msg">
/// none.<br class="gmail_msg">
unsigned getCurrentCallSite() { return CurCallSite; }<br class="gmail_msg">
<br class="gmail_msg">
- /// Return a reference to the C++ typeinfo for the current function.<br class="gmail_msg">
- const std::vector<const GlobalValue *> &getTypeInfos() const {<br class="gmail_msg">
- return TypeInfos;<br class="gmail_msg">
- }<br class="gmail_msg">
+ /// Provide the personality function for the exception information.<br class="gmail_msg">
+ void addPersonality(const Function *Personality);<br class="gmail_msg">
<br class="gmail_msg">
- /// Return a reference to the typeids encoding filters used in the current<br class="gmail_msg">
- /// function.<br class="gmail_msg">
- const std::vector<unsigned> &getFilterIds() const {<br class="gmail_msg">
- return FilterIds;<br class="gmail_msg">
+ /// Return array of personality functions ever seen.<br class="gmail_msg">
+ const std::vector<const Function *>& getPersonalities() const {<br class="gmail_msg">
+ return Personalities;<br class="gmail_msg">
}<br class="gmail_msg">
+ /// \}<br class="gmail_msg">
}; // End class MachineModuleInfo<br class="gmail_msg">
<br class="gmail_msg">
//===- MMI building helpers -----------------------------------------------===//<br class="gmail_msg">
@@ -393,12 +252,6 @@ public:<br class="gmail_msg">
/// which will link in MSVCRT's floating-point support.<br class="gmail_msg">
void computeUsesVAFloatArgument(const CallInst &I, MachineModuleInfo &MMI);<br class="gmail_msg">
<br class="gmail_msg">
-/// Extract the exception handling information from the landingpad instruction<br class="gmail_msg">
-/// and add them to the specified machine module info.<br class="gmail_msg">
-void addLandingPadInfo(const LandingPadInst &I, MachineModuleInfo &MMI,<br class="gmail_msg">
- MachineBasicBlock &MBB);<br class="gmail_msg">
-<br class="gmail_msg">
-<br class="gmail_msg">
} // End llvm namespace<br class="gmail_msg">
<br class="gmail_msg">
#endif<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/CodeGen/Analysis.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Analysis.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Analysis.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/CodeGen/Analysis.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/CodeGen/Analysis.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -684,7 +684,7 @@ llvm::getFuncletMembership(const Machine<br class="gmail_msg">
DenseMap<const MachineBasicBlock *, int> FuncletMembership;<br class="gmail_msg">
<br class="gmail_msg">
// We don't have anything to do if there aren't any EH pads.<br class="gmail_msg">
- if (!MF.getMMI().hasEHFunclets())<br class="gmail_msg">
+ if (!MF.hasEHFunclets())<br class="gmail_msg">
return FuncletMembership;<br class="gmail_msg">
<br class="gmail_msg">
int EntryBBNumber = MF.front().getNumber();<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -75,7 +75,7 @@ void ARMException::endFunction(const Mac<br class="gmail_msg">
F->hasPersonalityFn() && !isNoOpWithoutInvoke(classifyEHPersonality(Per)) &&<br class="gmail_msg">
F->needsUnwindTableEntry();<br class="gmail_msg">
bool shouldEmitPersonality = forceEmitPersonality ||<br class="gmail_msg">
- !MMI->getLandingPads().empty();<br class="gmail_msg">
+ !MF->getLandingPads().empty();<br class="gmail_msg">
if (!Asm->MF->getFunction()->needsUnwindTableEntry() &&<br class="gmail_msg">
!shouldEmitPersonality)<br class="gmail_msg">
ATS.emitCantUnwind();<br class="gmail_msg">
@@ -99,8 +99,9 @@ void ARMException::endFunction(const Mac<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
void ARMException::emitTypeInfos(unsigned TTypeEncoding) {<br class="gmail_msg">
- const std::vector<const GlobalValue *> &TypeInfos = MMI->getTypeInfos();<br class="gmail_msg">
- const std::vector<unsigned> &FilterIds = MMI->getFilterIds();<br class="gmail_msg">
+ const MachineFunction *MF = Asm->MF;<br class="gmail_msg">
+ const std::vector<const GlobalValue *> &TypeInfos = MF->getTypeInfos();<br class="gmail_msg">
+ const std::vector<unsigned> &FilterIds = MF->getFilterIds();<br class="gmail_msg">
<br class="gmail_msg">
bool VerboseAsm = Asm->OutStreamer->isVerboseAsm();<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -947,8 +947,8 @@ void AsmPrinter::EmitFunctionBody() {<br class="gmail_msg">
// Emit target-specific gunk after the function body.<br class="gmail_msg">
EmitFunctionBodyEnd();<br class="gmail_msg">
<br class="gmail_msg">
- if (!MMI->getLandingPads().empty() || MMI->hasDebugInfo() ||<br class="gmail_msg">
- MMI->hasEHFunclets() || MAI->hasDotTypeDotSizeDirective()) {<br class="gmail_msg">
+ if (!MF->getLandingPads().empty() || MMI->hasDebugInfo() ||<br class="gmail_msg">
+ MF->hasEHFunclets() || MAI->hasDotTypeDotSizeDirective()) {<br class="gmail_msg">
// Create a symbol for the end of function.<br class="gmail_msg">
CurrentFnEnd = createTempSymbol("func_end");<br class="gmail_msg">
OutStreamer->EmitLabel(CurrentFnEnd);<br class="gmail_msg">
@@ -981,7 +981,6 @@ void AsmPrinter::EmitFunctionBody() {<br class="gmail_msg">
HI.TimerGroupDescription, TimePassesIsEnabled);<br class="gmail_msg">
HI.Handler->endFunction(MF);<br class="gmail_msg">
}<br class="gmail_msg">
- MMI->EndFunction();<br class="gmail_msg">
<br class="gmail_msg">
OutStreamer->AddBlankLine();<br class="gmail_msg">
}<br class="gmail_msg">
@@ -1273,8 +1272,8 @@ void AsmPrinter::SetupMachineFunction(Ma<br class="gmail_msg">
CurrentFnBegin = nullptr;<br class="gmail_msg">
CurExceptionSym = nullptr;<br class="gmail_msg">
bool NeedsLocalForSize = MAI->needsLocalForSize();<br class="gmail_msg">
- if (!MMI->getLandingPads().empty() || MMI->hasDebugInfo() ||<br class="gmail_msg">
- MMI->hasEHFunclets() || NeedsLocalForSize) {<br class="gmail_msg">
+ if (!MF.getLandingPads().empty() || MMI->hasDebugInfo() ||<br class="gmail_msg">
+ MF.hasEHFunclets() || NeedsLocalForSize) {<br class="gmail_msg">
CurrentFnBegin = createTempSymbol("func_begin");<br class="gmail_msg">
if (NeedsLocalForSize)<br class="gmail_msg">
CurrentFnSymForSize = CurrentFnBegin;<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -44,11 +44,11 @@ DwarfCFIExceptionBase::DwarfCFIException<br class="gmail_msg">
void DwarfCFIExceptionBase::markFunctionEnd() {<br class="gmail_msg">
endFragment();<br class="gmail_msg">
<br class="gmail_msg">
- if (MMI->getLandingPads().empty())<br class="gmail_msg">
- return;<br class="gmail_msg">
-<br class="gmail_msg">
// Map all labels and get rid of any dead landing pads.<br class="gmail_msg">
- MMI->TidyLandingPads();<br class="gmail_msg">
+ if (!Asm->MF->getLandingPads().empty()) {<br class="gmail_msg">
+ MachineFunction *NonConstMF = const_cast<MachineFunction*>(Asm->MF);<br class="gmail_msg">
+ NonConstMF->tidyLandingPads();<br class="gmail_msg">
+ }<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
void DwarfCFIExceptionBase::endFragment() {<br class="gmail_msg">
@@ -98,7 +98,7 @@ void DwarfCFIException::beginFunction(co<br class="gmail_msg">
const Function *F = MF->getFunction();<br class="gmail_msg">
<br class="gmail_msg">
// If any landing pads survive, we need an EH table.<br class="gmail_msg">
- bool hasLandingPads = !MMI->getLandingPads().empty();<br class="gmail_msg">
+ bool hasLandingPads = !MF->getLandingPads().empty();<br class="gmail_msg">
<br class="gmail_msg">
// See if we need frame move info.<br class="gmail_msg">
AsmPrinter::CFIMoveType MoveType = Asm->needsCFIMoves();<br class="gmail_msg">
@@ -170,7 +170,7 @@ void DwarfCFIException::beginFragment(co<br class="gmail_msg">
<br class="gmail_msg">
/// endFunction - Gather and emit post-function exception information.<br class="gmail_msg">
///<br class="gmail_msg">
-void DwarfCFIException::endFunction(const MachineFunction *) {<br class="gmail_msg">
+void DwarfCFIException::endFunction(const MachineFunction *MF) {<br class="gmail_msg">
if (!shouldEmitPersonality)<br class="gmail_msg">
return;<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/EHStreamer.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/EHStreamer.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/EHStreamer.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/CodeGen/AsmPrinter/EHStreamer.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/CodeGen/AsmPrinter/EHStreamer.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -74,7 +74,7 @@ computeActionsTable(const SmallVectorImp<br class="gmail_msg">
// output using a fixed width encoding. FilterOffsets[i] holds the byte<br class="gmail_msg">
// offset corresponding to FilterIds[i].<br class="gmail_msg">
<br class="gmail_msg">
- const std::vector<unsigned> &FilterIds = MMI->getFilterIds();<br class="gmail_msg">
+ const std::vector<unsigned> &FilterIds = Asm->MF->getFilterIds();<br class="gmail_msg">
SmallVector<int, 16> FilterOffsets;<br class="gmail_msg">
FilterOffsets.reserve(FilterIds.size());<br class="gmail_msg">
int Offset = -1;<br class="gmail_msg">
@@ -296,7 +296,7 @@ computeCallSiteTable(SmallVectorImpl<Cal<br class="gmail_msg">
else {<br class="gmail_msg">
// SjLj EH must maintain the call sites in the order assigned<br class="gmail_msg">
// to them by the SjLjPrepare pass.<br class="gmail_msg">
- unsigned SiteNo = MMI->getCallSiteBeginLabel(BeginLabel);<br class="gmail_msg">
+ unsigned SiteNo = Asm->MF->getCallSiteBeginLabel(BeginLabel);<br class="gmail_msg">
if (CallSites.size() < SiteNo)<br class="gmail_msg">
CallSites.resize(SiteNo);<br class="gmail_msg">
CallSites[SiteNo - 1] = Site;<br class="gmail_msg">
@@ -336,9 +336,10 @@ computeCallSiteTable(SmallVectorImpl<Cal<br class="gmail_msg">
/// 3. Type ID table contains references to all the C++ typeinfo for all<br class="gmail_msg">
/// catches in the function. This tables is reverse indexed base 1.<br class="gmail_msg">
void EHStreamer::emitExceptionTable() {<br class="gmail_msg">
- const std::vector<const GlobalValue *> &TypeInfos = MMI->getTypeInfos();<br class="gmail_msg">
- const std::vector<unsigned> &FilterIds = MMI->getFilterIds();<br class="gmail_msg">
- const std::vector<LandingPadInfo> &PadInfos = MMI->getLandingPads();<br class="gmail_msg">
+ const MachineFunction *MF = Asm->MF;<br class="gmail_msg">
+ const std::vector<const GlobalValue *> &TypeInfos = MF->getTypeInfos();<br class="gmail_msg">
+ const std::vector<unsigned> &FilterIds = MF->getFilterIds();<br class="gmail_msg">
+ const std::vector<LandingPadInfo> &PadInfos = MF->getLandingPads();<br class="gmail_msg">
<br class="gmail_msg">
// Sort the landing pads in order of their type ids. This is used to fold<br class="gmail_msg">
// duplicate actions.<br class="gmail_msg">
@@ -649,8 +650,9 @@ void EHStreamer::emitExceptionTable() {<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
void EHStreamer::emitTypeInfos(unsigned TTypeEncoding) {<br class="gmail_msg">
- const std::vector<const GlobalValue *> &TypeInfos = MMI->getTypeInfos();<br class="gmail_msg">
- const std::vector<unsigned> &FilterIds = MMI->getFilterIds();<br class="gmail_msg">
+ const MachineFunction *MF = Asm->MF;<br class="gmail_msg">
+ const std::vector<const GlobalValue *> &TypeInfos = MF->getTypeInfos();<br class="gmail_msg">
+ const std::vector<unsigned> &FilterIds = MF->getFilterIds();<br class="gmail_msg">
<br class="gmail_msg">
bool VerboseAsm = Asm->OutStreamer->isVerboseAsm();<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/WinException.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/WinException.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/WinException.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/CodeGen/AsmPrinter/WinException.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/CodeGen/AsmPrinter/WinException.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -63,8 +63,8 @@ void WinException::beginFunction(const M<br class="gmail_msg">
shouldEmitMoves = shouldEmitPersonality = shouldEmitLSDA = false;<br class="gmail_msg">
<br class="gmail_msg">
// If any landing pads survive, we need an EH table.<br class="gmail_msg">
- bool hasLandingPads = !MMI->getLandingPads().empty();<br class="gmail_msg">
- bool hasEHFunclets = MMI->hasEHFunclets();<br class="gmail_msg">
+ bool hasLandingPads = !MF->getLandingPads().empty();<br class="gmail_msg">
+ bool hasEHFunclets = MF->hasEHFunclets();<br class="gmail_msg">
<br class="gmail_msg">
const Function *F = MF->getFunction();<br class="gmail_msg">
<br class="gmail_msg">
@@ -126,13 +126,15 @@ void WinException::endFunction(const Mac<br class="gmail_msg">
// Get rid of any dead landing pads if we're not using funclets. In funclet<br class="gmail_msg">
// schemes, the landing pad is not actually reachable. It only exists so<br class="gmail_msg">
// that we can emit the right table data.<br class="gmail_msg">
- if (!isFuncletEHPersonality(Per))<br class="gmail_msg">
- MMI->TidyLandingPads();<br class="gmail_msg">
+ if (!isFuncletEHPersonality(Per)) {<br class="gmail_msg">
+ MachineFunction *NonConstMF = const_cast<MachineFunction*>(MF);<br class="gmail_msg">
+ NonConstMF->tidyLandingPads();<br class="gmail_msg">
+ }<br class="gmail_msg">
<br class="gmail_msg">
endFunclet();<br class="gmail_msg">
<br class="gmail_msg">
// endFunclet will emit the necessary .xdata tables for x64 SEH.<br class="gmail_msg">
- if (Per == EHPersonality::MSVC_Win64SEH && MMI->hasEHFunclets())<br class="gmail_msg">
+ if (Per == EHPersonality::MSVC_Win64SEH && MF->hasEHFunclets())<br class="gmail_msg">
return;<br class="gmail_msg">
<br class="gmail_msg">
if (shouldEmitPersonality || shouldEmitLSDA) {<br class="gmail_msg">
@@ -234,8 +236,9 @@ void WinException::endFunclet() {<br class="gmail_msg">
if (!CurrentFuncletEntry)<br class="gmail_msg">
return;<br class="gmail_msg">
<br class="gmail_msg">
+ const MachineFunction *MF = Asm->MF;<br class="gmail_msg">
if (shouldEmitMoves || shouldEmitPersonality) {<br class="gmail_msg">
- const Function *F = Asm->MF->getFunction();<br class="gmail_msg">
+ const Function *F = MF->getFunction();<br class="gmail_msg">
EHPersonality Per = EHPersonality::Unknown;<br class="gmail_msg">
if (F->hasPersonalityFn())<br class="gmail_msg">
Per = classifyEHPersonality(F->getPersonalityFn()->stripPointerCasts());<br class="gmail_msg">
@@ -255,11 +258,11 @@ void WinException::endFunclet() {<br class="gmail_msg">
MCSymbol *FuncInfoXData = Asm->OutContext.getOrCreateSymbol(<br class="gmail_msg">
Twine("$cppxdata$", FuncLinkageName));<br class="gmail_msg">
Asm->OutStreamer->EmitValue(create32bitRef(FuncInfoXData), 4);<br class="gmail_msg">
- } else if (Per == EHPersonality::MSVC_Win64SEH && MMI->hasEHFunclets() &&<br class="gmail_msg">
+ } else if (Per == EHPersonality::MSVC_Win64SEH && MF->hasEHFunclets() &&<br class="gmail_msg">
!CurrentFuncletEntry->isEHFuncletEntry()) {<br class="gmail_msg">
// If this is the parent function in Win64 SEH, emit the LSDA immediately<br class="gmail_msg">
// following .seh_handlerdata.<br class="gmail_msg">
- emitCSpecificHandlerTable(Asm->MF);<br class="gmail_msg">
+ emitCSpecificHandlerTable(MF);<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
// Switch back to the previous section now that we are done writing to<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -568,6 +568,193 @@ MCSymbol *MachineFunction::getPICBaseSym<br class="gmail_msg">
Twine(getFunctionNumber()) + "$pb");<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
+/// \name Exception Handling<br class="gmail_msg">
+/// \{<br class="gmail_msg">
+<br class="gmail_msg">
+LandingPadInfo &<br class="gmail_msg">
+MachineFunction::getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad) {<br class="gmail_msg">
+ unsigned N = LandingPads.size();<br class="gmail_msg">
+ for (unsigned i = 0; i < N; ++i) {<br class="gmail_msg">
+ LandingPadInfo &LP = LandingPads[i];<br class="gmail_msg">
+ if (LP.LandingPadBlock == LandingPad)<br class="gmail_msg">
+ return LP;<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
+ LandingPads.push_back(LandingPadInfo(LandingPad));<br class="gmail_msg">
+ return LandingPads[N];<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+void MachineFunction::addInvoke(MachineBasicBlock *LandingPad,<br class="gmail_msg">
+ MCSymbol *BeginLabel, MCSymbol *EndLabel) {<br class="gmail_msg">
+ LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);<br class="gmail_msg">
+ LP.BeginLabels.push_back(BeginLabel);<br class="gmail_msg">
+ LP.EndLabels.push_back(EndLabel);<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+MCSymbol *MachineFunction::addLandingPad(MachineBasicBlock *LandingPad) {<br class="gmail_msg">
+ MCSymbol *LandingPadLabel = Ctx.createTempSymbol();<br class="gmail_msg">
+ LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);<br class="gmail_msg">
+ LP.LandingPadLabel = LandingPadLabel;<br class="gmail_msg">
+ return LandingPadLabel;<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+void MachineFunction::addCatchTypeInfo(MachineBasicBlock *LandingPad,<br class="gmail_msg">
+ ArrayRef<const GlobalValue *> TyInfo) {<br class="gmail_msg">
+ LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);<br class="gmail_msg">
+ for (unsigned N = TyInfo.size(); N; --N)<br class="gmail_msg">
+ LP.TypeIds.push_back(getTypeIDFor(TyInfo[N - 1]));<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+void MachineFunction::addFilterTypeInfo(MachineBasicBlock *LandingPad,<br class="gmail_msg">
+ ArrayRef<const GlobalValue *> TyInfo) {<br class="gmail_msg">
+ LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);<br class="gmail_msg">
+ std::vector<unsigned> IdsInFilter(TyInfo.size());<br class="gmail_msg">
+ for (unsigned I = 0, E = TyInfo.size(); I != E; ++I)<br class="gmail_msg">
+ IdsInFilter[I] = getTypeIDFor(TyInfo[I]);<br class="gmail_msg">
+ LP.TypeIds.push_back(getFilterIDFor(IdsInFilter));<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+void MachineFunction::tidyLandingPads(DenseMap<MCSymbol*, uintptr_t> *LPMap) {<br class="gmail_msg">
+ for (unsigned i = 0; i != LandingPads.size(); ) {<br class="gmail_msg">
+ LandingPadInfo &LandingPad = LandingPads[i];<br class="gmail_msg">
+ if (LandingPad.LandingPadLabel &&<br class="gmail_msg">
+ !LandingPad.LandingPadLabel->isDefined() &&<br class="gmail_msg">
+ (!LPMap || (*LPMap)[LandingPad.LandingPadLabel] == 0))<br class="gmail_msg">
+ LandingPad.LandingPadLabel = nullptr;<br class="gmail_msg">
+<br class="gmail_msg">
+ // Special case: we *should* emit LPs with null LP MBB. This indicates<br class="gmail_msg">
+ // "nounwind" case.<br class="gmail_msg">
+ if (!LandingPad.LandingPadLabel && LandingPad.LandingPadBlock) {<br class="gmail_msg">
+ LandingPads.erase(LandingPads.begin() + i);<br class="gmail_msg">
+ continue;<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
+ for (unsigned j = 0, e = LandingPads[i].BeginLabels.size(); j != e; ++j) {<br class="gmail_msg">
+ MCSymbol *BeginLabel = LandingPad.BeginLabels[j];<br class="gmail_msg">
+ MCSymbol *EndLabel = LandingPad.EndLabels[j];<br class="gmail_msg">
+ if ((BeginLabel->isDefined() ||<br class="gmail_msg">
+ (LPMap && (*LPMap)[BeginLabel] != 0)) &&<br class="gmail_msg">
+ (EndLabel->isDefined() ||<br class="gmail_msg">
+ (LPMap && (*LPMap)[EndLabel] != 0))) continue;<br class="gmail_msg">
+<br class="gmail_msg">
+ LandingPad.BeginLabels.erase(LandingPad.BeginLabels.begin() + j);<br class="gmail_msg">
+ LandingPad.EndLabels.erase(LandingPad.EndLabels.begin() + j);<br class="gmail_msg">
+ --j;<br class="gmail_msg">
+ --e;<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
+ // Remove landing pads with no try-ranges.<br class="gmail_msg">
+ if (LandingPads[i].BeginLabels.empty()) {<br class="gmail_msg">
+ LandingPads.erase(LandingPads.begin() + i);<br class="gmail_msg">
+ continue;<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
+ // If there is no landing pad, ensure that the list of typeids is empty.<br class="gmail_msg">
+ // If the only typeid is a cleanup, this is the same as having no typeids.<br class="gmail_msg">
+ if (!LandingPad.LandingPadBlock ||<br class="gmail_msg">
+ (LandingPad.TypeIds.size() == 1 && !LandingPad.TypeIds[0]))<br class="gmail_msg">
+ LandingPad.TypeIds.clear();<br class="gmail_msg">
+ ++i;<br class="gmail_msg">
+ }<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+void MachineFunction::addCleanup(MachineBasicBlock *LandingPad) {<br class="gmail_msg">
+ LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);<br class="gmail_msg">
+ LP.TypeIds.push_back(0);<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+void MachineFunction::addSEHCatchHandler(MachineBasicBlock *LandingPad,<br class="gmail_msg">
+ const Function *Filter,<br class="gmail_msg">
+ const BlockAddress *RecoverBA) {<br class="gmail_msg">
+ LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);<br class="gmail_msg">
+ SEHHandler Handler;<br class="gmail_msg">
+ Handler.FilterOrFinally = Filter;<br class="gmail_msg">
+ Handler.RecoverBA = RecoverBA;<br class="gmail_msg">
+ LP.SEHHandlers.push_back(Handler);<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+void MachineFunction::addSEHCleanupHandler(MachineBasicBlock *LandingPad,<br class="gmail_msg">
+ const Function *Cleanup) {<br class="gmail_msg">
+ LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);<br class="gmail_msg">
+ SEHHandler Handler;<br class="gmail_msg">
+ Handler.FilterOrFinally = Cleanup;<br class="gmail_msg">
+ Handler.RecoverBA = nullptr;<br class="gmail_msg">
+ LP.SEHHandlers.push_back(Handler);<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+void MachineFunction::setCallSiteLandingPad(MCSymbol *Sym,<br class="gmail_msg">
+ ArrayRef<unsigned> Sites) {<br class="gmail_msg">
+ LPadToCallSiteMap[Sym].append(Sites.begin(), Sites.end());<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+unsigned MachineFunction::getTypeIDFor(const GlobalValue *TI) {<br class="gmail_msg">
+ for (unsigned i = 0, N = TypeInfos.size(); i != N; ++i)<br class="gmail_msg">
+ if (TypeInfos[i] == TI) return i + 1;<br class="gmail_msg">
+<br class="gmail_msg">
+ TypeInfos.push_back(TI);<br class="gmail_msg">
+ return TypeInfos.size();<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+int MachineFunction::getFilterIDFor(std::vector<unsigned> &TyIds) {<br class="gmail_msg">
+ // If the new filter coincides with the tail of an existing filter, then<br class="gmail_msg">
+ // re-use the existing filter. Folding filters more than this requires<br class="gmail_msg">
+ // re-ordering filters and/or their elements - probably not worth it.<br class="gmail_msg">
+ for (std::vector<unsigned>::iterator I = FilterEnds.begin(),<br class="gmail_msg">
+ E = FilterEnds.end(); I != E; ++I) {<br class="gmail_msg">
+ unsigned i = *I, j = TyIds.size();<br class="gmail_msg">
+<br class="gmail_msg">
+ while (i && j)<br class="gmail_msg">
+ if (FilterIds[--i] != TyIds[--j])<br class="gmail_msg">
+ goto try_next;<br class="gmail_msg">
+<br class="gmail_msg">
+ if (!j)<br class="gmail_msg">
+ // The new filter coincides with range [i, end) of the existing filter.<br class="gmail_msg">
+ return -(1 + i);<br class="gmail_msg">
+<br class="gmail_msg">
+try_next:;<br class="gmail_msg">
+ }<br class="gmail_msg">
+<br class="gmail_msg">
+ // Add the new filter.<br class="gmail_msg">
+ int FilterID = -(1 + FilterIds.size());<br class="gmail_msg">
+ FilterIds.reserve(FilterIds.size() + TyIds.size() + 1);<br class="gmail_msg">
+ FilterIds.insert(FilterIds.end(), TyIds.begin(), TyIds.end());<br class="gmail_msg">
+ FilterEnds.push_back(FilterIds.size());<br class="gmail_msg">
+ FilterIds.push_back(0); // terminator<br class="gmail_msg">
+ return FilterID;<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+void llvm::addLandingPadInfo(const LandingPadInst &I, MachineBasicBlock &MBB) {<br class="gmail_msg">
+ MachineFunction &MF = *MBB.getParent();<br class="gmail_msg">
+ if (const auto *PF = dyn_cast<Function>(<br class="gmail_msg">
+ I.getParent()->getParent()->getPersonalityFn()->stripPointerCasts()))<br class="gmail_msg">
+ MF.getMMI().addPersonality(PF);<br class="gmail_msg">
+<br class="gmail_msg">
+ if (I.isCleanup())<br class="gmail_msg">
+ MF.addCleanup(&MBB);<br class="gmail_msg">
+<br class="gmail_msg">
+ // FIXME: New EH - Add the clauses in reverse order. This isn't 100% correct,<br class="gmail_msg">
+ // but we need to do it this way because of how the DWARF EH emitter<br class="gmail_msg">
+ // processes the clauses.<br class="gmail_msg">
+ for (unsigned i = I.getNumClauses(); i != 0; --i) {<br class="gmail_msg">
+ Value *Val = I.getClause(i - 1);<br class="gmail_msg">
+ if (I.isCatch(i - 1)) {<br class="gmail_msg">
+ MF.addCatchTypeInfo(&MBB,<br class="gmail_msg">
+ dyn_cast<GlobalValue>(Val->stripPointerCasts()));<br class="gmail_msg">
+ } else {<br class="gmail_msg">
+ // Add filters in a list.<br class="gmail_msg">
+ Constant *CVal = cast<Constant>(Val);<br class="gmail_msg">
+ SmallVector<const GlobalValue *, 4> FilterList;<br class="gmail_msg">
+ for (User::op_iterator II = CVal->op_begin(), IE = CVal->op_end();<br class="gmail_msg">
+ II != IE; ++II)<br class="gmail_msg">
+ FilterList.push_back(cast<GlobalValue>((*II)->stripPointerCasts()));<br class="gmail_msg">
+<br class="gmail_msg">
+ MF.addFilterTypeInfo(&MBB, FilterList);<br class="gmail_msg">
+ }<br class="gmail_msg">
+ }<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
+/// \}<br class="gmail_msg">
+<br class="gmail_msg">
//===----------------------------------------------------------------------===//<br class="gmail_msg">
// MachineFrameInfo implementation<br class="gmail_msg">
//===----------------------------------------------------------------------===//<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -203,11 +203,7 @@ bool MachineModuleInfo::doInitialization<br class="gmail_msg">
<br class="gmail_msg">
ObjFileMMI = nullptr;<br class="gmail_msg">
CurCallSite = 0;<br class="gmail_msg">
- CallsEHReturn = false;<br class="gmail_msg">
- CallsUnwindInit = false;<br class="gmail_msg">
- HasEHFunclets = false;<br class="gmail_msg">
DbgInfoAvailable = UsesVAFloatArgument = UsesMorestackAddr = false;<br class="gmail_msg">
- PersonalityTypeCache = EHPersonality::Unknown;<br class="gmail_msg">
AddrLabelSymbols = nullptr;<br class="gmail_msg">
TheModule = &M;<br class="gmail_msg">
<br class="gmail_msg">
@@ -229,19 +225,6 @@ bool MachineModuleInfo::doFinalization(M<br class="gmail_msg">
return false;<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
-void MachineModuleInfo::EndFunction() {<br class="gmail_msg">
- // Clean up exception info.<br class="gmail_msg">
- LandingPads.clear();<br class="gmail_msg">
- PersonalityTypeCache = EHPersonality::Unknown;<br class="gmail_msg">
- CallSiteMap.clear();<br class="gmail_msg">
- TypeInfos.clear();<br class="gmail_msg">
- FilterIds.clear();<br class="gmail_msg">
- FilterEnds.clear();<br class="gmail_msg">
- CallsEHReturn = false;<br class="gmail_msg">
- CallsUnwindInit = false;<br class="gmail_msg">
- HasEHFunclets = false;<br class="gmail_msg">
-}<br class="gmail_msg">
-<br class="gmail_msg">
//===- Address of Block Management ----------------------------------------===//<br class="gmail_msg">
<br class="gmail_msg">
ArrayRef<MCSymbol *><br class="gmail_msg">
@@ -261,34 +244,8 @@ takeDeletedSymbolsForFunction(const Func<br class="gmail_msg">
takeDeletedSymbolsForFunction(const_cast<Function*>(F), Result);<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
-//===- EH -----------------------------------------------------------------===//<br class="gmail_msg">
-<br class="gmail_msg">
-LandingPadInfo &MachineModuleInfo::getOrCreateLandingPadInfo<br class="gmail_msg">
- (MachineBasicBlock *LandingPad) {<br class="gmail_msg">
- unsigned N = LandingPads.size();<br class="gmail_msg">
- for (unsigned i = 0; i < N; ++i) {<br class="gmail_msg">
- LandingPadInfo &LP = LandingPads[i];<br class="gmail_msg">
- if (LP.LandingPadBlock == LandingPad)<br class="gmail_msg">
- return LP;<br class="gmail_msg">
- }<br class="gmail_msg">
-<br class="gmail_msg">
- LandingPads.push_back(LandingPadInfo(LandingPad));<br class="gmail_msg">
- return LandingPads[N];<br class="gmail_msg">
-}<br class="gmail_msg">
-<br class="gmail_msg">
-void MachineModuleInfo::addInvoke(MachineBasicBlock *LandingPad,<br class="gmail_msg">
- MCSymbol *BeginLabel, MCSymbol *EndLabel) {<br class="gmail_msg">
- LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);<br class="gmail_msg">
- LP.BeginLabels.push_back(BeginLabel);<br class="gmail_msg">
- LP.EndLabels.push_back(EndLabel);<br class="gmail_msg">
-}<br class="gmail_msg">
-<br class="gmail_msg">
-MCSymbol *MachineModuleInfo::addLandingPad(MachineBasicBlock *LandingPad) {<br class="gmail_msg">
- MCSymbol *LandingPadLabel = Context.createTempSymbol();<br class="gmail_msg">
- LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);<br class="gmail_msg">
- LP.LandingPadLabel = LandingPadLabel;<br class="gmail_msg">
- return LandingPadLabel;<br class="gmail_msg">
-}<br class="gmail_msg">
+/// \name Exception Handling<br class="gmail_msg">
+/// \{<br class="gmail_msg">
<br class="gmail_msg">
void MachineModuleInfo::addPersonality(const Function *Personality) {<br class="gmail_msg">
for (unsigned i = 0; i < Personalities.size(); ++i)<br class="gmail_msg">
@@ -297,132 +254,7 @@ void MachineModuleInfo::addPersonality(c<br class="gmail_msg">
Personalities.push_back(Personality);<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
-void MachineModuleInfo::<br class="gmail_msg">
-addCatchTypeInfo(MachineBasicBlock *LandingPad,<br class="gmail_msg">
- ArrayRef<const GlobalValue *> TyInfo) {<br class="gmail_msg">
- LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);<br class="gmail_msg">
- for (unsigned N = TyInfo.size(); N; --N)<br class="gmail_msg">
- LP.TypeIds.push_back(getTypeIDFor(TyInfo[N - 1]));<br class="gmail_msg">
-}<br class="gmail_msg">
-<br class="gmail_msg">
-void MachineModuleInfo::<br class="gmail_msg">
-addFilterTypeInfo(MachineBasicBlock *LandingPad,<br class="gmail_msg">
- ArrayRef<const GlobalValue *> TyInfo) {<br class="gmail_msg">
- LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);<br class="gmail_msg">
- std::vector<unsigned> IdsInFilter(TyInfo.size());<br class="gmail_msg">
- for (unsigned I = 0, E = TyInfo.size(); I != E; ++I)<br class="gmail_msg">
- IdsInFilter[I] = getTypeIDFor(TyInfo[I]);<br class="gmail_msg">
- LP.TypeIds.push_back(getFilterIDFor(IdsInFilter));<br class="gmail_msg">
-}<br class="gmail_msg">
-<br class="gmail_msg">
-void MachineModuleInfo::addCleanup(MachineBasicBlock *LandingPad) {<br class="gmail_msg">
- LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);<br class="gmail_msg">
- LP.TypeIds.push_back(0);<br class="gmail_msg">
-}<br class="gmail_msg">
-<br class="gmail_msg">
-void MachineModuleInfo::addSEHCatchHandler(MachineBasicBlock *LandingPad,<br class="gmail_msg">
- const Function *Filter,<br class="gmail_msg">
- const BlockAddress *RecoverBA) {<br class="gmail_msg">
- LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);<br class="gmail_msg">
- SEHHandler Handler;<br class="gmail_msg">
- Handler.FilterOrFinally = Filter;<br class="gmail_msg">
- Handler.RecoverBA = RecoverBA;<br class="gmail_msg">
- LP.SEHHandlers.push_back(Handler);<br class="gmail_msg">
-}<br class="gmail_msg">
-<br class="gmail_msg">
-void MachineModuleInfo::addSEHCleanupHandler(MachineBasicBlock *LandingPad,<br class="gmail_msg">
- const Function *Cleanup) {<br class="gmail_msg">
- LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);<br class="gmail_msg">
- SEHHandler Handler;<br class="gmail_msg">
- Handler.FilterOrFinally = Cleanup;<br class="gmail_msg">
- Handler.RecoverBA = nullptr;<br class="gmail_msg">
- LP.SEHHandlers.push_back(Handler);<br class="gmail_msg">
-}<br class="gmail_msg">
-<br class="gmail_msg">
-void MachineModuleInfo::TidyLandingPads(DenseMap<MCSymbol*, uintptr_t> *LPMap) {<br class="gmail_msg">
- for (unsigned i = 0; i != LandingPads.size(); ) {<br class="gmail_msg">
- LandingPadInfo &LandingPad = LandingPads[i];<br class="gmail_msg">
- if (LandingPad.LandingPadLabel &&<br class="gmail_msg">
- !LandingPad.LandingPadLabel->isDefined() &&<br class="gmail_msg">
- (!LPMap || (*LPMap)[LandingPad.LandingPadLabel] == 0))<br class="gmail_msg">
- LandingPad.LandingPadLabel = nullptr;<br class="gmail_msg">
-<br class="gmail_msg">
- // Special case: we *should* emit LPs with null LP MBB. This indicates<br class="gmail_msg">
- // "nounwind" case.<br class="gmail_msg">
- if (!LandingPad.LandingPadLabel && LandingPad.LandingPadBlock) {<br class="gmail_msg">
- LandingPads.erase(LandingPads.begin() + i);<br class="gmail_msg">
- continue;<br class="gmail_msg">
- }<br class="gmail_msg">
-<br class="gmail_msg">
- for (unsigned j = 0, e = LandingPads[i].BeginLabels.size(); j != e; ++j) {<br class="gmail_msg">
- MCSymbol *BeginLabel = LandingPad.BeginLabels[j];<br class="gmail_msg">
- MCSymbol *EndLabel = LandingPad.EndLabels[j];<br class="gmail_msg">
- if ((BeginLabel->isDefined() ||<br class="gmail_msg">
- (LPMap && (*LPMap)[BeginLabel] != 0)) &&<br class="gmail_msg">
- (EndLabel->isDefined() ||<br class="gmail_msg">
- (LPMap && (*LPMap)[EndLabel] != 0))) continue;<br class="gmail_msg">
-<br class="gmail_msg">
- LandingPad.BeginLabels.erase(LandingPad.BeginLabels.begin() + j);<br class="gmail_msg">
- LandingPad.EndLabels.erase(LandingPad.EndLabels.begin() + j);<br class="gmail_msg">
- --j;<br class="gmail_msg">
- --e;<br class="gmail_msg">
- }<br class="gmail_msg">
-<br class="gmail_msg">
- // Remove landing pads with no try-ranges.<br class="gmail_msg">
- if (LandingPads[i].BeginLabels.empty()) {<br class="gmail_msg">
- LandingPads.erase(LandingPads.begin() + i);<br class="gmail_msg">
- continue;<br class="gmail_msg">
- }<br class="gmail_msg">
-<br class="gmail_msg">
- // If there is no landing pad, ensure that the list of typeids is empty.<br class="gmail_msg">
- // If the only typeid is a cleanup, this is the same as having no typeids.<br class="gmail_msg">
- if (!LandingPad.LandingPadBlock ||<br class="gmail_msg">
- (LandingPad.TypeIds.size() == 1 && !LandingPad.TypeIds[0]))<br class="gmail_msg">
- LandingPad.TypeIds.clear();<br class="gmail_msg">
- ++i;<br class="gmail_msg">
- }<br class="gmail_msg">
-}<br class="gmail_msg">
-<br class="gmail_msg">
-void MachineModuleInfo::setCallSiteLandingPad(MCSymbol *Sym,<br class="gmail_msg">
- ArrayRef<unsigned> Sites) {<br class="gmail_msg">
- LPadToCallSiteMap[Sym].append(Sites.begin(), Sites.end());<br class="gmail_msg">
-}<br class="gmail_msg">
-<br class="gmail_msg">
-unsigned MachineModuleInfo::getTypeIDFor(const GlobalValue *TI) {<br class="gmail_msg">
- for (unsigned i = 0, N = TypeInfos.size(); i != N; ++i)<br class="gmail_msg">
- if (TypeInfos[i] == TI) return i + 1;<br class="gmail_msg">
-<br class="gmail_msg">
- TypeInfos.push_back(TI);<br class="gmail_msg">
- return TypeInfos.size();<br class="gmail_msg">
-}<br class="gmail_msg">
-<br class="gmail_msg">
-int MachineModuleInfo::getFilterIDFor(std::vector<unsigned> &TyIds) {<br class="gmail_msg">
- // If the new filter coincides with the tail of an existing filter, then<br class="gmail_msg">
- // re-use the existing filter. Folding filters more than this requires<br class="gmail_msg">
- // re-ordering filters and/or their elements - probably not worth it.<br class="gmail_msg">
- for (std::vector<unsigned>::iterator I = FilterEnds.begin(),<br class="gmail_msg">
- E = FilterEnds.end(); I != E; ++I) {<br class="gmail_msg">
- unsigned i = *I, j = TyIds.size();<br class="gmail_msg">
-<br class="gmail_msg">
- while (i && j)<br class="gmail_msg">
- if (FilterIds[--i] != TyIds[--j])<br class="gmail_msg">
- goto try_next;<br class="gmail_msg">
-<br class="gmail_msg">
- if (!j)<br class="gmail_msg">
- // The new filter coincides with range [i, end) of the existing filter.<br class="gmail_msg">
- return -(1 + i);<br class="gmail_msg">
-<br class="gmail_msg">
-try_next:;<br class="gmail_msg">
- }<br class="gmail_msg">
-<br class="gmail_msg">
- // Add the new filter.<br class="gmail_msg">
- int FilterID = -(1 + FilterIds.size());<br class="gmail_msg">
- FilterIds.reserve(FilterIds.size() + TyIds.size() + 1);<br class="gmail_msg">
- FilterIds.insert(FilterIds.end(), TyIds.begin(), TyIds.end());<br class="gmail_msg">
- FilterEnds.push_back(FilterIds.size());<br class="gmail_msg">
- FilterIds.push_back(0); // terminator<br class="gmail_msg">
- return FilterID;<br class="gmail_msg">
-}<br class="gmail_msg">
+/// \}<br class="gmail_msg">
<br class="gmail_msg">
MachineFunction &MachineModuleInfo::getMachineFunction(const Function &F) {<br class="gmail_msg">
// Shortcut for the common case where a sequence of MachineFunctionPasses<br class="gmail_msg">
@@ -502,33 +334,3 @@ void llvm::computeUsesVAFloatArgument(co<br class="gmail_msg">
}<br class="gmail_msg">
}<br class="gmail_msg">
}<br class="gmail_msg">
-<br class="gmail_msg">
-void llvm::addLandingPadInfo(const LandingPadInst &I, MachineModuleInfo &MMI,<br class="gmail_msg">
- MachineBasicBlock &MBB) {<br class="gmail_msg">
- if (const auto *PF = dyn_cast<Function>(<br class="gmail_msg">
- I.getParent()->getParent()->getPersonalityFn()->stripPointerCasts()))<br class="gmail_msg">
- MMI.addPersonality(PF);<br class="gmail_msg">
-<br class="gmail_msg">
- if (I.isCleanup())<br class="gmail_msg">
- MMI.addCleanup(&MBB);<br class="gmail_msg">
-<br class="gmail_msg">
- // FIXME: New EH - Add the clauses in reverse order. This isn't 100% correct,<br class="gmail_msg">
- // but we need to do it this way because of how the DWARF EH emitter<br class="gmail_msg">
- // processes the clauses.<br class="gmail_msg">
- for (unsigned i = I.getNumClauses(); i != 0; --i) {<br class="gmail_msg">
- Value *Val = I.getClause(i - 1);<br class="gmail_msg">
- if (I.isCatch(i - 1)) {<br class="gmail_msg">
- MMI.addCatchTypeInfo(&MBB,<br class="gmail_msg">
- dyn_cast<GlobalValue>(Val->stripPointerCasts()));<br class="gmail_msg">
- } else {<br class="gmail_msg">
- // Add filters in a list.<br class="gmail_msg">
- Constant *CVal = cast<Constant>(Val);<br class="gmail_msg">
- SmallVector<const GlobalValue *, 4> FilterList;<br class="gmail_msg">
- for (User::op_iterator II = CVal->op_begin(), IE = CVal->op_end();<br class="gmail_msg">
- II != IE; ++II)<br class="gmail_msg">
- FilterList.push_back(cast<GlobalValue>((*II)->stripPointerCasts()));<br class="gmail_msg">
-<br class="gmail_msg">
- MMI.addFilterTypeInfo(&MBB, FilterList);<br class="gmail_msg">
- }<br class="gmail_msg">
- }<br class="gmail_msg">
-}<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -261,7 +261,7 @@ void FunctionLoweringInfo::set(const Fun<br class="gmail_msg">
// FIXME: SEH catchpads do not create funclets, so we could avoid setting<br class="gmail_msg">
// this in such cases in order to improve frame layout.<br class="gmail_msg">
if (!isa<LandingPadInst>(I)) {<br class="gmail_msg">
- MMI.setHasEHFunclets(true);<br class="gmail_msg">
+ MF->setHasEHFunclets(true);<br class="gmail_msg">
MF->getFrameInfo().setHasOpaqueSPAdjustment(true);<br class="gmail_msg">
}<br class="gmail_msg">
if (isa<CatchSwitchInst>(I)) {<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -2293,8 +2293,7 @@ void SelectionDAGBuilder::visitLandingPa<br class="gmail_msg">
"Call to landingpad not in landing pad!");<br class="gmail_msg">
<br class="gmail_msg">
MachineBasicBlock *MBB = FuncInfo.MBB;<br class="gmail_msg">
- MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI();<br class="gmail_msg">
- addLandingPadInfo(LP, MMI, *MBB);<br class="gmail_msg">
+ addLandingPadInfo(LP, *MBB);<br class="gmail_msg">
<br class="gmail_msg">
// If there aren't registers to copy the values into (e.g., during SjLj<br class="gmail_msg">
// exceptions), then don't bother to create these DAG nodes.<br class="gmail_msg">
@@ -5027,7 +5026,7 @@ SelectionDAGBuilder::visitIntrinsicCall(<br class="gmail_msg">
case Intrinsic::eh_typeid_for: {<br class="gmail_msg">
// Find the type id for the given typeinfo.<br class="gmail_msg">
GlobalValue *GV = ExtractTypeInfo(I.getArgOperand(0));<br class="gmail_msg">
- unsigned TypeID = DAG.getMachineFunction().getMMI().getTypeIDFor(GV);<br class="gmail_msg">
+ unsigned TypeID = DAG.getMachineFunction().getTypeIDFor(GV);<br class="gmail_msg">
Res = DAG.getConstant(TypeID, sdl, MVT::i32);<br class="gmail_msg">
setValue(&I, Res);<br class="gmail_msg">
return nullptr;<br class="gmail_msg">
@@ -5035,7 +5034,7 @@ SelectionDAGBuilder::visitIntrinsicCall(<br class="gmail_msg">
<br class="gmail_msg">
case Intrinsic::eh_return_i32:<br class="gmail_msg">
case Intrinsic::eh_return_i64:<br class="gmail_msg">
- DAG.getMachineFunction().getMMI().setCallsEHReturn(true);<br class="gmail_msg">
+ DAG.getMachineFunction().setCallsEHReturn(true);<br class="gmail_msg">
DAG.setRoot(DAG.getNode(ISD::EH_RETURN, sdl,<br class="gmail_msg">
MVT::Other,<br class="gmail_msg">
getControlRoot(),<br class="gmail_msg">
@@ -5043,7 +5042,7 @@ SelectionDAGBuilder::visitIntrinsicCall(<br class="gmail_msg">
getValue(I.getArgOperand(1))));<br class="gmail_msg">
return nullptr;<br class="gmail_msg">
case Intrinsic::eh_unwind_init:<br class="gmail_msg">
- DAG.getMachineFunction().getMMI().setCallsUnwindInit(true);<br class="gmail_msg">
+ DAG.getMachineFunction().setCallsUnwindInit(true);<br class="gmail_msg">
return nullptr;<br class="gmail_msg">
case Intrinsic::eh_dwarf_cfa: {<br class="gmail_msg">
setValue(&I, DAG.getNode(ISD::EH_DWARF_CFA, sdl,<br class="gmail_msg">
@@ -5741,7 +5740,8 @@ SelectionDAGBuilder::visitIntrinsicCall(<br class="gmail_msg">
std::pair<SDValue, SDValue><br class="gmail_msg">
SelectionDAGBuilder::lowerInvokable(TargetLowering::CallLoweringInfo &CLI,<br class="gmail_msg">
const BasicBlock *EHPadBB) {<br class="gmail_msg">
- MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI();<br class="gmail_msg">
+ MachineFunction &MF = DAG.getMachineFunction();<br class="gmail_msg">
+ MachineModuleInfo &MMI = MF.getMMI();<br class="gmail_msg">
MCSymbol *BeginLabel = nullptr;<br class="gmail_msg">
<br class="gmail_msg">
if (EHPadBB) {<br class="gmail_msg">
@@ -5753,7 +5753,7 @@ SelectionDAGBuilder::lowerInvokable(Targ<br class="gmail_msg">
// so as to maintain the ordering of pads in the LSDA.<br class="gmail_msg">
unsigned CallSiteIndex = MMI.getCurrentCallSite();<br class="gmail_msg">
if (CallSiteIndex) {<br class="gmail_msg">
- MMI.setCallSiteBeginLabel(BeginLabel, CallSiteIndex);<br class="gmail_msg">
+ MF.setCallSiteBeginLabel(BeginLabel, CallSiteIndex);<br class="gmail_msg">
LPadToCallSiteMap[FuncInfo.MBBMap[EHPadBB]].push_back(CallSiteIndex);<br class="gmail_msg">
<br class="gmail_msg">
// Now that the call site is handled, stop tracking it.<br class="gmail_msg">
@@ -5794,13 +5794,13 @@ SelectionDAGBuilder::lowerInvokable(Targ<br class="gmail_msg">
DAG.setRoot(DAG.getEHLabel(getCurSDLoc(), getRoot(), EndLabel));<br class="gmail_msg">
<br class="gmail_msg">
// Inform MachineModuleInfo of range.<br class="gmail_msg">
- if (MMI.hasEHFunclets()) {<br class="gmail_msg">
+ if (MF.hasEHFunclets()) {<br class="gmail_msg">
assert(CLI.CS);<br class="gmail_msg">
WinEHFuncInfo *EHInfo = DAG.getMachineFunction().getWinEHFuncInfo();<br class="gmail_msg">
EHInfo->addIPToStateRange(cast<InvokeInst>(CLI.CS->getInstruction()),<br class="gmail_msg">
BeginLabel, EndLabel);<br class="gmail_msg">
} else {<br class="gmail_msg">
- MMI.addInvoke(FuncInfo.MBBMap[EHPadBB], BeginLabel, EndLabel);<br class="gmail_msg">
+ MF.addInvoke(FuncInfo.MBBMap[EHPadBB], BeginLabel, EndLabel);<br class="gmail_msg">
}<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -1014,10 +1014,10 @@ bool SelectionDAGISel::PrepareEHLandingP<br class="gmail_msg">
<br class="gmail_msg">
// Add a label to mark the beginning of the landing pad. Deletion of the<br class="gmail_msg">
// landing pad can thus be detected via the MachineModuleInfo.<br class="gmail_msg">
- MCSymbol *Label = MF->getMMI().addLandingPad(MBB);<br class="gmail_msg">
+ MCSymbol *Label = MF->addLandingPad(MBB);<br class="gmail_msg">
<br class="gmail_msg">
// Assign the call site to the landing pad's begin label.<br class="gmail_msg">
- MF->getMMI().setCallSiteLandingPad(Label, SDB->LPadToCallSiteMap[MBB]);<br class="gmail_msg">
+ MF->setCallSiteLandingPad(Label, SDB->LPadToCallSiteMap[MBB]);<br class="gmail_msg">
<br class="gmail_msg">
const MCInstrDesc &II = TII->get(TargetOpcode::EH_LABEL);<br class="gmail_msg">
BuildMI(*MBB, FuncInfo->InsertPt, SDB->getCurDebugLoc(), II)<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/CodeGen/TargetFrameLoweringImpl.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetFrameLoweringImpl.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetFrameLoweringImpl.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/CodeGen/TargetFrameLoweringImpl.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/CodeGen/TargetFrameLoweringImpl.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -84,7 +84,7 @@ void TargetFrameLowering::determineCalle<br class="gmail_msg">
return;<br class="gmail_msg">
<br class="gmail_msg">
// Functions which call __builtin_unwind_init get all their registers saved.<br class="gmail_msg">
- bool CallsUnwindInit = MF.getMMI().callsUnwindInit();<br class="gmail_msg">
+ bool CallsUnwindInit = MF.callsUnwindInit();<br class="gmail_msg">
const MachineRegisterInfo &MRI = MF.getRegInfo();<br class="gmail_msg">
for (unsigned i = 0; CSRegs[i]; ++i) {<br class="gmail_msg">
unsigned Reg = CSRegs[i];<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -7867,7 +7867,6 @@ void ARMTargetLowering::EmitSjLjDispatch<br class="gmail_msg">
// associated with.<br class="gmail_msg">
DenseMap<unsigned, SmallVector<MachineBasicBlock*, 2> > CallSiteNumToLPad;<br class="gmail_msg">
unsigned MaxCSNum = 0;<br class="gmail_msg">
- MachineModuleInfo &MMI = MF->getMMI();<br class="gmail_msg">
for (MachineFunction::iterator BB = MF->begin(), E = MF->end(); BB != E;<br class="gmail_msg">
++BB) {<br class="gmail_msg">
if (!BB->isEHPad()) continue;<br class="gmail_msg">
@@ -7879,9 +7878,9 @@ void ARMTargetLowering::EmitSjLjDispatch<br class="gmail_msg">
if (!II->isEHLabel()) continue;<br class="gmail_msg">
<br class="gmail_msg">
MCSymbol *Sym = II->getOperand(0).getMCSymbol();<br class="gmail_msg">
- if (!MMI.hasCallSiteLandingPad(Sym)) continue;<br class="gmail_msg">
+ if (!MF->hasCallSiteLandingPad(Sym)) continue;<br class="gmail_msg">
<br class="gmail_msg">
- SmallVectorImpl<unsigned> &CallSiteIdxs = MMI.getCallSiteLandingPad(Sym);<br class="gmail_msg">
+ SmallVectorImpl<unsigned> &CallSiteIdxs = MF->getCallSiteLandingPad(Sym);<br class="gmail_msg">
for (SmallVectorImpl<unsigned>::iterator<br class="gmail_msg">
CSI = CallSiteIdxs.begin(), CSE = CallSiteIdxs.end();<br class="gmail_msg">
CSI != CSE; ++CSI) {<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/Target/SystemZ/SystemZFrameLowering.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZFrameLowering.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZFrameLowering.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/Target/SystemZ/SystemZFrameLowering.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/Target/SystemZ/SystemZFrameLowering.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -82,7 +82,7 @@ void SystemZFrameLowering::determineCall<br class="gmail_msg">
SavedRegs.set(SystemZ::ArgGPRs[I]);<br class="gmail_msg">
<br class="gmail_msg">
// If there are any landing pads, entering them will modify r6/r7.<br class="gmail_msg">
- if (!MF.getMMI().getLandingPads().empty()) {<br class="gmail_msg">
+ if (!MF.getLandingPads().empty()) {<br class="gmail_msg">
SavedRegs.set(SystemZ::R6D);<br class="gmail_msg">
SavedRegs.set(SystemZ::R7D);<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/Target/X86/X86CallFrameOptimization.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallFrameOptimization.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallFrameOptimization.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/Target/X86/X86CallFrameOptimization.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/Target/X86/X86CallFrameOptimization.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -129,7 +129,7 @@ bool X86CallFrameOptimization::isLegal(M<br class="gmail_msg">
// in the compact unwind encoding that Darwin uses. So, bail if there<br class="gmail_msg">
// is a danger of that being generated.<br class="gmail_msg">
if (STI->isTargetDarwin() &&<br class="gmail_msg">
- (!MF.getMMI().getLandingPads().empty() ||<br class="gmail_msg">
+ (!MF.getLandingPads().empty() ||<br class="gmail_msg">
(MF.getFunction()->needsUnwindTableEntry() && !TFL->hasFP(MF))))<br class="gmail_msg">
return false;<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/Target/X86/X86FrameLowering.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -83,14 +83,12 @@ X86FrameLowering::needsFrameIndexResolut<br class="gmail_msg">
/// or if frame pointer elimination is disabled.<br class="gmail_msg">
bool X86FrameLowering::hasFP(const MachineFunction &MF) const {<br class="gmail_msg">
const MachineFrameInfo &MFI = MF.getFrameInfo();<br class="gmail_msg">
- const MachineModuleInfo &MMI = MF.getMMI();<br class="gmail_msg">
-<br class="gmail_msg">
return (MF.getTarget().Options.DisableFramePointerElim(MF) ||<br class="gmail_msg">
TRI->needsStackRealignment(MF) ||<br class="gmail_msg">
MFI.hasVarSizedObjects() ||<br class="gmail_msg">
MFI.isFrameAddressTaken() || MFI.hasOpaqueSPAdjustment() ||<br class="gmail_msg">
MF.getInfo<X86MachineFunctionInfo>()->getForceFramePointer() ||<br class="gmail_msg">
- MMI.callsUnwindInit() || MMI.hasEHFunclets() || MMI.callsEHReturn() ||<br class="gmail_msg">
+ MF.callsUnwindInit() || MF.hasEHFunclets() || MF.callsEHReturn() ||<br class="gmail_msg">
MFI.hasStackMap() || MFI.hasPatchPoint() ||<br class="gmail_msg">
MFI.hasCopyImplyingStackAdjustment());<br class="gmail_msg">
}<br class="gmail_msg">
@@ -151,7 +149,7 @@ static unsigned findDeadCallerSavedReg(M<br class="gmail_msg">
bool Is64Bit) {<br class="gmail_msg">
const MachineFunction *MF = MBB.getParent();<br class="gmail_msg">
const Function *F = MF->getFunction();<br class="gmail_msg">
- if (!F || MF->getMMI().callsEHReturn())<br class="gmail_msg">
+ if (!F || MF->callsEHReturn())<br class="gmail_msg">
return 0;<br class="gmail_msg">
<br class="gmail_msg">
const TargetRegisterClass &AvailableRegs = *TRI->getGPRsForTailCall(*MF);<br class="gmail_msg">
@@ -919,7 +917,7 @@ void X86FrameLowering::emitPrologue(Mach<br class="gmail_msg">
if (Fn->hasPersonalityFn())<br class="gmail_msg">
Personality = classifyEHPersonality(Fn->getPersonalityFn());<br class="gmail_msg">
bool FnHasClrFunclet =<br class="gmail_msg">
- MMI.hasEHFunclets() && Personality == EHPersonality::CoreCLR;<br class="gmail_msg">
+ MF.hasEHFunclets() && Personality == EHPersonality::CoreCLR;<br class="gmail_msg">
bool IsClrFunclet = IsFunclet && FnHasClrFunclet;<br class="gmail_msg">
bool HasFP = hasFP(MF);<br class="gmail_msg">
bool IsWin64CC = STI.isCallingConvWin64(Fn->getCallingConv());<br class="gmail_msg">
@@ -2040,7 +2038,7 @@ void X86FrameLowering::determineCalleeSa<br class="gmail_msg">
SavedRegs.set(TRI->getBaseRegister());<br class="gmail_msg">
<br class="gmail_msg">
// Allocate a spill slot for EBP if we have a base pointer and EH funclets.<br class="gmail_msg">
- if (MF.getMMI().hasEHFunclets()) {<br class="gmail_msg">
+ if (MF.hasEHFunclets()) {<br class="gmail_msg">
int FI = MFI.CreateSpillStackObject(SlotSize, SlotSize);<br class="gmail_msg">
X86FI->setHasSEHFramePtrSave(true);<br class="gmail_msg">
X86FI->setSEHFramePtrSaveIndex(FI);<br class="gmail_msg">
@@ -2610,8 +2608,7 @@ eliminateCallFramePseudoInstr(MachineFun<br class="gmail_msg">
// GNU_ARGS_SIZE.<br class="gmail_msg">
// TODO: We don't need to reset this between subsequent functions,<br class="gmail_msg">
// if it didn't change.<br class="gmail_msg">
- bool HasDwarfEHHandlers = !WindowsCFI &&<br class="gmail_msg">
- !MF.getMMI().getLandingPads().empty();<br class="gmail_msg">
+ bool HasDwarfEHHandlers = !WindowsCFI && !MF.getLandingPads().empty();<br class="gmail_msg">
<br class="gmail_msg">
if (HasDwarfEHHandlers && !isDestroy &&<br class="gmail_msg">
MF.getInfo<X86MachineFunctionInfo>()->getHasPushSequences())<br class="gmail_msg">
@@ -2949,7 +2946,7 @@ void X86FrameLowering::processFunctionBe<br class="gmail_msg">
// If this function isn't doing Win64-style C++ EH, we don't need to do<br class="gmail_msg">
// anything.<br class="gmail_msg">
const Function *Fn = MF.getFunction();<br class="gmail_msg">
- if (!STI.is64Bit() || !MF.getMMI().hasEHFunclets() ||<br class="gmail_msg">
+ if (!STI.is64Bit() || !MF.hasEHFunclets() ||<br class="gmail_msg">
classifyEHPersonality(Fn->getPersonalityFn()) != EHPersonality::MSVC_CXX)<br class="gmail_msg">
return;<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -24980,7 +24980,6 @@ X86TargetLowering::EmitSjLjDispatchBlock<br class="gmail_msg">
MachineBasicBlock *BB) const {<br class="gmail_msg">
DebugLoc DL = MI.getDebugLoc();<br class="gmail_msg">
MachineFunction *MF = BB->getParent();<br class="gmail_msg">
- MachineModuleInfo *MMI = &MF->getMMI();<br class="gmail_msg">
MachineFrameInfo &MFI = MF->getFrameInfo();<br class="gmail_msg">
MachineRegisterInfo *MRI = &MF->getRegInfo();<br class="gmail_msg">
const TargetInstrInfo *TII = Subtarget.getInstrInfo();<br class="gmail_msg">
@@ -25004,10 +25003,10 @@ X86TargetLowering::EmitSjLjDispatchBlock<br class="gmail_msg">
break;<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
- if (!MMI->hasCallSiteLandingPad(Sym))<br class="gmail_msg">
+ if (!MF->hasCallSiteLandingPad(Sym))<br class="gmail_msg">
continue;<br class="gmail_msg">
<br class="gmail_msg">
- for (unsigned CSI : MMI->getCallSiteLandingPad(Sym)) {<br class="gmail_msg">
+ for (unsigned CSI : MF->getCallSiteLandingPad(Sym)) {<br class="gmail_msg">
CallSiteNumToLPad[CSI].push_back(&MBB);<br class="gmail_msg">
MaxCSNum = std::max(MaxCSNum, CSI);<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -270,7 +270,7 @@ X86RegisterInfo::getCalleeSavedRegs(cons<br class="gmail_msg">
bool HasSSE = Subtarget.hasSSE1();<br class="gmail_msg">
bool HasAVX = Subtarget.hasAVX();<br class="gmail_msg">
bool HasAVX512 = Subtarget.hasAVX512();<br class="gmail_msg">
- bool CallsEHReturn = MF->getMMI().callsEHReturn();<br class="gmail_msg">
+ bool CallsEHReturn = MF->callsEHReturn();<br class="gmail_msg">
<br class="gmail_msg">
switch (MF->getFunction()->getCallingConv()) {<br class="gmail_msg">
case CallingConv::GHC:<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp?rev=288293&r1=288292&r2=288293&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp?rev=288293&r1=288292&r2=288293&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/Target/XCore/XCoreFrameLowering.cpp Wed Nov 30 17:49:01 2016<br class="gmail_msg">
@@ -548,7 +548,7 @@ void XCoreFrameLowering::determineCallee<br class="gmail_msg">
// We force the LR to be saved so these instructions are used.<br class="gmail_msg">
LRUsed = true;<br class="gmail_msg">
<br class="gmail_msg">
- if (MF.getMMI().callsUnwindInit() || MF.getMMI().callsEHReturn()) {<br class="gmail_msg">
+ if (MF.callsUnwindInit() || MF.callsEHReturn()) {<br class="gmail_msg">
// The unwinder expects to find spill slots for the exception info regs R0<br class="gmail_msg">
// & R1. These are used during llvm.eh.return() to 'restore' the exception<br class="gmail_msg">
// info. N.B. we do not spill or restore R0, R1 during normal operation.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
llvm-commits mailing list<br class="gmail_msg">
<a href="mailto:llvm-commits@lists.llvm.org" class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class="gmail_msg">
</blockquote></div>