[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp PPCInstrInfo.h PPCTargetMachine.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Jun 16 17:01:16 PDT 2006
Changes in directory llvm/lib/Target/PowerPC:
PPCInstrInfo.cpp updated: 1.20 -> 1.21
PPCInstrInfo.h updated: 1.15 -> 1.16
PPCTargetMachine.cpp updated: 1.94 -> 1.95
---
Log message:
Implement the getPointerRegClass method, which is required for the ptr_rc
magic to work.
---
Diffs of the changes: (+20 -6)
PPCInstrInfo.cpp | 16 +++++++++++++---
PPCInstrInfo.h | 8 ++++++--
PPCTargetMachine.cpp | 2 +-
3 files changed, 20 insertions(+), 6 deletions(-)
Index: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.20 llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.21
--- llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1.20 Thu May 4 12:52:23 2006
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.cpp Fri Jun 16 19:01:04 2006
@@ -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,
Index: llvm/lib/Target/PowerPC/PPCInstrInfo.h
diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.h:1.15 llvm/lib/Target/PowerPC/PPCInstrInfo.h:1.16
--- llvm/lib/Target/PowerPC/PPCInstrInfo.h:1.15 Wed May 24 12:04:04 2006
+++ llvm/lib/Target/PowerPC/PPCInstrInfo.h Fri Jun 16 19:01:04 2006
@@ -62,9 +62,10 @@
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 @@
///
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.
//
Index: llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
diff -u llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.94 llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.95
--- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.94 Fri Jun 16 13:50:48 2006
+++ llvm/lib/Target/PowerPC/PPCTargetMachine.cpp Fri Jun 16 19:01:04 2006
@@ -87,7 +87,7 @@
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()) {
More information about the llvm-commits
mailing list