diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/AsmParser/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/AsmParser/BUILD.gn new file mode 100644 --- /dev/null +++ b/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/AsmParser/BUILD.gn @@ -0,0 +1,22 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("LanaiGenAsmMatcher") { + visibility = [ ":AsmParser" ] + args = [ "-gen-asm-matcher" ] + td_file = "../Lanai.td" +} + +static_library("AsmParser") { + output_name = "LLVMLanaiAsmParser" + deps = [ + ":LanaiGenAsmMatcher", + "//llvm/lib/MC", + "//llvm/lib/MC/MCParser", + "//llvm/lib/Support", + "//llvm/lib/Target/Lanai/MCTargetDesc", + ] + include_dirs = [ ".." ] + sources = [ + "LanaiAsmParser.cpp", + ] +} diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/BUILD.gn new file mode 100644 --- /dev/null +++ b/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/BUILD.gn @@ -0,0 +1,64 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("LanaiGenCallingConv") { + visibility = [ ":LLVMLanaiCodeGen" ] + args = [ "-gen-callingconv" ] + td_file = "Lanai.td" +} + +tablegen("LanaiGenDAGISel") { + visibility = [ ":LLVMLanaiCodeGen" ] + args = [ "-gen-dag-isel" ] + td_file = "Lanai.td" +} + +static_library("LLVMLanaiCodeGen") { + deps = [ + ":LanaiGenCallingConv", + ":LanaiGenDAGISel", + "MCTargetDesc", + "TargetInfo", + "//llvm/include/llvm/Config:llvm-config", + "//llvm/lib/Analysis", + "//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 = [ + "LanaiAsmPrinter.cpp", + "LanaiDelaySlotFiller.cpp", + "LanaiFrameLowering.cpp", + "LanaiInstrInfo.cpp", + "LanaiISelDAGToDAG.cpp", + "LanaiISelLowering.cpp", + "LanaiMachineFunctionInfo.cpp", + "LanaiMCInstLower.cpp", + "LanaiMemAluCombiner.cpp", + "LanaiRegisterInfo.cpp", + "LanaiSelectionDAGInfo.cpp", + "LanaiSubtarget.cpp", + "LanaiTargetMachine.cpp", + "LanaiTargetObjectFile.cpp", + ] +} + +# This is a bit different from most build files: Due to this group +# having the directory's name, "//llvm/lib/Target/Lanai" 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("Lanai") { + deps = [ + ":LLVMLanaiCodeGen", + "AsmParser", + "Disassembler", + "MCTargetDesc", + "TargetInfo", + ] +} diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/Disassembler/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/Disassembler/BUILD.gn new file mode 100644 --- /dev/null +++ b/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/Disassembler/BUILD.gn @@ -0,0 +1,22 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("LanaiGenDisassemblerTables") { + visibility = [ ":Disassembler" ] + args = [ "-gen-disassembler" ] + td_file = "../Lanai.td" +} + +static_library("Disassembler") { + output_name = "LLVMLanaiDisassembler" + deps = [ + ":LanaiGenDisassemblerTables", + "//llvm/lib/MC/MCDisassembler", + "//llvm/lib/Support", + "//llvm/lib/Target/Lanai/MCTargetDesc", + "//llvm/lib/Target/Lanai/TargetInfo", + ] + include_dirs = [ ".." ] + sources = [ + "LanaiDisassembler.cpp", + ] +} diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/MCTargetDesc/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/MCTargetDesc/BUILD.gn new file mode 100644 --- /dev/null +++ b/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/MCTargetDesc/BUILD.gn @@ -0,0 +1,67 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("LanaiGenAsmWriter") { + visibility = [ ":tablegen" ] + args = [ "-gen-asm-writer" ] + td_file = "../Lanai.td" +} + +tablegen("LanaiGenInstrInfo") { + visibility = [ ":tablegen" ] + args = [ "-gen-instr-info" ] + td_file = "../Lanai.td" +} + +tablegen("LanaiGenMCCodeEmitter") { + visibility = [ ":tablegen" ] + args = [ "-gen-emitter" ] + td_file = "../Lanai.td" +} + +tablegen("LanaiGenRegisterInfo") { + visibility = [ ":tablegen" ] + args = [ "-gen-register-info" ] + td_file = "../Lanai.td" +} + +tablegen("LanaiGenSubtargetInfo") { + visibility = [ ":tablegen" ] + args = [ "-gen-subtarget" ] + td_file = "../Lanai.td" +} + +group("tablegen") { + visibility = [ + ":MCTargetDesc", + "../TargetInfo", + ] + public_deps = [ + ":LanaiGenAsmWriter", + ":LanaiGenInstrInfo", + ":LanaiGenMCCodeEmitter", + ":LanaiGenRegisterInfo", + ":LanaiGenSubtargetInfo", + ] +} + +static_library("MCTargetDesc") { + output_name = "LLVMLanaiDesc" + public_deps = [ + ":tablegen", + ] + deps = [ + "//llvm/lib/MC", + "//llvm/lib/Support", + "//llvm/lib/Target/Lanai/TargetInfo", + ] + include_dirs = [ ".." ] + sources = [ + "LanaiAsmBackend.cpp", + "LanaiELFObjectWriter.cpp", + "LanaiInstPrinter.cpp", + "LanaiMCAsmInfo.cpp", + "LanaiMCCodeEmitter.cpp", + "LanaiMCExpr.cpp", + "LanaiMCTargetDesc.cpp", + ] +} diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/TargetInfo/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/TargetInfo/BUILD.gn new file mode 100644 --- /dev/null +++ b/llvm/utils/gn/secondary/llvm/lib/Target/Lanai/TargetInfo/BUILD.gn @@ -0,0 +1,11 @@ +static_library("TargetInfo") { + output_name = "LLVMLanaiInfo" + deps = [ + "//llvm/lib/IR", + "//llvm/lib/Support", + ] + include_dirs = [ ".." ] + sources = [ + "LanaiTargetInfo.cpp", + ] +} diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/targets.gni b/llvm/utils/gn/secondary/llvm/lib/Target/targets.gni --- a/llvm/utils/gn/secondary/llvm/lib/Target/targets.gni +++ b/llvm/utils/gn/secondary/llvm/lib/Target/targets.gni @@ -23,6 +23,7 @@ "AArch64", "ARM", "BPF", + "Lanai", "PowerPC", "WebAssembly", "X86", @@ -34,6 +35,7 @@ llvm_build_AArch64 = false llvm_build_ARM = false llvm_build_BPF = false +llvm_build_Lanai = false llvm_build_PowerPC = false llvm_build_WebAssembly = false llvm_build_X86 = false @@ -44,6 +46,8 @@ llvm_build_ARM = true } else if (target == "BPF") { llvm_build_BPF = true + } else if (target == "Lanai") { + llvm_build_Lanai = true } else if (target == "PowerPC") { llvm_build_PowerPC = true } else if (target == "WebAssembly") {