License added.
This commit is contained in:
parent
02ebba390a
commit
e139f2b3b8
114 changed files with 1224 additions and 610 deletions
279
LICENSE.TXT
Normal file
279
LICENSE.TXT
Normal file
|
|
@ -0,0 +1,279 @@
|
||||||
|
==============================================================================
|
||||||
|
The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
|
---- LLVM Exceptions to the Apache 2.0 License ----
|
||||||
|
|
||||||
|
As an exception, if, as a result of your compiling your source code, portions
|
||||||
|
of this Software are embedded into an Object form of such source code, you
|
||||||
|
may redistribute such embedded portions in such Object form without complying
|
||||||
|
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
|
||||||
|
|
||||||
|
In addition, if you combine or link compiled forms of this Software with
|
||||||
|
software that is licensed under the GPLv2 ("Combined Software") and if a
|
||||||
|
court of competent jurisdiction determines that the patent provision (Section
|
||||||
|
3), the indemnity provision (Section 9) or other Section of the License
|
||||||
|
conflicts with the conditions of the GPLv2, you may retroactively and
|
||||||
|
prospectively choose to deem waived or otherwise exclude such Section(s) of
|
||||||
|
the License, but only in their entirety and only with respect to the Combined
|
||||||
|
Software.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
Software from third parties included in the LLVM Project:
|
||||||
|
==============================================================================
|
||||||
|
The LLVM Project contains third party software which is under different license
|
||||||
|
terms. All such code will be identified clearly using at least one of two
|
||||||
|
mechanisms:
|
||||||
|
1) It will be in a separate directory tree with its own `LICENSE.txt` or
|
||||||
|
`LICENSE` file at the top containing the specific license and restrictions
|
||||||
|
which apply to that software, or
|
||||||
|
2) It will contain specific license and restriction terms at the top of every
|
||||||
|
file.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy):
|
||||||
|
==============================================================================
|
||||||
|
University of Illinois/NCSA
|
||||||
|
Open Source License
|
||||||
|
|
||||||
|
Copyright (c) 2003-2019 University of Illinois at Urbana-Champaign.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Developed by:
|
||||||
|
|
||||||
|
LLVM Team
|
||||||
|
|
||||||
|
University of Illinois at Urbana-Champaign
|
||||||
|
|
||||||
|
http://llvm.org
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal with
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimers.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimers in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the names of the LLVM Team, University of Illinois at
|
||||||
|
Urbana-Champaign, nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this Software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
16
README.md
16
README.md
|
|
@ -151,5 +151,17 @@ backend internals.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Apache 2.0 (matching the LLVM project's license). See
|
The Apache License v2.0 with LLVM Exceptions, the license of llvm-mos and
|
||||||
`tools/llvm-mos/LICENSE.TXT` after install.
|
the LLVM project (`LICENSE.TXT`, llvm-mos's own, from the commit in
|
||||||
|
`llvmMosCommit.txt`). It covers the runtime too: by the LLVM Exceptions, a
|
||||||
|
program the runtime is compiled into may be shipped without meeting the
|
||||||
|
license's notice conditions (sections 4(a), 4(b) and 4(d)).
|
||||||
|
|
||||||
|
Third-party code in this repository keeps its own license:
|
||||||
|
|
||||||
|
| Path | What | License |
|
||||||
|
|---|---|---|
|
||||||
|
| `runtime/include/c++/etl/` | The Embedded Template Library | MIT (its `LICENSE`) |
|
||||||
|
| `tests/lua/lua-5.1.5/` | Lua 5.1.5 | MIT (its `COPYRIGHT`) |
|
||||||
|
| `tests/coremark/coremark-src/` | CoreMark | Apache 2.0, plus EEMBC's acceptable use agreement for the CoreMark trademark (its `LICENSE.md`) |
|
||||||
|
| `demos/frame.c`, `demos/minicad.c`, `demos/reversi.c` | Ports of Byte Works' 1989 ORCA/C samples (Mike Westerfield, Barbara Allred) | Byte Works' copyright; license Unknown |
|
||||||
|
|
|
||||||
64
STATUS.md
64
STATUS.md
|
|
@ -433,7 +433,9 @@ which runs correctly under MAME (apple2gs).
|
||||||
when X dead); `StackSlotCleanup` (deletes redundant adjacent
|
when X dead); `StackSlotCleanup` (deletes redundant adjacent
|
||||||
spills); `NegYIndY` (rewrites negative-Y indirect-Y stack-rel
|
spills); `NegYIndY` (rewrites negative-Y indirect-Y stack-rel
|
||||||
ops to avoid the 24-bit-add bank-cross).
|
ops to avoid the 24-bit-add bank-cross).
|
||||||
- Pre-emit: `BranchExpand` (long Bxx → INV_Bxx skip; BRA target);
|
- Pre-emit: `BranchCleanup` (Bxx next ; BRA other → INV_Bxx other,
|
||||||
|
dead conditionals, branches to the next block; branch LENGTHS are
|
||||||
|
the assembler's relaxation: BRA → BRL, Bxx → INV_Bxx +3 ; BRL);
|
||||||
`SepRepCleanup` (coalesces adjacent SEP/REP toggles, plus a
|
`SepRepCleanup` (coalesces adjacent SEP/REP toggles, plus a
|
||||||
cross-mode-neutral coalesce that drops REP/SEP pairs sandwiching
|
cross-mode-neutral coalesce that drops REP/SEP pairs sandwiching
|
||||||
X-flag-only ops, branches, transfers — saves 4B / 12cyc per
|
X-flag-only ops, branches, transfers — saves 4B / 12cyc per
|
||||||
|
|
@ -478,6 +480,66 @@ Work is now optimization-focused; the toolchain is feature-complete
|
||||||
for the common-case C / minimal-C++ workload. Priority is speed
|
for the common-case C / minimal-C++ workload. Priority is speed
|
||||||
(cycle counts), not size.
|
(cycle counts), not size.
|
||||||
|
|
||||||
|
**Recently landed (2026-10-06, what round 5 left):**
|
||||||
|
|
||||||
|
CoreMark 20583 -> 20449 ticks (-0.65%, CRCs validated); Space Taxi's
|
||||||
|
synced attract segment 753 -> 757 presents (+0.5%; 753 re-measured on
|
||||||
|
the old compiler, round 5 had 751); corpus .text 753388 -> 747351 bytes
|
||||||
|
(-0.80%, 201 TUs, sources frozen for the A/B); UBER 51/51 hashes, no
|
||||||
|
row slower (jlDrawCircle r=16 +7%, jlDrawPixel +1.4%, jlSamplePixel
|
||||||
|
+1.2%; jlStagePresent full read 849 -> 846 with the same 226 iterations
|
||||||
|
in 16 frames, i.e. the millisecond window). FileCheck 71/71, smoke
|
||||||
|
217/217, Lua OK, every JoeyLib IIgs gate (golden, iigs-verify, visual,
|
||||||
|
tilebank, input, audio, serial, save, loss, disk).
|
||||||
|
|
||||||
|
- **Branch lengths are the assembler's.** Branch fixups are now
|
||||||
|
PC-relative (`MCFixup` PCRel), so the assembler resolves a branch to
|
||||||
|
a label in its own section itself -- before, EVERY branch went to
|
||||||
|
link816 as an R_PCREL8/16 relocation, and BRA's relaxation compared
|
||||||
|
the target's offset in the section (not the displacement) with 127:
|
||||||
|
any BRA past a function's first 128 bytes became a BRL (46 of
|
||||||
|
joeyDraw.s's 59 source BRAs were BRLs). W65816AsmBackend now
|
||||||
|
relaxes a BRA to BRL and a conditional Bxx to `INV_Bxx +3 ; BRL`
|
||||||
|
(BEQ_Long .. BVC_Long, isCodeGenOnly, 5 bytes) only when the final
|
||||||
|
displacement needs it, layout iterating to a fixed point. The pre-
|
||||||
|
emit BranchExpand pass, which lengthened conditionals from size
|
||||||
|
estimates taken before StackRelToImg / FarPtrStageReuse still moved
|
||||||
|
code (90-byte margin), is now W65816BranchCleanup (its fall-through
|
||||||
|
inversion, dead-conditional and branch-to-next steps); in the old
|
||||||
|
output 2649 of 8250 BRLs and 1380 of 5621 `Bxx +3 ; BRL` pairs could
|
||||||
|
have been short. Hand asm keeps every byte except the bogus BRLs
|
||||||
|
(now BRA) and PER/branches it resolved through link816 (now in the
|
||||||
|
assembler, same targets: checked branch by branch over JoeyLib's and
|
||||||
|
the runtime's .s). An unresolved target (another section, a global
|
||||||
|
symbol) stays short; link816 range-checks it as before. Test
|
||||||
|
branch-relax.ll (120-byte Bxx stays short, 130-byte relaxes, a late
|
||||||
|
BRA stays BRA; fails on the old compiler).
|
||||||
|
- **promoteLoopLocal's address-taken test deleted.** It looked for
|
||||||
|
ADDframe, which PEI has expanded by then, so it never fired -- and it
|
||||||
|
is unnecessary: a stack-relative access only names an i16 frame
|
||||||
|
index (spill slot, named stack argument, backend slot; addr_fi),
|
||||||
|
while an alloca, the va_list area and anything IR can point at is an
|
||||||
|
i32 frame index reached through [$E0],y, so no pointer reaches a
|
||||||
|
loop home. Checked over the corpus: 243 loops take homes, 116 of
|
||||||
|
them in functions that take a stack address; all 1449 LEAs in those
|
||||||
|
functions land in an alloca or the va_list area, no home in either.
|
||||||
|
Matching the real shape (takesStackAddr) and forcing copy-outs would
|
||||||
|
have dropped 34 of the 243 promotions. FarPtrStageReuse's ADDframe
|
||||||
|
checks were dead the same way and went too. Test
|
||||||
|
loop-homes-addr-taken.ll.
|
||||||
|
- **Y-indexed pointer loops: measured, rejected.** A post-LSR IR pass
|
||||||
|
rewrote a loop's same-stride pointer walks onto one 16-bit offset
|
||||||
|
(`base + zext(off + K)`, peelPtr32Index's Y form) when SCEV bounded
|
||||||
|
the trip count: CoreMark 20449 -> 20416 (-0.16%), corpus +754
|
||||||
|
instructions. The bases lose the DP pairs LSR's pointer PHIs got
|
||||||
|
(a loop-invariant argument is rematerialized from its stack slot and
|
||||||
|
staged into $E0/$E2 per access), and the offset lives in a DP word
|
||||||
|
(`lda off ; tay` per access, `lda off ; clc ; adc #K ; tay` per
|
||||||
|
constant offset), so unrolled bodies got worse. It would pay with
|
||||||
|
the offset kept in Y across the loop (an Idx16 class + INY for the
|
||||||
|
step, no other Y use in the body) and loop-local homes for argument
|
||||||
|
pairs in call-free functions; versioning was not attempted.
|
||||||
|
|
||||||
**Recently landed (2026-10-05, speed pass 2):**
|
**Recently landed (2026-10-05, speed pass 2):**
|
||||||
|
|
||||||
CoreMark 21800 -> 20583 ticks (-5.6%, CRCs match); Space Taxi's synced
|
CoreMark 21800 -> 20583 ticks (-5.6%, CRCs match); Space Taxi's synced
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
#
|
||||||
# Build the entire W65816 runtime — assemble *.s, compile *.c.
|
# Build the entire W65816 runtime — assemble *.s, compile *.c.
|
||||||
# Run after editing anything under runtime/src/.
|
# Run after editing anything under runtime/src/.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
#ifndef _ASSERT_H
|
#ifndef _ASSERT_H
|
||||||
#define _ASSERT_H
|
#define _ASSERT_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// <cmath> — C++ shim over the W65816 runtime's <math.h>.
|
// <cmath> — C++ shim over the W65816 runtime's <math.h>.
|
||||||
//
|
//
|
||||||
// llvm-mos clang++ on this target has no system C++ stdlib. ETL's
|
// llvm-mos clang++ on this target has no system C++ stdlib. ETL's
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// <cstddef> — C++ shim over the W65816 runtime's <stddef.h>.
|
// <cstddef> — C++ shim over the W65816 runtime's <stddef.h>.
|
||||||
//
|
//
|
||||||
// Pulls in the runtime's <stddef.h> and re-exports size_t / ptrdiff_t
|
// Pulls in the runtime's <stddef.h> and re-exports size_t / ptrdiff_t
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// <cstdlib> — C++ shim over the W65816 runtime's <stdlib.h>.
|
// <cstdlib> — C++ shim over the W65816 runtime's <stdlib.h>.
|
||||||
//
|
//
|
||||||
// Pulls in the existing extern-C-wrapped <stdlib.h> and re-exports the
|
// Pulls in the existing extern-C-wrapped <stdlib.h> and re-exports the
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// etl_profile.h — ETL configuration for the W65816 / Apple IIgs target.
|
// etl_profile.h — ETL configuration for the W65816 / Apple IIgs target.
|
||||||
//
|
//
|
||||||
// Picked up by etl/platform.h via __has_include("etl_profile.h"). This
|
// Picked up by etl/platform.h via __has_include("etl_profile.h"). This
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// iigs/path.h - ProDOS / GS/OS aware path operations for C++ (Phase 5.4).
|
// iigs/path.h - ProDOS / GS/OS aware path operations for C++ (Phase 5.4).
|
||||||
//
|
//
|
||||||
// ProDOS and GS/OS impose a small set of structural rules on pathnames
|
// ProDOS and GS/OS impose a small set of structural rules on pathnames
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// <sstream> - cout-replacement wrapper for the W65816 / Apple IIgs target.
|
// <sstream> - cout-replacement wrapper for the W65816 / Apple IIgs target.
|
||||||
//
|
//
|
||||||
// std::stringstream / std::ostringstream are NOT provided on this target.
|
// std::stringstream / std::ostringstream are NOT provided on this target.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// C99 / C11 complex.h — complex-number types and core helpers.
|
// C99 / C11 complex.h — complex-number types and core helpers.
|
||||||
//
|
//
|
||||||
// clang implements `_Complex` as a built-in type that lowers to a
|
// clang implements `_Complex` as a built-in type that lowers to a
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
#ifndef _CTYPE_H
|
#ifndef _CTYPE_H
|
||||||
#define _CTYPE_H
|
#define _CTYPE_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
#ifndef _ERRNO_H
|
#ifndef _ERRNO_H
|
||||||
#define _ERRNO_H
|
#define _ERRNO_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// fcntl.h -- file-control definitions for the GNO/ME runtime.
|
// fcntl.h -- file-control definitions for the GNO/ME runtime.
|
||||||
//
|
//
|
||||||
// O_* values match GNO's <sys/fcntl.h> exactly so binaries agree with the
|
// O_* values match GNO's <sys/fcntl.h> exactly so binaries agree with the
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// fenv.h — floating-point environment.
|
// fenv.h — floating-point environment.
|
||||||
//
|
//
|
||||||
// The W65816 softFloat / softDouble runtime is fixed at round-to-
|
// The W65816 softFloat / softDouble runtime is fixed at round-to-
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// fnmatch.h — POSIX glob-style pattern match.
|
// fnmatch.h — POSIX glob-style pattern match.
|
||||||
//
|
//
|
||||||
// fnmatch(pattern, string, flags) returns 0 on a match, FNM_NOMATCH
|
// fnmatch(pattern, string, flags) returns 0 on a match, FNM_NOMATCH
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// glob.h — POSIX pathname expansion.
|
// glob.h — POSIX pathname expansion.
|
||||||
//
|
//
|
||||||
// glob(pattern, flags, errfunc, &gb) iterates the directory portion
|
// glob(pattern, flags, errfunc, &gb) iterates the directory portion
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// AUTOGENERATED by scripts/genGnoKernel.py — DO NOT EDIT.
|
// AUTOGENERATED by scripts/genGnoKernel.py — DO NOT EDIT.
|
||||||
// GNO kernel toolset $03 wrappers, callable from C.
|
// GNO kernel toolset $03 wrappers, callable from C.
|
||||||
// Convention: each K* returns the kernel result (or -1 on error);
|
// Convention: each K* returns the kernel result (or -1 on error);
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// iigs/cursor.h - convenience wrappers for the QuickDraw Cursor Mgr.
|
// iigs/cursor.h - convenience wrappers for the QuickDraw Cursor Mgr.
|
||||||
//
|
//
|
||||||
// What's here today: a small push/pop stack of CursorRecord COPIES so
|
// What's here today: a small push/pop stack of CursorRecord COPIES so
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// iigs/desktop.h - Full Window Manager desktop startup helper.
|
// iigs/desktop.h - Full Window Manager desktop startup helper.
|
||||||
//
|
//
|
||||||
// Equivalent to ORCA-C's `startdesk` library function: brings up the
|
// Equivalent to ORCA-C's `startdesk` library function: brings up the
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// iigs/eventLoop.h - curated event loop for desktop apps.
|
// iigs/eventLoop.h - curated event loop for desktop apps.
|
||||||
//
|
//
|
||||||
// Wraps TaskMaster in a "register callbacks, call run, get out when
|
// Wraps TaskMaster in a "register callbacks, call run, get out when
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// IIgs GS/OS file I/O wrappers.
|
// IIgs GS/OS file I/O wrappers.
|
||||||
//
|
//
|
||||||
// GS/OS calls dispatch through $E100A8 with X holding the call number
|
// GS/OS calls dispatch through $E100A8 with X holding the call number
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// iigs/misc.h - Misc Tool Set wrappers that genToolbox.py can't generate.
|
// iigs/misc.h - Misc Tool Set wrappers that genToolbox.py can't generate.
|
||||||
//
|
//
|
||||||
// genToolbox.py auto-generates inline-asm wrappers for every ORCA
|
// genToolbox.py auto-generates inline-asm wrappers for every ORCA
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// iigs/resource.h - typed-C facade over the IIgs Resource Manager.
|
// iigs/resource.h - typed-C facade over the IIgs Resource Manager.
|
||||||
//
|
//
|
||||||
// Phase 3.4 REAL implementation: parses .rsrc resource forks via the
|
// Phase 3.4 REAL implementation: parses .rsrc resource forks via the
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// iigs/sound.h - convenience wrappers for the SoundManager toolset.
|
// iigs/sound.h - convenience wrappers for the SoundManager toolset.
|
||||||
//
|
//
|
||||||
// What's here today: the simplest correct wrappers around the existing
|
// What's here today: the simplest correct wrappers around the existing
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// iigs/sprite.h - 16x16 fixed-shape 4bpp packed sprite primitives for
|
// iigs/sprite.h - 16x16 fixed-shape 4bpp packed sprite primitives for
|
||||||
// SHR 320 mode.
|
// SHR 320 mode.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// AUTOGENERATED by scripts/genToolbox.py from NList.Data.
|
// AUTOGENERATED by scripts/genToolbox.py from NList.Data.
|
||||||
// DO NOT EDIT by hand — regenerate to update.
|
// DO NOT EDIT by hand — regenerate to update.
|
||||||
// Source: tools/nlist/NList.Data.txt (Dave Lyons' NiftyList database).
|
// Source: tools/nlist/NList.Data.txt (Dave Lyons' NiftyList database).
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// iigs/uiBuilder.h - declarative UI scaffolding for desktop demos.
|
// iigs/uiBuilder.h - declarative UI scaffolding for desktop demos.
|
||||||
//
|
//
|
||||||
// Replaces hand-rolled ">> Menu \N3\r--Item\N250*Xx\r.\r" strings,
|
// Replaces hand-rolled ">> Menu \N3\r--Item\N250*Xx\r.\r" strings,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// Minimal inttypes.h for the W65816 runtime. Pulls in stdint.h's
|
// Minimal inttypes.h for the W65816 runtime. Pulls in stdint.h's
|
||||||
// fixed-width types and adds the printf/scanf format-string macros
|
// fixed-width types and adds the printf/scanf format-string macros
|
||||||
// for those types. Standalone (does not include the host clang's
|
// for those types. Standalone (does not include the host clang's
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// C95 iso646.h — alternative spellings of the C operators. Mandated
|
// C95 iso646.h — alternative spellings of the C operators. Mandated
|
||||||
// by C11 for portability with sources written under older standards
|
// by C11 for portability with sources written under older standards
|
||||||
// or in code-pages without the punctuation symbols.
|
// or in code-pages without the punctuation symbols.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// libgen.h — POSIX path-component helpers.
|
// libgen.h — POSIX path-component helpers.
|
||||||
//
|
//
|
||||||
// dirname() returns the parent-dir portion of `path`; basename()
|
// dirname() returns the parent-dir portion of `path`; basename()
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// Minimal limits.h for the W65816 runtime. Standalone (does not
|
// Minimal limits.h for the W65816 runtime. Standalone (does not
|
||||||
// include the host clang's limits.h, which pulls in glibc headers
|
// include the host clang's limits.h, which pulls in glibc headers
|
||||||
// and breaks the build). Sizes per the W65816 backend's view:
|
// and breaks the build). Sizes per the W65816 backend's view:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// Minimal locale.h for the W65816 runtime. No real locale support —
|
// Minimal locale.h for the W65816 runtime. No real locale support —
|
||||||
// just enough to let portable code compile. setlocale() always
|
// just enough to let portable code compile. setlocale() always
|
||||||
// returns "C" and ignores its argument; localeconv() returns a
|
// returns "C" and ignores its argument; localeconv() returns a
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
#ifndef _MATH_H
|
#ifndef _MATH_H
|
||||||
#define _MATH_H
|
#define _MATH_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// W65816 setjmp/longjmp — saves SP, return address (24-bit), and DP.
|
// W65816 setjmp/longjmp — saves SP, return address (24-bit), and DP.
|
||||||
// jmp_buf is 8 bytes of opaque storage.
|
// jmp_buf is 8 bytes of opaque storage.
|
||||||
#ifndef _SETJMP_H
|
#ifndef _SETJMP_H
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// Minimal signal.h for the W65816 runtime. No real signal handling
|
// Minimal signal.h for the W65816 runtime. No real signal handling
|
||||||
// — IIgs has no concept of POSIX signals. signal() always returns
|
// — IIgs has no concept of POSIX signals. signal() always returns
|
||||||
// SIG_ERR; raise() always returns -1. These exist so portable code
|
// SIG_ERR; raise() always returns -1. These exist so portable code
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// C11 stdalign.h — alias the keyword forms `_Alignas` / `_Alignof` to
|
// C11 stdalign.h — alias the keyword forms `_Alignas` / `_Alignof` to
|
||||||
// the more readable lowercase names.
|
// the more readable lowercase names.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// stdatomic.h — C11 atomic operations, single-core stubs.
|
// stdatomic.h — C11 atomic operations, single-core stubs.
|
||||||
//
|
//
|
||||||
// The W65816 is a uniprocessor with no preemption from a kernel scheduler
|
// The W65816 is a uniprocessor with no preemption from a kernel scheduler
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// Minimal stddef.h for the W65816 runtime. Standalone (does not
|
// Minimal stddef.h for the W65816 runtime. Standalone (does not
|
||||||
// include the host clang's stddef.h).
|
// include the host clang's stddef.h).
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// Minimal stdint.h for the W65816 runtime. Standalone (does not
|
// Minimal stdint.h for the W65816 runtime. Standalone (does not
|
||||||
// include the host clang's stdint.h, which pulls in glibc headers
|
// include the host clang's stdint.h, which pulls in glibc headers
|
||||||
// and breaks the build). Sizes per the W65816 backend's view:
|
// and breaks the build). Sizes per the W65816 backend's view:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
#ifndef _STDIO_H
|
#ifndef _STDIO_H
|
||||||
#define _STDIO_H
|
#define _STDIO_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
#ifndef _STDLIB_H
|
#ifndef _STDLIB_H
|
||||||
#define _STDLIB_H
|
#define _STDLIB_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// C11 stdnoreturn.h — alias the keyword form `_Noreturn` to the more
|
// C11 stdnoreturn.h — alias the keyword form `_Noreturn` to the more
|
||||||
// readable lowercase name.
|
// readable lowercase name.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
#ifndef _STRING_H
|
#ifndef _STRING_H
|
||||||
#define _STRING_H
|
#define _STRING_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// sys/stat.h -- file status for the GNO/ME runtime.
|
// sys/stat.h -- file status for the GNO/ME runtime.
|
||||||
//
|
//
|
||||||
// struct stat MUST byte-match the layout the GNO kernel's stat.c writes
|
// struct stat MUST byte-match the layout the GNO kernel's stat.c writes
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// sys/time.h - POSIX gettimeofday() shim on the IIgs RTC.
|
// sys/time.h - POSIX gettimeofday() shim on the IIgs RTC.
|
||||||
//
|
//
|
||||||
// The IIgs Misc Tool ReadTimeHex (set $03, tool $0D) is the only
|
// The IIgs Misc Tool ReadTimeHex (set $03, tool $0D) is the only
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// sys/times.h -- process CPU-time accounting for the GNO/ME runtime.
|
// sys/times.h -- process CPU-time accounting for the GNO/ME runtime.
|
||||||
//
|
//
|
||||||
// Layout byte-matches GNO's own <sys/times.h> (tools/gno kernel fills it):
|
// Layout byte-matches GNO's own <sys/times.h> (tools/gno kernel fills it):
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// sys/types.h -- primitive POSIX id/size typedefs for the GNO/ME runtime.
|
// sys/types.h -- primitive POSIX id/size typedefs for the GNO/ME runtime.
|
||||||
//
|
//
|
||||||
// Single source of truth for the scalar types struct stat and the file
|
// Single source of truth for the scalar types struct stat and the file
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// sys/wait.h -- GNO/ME process-wait status decoding.
|
// sys/wait.h -- GNO/ME process-wait status decoding.
|
||||||
//
|
//
|
||||||
// GNO's wait status is a single 16-bit int (sizeof(int)==2 on this target), the
|
// GNO's wait status is a single 16-bit int (sizeof(int)==2 on this target), the
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// tgmath.h — type-generic math macros.
|
// tgmath.h — type-generic math macros.
|
||||||
//
|
//
|
||||||
// Selects between the `f`-suffixed (float) and unsuffixed (double)
|
// Selects between the `f`-suffixed (float) and unsuffixed (double)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// threads.h — C11 threading API. Single-core IIgs / bare-metal: every
|
// threads.h — C11 threading API. Single-core IIgs / bare-metal: every
|
||||||
// thread function fails with `thrd_error`. Mutexes / cond-vars compile
|
// thread function fails with `thrd_error`. Mutexes / cond-vars compile
|
||||||
// but produce no synchronization — callers running on a single core
|
// but produce no synchronization — callers running on a single core
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
|
||||||
#ifndef _TIME_H
|
#ifndef _TIME_H
|
||||||
#define _TIME_H
|
#define _TIME_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// C11 uchar.h — char16_t / char32_t plus minimal conversion helpers.
|
// C11 uchar.h — char16_t / char32_t plus minimal conversion helpers.
|
||||||
//
|
//
|
||||||
// The W65816 runtime treats text as Latin-1 (8-bit) throughout, so
|
// The W65816 runtime treats text as Latin-1 (8-bit) throughout, so
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// unistd.h -- POSIX process, credential, job-control + timing glue for the
|
// unistd.h -- POSIX process, credential, job-control + timing glue for the
|
||||||
// GNO/ME runtime. These wrap the GNO kernel toolset $03 primitives (see
|
// GNO/ME runtime. These wrap the GNO kernel toolset $03 primitives (see
|
||||||
// gno/kernel.h) into POSIX names; the bodies live in runtime/src/libcGno.c.
|
// gno/kernel.h) into POSIX names; the bodies live in runtime/src/libcGno.c.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// Minimal wchar.h for the W65816 runtime.
|
// Minimal wchar.h for the W65816 runtime.
|
||||||
//
|
//
|
||||||
// wchar_t is 16-bit (matches `int` on this target). No real
|
// wchar_t is 16-bit (matches `int` on this target). No real
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// C95 / C11 wctype.h — wide-character classification + case folding.
|
// C95 / C11 wctype.h — wide-character classification + case folding.
|
||||||
//
|
//
|
||||||
// On the W65816 runtime wchar_t is 16-bit but text is Latin-1; the
|
// On the W65816 runtime wchar_t is 16-bit but text is Latin-1; the
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
; See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
;
|
||||||
; crt0 — C runtime startup for the W65816 backend.
|
; crt0 — C runtime startup for the W65816 backend.
|
||||||
;
|
;
|
||||||
; Entry point invoked by the loader (or the OMF dispatcher). Sets up
|
; Entry point invoked by the loader (or the OMF dispatcher). Sets up
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
; See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
;
|
||||||
; crt0Gno.s — GNO/ME shell command crt0.
|
; crt0Gno.s — GNO/ME shell command crt0.
|
||||||
;
|
;
|
||||||
; Use this INSTEAD OF crt0.s / crt0Gsos.s when building an OMF intended
|
; Use this INSTEAD OF crt0.s / crt0Gsos.s when building an OMF intended
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
; See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
;
|
||||||
; crt0Gsos.s — GS/OS S16 application crt0.
|
; crt0Gsos.s — GS/OS S16 application crt0.
|
||||||
;
|
;
|
||||||
; Use this INSTEAD OF crt0.s when building an OMF that the real
|
; Use this INSTEAD OF crt0.s when building an OMF that the real
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// cursor.c - iigs/cursor.h implementation. Push/pop stack of
|
// cursor.c - iigs/cursor.h implementation. Push/pop stack of
|
||||||
// CursorRecord COPIES so transient cursor swaps (busy, I-beam, etc.)
|
// CursorRecord COPIES so transient cursor swaps (busy, I-beam, etc.)
|
||||||
// can be installed and restored without the caller juggling pointers
|
// can be installed and restored without the caller juggling pointers
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// desktop.c - startdesk()/enddesk() — ORCA-C-style minimal desktop init.
|
// desktop.c - startdesk()/enddesk() — ORCA-C-style minimal desktop init.
|
||||||
//
|
//
|
||||||
// Brings up the toolset chain a full desktop app needs:
|
// Brings up the toolset chain a full desktop app needs:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// eventLoop.c - implementation of iigs/eventLoop.h.
|
// eventLoop.c - implementation of iigs/eventLoop.h.
|
||||||
//
|
//
|
||||||
// TaskMaster returns an event-code that already encodes "this was a
|
// TaskMaster returns an event-code that already encodes "this was a
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// Tiny string.h / stdlib.h helpers — kept out of libc.c because
|
// Tiny string.h / stdlib.h helpers — kept out of libc.c because
|
||||||
// adding to that translation unit shifts vprintf's internal branch
|
// adding to that translation unit shifts vprintf's internal branch
|
||||||
// distances and randomly breaks BranchExpand (same precedent as
|
// distances and randomly breaks BranchExpand (same precedent as
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
; See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
;
|
||||||
; gnoGsos.s — GS/OS calls from inside a GNO/ME process.
|
; gnoGsos.s — GS/OS calls from inside a GNO/ME process.
|
||||||
;
|
;
|
||||||
; GNO patches GS/OS entry $E100A8 to its interceptor (OurGSOS in
|
; GNO patches GS/OS entry $E100A8 to its interceptor (OurGSOS in
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
; See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
;
|
||||||
; AUTOGENERATED by scripts/genGnoKernel.py — DO NOT EDIT by hand.
|
; AUTOGENERATED by scripts/genGnoKernel.py — DO NOT EDIT by hand.
|
||||||
;
|
;
|
||||||
; GNO/ME kernel toolset $03 wrappers.
|
; GNO/ME kernel toolset $03 wrappers.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
; See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
;
|
||||||
; iigsGsos.s — INLINE-form GS/OS class-1 wrappers for bare-metal apps.
|
; iigsGsos.s — INLINE-form GS/OS class-1 wrappers for bare-metal apps.
|
||||||
;
|
;
|
||||||
; Real GS/OS 6.0.2 / 6.0.4 at $E100A8 expects the INLINE form:
|
; Real GS/OS 6.0.2 / 6.0.4 at $E100A8 expects the INLINE form:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
; See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
;
|
||||||
; Minimal GS/OS dispatcher stub at $E100A8. Native, M=0, X=0.
|
; Minimal GS/OS dispatcher stub at $E100A8. Native, M=0, X=0.
|
||||||
;
|
;
|
||||||
; Real GS/OS uses INLINE-form dispatch at $E100A8: the JSL is
|
; Real GS/OS uses INLINE-form dispatch at $E100A8: the JSL is
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
; See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
;
|
||||||
; AUTOGENERATED by scripts/genToolbox.py from NList.Data.
|
; AUTOGENERATED by scripts/genToolbox.py from NList.Data.
|
||||||
; DO NOT EDIT by hand — regenerate to update.
|
; DO NOT EDIT by hand — regenerate to update.
|
||||||
; Source: tools/nlist/NList.Data.txt (Dave Lyons' NiftyList database).
|
; Source: tools/nlist/NList.Data.txt (Dave Lyons' NiftyList database).
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
; See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
;
|
||||||
; iigsToolboxExtra.s — hand-written toolbox wrappers that don't fit the
|
; iigsToolboxExtra.s — hand-written toolbox wrappers that don't fit the
|
||||||
; standard genToolbox.py shape and therefore aren't auto-generated.
|
; standard genToolbox.py shape and therefore aren't auto-generated.
|
||||||
; Anything in this file is preserved across regenerations of
|
; Anything in this file is preserved across regenerations of
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// Minimal libc for the W65816 backend. Provides:
|
// Minimal libc for the W65816 backend. Provides:
|
||||||
// string.h: memcmp, strlen, strcpy, strcmp, strncpy, strncmp, strchr,
|
// string.h: memcmp, strlen, strcpy, strcmp, strncpy, strncmp, strchr,
|
||||||
// strrchr (memcpy, memmove and memset are in libgcc.s)
|
// strrchr (memcpy, memmove and memset are in libgcc.s)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// libcGno.c — GNO/ME backend for our libc.
|
// libcGno.c — GNO/ME backend for our libc.
|
||||||
//
|
//
|
||||||
// Two roles:
|
// Two roles:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// Minimal libcxxabi shim for the W65816 backend.
|
// Minimal libcxxabi shim for the W65816 backend.
|
||||||
//
|
//
|
||||||
// Provides just enough of the Itanium C++ ABI to make `dynamic_cast`
|
// Provides just enough of the Itanium C++ ABI to make `dynamic_cast`
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// SJLJ exception runtime for the W65816 backend.
|
// SJLJ exception runtime for the W65816 backend.
|
||||||
//
|
//
|
||||||
// Works with the IR generated by clang's `-fsjlj-exceptions` lowering
|
// Works with the IR generated by clang's `-fsjlj-exceptions` lowering
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
; See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
;
|
||||||
; Minimal libgcc-equivalent runtime for the W65816 / Apple IIgs.
|
; Minimal libgcc-equivalent runtime for the W65816 / Apple IIgs.
|
||||||
; Provides the helpers that the LLVM backend lowers integer multiply,
|
; Provides the helpers that the LLVM backend lowers integer multiply,
|
||||||
; shift, divide, and modulo operations to. Implementations are
|
; shift, divide, and modulo operations to. Implementations are
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// libunwindStub.c — Itanium _Unwind_* surface mapped onto our SJLJ runtime.
|
// libunwindStub.c — Itanium _Unwind_* surface mapped onto our SJLJ runtime.
|
||||||
//
|
//
|
||||||
// Phase 5.1 of GAP_CLOSURE_PLAN (Phase 0.1 LOCKED option A): NOT a real
|
// Phase 5.1 of GAP_CLOSURE_PLAN (Phase 0.1 LOCKED option A): NOT a real
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// Minimal math.h subset for the W65816 runtime.
|
// Minimal math.h subset for the W65816 runtime.
|
||||||
//
|
//
|
||||||
// All operations work directly on the IEEE-754 bit representation
|
// All operations work directly on the IEEE-754 bit representation
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// qsort + bsearch — own translation unit so the indirect cmp call
|
// qsort + bsearch — own translation unit so the indirect cmp call
|
||||||
// and the byte-swap inner loop don't perturb other libc code.
|
// and the byte-swap inner loop don't perturb other libc code.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// resource.c - Apple IIgs Resource Manager - real implementation.
|
// resource.c - Apple IIgs Resource Manager - real implementation.
|
||||||
//
|
//
|
||||||
// Replaces the Phase 3.4 stub. Reads .rsrc resource forks via the
|
// Replaces the Phase 3.4 stub. Reads .rsrc resource forks via the
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// Buffer-formatting siblings of printf — kept in their own translation
|
// Buffer-formatting siblings of printf — kept in their own translation
|
||||||
// unit so the shared writeXxx helpers don't have to take a function-
|
// unit so the shared writeXxx helpers don't have to take a function-
|
||||||
// pointer sink (indirect call cost on this target) and so adding the
|
// pointer sink (indirect call cost on this target) and so adding the
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// Real double-precision IEEE 754 soft-float for the W65816. Treats
|
// Real double-precision IEEE 754 soft-float for the W65816. Treats
|
||||||
// a `double` as `unsigned long long` (64-bit) and operates on its
|
// a `double` as `unsigned long long` (64-bit) and operates on its
|
||||||
// bit pattern. Returns by-value at the i64 ABI A:X:Y:DP[$F0].
|
// bit pattern. Returns by-value at the i64 ABI A:X:Y:DP[$F0].
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// 32-bit IEEE 754 soft-float runtime for the W65816 backend.
|
// 32-bit IEEE 754 soft-float runtime for the W65816 backend.
|
||||||
//
|
//
|
||||||
// Implements the libcalls clang emits for float ops:
|
// Implements the libcalls clang emits for float ops:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// sound.c - implementation of iigs/sound.h. Thin wrappers around
|
// sound.c - implementation of iigs/sound.h. Thin wrappers around
|
||||||
// the SoundManager toolset. See header for what's intentionally not
|
// the SoundManager toolset. See header for what's intentionally not
|
||||||
// here.
|
// here.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// sprite.c - 16x16 fixed-shape 4bpp packed sprite engine for SHR 320
|
// sprite.c - 16x16 fixed-shape 4bpp packed sprite engine for SHR 320
|
||||||
// mode. See runtime/include/iigs/sprite.h for the API contract and
|
// mode. See runtime/include/iigs/sprite.h for the API contract and
|
||||||
// the $C035-shadow-gotcha discussion.
|
// the $C035-shadow-gotcha discussion.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// sscanf / fscanf — minimal scanf family for the W65816 runtime.
|
// sscanf / fscanf — minimal scanf family for the W65816 runtime.
|
||||||
// Format directives:
|
// Format directives:
|
||||||
// %d / %i signed int (decimal)
|
// %d / %i signed int (decimal)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// strtok / strtok_r — own TU so the noinline on strtok_r doesn't
|
// strtok / strtok_r — own TU so the noinline on strtok_r doesn't
|
||||||
// affect other functions' inlining decisions. Kept separate from
|
// affect other functions' inlining decisions. Kept separate from
|
||||||
// extras.c by historical convention.
|
// extras.c by historical convention.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// strtol / strtoul — kept in their own translation unit because adding
|
// strtol / strtoul — kept in their own translation unit because adding
|
||||||
// them to libc.c bumped the libc.s layout enough that vprintf's branch
|
// them to libc.c bumped the libc.s layout enough that vprintf's branch
|
||||||
// distances exceeded our BranchExpand threshold (caught by printf("%d
|
// distances exceeded our BranchExpand threshold (caught by printf("%d
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// time.h additions (struct tm, gmtime, localtime, mktime, asctime,
|
// time.h additions (struct tm, gmtime, localtime, mktime, asctime,
|
||||||
// ctime, difftime, strftime). Split out from libc.c to keep that
|
// ctime, difftime, strftime). Split out from libc.c to keep that
|
||||||
// translation unit's frame size below the W65816 stack-relative range.
|
// translation unit's frame size below the W65816 stack-relative range.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// W65816 minimal UBSan runtime — handler stubs for
|
// W65816 minimal UBSan runtime — handler stubs for
|
||||||
// `-fsanitize=undefined -fsanitize-minimal-runtime`.
|
// `-fsanitize=undefined -fsanitize-minimal-runtime`.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// uiBuilder.c - declarative UI scaffolding implementation.
|
// uiBuilder.c - declarative UI scaffolding implementation.
|
||||||
//
|
//
|
||||||
// Menu mini-format reference (Apple IIgs TBR Vol.2 ch.13.MenuMgr,
|
// Menu mini-format reference (Apple IIgs TBR Vol.2 ch.13.MenuMgr,
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,14 @@ from pathlib import Path
|
||||||
OUT_ASM = Path("/home/scott/claude/llvm816/runtime/src/gnoKernel.s")
|
OUT_ASM = Path("/home/scott/claude/llvm816/runtime/src/gnoKernel.s")
|
||||||
OUT_HEADER = Path("/home/scott/claude/llvm816/runtime/include/gno/kernel.h")
|
OUT_HEADER = Path("/home/scott/claude/llvm816/runtime/include/gno/kernel.h")
|
||||||
|
|
||||||
|
# The license header every generated file opens with (llvm-mos's license;
|
||||||
|
# LICENSE.TXT), without its comment marker.
|
||||||
|
LICENSE_LINES = [
|
||||||
|
"Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.",
|
||||||
|
"See https://llvm.org/LICENSE.txt for license information.",
|
||||||
|
"SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception",
|
||||||
|
]
|
||||||
|
|
||||||
# Each entry: (funcId, name, retSize, [argSize, ...])
|
# Each entry: (funcId, name, retSize, [argSize, ...])
|
||||||
# Sizes in bytes (2 = i16, 4 = i32 / ptr32). Names follow ORCA's K* prefix.
|
# Sizes in bytes (2 = i16, 4 = i32 / ptr32). Names follow ORCA's K* prefix.
|
||||||
#
|
#
|
||||||
|
|
@ -178,7 +186,7 @@ def emitWrapper(funcId, name, retSize, argSizes):
|
||||||
|
|
||||||
def emitHeader():
|
def emitHeader():
|
||||||
"""Generate a C header with extern decls for use by libc."""
|
"""Generate a C header with extern decls for use by libc."""
|
||||||
hLines = [
|
hLines = ["// " + line for line in LICENSE_LINES] + ["//"] + [
|
||||||
"// AUTOGENERATED by scripts/genGnoKernel.py — DO NOT EDIT.",
|
"// AUTOGENERATED by scripts/genGnoKernel.py — DO NOT EDIT.",
|
||||||
"// GNO kernel toolset $03 wrappers, callable from C.",
|
"// GNO kernel toolset $03 wrappers, callable from C.",
|
||||||
"// Convention: each K* returns the kernel result (or -1 on error);",
|
"// Convention: each K* returns the kernel result (or -1 on error);",
|
||||||
|
|
@ -211,7 +219,7 @@ def emitHeader():
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
asmLines = [
|
asmLines = ["; " + line for line in LICENSE_LINES] + [";"] + [
|
||||||
"; AUTOGENERATED by scripts/genGnoKernel.py — DO NOT EDIT by hand.",
|
"; AUTOGENERATED by scripts/genGnoKernel.py — DO NOT EDIT by hand.",
|
||||||
";",
|
";",
|
||||||
"; GNO/ME kernel toolset $03 wrappers.",
|
"; GNO/ME kernel toolset $03 wrappers.",
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,14 @@ NLIST_PATH = Path("/home/scott/claude/llvm816/tools/nlist/NList.Data.txt")
|
||||||
OUT_HEADER = Path("/home/scott/claude/llvm816/runtime/include/iigs/toolbox.h")
|
OUT_HEADER = Path("/home/scott/claude/llvm816/runtime/include/iigs/toolbox.h")
|
||||||
OUT_ASM = Path("/home/scott/claude/llvm816/runtime/src/iigsToolbox.s")
|
OUT_ASM = Path("/home/scott/claude/llvm816/runtime/src/iigsToolbox.s")
|
||||||
|
|
||||||
|
# The license header every generated file opens with (llvm-mos's license;
|
||||||
|
# LICENSE.TXT), without its comment marker.
|
||||||
|
LICENSE_LINES = [
|
||||||
|
"Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.",
|
||||||
|
"See https://llvm.org/LICENSE.txt for license information.",
|
||||||
|
"SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception",
|
||||||
|
]
|
||||||
|
|
||||||
# Type table: (size in bytes, c-type)
|
# Type table: (size in bytes, c-type)
|
||||||
TYPE_MAP = {
|
TYPE_MAP = {
|
||||||
"void": (0, "void"),
|
"void": (0, "void"),
|
||||||
|
|
@ -265,7 +273,7 @@ def sizeInfo(sz, isPtr=False):
|
||||||
def emit(decls):
|
def emit(decls):
|
||||||
"""Generate C header and .s file from parsed decls."""
|
"""Generate C header and .s file from parsed decls."""
|
||||||
|
|
||||||
cLines = [
|
cLines = ["// " + line for line in LICENSE_LINES] + ["//"] + [
|
||||||
"// AUTOGENERATED by scripts/genToolbox.py from NList.Data.",
|
"// AUTOGENERATED by scripts/genToolbox.py from NList.Data.",
|
||||||
"// DO NOT EDIT by hand — regenerate to update.",
|
"// DO NOT EDIT by hand — regenerate to update.",
|
||||||
"// Source: tools/nlist/NList.Data.txt (Dave Lyons' NiftyList database).",
|
"// Source: tools/nlist/NList.Data.txt (Dave Lyons' NiftyList database).",
|
||||||
|
|
@ -294,7 +302,7 @@ def emit(decls):
|
||||||
"",
|
"",
|
||||||
]
|
]
|
||||||
|
|
||||||
sLines = [
|
sLines = ["; " + line for line in LICENSE_LINES] + [";"] + [
|
||||||
"; AUTOGENERATED by scripts/genToolbox.py from NList.Data.",
|
"; AUTOGENERATED by scripts/genToolbox.py from NList.Data.",
|
||||||
"; DO NOT EDIT by hand — regenerate to update.",
|
"; DO NOT EDIT by hand — regenerate to update.",
|
||||||
"; Source: tools/nlist/NList.Data.txt (Dave Lyons' NiftyList database).",
|
"; Source: tools/nlist/NList.Data.txt (Dave Lyons' NiftyList database).",
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ TEST_DIR="$PROJECT_ROOT/src/llvm/test/CodeGen/W65816"
|
||||||
LLC="$PROJECT_ROOT/tools/llvm-mos-build/bin/llc"
|
LLC="$PROJECT_ROOT/tools/llvm-mos-build/bin/llc"
|
||||||
FILECHECK="$PROJECT_ROOT/tools/llvm-mos-build/bin/FileCheck"
|
FILECHECK="$PROJECT_ROOT/tools/llvm-mos-build/bin/FileCheck"
|
||||||
NOT="$PROJECT_ROOT/tools/llvm-mos-build/bin/not"
|
NOT="$PROJECT_ROOT/tools/llvm-mos-build/bin/not"
|
||||||
|
OBJDUMP="$PROJECT_ROOT/tools/llvm-mos-build/bin/llvm-objdump"
|
||||||
|
|
||||||
[ -x "$LLC" ] || { echo "missing $LLC" >&2; exit 2; }
|
[ -x "$LLC" ] || { echo "missing $LLC" >&2; exit 2; }
|
||||||
[ -x "$FILECHECK" ] || { echo "missing $FILECHECK; build with 'ninja FileCheck not'" >&2; exit 2; }
|
[ -x "$FILECHECK" ] || { echo "missing $FILECHECK; build with 'ninja FileCheck not'" >&2; exit 2; }
|
||||||
|
|
@ -56,6 +57,7 @@ for f in "${files[@]}"; do
|
||||||
cmd=${cmd//llc/$LLC}
|
cmd=${cmd//llc/$LLC}
|
||||||
cmd=${cmd//FileCheck/$FILECHECK}
|
cmd=${cmd//FileCheck/$FILECHECK}
|
||||||
cmd=${cmd//not /$NOT }
|
cmd=${cmd//not /$NOT }
|
||||||
|
cmd=${cmd//llvm-objdump/$OBJDUMP}
|
||||||
out=$(bash -c "$cmd" 2>&1) || {
|
out=$(bash -c "$cmd" 2>&1) || {
|
||||||
ok=0
|
ok=0
|
||||||
echo "FAIL $name"
|
echo "FAIL $name"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
// link816 — minimal flat-binary linker for W65816 ELF .o files.
|
// link816 — minimal flat-binary linker for W65816 ELF .o files.
|
||||||
//
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// Reads one or more ELF32 object files (produced by llvm-mc / clang -c
|
// Reads one or more ELF32 object files (produced by llvm-mc / clang -c
|
||||||
// with the W65816 backend), concatenates their .text* / .rodata* /
|
// with the W65816 backend), concatenates their .text* / .rodata* /
|
||||||
// .data* sections at consecutive addresses starting from a given base,
|
// .data* sections at consecutive addresses starting from a given base,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
// omfEmit — wrap a flat binary (or a multi-segment manifest from
|
// omfEmit — wrap a flat binary (or a multi-segment manifest from
|
||||||
// link816) in an Apple IIgs OMF v2.1 container.
|
// link816) in an Apple IIgs OMF v2.1 container.
|
||||||
//
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
// Single-segment mode (legacy): one CODE segment with KIND=0,
|
// Single-segment mode (legacy): one CODE segment with KIND=0,
|
||||||
// no INTERSEG opcodes, ORG=0 (loader picks bank). Header layout
|
// no INTERSEG opcodes, ORG=0 (loader picks bank). Header layout
|
||||||
// per OMF 2.1 spec: 44-byte fixed header + 10-byte LOAD_NAME +
|
// per OMF 2.1 spec: 44-byte fixed header + 10-byte LOAD_NAME +
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ add_llvm_target(W65816CodeGen
|
||||||
W65816StackSlotCleanup.cpp
|
W65816StackSlotCleanup.cpp
|
||||||
W65816SepRepCleanup.cpp
|
W65816SepRepCleanup.cpp
|
||||||
W65816FarPtrStageReuse.cpp
|
W65816FarPtrStageReuse.cpp
|
||||||
W65816BranchExpand.cpp
|
W65816BranchCleanup.cpp
|
||||||
W65816TiedDefSpill.cpp
|
W65816TiedDefSpill.cpp
|
||||||
W65816ABridgeViaX.cpp
|
W65816ABridgeViaX.cpp
|
||||||
W65816WidenAcc16.cpp
|
W65816WidenAcc16.cpp
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// W65816 assembler backend. Implements applyFixup for the
|
// W65816 assembler backend. Implements applyFixup for the
|
||||||
// R_W65816_* relocation family, BRA -> BRL relaxation when the 8-bit
|
// R_W65816_* relocation family, branch relaxation when the 8-bit signed
|
||||||
// signed displacement won't fit, and writeNopData using 65816 NOP
|
// displacement won't fit (BRA -> BRL, Bxx -> inverted Bxx over a BRL),
|
||||||
// ($EA) bytes.
|
// and writeNopData using 65816 NOP ($EA) bytes.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
|
@ -41,6 +41,31 @@ using namespace llvm;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
// The long form of a conditional branch (W65816InstrInfo.td's
|
||||||
|
// InstPCRelLongCond), 0 for any other opcode.
|
||||||
|
unsigned longCondOpcode(unsigned Opcode) {
|
||||||
|
switch (Opcode) {
|
||||||
|
case W65816::BEQ:
|
||||||
|
return W65816::BEQ_Long;
|
||||||
|
case W65816::BNE:
|
||||||
|
return W65816::BNE_Long;
|
||||||
|
case W65816::BCS:
|
||||||
|
return W65816::BCS_Long;
|
||||||
|
case W65816::BCC:
|
||||||
|
return W65816::BCC_Long;
|
||||||
|
case W65816::BMI:
|
||||||
|
return W65816::BMI_Long;
|
||||||
|
case W65816::BPL:
|
||||||
|
return W65816::BPL_Long;
|
||||||
|
case W65816::BVS:
|
||||||
|
return W65816::BVS_Long;
|
||||||
|
case W65816::BVC:
|
||||||
|
return W65816::BVC_Long;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class W65816AsmBackend : public MCAsmBackend {
|
class W65816AsmBackend : public MCAsmBackend {
|
||||||
uint8_t OSABI;
|
uint8_t OSABI;
|
||||||
|
|
||||||
|
|
@ -112,6 +137,13 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A resolved branch displacement counts from the end of the
|
||||||
|
// instruction, which the operand ends: Value is measured from the
|
||||||
|
// operand's first byte.
|
||||||
|
if (Fixup.getKind() == W65816::fixup_8_pcrel ||
|
||||||
|
Fixup.getKind() == W65816::fixup_16_pcrel)
|
||||||
|
Value -= Width;
|
||||||
|
|
||||||
// PCRel8 (Bxx / BRA) takes a signed 8-bit offset. If the resolved
|
// PCRel8 (Bxx / BRA) takes a signed 8-bit offset. If the resolved
|
||||||
// displacement won't fit, the encoded byte is meaningless — the
|
// displacement won't fit, the encoded byte is meaningless — the
|
||||||
// branch would land somewhere unintended. Diagnose explicitly
|
// branch would land somewhere unintended. Diagnose explicitly
|
||||||
|
|
@ -171,45 +203,42 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
// Relaxation: BRA (signed-8 displacement) -> BRL (signed-16). When
|
// Relaxation. A branch starts short; when its target lies beyond an
|
||||||
// the assembler determines that a forward/backward BRA's target lies
|
// 8-bit displacement the assembler asks fixupNeedsRelaxation, then
|
||||||
// beyond +/-128 bytes, it asks us first via mayNeedRelaxation /
|
// relaxInstruction for the long form: BRA (0x80 dd) becomes BRL (0x82
|
||||||
// fixupNeedsRelaxation, then via relaxInstruction to materialise the
|
// dd dd), and a conditional Bxx, which has no long form on the 65816,
|
||||||
// longer form. Both BRA (0x80 dd) and BRL (0x82 dd dd) have the
|
// becomes its inversion over a BRL (`inv +3 ; brl dd dd`, the _Long
|
||||||
// same operand semantics (PC-relative) so the rewrite is just an
|
// opcodes). Layout iterates until every branch fits, so a branch is
|
||||||
// opcode swap with the fixup kind upgraded from fixup_8_pcrel to
|
// long only where it must be -- the code generator leaves every
|
||||||
// fixup_16_pcrel.
|
// distance to this.
|
||||||
//
|
//
|
||||||
// We do NOT relax conditional Bxx instructions yet: the 65816 has
|
// A target the assembler cannot resolve (another section, a global
|
||||||
// no long conditional branch, so the standard trick is to invert
|
// symbol) stays short: link816 resolves its R_PCREL8 and stops on one
|
||||||
// and span: `BNE l: ... -> BEQ skip; BRL l; skip:`. That requires
|
// out of range.
|
||||||
// emitting two instructions in place of one and shifting all
|
|
||||||
// subsequent fixup offsets, which the layered MCAsmBackend API
|
|
||||||
// doesn't support cleanly. A higher-level codegen pass (or a
|
|
||||||
// pre-emit MIR pass) is the right place for that. Until then,
|
|
||||||
// out-of-range conditional branches still error out via the
|
|
||||||
// applyFixup diagnostic above.
|
|
||||||
bool mayNeedRelaxation(unsigned Opcode, ArrayRef<MCOperand> Operands,
|
bool mayNeedRelaxation(unsigned Opcode, ArrayRef<MCOperand> Operands,
|
||||||
const MCSubtargetInfo &STI) const override {
|
const MCSubtargetInfo &STI) const override {
|
||||||
return Opcode == W65816::BRA;
|
return Opcode == W65816::BRA || longCondOpcode(Opcode) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fixupNeedsRelaxationAdvanced(const MCFragment &F, const MCFixup &Fixup,
|
bool fixupNeedsRelaxationAdvanced(const MCFragment &F, const MCFixup &Fixup,
|
||||||
const MCValue &Target, uint64_t Value,
|
const MCValue &Target, uint64_t Value,
|
||||||
bool Resolved) const override {
|
bool Resolved) const override {
|
||||||
if (Fixup.getKind() != W65816::fixup_8_pcrel)
|
if (!Resolved || Fixup.getKind() != W65816::fixup_8_pcrel)
|
||||||
return false;
|
return false;
|
||||||
int64_t Signed = static_cast<int64_t>(Value);
|
// Value counts from the displacement byte, the branch from the
|
||||||
|
// instruction's end one byte later (as applyFixup).
|
||||||
|
int64_t Signed = static_cast<int64_t>(Value) - 1;
|
||||||
return Signed < kBranch8Min || Signed > kBranch8Max;
|
return Signed < kBranch8Min || Signed > kBranch8Max;
|
||||||
}
|
}
|
||||||
|
|
||||||
void relaxInstruction(MCInst &Inst,
|
void relaxInstruction(MCInst &Inst,
|
||||||
const MCSubtargetInfo &STI) const override {
|
const MCSubtargetInfo &STI) const override {
|
||||||
if (Inst.getOpcode() == W65816::BRA) {
|
// The operand (the target expression) stays; the encoder emits the
|
||||||
|
// long form's fixup_16_pcrel.
|
||||||
|
if (Inst.getOpcode() == W65816::BRA)
|
||||||
Inst.setOpcode(W65816::BRL);
|
Inst.setOpcode(W65816::BRL);
|
||||||
// Operand stays the same (the symbol/expression). The encoder
|
else if (unsigned Long = longCondOpcode(Inst.getOpcode()))
|
||||||
// will pick the BRL encoding (3 bytes) and emit fixup_16_pcrel.
|
Inst.setOpcode(Long);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,10 @@
|
||||||
// tracking the per-instruction byte offset so block-move and other
|
// tracking the per-instruction byte offset so block-move and other
|
||||||
// multi-operand instructions get correctly-positioned fixups.
|
// multi-operand instructions get correctly-positioned fixups.
|
||||||
//
|
//
|
||||||
|
// Branch displacements are PC-relative fixups, so the assembler resolves
|
||||||
|
// a branch to a label in its own section itself, and its relaxation
|
||||||
|
// (W65816AsmBackend) sees the real displacement.
|
||||||
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "MCTargetDesc/W65816FixupKinds.h"
|
#include "MCTargetDesc/W65816FixupKinds.h"
|
||||||
|
|
@ -38,6 +42,10 @@
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
|
// Where a long conditional branch (`inv +3 ; brl dest`) keeps the BRL's
|
||||||
|
// displacement: after the inverted branch and the BRL opcode.
|
||||||
|
static constexpr unsigned kLongCondDispOffset = 3;
|
||||||
|
|
||||||
class W65816MCCodeEmitter : public MCCodeEmitter {
|
class W65816MCCodeEmitter : public MCCodeEmitter {
|
||||||
MCContext &Ctx;
|
MCContext &Ctx;
|
||||||
const MCInstrInfo &MCII;
|
const MCInstrInfo &MCII;
|
||||||
|
|
@ -84,13 +92,18 @@ class W65816MCCodeEmitter : public MCCodeEmitter {
|
||||||
unsigned encodePCRel16(const MCInst &MI, unsigned OpIdx,
|
unsigned encodePCRel16(const MCInst &MI, unsigned OpIdx,
|
||||||
SmallVectorImpl<MCFixup> &Fixups,
|
SmallVectorImpl<MCFixup> &Fixups,
|
||||||
const MCSubtargetInfo &STI) const;
|
const MCSubtargetInfo &STI) const;
|
||||||
|
unsigned encodePCRelLongCond(const MCInst &MI, unsigned OpIdx,
|
||||||
|
SmallVectorImpl<MCFixup> &Fixups,
|
||||||
|
const MCSubtargetInfo &STI) const;
|
||||||
|
|
||||||
// Shared implementation for every encode* helper. `width` is the number
|
// Shared implementation for every encode* helper. `width` is the number
|
||||||
// of bytes of the operand as it appears in the instruction stream; it
|
// of bytes of the operand as it appears in the instruction stream; it
|
||||||
// both advances the per-instruction offset and selects the fixup kind.
|
// both advances the per-instruction offset and selects the fixup kind.
|
||||||
|
// `pcRel` marks a branch displacement.
|
||||||
unsigned encodeOperand(const MCInst &MI, unsigned OpIdx, unsigned width,
|
unsigned encodeOperand(const MCInst &MI, unsigned OpIdx, unsigned width,
|
||||||
W65816::Fixups fixupKind,
|
W65816::Fixups fixupKind,
|
||||||
SmallVectorImpl<MCFixup> &Fixups) const;
|
SmallVectorImpl<MCFixup> &Fixups,
|
||||||
|
bool pcRel = false) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
W65816MCCodeEmitter(MCContext &Ctx, const MCInstrInfo &MCII)
|
W65816MCCodeEmitter(MCContext &Ctx, const MCInstrInfo &MCII)
|
||||||
|
|
@ -136,7 +149,8 @@ W65816MCCodeEmitter::getMachineOpValue(const MCInst &MI, const MCOperand &MO,
|
||||||
unsigned W65816MCCodeEmitter::encodeOperand(const MCInst &MI, unsigned OpIdx,
|
unsigned W65816MCCodeEmitter::encodeOperand(const MCInst &MI, unsigned OpIdx,
|
||||||
unsigned width,
|
unsigned width,
|
||||||
W65816::Fixups fixupKind,
|
W65816::Fixups fixupKind,
|
||||||
SmallVectorImpl<MCFixup> &Fixups) const {
|
SmallVectorImpl<MCFixup> &Fixups,
|
||||||
|
bool pcRel) const {
|
||||||
const MCOperand &MO = MI.getOperand(OpIdx);
|
const MCOperand &MO = MI.getOperand(OpIdx);
|
||||||
unsigned offsetForThisOperand = OperandOffset;
|
unsigned offsetForThisOperand = OperandOffset;
|
||||||
OperandOffset += width;
|
OperandOffset += width;
|
||||||
|
|
@ -147,7 +161,7 @@ unsigned W65816MCCodeEmitter::encodeOperand(const MCInst &MI, unsigned OpIdx,
|
||||||
|
|
||||||
assert(MO.isExpr() && "unexpected operand kind for encoded operand");
|
assert(MO.isExpr() && "unexpected operand kind for encoded operand");
|
||||||
Fixups.push_back(MCFixup::create(offsetForThisOperand, MO.getExpr(),
|
Fixups.push_back(MCFixup::create(offsetForThisOperand, MO.getExpr(),
|
||||||
MCFixupKind(fixupKind)));
|
MCFixupKind(fixupKind), pcRel));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -190,13 +204,21 @@ unsigned W65816MCCodeEmitter::encodeAddr24(const MCInst &MI, unsigned OpIdx,
|
||||||
unsigned W65816MCCodeEmitter::encodePCRel8(const MCInst &MI, unsigned OpIdx,
|
unsigned W65816MCCodeEmitter::encodePCRel8(const MCInst &MI, unsigned OpIdx,
|
||||||
SmallVectorImpl<MCFixup> &Fixups,
|
SmallVectorImpl<MCFixup> &Fixups,
|
||||||
const MCSubtargetInfo &STI) const {
|
const MCSubtargetInfo &STI) const {
|
||||||
return encodeOperand(MI, OpIdx, 1, W65816::fixup_8_pcrel, Fixups);
|
return encodeOperand(MI, OpIdx, 1, W65816::fixup_8_pcrel, Fixups, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned W65816MCCodeEmitter::encodePCRel16(const MCInst &MI, unsigned OpIdx,
|
unsigned W65816MCCodeEmitter::encodePCRel16(const MCInst &MI, unsigned OpIdx,
|
||||||
SmallVectorImpl<MCFixup> &Fixups,
|
SmallVectorImpl<MCFixup> &Fixups,
|
||||||
const MCSubtargetInfo &STI) const {
|
const MCSubtargetInfo &STI) const {
|
||||||
return encodeOperand(MI, OpIdx, 2, W65816::fixup_16_pcrel, Fixups);
|
return encodeOperand(MI, OpIdx, 2, W65816::fixup_16_pcrel, Fixups, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned
|
||||||
|
W65816MCCodeEmitter::encodePCRelLongCond(const MCInst &MI, unsigned OpIdx,
|
||||||
|
SmallVectorImpl<MCFixup> &Fixups,
|
||||||
|
const MCSubtargetInfo &STI) const {
|
||||||
|
OperandOffset = kLongCondDispOffset;
|
||||||
|
return encodeOperand(MI, OpIdx, 2, W65816::fixup_16_pcrel, Fixups, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
MCCodeEmitter *createW65816MCCodeEmitter(const MCInstrInfo &MCII,
|
MCCodeEmitter *createW65816MCCodeEmitter(const MCInstrInfo &MCII,
|
||||||
|
|
|
||||||
|
|
@ -72,12 +72,10 @@ FunctionPass *createW65816SepRepCleanup();
|
||||||
// W65816FarPtrStageReuse.cpp.
|
// W65816FarPtrStageReuse.cpp.
|
||||||
FunctionPass *createW65816FarPtrStageReuse();
|
FunctionPass *createW65816FarPtrStageReuse();
|
||||||
|
|
||||||
// Pre-emit pass: expands long conditional branches into the
|
// Pre-emit pass: inverts a conditional branch into a fall-through, drops
|
||||||
// `INVERTED_Bxx skip ; BRA target ; skip:` pattern when the byte
|
// dead conditionals and branches to the next block. Branch lengths are
|
||||||
// distance to the target exceeds the +/-128 reach of an 8-bit-PCREL
|
// left to the assembler's relaxation. See W65816BranchCleanup.cpp.
|
||||||
// branch. The unconditional BRA is then auto-relaxed to BRL by
|
FunctionPass *createW65816BranchCleanup();
|
||||||
// the assembler when its target is also far. See W65816BranchExpand.cpp.
|
|
||||||
FunctionPass *createW65816BranchExpand();
|
|
||||||
|
|
||||||
// Pre-RA pass: when a tied-def Acc16 instruction has a source vreg
|
// Pre-RA pass: when a tied-def Acc16 instruction has a source vreg
|
||||||
// whose value is also used after the consumer, fast regalloc fails
|
// whose value is also used after the consumer, fast regalloc fails
|
||||||
|
|
@ -235,7 +233,7 @@ void initializeW65816StackSlotCleanupPass(PassRegistry &);
|
||||||
void initializeW65816I32IncFoldPass(PassRegistry &);
|
void initializeW65816I32IncFoldPass(PassRegistry &);
|
||||||
void initializeW65816SepRepCleanupPass(PassRegistry &);
|
void initializeW65816SepRepCleanupPass(PassRegistry &);
|
||||||
void initializeW65816FarPtrStageReusePass(PassRegistry &);
|
void initializeW65816FarPtrStageReusePass(PassRegistry &);
|
||||||
void initializeW65816BranchExpandPass(PassRegistry &);
|
void initializeW65816BranchCleanupPass(PassRegistry &);
|
||||||
void initializeW65816TiedDefSpillPass(PassRegistry &);
|
void initializeW65816TiedDefSpillPass(PassRegistry &);
|
||||||
void initializeW65816ABridgeViaXPass(PassRegistry &);
|
void initializeW65816ABridgeViaXPass(PassRegistry &);
|
||||||
void initializeW65816UnLSRPass(PassRegistry &);
|
void initializeW65816UnLSRPass(PassRegistry &);
|
||||||
|
|
|
||||||
154
src/llvm/lib/Target/W65816/W65816BranchCleanup.cpp
Normal file
154
src/llvm/lib/Target/W65816/W65816BranchCleanup.cpp
Normal file
|
|
@ -0,0 +1,154 @@
|
||||||
|
//===-- W65816BranchCleanup.cpp - Pre-emit branch cleanup ------------------===//
|
||||||
|
//
|
||||||
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
//
|
||||||
|
// Tidies the branches block placement leaves at the end of each block:
|
||||||
|
//
|
||||||
|
// 1. `Bxx next ; BRA other`, where next is the following block, becomes
|
||||||
|
// `INV_Bxx other` falling through to next (a loop's `beq exit ; bra
|
||||||
|
// loop` becomes `bne loop`: 3 cycles a trip instead of 6).
|
||||||
|
// 2. `Bxx X ; BRA X` loses the conditional: both edges go to X.
|
||||||
|
// 3. A trailing `BRA next` goes: the block falls through.
|
||||||
|
//
|
||||||
|
// Branch lengths are not decided here. Every branch leaves the compiler
|
||||||
|
// short and W65816AsmBackend relaxes the ones whose final displacement
|
||||||
|
// does not fit 8 bits (BRA -> BRL, Bxx -> inverted Bxx over a BRL). This
|
||||||
|
// pass used to lengthen them itself, from byte-size estimates taken
|
||||||
|
// before the passes that still move code (stack-slot promotion, far-
|
||||||
|
// pointer staging, ...), with a 90-byte safety margin; a quarter of its
|
||||||
|
// long branches could have stayed short (0.8% of the corpus's .text).
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "W65816.h"
|
||||||
|
#include "W65816InstrInfo.h"
|
||||||
|
#include "W65816Subtarget.h"
|
||||||
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||||
|
#include "llvm/CodeGen/MachineInstr.h"
|
||||||
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||||
|
|
||||||
|
using namespace llvm;
|
||||||
|
|
||||||
|
#define DEBUG_TYPE "w65816-branch-cleanup"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
class W65816BranchCleanup : public MachineFunctionPass {
|
||||||
|
public:
|
||||||
|
static char ID;
|
||||||
|
W65816BranchCleanup() : MachineFunctionPass(ID) {}
|
||||||
|
StringRef getPassName() const override {
|
||||||
|
return "W65816 pre-emit branch cleanup";
|
||||||
|
}
|
||||||
|
bool runOnMachineFunction(MachineFunction &MF) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
char W65816BranchCleanup::ID = 0;
|
||||||
|
|
||||||
|
INITIALIZE_PASS(W65816BranchCleanup, DEBUG_TYPE,
|
||||||
|
"W65816 pre-emit branch cleanup", false, false)
|
||||||
|
|
||||||
|
FunctionPass *llvm::createW65816BranchCleanup() {
|
||||||
|
return new W65816BranchCleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// The MBB a branch's first operand names, or nullptr.
|
||||||
|
static MachineBasicBlock *branchTarget(const MachineInstr &MI) {
|
||||||
|
if (MI.getNumOperands() < 1 || !MI.getOperand(0).isMBB())
|
||||||
|
return nullptr;
|
||||||
|
return MI.getOperand(0).getMBB();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Step 3: a block's trailing `BRA next` when next is the following block
|
||||||
|
// in layout: block placement sometimes leaves one. 3 bytes, 3 cycles.
|
||||||
|
static bool dropBranchToNext(MachineFunction &MF) {
|
||||||
|
bool Changed = false;
|
||||||
|
for (auto MBBIt = MF.begin(); MBBIt != MF.end(); ++MBBIt) {
|
||||||
|
auto NextMBB = std::next(MBBIt);
|
||||||
|
if (NextMBB == MF.end())
|
||||||
|
continue;
|
||||||
|
auto Last = MBBIt->getLastNonDebugInstr();
|
||||||
|
if (Last == MBBIt->end() || Last->getOpcode() != W65816::BRA ||
|
||||||
|
branchTarget(*Last) != &*NextMBB)
|
||||||
|
continue;
|
||||||
|
Last->eraseFromParent();
|
||||||
|
Changed = true;
|
||||||
|
}
|
||||||
|
return Changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Step 2: `Bxx X ; BRA X` -- both edges go to X, so the conditional is
|
||||||
|
// dead. The shape survives upstream cleanup when the SELECT_CC inserter
|
||||||
|
// or CodeGenPrepare emitted `br i1 %c, label %X, label %X`.
|
||||||
|
static bool dropDeadConditionals(MachineFunction &MF) {
|
||||||
|
bool Changed = false;
|
||||||
|
for (MachineBasicBlock &MBB : MF) {
|
||||||
|
auto T = MBB.getFirstTerminator();
|
||||||
|
while (T != MBB.end()) {
|
||||||
|
auto Next = std::next(T);
|
||||||
|
if (Next == MBB.end())
|
||||||
|
break;
|
||||||
|
MachineBasicBlock *CondTarget = branchTarget(*T);
|
||||||
|
if (W65816Helpers::invertCondOpcode(T->getOpcode()) == 0 ||
|
||||||
|
Next->getOpcode() != W65816::BRA || !CondTarget ||
|
||||||
|
CondTarget != branchTarget(*Next)) {
|
||||||
|
++T;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
T = T->eraseFromParent();
|
||||||
|
Changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Step 1: `Bxx next ; BRA other`, next the following block, becomes
|
||||||
|
// `INV_Bxx other`, falling through to next. The common case is a tight
|
||||||
|
// loop's `beq exit ; bra loop` with the exit placed after the body: the
|
||||||
|
// back edge becomes one `bne loop` (3 cycles a trip, not 6).
|
||||||
|
static bool invertCondToFallThrough(MachineFunction &MF,
|
||||||
|
const TargetInstrInfo *TII) {
|
||||||
|
bool Changed = false;
|
||||||
|
for (auto MBBIt = MF.begin(); MBBIt != MF.end(); ++MBBIt) {
|
||||||
|
auto NextMBB = std::next(MBBIt);
|
||||||
|
if (NextMBB == MF.end())
|
||||||
|
continue;
|
||||||
|
auto T = MBBIt->getFirstTerminator();
|
||||||
|
if (T == MBBIt->end())
|
||||||
|
continue;
|
||||||
|
unsigned InvOpc = W65816Helpers::invertCondOpcode(T->getOpcode());
|
||||||
|
auto N = std::next(T);
|
||||||
|
if (InvOpc == 0 || N == MBBIt->end() || N->getOpcode() != W65816::BRA)
|
||||||
|
continue;
|
||||||
|
MachineBasicBlock *CondTarget = branchTarget(*T);
|
||||||
|
MachineBasicBlock *UncondTarget = branchTarget(*N);
|
||||||
|
if (!UncondTarget || CondTarget != &*NextMBB ||
|
||||||
|
CondTarget == UncondTarget)
|
||||||
|
continue;
|
||||||
|
T->setDesc(TII->get(InvOpc));
|
||||||
|
T->getOperand(0).setMBB(UncondTarget);
|
||||||
|
N->eraseFromParent();
|
||||||
|
Changed = true;
|
||||||
|
}
|
||||||
|
return Changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool W65816BranchCleanup::runOnMachineFunction(MachineFunction &MF) {
|
||||||
|
const TargetInstrInfo *TII = MF.getSubtarget<W65816Subtarget>().getInstrInfo();
|
||||||
|
bool Changed = invertCondToFallThrough(MF, TII);
|
||||||
|
Changed |= dropDeadConditionals(MF);
|
||||||
|
Changed |= dropBranchToNext(MF);
|
||||||
|
return Changed;
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue