--- /dev/null
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("LoongArchGenAsmMatcher") {
+ visibility = [
+ ":AsmParser",
+ "//llvm/lib/Target/LoongArch:LLVMLoongArchCodeGen",
+ ]
+ args = [ "-gen-asm-matcher" ]
+ td_file = "../LoongArch.td"
+}
+
+static_library("AsmParser") {
+ output_name = "LLVMLoongArchAsmParser"
+ deps = [
+ ":LoongArchGenAsmMatcher",
+ "//llvm/lib/MC",
+ "//llvm/lib/MC/MCParser",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/LoongArch/MCTargetDesc",
+ "//llvm/lib/Target/LoongArch/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [ "LoongArchAsmParser.cpp" ]
+}
--- /dev/null
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("LoongArchGenDAGISel") {
+ visibility = [ ":LLVMLoongArchCodeGen" ]
+ args = [ "-gen-dag-isel" ]
+ td_file = "LoongArch.td"
+}
+
+tablegen("LoongArchGenMCPseudoLowering") {
+ visibility = [ ":LLVMLoongArchCodeGen" ]
+ args = [ "-gen-pseudo-lowering" ]
+ td_file = "LoongArch.td"
+}
+
+
+static_library("LLVMLoongArchCodeGen") {
+ deps = [
+ ":LoongArchGenDAGISel",
+ ":LoongArchGenMCPseudoLowering",
+
+ # See https://reviews.llvm.org/D137532
+ "AsmParser:LoongArchGenAsmMatcher",
+ "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 = [
+ "LoongArchAsmPrinter.cpp",
+ "LoongArchExpandAtomicPseudoInsts.cpp",
+ "LoongArchExpandPseudoInsts.cpp",
+ "LoongArchFrameLowering.cpp",
+ "LoongArchInstrInfo.cpp",
+ "LoongArchISelDAGToDAG.cpp",
+ "LoongArchISelLowering.cpp",
+ "LoongArchMCInstLower.cpp",
+ "LoongArchRegisterInfo.cpp",
+ "LoongArchSubtarget.cpp",
+ "LoongArchTargetMachine.cpp",
+ ]
+}
+
+# This is a bit different from most build files: Due to this group
+# having the directory's name, "//llvm/lib/Target/LoongArch" 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("LoongArch") {
+ deps = [
+ ":LLVMLoongArchCodeGen",
+ "AsmParser",
+ "Disassembler",
+ "MCTargetDesc",
+ "TargetInfo",
+ ]
+}
--- /dev/null
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("LoongArchGenDisassemblerTables") {
+ visibility = [ ":Disassembler" ]
+ args = [ "-gen-disassembler" ]
+ td_file = "../LoongArch.td"
+}
+
+static_library("Disassembler") {
+ output_name = "LLVMLoongArchDisassembler"
+ deps = [
+ ":LoongArchGenDisassemblerTables",
+ "//llvm/lib/MC/MCDisassembler",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/LoongArch/MCTargetDesc",
+ "//llvm/lib/Target/LoongArch/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [ "LoongArchDisassembler.cpp" ]
+}
--- /dev/null
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("LoongArchGenAsmWriter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-asm-writer" ]
+ td_file = "../LoongArch.td"
+}
+
+tablegen("LoongArchGenInstrInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-instr-info" ]
+ td_file = "../LoongArch.td"
+}
+
+tablegen("LoongArchGenMCCodeEmitter") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-emitter" ]
+ td_file = "../LoongArch.td"
+}
+
+tablegen("LoongArchGenRegisterInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-register-info" ]
+ td_file = "../LoongArch.td"
+}
+
+tablegen("LoongArchGenSubtargetInfo") {
+ visibility = [ ":MCTargetDesc" ]
+ args = [ "-gen-subtarget" ]
+ td_file = "../LoongArch.td"
+}
+
+static_library("MCTargetDesc") {
+ output_name = "LLVMLoongArchDesc"
+
+ # 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 instead.
+ public_deps = [
+ ":LoongArchGenInstrInfo",
+ ":LoongArchGenRegisterInfo",
+ ":LoongArchGenSubtargetInfo",
+ ]
+ deps = [
+ ":LoongArchGenAsmWriter",
+ ":LoongArchGenMCCodeEmitter",
+ "//llvm/lib/MC",
+ "//llvm/lib/Support",
+ "//llvm/lib/Target/LoongArch/TargetInfo",
+ ]
+ include_dirs = [ ".." ]
+ sources = [
+ "LoongArchAsmBackend.cpp",
+ "LoongArchBaseInfo.cpp",
+ "LoongArchELFObjectWriter.cpp",
+ "LoongArchELFStreamer.cpp",
+ "LoongArchInstPrinter.cpp",
+ "LoongArchMCAsmInfo.cpp",
+ "LoongArchMCCodeEmitter.cpp",
+ "LoongArchMCExpr.cpp",
+ "LoongArchMCTargetDesc.cpp",
+ "LoongArchMatInt.cpp",
+ "LoongArchTargetStreamer.cpp",
+ ]
+}
--- /dev/null
+static_library("TargetInfo") {
+ output_name = "LLVMLoongArchInfo"
+ deps = [ "//llvm/lib/Support" ]
+ include_dirs = [ ".." ]
+ sources = [ "LoongArchTargetInfo.cpp" ]
+}
"BPF",
"Hexagon",
"Lanai",
+ "LoongArch",
"Mips",
"NVPTX",
"PowerPC",
} else if (target == "X86") {
llvm_build_X86 = true
} else if (target == "AVR" || target == "Hexagon" || target == "Lanai" ||
- target == "NVPTX" || target == "RISCV" || target == "Sparc" ||
- target == "SystemZ") {
+ target == "LoongArch" || target == "NVPTX" || target == "RISCV" ||
+ target == "Sparc" || target == "SystemZ") {
# Nothing to do.
} else {
all_targets_string = ""