I was surprised to discover that I originally wrote the arm minipool
support code over 20 years ago.  At the time there were a number of
assumptions made that are no-longer true.  The code was modified to
try to accommodate these new requirements, but the there remained
issues, some of which were relatively benign, but some which will bite
on specific chips, or occasionally lead to failure to assemble, such
as in PR127227.

In order to address this, I've almost entirely rewritten the pass with
some new functionality.  We now construct a minipool from a set of
subpools with each subpool having it's own alignment.  Subpools are
then separately ordered in decreasing alignment requirement, ensuring
that if the first subpool is correctly aligned for its content, then
all subsequent pools will automatically get correct alignment.  There's
no theoretical limit on the number of subpools, though we currently
use just 2 (8-byte and 4-byte aligned).

The other major change is to separate the code out into its own file.
It's large enough and isolated enough to justify this (and there's
just one entry point and one initializer hook; callbacks into the main
arm file are limited too).


---
This is a forge pull request published on the gcc-patches mailing list mailing 
list
as requested by Richard Earnshaw via Sourceware Forge 
<[email protected]>.
Forge discussion: https://forge.sourceware.org/gcc/gcc/pulls/239

Get it locally using:
```
git fetch forge-upstream "+refs/versioned_pull/239/*:refs/versioned_pull/239/*"
git switch -c "pr-239-v1" "refs/versioned_pull/239/1/head"
```
Or, download the patch at: https://forge.sourceware.org/gcc/gcc/pulls/239.diff
Created on: 2026-10-05 15:01:28+00:00
Latest update: 2026-10-05 15:01:31+00:00
Changes: 4 changed files, 1542 additions, 1191 deletions
Head revision: rearnsha/gcc ref minipool-v2 commit 
953a3d8c69130eddbeeabb186e75effdbee79bec
Base revision: gcc/gcc ref trunk commit 
ddb565d3acb79f37d253b33a8649ab1563fcc918 r17-4874-gddb565d3acb79f
Merge base: ddb565d3acb79f37d253b33a8649ab1563fcc918
Requested Reviewers:

Changed files:
- A: gcc/config/arm/minipool.cc
- A: gcc/config/arm/minipool.h
- M: gcc/config/arm/arm.cc
- M: gcc/config/arm/t-arm

Richard Earnshaw (4):
  Arm: minipool refactoring - create minipool class.
  arm: split minipool code into a separate file
  arm: Use std::list for minipools
  arm: rework minipool code to use subpools [PR127227]

 gcc/config/arm/arm.cc      | 1191 +---------------------------
 gcc/config/arm/minipool.cc | 1492 ++++++++++++++++++++++++++++++++++++
 gcc/config/arm/minipool.h  |   23 +
 gcc/config/arm/t-arm       |   27 +-
 4 files changed, 1542 insertions(+), 1191 deletions(-)
 create mode 100644 gcc/config/arm/minipool.cc
 create mode 100644 gcc/config/arm/minipool.h

-- 
2.54.0

Reply via email to