1 //===-- RISCV.td - Describe the RISCV Target Machine -------*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 include "llvm/Target/Target.td"
12 //===----------------------------------------------------------------------===//
13 // RISC-V subtarget features and instruction predicates.
14 //===----------------------------------------------------------------------===//
17 : SubtargetFeature<"m", "HasStdExtM", "true",
18 "'M' (Integer Multiplication and Division)">;
19 def HasStdExtM : Predicate<"Subtarget->hasStdExtM()">,
20 AssemblerPredicate<"FeatureStdExtM">;
23 : SubtargetFeature<"a", "HasStdExtA", "true",
24 "'A' (Atomic Instructions)">;
25 def HasStdExtA : Predicate<"Subtarget->hasStdExtA()">,
26 AssemblerPredicate<"FeatureStdExtA">;
29 : SubtargetFeature<"f", "HasStdExtF", "true",
30 "'F' (Single-Precision Floating-Point)">;
31 def HasStdExtF : Predicate<"Subtarget->hasStdExtF()">,
32 AssemblerPredicate<"FeatureStdExtF">;
35 : SubtargetFeature<"d", "HasStdExtD", "true",
36 "'D' (Double-Precision Floating-Point)",
38 def HasStdExtD : Predicate<"Subtarget->hasStdExtD()">,
39 AssemblerPredicate<"FeatureStdExtD">;
42 : SubtargetFeature<"c", "HasStdExtC", "true",
43 "'C' (Compressed Instructions)">;
44 def HasStdExtC : Predicate<"Subtarget->hasStdExtC()">,
45 AssemblerPredicate<"FeatureStdExtC">;
49 : SubtargetFeature<"64bit", "HasRV64", "true", "Implements RV64">;
50 def IsRV64 : Predicate<"Subtarget->is64Bit()">,
51 AssemblerPredicate<"Feature64Bit">;
52 def IsRV32 : Predicate<"!Subtarget->is64Bit()">,
53 AssemblerPredicate<"!Feature64Bit">;
55 def RV64 : HwMode<"+64bit">;
56 def RV32 : HwMode<"-64bit">;
59 : SubtargetFeature<"relax", "EnableLinkerRelax", "true",
60 "Enable Linker relaxation.">;
62 //===----------------------------------------------------------------------===//
63 // Registers, calling conventions, instruction descriptions.
64 //===----------------------------------------------------------------------===//
66 include "RISCVRegisterInfo.td"
67 include "RISCVCallingConv.td"
68 include "RISCVInstrInfo.td"
70 //===----------------------------------------------------------------------===//
71 // RISC-V processors supported.
72 //===----------------------------------------------------------------------===//
74 def : ProcessorModel<"generic-rv32", NoSchedModel, []>;
76 def : ProcessorModel<"generic-rv64", NoSchedModel, [Feature64Bit]>;
78 //===----------------------------------------------------------------------===//
79 // Define the RISC-V target.
80 //===----------------------------------------------------------------------===//
82 def RISCVInstrInfo : InstrInfo {
83 let guessInstructionProperties = 0;
86 def RISCVAsmParser : AsmParser {
87 let ShouldEmitMatchRegisterAltName = 1;
88 let AllowDuplicateRegisterNames = 1;
91 def RISCVAsmWriter : AsmWriter {
92 int PassSubtarget = 1;
96 let InstructionSet = RISCVInstrInfo;
97 let AssemblyParsers = [RISCVAsmParser];
98 let AssemblyWriters = [RISCVAsmWriter];
99 let AllowRegisterRenaming = 1;