forked from OSchip/llvm-project
[gn build] Add build files for llvm/lib/Target/WebAssembly + tests
The WebAssembly target itself is similar to the X86 target in https://reviews.llvm.org/rL348903 The unittests bits are similar to the corresponding AArch64 in https://reviews.llvm.org/rL350499 The motivation for this target is solely that it has a unit test and I want to enable the GN<->CMake unittest syncing check for llvm. (After this, only the PowerPC target is needed and I can turn it on.) Differential Revision: https://reviews.llvm.org/D56374 llvm-svn: 350628
This commit is contained in:
parent
d56edfe13a
commit
8caf42459b
|
@ -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",
|
||||
]
|
||||
}
|
|
@ -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",
|
||||
]
|
||||
}
|
|
@ -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",
|
||||
]
|
||||
}
|
|
@ -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",
|
||||
]
|
||||
}
|
|
@ -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",
|
||||
]
|
||||
}
|
|
@ -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",
|
||||
]
|
||||
}
|
|
@ -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 {
|
||||
|
|
|
@ -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" ]
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue