diff options
author | Saleem Abdulrasool <abdulras@google.com> | 2021-05-07 16:09:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-07 16:09:31 -0700 |
commit | 5450c2f731f16abe3a4f244c383c55f559c97359 (patch) | |
tree | 5ebfcf70b9fff2775002dc9f8615dfe311d690e1 /bbl | |
parent | 23f1834fc628f4093bdd5e322ac828956d185f8d (diff) | |
download | pk-5450c2f731f16abe3a4f244c383c55f559c97359.zip pk-5450c2f731f16abe3a4f244c383c55f559c97359.tar.gz pk-5450c2f731f16abe3a4f244c383c55f559c97359.tar.bz2 |
machine: fix a case of undefined behaviour with SP handling (#245)
The use of `asm` for register aliasing is supported in two different
contexts:
- local variables (including GNU expression statements) where it may
only be used for specifying registers for input and output operands to
extended `asm` syntax.
c.f. https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables.html#Local-Register-Variables
- global variables where it may be used to observe the contents of a
register.
c.f. https://gcc.gnu.org/onlinedocs/gcc/Global-Register-Variables.html#Global-Register-Variables
The two options here is to either to hoist the variable out into a
global variable, but then it should not be in a header due to fears of
ODR in case the optimizer does not inline it away, and thus becomes a
bit more tricky. The alternative that this change actually adopts is to
explicitly use a move to copy the value out via the GNU extended
assembly syntax.
With this change, it is now possible to build the Proxy Kernel
completely with clang/LLVM and link with LLD. The generated kernel also
runs under SPIKE and behaves as expected in a simple smoke test (without
any executable prints the expected message, and runs a trivial RVV
example).
Diffstat (limited to 'bbl')
0 files changed, 0 insertions, 0 deletions