diff options
author | Sam Elliott <quic_aelliott@quicinc.com> | 2025-04-25 17:12:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-25 17:12:27 -0700 |
commit | cfc5baf6e6fc083fdbb584534a3fb8ea289752d2 (patch) | |
tree | aa0c7f763accbfd7a1e1363123a68c8c183e7c12 /llvm/unittests/TargetParser/RISCVISAInfoTest.cpp | |
parent | 5137587fb1dc878e2dca31c4b929a3ca99f70ace (diff) | |
download | llvm-cfc5baf6e6fc083fdbb584534a3fb8ea289752d2.zip llvm-cfc5baf6e6fc083fdbb584534a3fb8ea289752d2.tar.gz llvm-cfc5baf6e6fc083fdbb584534a3fb8ea289752d2.tar.bz2 |
[RISCV] SiFive CLIC Support (#132481)
This Change adds support for two SiFive vendor attributes in clang:
- "SiFive-CLIC-preemptible"
- "SiFive-CLIC-stack-swap"
These can be given together, and can be combined with "machine", but
cannot be combined with any other interrupt attribute values.
These are handled primarily in RISCVFrameLowering:
- "SiFive-CLIC-stack-swap" entails swapping `sp` with `sf.mscratchcsw`
at function entry and exit, which holds the trap stack pointer.
- "SiFive-CLIC-preemptible" entails saving `mcause` and `mepc` before
re-enabling interrupts using `mstatus`. To save these, `s0` and `s1`
are first spilled to the stack, and then the values are read into
these registers. If these registers are used in the function, their
values will be spilled a second time onto the stack with the generic
callee-saved-register handling. At the end of the function interrupts
are disabled again before `mepc` and `mcause` are restored.
This Change also adds support for the following two experimental
extensions, which only contain CSRs:
- XSfsclic - for SiFive's CLIC Supervisor-Mode CSRs
- XSfmclic - for SiFive's CLIC Machine-Mode CSRs
The latter is needed for interrupt support.
The CFI information for this implementation is not correct, but I'd
prefer to correct this in a follow-up. While it's unlikely anyone wants
to unwind through a handler, the CFI information is also used by
debuggers so it would be good to get it right.
Co-authored-by: Ana Pazos <apazos@quicinc.com>
Diffstat (limited to 'llvm/unittests/TargetParser/RISCVISAInfoTest.cpp')
-rw-r--r-- | llvm/unittests/TargetParser/RISCVISAInfoTest.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/unittests/TargetParser/RISCVISAInfoTest.cpp b/llvm/unittests/TargetParser/RISCVISAInfoTest.cpp index 71c3b96..625c79a 100644 --- a/llvm/unittests/TargetParser/RISCVISAInfoTest.cpp +++ b/llvm/unittests/TargetParser/RISCVISAInfoTest.cpp @@ -1182,6 +1182,8 @@ Experimental extensions xqcisync 0.2 xrivosvisni 0.1 xrivosvizip 0.1 + xsfmclic 0.1 + xsfsclic 0.1 Supported Profiles rva20s64 |