Skip to content

Commit

Permalink
gn build: Add Mips target
Browse files Browse the repository at this point in the history
llvm-svn: 363159
  • Loading branch information
nico committed Jun 12, 2019
1 parent 1e21181 commit 4c69c56
Show file tree
Hide file tree
Showing 7 changed files with 253 additions and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/utils/gn/TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Ideas for things to do:
- once there are more projects, have an llvm_enable_projects arg, modeled
after llvm_targets_to_build in the GN build
- a check-all build target that runs test of all projects
- more targets (AVR MIPS RISCV SystemZ etc)
- more targets (AMDGPU ARC AVR MSP430 NVPTX SystemZ XCore)
- example: https://reviews.llvm.org/D56416
- investigate feasibility of working `gn check`

Expand Down
23 changes: 23 additions & 0 deletions llvm/utils/gn/secondary/llvm/lib/Target/Mips/AsmParser/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import("//llvm/utils/TableGen/tablegen.gni")

tablegen("MipsGenAsmMatcher") {
visibility = [ ":AsmParser" ]
args = [ "-gen-asm-matcher" ]
td_file = "../Mips.td"
}

static_library("AsmParser") {
output_name = "LLVMMipsAsmParser"
deps = [
":MipsGenAsmMatcher",
"//llvm/lib/MC",
"//llvm/lib/MC/MCParser",
"//llvm/lib/Support",
"//llvm/lib/Target/Mips/MCTargetDesc",
"//llvm/lib/Target/Mips/TargetInfo",
]
include_dirs = [ ".." ]
sources = [
"MipsAsmParser.cpp",
]
}
118 changes: 118 additions & 0 deletions llvm/utils/gn/secondary/llvm/lib/Target/Mips/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import("//llvm/utils/TableGen/tablegen.gni")

tablegen("MipsGenCallingConv") {
visibility = [ ":LLVMMipsCodeGen" ]
args = [ "-gen-callingconv" ]
td_file = "Mips.td"
}

tablegen("MipsGenDAGISel") {
visibility = [ ":LLVMMipsCodeGen" ]
args = [ "-gen-dag-isel" ]
td_file = "Mips.td"
}

tablegen("MipsGenFastISel") {
visibility = [ ":LLVMMipsCodeGen" ]
args = [ "-gen-fast-isel" ]
td_file = "Mips.td"
}

tablegen("MipsGenGlobalISel") {
visibility = [ ":LLVMMipsCodeGen" ]
args = [ "-gen-global-isel" ]
td_file = "Mips.td"
}

tablegen("MipsGenMCPseudoLowering") {
visibility = [ ":LLVMMipsCodeGen" ]
args = [ "-gen-pseudo-lowering" ]
td_file = "Mips.td"
}

tablegen("MipsGenRegisterBank") {
visibility = [ ":LLVMMipsCodeGen" ]
args = [ "-gen-register-bank" ]
td_file = "Mips.td"
}

static_library("LLVMMipsCodeGen") {
deps = [
":MipsGenCallingConv",
":MipsGenDAGISel",
":MipsGenFastISel",
":MipsGenGlobalISel",
":MipsGenMCPseudoLowering",
":MipsGenRegisterBank",
"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 = [
"MicroMipsSizeReduction.cpp",
"Mips16FrameLowering.cpp",
"Mips16HardFloat.cpp",
"Mips16HardFloatInfo.cpp",
"Mips16ISelDAGToDAG.cpp",
"Mips16ISelLowering.cpp",
"Mips16InstrInfo.cpp",
"Mips16RegisterInfo.cpp",
"MipsAnalyzeImmediate.cpp",
"MipsAsmPrinter.cpp",
"MipsBranchExpansion.cpp",
"MipsCCState.cpp",
"MipsCallLowering.cpp",
"MipsConstantIslandPass.cpp",
"MipsDelaySlotFiller.cpp",
"MipsExpandPseudo.cpp",
"MipsFastISel.cpp",
"MipsFrameLowering.cpp",
"MipsISelDAGToDAG.cpp",
"MipsISelLowering.cpp",
"MipsInstrInfo.cpp",
"MipsInstructionSelector.cpp",
"MipsLegalizerInfo.cpp",
"MipsMCInstLower.cpp",
"MipsMachineFunction.cpp",
"MipsModuleISelDAGToDAG.cpp",
"MipsOptimizePICCall.cpp",
"MipsOs16.cpp",
"MipsPreLegalizerCombiner.cpp",
"MipsRegisterBankInfo.cpp",
"MipsRegisterInfo.cpp",
"MipsSEFrameLowering.cpp",
"MipsSEISelDAGToDAG.cpp",
"MipsSEISelLowering.cpp",
"MipsSEInstrInfo.cpp",
"MipsSERegisterInfo.cpp",
"MipsSubtarget.cpp",
"MipsTargetMachine.cpp",
"MipsTargetObjectFile.cpp",
]
}

# This is a bit different from most build files: Due to this group
# having the directory's name, "//llvm/lib/Target/Mips" 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("Mips") {
deps = [
":LLVMMipsCodeGen",
"AsmParser",
"Disassembler",
"MCTargetDesc",
"TargetInfo",
]
}
22 changes: 22 additions & 0 deletions llvm/utils/gn/secondary/llvm/lib/Target/Mips/Disassembler/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import("//llvm/utils/TableGen/tablegen.gni")

tablegen("MipsGenDisassemblerTables") {
visibility = [ ":Disassembler" ]
args = [ "-gen-disassembler" ]
td_file = "../Mips.td"
}

static_library("Disassembler") {
output_name = "LLVMMipsDisassembler"
deps = [
":MipsGenDisassemblerTables",
"//llvm/lib/MC/MCDisassembler",
"//llvm/lib/Support",
"//llvm/lib/Target/Mips/MCTargetDesc",
"//llvm/lib/Target/Mips/TargetInfo",
]
include_dirs = [ ".." ]
sources = [
"MipsDisassembler.cpp",
]
}
76 changes: 76 additions & 0 deletions llvm/utils/gn/secondary/llvm/lib/Target/Mips/MCTargetDesc/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import("//llvm/utils/TableGen/tablegen.gni")

tablegen("MipsGenAsmWriter") {
visibility = [ ":MCTargetDesc" ]
args = [ "-gen-asm-writer" ]
td_file = "../Mips.td"
}

tablegen("MipsGenInstrInfo") {
visibility = [ ":tablegen" ]
args = [ "-gen-instr-info" ]
td_file = "../Mips.td"
}

tablegen("MipsGenMCCodeEmitter") {
visibility = [ ":MCTargetDesc" ]
args = [ "-gen-emitter" ]
td_file = "../Mips.td"
}

tablegen("MipsGenRegisterInfo") {
visibility = [ ":tablegen" ]
args = [ "-gen-register-info" ]
td_file = "../Mips.td"
}

tablegen("MipsGenSubtargetInfo") {
visibility = [ ":tablegen" ]
args = [ "-gen-subtarget" ]
td_file = "../Mips.td"
}

# 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 on the static_library instead.
group("tablegen") {
visibility = [
":MCTargetDesc",
"../TargetInfo",
]
public_deps = [
":MipsGenInstrInfo",
":MipsGenRegisterInfo",
":MipsGenSubtargetInfo",
]
}

static_library("MCTargetDesc") {
output_name = "LLVMMipsDesc"
public_deps = [
":tablegen",
]
deps = [
":MipsGenAsmWriter",
":MipsGenMCCodeEmitter",
"//llvm/lib/MC",
"//llvm/lib/Support",
"//llvm/lib/Target/Mips/TargetInfo",
]
include_dirs = [ ".." ]
sources = [
"MipsABIFlagsSection.cpp",
"MipsABIInfo.cpp",
"MipsAsmBackend.cpp",
"MipsELFObjectWriter.cpp",
"MipsELFStreamer.cpp",
"MipsInstPrinter.cpp",
"MipsMCAsmInfo.cpp",
"MipsMCCodeEmitter.cpp",
"MipsMCExpr.cpp",
"MipsMCTargetDesc.cpp",
"MipsNaClELFStreamer.cpp",
"MipsOptionRecord.cpp",
"MipsTargetStreamer.cpp",
]
}
10 changes: 10 additions & 0 deletions llvm/utils/gn/secondary/llvm/lib/Target/Mips/TargetInfo/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
static_library("TargetInfo") {
output_name = "LLVMMipsInfo"
deps = [
"//llvm/lib/Support",
]
include_dirs = [ ".." ]
sources = [
"MipsTargetInfo.cpp",
]
}
3 changes: 3 additions & 0 deletions llvm/utils/gn/secondary/llvm/lib/Target/targets.gni
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ if (llvm_targets_to_build == "host") {
"BPF",
"Hexagon",
"Lanai",
"Mips",
"PowerPC",
"Sparc",
"WebAssembly",
Expand All @@ -51,6 +52,8 @@ foreach(target, llvm_targets_to_build) {
# Nothing to do.
} else if (target == "Lanai") {
# Nothing to do.
} else if (target == "Mips") {
# Nothing to do.
} else if (target == "PowerPC") {
llvm_build_PowerPC = true
} else if (target == "RISCV") {
Expand Down

0 comments on commit 4c69c56

Please sign in to comment.