[Git][ghc/ghc][wip/angerman/aarch64-ncg] 73 commits: Initial NCG

Moritz Angermann gitlab at gitlab.haskell.org
Wed Sep 9 01:59:52 UTC 2020



Moritz Angermann pushed to branch wip/angerman/aarch64-ncg at Glasgow Haskell Compiler / GHC


Commits:
91c9a800 by Moritz Angermann at 2020-09-09T09:58:29+08:00
Initial NCG

- - - - -
f044ab59 by Moritz Angermann at 2020-09-09T09:58:35+08:00
Address Takenobu's comments

- - - - -
4a414b82 by Moritz Angermann at 2020-09-09T09:58:35+08:00
Fix floating points handling of NaNs

- - - - -
81f61ee8 by Moritz Angermann at 2020-09-09T09:58:35+08:00
Add basic Graph Coloring support

- - - - -
c9296b79 by Moritz Angermann at 2020-09-09T09:58:35+08:00
Drop debug

- - - - -
aa003a55 by Moritz Angermann at 2020-09-09T09:58:35+08:00
Add primops_match.cmm testsuite

- - - - -
e9f5f2af by Moritz Angermann at 2020-09-09T09:58:35+08:00
Fix -NaN for real this time.

- - - - -
4bc55702 by Moritz Angermann at 2020-09-09T09:58:36+08:00
Adds nan test.

- - - - -
c88ef273 by Moritz Angermann at 2020-09-09T09:58:36+08:00
no show

- - - - -
5f94b5c8 by Moritz Angermann at 2020-09-09T09:58:36+08:00
Some notes on PIC

- - - - -
5dbe01b9 by Moritz Angermann at 2020-09-09T09:58:36+08:00
Properly load W32 with bit 31 set.

- - - - -
37389eb2 by Moritz Angermann at 2020-09-09T09:58:36+08:00
better relocation logging

- - - - -
e6f1e0db by Moritz Angermann at 2020-09-09T09:58:36+08:00
[linker] Fix out of range relocations.

mmap may return address all over the place. mmap_next will ensure we get
the next free page after the requested address.

This is especially important for linking on aarch64, where the memory model with PIC
admits relocations in the +-4GB range, and as such we can't work with
arbitrary object locations in memory.

Of note: we map the rts into process space, so any mapped objects must
not be ouside of the 4GB from the processes address space.

- - - - -
dff3e8d9 by Moritz Angermann at 2020-09-09T09:58:37+08:00
Revert "BigNum: rename BigNat types"

This reverts commit d3bd68978476487591fc60f7feb7cfb36b8fc3a3.

Signed-off-by: Moritz Angermann <moritz.angermann at gmail.com>

- - - - -
f8cb8134 by Moritz Angermann at 2020-09-09T09:58:37+08:00
Add AsmOpt Flags

- - - - -
0640e8ae by Moritz Angermann at 2020-09-09T09:58:37+08:00
Adds ANN instruction.

I wish I had a `pad n` function for SDoc, that would interact with the
layout, and just pad what ever was printed so far to `n` chars.

- - - - -
2426b591 by Moritz Angermann at 2020-09-09T09:58:37+08:00
Drop dead 32bit logic.

- - - - -
5fa5c0e9 by Moritz Angermann at 2020-09-09T09:58:37+08:00
Add Show CmmExpr instances.

Why would we want this, when we have Outputtable CmmExpr? Quite often
when working on Code Generators, we want to structurally match on
a Cmm Expression. Having to recover the Cmm Expression from its
Outputtable text is not always trivial, and requires substantial effort.
By having a Show instance, we can almost copy the definition to match
on.

- - - - -
901eae18 by Moritz Angermann at 2020-09-09T09:58:37+08:00
Drop duplicate show instance for CLabel now.

- - - - -
0e89617a by Moritz Angermann at 2020-09-09T09:58:38+08:00
Add link, lest I keep forgetting it.

- - - - -
f49d72db by Moritz Angermann at 2020-09-09T09:58:38+08:00
inline comments with //

- - - - -
4e0bf0dd by Moritz Angermann at 2020-09-09T09:58:38+08:00
Some optimizations; not yet sure if safe or not.

- - - - -
78030e50 by Moritz Angermann at 2020-09-09T09:58:38+08:00
Add latest opt changes.

- - - - -
113f0b69 by Moritz Angermann at 2020-09-09T09:58:38+08:00
Address Takenobu Tani's comments.

Thanks!

- - - - -
c2737333 by Moritz Angermann at 2020-09-09T09:58:38+08:00
Fix gcd :blush:

- - - - -
687fd1fc by Moritz Angermann at 2020-09-09T09:58:39+08:00
Overflow guard

- - - - -
7d5e6add by Moritz Angermann at 2020-09-09T09:58:39+08:00
More annotations.

- - - - -
0fe460a8 by Moritz Angermann at 2020-09-09T09:58:39+08:00
Revert "Overflow guard"

They are Integers not Ints.

This reverts commit 3ef94e593a2848cf2bdc4251f5be34536642675f.

Signed-off-by: Moritz Angermann <moritz.angermann at gmail.com>

- - - - -
10da7b3e by Moritz Angermann at 2020-09-09T09:58:39+08:00
Add CmmAssign and CmmStore comments

- - - - -
2f4a436b by Moritz Angermann at 2020-09-09T09:58:39+08:00
Minor address mode changes

- - - - -
fd8470a0 by Moritz Angermann at 2020-09-09T09:58:40+08:00
More Amode optimizations

- - - - -
82820a0a by Moritz Angermann at 2020-09-09T09:58:40+08:00
I think this shoudl work for all Registers, not just CmmGlobal

- - - - -
003ea7f4 by Moritz Angermann at 2020-09-09T09:58:40+08:00
Opt <<, >>

- - - - -
3ebaafe3 by Moritz Angermann at 2020-09-09T09:58:40+08:00
Opt &&, ||

- - - - -
b5e405a2 by Moritz Angermann at 2020-09-09T09:58:40+08:00
Add branch ANNotations.

- - - - -
52d3539e by Moritz Angermann at 2020-09-09T09:58:40+08:00
Disable Opt &&, ||, due to mask immediate

- - - - -
777358ef by Moritz Angermann at 2020-09-09T09:58:41+08:00
Opt: Adds CBZ, CBNZ

- - - - -
cbc7c586 by Moritz Angermann at 2020-09-09T09:58:41+08:00
More generic CBZ, CBNZ

- - - - -
fdf20590 by Moritz Angermann at 2020-09-09T09:58:41+08:00
Fixup

- - - - -
99a91c35 by Moritz Angermann at 2020-09-09T09:58:41+08:00
very rudimentary bitmask support.

- - - - -
f7195086 by Moritz Angermann at 2020-09-09T09:58:41+08:00
Add some more bitmasks

- - - - -
8e00c910 by Moritz Angermann at 2020-09-09T09:58:41+08:00
Opt STR

- - - - -
e393fc40 by Moritz Angermann at 2020-09-09T09:58:42+08:00
Fixup

- - - - -
2e0a6d4d by Moritz Angermann at 2020-09-09T09:58:42+08:00
Fix MO_SF_Conv

- - - - -
c7b587f5 by Moritz Angermann at 2020-09-09T09:58:42+08:00
Add Comment re MO_Memcpy

- - - - -
11c130b5 by Moritz Angermann at 2020-09-09T09:58:42+08:00
Always PIC via GOT

- - - - -
60f1a153 by Moritz Angermann at 2020-09-09T09:58:42+08:00
Fix up generated assembly.

Don't generate identity moves
e.g. mov x18, x18

- - - - -
c7359c61 by Moritz Angermann at 2020-09-09T09:58:43+08:00
Drop superfulous alignment generation.

- - - - -
01b76839 by Moritz Angermann at 2020-09-09T09:58:43+08:00
Hadrian :fire:

- - - - -
2758f5cd by Moritz Angermann at 2020-09-09T09:58:43+08:00
Address Tekenobus comments.

Thanks!

- - - - -
7e08a0ac by Moritz Angermann at 2020-09-09T09:58:43+08:00
Adds J to distinguish jumps from B.

Maybe this would be better handled with a phantom type?

- - - - -
5e5690d8 by Moritz Angermann at 2020-09-09T09:58:43+08:00
Make sp an Operand

- - - - -
14dcaebc by Moritz Angermann at 2020-09-09T09:58:43+08:00
allocMoreStack

This is still broken, as we can't spill into arbitrary ranges. Hence while we can allocate extra space, we can't really spill past 4096 offsets due to the immediat having to be encoded. This leaves us with a max of 512 spill slots.

We *can* work around this if we change the sp though.

- - - - -
6f983158 by Moritz Angermann at 2020-09-09T09:58:44+08:00
[Spill/Reload] Spill Around :fire:

- - - - -
8e16a150 by Moritz Angermann at 2020-09-09T09:58:44+08:00
Address Takenobus observations!

Thanks!

- - - - -
2c0e56aa by Moritz Angermann at 2020-09-09T09:58:44+08:00
:sob:

- - - - -
0eb10468 by Moritz Angermann at 2020-09-09T09:58:44+08:00
Revert the Spill/Reload fix; undo :got: loads.

This breaks dynamic, however we can build a working
stage2 compiler with the following mk/build.mk

BuildFlavour = quick

ifneq "$(BuildFlavour)" ""
include mk/flavours/$(BuildFlavour).mk
endif

STRIP_CMD = :

DYNAMIC_BY_DEFAULT   = NO
DYNAMIC_GHC_PROGRAMS = NO

- - - - -
e876348b by Moritz Angermann at 2020-09-09T09:58:44+08:00
Disable trivial deadlock detection

- - - - -
58d3e2f3 by Moritz Angermann at 2020-09-09T09:58:44+08:00
Adds some annotations

- - - - -
f488a3d8 by Moritz Angermann at 2020-09-09T09:58:45+08:00
Trying to get PIC right.

- - - - -
4dd1aaa8 by Moritz Angermann at 2020-09-09T09:58:45+08:00
[aarch64] Fix spill/reload

- - - - -
331aeb2f by Moritz Angermann at 2020-09-09T09:58:45+08:00
Try to get PIC right.

- - - - -
89d11d33 by Moritz Angermann at 2020-09-09T09:58:45+08:00
Spill/Reload only need a smaller window

- - - - -
2eb9f10b by Moritz Angermann at 2020-09-09T09:58:45+08:00
Drop bad/useless optimisation

This was due to not handling PIC symbols correctly and injecting CmmLoad
as we do on other platforms, but this doesn't translate to aarch64's got lookups.

- - - - -
cc00541b by Moritz Angermann at 2020-09-09T09:58:45+08:00
B is b

- - - - -
8ef27a9e by Moritz Angermann at 2020-09-09T09:58:46+08:00
Fix CCall

|Now mark used registers properly for the Register Allocator.

- - - - -
a894d50f by Moritz Angermann at 2020-09-09T09:58:46+08:00
:sob:

- - - - -
bd0ba0fb by Moritz Angermann at 2020-09-09T09:58:46+08:00
:sob: :sob:

- - - - -
e6bb81d6 by Moritz Angermann at 2020-09-09T09:58:46+08:00
:sob: Segfault no 3. This showed up in T4114

- - - - -
4006c352 by Moritz Angermann at 2020-09-09T09:58:46+08:00
Add mkComment to `Instruction`

- - - - -
e1103e8f by Moritz Angermann at 2020-09-09T09:58:47+08:00
Use mkComment for debugging

- - - - -
255a0213 by Moritz Angermann at 2020-09-09T09:58:47+08:00
Fix T4114 crashes

T4114 causes this codepath to show up.

- - - - -
c0f42276 by Moritz Angermann at 2020-09-09T09:58:47+08:00
Cleanup some compiler warnings

- - - - -


10 changed files:

- aclocal.m4
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/Expr.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/Cmm/Type.hs
- compiler/GHC/CmmToAsm.hs
- + compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- + compiler/GHC/CmmToAsm/AArch64/Cond.hs
- + compiler/GHC/CmmToAsm/AArch64/Instr.hs
- + compiler/GHC/CmmToAsm/AArch64/LLVM Test Results.md


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5827e725749091d5c5db57464a6264a618842ee8...c0f422766833fe2a4747a94897100e9c99ac0164

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5827e725749091d5c5db57464a6264a618842ee8...c0f422766833fe2a4747a94897100e9c99ac0164
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200908/777c0cfa/attachment-0001.html>


More information about the ghc-commits mailing list