diff options
author | Chris Lattner <sabre@nondot.org> | 2006-06-17 00:01:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-06-17 00:01:04 +0000 |
commit | 49cadab3855b64a5116581efec6a53d027e932e8 (patch) | |
tree | 27a654ff5e8b2576ed696cddb1bd8f109ae7aef3 | |
parent | 8dd21436db06b73f9aa482cf246c2560d2d40f49 (diff) | |
download | bcm5719-llvm-49cadab3855b64a5116581efec6a53d027e932e8.tar.gz bcm5719-llvm-49cadab3855b64a5116581efec6a53d027e932e8.zip |
Implement the getPointerRegClass method, which is required for the ptr_rc
magic to work.
llvm-svn: 28847
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCInstrInfo.cpp | 16 | ||||
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCInstrInfo.h | 8 | ||||
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | 2 |
3 files changed, 20 insertions, 6 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp index d71f357990f..9390442b4d2 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -13,13 +13,23 @@ #include "PPCInstrInfo.h" #include "PPCGenInstrInfo.inc" -#include "PPC.h" +#include "PPCTargetMachine.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include <iostream> using namespace llvm; -PPCInstrInfo::PPCInstrInfo() - : TargetInstrInfo(PPCInsts, sizeof(PPCInsts)/sizeof(PPCInsts[0])) {} +PPCInstrInfo::PPCInstrInfo(PPCTargetMachine &tm) + : TargetInstrInfo(PPCInsts, sizeof(PPCInsts)/sizeof(PPCInsts[0])), TM(tm) {} + +/// getPointerRegClass - Return the register class to use to hold pointers. +/// This is used for addressing modes. +const TargetRegisterClass *PPCInstrInfo::getPointerRegClass() const { + if (TM.getSubtargetImpl()->isPPC64()) + return &PPC::G8RCRegClass; + else + return &PPC::GPRCRegClass; +} + bool PPCInstrInfo::isMoveInstr(const MachineInstr& MI, unsigned& sourceReg, diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.h b/llvm/lib/Target/PowerPC/PPCInstrInfo.h index 25551fb6c29..eecc1bc8be6 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.h +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.h @@ -62,9 +62,10 @@ enum PPC970_Unit { class PPCInstrInfo : public TargetInstrInfo { + PPCTargetMachine &TM; const PPCRegisterInfo RI; public: - PPCInstrInfo(); + PPCInstrInfo(PPCTargetMachine &TM); /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As /// such, whenever a client has an instance of instruction info, it should @@ -72,7 +73,10 @@ public: /// virtual const MRegisterInfo &getRegisterInfo() const { return RI; } - // + /// getPointerRegClass - Return the register class to use to hold pointers. + /// This is used for addressing modes. + virtual const TargetRegisterClass *getPointerRegClass() const; + // Return true if the instruction is a register to register move and // leave the source and dest operands in the passed parameters. // diff --git a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp index e5ee33be3f2..c174e264ce2 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -87,7 +87,7 @@ unsigned PPC64TargetMachine::getModuleMatchQuality(const Module &M) { PPCTargetMachine::PPCTargetMachine(const Module &M, const std::string &FS, bool is64Bit) : TargetMachine("PowerPC"), Subtarget(M, FS, is64Bit), - DataLayout(Subtarget.getTargetDataString()), + DataLayout(Subtarget.getTargetDataString()), InstrInfo(*this), FrameInfo(*this, false), JITInfo(*this), TLInfo(*this), InstrItins(Subtarget.getInstrItineraryData()) { |