mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-02 16:56:39 +00:00
TLI: Remove DAG argument from getRegisterByName
Replace with the MachineFunction. X86 is the only user, and only uses it for the function. This removes one obstacle from using this in GlobalISel. The other is the more tolerable EVT argument. The X86 use of the function seems questionable to me. It checks hasFP, before frame lowering. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373292 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
914e6761d9
commit
56aa8b8eb6
@ -3671,8 +3671,8 @@ public:
|
||||
/// Return the register ID of the name passed in. Used by named register
|
||||
/// global variables extension. There is no target-independent behaviour
|
||||
/// so the default action is to bail.
|
||||
virtual unsigned getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const {
|
||||
virtual Register getRegisterByName(const char* RegName, EVT VT,
|
||||
const MachineFunction &MF) const {
|
||||
report_fatal_error("Named registers not implemented for this target");
|
||||
}
|
||||
|
||||
|
@ -2231,9 +2231,9 @@ void SelectionDAGISel::Select_READ_REGISTER(SDNode *Op) {
|
||||
SDLoc dl(Op);
|
||||
MDNodeSDNode *MD = dyn_cast<MDNodeSDNode>(Op->getOperand(1));
|
||||
const MDString *RegStr = dyn_cast<MDString>(MD->getMD()->getOperand(0));
|
||||
unsigned Reg =
|
||||
Register Reg =
|
||||
TLI->getRegisterByName(RegStr->getString().data(), Op->getValueType(0),
|
||||
*CurDAG);
|
||||
CurDAG->getMachineFunction());
|
||||
SDValue New = CurDAG->getCopyFromReg(
|
||||
Op->getOperand(0), dl, Reg, Op->getValueType(0));
|
||||
New->setNodeId(-1);
|
||||
@ -2245,9 +2245,9 @@ void SelectionDAGISel::Select_WRITE_REGISTER(SDNode *Op) {
|
||||
SDLoc dl(Op);
|
||||
MDNodeSDNode *MD = dyn_cast<MDNodeSDNode>(Op->getOperand(1));
|
||||
const MDString *RegStr = dyn_cast<MDString>(MD->getMD()->getOperand(0));
|
||||
unsigned Reg = TLI->getRegisterByName(RegStr->getString().data(),
|
||||
Register Reg = TLI->getRegisterByName(RegStr->getString().data(),
|
||||
Op->getOperand(2).getValueType(),
|
||||
*CurDAG);
|
||||
CurDAG->getMachineFunction());
|
||||
SDValue New = CurDAG->getCopyToReg(
|
||||
Op->getOperand(0), dl, Reg, Op->getOperand(2));
|
||||
New->setNodeId(-1);
|
||||
|
@ -5489,9 +5489,9 @@ SDValue AArch64TargetLowering::LowerSPONENTRY(SDValue Op,
|
||||
|
||||
// FIXME? Maybe this could be a TableGen attribute on some registers and
|
||||
// this table could be generated automatically from RegInfo.
|
||||
unsigned AArch64TargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const {
|
||||
unsigned Reg = MatchRegisterName(RegName);
|
||||
Register AArch64TargetLowering::
|
||||
getRegisterByName(const char* RegName, EVT VT, const MachineFunction &MF) const {
|
||||
Register Reg = MatchRegisterName(RegName);
|
||||
if (AArch64::X1 <= Reg && Reg <= AArch64::X28) {
|
||||
const MCRegisterInfo *MRI = Subtarget->getRegisterInfo();
|
||||
unsigned DwarfRegNum = MRI->getDwarfRegNum(Reg, false);
|
||||
|
@ -707,8 +707,8 @@ private:
|
||||
unsigned combineRepeatedFPDivisors() const override;
|
||||
|
||||
ConstraintType getConstraintType(StringRef Constraint) const override;
|
||||
unsigned getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const override;
|
||||
Register getRegisterByName(const char* RegName, EVT VT,
|
||||
const MachineFunction &MF) const override;
|
||||
|
||||
/// Examine constraint string and operand type and determine a weight value.
|
||||
/// The operand object must already have been set up with the operand type.
|
||||
|
@ -2971,9 +2971,9 @@ SDValue SITargetLowering::LowerCall(CallLoweringInfo &CLI,
|
||||
IsThisReturn ? OutVals[0] : SDValue());
|
||||
}
|
||||
|
||||
unsigned SITargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const {
|
||||
unsigned Reg = StringSwitch<unsigned>(RegName)
|
||||
Register SITargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
const MachineFunction &MF) const {
|
||||
Register Reg = StringSwitch<Register>(RegName)
|
||||
.Case("m0", AMDGPU::M0)
|
||||
.Case("exec", AMDGPU::EXEC)
|
||||
.Case("exec_lo", AMDGPU::EXEC_LO)
|
||||
@ -2981,7 +2981,7 @@ unsigned SITargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
.Case("flat_scratch", AMDGPU::FLAT_SCR)
|
||||
.Case("flat_scratch_lo", AMDGPU::FLAT_SCR_LO)
|
||||
.Case("flat_scratch_hi", AMDGPU::FLAT_SCR_HI)
|
||||
.Default(AMDGPU::NoRegister);
|
||||
.Default(Register());
|
||||
|
||||
if (Reg == AMDGPU::NoRegister) {
|
||||
report_fatal_error(Twine("invalid register name \""
|
||||
|
@ -319,8 +319,8 @@ public:
|
||||
SDValue LowerCall(CallLoweringInfo &CLI,
|
||||
SmallVectorImpl<SDValue> &InVals) const override;
|
||||
|
||||
unsigned getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const override;
|
||||
Register getRegisterByName(const char* RegName, EVT VT,
|
||||
const MachineFunction &MF) const override;
|
||||
|
||||
MachineBasicBlock *splitKillBlock(MachineInstr &MI,
|
||||
MachineBasicBlock *BB) const;
|
||||
|
@ -5483,9 +5483,9 @@ SDValue ARMTargetLowering::LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const {
|
||||
|
||||
// FIXME? Maybe this could be a TableGen attribute on some registers and
|
||||
// this table could be generated automatically from RegInfo.
|
||||
unsigned ARMTargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const {
|
||||
unsigned Reg = StringSwitch<unsigned>(RegName)
|
||||
Register ARMTargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
const MachineFunction &MF) const {
|
||||
Register Reg = StringSwitch<unsigned>(RegName)
|
||||
.Case("sp", ARM::SP)
|
||||
.Default(0);
|
||||
if (Reg)
|
||||
|
@ -725,8 +725,8 @@ class VectorType;
|
||||
void lowerABS(SDNode *N, SmallVectorImpl<SDValue> &Results,
|
||||
SelectionDAG &DAG) const;
|
||||
|
||||
unsigned getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const override;
|
||||
Register getRegisterByName(const char* RegName, EVT VT,
|
||||
const MachineFunction &MF) const override;
|
||||
|
||||
SDValue BuildSDIVPow2(SDNode *N, const APInt &Divisor, SelectionDAG &DAG,
|
||||
SmallVectorImpl<SDNode *> &Created) const override;
|
||||
|
@ -2006,10 +2006,9 @@ void AVRTargetLowering::LowerAsmOperandForConstraint(SDValue Op,
|
||||
return TargetLowering::LowerAsmOperandForConstraint(Op, Constraint, Ops, DAG);
|
||||
}
|
||||
|
||||
unsigned AVRTargetLowering::getRegisterByName(const char *RegName,
|
||||
EVT VT,
|
||||
SelectionDAG &DAG) const {
|
||||
unsigned Reg;
|
||||
Register AVRTargetLowering::getRegisterByName(const char *RegName, EVT VT,
|
||||
const MachineFunction &MF) const {
|
||||
Register Reg;
|
||||
|
||||
if (VT == MVT::i8) {
|
||||
Reg = StringSwitch<unsigned>(RegName)
|
||||
|
@ -125,8 +125,8 @@ public:
|
||||
std::vector<SDValue> &Ops,
|
||||
SelectionDAG &DAG) const override;
|
||||
|
||||
unsigned getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const override;
|
||||
Register getRegisterByName(const char* RegName, EVT VT,
|
||||
const MachineFunction &MF) const override;
|
||||
|
||||
bool shouldSplitFunctionArgumentsAsLittleEndian(const DataLayout &DL)
|
||||
const override {
|
||||
|
@ -240,12 +240,12 @@ bool HexagonTargetLowering::mayBeEmittedAsTailCall(const CallInst *CI) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned HexagonTargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const {
|
||||
Register HexagonTargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
const MachineFunction &) const {
|
||||
// Just support r19, the linux kernel uses it.
|
||||
unsigned Reg = StringSwitch<unsigned>(RegName)
|
||||
Register Reg = StringSwitch<Register>(RegName)
|
||||
.Case("r19", Hexagon::R19)
|
||||
.Default(0);
|
||||
.Default(Register());
|
||||
if (Reg)
|
||||
return Reg;
|
||||
|
||||
|
@ -229,8 +229,8 @@ namespace HexagonISD {
|
||||
|
||||
bool mayBeEmittedAsTailCall(const CallInst *CI) const override;
|
||||
|
||||
unsigned getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const override;
|
||||
Register getRegisterByName(const char* RegName, EVT VT,
|
||||
const MachineFunction &MF) const override;
|
||||
|
||||
/// If a physical register, this returns the register that receives the
|
||||
/// exception address on entry to an EH pad.
|
||||
|
@ -212,10 +212,11 @@ SDValue LanaiTargetLowering::LowerOperation(SDValue Op,
|
||||
// Lanai Inline Assembly Support
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
unsigned LanaiTargetLowering::getRegisterByName(const char *RegName, EVT /*VT*/,
|
||||
SelectionDAG & /*DAG*/) const {
|
||||
Register LanaiTargetLowering::getRegisterByName(
|
||||
const char *RegName, EVT /*VT*/,
|
||||
const MachineFunction & /*MF*/) const {
|
||||
// Only unallocatable registers should be matched here.
|
||||
unsigned Reg = StringSwitch<unsigned>(RegName)
|
||||
Register Reg = StringSwitch<unsigned>(RegName)
|
||||
.Case("pc", Lanai::PC)
|
||||
.Case("sp", Lanai::SP)
|
||||
.Case("fp", Lanai::FP)
|
||||
|
@ -90,8 +90,8 @@ public:
|
||||
SDValue LowerSRL_PARTS(SDValue Op, SelectionDAG &DAG) const;
|
||||
SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const;
|
||||
|
||||
unsigned getRegisterByName(const char *RegName, EVT VT,
|
||||
SelectionDAG &DAG) const override;
|
||||
Register getRegisterByName(const char *RegName, EVT VT,
|
||||
const MachineFunction &MF) const override;
|
||||
std::pair<unsigned, const TargetRegisterClass *>
|
||||
getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
|
||||
StringRef Constraint, MVT VT) const override;
|
||||
|
@ -4566,20 +4566,20 @@ MachineBasicBlock *MipsTargetLowering::emitPseudoD_SELECT(MachineInstr &MI,
|
||||
|
||||
// FIXME? Maybe this could be a TableGen attribute on some registers and
|
||||
// this table could be generated automatically from RegInfo.
|
||||
unsigned MipsTargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const {
|
||||
Register MipsTargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
const MachineFunction &MF) const {
|
||||
// Named registers is expected to be fairly rare. For now, just support $28
|
||||
// since the linux kernel uses it.
|
||||
if (Subtarget.isGP64bit()) {
|
||||
unsigned Reg = StringSwitch<unsigned>(RegName)
|
||||
Register Reg = StringSwitch<Register>(RegName)
|
||||
.Case("$28", Mips::GP_64)
|
||||
.Default(0);
|
||||
.Default(Register());
|
||||
if (Reg)
|
||||
return Reg;
|
||||
} else {
|
||||
unsigned Reg = StringSwitch<unsigned>(RegName)
|
||||
Register Reg = StringSwitch<Register>(RegName)
|
||||
.Case("$28", Mips::GP)
|
||||
.Default(0);
|
||||
.Default(Register());
|
||||
if (Reg)
|
||||
return Reg;
|
||||
}
|
||||
|
@ -347,8 +347,8 @@ class TargetRegisterClass;
|
||||
|
||||
void HandleByVal(CCState *, unsigned &, unsigned) const override;
|
||||
|
||||
unsigned getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const override;
|
||||
Register getRegisterByName(const char* RegName, EVT VT,
|
||||
const MachineFunction &MF) const override;
|
||||
|
||||
/// If a physical register, this returns the register that receives the
|
||||
/// exception address on entry to an EH pad.
|
||||
|
@ -14513,8 +14513,8 @@ SDValue PPCTargetLowering::LowerFRAMEADDR(SDValue Op,
|
||||
|
||||
// FIXME? Maybe this could be a TableGen attribute on some registers and
|
||||
// this table could be generated automatically from RegInfo.
|
||||
unsigned PPCTargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const {
|
||||
Register PPCTargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
const MachineFunction &MF) const {
|
||||
bool isPPC64 = Subtarget.isPPC64();
|
||||
bool isDarwinABI = Subtarget.isDarwinABI();
|
||||
|
||||
@ -14523,12 +14523,12 @@ unsigned PPCTargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
report_fatal_error("Invalid register global variable type");
|
||||
|
||||
bool is64Bit = isPPC64 && VT == MVT::i64;
|
||||
unsigned Reg = StringSwitch<unsigned>(RegName)
|
||||
Register Reg = StringSwitch<Register>(RegName)
|
||||
.Case("r1", is64Bit ? PPC::X1 : PPC::R1)
|
||||
.Case("r2", (isDarwinABI || isPPC64) ? 0 : PPC::R2)
|
||||
.Case("r13", (!isPPC64 && isDarwinABI) ? 0 :
|
||||
.Case("r2", (isDarwinABI || isPPC64) ? Register() : PPC::R2)
|
||||
.Case("r13", (!isPPC64 && isDarwinABI) ? Register() :
|
||||
(is64Bit ? PPC::X13 : PPC::R13))
|
||||
.Default(0);
|
||||
.Default(Register());
|
||||
|
||||
if (Reg)
|
||||
return Reg;
|
||||
|
@ -733,8 +733,8 @@ namespace llvm {
|
||||
SDValue BuildSDIVPow2(SDNode *N, const APInt &Divisor, SelectionDAG &DAG,
|
||||
SmallVectorImpl<SDNode *> &Created) const override;
|
||||
|
||||
unsigned getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const override;
|
||||
Register getRegisterByName(const char* RegName, EVT VT,
|
||||
const MachineFunction &MF) const override;
|
||||
|
||||
void computeKnownBitsForTargetNode(const SDValue Op,
|
||||
KnownBits &Known,
|
||||
|
@ -1016,9 +1016,9 @@ SparcTargetLowering::LowerCall_32(TargetLowering::CallLoweringInfo &CLI,
|
||||
|
||||
// FIXME? Maybe this could be a TableGen attribute on some registers and
|
||||
// this table could be generated automatically from RegInfo.
|
||||
unsigned SparcTargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const {
|
||||
unsigned Reg = StringSwitch<unsigned>(RegName)
|
||||
Register SparcTargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
const MachineFunction &MF) const {
|
||||
Register Reg = StringSwitch<unsigned>(RegName)
|
||||
.Case("i0", SP::I0).Case("i1", SP::I1).Case("i2", SP::I2).Case("i3", SP::I3)
|
||||
.Case("i4", SP::I4).Case("i5", SP::I5).Case("i6", SP::I6).Case("i7", SP::I7)
|
||||
.Case("o0", SP::O0).Case("o1", SP::O1).Case("o2", SP::O2).Case("o3", SP::O3)
|
||||
|
@ -98,8 +98,8 @@ namespace llvm {
|
||||
return MVT::i32;
|
||||
}
|
||||
|
||||
unsigned getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const override;
|
||||
Register getRegisterByName(const char* RegName, EVT VT,
|
||||
const MachineFunction &MF) const override;
|
||||
|
||||
/// If a physical register, this returns the register that receives the
|
||||
/// exception address on entry to an EH pad.
|
||||
|
@ -24127,12 +24127,11 @@ SDValue X86TargetLowering::LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const {
|
||||
|
||||
// FIXME? Maybe this could be a TableGen attribute on some registers and
|
||||
// this table could be generated automatically from RegInfo.
|
||||
unsigned X86TargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const {
|
||||
Register X86TargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
const MachineFunction &MF) const {
|
||||
const TargetFrameLowering &TFI = *Subtarget.getFrameLowering();
|
||||
const MachineFunction &MF = DAG.getMachineFunction();
|
||||
|
||||
unsigned Reg = StringSwitch<unsigned>(RegName)
|
||||
Register Reg = StringSwitch<unsigned>(RegName)
|
||||
.Case("esp", X86::ESP)
|
||||
.Case("rsp", X86::RSP)
|
||||
.Case("ebp", X86::EBP)
|
||||
@ -24146,8 +24145,7 @@ unsigned X86TargetLowering::getRegisterByName(const char* RegName, EVT VT,
|
||||
#ifndef NDEBUG
|
||||
else {
|
||||
const X86RegisterInfo *RegInfo = Subtarget.getRegisterInfo();
|
||||
unsigned FrameReg =
|
||||
RegInfo->getPtrSizedFrameRegister(DAG.getMachineFunction());
|
||||
Register FrameReg = RegInfo->getPtrSizedFrameRegister(MF);
|
||||
assert((FrameReg == X86::EBP || FrameReg == X86::RBP) &&
|
||||
"Invalid Frame Register!");
|
||||
}
|
||||
|
@ -1151,8 +1151,8 @@ namespace llvm {
|
||||
return nullptr; // nothing to do, move along.
|
||||
}
|
||||
|
||||
unsigned getRegisterByName(const char* RegName, EVT VT,
|
||||
SelectionDAG &DAG) const override;
|
||||
Register getRegisterByName(const char* RegName, EVT VT,
|
||||
const MachineFunction &MF) const override;
|
||||
|
||||
/// If a physical register, this returns the register that receives the
|
||||
/// exception address on entry to an EH pad.
|
||||
|
Loading…
Reference in New Issue
Block a user