Skip to content

Commit 3458d7f

Browse files
committed
Teach rustc about the Xtensa arch.
1 parent 26a65a6 commit 3458d7f

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
@@ -153,6 +153,12 @@ extern "C" void LLVMRustTimeTraceProfilerFinish(const char* FileName) {
153153
#define SUBTARGET_SPARC
154154
#endif
155155

156+
#ifdef LLVM_COMPONENT_XTENSA
157+
#define SUBTARGET_XTENSA SUBTARGET(XTENSA)
158+
#else
159+
#define SUBTARGET_XTENSA
160+
#endif
161+
156162
#ifdef LLVM_COMPONENT_HEXAGON
157163
#define SUBTARGET_HEXAGON SUBTARGET(Hexagon)
158164
#else
@@ -178,6 +184,7 @@ extern "C" void LLVMRustTimeTraceProfilerFinish(const char* FileName) {
178184
SUBTARGET_MSP430 \
179185
SUBTARGET_SPARC \
180186
SUBTARGET_HEXAGON \
187+
SUBTARGET_XTENSA \
181188
SUBTARGET_RISCV \
182189
SUBTARGET_LOONGARCH \
183190

compiler/rustc_llvm/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,14 @@ pub fn initialize_available_targets() {
190190
LLVMInitializeHexagonAsmPrinter,
191191
LLVMInitializeHexagonAsmParser
192192
);
193+
init_target!(
194+
llvm_component = "xtensa",
195+
LLVMInitializeXtensaTargetInfo,
196+
LLVMInitializeXtensaTarget,
197+
LLVMInitializeXtensaTargetMC,
198+
LLVMInitializeXtensaAsmPrinter,
199+
LLVMInitializeXtensaAsmParser
200+
);
193201
init_target!(
194202
llvm_component = "webassembly",
195203
LLVMInitializeWebAssemblyTargetInfo,

0 commit comments

Comments
 (0)