Skip to content

Commit 33ff43f

Browse files
committed
Teach rustc about the Xtensa arch.
1 parent 506d4e6 commit 33ff43f

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

compiler/rustc_llvm/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const OPTIONAL_COMPONENTS: &[&str] = &[
2323
"nvptx",
2424
"hexagon",
2525
"riscv",
26+
"xtensa",
2627
"bpf",
2728
];
2829

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ extern "C" void LLVMRustTimeTraceProfilerFinish(const char* FileName) {
155155
#define SUBTARGET_SPARC
156156
#endif
157157

158+
#ifdef LLVM_COMPONENT_XTENSA
159+
#define SUBTARGET_XTENSA SUBTARGET(XTENSA)
160+
#else
161+
#define SUBTARGET_XTENSA
162+
#endif
163+
158164
#ifdef LLVM_COMPONENT_HEXAGON
159165
#define SUBTARGET_HEXAGON SUBTARGET(Hexagon)
160166
#else
@@ -180,6 +186,7 @@ extern "C" void LLVMRustTimeTraceProfilerFinish(const char* FileName) {
180186
SUBTARGET_MSP430 \
181187
SUBTARGET_SPARC \
182188
SUBTARGET_HEXAGON \
189+
SUBTARGET_XTENSA \
183190
SUBTARGET_RISCV \
184191
SUBTARGET_LOONGARCH \
185192

compiler/rustc_llvm/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,14 @@ pub fn initialize_available_targets() {
188188
LLVMInitializeHexagonAsmPrinter,
189189
LLVMInitializeHexagonAsmParser
190190
);
191+
init_target!(
192+
llvm_component = "xtensa",
193+
LLVMInitializeXtensaTargetInfo,
194+
LLVMInitializeXtensaTarget,
195+
LLVMInitializeXtensaTargetMC,
196+
LLVMInitializeXtensaAsmPrinter,
197+
LLVMInitializeXtensaAsmParser
198+
);
191199
init_target!(
192200
llvm_component = "webassembly",
193201
LLVMInitializeWebAssemblyTargetInfo,

0 commit comments

Comments
 (0)