Skip to content

Commit

Permalink
DO NOT MERGE: android: translate soong build rules for libLLVM17
Browse files Browse the repository at this point in the history
Changes to side build external/llvm-project project (llvm 17 version)
and avoid conflicts with external/llvm project targets and variables
Changes in mesa main Android.mk are required for libLLVM17
shared library dependency and cflag -DMESA_LLVM_VERSION_STRING=\"17.0\"

The changelog is described by means of modules and variables
which needed to be renamed in external/llvm-project/llvm/ path:

 #rename the target shared library and all static libraries
find . -type f -name "*.bp" -exec sed -i 's/libLLVM/libLLVM17/g' {} +

 #rename the boostrap and contextual build paths
find . -type f -name "*.bp" -exec sed -i 's/soong\-llvm/\soong-llvm17/g' {} +
find . -type f -name "*.go" -exec sed -i 's/android\/soong\/llvm/android\/soong\/llvm17/g' {} +

 #rename force_build_llvm_components type and module name
find . -type f -name '*.bp' -exec sed -i 's/force_build_llvm_components/force_build_llvm17_components/g' {} +
find . -type f -name '*.go' -exec sed -i 's/force_build_llvm_components/force_build_llvm17_components/g' {} +

 #rename all module that gave 'already defined' error
find . -type f -name '*.bp' -exec sed -i 's/llvm-aarch64-defaults/llvm17-aarch64-defaults/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-aarch64-headers/llvm17-aarch64-headers/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-amdgpu-defaults/llvm17-amdgpu-defaults/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-amdgpu-headers/llvm17-amdgpu-headers/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-arm-defaults/llvm17-arm-defaults/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-arm-headers/llvm17-arm-headers/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-defaults/llvm17-defaults/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-defaults-no-generated-headers/llvm17-defaults-no-generated-headers/g' {} +
 #note the following line replaced all llvm-gen-* entries of the previous versions
find . -type f -name '*.bp' -exec sed -i 's/llvm-gen-/llvm17-gen-/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-headers/llvm17-headers/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-headers-no-generated-headers/llvm17-headers-no-generated-headers/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-lib-defaults/llvm17-lib-defaults/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-mips-defaults/llvm17-mips-defaults/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-mips-headers/llvm17-mips-headers/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-tblgen/llvm17-tblgen/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-x86-defaults/llvm17-x86-defaults/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-x86-headers/llvm17-x86-headers/g' {} +

 #COMMENTED AS NOT NEEDED ANYMORE rename llvm-gen-instcombine module
 #find . -type f -name '*.bp' -exec sed -i 's/llvm-gen-instcombine/llvm17-gen-instcombine/g' {} +

 #rename the binaries
find . -type f -name '*.bp' -exec sed -i 's/LLVMHello/LLVM17Hello/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/LLVMgold/LLVM17gold/g' {} +

 #rename the TableGen binary module and variable in different files
find . -type f -name '*.go' -exec sed -i 's/LLVM TableGen/LLVM17 TableGen/g' {} +
find . -type f -name '*.go' -exec sed -i 's/llvm-tblgen/llvm17-tblgen/g' {} +
find . -type f -name '*.go' -exec sed -i 's/llvmTblgen/llvm17Tblgen/g' {} +
find . -type f -name '*.go' -exec sed -i 's/tblgenRule/tblgenRule17/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm_tblgen/llvm17_tblgen/g' {} +
find . -type f -name '*.go' -exec sed -i 's/llvm_tblgen/llvm17_tblgen/g' {} +
find . -type f -name 'tdtags' -exec sed -i 's/llvm-tblgen/llvm17-tblgen/g' {} +

 #COMMENTED AS NOT NEEDED in external/llvm-project (was: rename the include paths)
 #find . -type f -name '*.bp' -exec sed -i 's/external\/llvm/external\/llvm17/g' {} +
 #find . -type f -name '*.go' -exec sed -i 's/external\/llvm/external\/llvm17/g' {} +

 #rename package, registered types and llvm-config
find . -type f -name '*.go' -exec sed -i 's/package llvm/package llvm17/g' {} +
find . -type f -name '*.go' -exec sed -i 's/llvm_tblgen/llvm17_tblgen/g' {} +
find . -type f -name '*.go' -exec sed -i 's/llvm_defaults/llvm17_defaults/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/ llvm-config / llvm17-config /g' {} +
find . -type f -name '*.bp' -exec sed -i 's/"llvm-config"/"llvm17-config"/g' {} +
find . -type f -name '*.go' -exec sed -i 's/"llvm-config"/"llvm17-config"/g' {} +
  • Loading branch information
maurossi committed Oct 9, 2023
1 parent e3e3e07 commit e212bc6
Show file tree
Hide file tree
Showing 106 changed files with 457 additions and 457 deletions.
262 changes: 131 additions & 131 deletions llvm/Android.bp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
cc_defaults {
name: "llvm-defaults",
defaults: ["llvm-defaults-no-generated-headers"],
header_libs: ["llvm-headers"],
name: "llvm17-defaults",
defaults: ["llvm17-defaults-no-generated-headers"],
header_libs: ["llvm17-headers"],
}

// This module defines all of the defaults used to compiled llvm, except for
// the generated headers. It is necessary to avoid a circular dependency
// from the tblgen tool used to generate the headers to the generated headers.
llvm_defaults {
name: "llvm-defaults-no-generated-headers",
name: "llvm17-defaults-no-generated-headers",

host_supported: true,
clang: true,
Expand Down Expand Up @@ -44,7 +44,7 @@ llvm_defaults {
"-Wno-error=unreachable-code-loop-increment",
],

header_libs: ["llvm-headers-no-generated-headers"],
header_libs: ["llvm17-headers-no-generated-headers"],

target: {
android: {
Expand Down Expand Up @@ -99,7 +99,7 @@ llvm_defaults {
}

cc_library_headers {
name: "llvm-headers-no-generated-headers",
name: "llvm17-headers-no-generated-headers",
vendor_available: true,
host_supported: true,
export_include_dirs: ["include"],
Expand All @@ -120,26 +120,26 @@ cc_library_headers {
}

cc_library_headers {
name: "llvm-headers",
name: "llvm17-headers",
vendor_available: true,
host_supported: true,
header_libs: ["llvm-headers-no-generated-headers"],
export_header_lib_headers: ["llvm-headers-no-generated-headers"],
header_libs: ["llvm17-headers-no-generated-headers"],
export_header_lib_headers: ["llvm17-headers-no-generated-headers"],
generated_headers: [
"llvm-gen-attributes",
"llvm-gen-intrinsics",
"llvm-gen-revision",
"llvm-gen-extension",
"llvm-gen-omp_gen",
"llvm-gen-acc_gen",
"llvm17-gen-attributes",
"llvm17-gen-intrinsics",
"llvm17-gen-revision",
"llvm17-gen-extension",
"llvm17-gen-omp_gen",
"llvm17-gen-acc_gen",
],
export_generated_headers: [
"llvm-gen-attributes",
"llvm-gen-intrinsics",
"llvm-gen-revision",
"llvm-gen-extension",
"llvm-gen-omp_gen",
"llvm-gen-acc_gen",
"llvm17-gen-attributes",
"llvm17-gen-intrinsics",
"llvm17-gen-revision",
"llvm17-gen-extension",
"llvm17-gen-omp_gen",
"llvm17-gen-acc_gen",
],
target: {
windows: {
Expand All @@ -148,14 +148,14 @@ cc_library_headers {
},
}

llvm_tblgen {
name: "llvm-gen-attributes",
llvm17_tblgen {
name: "llvm17-gen-attributes",
in: "include/llvm/IR/Attributes.td",
outs: ["llvm/IR/Attributes.inc"],
}

llvm_tblgen {
name: "llvm-gen-intrinsics",
llvm17_tblgen {
name: "llvm17-gen-intrinsics",
in: "include/llvm/IR/Intrinsics.td",
outs: [
"llvm/IR/IntrinsicEnums.inc",
Expand All @@ -179,176 +179,176 @@ llvm_tblgen {
],
}

llvm_tblgen {
name: "llvm-gen-omp_gen",
llvm17_tblgen {
name: "llvm17-gen-omp_gen",
in: "include/llvm/Frontend/OpenMP/OMP.td",
outs: [
"llvm/Frontend/OpenMP/OMP.h.inc",
"llvm/Frontend/OpenMP/OMP.inc",
],
}

llvm_tblgen {
name: "llvm-gen-acc_gen",
llvm17_tblgen {
name: "llvm17-gen-acc_gen",
in: "include/llvm/Frontend/OpenACC/ACC.td",
outs: [
"llvm/Frontend/OpenMP/ACC.h.inc",
"llvm/Frontend/OpenMP/ACC.inc",
],
}

llvm_tblgen {
name: "llvm-gen-riscv-target-def",
llvm17_tblgen {
name: "llvm17-gen-riscv-target-def",
in: "lib/Target/RISCV/RISCV.td",
outs: ["llvm/TargetParser/RISCVTargetParserDef.inc"],
}

genrule {
name: "llvm-gen-revision",
name: "llvm17-gen-revision",
out: ["llvm/Support/VCSRevision.h"],
srcs: [".git/logs/HEAD*"],
tool_files: ["git_sha1_gen.py"],
cmd: "python $(location git_sha1_gen.py) --output $(out)",
}

genrule {
name: "llvm-gen-extension",
name: "llvm17-gen-extension",
out: ["llvm/Support/Extension.def"],
srcs: [".git/logs/HEAD*"],
tool_files: ["utils/gn/secondary/llvm/include/llvm/Support/write_extension_def.py"],
cmd: "python $(location utils/gn/secondary/llvm/include/llvm/Support/write_extension_def.py) --output $(out)",
}

force_build_llvm_components_defaults {
name: "force_build_llvm_components",
force_build_llvm17_components_defaults {
name: "force_build_llvm17_components",
// Host build disabled by soong/llvm.go unless FORCE_BUILD_LLVM_COMPONENTS
// environment variable is set
}

// LLVM shared library build

llvm_arm_static_libraries = [
"libLLVMARMCodeGen",
"libLLVMARMAsmParser",
"libLLVMARMAsmPrinter",
"libLLVMARMInfo",
"libLLVMARMDesc",
"libLLVMARMDisassembler",
"libLLVMARMUtils",
"libLLVM17ARMCodeGen",
"libLLVM17ARMAsmParser",
"libLLVM17ARMAsmPrinter",
"libLLVM17ARMInfo",
"libLLVM17ARMDesc",
"libLLVM17ARMDisassembler",
"libLLVM17ARMUtils",
]

llvm_x86_static_libraries = [
"libLLVMX86CodeGen",
"libLLVMX86Info",
"libLLVMX86Desc",
"libLLVMX86AsmParser",
"libLLVMX86AsmPrinter",
"libLLVMX86Utils",
"libLLVMX86Disassembler",
"libLLVM17X86CodeGen",
"libLLVM17X86Info",
"libLLVM17X86Desc",
"libLLVM17X86AsmParser",
"libLLVM17X86AsmPrinter",
"libLLVM17X86Utils",
"libLLVM17X86Disassembler",
]

llvm_mips_static_libraries = [
"libLLVMMipsCodeGen",
"libLLVMMipsInfo",
"libLLVMMipsDesc",
"libLLVMMipsAsmParser",
"libLLVMMipsAsmPrinter",
"libLLVMMipsDisassembler",
"libLLVM17MipsCodeGen",
"libLLVM17MipsInfo",
"libLLVM17MipsDesc",
"libLLVM17MipsAsmParser",
"libLLVM17MipsAsmPrinter",
"libLLVM17MipsDisassembler",
]

llvm_aarch64_static_libraries = [
"libLLVMAArch64CodeGen",
"libLLVMAArch64Info",
"libLLVMAArch64Desc",
"libLLVMAArch64AsmParser",
"libLLVMAArch64AsmPrinter",
"libLLVMAArch64Utils",
"libLLVMAArch64Disassembler",
"libLLVM17AArch64CodeGen",
"libLLVM17AArch64Info",
"libLLVM17AArch64Desc",
"libLLVM17AArch64AsmParser",
"libLLVM17AArch64AsmPrinter",
"libLLVM17AArch64Utils",
"libLLVM17AArch64Disassembler",
]

llvm_amdgpu_static_libraries = [
"libLLVMAMDGPUCodeGen",
"libLLVMAMDGPUInfo",
"libLLVMAMDGPUDesc",
"libLLVMAMDGPUAsmParser",
"libLLVMAMDGPUAsmPrinter",
"libLLVMAMDGPUUtils",
"libLLVMAMDGPUDisassembler",
"libLLVM17AMDGPUCodeGen",
"libLLVM17AMDGPUInfo",
"libLLVM17AMDGPUDesc",
"libLLVM17AMDGPUAsmParser",
"libLLVM17AMDGPUAsmPrinter",
"libLLVM17AMDGPUUtils",
"libLLVM17AMDGPUDisassembler",
]


cc_library_shared {
host_supported: true,
vendor_available: true,
name: "libLLVM",
name: "libLLVM17",
defaults: [
"llvm-defaults",
"force_build_llvm_components",
"llvm17-defaults",
"force_build_llvm17_components",
],

whole_static_libs: [
// pre static libraries
"libLLVMLinker",
"libLLVMipo",
"libLLVMDebugInfoBTF",
"libLLVMDebugInfoDWARF",
"libLLVMDebugInfoMSF",
"libLLVMDebugInfoPDB",
"libLLVMSymbolize",
"libLLVMIRPrinter",
"libLLVMIRReader",
"libLLVMBitWriter",
"libLLVMBitReader",
"libLLVMPasses",
"libLLVMDemangle",
"libLLVMBitstreamReader",
"libLLVM17Linker",
"libLLVM17ipo",
"libLLVM17DebugInfoBTF",
"libLLVM17DebugInfoDWARF",
"libLLVM17DebugInfoMSF",
"libLLVM17DebugInfoPDB",
"libLLVM17Symbolize",
"libLLVM17IRPrinter",
"libLLVM17IRReader",
"libLLVM17BitWriter",
"libLLVM17BitReader",
"libLLVM17Passes",
"libLLVM17Demangle",
"libLLVM17BitstreamReader",

// post static libraries
"libLLVMLTO",
"libLLVMAsmPrinter",
"libLLVMSelectionDAG",
"libLLVMCodeGen",
"libLLVMDebugInfoCodeView",
"libLLVMObject",
"libLLVMScalarOpts",
"libLLVMAggressiveInstCombine",
"libLLVMInstCombine",
"libLLVMInstrumentation",
"libLLVMTransformObjCARC",
"libLLVMTransformUtils",
"libLLVMAnalysis",
"libLLVMTarget",
"libLLVMTargetParser",
"libLLVMGlobalISel",
"libLLVMMCDisassembler",
"libLLVMMC",
"libLLVMMCParser",
"libLLVMCore",
"libLLVMAsmParser",
"libLLVMOption",
"libLLVMSupport",
"libLLVMVectorize",
"libLLVMProfileData",
"libLLVMProfileDataCoverage",
"libLLVMLibDriver",
"libLLVMExecutionEngine",
"libLLVMRuntimeDyld",
"libLLVMMCJIT",
"libLLVMOrcJIT",
"libLLVMBinaryFormat",
"libLLVMMIRParser",
"libLLVMRemarks",
"libLLVMJITLink",
"libLLVMCoroutines",
"libLLVMTextAPI",
"libLLVMCFGuard",
"libLLVMFrontendOpenMP",
"libLLVMHelloNew",
"libLLVMOrcShared",
"libLLVMOrcTargetProcess",
"libLLVMInterfaceStub",
"libLLVMDebuginfod",
"libLLVMWindowsDriver",
"libLLVM17LTO",
"libLLVM17AsmPrinter",
"libLLVM17SelectionDAG",
"libLLVM17CodeGen",
"libLLVM17DebugInfoCodeView",
"libLLVM17Object",
"libLLVM17ScalarOpts",
"libLLVM17AggressiveInstCombine",
"libLLVM17InstCombine",
"libLLVM17Instrumentation",
"libLLVM17TransformObjCARC",
"libLLVM17TransformUtils",
"libLLVM17Analysis",
"libLLVM17Target",
"libLLVM17TargetParser",
"libLLVM17GlobalISel",
"libLLVM17MCDisassembler",
"libLLVM17MC",
"libLLVM17MCParser",
"libLLVM17Core",
"libLLVM17AsmParser",
"libLLVM17Option",
"libLLVM17Support",
"libLLVM17Vectorize",
"libLLVM17ProfileData",
"libLLVM17ProfileDataCoverage",
"libLLVM17LibDriver",
"libLLVM17ExecutionEngine",
"libLLVM17RuntimeDyld",
"libLLVM17MCJIT",
"libLLVM17OrcJIT",
"libLLVM17BinaryFormat",
"libLLVM17MIRParser",
"libLLVM17Remarks",
"libLLVM17JITLink",
"libLLVM17Coroutines",
"libLLVM17TextAPI",
"libLLVM17CFGuard",
"libLLVM17FrontendOpenMP",
"libLLVM17HelloNew",
"libLLVM17OrcShared",
"libLLVM17OrcTargetProcess",
"libLLVM17InterfaceStub",
"libLLVM17Debuginfod",
"libLLVM17WindowsDriver",
],

export_include_dirs: ["include"],
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Analysis/Android.bp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cc_library_static {
name: "libLLVMAnalysis",
name: "libLLVM17Analysis",
defaults: [
"llvm-lib-defaults",
"llvm17-lib-defaults",
],
srcs: [
"AliasAnalysis.cpp",
Expand Down
Loading

0 comments on commit e212bc6

Please sign in to comment.