1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Convert more uses of XXXRegisterClass to &XXXRegClass. No functional change since they are equivalent.

llvm-svn: 155188
This commit is contained in:
Craig Topper 2012-04-20 07:30:17 +00:00
parent a0bf6c3af3
commit 90d95a9142
31 changed files with 292 additions and 296 deletions

View File

@ -258,7 +258,7 @@ ARMBaseRegisterInfo::getLargestLegalSuperClass(const TargetRegisterClass *RC)
const TargetRegisterClass * const TargetRegisterClass *
ARMBaseRegisterInfo::getPointerRegClass(unsigned Kind) const { ARMBaseRegisterInfo::getPointerRegClass(unsigned Kind) const {
return ARM::GPRRegisterClass; return &ARM::GPRRegClass;
} }
const TargetRegisterClass * const TargetRegisterClass *
@ -369,7 +369,7 @@ ARMBaseRegisterInfo::getRawAllocationOrder(const TargetRegisterClass *RC,
}; };
// We only support even/odd hints for GPR and rGPR. // We only support even/odd hints for GPR and rGPR.
if (RC != ARM::GPRRegisterClass && RC != ARM::rGPRRegisterClass) if (RC != &ARM::GPRRegClass && RC != &ARM::rGPRRegClass)
return RC->getRawAllocationOrder(MF); return RC->getRawAllocationOrder(MF);
if (HintType == ARMRI::RegPairEven) { if (HintType == ARMRI::RegPairEven) {
@ -1110,7 +1110,7 @@ ARMBaseRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
// Must be addrmode4/6. // Must be addrmode4/6.
MI.getOperand(i).ChangeToRegister(FrameReg, false, false, false); MI.getOperand(i).ChangeToRegister(FrameReg, false, false, false);
else { else {
ScratchReg = MF.getRegInfo().createVirtualRegister(ARM::GPRRegisterClass); ScratchReg = MF.getRegInfo().createVirtualRegister(&ARM::GPRRegClass);
if (!AFI->isThumbFunction()) if (!AFI->isThumbFunction())
emitARMRegPlusImmediate(MBB, II, MI.getDebugLoc(), ScratchReg, FrameReg, emitARMRegPlusImmediate(MBB, II, MI.getDebugLoc(), ScratchReg, FrameReg,
Offset, Pred, PredReg, TII); Offset, Pred, PredReg, TII);

View File

@ -1541,7 +1541,7 @@ void ARMCodeEmitter::emitMiscBranchInstruction(const MachineInstr &MI) {
static unsigned encodeVFPRd(const MachineInstr &MI, unsigned OpIdx) { static unsigned encodeVFPRd(const MachineInstr &MI, unsigned OpIdx) {
unsigned RegD = MI.getOperand(OpIdx).getReg(); unsigned RegD = MI.getOperand(OpIdx).getReg();
unsigned Binary = 0; unsigned Binary = 0;
bool isSPVFP = ARM::SPRRegisterClass->contains(RegD); bool isSPVFP = ARM::SPRRegClass.contains(RegD);
RegD = getARMRegisterNumbering(RegD); RegD = getARMRegisterNumbering(RegD);
if (!isSPVFP) if (!isSPVFP)
Binary |= RegD << ARMII::RegRdShift; Binary |= RegD << ARMII::RegRdShift;
@ -1555,7 +1555,7 @@ static unsigned encodeVFPRd(const MachineInstr &MI, unsigned OpIdx) {
static unsigned encodeVFPRn(const MachineInstr &MI, unsigned OpIdx) { static unsigned encodeVFPRn(const MachineInstr &MI, unsigned OpIdx) {
unsigned RegN = MI.getOperand(OpIdx).getReg(); unsigned RegN = MI.getOperand(OpIdx).getReg();
unsigned Binary = 0; unsigned Binary = 0;
bool isSPVFP = ARM::SPRRegisterClass->contains(RegN); bool isSPVFP = ARM::SPRRegClass.contains(RegN);
RegN = getARMRegisterNumbering(RegN); RegN = getARMRegisterNumbering(RegN);
if (!isSPVFP) if (!isSPVFP)
Binary |= RegN << ARMII::RegRnShift; Binary |= RegN << ARMII::RegRnShift;
@ -1569,7 +1569,7 @@ static unsigned encodeVFPRn(const MachineInstr &MI, unsigned OpIdx) {
static unsigned encodeVFPRm(const MachineInstr &MI, unsigned OpIdx) { static unsigned encodeVFPRm(const MachineInstr &MI, unsigned OpIdx) {
unsigned RegM = MI.getOperand(OpIdx).getReg(); unsigned RegM = MI.getOperand(OpIdx).getReg();
unsigned Binary = 0; unsigned Binary = 0;
bool isSPVFP = ARM::SPRRegisterClass->contains(RegM); bool isSPVFP = ARM::SPRRegClass.contains(RegM);
RegM = getARMRegisterNumbering(RegM); RegM = getARMRegisterNumbering(RegM);
if (!isSPVFP) if (!isSPVFP)
Binary |= RegM; Binary |= RegM;

View File

@ -910,8 +910,9 @@ void ARMFastISel::ARMSimplifyAddress(Address &Addr, EVT VT, bool useAM3) {
// put the alloca address into a register, set the base type back to // put the alloca address into a register, set the base type back to
// register and continue. This should almost never happen. // register and continue. This should almost never happen.
if (needsLowering && Addr.BaseType == Address::FrameIndexBase) { if (needsLowering && Addr.BaseType == Address::FrameIndexBase) {
const TargetRegisterClass *RC = isThumb2 ? ARM::tGPRRegisterClass const TargetRegisterClass *RC = isThumb2 ?
: ARM::GPRRegisterClass; (const TargetRegisterClass*)&ARM::tGPRRegClass :
(const TargetRegisterClass*)&ARM::GPRRegClass;
unsigned ResultReg = createResultReg(RC); unsigned ResultReg = createResultReg(RC);
unsigned Opc = isThumb2 ? ARM::t2ADDri : ARM::ADDri; unsigned Opc = isThumb2 ? ARM::t2ADDri : ARM::ADDri;
AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
@ -1005,7 +1006,7 @@ bool ARMFastISel::ARMEmitLoad(EVT VT, unsigned &ResultReg, Address &Addr,
useAM3 = true; useAM3 = true;
} }
} }
RC = ARM::GPRRegisterClass; RC = &ARM::GPRRegClass;
break; break;
case MVT::i16: case MVT::i16:
if (isThumb2) { if (isThumb2) {
@ -1017,7 +1018,7 @@ bool ARMFastISel::ARMEmitLoad(EVT VT, unsigned &ResultReg, Address &Addr,
Opc = isZExt ? ARM::LDRH : ARM::LDRSH; Opc = isZExt ? ARM::LDRH : ARM::LDRSH;
useAM3 = true; useAM3 = true;
} }
RC = ARM::GPRRegisterClass; RC = &ARM::GPRRegClass;
break; break;
case MVT::i32: case MVT::i32:
if (isThumb2) { if (isThumb2) {
@ -1028,7 +1029,7 @@ bool ARMFastISel::ARMEmitLoad(EVT VT, unsigned &ResultReg, Address &Addr,
} else { } else {
Opc = ARM::LDRi12; Opc = ARM::LDRi12;
} }
RC = ARM::GPRRegisterClass; RC = &ARM::GPRRegClass;
break; break;
case MVT::f32: case MVT::f32:
if (!Subtarget->hasVFP2()) return false; if (!Subtarget->hasVFP2()) return false;
@ -1037,7 +1038,7 @@ bool ARMFastISel::ARMEmitLoad(EVT VT, unsigned &ResultReg, Address &Addr,
needVMOV = true; needVMOV = true;
VT = MVT::i32; VT = MVT::i32;
Opc = isThumb2 ? ARM::t2LDRi12 : ARM::LDRi12; Opc = isThumb2 ? ARM::t2LDRi12 : ARM::LDRi12;
RC = ARM::GPRRegisterClass; RC = &ARM::GPRRegClass;
} else { } else {
Opc = ARM::VLDRS; Opc = ARM::VLDRS;
RC = TLI.getRegClassFor(VT); RC = TLI.getRegClassFor(VT);
@ -1106,8 +1107,9 @@ bool ARMFastISel::ARMEmitStore(EVT VT, unsigned SrcReg, Address &Addr,
// This is mostly going to be Neon/vector support. // This is mostly going to be Neon/vector support.
default: return false; default: return false;
case MVT::i1: { case MVT::i1: {
unsigned Res = createResultReg(isThumb2 ? ARM::tGPRRegisterClass : unsigned Res = createResultReg(isThumb2 ?
ARM::GPRRegisterClass); (const TargetRegisterClass*)&ARM::tGPRRegClass :
(const TargetRegisterClass*)&ARM::GPRRegClass);
unsigned Opc = isThumb2 ? ARM::t2ANDri : ARM::ANDri; unsigned Opc = isThumb2 ? ARM::t2ANDri : ARM::ANDri;
AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
TII.get(Opc), Res) TII.get(Opc), Res)
@ -1491,8 +1493,9 @@ bool ARMFastISel::SelectCmp(const Instruction *I) {
// Now set a register based on the comparison. Explicitly set the predicates // Now set a register based on the comparison. Explicitly set the predicates
// here. // here.
unsigned MovCCOpc = isThumb2 ? ARM::t2MOVCCi : ARM::MOVCCi; unsigned MovCCOpc = isThumb2 ? ARM::t2MOVCCi : ARM::MOVCCi;
const TargetRegisterClass *RC = isThumb2 ? ARM::rGPRRegisterClass const TargetRegisterClass *RC = isThumb2 ?
: ARM::GPRRegisterClass; (const TargetRegisterClass*)&ARM::rGPRRegClass :
(const TargetRegisterClass*)&ARM::GPRRegClass;
unsigned DestReg = createResultReg(RC); unsigned DestReg = createResultReg(RC);
Constant *Zero = ConstantInt::get(Type::getInt32Ty(*Context), 0); Constant *Zero = ConstantInt::get(Type::getInt32Ty(*Context), 0);
unsigned ZeroReg = TargetMaterializeConstant(Zero); unsigned ZeroReg = TargetMaterializeConstant(Zero);
@ -1516,7 +1519,7 @@ bool ARMFastISel::SelectFPExt(const Instruction *I) {
unsigned Op = getRegForValue(V); unsigned Op = getRegForValue(V);
if (Op == 0) return false; if (Op == 0) return false;
unsigned Result = createResultReg(ARM::DPRRegisterClass); unsigned Result = createResultReg(&ARM::DPRRegClass);
AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
TII.get(ARM::VCVTDS), Result) TII.get(ARM::VCVTDS), Result)
.addReg(Op)); .addReg(Op));
@ -1535,7 +1538,7 @@ bool ARMFastISel::SelectFPTrunc(const Instruction *I) {
unsigned Op = getRegForValue(V); unsigned Op = getRegForValue(V);
if (Op == 0) return false; if (Op == 0) return false;
unsigned Result = createResultReg(ARM::SPRRegisterClass); unsigned Result = createResultReg(&ARM::SPRRegClass);
AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
TII.get(ARM::VCVTSD), Result) TII.get(ARM::VCVTSD), Result)
.addReg(Op)); .addReg(Op));

View File

@ -790,7 +790,7 @@ static void emitAlignedDPRCS2Spills(MachineBasicBlock &MBB,
// The writeback is only needed when emitting two vst1.64 instructions. // The writeback is only needed when emitting two vst1.64 instructions.
if (NumAlignedDPRCS2Regs >= 6) { if (NumAlignedDPRCS2Regs >= 6) {
unsigned SupReg = TRI->getMatchingSuperReg(NextReg, ARM::dsub_0, unsigned SupReg = TRI->getMatchingSuperReg(NextReg, ARM::dsub_0,
ARM::QQPRRegisterClass); &ARM::QQPRRegClass);
MBB.addLiveIn(SupReg); MBB.addLiveIn(SupReg);
AddDefaultPred(BuildMI(MBB, MI, DL, TII.get(ARM::VST1d64Qwb_fixed), AddDefaultPred(BuildMI(MBB, MI, DL, TII.get(ARM::VST1d64Qwb_fixed),
ARM::R4) ARM::R4)
@ -808,7 +808,7 @@ static void emitAlignedDPRCS2Spills(MachineBasicBlock &MBB,
// 16-byte aligned vst1.64 with 4 d-regs, no writeback. // 16-byte aligned vst1.64 with 4 d-regs, no writeback.
if (NumAlignedDPRCS2Regs >= 4) { if (NumAlignedDPRCS2Regs >= 4) {
unsigned SupReg = TRI->getMatchingSuperReg(NextReg, ARM::dsub_0, unsigned SupReg = TRI->getMatchingSuperReg(NextReg, ARM::dsub_0,
ARM::QQPRRegisterClass); &ARM::QQPRRegClass);
MBB.addLiveIn(SupReg); MBB.addLiveIn(SupReg);
AddDefaultPred(BuildMI(MBB, MI, DL, TII.get(ARM::VST1d64Q)) AddDefaultPred(BuildMI(MBB, MI, DL, TII.get(ARM::VST1d64Q))
.addReg(ARM::R4).addImm(16).addReg(NextReg) .addReg(ARM::R4).addImm(16).addReg(NextReg)
@ -820,7 +820,7 @@ static void emitAlignedDPRCS2Spills(MachineBasicBlock &MBB,
// 16-byte aligned vst1.64 with 2 d-regs. // 16-byte aligned vst1.64 with 2 d-regs.
if (NumAlignedDPRCS2Regs >= 2) { if (NumAlignedDPRCS2Regs >= 2) {
unsigned SupReg = TRI->getMatchingSuperReg(NextReg, ARM::dsub_0, unsigned SupReg = TRI->getMatchingSuperReg(NextReg, ARM::dsub_0,
ARM::QPRRegisterClass); &ARM::QPRRegClass);
MBB.addLiveIn(SupReg); MBB.addLiveIn(SupReg);
AddDefaultPred(BuildMI(MBB, MI, DL, TII.get(ARM::VST1q64)) AddDefaultPred(BuildMI(MBB, MI, DL, TII.get(ARM::VST1q64))
.addReg(ARM::R4).addImm(16).addReg(SupReg)); .addReg(ARM::R4).addImm(16).addReg(SupReg));
@ -908,7 +908,7 @@ static void emitAlignedDPRCS2Restores(MachineBasicBlock &MBB,
// 16-byte aligned vld1.64 with 4 d-regs and writeback. // 16-byte aligned vld1.64 with 4 d-regs and writeback.
if (NumAlignedDPRCS2Regs >= 6) { if (NumAlignedDPRCS2Regs >= 6) {
unsigned SupReg = TRI->getMatchingSuperReg(NextReg, ARM::dsub_0, unsigned SupReg = TRI->getMatchingSuperReg(NextReg, ARM::dsub_0,
ARM::QQPRRegisterClass); &ARM::QQPRRegClass);
AddDefaultPred(BuildMI(MBB, MI, DL, TII.get(ARM::VLD1d64Qwb_fixed), NextReg) AddDefaultPred(BuildMI(MBB, MI, DL, TII.get(ARM::VLD1d64Qwb_fixed), NextReg)
.addReg(ARM::R4, RegState::Define) .addReg(ARM::R4, RegState::Define)
.addReg(ARM::R4, RegState::Kill).addImm(16) .addReg(ARM::R4, RegState::Kill).addImm(16)
@ -924,7 +924,7 @@ static void emitAlignedDPRCS2Restores(MachineBasicBlock &MBB,
// 16-byte aligned vld1.64 with 4 d-regs, no writeback. // 16-byte aligned vld1.64 with 4 d-regs, no writeback.
if (NumAlignedDPRCS2Regs >= 4) { if (NumAlignedDPRCS2Regs >= 4) {
unsigned SupReg = TRI->getMatchingSuperReg(NextReg, ARM::dsub_0, unsigned SupReg = TRI->getMatchingSuperReg(NextReg, ARM::dsub_0,
ARM::QQPRRegisterClass); &ARM::QQPRRegClass);
AddDefaultPred(BuildMI(MBB, MI, DL, TII.get(ARM::VLD1d64Q), NextReg) AddDefaultPred(BuildMI(MBB, MI, DL, TII.get(ARM::VLD1d64Q), NextReg)
.addReg(ARM::R4).addImm(16) .addReg(ARM::R4).addImm(16)
.addReg(SupReg, RegState::ImplicitDefine)); .addReg(SupReg, RegState::ImplicitDefine));
@ -935,7 +935,7 @@ static void emitAlignedDPRCS2Restores(MachineBasicBlock &MBB,
// 16-byte aligned vld1.64 with 2 d-regs. // 16-byte aligned vld1.64 with 2 d-regs.
if (NumAlignedDPRCS2Regs >= 2) { if (NumAlignedDPRCS2Regs >= 2) {
unsigned SupReg = TRI->getMatchingSuperReg(NextReg, ARM::dsub_0, unsigned SupReg = TRI->getMatchingSuperReg(NextReg, ARM::dsub_0,
ARM::QPRRegisterClass); &ARM::QPRRegClass);
AddDefaultPred(BuildMI(MBB, MI, DL, TII.get(ARM::VLD1q64), SupReg) AddDefaultPred(BuildMI(MBB, MI, DL, TII.get(ARM::VLD1q64), SupReg)
.addReg(ARM::R4).addImm(16)); .addReg(ARM::R4).addImm(16));
NextReg += 2; NextReg += 2;
@ -1244,7 +1244,7 @@ ARMFrameLowering::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
CanEliminateFrame = false; CanEliminateFrame = false;
} }
if (!ARM::GPRRegisterClass->contains(Reg)) if (!ARM::GPRRegClass.contains(Reg))
continue; continue;
if (Spilled) { if (Spilled) {
@ -1404,7 +1404,7 @@ ARMFrameLowering::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
} else if (!AFI->isThumb1OnlyFunction()) { } else if (!AFI->isThumb1OnlyFunction()) {
// note: Thumb1 functions spill to R12, not the stack. Reserve a slot // note: Thumb1 functions spill to R12, not the stack. Reserve a slot
// closest to SP or frame pointer. // closest to SP or frame pointer.
const TargetRegisterClass *RC = ARM::GPRRegisterClass; const TargetRegisterClass *RC = &ARM::GPRRegClass;
RS->setScavengingFrameIndex(MFI->CreateStackObject(RC->getSize(), RS->setScavengingFrameIndex(MFI->CreateStackObject(RC->getSize(),
RC->getAlignment(), RC->getAlignment(),
false)); false));

View File

@ -153,12 +153,12 @@ void ARMTargetLowering::addTypeForNEON(EVT VT, EVT PromotedLdStVT,
} }
void ARMTargetLowering::addDRTypeForNEON(EVT VT) { void ARMTargetLowering::addDRTypeForNEON(EVT VT) {
addRegisterClass(VT, ARM::DPRRegisterClass); addRegisterClass(VT, &ARM::DPRRegClass);
addTypeForNEON(VT, MVT::f64, MVT::v2i32); addTypeForNEON(VT, MVT::f64, MVT::v2i32);
} }
void ARMTargetLowering::addQRTypeForNEON(EVT VT) { void ARMTargetLowering::addQRTypeForNEON(EVT VT) {
addRegisterClass(VT, ARM::QPRRegisterClass); addRegisterClass(VT, &ARM::QPRRegClass);
addTypeForNEON(VT, MVT::v2f64, MVT::v4i32); addTypeForNEON(VT, MVT::v2f64, MVT::v4i32);
} }
@ -431,14 +431,14 @@ ARMTargetLowering::ARMTargetLowering(TargetMachine &TM)
} }
if (Subtarget->isThumb1Only()) if (Subtarget->isThumb1Only())
addRegisterClass(MVT::i32, ARM::tGPRRegisterClass); addRegisterClass(MVT::i32, &ARM::tGPRRegClass);
else else
addRegisterClass(MVT::i32, ARM::GPRRegisterClass); addRegisterClass(MVT::i32, &ARM::GPRRegClass);
if (!TM.Options.UseSoftFloat && Subtarget->hasVFP2() && if (!TM.Options.UseSoftFloat && Subtarget->hasVFP2() &&
!Subtarget->isThumb1Only()) { !Subtarget->isThumb1Only()) {
addRegisterClass(MVT::f32, ARM::SPRRegisterClass); addRegisterClass(MVT::f32, &ARM::SPRRegClass);
if (!Subtarget->isFPOnlySP()) if (!Subtarget->isFPOnlySP())
addRegisterClass(MVT::f64, ARM::DPRRegisterClass); addRegisterClass(MVT::f64, &ARM::DPRRegClass);
setTruncStoreAction(MVT::f64, MVT::f32, Expand); setTruncStoreAction(MVT::f64, MVT::f32, Expand);
} }
@ -849,7 +849,7 @@ ARMTargetLowering::findRepresentativeClass(EVT VT) const{
// the cost is 1 for both f32 and f64. // the cost is 1 for both f32 and f64.
case MVT::f32: case MVT::f64: case MVT::v8i8: case MVT::v4i16: case MVT::f32: case MVT::f64: case MVT::v8i8: case MVT::v4i16:
case MVT::v2i32: case MVT::v1i64: case MVT::v2f32: case MVT::v2i32: case MVT::v1i64: case MVT::v2f32:
RRC = ARM::DPRRegisterClass; RRC = &ARM::DPRRegClass;
// When NEON is used for SP, only half of the register file is available // When NEON is used for SP, only half of the register file is available
// because operations that define both SP and DP results will be constrained // because operations that define both SP and DP results will be constrained
// to the VFP2 class (D0-D15). We currently model this constraint prior to // to the VFP2 class (D0-D15). We currently model this constraint prior to
@ -859,15 +859,15 @@ ARMTargetLowering::findRepresentativeClass(EVT VT) const{
break; break;
case MVT::v16i8: case MVT::v8i16: case MVT::v4i32: case MVT::v2i64: case MVT::v16i8: case MVT::v8i16: case MVT::v4i32: case MVT::v2i64:
case MVT::v4f32: case MVT::v2f64: case MVT::v4f32: case MVT::v2f64:
RRC = ARM::DPRRegisterClass; RRC = &ARM::DPRRegClass;
Cost = 2; Cost = 2;
break; break;
case MVT::v4i64: case MVT::v4i64:
RRC = ARM::DPRRegisterClass; RRC = &ARM::DPRRegClass;
Cost = 4; Cost = 4;
break; break;
case MVT::v8i64: case MVT::v8i64:
RRC = ARM::DPRRegisterClass; RRC = &ARM::DPRRegClass;
Cost = 8; Cost = 8;
break; break;
} }
@ -1027,9 +1027,9 @@ const TargetRegisterClass *ARMTargetLowering::getRegClassFor(EVT VT) const {
// load / store 4 to 8 consecutive D registers. // load / store 4 to 8 consecutive D registers.
if (Subtarget->hasNEON()) { if (Subtarget->hasNEON()) {
if (VT == MVT::v4i64) if (VT == MVT::v4i64)
return ARM::QQPRRegisterClass; return &ARM::QQPRRegClass;
else if (VT == MVT::v8i64) if (VT == MVT::v8i64)
return ARM::QQQQPRRegisterClass; return &ARM::QQQQPRRegClass;
} }
return TargetLowering::getRegClassFor(VT); return TargetLowering::getRegClassFor(VT);
} }
@ -2457,9 +2457,9 @@ ARMTargetLowering::GetF64FormalArgument(CCValAssign &VA, CCValAssign &NextVA,
const TargetRegisterClass *RC; const TargetRegisterClass *RC;
if (AFI->isThumb1OnlyFunction()) if (AFI->isThumb1OnlyFunction())
RC = ARM::tGPRRegisterClass; RC = &ARM::tGPRRegClass;
else else
RC = ARM::GPRRegisterClass; RC = &ARM::GPRRegClass;
// Transform the arguments stored in physical registers into virtual ones. // Transform the arguments stored in physical registers into virtual ones.
unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC); unsigned Reg = MF.addLiveIn(VA.getLocReg(), RC);
@ -2543,9 +2543,9 @@ ARMTargetLowering::VarArgStyleRegisters(CCState &CCInfo, SelectionDAG &DAG,
for (; firstRegToSaveIndex < 4; ++firstRegToSaveIndex) { for (; firstRegToSaveIndex < 4; ++firstRegToSaveIndex) {
const TargetRegisterClass *RC; const TargetRegisterClass *RC;
if (AFI->isThumb1OnlyFunction()) if (AFI->isThumb1OnlyFunction())
RC = ARM::tGPRRegisterClass; RC = &ARM::tGPRRegClass;
else else
RC = ARM::GPRRegisterClass; RC = &ARM::GPRRegClass;
unsigned VReg = MF.addLiveIn(GPRArgRegs[firstRegToSaveIndex], RC); unsigned VReg = MF.addLiveIn(GPRArgRegs[firstRegToSaveIndex], RC);
SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i32); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i32);
@ -2627,14 +2627,15 @@ ARMTargetLowering::LowerFormalArguments(SDValue Chain,
const TargetRegisterClass *RC; const TargetRegisterClass *RC;
if (RegVT == MVT::f32) if (RegVT == MVT::f32)
RC = ARM::SPRRegisterClass; RC = &ARM::SPRRegClass;
else if (RegVT == MVT::f64) else if (RegVT == MVT::f64)
RC = ARM::DPRRegisterClass; RC = &ARM::DPRRegClass;
else if (RegVT == MVT::v2f64) else if (RegVT == MVT::v2f64)
RC = ARM::QPRRegisterClass; RC = &ARM::QPRRegClass;
else if (RegVT == MVT::i32) else if (RegVT == MVT::i32)
RC = (AFI->isThumb1OnlyFunction() ? RC = AFI->isThumb1OnlyFunction() ?
ARM::tGPRRegisterClass : ARM::GPRRegisterClass); (const TargetRegisterClass*)&ARM::tGPRRegClass :
(const TargetRegisterClass*)&ARM::GPRRegClass;
else else
llvm_unreachable("RegVT not supported by FORMAL_ARGUMENTS Lowering"); llvm_unreachable("RegVT not supported by FORMAL_ARGUMENTS Lowering");
@ -5252,14 +5253,14 @@ ARMTargetLowering::EmitAtomicCmpSwap(MachineInstr *MI,
bool isThumb2 = Subtarget->isThumb2(); bool isThumb2 = Subtarget->isThumb2();
MachineRegisterInfo &MRI = BB->getParent()->getRegInfo(); MachineRegisterInfo &MRI = BB->getParent()->getRegInfo();
unsigned scratch = unsigned scratch = MRI.createVirtualRegister(isThumb2 ?
MRI.createVirtualRegister(isThumb2 ? ARM::rGPRRegisterClass (const TargetRegisterClass*)&ARM::rGPRRegClass :
: ARM::GPRRegisterClass); (const TargetRegisterClass*)&ARM::GPRRegClass);
if (isThumb2) { if (isThumb2) {
MRI.constrainRegClass(dest, ARM::rGPRRegisterClass); MRI.constrainRegClass(dest, &ARM::rGPRRegClass);
MRI.constrainRegClass(oldval, ARM::rGPRRegisterClass); MRI.constrainRegClass(oldval, &ARM::rGPRRegClass);
MRI.constrainRegClass(newval, ARM::rGPRRegisterClass); MRI.constrainRegClass(newval, &ARM::rGPRRegClass);
} }
unsigned ldrOpc, strOpc; unsigned ldrOpc, strOpc;
@ -5362,8 +5363,8 @@ ARMTargetLowering::EmitAtomicBinary(MachineInstr *MI, MachineBasicBlock *BB,
MachineRegisterInfo &MRI = BB->getParent()->getRegInfo(); MachineRegisterInfo &MRI = BB->getParent()->getRegInfo();
if (isThumb2) { if (isThumb2) {
MRI.constrainRegClass(dest, ARM::rGPRRegisterClass); MRI.constrainRegClass(dest, &ARM::rGPRRegClass);
MRI.constrainRegClass(ptr, ARM::rGPRRegisterClass); MRI.constrainRegClass(ptr, &ARM::rGPRRegClass);
} }
unsigned ldrOpc, strOpc; unsigned ldrOpc, strOpc;
@ -5394,8 +5395,9 @@ ARMTargetLowering::EmitAtomicBinary(MachineInstr *MI, MachineBasicBlock *BB,
BB->end()); BB->end());
exitMBB->transferSuccessorsAndUpdatePHIs(BB); exitMBB->transferSuccessorsAndUpdatePHIs(BB);
const TargetRegisterClass *TRC = const TargetRegisterClass *TRC = isThumb2 ?
isThumb2 ? ARM::tGPRRegisterClass : ARM::GPRRegisterClass; (const TargetRegisterClass*)&ARM::tGPRRegClass :
(const TargetRegisterClass*)&ARM::GPRRegClass;
unsigned scratch = MRI.createVirtualRegister(TRC); unsigned scratch = MRI.createVirtualRegister(TRC);
unsigned scratch2 = (!BinOpcode) ? incr : MRI.createVirtualRegister(TRC); unsigned scratch2 = (!BinOpcode) ? incr : MRI.createVirtualRegister(TRC);
@ -5469,8 +5471,8 @@ ARMTargetLowering::EmitAtomicBinaryMinMax(MachineInstr *MI,
MachineRegisterInfo &MRI = BB->getParent()->getRegInfo(); MachineRegisterInfo &MRI = BB->getParent()->getRegInfo();
if (isThumb2) { if (isThumb2) {
MRI.constrainRegClass(dest, ARM::rGPRRegisterClass); MRI.constrainRegClass(dest, &ARM::rGPRRegClass);
MRI.constrainRegClass(ptr, ARM::rGPRRegisterClass); MRI.constrainRegClass(ptr, &ARM::rGPRRegClass);
} }
unsigned ldrOpc, strOpc, extendOpc; unsigned ldrOpc, strOpc, extendOpc;
@ -5504,8 +5506,9 @@ ARMTargetLowering::EmitAtomicBinaryMinMax(MachineInstr *MI,
BB->end()); BB->end());
exitMBB->transferSuccessorsAndUpdatePHIs(BB); exitMBB->transferSuccessorsAndUpdatePHIs(BB);
const TargetRegisterClass *TRC = const TargetRegisterClass *TRC = isThumb2 ?
isThumb2 ? ARM::tGPRRegisterClass : ARM::GPRRegisterClass; (const TargetRegisterClass*)&ARM::tGPRRegClass :
(const TargetRegisterClass*)&ARM::GPRRegClass;
unsigned scratch = MRI.createVirtualRegister(TRC); unsigned scratch = MRI.createVirtualRegister(TRC);
unsigned scratch2 = MRI.createVirtualRegister(TRC); unsigned scratch2 = MRI.createVirtualRegister(TRC);
@ -5531,7 +5534,7 @@ ARMTargetLowering::EmitAtomicBinaryMinMax(MachineInstr *MI,
// Sign extend the value, if necessary. // Sign extend the value, if necessary.
if (signExtend && extendOpc) { if (signExtend && extendOpc) {
oldval = MRI.createVirtualRegister(ARM::GPRRegisterClass); oldval = MRI.createVirtualRegister(&ARM::GPRRegClass);
AddDefaultPred(BuildMI(BB, dl, TII->get(extendOpc), oldval) AddDefaultPred(BuildMI(BB, dl, TII->get(extendOpc), oldval)
.addReg(dest) .addReg(dest)
.addImm(0)); .addImm(0));
@ -5586,9 +5589,9 @@ ARMTargetLowering::EmitAtomicBinary64(MachineInstr *MI, MachineBasicBlock *BB,
MachineRegisterInfo &MRI = BB->getParent()->getRegInfo(); MachineRegisterInfo &MRI = BB->getParent()->getRegInfo();
if (isThumb2) { if (isThumb2) {
MRI.constrainRegClass(destlo, ARM::rGPRRegisterClass); MRI.constrainRegClass(destlo, &ARM::rGPRRegClass);
MRI.constrainRegClass(desthi, ARM::rGPRRegisterClass); MRI.constrainRegClass(desthi, &ARM::rGPRRegClass);
MRI.constrainRegClass(ptr, ARM::rGPRRegisterClass); MRI.constrainRegClass(ptr, &ARM::rGPRRegClass);
} }
unsigned ldrOpc = isThumb2 ? ARM::t2LDREXD : ARM::LDREXD; unsigned ldrOpc = isThumb2 ? ARM::t2LDREXD : ARM::LDREXD;
@ -5614,8 +5617,9 @@ ARMTargetLowering::EmitAtomicBinary64(MachineInstr *MI, MachineBasicBlock *BB,
BB->end()); BB->end());
exitMBB->transferSuccessorsAndUpdatePHIs(BB); exitMBB->transferSuccessorsAndUpdatePHIs(BB);
const TargetRegisterClass *TRC = const TargetRegisterClass *TRC = isThumb2 ?
isThumb2 ? ARM::tGPRRegisterClass : ARM::GPRRegisterClass; (const TargetRegisterClass*)&ARM::tGPRRegClass :
(const TargetRegisterClass*)&ARM::GPRRegClass;
unsigned storesuccess = MRI.createVirtualRegister(TRC); unsigned storesuccess = MRI.createVirtualRegister(TRC);
// thisMBB: // thisMBB:
@ -5722,8 +5726,9 @@ SetupEntryBlockForSjLj(MachineInstr *MI, MachineBasicBlock *MBB,
ARMConstantPoolMBB::Create(F->getContext(), DispatchBB, PCLabelId, PCAdj); ARMConstantPoolMBB::Create(F->getContext(), DispatchBB, PCLabelId, PCAdj);
unsigned CPI = MCP->getConstantPoolIndex(CPV, 4); unsigned CPI = MCP->getConstantPoolIndex(CPV, 4);
const TargetRegisterClass *TRC = const TargetRegisterClass *TRC = isThumb ?
isThumb ? ARM::tGPRRegisterClass : ARM::GPRRegisterClass; (const TargetRegisterClass*)&ARM::tGPRRegClass :
(const TargetRegisterClass*)&ARM::GPRRegClass;
// Grab constant pool and fixed stack memory operands. // Grab constant pool and fixed stack memory operands.
MachineMemOperand *CPMMO = MachineMemOperand *CPMMO =
@ -5827,8 +5832,9 @@ EmitSjLjDispatchBlock(MachineInstr *MI, MachineBasicBlock *MBB) const {
MachineFrameInfo *MFI = MF->getFrameInfo(); MachineFrameInfo *MFI = MF->getFrameInfo();
int FI = MFI->getFunctionContextIndex(); int FI = MFI->getFunctionContextIndex();
const TargetRegisterClass *TRC = const TargetRegisterClass *TRC = Subtarget->isThumb() ?
Subtarget->isThumb() ? ARM::tGPRRegisterClass : ARM::GPRRegisterClass; (const TargetRegisterClass*)&ARM::tGPRRegClass :
(const TargetRegisterClass*)&ARM::GPRRegClass;
// Get a mapping of the call site numbers to all of the landing pads they're // Get a mapping of the call site numbers to all of the landing pads they're
// associated with. // associated with.
@ -6176,14 +6182,12 @@ EmitSjLjDispatchBlock(MachineInstr *MI, MachineBasicBlock *MBB) const {
for (unsigned i = 0; SavedRegs[i] != 0; ++i) { for (unsigned i = 0; SavedRegs[i] != 0; ++i) {
unsigned Reg = SavedRegs[i]; unsigned Reg = SavedRegs[i];
if (Subtarget->isThumb2() && if (Subtarget->isThumb2() &&
!ARM::tGPRRegisterClass->contains(Reg) && !ARM::tGPRRegClass.contains(Reg) &&
!ARM::hGPRRegisterClass->contains(Reg)) !ARM::hGPRRegClass.contains(Reg))
continue; continue;
else if (Subtarget->isThumb1Only() && if (Subtarget->isThumb1Only() && !ARM::tGPRRegClass.contains(Reg))
!ARM::tGPRRegisterClass->contains(Reg))
continue; continue;
else if (!Subtarget->isThumb() && if (!Subtarget->isThumb() && !ARM::GPRRegClass.contains(Reg))
!ARM::GPRRegisterClass->contains(Reg))
continue; continue;
if (!DefRegs[Reg]) if (!DefRegs[Reg])
MIB.addReg(Reg, RegState::ImplicitDefine | RegState::Dead); MIB.addReg(Reg, RegState::ImplicitDefine | RegState::Dead);
@ -6517,10 +6521,12 @@ ARMTargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
MachineRegisterInfo &MRI = Fn->getRegInfo(); MachineRegisterInfo &MRI = Fn->getRegInfo();
// In Thumb mode S must not be specified if source register is the SP or // In Thumb mode S must not be specified if source register is the SP or
// PC and if destination register is the SP, so restrict register class // PC and if destination register is the SP, so restrict register class
unsigned NewMovDstReg = MRI.createVirtualRegister( unsigned NewMovDstReg = MRI.createVirtualRegister(isThumb2 ?
isThumb2 ? ARM::rGPRRegisterClass : ARM::GPRRegisterClass); (const TargetRegisterClass*)&ARM::rGPRRegClass :
unsigned NewRsbDstReg = MRI.createVirtualRegister( (const TargetRegisterClass*)&ARM::GPRRegClass);
isThumb2 ? ARM::rGPRRegisterClass : ARM::GPRRegisterClass); unsigned NewRsbDstReg = MRI.createVirtualRegister(isThumb2 ?
(const TargetRegisterClass*)&ARM::rGPRRegClass :
(const TargetRegisterClass*)&ARM::GPRRegClass);
// Transfer the remainder of BB and its successor edges to sinkMBB. // Transfer the remainder of BB and its successor edges to sinkMBB.
SinkBB->splice(SinkBB->begin(), BB, SinkBB->splice(SinkBB->begin(), BB,
@ -9030,39 +9036,38 @@ ARMTargetLowering::getRegForInlineAsmConstraint(const std::string &Constraint,
switch (Constraint[0]) { switch (Constraint[0]) {
case 'l': // Low regs or general regs. case 'l': // Low regs or general regs.
if (Subtarget->isThumb()) if (Subtarget->isThumb())
return RCPair(0U, ARM::tGPRRegisterClass); return RCPair(0U, &ARM::tGPRRegClass);
else return RCPair(0U, &ARM::GPRRegClass);
return RCPair(0U, ARM::GPRRegisterClass);
case 'h': // High regs or no regs. case 'h': // High regs or no regs.
if (Subtarget->isThumb()) if (Subtarget->isThumb())
return RCPair(0U, ARM::hGPRRegisterClass); return RCPair(0U, &ARM::hGPRRegClass);
break; break;
case 'r': case 'r':
return RCPair(0U, ARM::GPRRegisterClass); return RCPair(0U, &ARM::GPRRegClass);
case 'w': case 'w':
if (VT == MVT::f32) if (VT == MVT::f32)
return RCPair(0U, ARM::SPRRegisterClass); return RCPair(0U, &ARM::SPRRegClass);
if (VT.getSizeInBits() == 64) if (VT.getSizeInBits() == 64)
return RCPair(0U, ARM::DPRRegisterClass); return RCPair(0U, &ARM::DPRRegClass);
if (VT.getSizeInBits() == 128) if (VT.getSizeInBits() == 128)
return RCPair(0U, ARM::QPRRegisterClass); return RCPair(0U, &ARM::QPRRegClass);
break; break;
case 'x': case 'x':
if (VT == MVT::f32) if (VT == MVT::f32)
return RCPair(0U, ARM::SPR_8RegisterClass); return RCPair(0U, &ARM::SPR_8RegClass);
if (VT.getSizeInBits() == 64) if (VT.getSizeInBits() == 64)
return RCPair(0U, ARM::DPR_8RegisterClass); return RCPair(0U, &ARM::DPR_8RegClass);
if (VT.getSizeInBits() == 128) if (VT.getSizeInBits() == 128)
return RCPair(0U, ARM::QPR_8RegisterClass); return RCPair(0U, &ARM::QPR_8RegClass);
break; break;
case 't': case 't':
if (VT == MVT::f32) if (VT == MVT::f32)
return RCPair(0U, ARM::SPRRegisterClass); return RCPair(0U, &ARM::SPRRegClass);
break; break;
} }
} }
if (StringRef("{cc}").equals_lower(Constraint)) if (StringRef("{cc}").equals_lower(Constraint))
return std::make_pair(unsigned(ARM::CPSR), ARM::CCRRegisterClass); return std::make_pair(unsigned(ARM::CPSR), &ARM::CCRRegClass);
return TargetLowering::getRegForInlineAsmConstraint(Constraint, VT); return TargetLowering::getRegForInlineAsmConstraint(Constraint, VT);
} }

View File

@ -1326,7 +1326,7 @@ bool ARMLoadStoreOpt::LoadStoreMultipleOpti(MachineBasicBlock &MBB) {
// First advance to the instruction just before the start of the chain. // First advance to the instruction just before the start of the chain.
AdvanceRS(MBB, MemOps); AdvanceRS(MBB, MemOps);
// Find a scratch register. // Find a scratch register.
unsigned Scratch = RS->FindUnusedReg(ARM::GPRRegisterClass); unsigned Scratch = RS->FindUnusedReg(&ARM::GPRRegClass);
// Process the load / store instructions. // Process the load / store instructions.
RS->forward(prior(MBBI)); RS->forward(prior(MBBI));

View File

@ -53,11 +53,11 @@ storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
unsigned SrcReg, bool isKill, int FI, unsigned SrcReg, bool isKill, int FI,
const TargetRegisterClass *RC, const TargetRegisterClass *RC,
const TargetRegisterInfo *TRI) const { const TargetRegisterInfo *TRI) const {
assert((RC == ARM::tGPRRegisterClass || assert((RC == &ARM::tGPRRegClass ||
(TargetRegisterInfo::isPhysicalRegister(SrcReg) && (TargetRegisterInfo::isPhysicalRegister(SrcReg) &&
isARMLowRegister(SrcReg))) && "Unknown regclass!"); isARMLowRegister(SrcReg))) && "Unknown regclass!");
if (RC == ARM::tGPRRegisterClass || if (RC == &ARM::tGPRRegClass ||
(TargetRegisterInfo::isPhysicalRegister(SrcReg) && (TargetRegisterInfo::isPhysicalRegister(SrcReg) &&
isARMLowRegister(SrcReg))) { isARMLowRegister(SrcReg))) {
DebugLoc DL; DebugLoc DL;
@ -81,11 +81,11 @@ loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
unsigned DestReg, int FI, unsigned DestReg, int FI,
const TargetRegisterClass *RC, const TargetRegisterClass *RC,
const TargetRegisterInfo *TRI) const { const TargetRegisterInfo *TRI) const {
assert((RC == ARM::tGPRRegisterClass || assert((RC == &ARM::tGPRRegClass ||
(TargetRegisterInfo::isPhysicalRegister(DestReg) && (TargetRegisterInfo::isPhysicalRegister(DestReg) &&
isARMLowRegister(DestReg))) && "Unknown regclass!"); isARMLowRegister(DestReg))) && "Unknown regclass!");
if (RC == ARM::tGPRRegisterClass || if (RC == &ARM::tGPRRegClass ||
(TargetRegisterInfo::isPhysicalRegister(DestReg) && (TargetRegisterInfo::isPhysicalRegister(DestReg) &&
isARMLowRegister(DestReg))) { isARMLowRegister(DestReg))) {
DebugLoc DL; DebugLoc DL;

View File

@ -49,13 +49,13 @@ const TargetRegisterClass*
Thumb1RegisterInfo::getLargestLegalSuperClass(const TargetRegisterClass *RC) Thumb1RegisterInfo::getLargestLegalSuperClass(const TargetRegisterClass *RC)
const { const {
if (ARM::tGPRRegClass.hasSubClassEq(RC)) if (ARM::tGPRRegClass.hasSubClassEq(RC))
return ARM::tGPRRegisterClass; return &ARM::tGPRRegClass;
return ARMBaseRegisterInfo::getLargestLegalSuperClass(RC); return ARMBaseRegisterInfo::getLargestLegalSuperClass(RC);
} }
const TargetRegisterClass * const TargetRegisterClass *
Thumb1RegisterInfo::getPointerRegClass(unsigned Kind) const { Thumb1RegisterInfo::getPointerRegClass(unsigned Kind) const {
return ARM::tGPRRegisterClass; return &ARM::tGPRRegClass;
} }
/// emitLoadConstPool - Emits a load from constpool to materialize the /// emitLoadConstPool - Emits a load from constpool to materialize the
@ -109,7 +109,7 @@ void emitThumbRegPlusImmInReg(MachineBasicBlock &MBB,
unsigned LdReg = DestReg; unsigned LdReg = DestReg;
if (DestReg == ARM::SP) { if (DestReg == ARM::SP) {
assert(BaseReg == ARM::SP && "Unexpected!"); assert(BaseReg == ARM::SP && "Unexpected!");
LdReg = MF.getRegInfo().createVirtualRegister(ARM::tGPRRegisterClass); LdReg = MF.getRegInfo().createVirtualRegister(&ARM::tGPRRegClass);
} }
if (NumBytes <= 255 && NumBytes >= 0) if (NumBytes <= 255 && NumBytes >= 0)
@ -693,7 +693,7 @@ Thumb1RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
// register. The offset is already handled in the vreg value. // register. The offset is already handled in the vreg value.
MI.getOperand(i+1).ChangeToRegister(FrameReg, false, false, false); MI.getOperand(i+1).ChangeToRegister(FrameReg, false, false, false);
} else if (MI.mayStore()) { } else if (MI.mayStore()) {
VReg = MF.getRegInfo().createVirtualRegister(ARM::tGPRRegisterClass); VReg = MF.getRegInfo().createVirtualRegister(&ARM::tGPRRegClass);
bool UseRR = false; bool UseRR = false;
if (Opcode == ARM::tSTRspi) { if (Opcode == ARM::tSTRspi) {

View File

@ -126,9 +126,9 @@ storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
unsigned SrcReg, bool isKill, int FI, unsigned SrcReg, bool isKill, int FI,
const TargetRegisterClass *RC, const TargetRegisterClass *RC,
const TargetRegisterInfo *TRI) const { const TargetRegisterInfo *TRI) const {
if (RC == ARM::GPRRegisterClass || RC == ARM::tGPRRegisterClass || if (RC == &ARM::GPRRegClass || RC == &ARM::tGPRRegClass ||
RC == ARM::tcGPRRegisterClass || RC == ARM::rGPRRegisterClass || RC == &ARM::tcGPRRegClass || RC == &ARM::rGPRRegClass ||
RC == ARM::GPRnopcRegisterClass) { RC == &ARM::GPRnopcRegClass) {
DebugLoc DL; DebugLoc DL;
if (I != MBB.end()) DL = I->getDebugLoc(); if (I != MBB.end()) DL = I->getDebugLoc();
@ -153,9 +153,9 @@ loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
unsigned DestReg, int FI, unsigned DestReg, int FI,
const TargetRegisterClass *RC, const TargetRegisterClass *RC,
const TargetRegisterInfo *TRI) const { const TargetRegisterInfo *TRI) const {
if (RC == ARM::GPRRegisterClass || RC == ARM::tGPRRegisterClass || if (RC == &ARM::GPRRegClass || RC == &ARM::tGPRRegClass ||
RC == ARM::tcGPRRegisterClass || RC == ARM::rGPRRegisterClass || RC == &ARM::tcGPRRegClass || RC == &ARM::rGPRRegClass ||
RC == ARM::GPRnopcRegisterClass) { RC == &ARM::GPRnopcRegClass) {
DebugLoc DL; DebugLoc DL;
if (I != MBB.end()) DL = I->getDebugLoc(); if (I != MBB.end()) DL = I->getDebugLoc();

View File

@ -100,13 +100,13 @@ SPUTargetLowering::SPUTargetLowering(SPUTargetMachine &TM)
setLibcallName(RTLIB::DIV_F64, "__fast_divdf3"); setLibcallName(RTLIB::DIV_F64, "__fast_divdf3");
// Set up the SPU's register classes: // Set up the SPU's register classes:
addRegisterClass(MVT::i8, SPU::R8CRegisterClass); addRegisterClass(MVT::i8, &SPU::R8CRegClass);
addRegisterClass(MVT::i16, SPU::R16CRegisterClass); addRegisterClass(MVT::i16, &SPU::R16CRegClass);
addRegisterClass(MVT::i32, SPU::R32CRegisterClass); addRegisterClass(MVT::i32, &SPU::R32CRegClass);
addRegisterClass(MVT::i64, SPU::R64CRegisterClass); addRegisterClass(MVT::i64, &SPU::R64CRegClass);
addRegisterClass(MVT::f32, SPU::R32FPRegisterClass); addRegisterClass(MVT::f32, &SPU::R32FPRegClass);
addRegisterClass(MVT::f64, SPU::R64FPRegisterClass); addRegisterClass(MVT::f64, &SPU::R64FPRegClass);
addRegisterClass(MVT::i128, SPU::GPRCRegisterClass); addRegisterClass(MVT::i128, &SPU::GPRCRegClass);
// SPU has no sign or zero extended loads for i1, i8, i16: // SPU has no sign or zero extended loads for i1, i8, i16:
setLoadExtAction(ISD::EXTLOAD, MVT::i1, Promote); setLoadExtAction(ISD::EXTLOAD, MVT::i1, Promote);
@ -397,12 +397,12 @@ SPUTargetLowering::SPUTargetLowering(SPUTargetMachine &TM)
// First set operation action for all vector types to expand. Then we // First set operation action for all vector types to expand. Then we
// will selectively turn on ones that can be effectively codegen'd. // will selectively turn on ones that can be effectively codegen'd.
addRegisterClass(MVT::v16i8, SPU::VECREGRegisterClass); addRegisterClass(MVT::v16i8, &SPU::VECREGRegClass);
addRegisterClass(MVT::v8i16, SPU::VECREGRegisterClass); addRegisterClass(MVT::v8i16, &SPU::VECREGRegClass);
addRegisterClass(MVT::v4i32, SPU::VECREGRegisterClass); addRegisterClass(MVT::v4i32, &SPU::VECREGRegClass);
addRegisterClass(MVT::v2i64, SPU::VECREGRegisterClass); addRegisterClass(MVT::v2i64, &SPU::VECREGRegClass);
addRegisterClass(MVT::v4f32, SPU::VECREGRegisterClass); addRegisterClass(MVT::v4f32, &SPU::VECREGRegClass);
addRegisterClass(MVT::v2f64, SPU::VECREGRegisterClass); addRegisterClass(MVT::v2f64, &SPU::VECREGRegClass);
for (unsigned i = (unsigned)MVT::FIRST_VECTOR_VALUETYPE; for (unsigned i = (unsigned)MVT::FIRST_VECTOR_VALUETYPE;
i <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++i) { i <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++i) {
@ -3139,16 +3139,16 @@ SPUTargetLowering::getRegForInlineAsmConstraint(const std::string &Constraint,
case 'b': // R1-R31 case 'b': // R1-R31
case 'r': // R0-R31 case 'r': // R0-R31
if (VT == MVT::i64) if (VT == MVT::i64)
return std::make_pair(0U, SPU::R64CRegisterClass); return std::make_pair(0U, &SPU::R64CRegClass);
return std::make_pair(0U, SPU::R32CRegisterClass); return std::make_pair(0U, &SPU::R32CRegClass);
case 'f': case 'f':
if (VT == MVT::f32) if (VT == MVT::f32)
return std::make_pair(0U, SPU::R32FPRegisterClass); return std::make_pair(0U, &SPU::R32FPRegClass);
else if (VT == MVT::f64) if (VT == MVT::f64)
return std::make_pair(0U, SPU::R64FPRegisterClass); return std::make_pair(0U, &SPU::R64FPRegClass);
break; break;
case 'v': case 'v':
return std::make_pair(0U, SPU::GPRCRegisterClass); return std::make_pair(0U, &SPU::GPRCRegClass);
} }
} }

View File

@ -143,21 +143,21 @@ SPUInstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
const TargetRegisterInfo *TRI) const { const TargetRegisterInfo *TRI) const {
unsigned opc; unsigned opc;
bool isValidFrameIdx = (FrameIdx < SPUFrameLowering::maxFrameOffset()); bool isValidFrameIdx = (FrameIdx < SPUFrameLowering::maxFrameOffset());
if (RC == SPU::GPRCRegisterClass) if (RC == &SPU::GPRCRegClass)
opc = isValidFrameIdx ? SPU::STQDr128 : SPU::STQXr128; opc = isValidFrameIdx ? SPU::STQDr128 : SPU::STQXr128;
else if (RC == SPU::R64CRegisterClass) else if (RC == &SPU::R64CRegClass)
opc = isValidFrameIdx ? SPU::STQDr64 : SPU::STQXr64; opc = isValidFrameIdx ? SPU::STQDr64 : SPU::STQXr64;
else if (RC == SPU::R64FPRegisterClass) else if (RC == &SPU::R64FPRegClass)
opc = isValidFrameIdx ? SPU::STQDr64 : SPU::STQXr64; opc = isValidFrameIdx ? SPU::STQDr64 : SPU::STQXr64;
else if (RC == SPU::R32CRegisterClass) else if (RC == &SPU::R32CRegClass)
opc = isValidFrameIdx ? SPU::STQDr32 : SPU::STQXr32; opc = isValidFrameIdx ? SPU::STQDr32 : SPU::STQXr32;
else if (RC == SPU::R32FPRegisterClass) else if (RC == &SPU::R32FPRegClass)
opc = isValidFrameIdx ? SPU::STQDr32 : SPU::STQXr32; opc = isValidFrameIdx ? SPU::STQDr32 : SPU::STQXr32;
else if (RC == SPU::R16CRegisterClass) else if (RC == &SPU::R16CRegClass)
opc = isValidFrameIdx ? SPU::STQDr16 : SPU::STQXr16; opc = isValidFrameIdx ? SPU::STQDr16 : SPU::STQXr16;
else if (RC == SPU::R8CRegisterClass) else if (RC == &SPU::R8CRegClass)
opc = isValidFrameIdx ? SPU::STQDr8 : SPU::STQXr8; opc = isValidFrameIdx ? SPU::STQDr8 : SPU::STQXr8;
else if (RC == SPU::VECREGRegisterClass) else if (RC == &SPU::VECREGRegClass)
opc = isValidFrameIdx ? SPU::STQDv16i8 : SPU::STQXv16i8; opc = isValidFrameIdx ? SPU::STQDv16i8 : SPU::STQXv16i8;
else else
llvm_unreachable("Unknown regclass!"); llvm_unreachable("Unknown regclass!");
@ -176,21 +176,21 @@ SPUInstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
const TargetRegisterInfo *TRI) const { const TargetRegisterInfo *TRI) const {
unsigned opc; unsigned opc;
bool isValidFrameIdx = (FrameIdx < SPUFrameLowering::maxFrameOffset()); bool isValidFrameIdx = (FrameIdx < SPUFrameLowering::maxFrameOffset());
if (RC == SPU::GPRCRegisterClass) if (RC == &SPU::GPRCRegClass)
opc = isValidFrameIdx ? SPU::LQDr128 : SPU::LQXr128; opc = isValidFrameIdx ? SPU::LQDr128 : SPU::LQXr128;
else if (RC == SPU::R64CRegisterClass) else if (RC == &SPU::R64CRegClass)
opc = isValidFrameIdx ? SPU::LQDr64 : SPU::LQXr64; opc = isValidFrameIdx ? SPU::LQDr64 : SPU::LQXr64;
else if (RC == SPU::R64FPRegisterClass) else if (RC == &SPU::R64FPRegClass)
opc = isValidFrameIdx ? SPU::LQDr64 : SPU::LQXr64; opc = isValidFrameIdx ? SPU::LQDr64 : SPU::LQXr64;
else if (RC == SPU::R32CRegisterClass) else if (RC == &SPU::R32CRegClass)
opc = isValidFrameIdx ? SPU::LQDr32 : SPU::LQXr32; opc = isValidFrameIdx ? SPU::LQDr32 : SPU::LQXr32;
else if (RC == SPU::R32FPRegisterClass) else if (RC == &SPU::R32FPRegClass)
opc = isValidFrameIdx ? SPU::LQDr32 : SPU::LQXr32; opc = isValidFrameIdx ? SPU::LQDr32 : SPU::LQXr32;
else if (RC == SPU::R16CRegisterClass) else if (RC == &SPU::R16CRegClass)
opc = isValidFrameIdx ? SPU::LQDr16 : SPU::LQXr16; opc = isValidFrameIdx ? SPU::LQDr16 : SPU::LQXr16;
else if (RC == SPU::R8CRegisterClass) else if (RC == &SPU::R8CRegClass)
opc = isValidFrameIdx ? SPU::LQDr8 : SPU::LQXr8; opc = isValidFrameIdx ? SPU::LQDr8 : SPU::LQXr8;
else if (RC == SPU::VECREGRegisterClass) else if (RC == &SPU::VECREGRegClass)
opc = isValidFrameIdx ? SPU::LQDv16i8 : SPU::LQXv16i8; opc = isValidFrameIdx ? SPU::LQDv16i8 : SPU::LQXv16i8;
else else
llvm_unreachable("Unknown regclass in loadRegFromStackSlot!"); llvm_unreachable("Unknown regclass in loadRegFromStackSlot!");

View File

@ -623,7 +623,7 @@ void HexagonFixupHwLoops::convertLoopInstr(MachineFunction &MF,
const TargetInstrInfo *TII = MF.getTarget().getInstrInfo(); const TargetInstrInfo *TII = MF.getTarget().getInstrInfo();
MachineBasicBlock *MBB = MII->getParent(); MachineBasicBlock *MBB = MII->getParent();
DebugLoc DL = MII->getDebugLoc(); DebugLoc DL = MII->getDebugLoc();
unsigned Scratch = RS.scavengeRegister(Hexagon::IntRegsRegisterClass, MII, 0); unsigned Scratch = RS.scavengeRegister(&Hexagon::IntRegsRegClass, MII, 0);
// First, set the LC0 with the trip count. // First, set the LC0 with the trip count.
if (MII->getOperand(1).isReg()) { if (MII->getOperand(1).isReg()) {

View File

@ -1130,10 +1130,10 @@ SDNode *HexagonDAGToDAGISel::SelectIntrinsicWOChain(SDNode *N) {
SDNode *Arg = N->getOperand(i).getNode(); SDNode *Arg = N->getOperand(i).getNode();
const TargetRegisterClass *RC = TII->getRegClass(MCID, i, TRI); const TargetRegisterClass *RC = TII->getRegClass(MCID, i, TRI);
if (RC == Hexagon::IntRegsRegisterClass || if (RC == &Hexagon::IntRegsRegClass ||
RC == Hexagon::DoubleRegsRegisterClass) { RC == &Hexagon::DoubleRegsRegClass) {
Ops.push_back(SDValue(Arg, 0)); Ops.push_back(SDValue(Arg, 0));
} else if (RC == Hexagon::PredRegsRegisterClass) { } else if (RC == &Hexagon::PredRegsRegClass) {
// Do the transfer. // Do the transfer.
SDNode *PdRs = CurDAG->getMachineNode(Hexagon::TFR_PdRs, dl, MVT::i1, SDNode *PdRs = CurDAG->getMachineNode(Hexagon::TFR_PdRs, dl, MVT::i1,
SDValue(Arg, 0)); SDValue(Arg, 0));

View File

@ -839,12 +839,12 @@ const {
EVT RegVT = VA.getLocVT(); EVT RegVT = VA.getLocVT();
if (RegVT == MVT::i8 || RegVT == MVT::i16 || RegVT == MVT::i32) { if (RegVT == MVT::i8 || RegVT == MVT::i16 || RegVT == MVT::i32) {
unsigned VReg = unsigned VReg =
RegInfo.createVirtualRegister(Hexagon::IntRegsRegisterClass); RegInfo.createVirtualRegister(&Hexagon::IntRegsRegClass);
RegInfo.addLiveIn(VA.getLocReg(), VReg); RegInfo.addLiveIn(VA.getLocReg(), VReg);
InVals.push_back(DAG.getCopyFromReg(Chain, dl, VReg, RegVT)); InVals.push_back(DAG.getCopyFromReg(Chain, dl, VReg, RegVT));
} else if (RegVT == MVT::i64) { } else if (RegVT == MVT::i64) {
unsigned VReg = unsigned VReg =
RegInfo.createVirtualRegister(Hexagon::DoubleRegsRegisterClass); RegInfo.createVirtualRegister(&Hexagon::DoubleRegsRegClass);
RegInfo.addLiveIn(VA.getLocReg(), VReg); RegInfo.addLiveIn(VA.getLocReg(), VReg);
InVals.push_back(DAG.getCopyFromReg(Chain, dl, VReg, RegVT)); InVals.push_back(DAG.getCopyFromReg(Chain, dl, VReg, RegVT));
} else { } else {
@ -1009,10 +1009,10 @@ HexagonTargetLowering::HexagonTargetLowering(HexagonTargetMachine
TM(targetmachine) { TM(targetmachine) {
// Set up the register classes. // Set up the register classes.
addRegisterClass(MVT::i32, Hexagon::IntRegsRegisterClass); addRegisterClass(MVT::i32, &Hexagon::IntRegsRegClass);
addRegisterClass(MVT::i64, Hexagon::DoubleRegsRegisterClass); addRegisterClass(MVT::i64, &Hexagon::DoubleRegsRegClass);
addRegisterClass(MVT::i1, Hexagon::PredRegsRegisterClass); addRegisterClass(MVT::i1, &Hexagon::PredRegsRegClass);
computeRegisterProperties(); computeRegisterProperties();
@ -1402,9 +1402,9 @@ HexagonTargetLowering::getRegForInlineAsmConstraint(const
case MVT::i32: case MVT::i32:
case MVT::i16: case MVT::i16:
case MVT::i8: case MVT::i8:
return std::make_pair(0U, Hexagon::IntRegsRegisterClass); return std::make_pair(0U, &Hexagon::IntRegsRegClass);
case MVT::i64: case MVT::i64:
return std::make_pair(0U, Hexagon::DoubleRegsRegisterClass); return std::make_pair(0U, &Hexagon::DoubleRegsRegClass);
} }
default: default:
llvm_unreachable("Unknown asm register class"); llvm_unreachable("Unknown asm register class");

View File

@ -370,15 +370,15 @@ storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
MFI.getObjectSize(FI), MFI.getObjectSize(FI),
Align); Align);
if (Hexagon::IntRegsRegisterClass->hasSubClassEq(RC)) { if (Hexagon::IntRegsRegClass.hasSubClassEq(RC)) {
BuildMI(MBB, I, DL, get(Hexagon::STriw)) BuildMI(MBB, I, DL, get(Hexagon::STriw))
.addFrameIndex(FI).addImm(0) .addFrameIndex(FI).addImm(0)
.addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO); .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO);
} else if (Hexagon::DoubleRegsRegisterClass->hasSubClassEq(RC)) { } else if (Hexagon::DoubleRegsRegClass.hasSubClassEq(RC)) {
BuildMI(MBB, I, DL, get(Hexagon::STrid)) BuildMI(MBB, I, DL, get(Hexagon::STrid))
.addFrameIndex(FI).addImm(0) .addFrameIndex(FI).addImm(0)
.addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO); .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO);
} else if (Hexagon::PredRegsRegisterClass->hasSubClassEq(RC)) { } else if (Hexagon::PredRegsRegClass.hasSubClassEq(RC)) {
BuildMI(MBB, I, DL, get(Hexagon::STriw_pred)) BuildMI(MBB, I, DL, get(Hexagon::STriw_pred))
.addFrameIndex(FI).addImm(0) .addFrameIndex(FI).addImm(0)
.addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO); .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO);
@ -416,13 +416,13 @@ loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
MFI.getObjectSize(FI), MFI.getObjectSize(FI),
Align); Align);
if (RC == Hexagon::IntRegsRegisterClass) { if (RC == &Hexagon::IntRegsRegClass) {
BuildMI(MBB, I, DL, get(Hexagon::LDriw), DestReg) BuildMI(MBB, I, DL, get(Hexagon::LDriw), DestReg)
.addFrameIndex(FI).addImm(0).addMemOperand(MMO); .addFrameIndex(FI).addImm(0).addMemOperand(MMO);
} else if (RC == Hexagon::DoubleRegsRegisterClass) { } else if (RC == &Hexagon::DoubleRegsRegClass) {
BuildMI(MBB, I, DL, get(Hexagon::LDrid), DestReg) BuildMI(MBB, I, DL, get(Hexagon::LDrid), DestReg)
.addFrameIndex(FI).addImm(0).addMemOperand(MMO); .addFrameIndex(FI).addImm(0).addMemOperand(MMO);
} else if (RC == Hexagon::PredRegsRegisterClass) { } else if (RC == &Hexagon::PredRegsRegClass) {
BuildMI(MBB, I, DL, get(Hexagon::LDriw_pred), DestReg) BuildMI(MBB, I, DL, get(Hexagon::LDriw_pred), DestReg)
.addFrameIndex(FI).addImm(0).addMemOperand(MMO); .addFrameIndex(FI).addImm(0).addMemOperand(MMO);
} else { } else {
@ -452,15 +452,14 @@ unsigned HexagonInstrInfo::createVR(MachineFunction* MF, MVT VT) const {
MachineRegisterInfo &RegInfo = MF->getRegInfo(); MachineRegisterInfo &RegInfo = MF->getRegInfo();
const TargetRegisterClass *TRC; const TargetRegisterClass *TRC;
if (VT == MVT::i1) { if (VT == MVT::i1)
TRC = Hexagon::PredRegsRegisterClass; TRC = &Hexagon::PredRegsRegClass;
} else if (VT == MVT::i32) { else if (VT == MVT::i32)
TRC = Hexagon::IntRegsRegisterClass; TRC = &Hexagon::IntRegsRegClass;
} else if (VT == MVT::i64) { else if (VT == MVT::i64)
TRC = Hexagon::DoubleRegsRegisterClass; TRC = &Hexagon::DoubleRegsRegClass;
} else { else
llvm_unreachable("Cannot handle this register class"); llvm_unreachable("Cannot handle this register class");
}
unsigned NewReg = RegInfo.createVirtualRegister(TRC); unsigned NewReg = RegInfo.createVirtualRegister(TRC);
return NewReg; return NewReg;
@ -1331,7 +1330,7 @@ HexagonInstrInfo::DefinesPredicate(MachineInstr *MI,
MachineOperand MO = MI->getOperand(oper); MachineOperand MO = MI->getOperand(oper);
if (MO.isReg() && MO.isDef()) { if (MO.isReg() && MO.isDef()) {
const TargetRegisterClass* RC = RI.getMinimalPhysRegClass(MO.getReg()); const TargetRegisterClass* RC = RI.getMinimalPhysRegClass(MO.getReg());
if (RC == Hexagon::PredRegsRegisterClass) { if (RC == &Hexagon::PredRegsRegClass) {
Pred.push_back(MO); Pred.push_back(MO);
return true; return true;
} }

View File

@ -135,7 +135,7 @@ void MBlazeAsmPrinter::printSavedRegsBitmask() {
for (unsigned i = 0, e = CSI.size(); i != e; ++i) { for (unsigned i = 0, e = CSI.size(); i != e; ++i) {
unsigned Reg = CSI[i].getReg(); unsigned Reg = CSI[i].getReg();
unsigned RegNum = getMBlazeRegisterNumbering(Reg); unsigned RegNum = getMBlazeRegisterNumbering(Reg);
if (MBlaze::GPRRegisterClass->contains(Reg)) if (MBlaze::GPRRegClass.contains(Reg))
CPUBitmask |= (1 << RegNum); CPUBitmask |= (1 << RegNum);
} }

View File

@ -62,9 +62,9 @@ MBlazeTargetLowering::MBlazeTargetLowering(MBlazeTargetMachine &TM)
setBooleanVectorContents(ZeroOrOneBooleanContent); // FIXME: Is this correct? setBooleanVectorContents(ZeroOrOneBooleanContent); // FIXME: Is this correct?
// Set up the register classes // Set up the register classes
addRegisterClass(MVT::i32, MBlaze::GPRRegisterClass); addRegisterClass(MVT::i32, &MBlaze::GPRRegClass);
if (Subtarget->hasFPU()) { if (Subtarget->hasFPU()) {
addRegisterClass(MVT::f32, MBlaze::GPRRegisterClass); addRegisterClass(MVT::f32, &MBlaze::GPRRegClass);
setOperationAction(ISD::ConstantFP, MVT::f32, Legal); setOperationAction(ISD::ConstantFP, MVT::f32, Legal);
} }
@ -291,12 +291,12 @@ MBlazeTargetLowering::EmitCustomShift(MachineInstr *MI,
loop->addSuccessor(finish); loop->addSuccessor(finish);
loop->addSuccessor(loop); loop->addSuccessor(loop);
unsigned IAMT = R.createVirtualRegister(MBlaze::GPRRegisterClass); unsigned IAMT = R.createVirtualRegister(&MBlaze::GPRRegClass);
BuildMI(MBB, dl, TII->get(MBlaze::ANDI), IAMT) BuildMI(MBB, dl, TII->get(MBlaze::ANDI), IAMT)
.addReg(MI->getOperand(2).getReg()) .addReg(MI->getOperand(2).getReg())
.addImm(31); .addImm(31);
unsigned IVAL = R.createVirtualRegister(MBlaze::GPRRegisterClass); unsigned IVAL = R.createVirtualRegister(&MBlaze::GPRRegClass);
BuildMI(MBB, dl, TII->get(MBlaze::ADDIK), IVAL) BuildMI(MBB, dl, TII->get(MBlaze::ADDIK), IVAL)
.addReg(MI->getOperand(1).getReg()) .addReg(MI->getOperand(1).getReg())
.addImm(0); .addImm(0);
@ -305,14 +305,14 @@ MBlazeTargetLowering::EmitCustomShift(MachineInstr *MI,
.addReg(IAMT) .addReg(IAMT)
.addMBB(finish); .addMBB(finish);
unsigned DST = R.createVirtualRegister(MBlaze::GPRRegisterClass); unsigned DST = R.createVirtualRegister(&MBlaze::GPRRegClass);
unsigned NDST = R.createVirtualRegister(MBlaze::GPRRegisterClass); unsigned NDST = R.createVirtualRegister(&MBlaze::GPRRegClass);
BuildMI(loop, dl, TII->get(MBlaze::PHI), DST) BuildMI(loop, dl, TII->get(MBlaze::PHI), DST)
.addReg(IVAL).addMBB(MBB) .addReg(IVAL).addMBB(MBB)
.addReg(NDST).addMBB(loop); .addReg(NDST).addMBB(loop);
unsigned SAMT = R.createVirtualRegister(MBlaze::GPRRegisterClass); unsigned SAMT = R.createVirtualRegister(&MBlaze::GPRRegClass);
unsigned NAMT = R.createVirtualRegister(MBlaze::GPRRegisterClass); unsigned NAMT = R.createVirtualRegister(&MBlaze::GPRRegClass);
BuildMI(loop, dl, TII->get(MBlaze::PHI), SAMT) BuildMI(loop, dl, TII->get(MBlaze::PHI), SAMT)
.addReg(IAMT).addMBB(MBB) .addReg(IAMT).addMBB(MBB)
.addReg(NAMT).addMBB(loop); .addReg(NAMT).addMBB(loop);
@ -500,7 +500,7 @@ MBlazeTargetLowering::EmitCustomAtomic(MachineInstr *MI,
case MBlaze::LAN32: opcode = MBlaze::AND; break; case MBlaze::LAN32: opcode = MBlaze::AND; break;
} }
finalReg = R.createVirtualRegister(MBlaze::GPRRegisterClass); finalReg = R.createVirtualRegister(&MBlaze::GPRRegClass);
start->addSuccessor(exit); start->addSuccessor(exit);
start->addSuccessor(start); start->addSuccessor(start);
@ -510,7 +510,7 @@ MBlazeTargetLowering::EmitCustomAtomic(MachineInstr *MI,
if (MI->getOpcode() == MBlaze::LAN32) { if (MI->getOpcode() == MBlaze::LAN32) {
unsigned tmp = finalReg; unsigned tmp = finalReg;
finalReg = R.createVirtualRegister(MBlaze::GPRRegisterClass); finalReg = R.createVirtualRegister(&MBlaze::GPRRegClass);
BuildMI(start, dl, TII->get(MBlaze::XORI), finalReg) BuildMI(start, dl, TII->get(MBlaze::XORI), finalReg)
.addReg(tmp) .addReg(tmp)
.addImm(-1); .addImm(-1);
@ -528,7 +528,7 @@ MBlazeTargetLowering::EmitCustomAtomic(MachineInstr *MI,
final->addSuccessor(exit); final->addSuccessor(exit);
final->addSuccessor(start); final->addSuccessor(start);
unsigned CMP = R.createVirtualRegister(MBlaze::GPRRegisterClass); unsigned CMP = R.createVirtualRegister(&MBlaze::GPRRegClass);
BuildMI(start, dl, TII->get(MBlaze::CMP), CMP) BuildMI(start, dl, TII->get(MBlaze::CMP), CMP)
.addReg(MI->getOperand(0).getReg()) .addReg(MI->getOperand(0).getReg())
.addReg(MI->getOperand(2).getReg()); .addReg(MI->getOperand(2).getReg());
@ -543,7 +543,7 @@ MBlazeTargetLowering::EmitCustomAtomic(MachineInstr *MI,
} }
} }
unsigned CHK = R.createVirtualRegister(MBlaze::GPRRegisterClass); unsigned CHK = R.createVirtualRegister(&MBlaze::GPRRegClass);
BuildMI(final, dl, TII->get(MBlaze::SWX)) BuildMI(final, dl, TII->get(MBlaze::SWX))
.addReg(finalReg) .addReg(finalReg)
.addReg(MI->getOperand(1).getReg()) .addReg(MI->getOperand(1).getReg())
@ -899,9 +899,9 @@ LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
const TargetRegisterClass *RC; const TargetRegisterClass *RC;
if (RegVT == MVT::i32) if (RegVT == MVT::i32)
RC = MBlaze::GPRRegisterClass; RC = &MBlaze::GPRRegClass;
else if (RegVT == MVT::f32) else if (RegVT == MVT::f32)
RC = MBlaze::GPRRegisterClass; RC = &MBlaze::GPRRegClass;
else else
llvm_unreachable("RegVT not supported by LowerFormalArguments"); llvm_unreachable("RegVT not supported by LowerFormalArguments");
@ -964,7 +964,7 @@ LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
StackPtr = DAG.getRegister(StackReg, getPointerTy()); StackPtr = DAG.getRegister(StackReg, getPointerTy());
// The last register argument that must be saved is MBlaze::R10 // The last register argument that must be saved is MBlaze::R10
const TargetRegisterClass *RC = MBlaze::GPRRegisterClass; const TargetRegisterClass *RC = &MBlaze::GPRRegClass;
unsigned Begin = getMBlazeRegisterNumbering(MBlaze::R5); unsigned Begin = getMBlazeRegisterNumbering(MBlaze::R5);
unsigned Start = getMBlazeRegisterNumbering(ArgRegEnd+1); unsigned Start = getMBlazeRegisterNumbering(ArgRegEnd+1);
@ -1124,14 +1124,14 @@ getRegForInlineAsmConstraint(const std::string &Constraint, EVT VT) const {
if (Constraint.size() == 1) { if (Constraint.size() == 1) {
switch (Constraint[0]) { switch (Constraint[0]) {
case 'r': case 'r':
return std::make_pair(0U, MBlaze::GPRRegisterClass); return std::make_pair(0U, &MBlaze::GPRRegClass);
// TODO: These can't possibly be right, but match what was in // TODO: These can't possibly be right, but match what was in
// getRegClassForInlineAsmConstraint. // getRegClassForInlineAsmConstraint.
case 'd': case 'd':
case 'y': case 'y':
case 'f': case 'f':
if (VT == MVT::f32) if (VT == MVT::f32)
return std::make_pair(0U, MBlaze::GPRRegisterClass); return std::make_pair(0U, &MBlaze::GPRRegClass);
} }
} }
return TargetLowering::getRegForInlineAsmConstraint(Constraint, VT); return TargetLowering::getRegForInlineAsmConstraint(Constraint, VT);

View File

@ -287,7 +287,7 @@ unsigned MBlazeInstrInfo::getGlobalBaseReg(MachineFunction *MF) const {
MachineRegisterInfo &RegInfo = MF->getRegInfo(); MachineRegisterInfo &RegInfo = MF->getRegInfo();
const TargetInstrInfo *TII = MF->getTarget().getInstrInfo(); const TargetInstrInfo *TII = MF->getTarget().getInstrInfo();
GlobalBaseReg = RegInfo.createVirtualRegister(MBlaze::GPRRegisterClass); GlobalBaseReg = RegInfo.createVirtualRegister(&MBlaze::GPRRegClass);
BuildMI(FirstMBB, MBBI, DebugLoc(), TII->get(TargetOpcode::COPY), BuildMI(FirstMBB, MBBI, DebugLoc(), TII->get(TargetOpcode::COPY),
GlobalBaseReg).addReg(MBlaze::R20); GlobalBaseReg).addReg(MBlaze::R20);
RegInfo.addLiveIn(MBlaze::R20); RegInfo.addLiveIn(MBlaze::R20);

View File

@ -64,8 +64,8 @@ MSP430TargetLowering::MSP430TargetLowering(MSP430TargetMachine &tm) :
TD = getTargetData(); TD = getTargetData();
// Set up the register classes. // Set up the register classes.
addRegisterClass(MVT::i8, MSP430::GR8RegisterClass); addRegisterClass(MVT::i8, &MSP430::GR8RegClass);
addRegisterClass(MVT::i16, MSP430::GR16RegisterClass); addRegisterClass(MVT::i16, &MSP430::GR16RegClass);
// Compute derived properties from the register classes // Compute derived properties from the register classes
computeRegisterProperties(); computeRegisterProperties();
@ -226,9 +226,9 @@ getRegForInlineAsmConstraint(const std::string &Constraint,
default: break; default: break;
case 'r': // GENERAL_REGS case 'r': // GENERAL_REGS
if (VT == MVT::i8) if (VT == MVT::i8)
return std::make_pair(0U, MSP430::GR8RegisterClass); return std::make_pair(0U, &MSP430::GR8RegClass);
return std::make_pair(0U, MSP430::GR16RegisterClass); return std::make_pair(0U, &MSP430::GR16RegClass);
} }
} }
@ -330,8 +330,7 @@ MSP430TargetLowering::LowerCCCArguments(SDValue Chain,
llvm_unreachable(0); llvm_unreachable(0);
} }
case MVT::i16: case MVT::i16:
unsigned VReg = unsigned VReg = RegInfo.createVirtualRegister(&MSP430::GR16RegClass);
RegInfo.createVirtualRegister(MSP430::GR16RegisterClass);
RegInfo.addLiveIn(VA.getLocReg(), VReg); RegInfo.addLiveIn(VA.getLocReg(), VReg);
SDValue ArgValue = DAG.getCopyFromReg(Chain, dl, VReg, RegVT); SDValue ArgValue = DAG.getCopyFromReg(Chain, dl, VReg, RegVT);
@ -1024,27 +1023,27 @@ MSP430TargetLowering::EmitShiftInstr(MachineInstr *MI,
default: llvm_unreachable("Invalid shift opcode!"); default: llvm_unreachable("Invalid shift opcode!");
case MSP430::Shl8: case MSP430::Shl8:
Opc = MSP430::SHL8r1; Opc = MSP430::SHL8r1;
RC = MSP430::GR8RegisterClass; RC = &MSP430::GR8RegClass;
break; break;
case MSP430::Shl16: case MSP430::Shl16:
Opc = MSP430::SHL16r1; Opc = MSP430::SHL16r1;
RC = MSP430::GR16RegisterClass; RC = &MSP430::GR16RegClass;
break; break;
case MSP430::Sra8: case MSP430::Sra8:
Opc = MSP430::SAR8r1; Opc = MSP430::SAR8r1;
RC = MSP430::GR8RegisterClass; RC = &MSP430::GR8RegClass;
break; break;
case MSP430::Sra16: case MSP430::Sra16:
Opc = MSP430::SAR16r1; Opc = MSP430::SAR16r1;
RC = MSP430::GR16RegisterClass; RC = &MSP430::GR16RegClass;
break; break;
case MSP430::Srl8: case MSP430::Srl8:
Opc = MSP430::SAR8r1c; Opc = MSP430::SAR8r1c;
RC = MSP430::GR8RegisterClass; RC = &MSP430::GR8RegClass;
break; break;
case MSP430::Srl16: case MSP430::Srl16:
Opc = MSP430::SAR16r1c; Opc = MSP430::SAR16r1c;
RC = MSP430::GR16RegisterClass; RC = &MSP430::GR16RegClass;
break; break;
} }
@ -1072,8 +1071,8 @@ MSP430TargetLowering::EmitShiftInstr(MachineInstr *MI,
LoopBB->addSuccessor(RemBB); LoopBB->addSuccessor(RemBB);
LoopBB->addSuccessor(LoopBB); LoopBB->addSuccessor(LoopBB);
unsigned ShiftAmtReg = RI.createVirtualRegister(MSP430::GR8RegisterClass); unsigned ShiftAmtReg = RI.createVirtualRegister(&MSP430::GR8RegClass);
unsigned ShiftAmtReg2 = RI.createVirtualRegister(MSP430::GR8RegisterClass); unsigned ShiftAmtReg2 = RI.createVirtualRegister(&MSP430::GR8RegClass);
unsigned ShiftReg = RI.createVirtualRegister(RC); unsigned ShiftReg = RI.createVirtualRegister(RC);
unsigned ShiftReg2 = RI.createVirtualRegister(RC); unsigned ShiftReg2 = RI.createVirtualRegister(RC);
unsigned ShiftAmtSrcReg = MI->getOperand(2).getReg(); unsigned ShiftAmtSrcReg = MI->getOperand(2).getReg();

View File

@ -197,9 +197,9 @@ void MipsAsmPrinter::printSavedRegsBitmask(raw_ostream &O) {
const MachineFrameInfo *MFI = MF->getFrameInfo(); const MachineFrameInfo *MFI = MF->getFrameInfo();
const std::vector<CalleeSavedInfo> &CSI = MFI->getCalleeSavedInfo(); const std::vector<CalleeSavedInfo> &CSI = MFI->getCalleeSavedInfo();
// size of stack area to which FP callee-saved regs are saved. // size of stack area to which FP callee-saved regs are saved.
unsigned CPURegSize = Mips::CPURegsRegisterClass->getSize(); unsigned CPURegSize = Mips::CPURegsRegClass.getSize();
unsigned FGR32RegSize = Mips::FGR32RegisterClass->getSize(); unsigned FGR32RegSize = Mips::FGR32RegClass.getSize();
unsigned AFGR64RegSize = Mips::AFGR64RegisterClass->getSize(); unsigned AFGR64RegSize = Mips::AFGR64RegClass.getSize();
bool HasAFGR64Reg = false; bool HasAFGR64Reg = false;
unsigned CSFPRegsSize = 0; unsigned CSFPRegsSize = 0;
unsigned i, e = CSI.size(); unsigned i, e = CSI.size();
@ -207,11 +207,11 @@ void MipsAsmPrinter::printSavedRegsBitmask(raw_ostream &O) {
// Set FPU Bitmask. // Set FPU Bitmask.
for (i = 0; i != e; ++i) { for (i = 0; i != e; ++i) {
unsigned Reg = CSI[i].getReg(); unsigned Reg = CSI[i].getReg();
if (Mips::CPURegsRegisterClass->contains(Reg)) if (Mips::CPURegsRegClass.contains(Reg))
break; break;
unsigned RegNum = getMipsRegisterNumbering(Reg); unsigned RegNum = getMipsRegisterNumbering(Reg);
if (Mips::AFGR64RegisterClass->contains(Reg)) { if (Mips::AFGR64RegClass.contains(Reg)) {
FPUBitmask |= (3 << RegNum); FPUBitmask |= (3 << RegNum);
CSFPRegsSize += AFGR64RegSize; CSFPRegsSize += AFGR64RegSize;
HasAFGR64Reg = true; HasAFGR64Reg = true;

View File

@ -217,7 +217,7 @@ void MipsFrameLowering::emitPrologue(MachineFunction &MF) const {
// If Reg is a double precision register, emit two cfa_offsets, // If Reg is a double precision register, emit two cfa_offsets,
// one for each of the paired single precision registers. // one for each of the paired single precision registers.
if (Mips::AFGR64RegisterClass->contains(Reg)) { if (Mips::AFGR64RegClass.contains(Reg)) {
const uint16_t *SubRegs = RegInfo->getSubRegisters(Reg); const uint16_t *SubRegs = RegInfo->getSubRegisters(Reg);
MachineLocation DstML0(MachineLocation::VirtualFP, Offset); MachineLocation DstML0(MachineLocation::VirtualFP, Offset);
MachineLocation DstML1(MachineLocation::VirtualFP, Offset + 4); MachineLocation DstML1(MachineLocation::VirtualFP, Offset + 4);
@ -229,8 +229,7 @@ void MipsFrameLowering::emitPrologue(MachineFunction &MF) const {
Moves.push_back(MachineMove(CSLabel, DstML0, SrcML0)); Moves.push_back(MachineMove(CSLabel, DstML0, SrcML0));
Moves.push_back(MachineMove(CSLabel, DstML1, SrcML1)); Moves.push_back(MachineMove(CSLabel, DstML1, SrcML1));
} } else {
else {
// Reg is either in CPURegs or FGR32. // Reg is either in CPURegs or FGR32.
DstML = MachineLocation(MachineLocation::VirtualFP, Offset); DstML = MachineLocation(MachineLocation::VirtualFP, Offset);
SrcML = MachineLocation(Reg); SrcML = MachineLocation(Reg);

View File

@ -134,7 +134,8 @@ void MipsDAGToDAGISel::InitGlobalBaseReg(MachineFunction &MF) {
else { else {
const TargetRegisterClass *RC; const TargetRegisterClass *RC;
RC = Subtarget.isABI_N64() ? RC = Subtarget.isABI_N64() ?
Mips::CPU64RegsRegisterClass : Mips::CPURegsRegisterClass; (const TargetRegisterClass*)&Mips::CPU64RegsRegClass :
(const TargetRegisterClass*)&Mips::CPURegsRegClass;
V0 = RegInfo.createVirtualRegister(RC); V0 = RegInfo.createVirtualRegister(RC);
V1 = RegInfo.createVirtualRegister(RC); V1 = RegInfo.createVirtualRegister(RC);

View File

@ -96,20 +96,20 @@ MipsTargetLowering(MipsTargetMachine &TM)
setBooleanVectorContents(ZeroOrOneBooleanContent); // FIXME: Is this correct? setBooleanVectorContents(ZeroOrOneBooleanContent); // FIXME: Is this correct?
// Set up the register classes // Set up the register classes
addRegisterClass(MVT::i32, Mips::CPURegsRegisterClass); addRegisterClass(MVT::i32, &Mips::CPURegsRegClass);
if (HasMips64) if (HasMips64)
addRegisterClass(MVT::i64, Mips::CPU64RegsRegisterClass); addRegisterClass(MVT::i64, &Mips::CPU64RegsRegClass);
if (!TM.Options.UseSoftFloat) { if (!TM.Options.UseSoftFloat) {
addRegisterClass(MVT::f32, Mips::FGR32RegisterClass); addRegisterClass(MVT::f32, &Mips::FGR32RegClass);
// When dealing with single precision only, use libcalls // When dealing with single precision only, use libcalls
if (!Subtarget->isSingleFloat()) { if (!Subtarget->isSingleFloat()) {
if (HasMips64) if (HasMips64)
addRegisterClass(MVT::f64, Mips::FGR64RegisterClass); addRegisterClass(MVT::f64, &Mips::FGR64RegClass);
else else
addRegisterClass(MVT::f64, Mips::AFGR64RegisterClass); addRegisterClass(MVT::f64, &Mips::AFGR64RegClass);
} }
} }
@ -2666,7 +2666,7 @@ static void ReadByValArg(MachineFunction &MF, SDValue Chain, DebugLoc dl,
break; break;
unsigned SrcReg = O32IntRegs[CurWord]; unsigned SrcReg = O32IntRegs[CurWord];
unsigned Reg = AddLiveIn(MF, SrcReg, Mips::CPURegsRegisterClass); unsigned Reg = AddLiveIn(MF, SrcReg, &Mips::CPURegsRegClass);
SDValue StorePtr = DAG.getNode(ISD::ADD, dl, MVT::i32, FIN, SDValue StorePtr = DAG.getNode(ISD::ADD, dl, MVT::i32, FIN,
DAG.getConstant(i * 4, MVT::i32)); DAG.getConstant(i * 4, MVT::i32));
SDValue Store = DAG.getStore(Chain, dl, DAG.getRegister(Reg, MVT::i32), SDValue Store = DAG.getStore(Chain, dl, DAG.getRegister(Reg, MVT::i32),
@ -2703,7 +2703,7 @@ CopyMips64ByValRegs(MachineFunction &MF, SDValue Chain, DebugLoc dl,
// Copy arg registers. // Copy arg registers.
for (unsigned I = 0; (Reg != Mips64IntRegs + 8) && (I < NumRegs); for (unsigned I = 0; (Reg != Mips64IntRegs + 8) && (I < NumRegs);
++Reg, ++I) { ++Reg, ++I) {
unsigned VReg = AddLiveIn(MF, *Reg, Mips::CPU64RegsRegisterClass); unsigned VReg = AddLiveIn(MF, *Reg, &Mips::CPU64RegsRegClass);
SDValue StorePtr = DAG.getNode(ISD::ADD, dl, PtrTy, FIN, SDValue StorePtr = DAG.getNode(ISD::ADD, dl, PtrTy, FIN,
DAG.getConstant(I * 8, PtrTy)); DAG.getConstant(I * 8, PtrTy));
SDValue Store = DAG.getStore(Chain, dl, DAG.getRegister(VReg, MVT::i64), SDValue Store = DAG.getStore(Chain, dl, DAG.getRegister(VReg, MVT::i64),
@ -2779,13 +2779,13 @@ MipsTargetLowering::LowerFormalArguments(SDValue Chain,
const TargetRegisterClass *RC; const TargetRegisterClass *RC;
if (RegVT == MVT::i32) if (RegVT == MVT::i32)
RC = Mips::CPURegsRegisterClass; RC = &Mips::CPURegsRegClass;
else if (RegVT == MVT::i64) else if (RegVT == MVT::i64)
RC = Mips::CPU64RegsRegisterClass; RC = &Mips::CPU64RegsRegClass;
else if (RegVT == MVT::f32) else if (RegVT == MVT::f32)
RC = Mips::FGR32RegisterClass; RC = &Mips::FGR32RegClass;
else if (RegVT == MVT::f64) else if (RegVT == MVT::f64)
RC = HasMips64 ? Mips::FGR64RegisterClass : Mips::AFGR64RegisterClass; RC = HasMips64 ? &Mips::FGR64RegClass : &Mips::AFGR64RegClass;
else else
llvm_unreachable("RegVT not supported by FormalArguments Lowering"); llvm_unreachable("RegVT not supported by FormalArguments Lowering");
@ -2859,8 +2859,9 @@ MipsTargetLowering::LowerFormalArguments(SDValue Chain,
const uint16_t *ArgRegs = IsO32 ? O32IntRegs : Mips64IntRegs; const uint16_t *ArgRegs = IsO32 ? O32IntRegs : Mips64IntRegs;
unsigned Idx = CCInfo.getFirstUnallocated(ArgRegs, NumOfRegs); unsigned Idx = CCInfo.getFirstUnallocated(ArgRegs, NumOfRegs);
int FirstRegSlotOffset = IsO32 ? 0 : -64 ; // offset of $a0's slot. int FirstRegSlotOffset = IsO32 ? 0 : -64 ; // offset of $a0's slot.
const TargetRegisterClass *RC const TargetRegisterClass *RC = IsO32 ?
= IsO32 ? Mips::CPURegsRegisterClass : Mips::CPU64RegsRegisterClass; (const TargetRegisterClass*)&Mips::CPURegsRegClass :
(const TargetRegisterClass*)&Mips::CPU64RegsRegClass;
unsigned RegSize = RC->getSize(); unsigned RegSize = RC->getSize();
int RegSlotOffset = FirstRegSlotOffset + Idx * RegSize; int RegSlotOffset = FirstRegSlotOffset + Idx * RegSize;
@ -3049,17 +3050,16 @@ getRegForInlineAsmConstraint(const std::string &Constraint, EVT VT) const
case 'y': // Same as 'r'. Exists for compatibility. case 'y': // Same as 'r'. Exists for compatibility.
case 'r': case 'r':
if (VT == MVT::i32) if (VT == MVT::i32)
return std::make_pair(0U, Mips::CPURegsRegisterClass); return std::make_pair(0U, &Mips::CPURegsRegClass);
assert(VT == MVT::i64 && "Unexpected type."); assert(VT == MVT::i64 && "Unexpected type.");
return std::make_pair(0U, Mips::CPU64RegsRegisterClass); return std::make_pair(0U, &Mips::CPU64RegsRegClass);
case 'f': case 'f':
if (VT == MVT::f32) if (VT == MVT::f32)
return std::make_pair(0U, Mips::FGR32RegisterClass); return std::make_pair(0U, &Mips::FGR32RegClass);
if ((VT == MVT::f64) && (!Subtarget->isSingleFloat())) { if ((VT == MVT::f64) && (!Subtarget->isSingleFloat())) {
if (Subtarget->isFP64bit()) if (Subtarget->isFP64bit())
return std::make_pair(0U, Mips::FGR64RegisterClass); return std::make_pair(0U, &Mips::FGR64RegClass);
else return std::make_pair(0U, &Mips::AFGR64RegClass);
return std::make_pair(0U, Mips::AFGR64RegisterClass);
} }
} }
} }

View File

@ -189,15 +189,15 @@ storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
unsigned Opc = 0; unsigned Opc = 0;
if (RC == Mips::CPURegsRegisterClass) if (RC == &Mips::CPURegsRegClass)
Opc = IsN64 ? Mips::SW_P8 : Mips::SW; Opc = IsN64 ? Mips::SW_P8 : Mips::SW;
else if (RC == Mips::CPU64RegsRegisterClass) else if (RC == &Mips::CPU64RegsRegClass)
Opc = IsN64 ? Mips::SD_P8 : Mips::SD; Opc = IsN64 ? Mips::SD_P8 : Mips::SD;
else if (RC == Mips::FGR32RegisterClass) else if (RC == &Mips::FGR32RegClass)
Opc = IsN64 ? Mips::SWC1_P8 : Mips::SWC1; Opc = IsN64 ? Mips::SWC1_P8 : Mips::SWC1;
else if (RC == Mips::AFGR64RegisterClass) else if (RC == &Mips::AFGR64RegClass)
Opc = Mips::SDC1; Opc = Mips::SDC1;
else if (RC == Mips::FGR64RegisterClass) else if (RC == &Mips::FGR64RegClass)
Opc = IsN64 ? Mips::SDC164_P8 : Mips::SDC164; Opc = IsN64 ? Mips::SDC164_P8 : Mips::SDC164;
assert(Opc && "Register class not handled!"); assert(Opc && "Register class not handled!");
@ -216,15 +216,15 @@ loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
MachineMemOperand *MMO = GetMemOperand(MBB, FI, MachineMemOperand::MOLoad); MachineMemOperand *MMO = GetMemOperand(MBB, FI, MachineMemOperand::MOLoad);
unsigned Opc = 0; unsigned Opc = 0;
if (RC == Mips::CPURegsRegisterClass) if (RC == &Mips::CPURegsRegClass)
Opc = IsN64 ? Mips::LW_P8 : Mips::LW; Opc = IsN64 ? Mips::LW_P8 : Mips::LW;
else if (RC == Mips::CPU64RegsRegisterClass) else if (RC == &Mips::CPU64RegsRegClass)
Opc = IsN64 ? Mips::LD_P8 : Mips::LD; Opc = IsN64 ? Mips::LD_P8 : Mips::LD;
else if (RC == Mips::FGR32RegisterClass) else if (RC == &Mips::FGR32RegClass)
Opc = IsN64 ? Mips::LWC1_P8 : Mips::LWC1; Opc = IsN64 ? Mips::LWC1_P8 : Mips::LWC1;
else if (RC == Mips::AFGR64RegisterClass) else if (RC == &Mips::AFGR64RegClass)
Opc = Mips::LDC1; Opc = Mips::LDC1;
else if (RC == Mips::FGR64RegisterClass) else if (RC == &Mips::FGR64RegClass)
Opc = IsN64 ? Mips::LDC164_P8 : Mips::LDC164; Opc = IsN64 ? Mips::LDC164_P8 : Mips::LDC164;
assert(Opc && "Register class not handled!"); assert(Opc && "Register class not handled!");

View File

@ -40,9 +40,9 @@ unsigned MipsFunctionInfo::getGlobalBaseReg() {
if (FixGlobalBaseReg) // $gp is the global base register. if (FixGlobalBaseReg) // $gp is the global base register.
return GlobalBaseReg = ST.isABI_N64() ? Mips::GP_64 : Mips::GP; return GlobalBaseReg = ST.isABI_N64() ? Mips::GP_64 : Mips::GP;
const TargetRegisterClass *RC; const TargetRegisterClass *RC = ST.isABI_N64() ?
RC = ST.isABI_N64() ? (const TargetRegisterClass*)&Mips::CPU64RegsRegClass :
Mips::CPU64RegsRegisterClass : Mips::CPURegsRegisterClass; (const TargetRegisterClass*)&Mips::CPURegsRegClass;
return GlobalBaseReg = MF.getRegInfo().createVirtualRegister(RC); return GlobalBaseReg = MF.getRegInfo().createVirtualRegister(RC);
} }

View File

@ -94,7 +94,7 @@ getReservedRegs(const MachineFunction &MF) const {
}; };
BitVector Reserved(getNumRegs()); BitVector Reserved(getNumRegs());
typedef TargetRegisterClass::iterator RegIter; typedef TargetRegisterClass::const_iterator RegIter;
for (unsigned I = 0; I < array_lengthof(ReservedCPURegs); ++I) for (unsigned I = 0; I < array_lengthof(ReservedCPURegs); ++I)
Reserved.set(ReservedCPURegs[I]); Reserved.set(ReservedCPURegs[I]);
@ -104,18 +104,17 @@ getReservedRegs(const MachineFunction &MF) const {
Reserved.set(ReservedCPU64Regs[I]); Reserved.set(ReservedCPU64Regs[I]);
// Reserve all registers in AFGR64. // Reserve all registers in AFGR64.
for (RegIter Reg = Mips::AFGR64RegisterClass->begin(); for (RegIter Reg = Mips::AFGR64RegClass.begin(),
Reg != Mips::AFGR64RegisterClass->end(); ++Reg) EReg = Mips::AFGR64RegClass.end(); Reg != EReg; ++Reg)
Reserved.set(*Reg); Reserved.set(*Reg);
} } else {
else {
// Reserve all registers in CPU64Regs & FGR64. // Reserve all registers in CPU64Regs & FGR64.
for (RegIter Reg = Mips::CPU64RegsRegisterClass->begin(); for (RegIter Reg = Mips::CPU64RegsRegClass.begin(),
Reg != Mips::CPU64RegsRegisterClass->end(); ++Reg) EReg = Mips::CPU64RegsRegClass.end(); Reg != EReg; ++Reg)
Reserved.set(*Reg); Reserved.set(*Reg);
for (RegIter Reg = Mips::FGR64RegisterClass->begin(); for (RegIter Reg = Mips::FGR64RegClass.begin(),
Reg != Mips::FGR64RegisterClass->end(); ++Reg) EReg = Mips::FGR64RegClass.end(); Reg != EReg; ++Reg)
Reserved.set(*Reg); Reserved.set(*Reg);
} }

View File

@ -36,12 +36,12 @@ using namespace llvm;
PTXTargetLowering::PTXTargetLowering(TargetMachine &TM) PTXTargetLowering::PTXTargetLowering(TargetMachine &TM)
: TargetLowering(TM, new TargetLoweringObjectFileELF()) { : TargetLowering(TM, new TargetLoweringObjectFileELF()) {
// Set up the register classes. // Set up the register classes.
addRegisterClass(MVT::i1, PTX::RegPredRegisterClass); addRegisterClass(MVT::i1, &PTX::RegPredRegClass);
addRegisterClass(MVT::i16, PTX::RegI16RegisterClass); addRegisterClass(MVT::i16, &PTX::RegI16RegClass);
addRegisterClass(MVT::i32, PTX::RegI32RegisterClass); addRegisterClass(MVT::i32, &PTX::RegI32RegClass);
addRegisterClass(MVT::i64, PTX::RegI64RegisterClass); addRegisterClass(MVT::i64, &PTX::RegI64RegClass);
addRegisterClass(MVT::f32, PTX::RegF32RegisterClass); addRegisterClass(MVT::f32, &PTX::RegF32RegClass);
addRegisterClass(MVT::f64, PTX::RegF64RegisterClass); addRegisterClass(MVT::f64, &PTX::RegF64RegClass);
setBooleanContents(ZeroOrOneBooleanContent); setBooleanContents(ZeroOrOneBooleanContent);
setBooleanVectorContents(ZeroOrOneBooleanContent); // FIXME: Is this correct? setBooleanVectorContents(ZeroOrOneBooleanContent); // FIXME: Is this correct?
@ -328,36 +328,30 @@ SDValue PTXTargetLowering::
} }
} else { } else {
for (unsigned i = 0, e = Outs.size(); i != e; ++i) { for (unsigned i = 0, e = Outs.size(); i != e; ++i) {
EVT RegVT = Outs[i].VT; EVT RegVT = Outs[i].VT;
const TargetRegisterClass* TRC; const TargetRegisterClass* TRC;
unsigned RegType; unsigned RegType;
// Determine which register class we need // Determine which register class we need
if (RegVT == MVT::i1) { if (RegVT == MVT::i1) {
TRC = PTX::RegPredRegisterClass; TRC = &PTX::RegPredRegClass;
RegType = PTXRegisterType::Pred; RegType = PTXRegisterType::Pred;
} } else if (RegVT == MVT::i16) {
else if (RegVT == MVT::i16) { TRC = &PTX::RegI16RegClass;
TRC = PTX::RegI16RegisterClass;
RegType = PTXRegisterType::B16; RegType = PTXRegisterType::B16;
} } else if (RegVT == MVT::i32) {
else if (RegVT == MVT::i32) { TRC = &PTX::RegI32RegClass;
TRC = PTX::RegI32RegisterClass;
RegType = PTXRegisterType::B32; RegType = PTXRegisterType::B32;
} } else if (RegVT == MVT::i64) {
else if (RegVT == MVT::i64) { TRC = &PTX::RegI64RegClass;
TRC = PTX::RegI64RegisterClass;
RegType = PTXRegisterType::B64; RegType = PTXRegisterType::B64;
} } else if (RegVT == MVT::f32) {
else if (RegVT == MVT::f32) { TRC = &PTX::RegF32RegClass;
TRC = PTX::RegF32RegisterClass;
RegType = PTXRegisterType::F32; RegType = PTXRegisterType::F32;
} } else if (RegVT == MVT::f64) {
else if (RegVT == MVT::f64) { TRC = &PTX::RegF64RegClass;
TRC = PTX::RegF64RegisterClass;
RegType = PTXRegisterType::F64; RegType = PTXRegisterType::F64;
} } else {
else {
llvm_unreachable("Unknown parameter type"); llvm_unreachable("Unknown parameter type");
} }

View File

@ -59,17 +59,17 @@ bool PTXMFInfoExtract::runOnMachineFunction(MachineFunction &MF) {
unsigned Reg = TargetRegisterInfo::index2VirtReg(i); unsigned Reg = TargetRegisterInfo::index2VirtReg(i);
const TargetRegisterClass *TRC = MRI.getRegClass(Reg); const TargetRegisterClass *TRC = MRI.getRegClass(Reg);
unsigned RegType; unsigned RegType;
if (TRC == PTX::RegPredRegisterClass) if (TRC == &PTX::RegPredRegClass)
RegType = PTXRegisterType::Pred; RegType = PTXRegisterType::Pred;
else if (TRC == PTX::RegI16RegisterClass) else if (TRC == &PTX::RegI16RegClass)
RegType = PTXRegisterType::B16; RegType = PTXRegisterType::B16;
else if (TRC == PTX::RegI32RegisterClass) else if (TRC == &PTX::RegI32RegClass)
RegType = PTXRegisterType::B32; RegType = PTXRegisterType::B32;
else if (TRC == PTX::RegI64RegisterClass) else if (TRC == &PTX::RegI64RegClass)
RegType = PTXRegisterType::B64; RegType = PTXRegisterType::B64;
else if (TRC == PTX::RegF32RegisterClass) else if (TRC == &PTX::RegF32RegClass)
RegType = PTXRegisterType::F32; RegType = PTXRegisterType::F32;
else if (TRC == PTX::RegF64RegisterClass) else if (TRC == &PTX::RegF64RegClass)
RegType = PTXRegisterType::F64; RegType = PTXRegisterType::F64;
else else
llvm_unreachable("Unkown register class."); llvm_unreachable("Unkown register class.");

View File

@ -341,7 +341,7 @@ XCoreFrameLowering::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
MachineFrameInfo *MFI = MF.getFrameInfo(); MachineFrameInfo *MFI = MF.getFrameInfo();
const TargetRegisterInfo *RegInfo = MF.getTarget().getRegisterInfo(); const TargetRegisterInfo *RegInfo = MF.getTarget().getRegisterInfo();
bool LRUsed = MF.getRegInfo().isPhysRegUsed(XCore::LR); bool LRUsed = MF.getRegInfo().isPhysRegUsed(XCore::LR);
const TargetRegisterClass *RC = XCore::GRRegsRegisterClass; const TargetRegisterClass *RC = &XCore::GRRegsRegClass;
XCoreFunctionInfo *XFI = MF.getInfo<XCoreFunctionInfo>(); XCoreFunctionInfo *XFI = MF.getInfo<XCoreFunctionInfo>();
if (LRUsed) { if (LRUsed) {
MF.getRegInfo().setPhysRegUnused(XCore::LR); MF.getRegInfo().setPhysRegUnused(XCore::LR);

View File

@ -66,7 +66,7 @@ XCoreTargetLowering::XCoreTargetLowering(XCoreTargetMachine &XTM)
Subtarget(*XTM.getSubtargetImpl()) { Subtarget(*XTM.getSubtargetImpl()) {
// Set up the register classes. // Set up the register classes.
addRegisterClass(MVT::i32, XCore::GRRegsRegisterClass); addRegisterClass(MVT::i32, &XCore::GRRegsRegClass);
// Compute derived properties from the register classes // Compute derived properties from the register classes
computeRegisterProperties(); computeRegisterProperties();
@ -1121,8 +1121,7 @@ XCoreTargetLowering::LowerCCCArguments(SDValue Chain,
llvm_unreachable(0); llvm_unreachable(0);
} }
case MVT::i32: case MVT::i32:
unsigned VReg = RegInfo.createVirtualRegister( unsigned VReg = RegInfo.createVirtualRegister(&XCore::GRRegsRegClass);
XCore::GRRegsRegisterClass);
RegInfo.addLiveIn(VA.getLocReg(), VReg); RegInfo.addLiveIn(VA.getLocReg(), VReg);
InVals.push_back(DAG.getCopyFromReg(Chain, dl, VReg, RegVT)); InVals.push_back(DAG.getCopyFromReg(Chain, dl, VReg, RegVT));
} }
@ -1172,8 +1171,7 @@ XCoreTargetLowering::LowerCCCArguments(SDValue Chain,
offset -= StackSlotSize; offset -= StackSlotSize;
SDValue FIN = DAG.getFrameIndex(FI, MVT::i32); SDValue FIN = DAG.getFrameIndex(FI, MVT::i32);
// Move argument from phys reg -> virt reg // Move argument from phys reg -> virt reg
unsigned VReg = RegInfo.createVirtualRegister( unsigned VReg = RegInfo.createVirtualRegister(&XCore::GRRegsRegClass);
XCore::GRRegsRegisterClass);
RegInfo.addLiveIn(ArgRegs[i], VReg); RegInfo.addLiveIn(ArgRegs[i], VReg);
SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i32); SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i32);
// Move argument from virt reg -> stack // Move argument from virt reg -> stack
@ -1611,7 +1609,7 @@ getRegForInlineAsmConstraint(const std::string &Constraint,
switch (Constraint[0]) { switch (Constraint[0]) {
default : break; default : break;
case 'r': case 'r':
return std::make_pair(0U, XCore::GRRegsRegisterClass); return std::make_pair(0U, &XCore::GRRegsRegClass);
} }
} }
// Use the default implementation in TargetLowering to convert the register // Use the default implementation in TargetLowering to convert the register

View File

@ -205,8 +205,7 @@ XCoreRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
unsigned Reg = MI.getOperand(0).getReg(); unsigned Reg = MI.getOperand(0).getReg();
bool isKill = MI.getOpcode() == XCore::STWFI && MI.getOperand(0).isKill(); bool isKill = MI.getOpcode() == XCore::STWFI && MI.getOperand(0).isKill();
assert(XCore::GRRegsRegisterClass->contains(Reg) && assert(XCore::GRRegsRegClass.contains(Reg) && "Unexpected register operand");
"Unexpected register operand");
MachineBasicBlock &MBB = *MI.getParent(); MachineBasicBlock &MBB = *MI.getParent();
@ -217,7 +216,7 @@ XCoreRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
if (!RS) if (!RS)
report_fatal_error("eliminateFrameIndex Frame size too big: " + report_fatal_error("eliminateFrameIndex Frame size too big: " +
Twine(Offset)); Twine(Offset));
unsigned ScratchReg = RS->scavengeRegister(XCore::GRRegsRegisterClass, II, unsigned ScratchReg = RS->scavengeRegister(&XCore::GRRegsRegClass, II,
SPAdj); SPAdj);
loadConstant(MBB, II, ScratchReg, Offset, dl); loadConstant(MBB, II, ScratchReg, Offset, dl);
switch (MI.getOpcode()) { switch (MI.getOpcode()) {