Skip to content

Commit 2d0e47e

Browse files
MabezDevGasper
authored andcommitted
The xtensa triples are recognized by the compiler. Need to implement the calling convention, target -> call -> abi
1 parent cff07db commit 2d0e47e

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

src/librustc_llvm/build.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ fn main() {
7777
"sparc",
7878
"nvptx",
7979
"hexagon",
80+
"xtensa",
8081
];
8182

8283
let mut version_cmd = Command::new(&llvm_config);
@@ -250,7 +251,11 @@ fn main() {
250251
let llvm_use_libcxx = env::var_os("LLVM_USE_LIBCXX");
251252

252253
let stdcppname = if target.contains("openbsd") {
253-
if target.contains("sparc64") { "estdc++" } else { "c++" }
254+
if target.contains("sparc64") {
255+
"estdc++"
256+
} else {
257+
"c++"
258+
}
254259
} else if target.contains("freebsd") {
255260
"c++"
256261
} else if target.contains("darwin") {

src/librustc_llvm/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,12 @@ pub fn initialize_available_targets() {
155155
LLVMInitializeWebAssemblyTargetMC,
156156
LLVMInitializeWebAssemblyAsmPrinter
157157
);
158+
init_target!(
159+
llvm_component = "xtensa",
160+
LLVMInitializeXtensaTargetInfo,
161+
LLVMInitializeXtensaTarget,
162+
LLVMInitializeXtensaTargetMC,
163+
LLVMInitializeXtensaAsmPrinter,
164+
LLVMInitializeXtensaAsmParser
165+
);
158166
}

src/rustllvm/PassWrapper.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,14 @@ void LLVMRustAddLastExtensionPasses(
251251
#define SUBTARGET_HEXAGON
252252
#endif
253253

254+
#ifdef LLVM_COMPONENT_XTENSA
255+
#define SUBTARGET_XTENSA SUBTARGET(XTENSA)
256+
#else
257+
#define SUBTARGET_XTENSA
258+
#endif
259+
260+
261+
254262
#define GEN_SUBTARGETS \
255263
SUBTARGET_X86 \
256264
SUBTARGET_ARM \
@@ -262,6 +270,7 @@ void LLVMRustAddLastExtensionPasses(
262270
SUBTARGET_SPARC \
263271
SUBTARGET_HEXAGON \
264272
SUBTARGET_RISCV \
273+
SUBTARGET_XTENSA \
265274

266275
#define SUBTARGET(x) \
267276
namespace llvm { \

0 commit comments

Comments
 (0)