-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add a "xcheri-std-compat" mode to LLVM #756
Open
arichardson
wants to merge
19
commits into
CTSRD-CHERI:dev
Choose a base branch
from
arichardson:std-compat
base: dev
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.
+1,926
−379
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
341ba17
[CHERI-RISC-V][NFCI] Split xcheri feature into cheri-common and xcheri
arichardson af7d526
[CHERI RISC-V] Use RISCVISAInfo::parseFeatures() instead of manual pa…
arichardson f3a1f2e
[CHERI-RISC-V] Stop manually handling xcheri feature
arichardson cfc581c
[cheri_init_globals.h] Avoid using cgetaddr/cgetoffset in assembly
arichardson 54b342a
[CHERI-RISC-V] Use RISCVIsaInfo to check for CHERI support in Driver
arichardson 6f9d5b2
[CHERI StdCompat] Add a flag to disable non-standard instructions
arichardson e52e478
[CHERI StdCompat] Expand CGetOffset
arichardson 35a4ccf
[CHERI StdCompat] Expand CGetSealed
arichardson 5ce4366
[CHERI StdCompat] Expand CSetOffset to a CSetAddr sequence
arichardson 710abed
[CHERI StdCompat] Expand (CClearTag x) to (CSetHigh x, (CGetHigh x))
arichardson 785edcf
[CHERI StdCompat] Expand CRRL to the equivalent CRAM sequence
arichardson 14e06ff
[CHERI StdCompat] Emit a Clang error for unsupported builtins
arichardson 579f97b
[CHERI StdCompat] Disable more unsupported intrinsics
arichardson b9a116e
[CHERI StdCompat] Add a baseline test for a broken pre-defined macro
arichardson b6d225b
[CHERI StdCompat] Correctly define a __riscv_xcheri_std_compat macro
arichardson c762c97
[CHERI StdCompat] Add MC support for the modesw.{cap,int} instructions
arichardson 25f7274
[CHERI StdCompat] Expand explicit mode loads using mode-switching
arichardson 37c3ae2
[CHERI StdCompat] Expand explicit mode stores using mode-switching
arichardson 675f463
fixup! [CHERI StdCompat] Expand CGetSealed
arichardson 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 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 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 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 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 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/// In the RISC-V standard compat mode not all builtins are supported since we do not perform the expansion in the backend. | ||
// RUN: %riscv64_cheri_purecap_cc1 -target-feature +xcheri %s -fsyntax-only -verify=xcheri | ||
// RUN: %riscv64_cheri_purecap_cc1 -target-feature +xcheri-std-compat %s -fsyntax-only -verify=std-compat | ||
// xcheri-no-diagnostics | ||
|
||
void *cseal(void *a, void *b) { | ||
_Static_assert(__has_builtin(__builtin_cheri_seal), ""); // TODO: would be nice to report false here | ||
return __builtin_cheri_seal(a, b); // std-compat-error{{builtin requires at least one of the following extensions to be enabled: xcheri (without std-compat)}} | ||
} | ||
void *cunseal(void *a, void *b) { | ||
_Static_assert(__has_builtin(__builtin_cheri_unseal), ""); // TODO: would be nice to report false here | ||
return __builtin_cheri_unseal(a, b); // std-compat-error{{builtin requires at least one of the following extensions to be enabled: xcheri (without std-compat)}} | ||
} | ||
void *ccseal(void *a, void *b) { | ||
_Static_assert(__has_builtin(__builtin_cheri_conditional_seal), ""); // TODO: would be nice to report false here | ||
return __builtin_cheri_conditional_seal(a, b); // std-compat-error{{builtin requires at least one of the following extensions to be enabled: xcheri (without std-compat)}} | ||
} | ||
void *ccopytype(void *a, void *b) { | ||
_Static_assert(__has_builtin(__builtin_cheri_cap_type_copy), ""); // TODO: would be nice to report false here | ||
return __builtin_cheri_cap_type_copy(a, b); // std-compat-error{{builtin requires at least one of the following extensions to be enabled: xcheri (without std-compat)}} | ||
} | ||
unsigned long cloadtags(void *a) { | ||
_Static_assert(__has_builtin(__builtin_cheri_cap_load_tags), ""); // TODO: would be nice to report false here | ||
return __builtin_cheri_cap_load_tags(a); // std-compat-error{{builtin requires at least one of the following extensions to be enabled: xcheri (without std-compat)}} | ||
} |
This file contains 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 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 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 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 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 guess we could expand this to lc+cgettag, but I think an error if it's not support might make it clearer that the optimized version does not exist?