forked from OSchip/llvm-project
				
			Implement the getPointerRegClass method, which is required for the ptr_rc
magic to work. llvm-svn: 28847
This commit is contained in:
		
							parent
							
								
									8dd21436db
								
							
						
					
					
						commit
						49cadab385
					
				| 
						 | 
					@ -13,13 +13,23 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "PPCInstrInfo.h"
 | 
					#include "PPCInstrInfo.h"
 | 
				
			||||||
#include "PPCGenInstrInfo.inc"
 | 
					#include "PPCGenInstrInfo.inc"
 | 
				
			||||||
#include "PPC.h"
 | 
					#include "PPCTargetMachine.h"
 | 
				
			||||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
 | 
					#include "llvm/CodeGen/MachineInstrBuilder.h"
 | 
				
			||||||
#include <iostream>
 | 
					#include <iostream>
 | 
				
			||||||
using namespace llvm;
 | 
					using namespace llvm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PPCInstrInfo::PPCInstrInfo()
 | 
					PPCInstrInfo::PPCInstrInfo(PPCTargetMachine &tm)
 | 
				
			||||||
  : TargetInstrInfo(PPCInsts, sizeof(PPCInsts)/sizeof(PPCInsts[0])) {}
 | 
					  : 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,
 | 
					bool PPCInstrInfo::isMoveInstr(const MachineInstr& MI,
 | 
				
			||||||
                               unsigned& sourceReg,
 | 
					                               unsigned& sourceReg,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,9 +62,10 @@ enum PPC970_Unit {
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
class PPCInstrInfo : public TargetInstrInfo {
 | 
					class PPCInstrInfo : public TargetInstrInfo {
 | 
				
			||||||
 | 
					  PPCTargetMachine &TM;
 | 
				
			||||||
  const PPCRegisterInfo RI;
 | 
					  const PPCRegisterInfo RI;
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  PPCInstrInfo();
 | 
					  PPCInstrInfo(PPCTargetMachine &TM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
 | 
					  /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
 | 
				
			||||||
  /// such, whenever a client has an instance of instruction info, it should
 | 
					  /// such, whenever a client has an instance of instruction info, it should
 | 
				
			||||||
| 
						 | 
					@ -72,7 +73,10 @@ public:
 | 
				
			||||||
  ///
 | 
					  ///
 | 
				
			||||||
  virtual const MRegisterInfo &getRegisterInfo() const { return RI; }
 | 
					  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
 | 
					  // Return true if the instruction is a register to register move and
 | 
				
			||||||
  // leave the source and dest operands in the passed parameters.
 | 
					  // leave the source and dest operands in the passed parameters.
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -87,7 +87,7 @@ unsigned PPC64TargetMachine::getModuleMatchQuality(const Module &M) {
 | 
				
			||||||
PPCTargetMachine::PPCTargetMachine(const Module &M, const std::string &FS,
 | 
					PPCTargetMachine::PPCTargetMachine(const Module &M, const std::string &FS,
 | 
				
			||||||
                                   bool is64Bit)
 | 
					                                   bool is64Bit)
 | 
				
			||||||
  : TargetMachine("PowerPC"), Subtarget(M, FS, is64Bit),
 | 
					  : TargetMachine("PowerPC"), Subtarget(M, FS, is64Bit),
 | 
				
			||||||
    DataLayout(Subtarget.getTargetDataString()),
 | 
					    DataLayout(Subtarget.getTargetDataString()), InstrInfo(*this),
 | 
				
			||||||
    FrameInfo(*this, false), JITInfo(*this), TLInfo(*this),
 | 
					    FrameInfo(*this, false), JITInfo(*this), TLInfo(*this),
 | 
				
			||||||
    InstrItins(Subtarget.getInstrItineraryData()) {
 | 
					    InstrItins(Subtarget.getInstrItineraryData()) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue