mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-31 10:34:17 +00:00
Reset the subtarget for DAGToDAG on every iteration of runOnMachineFunction.
This required updating the generated functions and TD file accordingly to be pointers rather than const references. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209375 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
162180cba5
commit
58d9172bb4
@ -86,7 +86,7 @@ class PPCFastISel final : public FastISel {
|
|||||||
const TargetMachine &TM;
|
const TargetMachine &TM;
|
||||||
const TargetInstrInfo &TII;
|
const TargetInstrInfo &TII;
|
||||||
const TargetLowering &TLI;
|
const TargetLowering &TLI;
|
||||||
const PPCSubtarget &PPCSubTarget;
|
const PPCSubtarget *PPCSubTarget;
|
||||||
LLVMContext *Context;
|
LLVMContext *Context;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -96,9 +96,7 @@ class PPCFastISel final : public FastISel {
|
|||||||
TM(FuncInfo.MF->getTarget()),
|
TM(FuncInfo.MF->getTarget()),
|
||||||
TII(*TM.getInstrInfo()),
|
TII(*TM.getInstrInfo()),
|
||||||
TLI(*TM.getTargetLowering()),
|
TLI(*TM.getTargetLowering()),
|
||||||
PPCSubTarget(
|
PPCSubTarget(&TM.getSubtarget<PPCSubtarget>()),
|
||||||
*((static_cast<const PPCTargetMachine *>(&TM))->getSubtargetImpl())
|
|
||||||
),
|
|
||||||
Context(&FuncInfo.Fn->getContext()) { }
|
Context(&FuncInfo.Fn->getContext()) { }
|
||||||
|
|
||||||
// Backend specific FastISel code.
|
// Backend specific FastISel code.
|
||||||
@ -740,7 +738,7 @@ bool PPCFastISel::PPCEmitCmp(const Value *SrcValue1, const Value *SrcValue2,
|
|||||||
return false;
|
return false;
|
||||||
MVT SrcVT = SrcEVT.getSimpleVT();
|
MVT SrcVT = SrcEVT.getSimpleVT();
|
||||||
|
|
||||||
if (SrcVT == MVT::i1 && PPCSubTarget.useCRBits())
|
if (SrcVT == MVT::i1 && PPCSubTarget->useCRBits())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// See if operand 2 is an immediate encodeable in the compare.
|
// See if operand 2 is an immediate encodeable in the compare.
|
||||||
@ -901,7 +899,7 @@ unsigned PPCFastISel::PPCMoveToFPReg(MVT SrcVT, unsigned SrcReg,
|
|||||||
if (!IsSigned) {
|
if (!IsSigned) {
|
||||||
LoadOpc = PPC::LFIWZX;
|
LoadOpc = PPC::LFIWZX;
|
||||||
Addr.Offset = 4;
|
Addr.Offset = 4;
|
||||||
} else if (PPCSubTarget.hasLFIWAX()) {
|
} else if (PPCSubTarget->hasLFIWAX()) {
|
||||||
LoadOpc = PPC::LFIWAX;
|
LoadOpc = PPC::LFIWAX;
|
||||||
Addr.Offset = 4;
|
Addr.Offset = 4;
|
||||||
}
|
}
|
||||||
@ -942,7 +940,7 @@ bool PPCFastISel::SelectIToFP(const Instruction *I, bool IsSigned) {
|
|||||||
|
|
||||||
// We can only lower an unsigned convert if we have the newer
|
// We can only lower an unsigned convert if we have the newer
|
||||||
// floating-point conversion operations.
|
// floating-point conversion operations.
|
||||||
if (!IsSigned && !PPCSubTarget.hasFPCVT())
|
if (!IsSigned && !PPCSubTarget->hasFPCVT())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// FIXME: For now we require the newer floating-point conversion operations
|
// FIXME: For now we require the newer floating-point conversion operations
|
||||||
@ -950,7 +948,7 @@ bool PPCFastISel::SelectIToFP(const Instruction *I, bool IsSigned) {
|
|||||||
// to single-precision float. Otherwise we have to generate a lot of
|
// to single-precision float. Otherwise we have to generate a lot of
|
||||||
// fiddly code to avoid double rounding. If necessary, the fiddly code
|
// fiddly code to avoid double rounding. If necessary, the fiddly code
|
||||||
// can be found in PPCTargetLowering::LowerINT_TO_FP().
|
// can be found in PPCTargetLowering::LowerINT_TO_FP().
|
||||||
if (DstVT == MVT::f32 && !PPCSubTarget.hasFPCVT())
|
if (DstVT == MVT::f32 && !PPCSubTarget->hasFPCVT())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Extend the input if necessary.
|
// Extend the input if necessary.
|
||||||
@ -1065,7 +1063,7 @@ bool PPCFastISel::SelectFPToI(const Instruction *I, bool IsSigned) {
|
|||||||
if (IsSigned)
|
if (IsSigned)
|
||||||
Opc = PPC::FCTIWZ;
|
Opc = PPC::FCTIWZ;
|
||||||
else
|
else
|
||||||
Opc = PPCSubTarget.hasFPCVT() ? PPC::FCTIWUZ : PPC::FCTIDZ;
|
Opc = PPCSubTarget->hasFPCVT() ? PPC::FCTIWUZ : PPC::FCTIDZ;
|
||||||
else
|
else
|
||||||
Opc = IsSigned ? PPC::FCTIDZ : PPC::FCTIDUZ;
|
Opc = IsSigned ? PPC::FCTIDZ : PPC::FCTIDUZ;
|
||||||
|
|
||||||
@ -2002,7 +2000,7 @@ unsigned PPCFastISel::PPCMaterialize64BitInt(int64_t Imm,
|
|||||||
unsigned PPCFastISel::PPCMaterializeInt(const Constant *C, MVT VT) {
|
unsigned PPCFastISel::PPCMaterializeInt(const Constant *C, MVT VT) {
|
||||||
// If we're using CR bit registers for i1 values, handle that as a special
|
// If we're using CR bit registers for i1 values, handle that as a special
|
||||||
// case first.
|
// case first.
|
||||||
if (VT == MVT::i1 && PPCSubTarget.useCRBits()) {
|
if (VT == MVT::i1 && PPCSubTarget->useCRBits()) {
|
||||||
const ConstantInt *CI = cast<ConstantInt>(C);
|
const ConstantInt *CI = cast<ConstantInt>(C);
|
||||||
unsigned ImmReg = createResultReg(&PPC::CRBITRCRegClass);
|
unsigned ImmReg = createResultReg(&PPC::CRBITRCRegClass);
|
||||||
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
|
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
|
||||||
@ -2176,7 +2174,7 @@ unsigned PPCFastISel::FastEmit_i(MVT Ty, MVT VT, unsigned Opc, uint64_t Imm) {
|
|||||||
|
|
||||||
// If we're using CR bit registers for i1 values, handle that as a special
|
// If we're using CR bit registers for i1 values, handle that as a special
|
||||||
// case first.
|
// case first.
|
||||||
if (VT == MVT::i1 && PPCSubTarget.useCRBits()) {
|
if (VT == MVT::i1 && PPCSubTarget->useCRBits()) {
|
||||||
unsigned ImmReg = createResultReg(&PPC::CRBITRCRegClass);
|
unsigned ImmReg = createResultReg(&PPC::CRBITRCRegClass);
|
||||||
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
|
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
|
||||||
TII.get(Imm == 0 ? PPC::CRUNSET : PPC::CRSET), ImmReg);
|
TII.get(Imm == 0 ? PPC::CRUNSET : PPC::CRSET), ImmReg);
|
||||||
|
@ -51,23 +51,25 @@ namespace {
|
|||||||
///
|
///
|
||||||
class PPCDAGToDAGISel : public SelectionDAGISel {
|
class PPCDAGToDAGISel : public SelectionDAGISel {
|
||||||
const PPCTargetMachine &TM;
|
const PPCTargetMachine &TM;
|
||||||
const PPCTargetLowering &PPCLowering;
|
const PPCTargetLowering *PPCLowering;
|
||||||
const PPCSubtarget &PPCSubTarget;
|
const PPCSubtarget *PPCSubTarget;
|
||||||
unsigned GlobalBaseReg;
|
unsigned GlobalBaseReg;
|
||||||
public:
|
public:
|
||||||
explicit PPCDAGToDAGISel(PPCTargetMachine &tm)
|
explicit PPCDAGToDAGISel(PPCTargetMachine &tm)
|
||||||
: SelectionDAGISel(tm), TM(tm),
|
: SelectionDAGISel(tm), TM(tm),
|
||||||
PPCLowering(*TM.getTargetLowering()),
|
PPCLowering(TM.getTargetLowering()),
|
||||||
PPCSubTarget(*TM.getSubtargetImpl()) {
|
PPCSubTarget(TM.getSubtargetImpl()) {
|
||||||
initializePPCDAGToDAGISelPass(*PassRegistry::getPassRegistry());
|
initializePPCDAGToDAGISelPass(*PassRegistry::getPassRegistry());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool runOnMachineFunction(MachineFunction &MF) override {
|
bool runOnMachineFunction(MachineFunction &MF) override {
|
||||||
// Make sure we re-emit a set of the global base reg if necessary
|
// Make sure we re-emit a set of the global base reg if necessary
|
||||||
GlobalBaseReg = 0;
|
GlobalBaseReg = 0;
|
||||||
|
PPCLowering = TM.getTargetLowering();
|
||||||
|
PPCSubTarget = TM.getSubtargetImpl();
|
||||||
SelectionDAGISel::runOnMachineFunction(MF);
|
SelectionDAGISel::runOnMachineFunction(MF);
|
||||||
|
|
||||||
if (!PPCSubTarget.isSVR4ABI())
|
if (!PPCSubTarget->isSVR4ABI())
|
||||||
InsertVRSaveCode(MF);
|
InsertVRSaveCode(MF);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -89,7 +91,7 @@ namespace {
|
|||||||
|
|
||||||
/// getSmallIPtrImm - Return a target constant of pointer type.
|
/// getSmallIPtrImm - Return a target constant of pointer type.
|
||||||
inline SDValue getSmallIPtrImm(unsigned Imm) {
|
inline SDValue getSmallIPtrImm(unsigned Imm) {
|
||||||
return CurDAG->getTargetConstant(Imm, PPCLowering.getPointerTy());
|
return CurDAG->getTargetConstant(Imm, PPCLowering->getPointerTy());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isRunOfOnes - Returns true iff Val consists of one contiguous run of 1s
|
/// isRunOfOnes - Returns true iff Val consists of one contiguous run of 1s
|
||||||
@ -122,7 +124,7 @@ namespace {
|
|||||||
/// a base register plus a signed 16-bit displacement [r+imm].
|
/// a base register plus a signed 16-bit displacement [r+imm].
|
||||||
bool SelectAddrImm(SDValue N, SDValue &Disp,
|
bool SelectAddrImm(SDValue N, SDValue &Disp,
|
||||||
SDValue &Base) {
|
SDValue &Base) {
|
||||||
return PPCLowering.SelectAddressRegImm(N, Disp, Base, *CurDAG, false);
|
return PPCLowering->SelectAddressRegImm(N, Disp, Base, *CurDAG, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SelectAddrImmOffs - Return true if the operand is valid for a preinc
|
/// SelectAddrImmOffs - Return true if the operand is valid for a preinc
|
||||||
@ -142,20 +144,20 @@ namespace {
|
|||||||
/// represented as an indexed [r+r] operation. Returns false if it can
|
/// represented as an indexed [r+r] operation. Returns false if it can
|
||||||
/// be represented by [r+imm], which are preferred.
|
/// be represented by [r+imm], which are preferred.
|
||||||
bool SelectAddrIdx(SDValue N, SDValue &Base, SDValue &Index) {
|
bool SelectAddrIdx(SDValue N, SDValue &Base, SDValue &Index) {
|
||||||
return PPCLowering.SelectAddressRegReg(N, Base, Index, *CurDAG);
|
return PPCLowering->SelectAddressRegReg(N, Base, Index, *CurDAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SelectAddrIdxOnly - Given the specified addressed, force it to be
|
/// SelectAddrIdxOnly - Given the specified addressed, force it to be
|
||||||
/// represented as an indexed [r+r] operation.
|
/// represented as an indexed [r+r] operation.
|
||||||
bool SelectAddrIdxOnly(SDValue N, SDValue &Base, SDValue &Index) {
|
bool SelectAddrIdxOnly(SDValue N, SDValue &Base, SDValue &Index) {
|
||||||
return PPCLowering.SelectAddressRegRegOnly(N, Base, Index, *CurDAG);
|
return PPCLowering->SelectAddressRegRegOnly(N, Base, Index, *CurDAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SelectAddrImmX4 - Returns true if the address N can be represented by
|
/// SelectAddrImmX4 - Returns true if the address N can be represented by
|
||||||
/// a base register plus a signed 16-bit displacement that is a multiple of 4.
|
/// a base register plus a signed 16-bit displacement that is a multiple of 4.
|
||||||
/// Suitable for use by STD and friends.
|
/// Suitable for use by STD and friends.
|
||||||
bool SelectAddrImmX4(SDValue N, SDValue &Disp, SDValue &Base) {
|
bool SelectAddrImmX4(SDValue N, SDValue &Disp, SDValue &Base) {
|
||||||
return PPCLowering.SelectAddressRegImm(N, Disp, Base, *CurDAG, true);
|
return PPCLowering->SelectAddressRegImm(N, Disp, Base, *CurDAG, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select an address into a single register.
|
// Select an address into a single register.
|
||||||
@ -272,7 +274,7 @@ SDNode *PPCDAGToDAGISel::getGlobalBaseReg() {
|
|||||||
MachineBasicBlock::iterator MBBI = FirstMBB.begin();
|
MachineBasicBlock::iterator MBBI = FirstMBB.begin();
|
||||||
DebugLoc dl;
|
DebugLoc dl;
|
||||||
|
|
||||||
if (PPCLowering.getPointerTy() == MVT::i32) {
|
if (PPCLowering->getPointerTy() == MVT::i32) {
|
||||||
GlobalBaseReg = RegInfo->createVirtualRegister(&PPC::GPRC_NOR0RegClass);
|
GlobalBaseReg = RegInfo->createVirtualRegister(&PPC::GPRC_NOR0RegClass);
|
||||||
BuildMI(FirstMBB, MBBI, dl, TII.get(PPC::MovePCtoLR));
|
BuildMI(FirstMBB, MBBI, dl, TII.get(PPC::MovePCtoLR));
|
||||||
BuildMI(FirstMBB, MBBI, dl, TII.get(PPC::MFLR), GlobalBaseReg);
|
BuildMI(FirstMBB, MBBI, dl, TII.get(PPC::MFLR), GlobalBaseReg);
|
||||||
@ -283,7 +285,7 @@ SDNode *PPCDAGToDAGISel::getGlobalBaseReg() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CurDAG->getRegister(GlobalBaseReg,
|
return CurDAG->getRegister(GlobalBaseReg,
|
||||||
PPCLowering.getPointerTy()).getNode();
|
PPCLowering->getPointerTy()).getNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isIntS16Immediate - This method tests to see if the node is either a 32-bit
|
/// isIntS16Immediate - This method tests to see if the node is either a 32-bit
|
||||||
@ -580,7 +582,7 @@ SDValue PPCDAGToDAGISel::SelectCC(SDValue LHS, SDValue RHS,
|
|||||||
Opc = PPC::FCMPUS;
|
Opc = PPC::FCMPUS;
|
||||||
} else {
|
} else {
|
||||||
assert(LHS.getValueType() == MVT::f64 && "Unknown vt!");
|
assert(LHS.getValueType() == MVT::f64 && "Unknown vt!");
|
||||||
Opc = PPCSubTarget.hasVSX() ? PPC::XSCMPUDP : PPC::FCMPUD;
|
Opc = PPCSubTarget->hasVSX() ? PPC::XSCMPUDP : PPC::FCMPUD;
|
||||||
}
|
}
|
||||||
return SDValue(CurDAG->getMachineNode(Opc, dl, MVT::i32, LHS, RHS), 0);
|
return SDValue(CurDAG->getMachineNode(Opc, dl, MVT::i32, LHS, RHS), 0);
|
||||||
}
|
}
|
||||||
@ -746,7 +748,7 @@ SDNode *PPCDAGToDAGISel::SelectSETCC(SDNode *N) {
|
|||||||
EVT PtrVT = CurDAG->getTargetLoweringInfo().getPointerTy();
|
EVT PtrVT = CurDAG->getTargetLoweringInfo().getPointerTy();
|
||||||
bool isPPC64 = (PtrVT == MVT::i64);
|
bool isPPC64 = (PtrVT == MVT::i64);
|
||||||
|
|
||||||
if (!PPCSubTarget.useCRBits() &&
|
if (!PPCSubTarget->useCRBits() &&
|
||||||
isInt32Immediate(N->getOperand(1), Imm)) {
|
isInt32Immediate(N->getOperand(1), Imm)) {
|
||||||
// We can codegen setcc op, imm very efficiently compared to a brcond.
|
// We can codegen setcc op, imm very efficiently compared to a brcond.
|
||||||
// Check for those cases here.
|
// Check for those cases here.
|
||||||
@ -828,7 +830,7 @@ SDNode *PPCDAGToDAGISel::SelectSETCC(SDNode *N) {
|
|||||||
if (LHS.getValueType().isVector()) {
|
if (LHS.getValueType().isVector()) {
|
||||||
EVT VecVT = LHS.getValueType();
|
EVT VecVT = LHS.getValueType();
|
||||||
MVT::SimpleValueType VT = VecVT.getSimpleVT().SimpleTy;
|
MVT::SimpleValueType VT = VecVT.getSimpleVT().SimpleTy;
|
||||||
unsigned int VCmpInst = getVCmpInst(VT, CC, PPCSubTarget.hasVSX());
|
unsigned int VCmpInst = getVCmpInst(VT, CC, PPCSubTarget->hasVSX());
|
||||||
|
|
||||||
switch (CC) {
|
switch (CC) {
|
||||||
case ISD::SETEQ:
|
case ISD::SETEQ:
|
||||||
@ -839,7 +841,7 @@ SDNode *PPCDAGToDAGISel::SelectSETCC(SDNode *N) {
|
|||||||
case ISD::SETONE:
|
case ISD::SETONE:
|
||||||
case ISD::SETUNE: {
|
case ISD::SETUNE: {
|
||||||
SDValue VCmp(CurDAG->getMachineNode(VCmpInst, dl, VecVT, LHS, RHS), 0);
|
SDValue VCmp(CurDAG->getMachineNode(VCmpInst, dl, VecVT, LHS, RHS), 0);
|
||||||
return CurDAG->SelectNodeTo(N, PPCSubTarget.hasVSX() ? PPC::XXLNOR :
|
return CurDAG->SelectNodeTo(N, PPCSubTarget->hasVSX() ? PPC::XXLNOR :
|
||||||
PPC::VNOR,
|
PPC::VNOR,
|
||||||
VecVT, VCmp, VCmp);
|
VecVT, VCmp, VCmp);
|
||||||
}
|
}
|
||||||
@ -861,9 +863,9 @@ SDNode *PPCDAGToDAGISel::SelectSETCC(SDNode *N) {
|
|||||||
return CurDAG->SelectNodeTo(N, VCmpInst, VecVT, LHS, RHS);
|
return CurDAG->SelectNodeTo(N, VCmpInst, VecVT, LHS, RHS);
|
||||||
} else {
|
} else {
|
||||||
SDValue VCmpGT(CurDAG->getMachineNode(VCmpInst, dl, VecVT, LHS, RHS), 0);
|
SDValue VCmpGT(CurDAG->getMachineNode(VCmpInst, dl, VecVT, LHS, RHS), 0);
|
||||||
unsigned int VCmpEQInst = getVCmpEQInst(VT, PPCSubTarget.hasVSX());
|
unsigned int VCmpEQInst = getVCmpEQInst(VT, PPCSubTarget->hasVSX());
|
||||||
SDValue VCmpEQ(CurDAG->getMachineNode(VCmpEQInst, dl, VecVT, LHS, RHS), 0);
|
SDValue VCmpEQ(CurDAG->getMachineNode(VCmpEQInst, dl, VecVT, LHS, RHS), 0);
|
||||||
return CurDAG->SelectNodeTo(N, PPCSubTarget.hasVSX() ? PPC::XXLOR :
|
return CurDAG->SelectNodeTo(N, PPCSubTarget->hasVSX() ? PPC::XXLOR :
|
||||||
PPC::VOR,
|
PPC::VOR,
|
||||||
VecVT, VCmpGT, VCmpEQ);
|
VecVT, VCmpGT, VCmpEQ);
|
||||||
}
|
}
|
||||||
@ -872,9 +874,9 @@ SDNode *PPCDAGToDAGISel::SelectSETCC(SDNode *N) {
|
|||||||
case ISD::SETOLE:
|
case ISD::SETOLE:
|
||||||
case ISD::SETULE: {
|
case ISD::SETULE: {
|
||||||
SDValue VCmpLE(CurDAG->getMachineNode(VCmpInst, dl, VecVT, RHS, LHS), 0);
|
SDValue VCmpLE(CurDAG->getMachineNode(VCmpInst, dl, VecVT, RHS, LHS), 0);
|
||||||
unsigned int VCmpEQInst = getVCmpEQInst(VT, PPCSubTarget.hasVSX());
|
unsigned int VCmpEQInst = getVCmpEQInst(VT, PPCSubTarget->hasVSX());
|
||||||
SDValue VCmpEQ(CurDAG->getMachineNode(VCmpEQInst, dl, VecVT, LHS, RHS), 0);
|
SDValue VCmpEQ(CurDAG->getMachineNode(VCmpEQInst, dl, VecVT, LHS, RHS), 0);
|
||||||
return CurDAG->SelectNodeTo(N, PPCSubTarget.hasVSX() ? PPC::XXLOR :
|
return CurDAG->SelectNodeTo(N, PPCSubTarget->hasVSX() ? PPC::XXLOR :
|
||||||
PPC::VOR,
|
PPC::VOR,
|
||||||
VecVT, VCmpLE, VCmpEQ);
|
VecVT, VCmpLE, VCmpEQ);
|
||||||
}
|
}
|
||||||
@ -883,7 +885,7 @@ SDNode *PPCDAGToDAGISel::SelectSETCC(SDNode *N) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PPCSubTarget.useCRBits())
|
if (PPCSubTarget->useCRBits())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
bool Inv;
|
bool Inv;
|
||||||
@ -1101,7 +1103,7 @@ SDNode *PPCDAGToDAGISel::Select(SDNode *N) {
|
|||||||
SDValue Base = LD->getBasePtr();
|
SDValue Base = LD->getBasePtr();
|
||||||
SDValue Ops[] = { Offset, Base, Chain };
|
SDValue Ops[] = { Offset, Base, Chain };
|
||||||
return CurDAG->getMachineNode(Opcode, dl, LD->getValueType(0),
|
return CurDAG->getMachineNode(Opcode, dl, LD->getValueType(0),
|
||||||
PPCLowering.getPointerTy(),
|
PPCLowering->getPointerTy(),
|
||||||
MVT::Other, Ops);
|
MVT::Other, Ops);
|
||||||
} else {
|
} else {
|
||||||
unsigned Opcode;
|
unsigned Opcode;
|
||||||
@ -1136,7 +1138,7 @@ SDNode *PPCDAGToDAGISel::Select(SDNode *N) {
|
|||||||
SDValue Base = LD->getBasePtr();
|
SDValue Base = LD->getBasePtr();
|
||||||
SDValue Ops[] = { Base, Offset, Chain };
|
SDValue Ops[] = { Base, Offset, Chain };
|
||||||
return CurDAG->getMachineNode(Opcode, dl, LD->getValueType(0),
|
return CurDAG->getMachineNode(Opcode, dl, LD->getValueType(0),
|
||||||
PPCLowering.getPointerTy(),
|
PPCLowering->getPointerTy(),
|
||||||
MVT::Other, Ops);
|
MVT::Other, Ops);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1267,7 +1269,7 @@ SDNode *PPCDAGToDAGISel::Select(SDNode *N) {
|
|||||||
bool isPPC64 = (PtrVT == MVT::i64);
|
bool isPPC64 = (PtrVT == MVT::i64);
|
||||||
|
|
||||||
// If this is a select of i1 operands, we'll pattern match it.
|
// If this is a select of i1 operands, we'll pattern match it.
|
||||||
if (PPCSubTarget.useCRBits() &&
|
if (PPCSubTarget->useCRBits() &&
|
||||||
N->getOperand(0).getValueType() == MVT::i1)
|
N->getOperand(0).getValueType() == MVT::i1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1338,14 +1340,14 @@ SDNode *PPCDAGToDAGISel::Select(SDNode *N) {
|
|||||||
return CurDAG->SelectNodeTo(N, SelectCCOp, N->getValueType(0), Ops);
|
return CurDAG->SelectNodeTo(N, SelectCCOp, N->getValueType(0), Ops);
|
||||||
}
|
}
|
||||||
case ISD::VSELECT:
|
case ISD::VSELECT:
|
||||||
if (PPCSubTarget.hasVSX()) {
|
if (PPCSubTarget->hasVSX()) {
|
||||||
SDValue Ops[] = { N->getOperand(2), N->getOperand(1), N->getOperand(0) };
|
SDValue Ops[] = { N->getOperand(2), N->getOperand(1), N->getOperand(0) };
|
||||||
return CurDAG->SelectNodeTo(N, PPC::XXSEL, N->getValueType(0), Ops);
|
return CurDAG->SelectNodeTo(N, PPC::XXSEL, N->getValueType(0), Ops);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ISD::VECTOR_SHUFFLE:
|
case ISD::VECTOR_SHUFFLE:
|
||||||
if (PPCSubTarget.hasVSX() && (N->getValueType(0) == MVT::v2f64 ||
|
if (PPCSubTarget->hasVSX() && (N->getValueType(0) == MVT::v2f64 ||
|
||||||
N->getValueType(0) == MVT::v2i64)) {
|
N->getValueType(0) == MVT::v2i64)) {
|
||||||
ShuffleVectorSDNode *SVN = cast<ShuffleVectorSDNode>(N);
|
ShuffleVectorSDNode *SVN = cast<ShuffleVectorSDNode>(N);
|
||||||
|
|
||||||
@ -1383,7 +1385,7 @@ SDNode *PPCDAGToDAGISel::Select(SDNode *N) {
|
|||||||
break;
|
break;
|
||||||
case PPCISD::BDNZ:
|
case PPCISD::BDNZ:
|
||||||
case PPCISD::BDZ: {
|
case PPCISD::BDZ: {
|
||||||
bool IsPPC64 = PPCSubTarget.isPPC64();
|
bool IsPPC64 = PPCSubTarget->isPPC64();
|
||||||
SDValue Ops[] = { N->getOperand(1), N->getOperand(0) };
|
SDValue Ops[] = { N->getOperand(1), N->getOperand(0) };
|
||||||
return CurDAG->SelectNodeTo(N, N->getOpcode() == PPCISD::BDNZ ?
|
return CurDAG->SelectNodeTo(N, N->getOpcode() == PPCISD::BDNZ ?
|
||||||
(IsPPC64 ? PPC::BDNZ8 : PPC::BDNZ) :
|
(IsPPC64 ? PPC::BDNZ8 : PPC::BDNZ) :
|
||||||
@ -1443,7 +1445,7 @@ SDNode *PPCDAGToDAGISel::Select(SDNode *N) {
|
|||||||
return CurDAG->SelectNodeTo(N, Reg, MVT::Other, Chain);
|
return CurDAG->SelectNodeTo(N, Reg, MVT::Other, Chain);
|
||||||
}
|
}
|
||||||
case PPCISD::TOC_ENTRY: {
|
case PPCISD::TOC_ENTRY: {
|
||||||
assert (PPCSubTarget.isPPC64() && "Only supported for 64-bit ABI");
|
assert (PPCSubTarget->isPPC64() && "Only supported for 64-bit ABI");
|
||||||
|
|
||||||
// For medium and large code model, we generate two instructions as
|
// For medium and large code model, we generate two instructions as
|
||||||
// described below. Otherwise we allow SelectCodeCommon to handle this,
|
// described below. Otherwise we allow SelectCodeCommon to handle this,
|
||||||
@ -1583,7 +1585,7 @@ void PPCDAGToDAGISel::PostprocessISelDAG() {
|
|||||||
// containing zero.
|
// containing zero.
|
||||||
bool PPCDAGToDAGISel::AllUsersSelectZero(SDNode *N) {
|
bool PPCDAGToDAGISel::AllUsersSelectZero(SDNode *N) {
|
||||||
// If we're not using isel, then this does not matter.
|
// If we're not using isel, then this does not matter.
|
||||||
if (!PPCSubTarget.hasISEL())
|
if (!PPCSubTarget->hasISEL())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (SDNode::use_iterator UI = N->use_begin(), UE = N->use_end();
|
for (SDNode::use_iterator UI = N->use_begin(), UE = N->use_end();
|
||||||
@ -2045,7 +2047,7 @@ void PPCDAGToDAGISel::PeepholeCROps() {
|
|||||||
|
|
||||||
void PPCDAGToDAGISel::PeepholePPC64() {
|
void PPCDAGToDAGISel::PeepholePPC64() {
|
||||||
// These optimizations are currently supported only for 64-bit SVR4.
|
// These optimizations are currently supported only for 64-bit SVR4.
|
||||||
if (PPCSubTarget.isDarwin() || !PPCSubTarget.isPPC64())
|
if (PPCSubTarget->isDarwin() || !PPCSubTarget->isPPC64())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SelectionDAG::allnodes_iterator Position(CurDAG->getRoot().getNode());
|
SelectionDAG::allnodes_iterator Position(CurDAG->getRoot().getNode());
|
||||||
|
@ -223,7 +223,7 @@ class VX2_Int_Ty2<bits<11> xo, string opc, Intrinsic IntID, ValueType OutTy,
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Instruction Definitions.
|
// Instruction Definitions.
|
||||||
|
|
||||||
def HasAltivec : Predicate<"PPCSubTarget.hasAltivec()">;
|
def HasAltivec : Predicate<"PPCSubTarget->hasAltivec()">;
|
||||||
let Predicates = [HasAltivec] in {
|
let Predicates = [HasAltivec] in {
|
||||||
|
|
||||||
let isCodeGenOnly = 1 in {
|
let isCodeGenOnly = 1 in {
|
||||||
|
@ -610,10 +610,10 @@ def iaddroff : ComplexPattern<iPTR, 1, "SelectAddrImmOffs", [], []>;
|
|||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// PowerPC Instruction Predicate Definitions.
|
// PowerPC Instruction Predicate Definitions.
|
||||||
def In32BitMode : Predicate<"!PPCSubTarget.isPPC64()">;
|
def In32BitMode : Predicate<"!PPCSubTarget->isPPC64()">;
|
||||||
def In64BitMode : Predicate<"PPCSubTarget.isPPC64()">;
|
def In64BitMode : Predicate<"PPCSubTarget->isPPC64()">;
|
||||||
def IsBookE : Predicate<"PPCSubTarget.isBookE()">;
|
def IsBookE : Predicate<"PPCSubTarget->isBookE()">;
|
||||||
def IsNotBookE : Predicate<"!PPCSubTarget.isBookE()">;
|
def IsNotBookE : Predicate<"!PPCSubTarget->isBookE()">;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// PowerPC Multiclass Definitions.
|
// PowerPC Multiclass Definitions.
|
||||||
|
@ -39,7 +39,7 @@ multiclass XX3Form_Rcr<bits<6> opcode, bits<7> xo, dag OOL, dag IOL,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def HasVSX : Predicate<"PPCSubTarget.hasVSX()">;
|
def HasVSX : Predicate<"PPCSubTarget->hasVSX()">;
|
||||||
let Predicates = [HasVSX] in {
|
let Predicates = [HasVSX] in {
|
||||||
let AddedComplexity = 400 in { // Prefer VSX patterns over non-VSX patterns.
|
let AddedComplexity = 400 in { // Prefer VSX patterns over non-VSX patterns.
|
||||||
let neverHasSideEffects = 1 in { // VSX instructions don't have side effects.
|
let neverHasSideEffects = 1 in { // VSX instructions don't have side effects.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user