From ceb7d2f4f8bb220990b9392f4dcf1eff7fd5690c Mon Sep 17 00:00:00 2001 From: "Vikram S. Adve" Date: Tue, 29 Jul 2003 19:41:23 +0000 Subject: [PATCH] Moved insertCallerSavingCode() to PhyRegAlloc and moved isRegVolatile and modifiedByCall here: they are all machine independent. Remove all uses of PhyRegAlloc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7387 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Target/TargetRegInfo.h | 41 ++++++++++++++++------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/include/llvm/Target/TargetRegInfo.h b/include/llvm/Target/TargetRegInfo.h index 76e1daf2220..44ba3e06f2d 100644 --- a/include/llvm/Target/TargetRegInfo.h +++ b/include/llvm/Target/TargetRegInfo.h @@ -21,7 +21,6 @@ class Function; class LiveRange; class AddedInstrns; class MachineInstr; -class PhyRegAlloc; class BasicBlock; ///---------------------------------------------------------------------------- @@ -75,9 +74,12 @@ public: virtual void colorIGNode(IGNode *Node, const std::vector &IsColorUsedArr) const = 0; + // Check whether a specific register is volatile, i.e., whether it is not + // preserved across calls virtual bool isRegVolatile(int Reg) const = 0; - // If any specific register needs extra information + // Check whether a specific register is modified as a side-effect of the + // call instruction itself, virtual bool modifiedByCall(int Reg) const {return false; } virtual const char* const getRegName(unsigned reg) const = 0; @@ -151,27 +153,18 @@ public: // as required. See SparcRegInfo.cpp for the implementation for Sparc. // virtual void suggestRegs4MethodArgs(const Function *Func, - LiveRangeInfo &LRI) const = 0; + LiveRangeInfo& LRI) const = 0; virtual void suggestRegs4CallArgs(MachineInstr *CallI, - LiveRangeInfo &LRI) const = 0; + LiveRangeInfo& LRI) const = 0; virtual void suggestReg4RetValue(MachineInstr *RetI, - LiveRangeInfo &LRI) const = 0; + LiveRangeInfo& LRI) const = 0; - virtual void colorMethodArgs(const Function *Func, LiveRangeInfo &LRI, - AddedInstrns *FirstAI) const = 0; - - // Method for inserting caller saving code. The caller must save all the - // volatile registers across a call based on the calling conventions of - // an architecture. This must insert code for saving and restoring - // such registers on - // - virtual void insertCallerSavingCode(std::vector& instrnsBefore, - std::vector& instrnsAfter, - MachineInstr *CallMI, - const BasicBlock *BB, - PhyRegAlloc &PRA) const = 0; + virtual void colorMethodArgs(const Function *Func, + LiveRangeInfo &LRI, + std::vector& InstrnsBefore, + std::vector& InstrnsAfter) const = 0; // The following methods are used to generate "copy" machine instructions // for an architecture. Currently they are used in TargetRegClass @@ -204,7 +197,17 @@ public: virtual void cpValue2Value(Value *Src, Value *Dest, std::vector& mvec) const = 0; - virtual bool isRegVolatile(int RegClassID, int Reg) const = 0; + // Check whether a specific register is volatile, i.e., whether it is not + // preserved across calls + inline virtual bool isRegVolatile(int RegClassID, int Reg) const { + return MachineRegClassArr[RegClassID]->isRegVolatile(Reg); + } + + // Check whether a specific register is modified as a side-effect of the + // call instruction itself, + inline virtual bool modifiedByCall(int RegClassID, int Reg) const { + return MachineRegClassArr[RegClassID]->modifiedByCall(Reg); + } // Returns the reg used for pushing the address when a method is called. // This can be used for other purposes between calls