mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
dc6a85256b
If an instruction has several operands and a PC-relative one is not the first of them, the generator may produce the code that does not pass the 'Address' parameter to the printout method. For example, for an Arm instruction 'LE LR, $imm', it reuses the same code as for other instructions where the second operand is not PC-relative: void ARMInstPrinter::printInstruction(...) { ... case 11: // BF16VDOTI_VDOTD, BF16VDOTI_VDOTQ, BF16VDOTS_VDOTD, ... printOperand(MI, 1, STI, O); O << ", "; printOperand(MI, 2, STI, O); break; ... The patch fixes that by considering 'PCRel' when comparing 'AsmWriterOperand' values. Differential Revision: https://reviews.llvm.org/D104698
39 lines
934 B
TableGen
39 lines
934 B
TableGen
// RUN: llvm-tblgen -gen-asm-writer -I %p/../../include %s | FileCheck %s
|
|
|
|
include "llvm/Target/Target.td"
|
|
|
|
def ArchInstrInfo : InstrInfo { }
|
|
|
|
def Arch : Target {
|
|
let InstructionSet = ArchInstrInfo;
|
|
}
|
|
|
|
def R0 : Register<"r0">;
|
|
def Reg : RegisterClass<"Reg", [i32], 0, (add R0)>;
|
|
|
|
def IntOperand: Operand<i32>;
|
|
|
|
def PCRelOperand : Operand<i32> {
|
|
let OperandType = "OPERAND_PCREL";
|
|
}
|
|
|
|
def foo : Instruction {
|
|
let OutOperandList = (outs);
|
|
let InOperandList = (ins Reg:$reg, IntOperand:$imm);
|
|
let AsmString = "foo $reg, $imm";
|
|
}
|
|
|
|
def bar : Instruction {
|
|
let OutOperandList = (outs);
|
|
let InOperandList = (ins Reg:$reg, PCRelOperand:$imm);
|
|
let AsmString = "bar $reg, $imm";
|
|
}
|
|
|
|
// CHECK: ArchInstPrinter::printInstruction(
|
|
// CHECK: // bar, foo
|
|
// CHECK-NEXT: printOperand(MI, 0, O);
|
|
// CHECK: // foo
|
|
// CHECK-NEXT: printOperand(MI, 1, O);
|
|
// CHECK: // bar
|
|
// CHECK-NEXT: printOperand(MI, Address, 1, O);
|