1import("//llvm/utils/TableGen/tablegen.gni")
2
3# RISCV is the only target that has a "compress instr emitter", and it's
4# a bit strange in that it defines static functions depending on which
5# defines are set. Instead of housing these functions in one library,
6# various libraries include the generated .inc file with different defines set.
7tablegen("RISCVGenCompressInstEmitter") {
8  visibility = [
9    ":LLVMRISCVCodeGen",
10    "AsmParser",
11    "MCTargetDesc",
12  ]
13  args = [ "-gen-compress-inst-emitter" ]
14  td_file = "RISCV.td"
15}
16
17tablegen("RISCVGenDAGISel") {
18  visibility = [ ":LLVMRISCVCodeGen" ]
19  args = [ "-gen-dag-isel" ]
20  td_file = "RISCV.td"
21}
22
23tablegen("RISCVGenGlobalISel") {
24  visibility = [ ":LLVMRISCVCodeGen" ]
25  args = [ "-gen-global-isel" ]
26  td_file = "RISCV.td"
27}
28
29tablegen("RISCVGenMCPseudoLowering") {
30  visibility = [ ":LLVMRISCVCodeGen" ]
31  args = [ "-gen-pseudo-lowering" ]
32  td_file = "RISCV.td"
33}
34
35tablegen("RISCVGenRegisterBank") {
36  visibility = [ ":LLVMRISCVCodeGen" ]
37  args = [ "-gen-register-bank" ]
38  td_file = "RISCV.td"
39}
40
41static_library("LLVMRISCVCodeGen") {
42  deps = [
43    ":RISCVGenCompressInstEmitter",
44    ":RISCVGenDAGISel",
45    ":RISCVGenGlobalISel",
46    ":RISCVGenMCPseudoLowering",
47    ":RISCVGenRegisterBank",
48
49    # See https://reviews.llvm.org/D69130
50    "AsmParser:RISCVGenAsmMatcher",
51    "MCTargetDesc",
52    "TargetInfo",
53    "//llvm/include/llvm/Config:llvm-config",
54    "//llvm/lib/CodeGen",
55    "//llvm/lib/CodeGen/AsmPrinter",
56    "//llvm/lib/CodeGen/SelectionDAG",
57    "//llvm/lib/IR",
58    "//llvm/lib/MC",
59    "//llvm/lib/Support",
60    "//llvm/lib/Target",
61  ]
62  include_dirs = [ "." ]
63  sources = [
64    "RISCVAsmPrinter.cpp",
65    "RISCVCallLowering.cpp",
66    "RISCVExpandAtomicPseudoInsts.cpp",
67    "RISCVExpandPseudoInsts.cpp",
68    "RISCVFrameLowering.cpp",
69    "RISCVISelDAGToDAG.cpp",
70    "RISCVISelLowering.cpp",
71    "RISCVInsertVSETVLI.cpp",
72    "RISCVInstrInfo.cpp",
73    "RISCVInstructionSelector.cpp",
74    "RISCVLegalizerInfo.cpp",
75    "RISCVMCInstLower.cpp",
76    "RISCVMergeBaseOffset.cpp",
77    "RISCVRegisterBankInfo.cpp",
78    "RISCVRegisterInfo.cpp",
79    "RISCVSubtarget.cpp",
80    "RISCVTargetMachine.cpp",
81    "RISCVTargetObjectFile.cpp",
82    "RISCVTargetTransformInfo.cpp",
83  ]
84}
85
86# This is a bit different from most build files: Due to this group
87# having the directory's name, "//llvm/lib/Target/RISCV" will refer to this
88# target, which pulls in the code in this directory *and all subdirectories*.
89# For most other directories, "//llvm/lib/Foo" only pulls in the code directly
90# in "llvm/lib/Foo". The forwarding targets in //llvm/lib/Target expect this
91# different behavior.
92group("RISCV") {
93  deps = [
94    ":LLVMRISCVCodeGen",
95    "AsmParser",
96    "Disassembler",
97    "MCTargetDesc",
98    "TargetInfo",
99  ]
100}
101