diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/AsmParser/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/AsmParser/BUILD.gn new file mode 100644 index 000000000000..158f9e97fd84 --- /dev/null +++ b/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/AsmParser/BUILD.gn @@ -0,0 +1,23 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("WebAssemblyGenAsmMatcher") { + visibility = [ ":AsmParser" ] + args = [ "-gen-asm-matcher" ] + td_file = "../WebAssembly.td" +} + +static_library("AsmParser") { + output_name = "LLVMWebAssemblyAsmParser" + deps = [ + ":WebAssemblyGenAsmMatcher", + "//llvm/lib/MC", + "//llvm/lib/MC/MCParser", + "//llvm/lib/Support", + "//llvm/lib/Target/WebAssembly/MCTargetDesc", + "//llvm/lib/Target/WebAssembly/TargetInfo", + ] + include_dirs = [ ".." ] + sources = [ + "WebAssemblyAsmParser.cpp", + ] +} diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/BUILD.gn new file mode 100644 index 000000000000..58781a070ccf --- /dev/null +++ b/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/BUILD.gn @@ -0,0 +1,121 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("WebAssemblyGenCallingConv") { + visibility = [ ":LLVMWebAssemblyCodeGen" ] + args = [ "-gen-callingconv" ] + td_file = "WebAssembly.td" +} + +tablegen("WebAssemblyGenDAGISel") { + visibility = [ ":LLVMWebAssemblyCodeGen" ] + args = [ "-gen-dag-isel" ] + td_file = "WebAssembly.td" +} + +tablegen("WebAssemblyGenFastISel") { + visibility = [ ":LLVMWebAssemblyCodeGen" ] + args = [ "-gen-fast-isel" ] + td_file = "WebAssembly.td" +} + +tablegen("WebAssemblyGenGlobalISel") { + visibility = [ ":LLVMWebAssemblyCodeGen" ] + args = [ "-gen-global-isel" ] + td_file = "WebAssembly.td" +} + +tablegen("WebAssemblyGenMCPseudoLowering") { + visibility = [ ":LLVMWebAssemblyCodeGen" ] + args = [ "-gen-pseudo-lowering" ] + td_file = "WebAssembly.td" +} + +tablegen("WebAssemblyGenRegisterBank") { + visibility = [ ":LLVMWebAssemblyCodeGen" ] + args = [ "-gen-register-bank" ] + td_file = "WebAssembly.td" +} + +static_library("LLVMWebAssemblyCodeGen") { + deps = [ + ":WebAssemblyGenCallingConv", + ":WebAssemblyGenDAGISel", + ":WebAssemblyGenFastISel", + ":WebAssemblyGenGlobalISel", + ":WebAssemblyGenMCPseudoLowering", + ":WebAssemblyGenRegisterBank", + "InstPrinter", + "MCTargetDesc", + "TargetInfo", + "//llvm/include/llvm/Config:llvm-config", + "//llvm/lib/Analysis", + "//llvm/lib/CodeGen", + "//llvm/lib/CodeGen/AsmPrinter", + "//llvm/lib/CodeGen/GlobalISel", + "//llvm/lib/CodeGen/SelectionDAG", + "//llvm/lib/IR", + "//llvm/lib/MC", + "//llvm/lib/Support", + "//llvm/lib/Target", + ] + include_dirs = [ "." ] + sources = [ + "WebAssemblyAddMissingPrototypes.cpp", + "WebAssemblyArgumentMove.cpp", + "WebAssemblyAsmPrinter.cpp", + "WebAssemblyCFGSort.cpp", + "WebAssemblyCFGStackify.cpp", + "WebAssemblyCallIndirectFixup.cpp", + "WebAssemblyEHRestoreStackPointer.cpp", + "WebAssemblyExceptionInfo.cpp", + "WebAssemblyExplicitLocals.cpp", + "WebAssemblyFastISel.cpp", + "WebAssemblyFixFunctionBitcasts.cpp", + "WebAssemblyFixIrreducibleControlFlow.cpp", + "WebAssemblyFrameLowering.cpp", + "WebAssemblyISelDAGToDAG.cpp", + "WebAssemblyISelLowering.cpp", + "WebAssemblyInstrInfo.cpp", + "WebAssemblyLateEHPrepare.cpp", + "WebAssemblyLowerBrUnless.cpp", + "WebAssemblyLowerEmscriptenEHSjLj.cpp", + "WebAssemblyLowerGlobalDtors.cpp", + "WebAssemblyMCInstLower.cpp", + "WebAssemblyMachineFunctionInfo.cpp", + "WebAssemblyOptimizeLiveIntervals.cpp", + "WebAssemblyOptimizeReturned.cpp", + "WebAssemblyPeephole.cpp", + "WebAssemblyPrepareForLiveIntervals.cpp", + "WebAssemblyRegColoring.cpp", + "WebAssemblyRegNumbering.cpp", + "WebAssemblyRegStackify.cpp", + "WebAssemblyRegisterInfo.cpp", + "WebAssemblyReplacePhysRegs.cpp", + "WebAssemblyRuntimeLibcallSignatures.cpp", + "WebAssemblySelectionDAGInfo.cpp", + "WebAssemblySetP2AlignOperands.cpp", + "WebAssemblyStoreResults.cpp", + "WebAssemblySubtarget.cpp", + "WebAssemblyTargetMachine.cpp", + "WebAssemblyTargetObjectFile.cpp", + "WebAssemblyTargetTransformInfo.cpp", + "WebAssemblyUtilities.cpp", + ] +} + +# This is a bit different from most build files: Due to this group +# having the directory's name, "//llvm/lib/Target/AArch64" 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("WebAssembly") { + deps = [ + ":LLVMWebAssemblyCodeGen", + "AsmParser", + "Disassembler", + "InstPrinter", + "MCTargetDesc", + "TargetInfo", + ] +} diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/Disassembler/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/Disassembler/BUILD.gn new file mode 100644 index 000000000000..44e586dbdd79 --- /dev/null +++ b/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/Disassembler/BUILD.gn @@ -0,0 +1,23 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("WebAssemblyGenDisassemblerTables") { + visibility = [ ":Disassembler" ] + args = [ "-gen-disassembler" ] + td_file = "../WebAssembly.td" +} + +static_library("Disassembler") { + output_name = "LLVMWebAssemblyDisassembler" + deps = [ + ":WebAssemblyGenDisassemblerTables", + "//llvm/lib/MC", + "//llvm/lib/MC/MCDisassembler", + "//llvm/lib/Support", + "//llvm/lib/Target/WebAssembly/MCTargetDesc", + "//llvm/lib/Target/WebAssembly/TargetInfo", + ] + include_dirs = [ ".." ] + sources = [ + "WebAssemblyDisassembler.cpp", + ] +} diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/InstPrinter/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/InstPrinter/BUILD.gn new file mode 100644 index 000000000000..e63ea79174e9 --- /dev/null +++ b/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/InstPrinter/BUILD.gn @@ -0,0 +1,24 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("WebAssemblyGenAsmWriter") { + visibility = [ ":InstPrinter" ] + args = [ "-gen-asm-writer" ] + td_file = "../WebAssembly.td" +} + +static_library("InstPrinter") { + output_name = "LLVMWebAssemblyAsmPrinter" + deps = [ + ":WebAssemblyGenAsmWriter", + "//llvm/lib/MC", + "//llvm/lib/Support", + + # MCTargetDesc depends on InstPrinter, so we can't depend on the full + # MCTargetDesc target here: it would form a cycle. + "//llvm/lib/Target/WebAssembly/MCTargetDesc:tablegen", + ] + include_dirs = [ ".." ] + sources = [ + "WebAssemblyInstPrinter.cpp", + ] +} diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/MCTargetDesc/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/MCTargetDesc/BUILD.gn new file mode 100644 index 000000000000..8d8e6c0a0e90 --- /dev/null +++ b/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/MCTargetDesc/BUILD.gn @@ -0,0 +1,61 @@ +import("//llvm/utils/TableGen/tablegen.gni") + +tablegen("WebAssemblyGenInstrInfo") { + visibility = [ ":tablegen" ] + args = [ "-gen-instr-info" ] + td_file = "../WebAssembly.td" +} + +tablegen("WebAssemblyGenMCCodeEmitter") { + visibility = [ ":tablegen" ] + args = [ "-gen-emitter" ] + td_file = "../WebAssembly.td" +} + +tablegen("WebAssemblyGenRegisterInfo") { + visibility = [ ":tablegen" ] + args = [ "-gen-register-info" ] + td_file = "../WebAssembly.td" +} + +tablegen("WebAssemblyGenSubtargetInfo") { + visibility = [ ":tablegen" ] + args = [ "-gen-subtarget" ] + td_file = "../WebAssembly.td" +} + +group("tablegen") { + visibility = [ + ":MCTargetDesc", + "../InstPrinter", + "../TargetInfo", + "../Utils", + ] + public_deps = [ + ":WebAssemblyGenInstrInfo", + ":WebAssemblyGenMCCodeEmitter", + ":WebAssemblyGenRegisterInfo", + ":WebAssemblyGenSubtargetInfo", + ] +} +static_library("MCTargetDesc") { + output_name = "LLVMWebAssemblyDesc" + public_deps = [ + ":tablegen", + ] + deps = [ + "//llvm/lib/MC", + "//llvm/lib/Support", + "//llvm/lib/Target/WebAssembly/InstPrinter", + "//llvm/lib/Target/WebAssembly/TargetInfo", + ] + include_dirs = [ ".." ] + sources = [ + "WebAssemblyAsmBackend.cpp", + "WebAssemblyMCAsmInfo.cpp", + "WebAssemblyMCCodeEmitter.cpp", + "WebAssemblyMCTargetDesc.cpp", + "WebAssemblyTargetStreamer.cpp", + "WebAssemblyWasmObjectWriter.cpp", + ] +} diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/TargetInfo/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/TargetInfo/BUILD.gn new file mode 100644 index 000000000000..334183bb5d6f --- /dev/null +++ b/llvm/utils/gn/secondary/llvm/lib/Target/WebAssembly/TargetInfo/BUILD.gn @@ -0,0 +1,14 @@ +static_library("TargetInfo") { + output_name = "LLVMWebAssemblyInfo" + deps = [ + "//llvm/lib/Support", + + # MCTargetDesc depends on TargetInfo, so we can't depend on the full + # MCTargetDesc target here: it would form a cycle. + "//llvm/lib/Target/WebAssembly/MCTargetDesc:tablegen", + ] + include_dirs = [ ".." ] + sources = [ + "WebAssemblyTargetInfo.cpp", + ] +} diff --git a/llvm/utils/gn/secondary/llvm/lib/Target/targets.gni b/llvm/utils/gn/secondary/llvm/lib/Target/targets.gni index 01252d0c4d0f..5a01d7f758c4 100644 --- a/llvm/utils/gn/secondary/llvm/lib/Target/targets.gni +++ b/llvm/utils/gn/secondary/llvm/lib/Target/targets.gni @@ -20,6 +20,7 @@ if (llvm_targets_to_build == "host") { llvm_targets_to_build = [ "AArch64", "ARM", + "WebAssembly", "X86", ] } @@ -28,12 +29,15 @@ if (llvm_targets_to_build == "host") { # and remember which targets are built. llvm_build_AArch64 = false llvm_build_ARM = false +llvm_build_WebAssembly = false llvm_build_X86 = false foreach(target, llvm_targets_to_build) { if (target == "AArch64") { llvm_build_AArch64 = true } else if (target == "ARM") { llvm_build_ARM = true + } else if (target == "WebAssembly") { + llvm_build_WebAssembly = true } else if (target == "X86") { llvm_build_X86 = true } else { diff --git a/llvm/utils/gn/secondary/llvm/unittests/BUILD.gn b/llvm/utils/gn/secondary/llvm/unittests/BUILD.gn index 89cb9b6724b3..de8e89ff4343 100644 --- a/llvm/utils/gn/secondary/llvm/unittests/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/unittests/BUILD.gn @@ -54,6 +54,9 @@ group("unittests") { if (llvm_build_ARM) { deps += [ "tools/llvm-exegesis/ARM:LLVMExegesisARMTests" ] } + if (llvm_build_WebAssembly) { + deps += [ "Target/WebAssembly:WebAssemblyTests" ] + } if (llvm_build_X86) { deps += [ "tools/llvm-exegesis/X86:LLVMExegesisX86Tests" ] } diff --git a/llvm/utils/gn/secondary/llvm/unittests/Target/WebAssembly/BUILD.gn b/llvm/utils/gn/secondary/llvm/unittests/Target/WebAssembly/BUILD.gn new file mode 100644 index 000000000000..e02149f738d6 --- /dev/null +++ b/llvm/utils/gn/secondary/llvm/unittests/Target/WebAssembly/BUILD.gn @@ -0,0 +1,18 @@ +import("//llvm/utils/unittest/unittest.gni") + +unittest("WebAssemblyTests") { + deps = [ + "//llvm/lib/CodeGen", + "//llvm/lib/CodeGen/MIRParser", + "//llvm/lib/IR", + "//llvm/lib/MC", + "//llvm/lib/Support", + "//llvm/lib/Target/WebAssembly:LLVMWebAssemblyCodeGen", + "//llvm/lib/Target/WebAssembly/MCTargetDesc", + "//llvm/lib/Target/WebAssembly/TargetInfo", + ] + include_dirs = [ "//llvm/lib/Target/WebAssembly" ] + sources = [ + "WebAssemblyExceptionInfoTest.cpp", + ] +}