diff options
author | Anand Shukla <ashukla@cs.uiuc.edu> | 2003-07-20 15:39:30 +0000 |
---|---|---|
committer | Anand Shukla <ashukla@cs.uiuc.edu> | 2003-07-20 15:39:30 +0000 |
commit | 6da69e75ec594afe6758d923ff011b59c2e82dee (patch) | |
tree | 9b25ebf7c0a3497dba6ff737090c735367f7c808 | |
parent | fcf2be75ec61c6ae3da53d0e4e9f53b4d754dc9b (diff) |
Added special consideration for instrumentation strategy
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7208 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Target/TargetRegInfo.h | 3 | ||||
-rw-r--r-- | lib/Target/SparcV9/SparcV9Internals.h | 4 | ||||
-rw-r--r-- | lib/Target/SparcV9/SparcV9RegClassInfo.h | 6 | ||||
-rw-r--r-- | lib/Target/SparcV9/SparcV9RegInfo.cpp | 14 |
4 files changed, 27 insertions, 0 deletions
diff --git a/include/llvm/Target/TargetRegInfo.h b/include/llvm/Target/TargetRegInfo.h index fc3b52b59b..e5b1355ac4 100644 --- a/include/llvm/Target/TargetRegInfo.h +++ b/include/llvm/Target/TargetRegInfo.h @@ -44,6 +44,9 @@ public: std::vector<bool> &IsColorUsedArr) const = 0; virtual bool isRegVolatile(int Reg) const = 0; + //If any specific register needs extra information + virtual bool modifiedByCall(int Reg) const {return false; } + virtual const char* const getRegName(unsigned reg) const = 0; TargetRegClassInfo(unsigned ID, unsigned NVR, unsigned NAR) diff --git a/lib/Target/SparcV9/SparcV9Internals.h b/lib/Target/SparcV9/SparcV9Internals.h index 47885a4f57..2cd54b2c00 100644 --- a/lib/Target/SparcV9/SparcV9Internals.h +++ b/lib/Target/SparcV9/SparcV9Internals.h @@ -447,6 +447,10 @@ public: return MachineRegClassArr[RegClassID]->isRegVolatile(Reg); } + inline bool modifiedByCall(int RegClassID, int Reg) const { + return MachineRegClassArr[RegClassID]->modifiedByCall(Reg); + } + // Get the register type for a register identified different ways. int getRegType(const Type* type) const; int getRegType(const LiveRange *LR) const; diff --git a/lib/Target/SparcV9/SparcV9RegClassInfo.h b/lib/Target/SparcV9/SparcV9RegClassInfo.h index 50cccb6621..38b81b3798 100644 --- a/lib/Target/SparcV9/SparcV9RegClassInfo.h +++ b/lib/Target/SparcV9/SparcV9RegClassInfo.h @@ -25,6 +25,10 @@ struct SparcIntRegClass : public TargetRegClassInfo { return (Reg < (int)StartOfNonVolatileRegs); } + inline bool modifiedByCall(int Reg) const { + return Reg==(int)ModifiedByCall; + } + enum { // colors possible for a LR (in preferred order) // --- following colors are volatile across function calls // %g0 can't be used for coloring - always 0 @@ -61,6 +65,8 @@ struct SparcIntRegClass : public TargetRegClassInfo { StartOfNonVolatileRegs = l0, StartOfAllRegs = o0, + + ModifiedByCall = o7, }; const char * const getRegName(unsigned reg) const; diff --git a/lib/Target/SparcV9/SparcV9RegInfo.cpp b/lib/Target/SparcV9/SparcV9RegInfo.cpp index e1eb148f02..42b9d10b59 100644 --- a/lib/Target/SparcV9/SparcV9RegInfo.cpp +++ b/lib/Target/SparcV9/SparcV9RegInfo.cpp @@ -1182,6 +1182,15 @@ UltraSparcRegInfo::insertCallerSavingCode CallArgsDescriptor* argDesc = CallArgsDescriptor::get(CallMI); + //if the call is to a instrumentation function, do not + //insert save and restore instructions + //the instrumentation function takes care of + //save restore for volatile regs + bool isLLVMFirstTrigger = false; + const Function *calledFunction = argDesc->getCallInst()->getCalledFunction(); + if(calledFunction && calledFunction->getName() == "llvm_first_trigger") + isLLVMFirstTrigger = true; + // Now check if the call has a return value (using argDesc) and if so, // find the LR of the TmpInstruction representing the return value register. // (using the last or second-last *implicit operand* of the call MI). @@ -1228,6 +1237,11 @@ UltraSparcRegInfo::insertCallerSavingCode if ( isRegVolatile(RCID, Color) ) { + //if the function is special LLVM function, + //And the register is not modified by call, don't save and restore + if(isLLVMFirstTrigger && !modifiedByCall(RCID, Color)) + continue; + // if the value is in both LV sets (i.e., live before and after // the call machine instruction) |