aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/MachineFunction.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/CodeGen/MachineFunction.h')
-rw-r--r--include/llvm/CodeGen/MachineFunction.h61
1 files changed, 43 insertions, 18 deletions
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h
index 201c126ee52e..3a3176e51c51 100644
--- a/include/llvm/CodeGen/MachineFunction.h
+++ b/include/llvm/CodeGen/MachineFunction.h
@@ -36,6 +36,7 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Recycler.h"
+#include "llvm/Target/TargetMachine.h"
#include <cassert>
#include <cstdint>
#include <memory>
@@ -277,7 +278,7 @@ class MachineFunction {
unsigned FunctionNumber;
/// Alignment - The alignment of the function.
- unsigned Alignment;
+ Align Alignment;
/// ExposesReturnsTwice - True if the function calls setjmp or related
/// functions with attribute "returns twice", but doesn't have
@@ -322,7 +323,7 @@ class MachineFunction {
std::vector<std::pair<MCSymbol *, MDNode *>> CodeViewAnnotations;
/// CodeView heapallocsites.
- std::vector<std::tuple<MCSymbol*, MCSymbol*, DIType*>>
+ std::vector<std::tuple<MCSymbol *, MCSymbol *, const DIType *>>
CodeViewHeapAllocSites;
bool CallsEHReturn = false;
@@ -400,6 +401,17 @@ private:
/// Map a call instruction to call site arguments forwarding info.
CallSiteInfoMap CallSitesInfo;
+ /// A helper function that returns call site info for a give call
+ /// instruction if debug entry value support is enabled.
+ CallSiteInfoMap::iterator getCallSiteInfo(const MachineInstr *MI) {
+ assert(MI->isCall() &&
+ "Call site info refers only to call instructions!");
+
+ if (!Target.Options.EnableDebugEntryValues)
+ return CallSitesInfo.end();
+ return CallSitesInfo.find(MI);
+ }
+
// Callbacks for insertion and removal.
void handleInsertion(MachineInstr &MI);
void handleRemoval(MachineInstr &MI);
@@ -508,15 +520,16 @@ public:
const WinEHFuncInfo *getWinEHFuncInfo() const { return WinEHInfo; }
WinEHFuncInfo *getWinEHFuncInfo() { return WinEHInfo; }
- /// getAlignment - Return the alignment (log2, not bytes) of the function.
- unsigned getAlignment() const { return Alignment; }
+ /// getAlignment - Return the alignment of the function.
+ Align getAlignment() const { return Alignment; }
- /// setAlignment - Set the alignment (log2, not bytes) of the function.
- void setAlignment(unsigned A) { Alignment = A; }
+ /// setAlignment - Set the alignment of the function.
+ void setAlignment(Align A) { Alignment = A; }
- /// ensureAlignment - Make sure the function is at least 1 << A bytes aligned.
- void ensureAlignment(unsigned A) {
- if (Alignment < A) Alignment = A;
+ /// ensureAlignment - Make sure the function is at least A bytes aligned.
+ void ensureAlignment(Align A) {
+ if (Alignment < A)
+ Alignment = A;
}
/// exposesReturnsTwice - Returns true if the function calls setjmp or
@@ -935,10 +948,10 @@ public:
}
/// Record heapallocsites
- void addCodeViewHeapAllocSite(MachineInstr *I, MDNode *MD);
+ void addCodeViewHeapAllocSite(MachineInstr *I, const MDNode *MD);
- ArrayRef<std::tuple<MCSymbol*, MCSymbol*, DIType*>>
- getCodeViewHeapAllocSites() const {
+ ArrayRef<std::tuple<MCSymbol *, MCSymbol *, const DIType *>>
+ getCodeViewHeapAllocSites() const {
return CodeViewHeapAllocSites;
}
@@ -976,12 +989,24 @@ public:
return CallSitesInfo;
}
- /// Update call sites info by deleting entry for \p Old call instruction.
- /// If \p New is present then transfer \p Old call info to it. This function
- /// should be called before removing call instruction or before replacing
- /// call instruction with new one.
- void updateCallSiteInfo(const MachineInstr *Old,
- const MachineInstr *New = nullptr);
+ /// Following functions update call site info. They should be called before
+ /// removing, replacing or copying call instruction.
+
+ /// Move the call site info from \p Old to \New call site info. This function
+ /// is used when we are replacing one call instruction with another one to
+ /// the same callee.
+ void moveCallSiteInfo(const MachineInstr *Old,
+ const MachineInstr *New);
+
+ /// Erase the call site info for \p MI. It is used to remove a call
+ /// instruction from the instruction stream.
+ void eraseCallSiteInfo(const MachineInstr *MI);
+
+ /// Copy the call site info from \p Old to \ New. Its usage is when we are
+ /// making a copy of the instruction that will be inserted at different point
+ /// of the instruction stream.
+ void copyCallSiteInfo(const MachineInstr *Old,
+ const MachineInstr *New);
};
//===--------------------------------------------------------------------===//