This doesn't yet support parsing things like %pcrel_hi(foo), but will handle
basic instructions with register or immediate operands.
Differential Revision: https://reviews.llvm.org/D23563
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310361
91177308-0d34-0410-b5e6-
96231b3b80d8
tablegen(LLVM RISCVGenRegisterInfo.inc -gen-register-info)
tablegen(LLVM RISCVGenInstrInfo.inc -gen-instr-info)
tablegen(LLVM RISCVGenMCCodeEmitter.inc -gen-emitter)
+tablegen(LLVM RISCVGenAsmMatcher.inc -gen-asm-matcher)
add_public_tablegen_target(RISCVCommonTableGen)
RISCVTargetMachine.cpp
)
+add_subdirectory(AsmParser)
add_subdirectory(TargetInfo)
add_subdirectory(MCTargetDesc)
;===------------------------------------------------------------------------===;
[common]
-subdirectories = TargetInfo MCTargetDesc
+subdirectories = AsmParser TargetInfo MCTargetDesc
[component_0]
type = TargetGroup
name = RISCV
parent = Target
+has_asmparser = 1
[component_1]
type = Library
def : ProcessorModel<"generic-rv64", NoSchedModel, [Feature64Bit]>;
+def RISCVAsmParser : AsmParser {
+ let ShouldEmitMatchRegisterAltName = 1;
+}
+
def RISCV : Target {
let InstructionSet = RISCVInstrInfo;
+ let AssemblyParsers = [RISCVAsmParser];
}
include "RISCVInstrFormats.td"
-def simm12 : Operand<i32>;
+class SImmAsmOperand<int width>
+ : AsmOperandClass {
+ let Name = "SImm" # width;
+ let RenderMethod = "addImmOperands";
+ let DiagnosticType = !strconcat("Invalid", Name);
+}
+
+def simm12 : Operand<i32> {
+ let ParserMatchClass = SImmAsmOperand<12>;
+}
// As noted in RISCVRegisterInfo.td, the hope is that support for
// variable-sized register classes will mean that instruction definitions do