-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[llvm-objcopy][libObject] Add RISC-V big-endian support #146913
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
Open
djtodoro
wants to merge
6
commits into
llvm:main
Choose a base branch
from
djtodoro:pr/riscvbe-objcopy
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a3b50d1
[llvm-objcopy][libObject] Add RISC-V big-endian support
djtodoro 9f95a0c
Fixup: Remove Triple::riscv32/64be from isLittleEndian predicates
djtodoro 5db9463
Apply clang-format
djtodoro 688f560
Satisfy clang-format
djtodoro 2f68ae4
Additional request from clang-format
djtodoro 158b232
Follow existing format
djtodoro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,8 @@ StringRef Triple::getArchTypeName(ArchType Kind) { | |
case renderscript64: return "renderscript64"; | ||
case riscv32: return "riscv32"; | ||
case riscv64: return "riscv64"; | ||
case riscv32be: return "riscv32be"; | ||
case riscv64be: return "riscv64be"; | ||
case shave: return "shave"; | ||
case sparc: return "sparc"; | ||
case sparcel: return "sparcel"; | ||
|
@@ -237,7 +239,10 @@ StringRef Triple::getArchTypePrefix(ArchType Kind) { | |
case wasm64: return "wasm"; | ||
|
||
case riscv32: | ||
case riscv64: return "riscv"; | ||
case riscv64: | ||
case riscv32be: | ||
case riscv64be: | ||
return "riscv"; | ||
topperc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
case ve: return "ve"; | ||
case csky: return "csky"; | ||
|
@@ -452,6 +457,8 @@ Triple::ArchType Triple::getArchTypeForLLVMName(StringRef Name) { | |
.Case("amdgcn", amdgcn) | ||
.Case("riscv32", riscv32) | ||
.Case("riscv64", riscv64) | ||
.Case("riscv32be", riscv32be) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here and in the similar case below, we should probably abide by clang-format's formatting. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah... I agree |
||
.Case("riscv64be", riscv64be) | ||
.Case("hexagon", hexagon) | ||
.Case("sparc", sparc) | ||
.Case("sparcel", sparcel) | ||
|
@@ -598,6 +605,8 @@ static Triple::ArchType parseArch(StringRef ArchName) { | |
.Case("amdgcn", Triple::amdgcn) | ||
.Case("riscv32", Triple::riscv32) | ||
.Case("riscv64", Triple::riscv64) | ||
.Case("riscv32be", Triple::riscv32be) | ||
.Case("riscv64be", Triple::riscv64be) | ||
.Case("hexagon", Triple::hexagon) | ||
.Cases("s390x", "systemz", Triple::systemz) | ||
.Case("sparc", Triple::sparc) | ||
|
@@ -967,6 +976,8 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) { | |
case Triple::renderscript64: | ||
case Triple::riscv32: | ||
case Triple::riscv64: | ||
case Triple::riscv32be: | ||
case Triple::riscv64be: | ||
case Triple::shave: | ||
case Triple::sparc: | ||
case Triple::sparcel: | ||
|
@@ -1689,6 +1700,7 @@ unsigned Triple::getArchPointerBitWidth(llvm::Triple::ArchType Arch) { | |
case llvm::Triple::r600: | ||
case llvm::Triple::renderscript32: | ||
case llvm::Triple::riscv32: | ||
case llvm::Triple::riscv32be: | ||
case llvm::Triple::shave: | ||
case llvm::Triple::sparc: | ||
case llvm::Triple::sparcel: | ||
|
@@ -1719,6 +1731,7 @@ unsigned Triple::getArchPointerBitWidth(llvm::Triple::ArchType Arch) { | |
case llvm::Triple::ppc64le: | ||
case llvm::Triple::renderscript64: | ||
case llvm::Triple::riscv64: | ||
case llvm::Triple::riscv64be: | ||
case llvm::Triple::sparcv9: | ||
case llvm::Triple::spirv: | ||
case llvm::Triple::spir64: | ||
|
@@ -1797,6 +1810,7 @@ Triple Triple::get32BitArchVariant() const { | |
case Triple::r600: | ||
case Triple::renderscript32: | ||
case Triple::riscv32: | ||
case Triple::riscv32be: | ||
case Triple::shave: | ||
case Triple::sparc: | ||
case Triple::sparcel: | ||
|
@@ -1829,6 +1843,9 @@ Triple Triple::get32BitArchVariant() const { | |
case Triple::ppc64le: T.setArch(Triple::ppcle); break; | ||
case Triple::renderscript64: T.setArch(Triple::renderscript32); break; | ||
case Triple::riscv64: T.setArch(Triple::riscv32); break; | ||
case Triple::riscv64be: | ||
topperc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
T.setArch(Triple::riscv32be); | ||
break; | ||
case Triple::sparcv9: T.setArch(Triple::sparc); break; | ||
case Triple::spir64: T.setArch(Triple::spir); break; | ||
case Triple::spirv: | ||
|
@@ -1879,6 +1896,7 @@ Triple Triple::get64BitArchVariant() const { | |
case Triple::ppc64le: | ||
case Triple::renderscript64: | ||
case Triple::riscv64: | ||
case Triple::riscv64be: | ||
case Triple::sparcv9: | ||
case Triple::spir64: | ||
case Triple::spirv64: | ||
|
@@ -1906,6 +1924,9 @@ Triple Triple::get64BitArchVariant() const { | |
case Triple::ppcle: T.setArch(Triple::ppc64le); break; | ||
case Triple::renderscript32: T.setArch(Triple::renderscript64); break; | ||
case Triple::riscv32: T.setArch(Triple::riscv64); break; | ||
case Triple::riscv32be: | ||
T.setArch(Triple::riscv64be); | ||
break; | ||
case Triple::sparc: T.setArch(Triple::sparcv9); break; | ||
case Triple::spir: T.setArch(Triple::spir64); break; | ||
case Triple::spirv: | ||
|
@@ -1944,8 +1965,8 @@ Triple Triple::getBigEndianArchVariant() const { | |
case Triple::r600: | ||
case Triple::renderscript32: | ||
case Triple::renderscript64: | ||
case Triple::riscv32: | ||
case Triple::riscv64: | ||
case Triple::riscv32be: | ||
case Triple::riscv64be: | ||
case Triple::shave: | ||
case Triple::spir64: | ||
case Triple::spir: | ||
|
@@ -1978,6 +1999,12 @@ Triple Triple::getBigEndianArchVariant() const { | |
break; | ||
case Triple::ppcle: T.setArch(Triple::ppc); break; | ||
case Triple::ppc64le: T.setArch(Triple::ppc64); break; | ||
case Triple::riscv32: | ||
T.setArch(Triple::riscv32be); | ||
break; | ||
case Triple::riscv64: | ||
T.setArch(Triple::riscv64be); | ||
break; | ||
case Triple::sparcel: T.setArch(Triple::sparc); break; | ||
case Triple::tcele: T.setArch(Triple::tce); break; | ||
default: | ||
|
@@ -2015,6 +2042,12 @@ Triple Triple::getLittleEndianArchVariant() const { | |
break; | ||
case Triple::ppc: T.setArch(Triple::ppcle); break; | ||
case Triple::ppc64: T.setArch(Triple::ppc64le); break; | ||
case Triple::riscv32be: | ||
T.setArch(Triple::riscv32); | ||
break; | ||
case Triple::riscv64be: | ||
T.setArch(Triple::riscv64); | ||
break; | ||
case Triple::sparc: T.setArch(Triple::sparcel); break; | ||
case Triple::tce: T.setArch(Triple::tcele); break; | ||
default: | ||
|
@@ -2053,6 +2086,8 @@ bool Triple::isLittleEndian() const { | |
case Triple::renderscript64: | ||
case Triple::riscv32: | ||
case Triple::riscv64: | ||
case Triple::riscv32be: | ||
case Triple::riscv64be: | ||
djtodoro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
case Triple::shave: | ||
case Triple::sparcel: | ||
case Triple::spir64: | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to know why clang-format disagrees with this formatting...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange...