1
Fork 0

Enable loongarch64 LLVM target

This commit is contained in:
zhaixiaojuan 2022-07-07 15:46:10 +08:00 committed by wangrui
parent 10f7ba562a
commit ccf5417799
5 changed files with 18 additions and 2 deletions

View file

@ -10,6 +10,7 @@ const OPTIONAL_COMPONENTS: &[&str] = &[
"aarch64", "aarch64",
"amdgpu", "amdgpu",
"avr", "avr",
"loongarch",
"m68k", "m68k",
"mips", "mips",
"powerpc", "powerpc",

View file

@ -146,6 +146,12 @@ extern "C" void LLVMTimeTraceProfilerFinish(const char* FileName) {
#define SUBTARGET_HEXAGON #define SUBTARGET_HEXAGON
#endif #endif
#ifdef LLVM_COMPONENT_LOONGARCH
#define SUBTARGET_LOONGARCH SUBTARGET(LoongArch)
#else
#define SUBTARGET_LOONGARCH
#endif
#define GEN_SUBTARGETS \ #define GEN_SUBTARGETS \
SUBTARGET_X86 \ SUBTARGET_X86 \
SUBTARGET_ARM \ SUBTARGET_ARM \
@ -159,6 +165,7 @@ extern "C" void LLVMTimeTraceProfilerFinish(const char* FileName) {
SUBTARGET_SPARC \ SUBTARGET_SPARC \
SUBTARGET_HEXAGON \ SUBTARGET_HEXAGON \
SUBTARGET_RISCV \ SUBTARGET_RISCV \
SUBTARGET_LOONGARCH \
#define SUBTARGET(x) \ #define SUBTARGET(x) \
namespace llvm { \ namespace llvm { \

View file

@ -102,6 +102,14 @@ pub fn initialize_available_targets() {
LLVMInitializeM68kAsmPrinter, LLVMInitializeM68kAsmPrinter,
LLVMInitializeM68kAsmParser LLVMInitializeM68kAsmParser
); );
init_target!(
llvm_component = "loongarch",
LLVMInitializeLoongArchTargetInfo,
LLVMInitializeLoongArchTarget,
LLVMInitializeLoongArchTargetMC,
LLVMInitializeLoongArchAsmPrinter,
LLVMInitializeLoongArchAsmParser
);
init_target!( init_target!(
llvm_component = "mips", llvm_component = "mips",
LLVMInitializeMipsTargetInfo, LLVMInitializeMipsTargetInfo,

View file

@ -88,7 +88,7 @@ changelog-seen = 2
# the resulting rustc being unable to compile for the disabled architectures. # the resulting rustc being unable to compile for the disabled architectures.
# #
# To add support for new targets, see https://rustc-dev-guide.rust-lang.org/building/new-target.html. # To add support for new targets, see https://rustc-dev-guide.rust-lang.org/building/new-target.html.
#targets = "AArch64;ARM;BPF;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86" #targets = "AArch64;ARM;BPF;Hexagon;LoongArch;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86"
# LLVM experimental targets to build support for. These targets are specified in # LLVM experimental targets to build support for. These targets are specified in
# the same format as above, but since these targets are experimental, they are # the same format as above, but since these targets are experimental, they are

View file

@ -291,7 +291,7 @@ impl Step for Llvm {
let llvm_targets = match &builder.config.llvm_targets { let llvm_targets = match &builder.config.llvm_targets {
Some(s) => s, Some(s) => s,
None => { None => {
"AArch64;ARM;BPF;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;\ "AArch64;ARM;BPF;Hexagon;LoongArch;MSP430;Mips;NVPTX;PowerPC;RISCV;\
Sparc;SystemZ;WebAssembly;X86" Sparc;SystemZ;WebAssembly;X86"
} }
}; };