Index: llvm/trunk/utils/gn/secondary/llvm/lib/Target/WebAssembly/AsmParser/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/lib/Target/WebAssembly/AsmParser/BUILD.gn +++ llvm/trunk/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", + ] +} Index: llvm/trunk/utils/gn/secondary/llvm/lib/Target/WebAssembly/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/lib/Target/WebAssembly/BUILD.gn +++ llvm/trunk/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", + ] +} Index: llvm/trunk/utils/gn/secondary/llvm/lib/Target/WebAssembly/Disassembler/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/lib/Target/WebAssembly/Disassembler/BUILD.gn +++ llvm/trunk/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", + ] +} Index: llvm/trunk/utils/gn/secondary/llvm/lib/Target/WebAssembly/InstPrinter/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/lib/Target/WebAssembly/InstPrinter/BUILD.gn +++ llvm/trunk/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", + ] +} Index: llvm/trunk/utils/gn/secondary/llvm/lib/Target/WebAssembly/MCTargetDesc/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/lib/Target/WebAssembly/MCTargetDesc/BUILD.gn +++ llvm/trunk/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", + ] +} Index: llvm/trunk/utils/gn/secondary/llvm/lib/Target/WebAssembly/TargetInfo/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/lib/Target/WebAssembly/TargetInfo/BUILD.gn +++ llvm/trunk/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", + ] +} Index: llvm/trunk/utils/gn/secondary/llvm/lib/Target/targets.gni =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/lib/Target/targets.gni +++ llvm/trunk/utils/gn/secondary/llvm/lib/Target/targets.gni @@ -20,6 +20,7 @@ llvm_targets_to_build = [ "AArch64", "ARM", + "WebAssembly", "X86", ] } @@ -28,12 +29,15 @@ # 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 { Index: llvm/trunk/utils/gn/secondary/llvm/unittests/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/unittests/BUILD.gn +++ llvm/trunk/utils/gn/secondary/llvm/unittests/BUILD.gn @@ -54,6 +54,9 @@ 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" ] } Index: llvm/trunk/utils/gn/secondary/llvm/unittests/Target/WebAssembly/BUILD.gn =================================================================== --- llvm/trunk/utils/gn/secondary/llvm/unittests/Target/WebAssembly/BUILD.gn +++ llvm/trunk/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", + ] +}