Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions llvm/include/llvm/MC/MCInstrDesc.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ enum OperandConstraint {
/// private, all access should go through the MCOperandInfo accessors.
/// See the accessors for a description of what these are.
enum OperandFlags {
LookupPtrRegClass = 0,
LookupRegClassByHwMode,
LookupRegClassByHwMode = 0,
Predicate,
OptionalDef,
BranchTarget
Expand Down Expand Up @@ -90,9 +89,6 @@ class MCOperandInfo {
/// operand is a register. If LookupRegClassByHwMode is set, then this is an
/// index into a table in TargetInstrInfo or MCInstrInfo which contains the
/// real register class ID.
///
/// If isLookupPtrRegClass is set, then this is an index that is passed to
/// TargetRegisterInfo::getPointerRegClass(x) to get a dynamic register class.
int16_t RegClass;

/// These are flags from the MCOI::OperandFlags enum.
Expand All @@ -104,13 +100,6 @@ class MCOperandInfo {
/// Operand constraints (see OperandConstraint enum).
uint16_t Constraints;

/// Set if this operand is a pointer value and it requires a callback
/// to look up its register class.
// TODO: Deprecated in favor of isLookupRegClassByHwMode
bool isLookupPtrRegClass() const {
return Flags & (1 << MCOI::LookupPtrRegClass);
}

/// Set if this operand is a value that requires the current hwmode to look up
/// its register class.
bool isLookupRegClassByHwMode() const {
Expand Down
26 changes: 13 additions & 13 deletions llvm/include/llvm/Target/Target.td
Original file line number Diff line number Diff line change
Expand Up @@ -918,16 +918,23 @@ def slice;
def encoder;
def decoder;

/// PointerLikeRegClass - Values that are designed to have pointer width are
/// derived from this. TableGen treats the register class as having a symbolic
/// type that it doesn't know, and resolves the actual regclass to use by using
/// the TargetRegisterInfo::getPointerRegClass() hook at codegen time.
///
/// This is deprecated in favor of RegClassByHwMode.
/// PointerLikeRegClass - Pseudoinstruction operands that are designed
/// to have pointer width are derived from this. This should only be
/// used by StandardPseudoInstruction instructions. No target specific
/// instruction should use this.
class PointerLikeRegClass<int Kind> {
int RegClassKind = Kind;
}

/// ptr_rc definition - Mark this operand as being a pointer value
/// whose register class needs to be defined by the target. Targets
/// should provide instruction definition overrides which substitute
/// the uses of this with the backend defined RegisterClass or
/// RegClassByHwMode to use for pointer virtual registers for a
/// particular opcode (typically by defining a subsitute instruction
/// with RemapPointerOperands).
def ptr_rc : PointerLikeRegClass<0>;

/// RegClassByHwMode - Operands that change the register class based
/// on the subtarget are derived from this. TableGen
/// treats the register class as having a symbolic kind that it
Expand All @@ -941,13 +948,6 @@ class RegClassByHwMode<list<HwMode> Modes,
list<RegisterClass> Objects = RegClasses;
}

/// ptr_rc definition - Mark this operand as being a pointer value whose
/// register class is resolved dynamically via a callback to TargetInstrInfo.
/// FIXME: We should probably change this to a class which contain a list of
/// flags. But currently we have but one flag.
// Deprecated, use RegClassByHwMode instead.
def ptr_rc : PointerLikeRegClass<0>;

/// unknown definition - Mark this operand as being of unknown type, causing
/// it to be resolved by inference in the context it is used.
class unknown_class;
Expand Down
4 changes: 0 additions & 4 deletions llvm/lib/CodeGen/TargetInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ const TargetRegisterClass *TargetInstrInfo::getRegClass(const MCInstrDesc &MCID,
const MCOperandInfo &OpInfo = MCID.operands()[OpNum];
int16_t RegClass = getOpRegClassID(OpInfo);

// TODO: Remove isLookupPtrRegClass in favor of isLookupRegClassByHwMode
if (OpInfo.isLookupPtrRegClass())
return TRI.getPointerRegClass(RegClass);

// Instructions like INSERT_SUBREG do not have fixed register classes.
if (RegClass < 0)
return nullptr;
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/AArch64/AArch64.td
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ include "AArch64SchedPredExynos.td"
include "AArch64SchedPredNeoverse.td"
include "AArch64Combine.td"

defm : RemapAllTargetPseudoPointerOperands<GPR64sp>;

def AArch64InstrInfo : InstrInfo;

//===----------------------------------------------------------------------===//
Expand Down
21 changes: 12 additions & 9 deletions llvm/lib/Target/AMDGPU/R600.td
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@

include "llvm/Target/Target.td"

def R600InstrInfo : InstrInfo {
let guessInstructionProperties = 1;
}

def R600 : Target {
let InstructionSet = R600InstrInfo;
let AllowRegisterRenaming = 1;
}

let Namespace = "R600" in {

foreach Index = 0-15 in {
Expand All @@ -27,6 +18,18 @@ include "R600RegisterInfo.td"

}

defm : RemapAllTargetPseudoPointerOperands<R600_Addr>;

def R600InstrInfo : InstrInfo {
let guessInstructionProperties = 1;
}

def R600 : Target {
let InstructionSet = R600InstrInfo;
let AllowRegisterRenaming = 1;
}


def NullALU : InstrItinClass;
def ALU_NULL : FuncUnit;

Expand Down
11 changes: 11 additions & 0 deletions llvm/lib/Target/AMDGPU/SIInstructions.td
Original file line number Diff line number Diff line change
Expand Up @@ -4751,3 +4751,14 @@ def V_ILLEGAL : Enc32, InstSI<(outs), (ins), "v_illegal"> {
let hasSideEffects = 1;
let SubtargetPredicate = isGFX10Plus;
}

defvar VGPR32_Ptr_Opcodes = [LOAD_STACK_GUARD];
defvar VGPR64_Ptr_Opcodes = !listremove(PseudosWithPtrOps, VGPR32_Ptr_Opcodes);

foreach inst = VGPR32_Ptr_Opcodes in {
def : RemapPointerOperands<inst, VGPR_32>;
}

foreach inst = VGPR64_Ptr_Opcodes in {
def : RemapPointerOperands<inst, VReg_64_AlignTarget>;
}
8 changes: 8 additions & 0 deletions llvm/lib/Target/ARM/ARM.td
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ include "ARMSchedule.td"
//===----------------------------------------------------------------------===//

include "ARMInstrInfo.td"

def Thumb1OnlyMode : HwMode<[IsThumb1Only]>;
def arm_ptr_rc : RegClassByHwMode<
[DefaultMode, Thumb1OnlyMode],
[GPR, tGPR]>;

defm : RemapAllTargetPseudoPointerOperands<arm_ptr_rc>;

def ARMInstrInfo : InstrInfo;

//===----------------------------------------------------------------------===//
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/AVR/AVR.td
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ include "AVRRegisterInfo.td"

include "AVRInstrInfo.td"

defm : RemapAllTargetPseudoPointerOperands<PTRDISPREGS>;

def AVRInstrInfo : InstrInfo;

//===---------------------------------------------------------------------===//
Expand Down
3 changes: 3 additions & 0 deletions llvm/lib/Target/BPF/BPF.td
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ include "BPFCallingConv.td"
include "BPFInstrInfo.td"
include "GISel/BPFRegisterBanks.td"


defm : RemapAllTargetPseudoPointerOperands<GPR>;

def BPFInstrInfo : InstrInfo;

class Proc<string Name, list<SubtargetFeature> Features>
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/CSKY/CSKY.td
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,8 @@ def : CK860V<"ck860fv", NoSchedModel,
// Define the CSKY target.
//===----------------------------------------------------------------------===//

defm : RemapAllTargetPseudoPointerOperands<GPR>;

def CSKYInstrInfo : InstrInfo;


Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/DirectX/DirectX.td
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ include "DXILStubs.td"
// DirectX Subtarget features.
//===----------------------------------------------------------------------===//

defm : RemapAllTargetPseudoPointerOperands<DXILClass>;

def DirectXInstrInfo : InstrInfo;

//===----------------------------------------------------------------------===//
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/Hexagon/Hexagon.td
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ include "HexagonPatternsV65.td"
include "HexagonDepMappings.td"
include "HexagonIntrinsics.td"

defm : RemapAllTargetPseudoPointerOperands<IntRegs>;

def HexagonInstrInfo : InstrInfo;

//===----------------------------------------------------------------------===//
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/Lanai/Lanai.td
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ include "LanaiRegisterInfo.td"
include "LanaiCallingConv.td"
include "LanaiInstrInfo.td"

defm : RemapAllTargetPseudoPointerOperands<GPR>;

def LanaiInstrInfo : InstrInfo;

//===----------------------------------------------------------------------===//
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/LoongArch/LoongArch.td
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ def : ProcessorModel<"la664", NoSchedModel, [Feature64Bit,
// Define the LoongArch target.
//===----------------------------------------------------------------------===//

defm : RemapAllTargetPseudoPointerOperands<GPR>;

def LoongArchInstrInfo : InstrInfo {
let guessInstructionProperties = 0;
}
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/M68k/M68k.td
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ include "GISel/M68kRegisterBanks.td"

include "M68kInstrInfo.td"

defm : RemapAllTargetPseudoPointerOperands<AR16>;

def M68kInstrInfo : InstrInfo;

//===----------------------------------------------------------------------===//
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/MSP430/MSP430.td
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ include "MSP430CallingConv.td"

include "MSP430InstrInfo.td"

defm : RemapAllTargetPseudoPointerOperands<GR16>;

def MSP430InstrInfo : InstrInfo;

//===---------------------------------------------------------------------===//
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/Mips/Mips.td
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ include "MipsScheduleI6400.td"
include "MipsScheduleP5600.td"
include "MipsScheduleGeneric.td"

defm : RemapAllTargetPseudoPointerOperands<mips_ptr_rc>;

def MipsInstrInfo : InstrInfo {
}

Expand Down
10 changes: 10 additions & 0 deletions llvm/lib/Target/NVPTX/NVPTX.td
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ def : Proc<"sm_121", [SM121, PTX88]>;
def : Proc<"sm_121a", [SM121a, PTX88]>;
def : Proc<"sm_121f", [SM121f, PTX88]>;


def Is64Bit : Predicate<"Subtarget->getTargetTriple().getArch() == Triple::nvptx64">;
def NVPTX64 : HwMode<[Is64Bit]>;

def nvptx_ptr_rc : RegClassByHwMode<
[DefaultMode, NVPTX64],
[B32, B64]>;

defm : RemapAllTargetPseudoPointerOperands<nvptx_ptr_rc>;

def NVPTXInstrInfo : InstrInfo {
}

Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/PowerPC/PPC.td
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,8 @@ def PPCAsmParserVariant : AsmParserVariant {
string BreakCharacters = ".";
}

defm : RemapAllTargetPseudoPointerOperands<ppc_ptr_rc>;

def PPC : Target {
// Information about the instructions.
let InstructionSet = PPCInstrInfo;
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/Target/PowerPC/PPCRegisterInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,10 @@ def PPCRegGxRCNoR0Operand : AsmOperandClass {
let Name = "RegGxRCNoR0"; let PredicateMethod = "isRegNumber";
}

def ppc_ptr_rc : RegClassByHwMode<
[PPC32, PPC64],
[GPRC, G8RC]>;

def ptr_rc_nor0_by_hwmode : RegClassByHwMode<
[PPC32, PPC64],
[GPRC_NOR0, G8RC_NOX0]>;
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/RISCV/RISCV.td
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def RISCVAsmWriter : AsmWriter {
int PassSubtarget = 1;
}

defm : RemapAllTargetPseudoPointerOperands<GPR>;

def RISCV : Target {
let InstructionSet = RISCVInstrInfo;
let AssemblyParsers = [RISCVAsmParser];
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/SPIRV/SPIRV.td
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ include "SPIRVInstrInfo.td"
include "SPIRVCombine.td"
include "SPIRVBuiltins.td"

defm : RemapAllTargetPseudoPointerOperands<pID>;

def SPIRVInstrInfo : InstrInfo;

class Proc<string Name, list<SubtargetFeature> Features>
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/Sparc/Sparc.td
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ include "SparcCallingConv.td"
include "SparcSchedule.td"
include "SparcInstrInfo.td"

defm : RemapAllTargetPseudoPointerOperands<sparc_ptr_rc>;

def SparcInstrInfo : InstrInfo;

def SparcAsmParser : AsmParser {
Expand Down
3 changes: 3 additions & 0 deletions llvm/lib/Target/SystemZ/SystemZ.td
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ include "SystemZInstrHFP.td"
include "SystemZInstrDFP.td"
include "SystemZInstrSystem.td"


defm : RemapAllTargetPseudoPointerOperands<ADDR64Bit>;

def SystemZInstrInfo : InstrInfo { let guessInstructionProperties = 0; }

//===----------------------------------------------------------------------===//
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/VE/VE.td
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ include "VERegisterInfo.td"
include "VECallingConv.td"
include "VEInstrInfo.td"

defm : RemapAllTargetPseudoPointerOperands<ve_ptr_rc>;
def VEInstrInfo : InstrInfo {}

def VEAsmParser : AsmParser {
Expand Down
8 changes: 8 additions & 0 deletions llvm/lib/Target/WebAssembly/WebAssembly.td
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ include "WebAssemblyRegisterInfo.td"

include "WebAssemblyInstrInfo.td"

def WASM64 : HwMode<[HasAddr64]>;

def wasm_ptr_rc : RegClassByHwMode<
[DefaultMode, WASM64],
[I32, I64]>;

defm : RemapAllTargetPseudoPointerOperands<wasm_ptr_rc>;

def WebAssemblyInstrInfo : InstrInfo;

//===----------------------------------------------------------------------===//
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/X86/X86.td
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,8 @@ include "X86Schedule.td"
include "X86InstrInfo.td"
include "X86SchedPredicates.td"

defm : RemapAllTargetPseudoPointerOperands<x86_ptr_rc>;

def X86InstrInfo : InstrInfo;

//===----------------------------------------------------------------------===//
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/XCore/XCore.td
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ include "XCoreRegisterInfo.td"
include "XCoreInstrInfo.td"
include "XCoreCallingConv.td"

defm : RemapAllTargetPseudoPointerOperands<GRRegs>;

def XCoreInstrInfo : InstrInfo;

//===----------------------------------------------------------------------===//
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/Xtensa/Xtensa.td
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ include "XtensaCallingConv.td"

include "XtensaInstrInfo.td"

defm : RemapAllTargetPseudoPointerOperands<AR>;

def XtensaInstrInfo : InstrInfo;

//===----------------------------------------------------------------------===//
Expand Down
1 change: 1 addition & 0 deletions llvm/test/TableGen/DuplicateFieldValues.td
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ let BaseName = "0" in {
def E0 : I, ABCRel, isEForm;
}

defm : RemapAllTargetPseudoPointerOperands<DFVRegClass>;
Loading
Loading