Index: llvm/utils/gn/secondary/llvm/lib/Target/RISCV/AsmParser/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/llvm/lib/Target/RISCV/AsmParser/BUILD.gn @@ -0,0 +1,24 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("RISCVGenAsmMatcher") { + visibility = [ ":AsmParser" ] + args = [ "-gen-asm-matcher" ] + td_file = "../RISCV.td" +} + +static_library("AsmParser") { + output_name = "LLVMRISCVAsmParser" + deps = [ + ":RISCVGenAsmMatcher", + "//llvm/lib/MC", + "//llvm/lib/MC/MCParser", + "//llvm/lib/Support", + "//llvm/lib/Target/RISCV:tablegen", + "//llvm/lib/Target/RISCV/MCTargetDesc", + "//llvm/lib/Target/RISCV/Utils", + ] + include_dirs = [ ".." ] + sources = [ + "RISCVAsmParser.cpp", + ] +} Index: llvm/utils/gn/secondary/llvm/lib/Target/RISCV/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/llvm/lib/Target/RISCV/BUILD.gn @@ -0,0 +1,84 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("RISCVGenCompressInstEmitter") { + visibility = [ ":tablegen" ] + args = [ "-gen-compress-inst-emitter" ] + td_file = "RISCV.td" +} + +tablegen("RISCVGenDAGISel") { + visibility = [ ":tablegen" ] + args = [ "-gen-dag-isel" ] + td_file = "RISCV.td" +} + +tablegen("RISCVGenMCPseudoLowering") { + visibility = [ ":tablegen" ] + args = [ "-gen-pseudo-lowering" ] + td_file = "RISCV.td" +} + +# This should contain tablegen targets generating .inc files included +# by other targets. .inc files only used by .cpp files in this directory +# should be in deps on the static_library instead. +group("tablegen") { + visibility = [ + ":LLVMRISCVCodeGen", + "AsmParser", + "MCTargetDesc", + "Utils", + ] + public_deps = [ + ":RISCVGenCompressInstEmitter", + ":RISCVGenDAGISel", + ":RISCVGenMCPseudoLowering", + ] +} + +static_library("LLVMRISCVCodeGen") { + deps = [ + ":tablegen", + "MCTargetDesc", + "TargetInfo", + "//llvm/include/llvm/Config:llvm-config", + "//llvm/lib/CodeGen", + "//llvm/lib/CodeGen/AsmPrinter", + "//llvm/lib/CodeGen/SelectionDAG", + "//llvm/lib/IR", + "//llvm/lib/MC", + "//llvm/lib/Support", + "//llvm/lib/Target", + ] + include_dirs = [ "." ] + sources = [ + "RISCVAsmPrinter.cpp", + "RISCVExpandPseudoInsts.cpp", + "RISCVFrameLowering.cpp", + "RISCVInstrInfo.cpp", + "RISCVISelDAGToDAG.cpp", + "RISCVISelLowering.cpp", + "RISCVMCInstLower.cpp", + "RISCVMergeBaseOffset.cpp", + "RISCVRegisterInfo.cpp", + "RISCVSubtarget.cpp", + "RISCVTargetMachine.cpp", + "RISCVTargetObjectFile.cpp", + ] +} + +# This is a bit different from most build files: Due to this group +# having the directory's name, "//llvm/lib/Target/RISCV" will refer to this +# target, which pulls in the code in this directory *and all subdirectories*. +# For most other directories, "//llvm/lib/Foo" only pulls in the code directly +# in "llvm/lib/Foo". The forwarding targets in //llvm/lib/Target expect this +# different behavior. +group("RISCV") { + deps = [ + ":LLVMRISCVCodeGen", + "AsmParser", + "Disassembler", + "MCTargetDesc", + "TargetInfo", + "Utils", + ] +} Index: llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Disassembler/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Disassembler/BUILD.gn @@ -0,0 +1,22 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("RISCVGenDisassemblerTables") { + visibility = [ ":Disassembler" ] + args = [ "-gen-disassembler" ] + td_file = "../RISCV.td" +} + +static_library("Disassembler") { + output_name = "LLVMRISCVDisassembler" + deps = [ + ":RISCVGenDisassemblerTables", + "//llvm/lib/MC/MCDisassembler", + "//llvm/lib/Support", + "//llvm/lib/Target/RISCV/MCTargetDesc", + "//llvm/lib/Target/RISCV/Utils", + ] + include_dirs = [ ".." ] + sources = [ + "RISCVDisassembler.cpp", + ] +} Index: llvm/utils/gn/secondary/llvm/lib/Target/RISCV/MCTargetDesc/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/llvm/lib/Target/RISCV/MCTargetDesc/BUILD.gn @@ -0,0 +1,73 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("RISCVGenAsmWriter") { + visibility = [ ":MCTargetDesc" ] + args = [ "-gen-asm-writer" ] + td_file = "../RISCV.td" +} + +tablegen("RISCVGenInstrInfo") { + visibility = [ ":tablegen" ] + args = [ "-gen-instr-info" ] + td_file = "../RISCV.td" +} + +tablegen("RISCVGenMCCodeEmitter") { + visibility = [ ":MCTargetDesc" ] + args = [ "-gen-emitter" ] + td_file = "../RISCV.td" +} + +tablegen("RISCVGenRegisterInfo") { + visibility = [ ":tablegen" ] + args = [ "-gen-register-info" ] + td_file = "../RISCV.td" +} + +tablegen("RISCVGenSubtargetInfo") { + visibility = [ ":tablegen" ] + args = [ "-gen-subtarget" ] + td_file = "../RISCV.td" +} + +# This should contain tablegen targets generating .inc files included +# by other targets. .inc files only used by .cpp files in this directory +# should be in deps on the static_library instead. +group("tablegen") { + visibility = [ + ":MCTargetDesc", + "../Utils", + ] + public_deps = [ + ":RISCVGenInstrInfo", + ":RISCVGenRegisterInfo", + ":RISCVGenSubtargetInfo", + ] +} + +static_library("MCTargetDesc") { + output_name = "LLVMRISCVDesc" + public_deps = [ + ":tablegen", + ] + deps = [ + ":RISCVGenAsmWriter", + ":RISCVGenMCCodeEmitter", + "//llvm/lib/MC", + "//llvm/lib/Support", + "//llvm/lib/Target/RISCV:tablegen", + "//llvm/lib/Target/RISCV/Utils", + ] + include_dirs = [ ".." ] + sources = [ + "RISCVAsmBackend.cpp", + "RISCVELFObjectWriter.cpp", + "RISCVInstPrinter.cpp", + "RISCVMCAsmInfo.cpp", + "RISCVMCCodeEmitter.cpp", + "RISCVMCExpr.cpp", + "RISCVMCTargetDesc.cpp", + "RISCVTargetStreamer.cpp", + "RISCVELFStreamer.cpp", + ] +} Index: llvm/utils/gn/secondary/llvm/lib/Target/RISCV/TargetInfo/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/llvm/lib/Target/RISCV/TargetInfo/BUILD.gn @@ -0,0 +1,10 @@ +static_library("TargetInfo") { + output_name = "LLVMRISCVInfo" + deps = [ + "//llvm/lib/Support", + ] + include_dirs = [ ".." ] + sources = [ + "RISCVTargetInfo.cpp", + ] +} Index: llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Utils/BUILD.gn =================================================================== --- /dev/null +++ llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Utils/BUILD.gn @@ -0,0 +1,25 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("RISCVGenSystemOperands") { + visibility = [ ":Utils" ] + args = [ "-gen-searchable-tables" ] + td_file = "../RISCV.td" +} + +static_library("Utils") { + output_name = "LLVMRISCVUtils" + public_deps = [ + ":RISCVGenSystemOperands", + ] + deps = [ + "//llvm/lib/MC", + "//llvm/lib/Support", + "//llvm/lib/Target/RISCV/MCTargetDesc:tablegen", + ] + + include_dirs = [ ".." ] + sources = [ + "RISCVBaseInfo.cpp", + "RISCVMatInt.cpp", + ] +} Index: llvm/utils/gn/secondary/llvm/lib/Target/targets.gni =================================================================== --- llvm/utils/gn/secondary/llvm/lib/Target/targets.gni +++ llvm/utils/gn/secondary/llvm/lib/Target/targets.gni @@ -26,12 +26,13 @@ "Hexagon", "Lanai", "PowerPC", + "RISCV", "Sparc", "WebAssembly", "X86", ] } # Validate that llvm_targets_to_build is set to a list of valid targets, # and remember which targets are built. llvm_build_AArch64 = false @@ -53,6 +54,8 @@ # Nothing to do. } else if (target == "PowerPC") { llvm_build_PowerPC = true + } else if (target == "RISCV") { + # Nothing to do. } else if (target == "Sparc") { # Nothing to do. } else if (target == "WebAssembly") {