RegisterInfo now supports handing out caller- and callee-save registers, as

well as building a map from a physical register to its register class.

llvm-svn: 4896
This commit is contained in:
Misha Brukman 2002-12-03 23:09:53 +00:00
parent 64261741c7
commit 9e4163539f
1 changed files with 17 additions and 0 deletions

View File

@ -10,6 +10,7 @@
#define LLVM_TARGET_MREGISTERINFO_H #define LLVM_TARGET_MREGISTERINFO_H
#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineBasicBlock.h"
#include <map>
#include <assert.h> #include <assert.h>
class Type; class Type;
@ -60,6 +61,15 @@ public:
virtual unsigned getDataSize() const { return 0; } virtual unsigned getDataSize() const { return 0; }
virtual void
buildReg2RegClassMap(std::map<unsigned,const TargetRegisterClass*>&
Reg2RegClassMap) const
{
for (unsigned i=0; i < getNumRegs(); ++i) {
Reg2RegClassMap[getRegister(i)] = this;
}
}
//const std::vector<unsigned> &getRegsInClass(void) { return Regs; } //const std::vector<unsigned> &getRegsInClass(void) { return Regs; }
//void getAliases(void); //void getAliases(void);
}; };
@ -119,6 +129,9 @@ public:
unsigned DestReg, unsigned SrcReg, unsigned DestReg, unsigned SrcReg,
unsigned ImmOffset, unsigned dataSize) const = 0; unsigned ImmOffset, unsigned dataSize) const = 0;
virtual const unsigned* getCalleeSaveRegs() const = 0;
virtual const unsigned* getCallerSaveRegs() const = 0;
virtual unsigned getFramePointer() const = 0; virtual unsigned getFramePointer() const = 0;
virtual unsigned getStackPointer() const = 0; virtual unsigned getStackPointer() const = 0;
@ -130,6 +143,10 @@ public:
virtual unsigned getNumRegClasses() const = 0; virtual unsigned getNumRegClasses() const = 0;
virtual const TargetRegisterClass* getRegClassForType(const Type* Ty) const=0; virtual const TargetRegisterClass* getRegClassForType(const Type* Ty) const=0;
virtual void
buildReg2RegClassMap(std::map<unsigned,const TargetRegisterClass*>&
Reg2RegClassMap) const=0;
}; };
#endif #endif