summaryrefslogtreecommitdiff
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.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h
index 57c946c789..f30cb821c1 100644
--- a/include/llvm/CodeGen/MachineFunction.h
+++ b/include/llvm/CodeGen/MachineFunction.h
@@ -18,6 +18,7 @@
#ifndef LLVM_CODEGEN_MACHINEFUNCTION_H
#define LLVM_CODEGEN_MACHINEFUNCTION_H
+#include <map>
#include "llvm/ADT/ilist.h"
#include "llvm/Support/DebugLoc.h"
#include "llvm/CodeGen/Dump.h"
@@ -114,6 +115,15 @@ class MachineFunction {
// The alignment of the function.
unsigned Alignment;
+ // The currently active call_site value
+ unsigned CallSiteIndex;
+
+ // The largest call_site value encountered
+ unsigned MaxCallSiteIndex;
+
+ // Call sites mapped to corresponding landing pads
+ std::map<MachineBasicBlock*, unsigned> LandingPadCallSiteIndexMap;
+
public:
MachineFunction(Function *Fn, const TargetMachine &TM);
~MachineFunction();
@@ -159,6 +169,41 @@ public:
///
void setAlignment(unsigned A) { Alignment = A; }
+ /// getCallSiteIndex() - Get the current call site index
+ ///
+ unsigned getCallSiteIndex() { return CallSiteIndex; }
+
+ /// setCallSiteIndex() - Set the current call site index
+ ///
+ void setCallSiteIndex(unsigned Idx) {
+ CallSiteIndex = Idx;
+ if (CallSiteIndex > MaxCallSiteIndex)
+ MaxCallSiteIndex = CallSiteIndex;
+ }
+
+ /// getMaxCallSiteIndex() - Get the largest call site index issued
+ ///
+ unsigned getMaxCallSiteIndex() { return MaxCallSiteIndex; }
+
+ /// setCallSiteIndexLandingPad() - Map the call site to a landing pad
+ ///
+ void setLandingPadCallSiteIndex(MachineBasicBlock *LandingPad,
+ unsigned CallSite) {
+ LandingPadCallSiteIndexMap[LandingPad] = CallSite;
+ }
+
+ /// getCallSiteIndexLandingPad() - Get landing pad for the call site index
+ ///
+ unsigned getLandingPadCallSiteIndex(MachineBasicBlock *LandingPad) {
+ return LandingPadCallSiteIndexMap[LandingPad];
+ }
+
+ /// getCallSiteCount() - Get the count of call site entries
+ ///
+ unsigned getCallSiteCount() {
+ return LandingPadCallSiteIndexMap.size();
+ }
+
/// MachineFunctionInfo - Keep track of various per-function pieces of
/// information for backends that would like to do so.
///