Skip to content

Commit d027159

Browse files
committed
Teach rustc about the Xtensa arch.
1 parent 574c58b commit d027159

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
@@ -22,6 +22,7 @@ const OPTIONAL_COMPONENTS: &[&str] = &[
2222
"nvptx",
2323
"hexagon",
2424
"riscv",
25+
"xtensa",
2526
"bpf",
2627
];
2728

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ extern "C" void LLVMTimeTraceProfilerFinish(const char* FileName) {
140140
#define SUBTARGET_SPARC
141141
#endif
142142

143+
#ifdef LLVM_COMPONENT_XTENSA
144+
#define SUBTARGET_XTENSA SUBTARGET(XTENSA)
145+
#else
146+
#define SUBTARGET_XTENSA
147+
#endif
148+
143149
#ifdef LLVM_COMPONENT_HEXAGON
144150
#define SUBTARGET_HEXAGON SUBTARGET(Hexagon)
145151
#else
@@ -164,6 +170,7 @@ extern "C" void LLVMTimeTraceProfilerFinish(const char* FileName) {
164170
SUBTARGET_MSP430 \
165171
SUBTARGET_SPARC \
166172
SUBTARGET_HEXAGON \
173+
SUBTARGET_XTENSA \
167174
SUBTARGET_RISCV \
168175
SUBTARGET_LOONGARCH \
169176

compiler/rustc_llvm/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,14 @@ pub fn initialize_available_targets() {
179179
LLVMInitializeHexagonAsmPrinter,
180180
LLVMInitializeHexagonAsmParser
181181
);
182+
init_target!(
183+
llvm_component = "xtensa",
184+
LLVMInitializeXtensaTargetInfo,
185+
LLVMInitializeXtensaTarget,
186+
LLVMInitializeXtensaTargetMC,
187+
LLVMInitializeXtensaAsmPrinter,
188+
LLVMInitializeXtensaAsmParser
189+
);
182190
init_target!(
183191
llvm_component = "webassembly",
184192
LLVMInitializeWebAssemblyTargetInfo,

0 commit comments

Comments
 (0)