Skip to content

Implement basic xtensa architecture triple parsing #1576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Sources/SwiftDriver/Utilities/Triple.swift
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,8 @@ extension Triple {
case renderscript32
// 64-bit RenderScript
case renderscript64
// Xtensa instruction set
case xtensa

static func parse(_ archName: Substring) -> Triple.Arch? {
switch archName {
Expand Down Expand Up @@ -633,6 +635,8 @@ extension Triple {
return .renderscript32
case "renderscript64":
return .renderscript64
case "xtensa":
return .xtensa

case _ where archName.hasPrefix("arm") || archName.hasPrefix("thumb") || archName.hasPrefix("aarch64"):
return parseARMArch(archName)
Expand Down Expand Up @@ -822,7 +826,7 @@ extension Triple {
case .arc, .arm, .armeb, .hexagon, .le32, .mips, .mipsel, .nvptx,
.ppc, .r600, .riscv32, .sparc, .sparcel, .tce, .tcele, .thumb,
.thumbeb, .x86, .xcore, .amdil, .hsail, .spir, .kalimba,.lanai,
.shave, .wasm32, .renderscript32, .aarch64_32, .m68k:
.shave, .wasm32, .renderscript32, .aarch64_32, .m68k, .xtensa:
return 32

case .aarch64, .aarch64e, .aarch64_be, .amdgcn, .bpfel, .bpfeb, .le64, .mips64,
Expand Down Expand Up @@ -1425,7 +1429,8 @@ extension Triple {
case .tce: fallthrough
case .tcele: fallthrough
case .thumbeb: fallthrough
case .xcore:
case .xcore: fallthrough
case .xtensa:
return .elf

case .ppc, .ppc64:
Expand Down
2 changes: 2 additions & 0 deletions Tests/SwiftDriverTests/TripleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ final class TripleTests: XCTestCase {
XCTAssertEqual(Triple("arm64-unknown-none").environment, nil)
XCTAssertEqual(Triple("arm64-unknown-none").objectFormat, .elf)

XCTAssertEqual(Triple("xtensa-unknown-none").objectFormat, .elf)

XCTAssertEqual(Triple("arm64-apple-none-macho").arch, .aarch64)
XCTAssertEqual(Triple("arm64-apple-none-macho").vendor, .apple)
XCTAssertEqual(Triple("arm64-apple-none-macho").os, .noneOS)
Expand Down