<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp, branch users/nico/python-2</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[RISCV][NFC] Remove hasStdExtCOrZca (#145139)</title>
<updated>2025-06-23T17:49:47+00:00</updated>
<author>
<name>Sam Elliott</name>
<email>quic_aelliott@quicinc.com</email>
</author>
<published>2025-06-23T17:49:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a6eb5eee38ee08fb8466956553e77177e2ad1b02'/>
<id>a6eb5eee38ee08fb8466956553e77177e2ad1b02</id>
<content type='text'>
As of 20b5728b7b1ccc4509a316efb270d46cc9526d69, C always enables Zca, so
the check `C || Zca` is equivalent to just checking for `Zca`.

This replaces any uses of `HasStdExtCOrZca` with a new `HasStdExtZca`
(with the same assembler description, to avoid changes in error
messages), and simplifies everywhere where C++ needed to check for
either C or Zca.

The Subtarget function is just deprecated for the moment.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As of 20b5728b7b1ccc4509a316efb270d46cc9526d69, C always enables Zca, so
the check `C || Zca` is equivalent to just checking for `Zca`.

This replaces any uses of `HasStdExtCOrZca` with a new `HasStdExtZca`
(with the same assembler description, to avoid changes in error
messages), and simplifies everywhere where C++ needed to check for
either C or Zca.

The Subtarget function is just deprecated for the moment.</pre>
</div>
</content>
</entry>
<entry>
<title>[RISCV] Use llvm::is_contained (NFC) (#141372)</title>
<updated>2025-05-24T21:46:55+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2025-05-24T21:46:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=1ecc291cd4a35c0afdc1ff29c09814998f4657f0'/>
<id>1ecc291cd4a35c0afdc1ff29c09814998f4657f0</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[RISCV] Use implicit def/use of SP for PROBED_STACKALLOC*. (#139153)</title>
<updated>2025-05-16T21:43:22+00:00</updated>
<author>
<name>Craig Topper</name>
<email>craig.topper@sifive.com</email>
</author>
<published>2025-05-16T21:43:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=555d68f3db3fd189809bd19dd274e3bf5ac68d2f'/>
<id>555d68f3db3fd189809bd19dd274e3bf5ac68d2f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[RISCV] Add stack probing in eliminateCallFramePseudoInstr (#139731)</title>
<updated>2025-05-16T16:41:34+00:00</updated>
<author>
<name>Raphael Moreira Zinsly</name>
<email>rzinsly@ventanamicro.com</email>
</author>
<published>2025-05-16T16:41:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=52af23f950bc9585c623bfff6ac2a7d4fbe5e18a'/>
<id>52af23f950bc9585c623bfff6ac2a7d4fbe5e18a</id>
<content type='text'>
Stack clash protection code was missing from
RISCVFrameLowering::eliminateCallFramePseudoInstr, calling allocateStack
fixes it.
This patch also fixes the tests in stack-probing-dynamic.ll that should
be testing the stack allocation before a function call.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Stack clash protection code was missing from
RISCVFrameLowering::eliminateCallFramePseudoInstr, calling allocateStack
fixes it.
This patch also fixes the tests in stack-probing-dynamic.ll that should
be testing the stack allocation before a function call.</pre>
</div>
</content>
</entry>
<entry>
<title>[RISCV] Fix Defs/Uses for SiFive CLIC Support (#137724)</title>
<updated>2025-04-29T02:35:11+00:00</updated>
<author>
<name>Sam Elliott</name>
<email>quic_aelliott@quicinc.com</email>
</author>
<published>2025-04-29T02:35:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4e175b889669b430113ce0216e0ee1fe7884889c'/>
<id>4e175b889669b430113ce0216e0ee1fe7884889c</id>
<content type='text'>
The expensive checks bots found issues with #132481, due to not setting
defs/uses correctly. In 31bd7a507152 I added verify flags, so that the
failure is reproduced without requiring expensive checks, and xfailed
the test.

This change:
- Ensures that registers are correctly marked as defs/uses.
- Removes the xfail.
- Leaves the tests with `-verify-machineinstrs` which should have been
present originally.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The expensive checks bots found issues with #132481, due to not setting
defs/uses correctly. In 31bd7a507152 I added verify flags, so that the
failure is reproduced without requiring expensive checks, and xfailed
the test.

This change:
- Ensures that registers are correctly marked as defs/uses.
- Removes the xfail.
- Leaves the tests with `-verify-machineinstrs` which should have been
present originally.</pre>
</div>
</content>
</entry>
<entry>
<title>[RISCV] Support Push/Pop with Xqci (#134191)</title>
<updated>2025-04-28T15:12:45+00:00</updated>
<author>
<name>Sam Elliott</name>
<email>quic_aelliott@quicinc.com</email>
</author>
<published>2025-04-28T15:12:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=3f46af98caa2d0c3b8dcde02f0cc08fde03376c9'/>
<id>3f46af98caa2d0c3b8dcde02f0cc08fde03376c9</id>
<content type='text'>
The `qc.c.mienter` and `qc.c.mienter.nest` instructions, broadly only
save the argument and temporary registers. The exceptions are that they
also save `fp` (`s0`) to construct a frame chain from the signal handler
to the frame below, and they also save `ra`. They are designed this way
so that (if needed) push and pop instructions can be used to save the
callee-saved registers.

This patch implements this optimisation, constructing the following
rather than a long sequence of `sw` and `lw` instructions for saving the
callee-saved registers:

```asm
  qc.c.mienter
  qc.cm.push {ra, s0-sN}, -M
  ...
  qc.cm.pop {ra, s0-sN}, M
  qc.c.mileaveret
```

There are some carefully-worked-out details here, especially around CFI
information. For any register saved by both `qc.c.mienter(.nest)` and
the push (which is `ra` and `s0` at most), we point the CFI information
at the version saved by `qc.c.mienter(.nest)`. This ensures the CFI
points at the same `fp` copy as a frame pointer unwinder would find.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `qc.c.mienter` and `qc.c.mienter.nest` instructions, broadly only
save the argument and temporary registers. The exceptions are that they
also save `fp` (`s0`) to construct a frame chain from the signal handler
to the frame below, and they also save `ra`. They are designed this way
so that (if needed) push and pop instructions can be used to save the
callee-saved registers.

This patch implements this optimisation, constructing the following
rather than a long sequence of `sw` and `lw` instructions for saving the
callee-saved registers:

```asm
  qc.c.mienter
  qc.cm.push {ra, s0-sN}, -M
  ...
  qc.cm.pop {ra, s0-sN}, M
  qc.c.mileaveret
```

There are some carefully-worked-out details here, especially around CFI
information. For any register saved by both `qc.c.mienter(.nest)` and
the push (which is `ra` and `s0` at most), we point the CFI information
at the version saved by `qc.c.mienter(.nest)`. This ensures the CFI
points at the same `fp` copy as a frame pointer unwinder would find.</pre>
</div>
</content>
</entry>
<entry>
<title>[RISCV] SiFive CLIC Support (#132481)</title>
<updated>2025-04-26T00:12:27+00:00</updated>
<author>
<name>Sam Elliott</name>
<email>quic_aelliott@quicinc.com</email>
</author>
<published>2025-04-26T00:12:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=cfc5baf6e6fc083fdbb584534a3fb8ea289752d2'/>
<id>cfc5baf6e6fc083fdbb584534a3fb8ea289752d2</id>
<content type='text'>
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 &lt;apazos@quicinc.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;apazos@quicinc.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[RISCV] Allow spilling to unused Zcmp Stack (#125959)" (#137060)</title>
<updated>2025-04-24T00:36:00+00:00</updated>
<author>
<name>Craig Topper</name>
<email>craig.topper@sifive.com</email>
</author>
<published>2025-04-24T00:36:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=fc7fee8360b3e69777fa1c5c3c563728b1a2836f'/>
<id>fc7fee8360b3e69777fa1c5c3c563728b1a2836f</id>
<content type='text'>
This reverts commit 50cdf6cbc5035345507bb4d23fcb0292272754eb.

This patch causes miscompiles with vector and produces some odd code for
ilp32e.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 50cdf6cbc5035345507bb4d23fcb0292272754eb.

This patch causes miscompiles with vector and produces some odd code for
ilp32e.</pre>
</div>
</content>
</entry>
<entry>
<title>[RISCV] Remove duplicate call to MFI.getStackID(FI). NFC</title>
<updated>2025-04-21T23:53:22+00:00</updated>
<author>
<name>Craig Topper</name>
<email>craig.topper@sifive.com</email>
</author>
<published>2025-04-21T23:53:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a1db2c64918efa3d74dfdb402b8cff30bc555521'/>
<id>a1db2c64918efa3d74dfdb402b8cff30bc555521</id>
<content type='text'>
Reuse existing local variable.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reuse existing local variable.
</pre>
</div>
</content>
</entry>
<entry>
<title>[RISCV] Fix assertion failure when using -fstack-clash-protection (#135248)</title>
<updated>2025-04-18T16:12:52+00:00</updated>
<author>
<name>Paul Kirth</name>
<email>paulkirth@google.com</email>
</author>
<published>2025-04-18T16:12:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b3d2dc321c5c78b7204696afe07fe6ef3375acfd'/>
<id>b3d2dc321c5c78b7204696afe07fe6ef3375acfd</id>
<content type='text'>
We can't assume MBBI is still pointing at MBB if we've already expanded
a probe. We need to re-query the MBB from MBBI. Fixes #135206

Co-authored-by: Craig Topper &lt;craig.topper@sifive.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We can't assume MBBI is still pointing at MBB if we've already expanded
a probe. We need to re-query the MBB from MBBI. Fixes #135206

Co-authored-by: Craig Topper &lt;craig.topper@sifive.com&gt;</pre>
</div>
</content>
</entry>
</feed>
