Skip to content

Commit 4b73ace

Browse files
committed
Teach rustc about the Xtensa arch.
1 parent 07df4f5 commit 4b73ace

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
@@ -151,6 +151,12 @@ extern "C" void LLVMTimeTraceProfilerFinish(const char* FileName) {
151151
#define SUBTARGET_SPARC
152152
#endif
153153

154+
#ifdef LLVM_COMPONENT_XTENSA
155+
#define SUBTARGET_XTENSA SUBTARGET(XTENSA)
156+
#else
157+
#define SUBTARGET_XTENSA
158+
#endif
159+
154160
#ifdef LLVM_COMPONENT_HEXAGON
155161
#define SUBTARGET_HEXAGON SUBTARGET(Hexagon)
156162
#else
@@ -176,6 +182,7 @@ extern "C" void LLVMTimeTraceProfilerFinish(const char* FileName) {
176182
SUBTARGET_MSP430 \
177183
SUBTARGET_SPARC \
178184
SUBTARGET_HEXAGON \
185+
SUBTARGET_XTENSA \
179186
SUBTARGET_RISCV \
180187
SUBTARGET_LOONGARCH \
181188

compiler/rustc_llvm/src/lib.rs

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

0 commit comments

Comments
 (0)