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

Moritz Angermann gitlab at gitlab.haskell.org
Wed Sep 9 01:41:27 UTC 2020



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


Commits:
bf4920a8 by Moritz Angermann at 2020-09-09T09:40:44+08:00
Initial NCG

- - - - -
ece885c0 by Moritz Angermann at 2020-09-09T09:40:52+08:00
Address Takenobu's comments

- - - - -
5369111f by Moritz Angermann at 2020-09-09T09:40:52+08:00
Fix floating points handling of NaNs

- - - - -
796e2ec3 by Moritz Angermann at 2020-09-09T09:40:52+08:00
Add basic Graph Coloring support

- - - - -
07e804f5 by Moritz Angermann at 2020-09-09T09:40:52+08:00
Drop debug

- - - - -
41612e12 by Moritz Angermann at 2020-09-09T09:40:52+08:00
Add primops_match.cmm testsuite

- - - - -
b20e7822 by Moritz Angermann at 2020-09-09T09:40:53+08:00
Fix -NaN for real this time.

- - - - -
62158d6f by Moritz Angermann at 2020-09-09T09:40:53+08:00
Adds nan test.

- - - - -
95588cc1 by Moritz Angermann at 2020-09-09T09:40:53+08:00
no show

- - - - -
93976cd4 by Moritz Angermann at 2020-09-09T09:40:53+08:00
Some notes on PIC

- - - - -
92cb90de by Moritz Angermann at 2020-09-09T09:40:53+08:00
Properly load W32 with bit 31 set.

- - - - -
e38ca0f0 by Moritz Angermann at 2020-09-09T09:40:53+08:00
better relocation logging

- - - - -
97f4a843 by Moritz Angermann at 2020-09-09T09:40:54+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.

- - - - -
b2312a8a by Moritz Angermann at 2020-09-09T09:40:54+08:00
Revert "BigNum: rename BigNat types"

This reverts commit d3bd68978476487591fc60f7feb7cfb36b8fc3a3.

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

- - - - -
aa74ad98 by Moritz Angermann at 2020-09-09T09:40:54+08:00
Add AsmOpt Flags

- - - - -
98a00264 by Moritz Angermann at 2020-09-09T09:40:54+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.

- - - - -
e15c3e7e by Moritz Angermann at 2020-09-09T09:40:54+08:00
Drop dead 32bit logic.

- - - - -
c0ae0f38 by Moritz Angermann at 2020-09-09T09:40:55+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.

- - - - -
4103bd9c by Moritz Angermann at 2020-09-09T09:40:55+08:00
Drop duplicate show instance for CLabel now.

- - - - -
b9fcb281 by Moritz Angermann at 2020-09-09T09:40:55+08:00
Add link, lest I keep forgetting it.

- - - - -
d75dd0b4 by Moritz Angermann at 2020-09-09T09:40:55+08:00
inline comments with //

- - - - -
83d4a3b3 by Moritz Angermann at 2020-09-09T09:40:55+08:00
Some optimizations; not yet sure if safe or not.

- - - - -
6018234c by Moritz Angermann at 2020-09-09T09:40:55+08:00
Add latest opt changes.

- - - - -
54d091bb by Moritz Angermann at 2020-09-09T09:40:56+08:00
Address Takenobu Tani's comments.

Thanks!

- - - - -
6d083263 by Moritz Angermann at 2020-09-09T09:40:56+08:00
Fix gcd :blush:

- - - - -
c5bbf469 by Moritz Angermann at 2020-09-09T09:40:56+08:00
Overflow guard

- - - - -
c50e9e1e by Moritz Angermann at 2020-09-09T09:40:56+08:00
More annotations.

- - - - -
9d85b7b6 by Moritz Angermann at 2020-09-09T09:40:56+08:00
Revert "Overflow guard"

They are Integers not Ints.

This reverts commit 3ef94e593a2848cf2bdc4251f5be34536642675f.

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

- - - - -
473555a1 by Moritz Angermann at 2020-09-09T09:40:57+08:00
Add CmmAssign and CmmStore comments

- - - - -
b9fb33d3 by Moritz Angermann at 2020-09-09T09:40:57+08:00
Minor address mode changes

- - - - -
90e45257 by Moritz Angermann at 2020-09-09T09:40:57+08:00
More Amode optimizations

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

- - - - -
bf3fad93 by Moritz Angermann at 2020-09-09T09:40:57+08:00
Opt <<, >>

- - - - -
95e717aa by Moritz Angermann at 2020-09-09T09:40:57+08:00
Opt &&, ||

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

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

- - - - -
a09d9074 by Moritz Angermann at 2020-09-09T09:40:58+08:00
Opt: Adds CBZ, CBNZ

- - - - -
7ab6dae5 by Moritz Angermann at 2020-09-09T09:40:58+08:00
More generic CBZ, CBNZ

- - - - -
9a91fdf0 by Moritz Angermann at 2020-09-09T09:40:58+08:00
Fixup

- - - - -
999fd795 by Moritz Angermann at 2020-09-09T09:40:58+08:00
very rudimentary bitmask support.

- - - - -
425e9111 by Moritz Angermann at 2020-09-09T09:40:59+08:00
Add some more bitmasks

- - - - -
6c1d2f5f by Moritz Angermann at 2020-09-09T09:40:59+08:00
Opt STR

- - - - -
b996cfe2 by Moritz Angermann at 2020-09-09T09:40:59+08:00
Fixup

- - - - -
8b598d19 by Moritz Angermann at 2020-09-09T09:40:59+08:00
Fix MO_SF_Conv

- - - - -
a38438f7 by Moritz Angermann at 2020-09-09T09:40:59+08:00
Add Comment re MO_Memcpy

- - - - -
44a1c6f0 by Moritz Angermann at 2020-09-09T09:40:59+08:00
Always PIC via GOT

- - - - -
c8525dd7 by Moritz Angermann at 2020-09-09T09:41:00+08:00
Fix up generated assembly.

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

- - - - -
f0584689 by Moritz Angermann at 2020-09-09T09:41:00+08:00
Drop superfulous alignment generation.

- - - - -
ca93217e by Moritz Angermann at 2020-09-09T09:41:00+08:00
Hadrian :fire:

- - - - -
f55be89f by Moritz Angermann at 2020-09-09T09:41:00+08:00
Address Tekenobus comments.

Thanks!

- - - - -
df5b4cdc by Moritz Angermann at 2020-09-09T09:41:00+08:00
Adds J to distinguish jumps from B.

Maybe this would be better handled with a phantom type?

- - - - -
8957ed57 by Moritz Angermann at 2020-09-09T09:41:01+08:00
Make sp an Operand

- - - - -
b74bf740 by Moritz Angermann at 2020-09-09T09:41:01+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.

- - - - -
58f2287f by Moritz Angermann at 2020-09-09T09:41:01+08:00
[Spill/Reload] Spill Around :fire:

- - - - -
bb10aff6 by Moritz Angermann at 2020-09-09T09:41:01+08:00
Address Takenobus observations!

Thanks!

- - - - -
447ff793 by Moritz Angermann at 2020-09-09T09:41:01+08:00
:sob:

- - - - -
2e9fba1c by Moritz Angermann at 2020-09-09T09:41:01+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

- - - - -
49f92a85 by Moritz Angermann at 2020-09-09T09:41:02+08:00
Disable trivial deadlock detection

- - - - -
1ca3f3b6 by Moritz Angermann at 2020-09-09T09:41:02+08:00
Adds some annotations

- - - - -
fb89c361 by Moritz Angermann at 2020-09-09T09:41:02+08:00
Trying to get PIC right.

- - - - -
d2e026bb by Moritz Angermann at 2020-09-09T09:41:02+08:00
[aarch64] Fix spill/reload

- - - - -
9903d46e by Moritz Angermann at 2020-09-09T09:41:02+08:00
Try to get PIC right.

- - - - -
c801df2c by Moritz Angermann at 2020-09-09T09:41:03+08:00
Spill/Reload only need a smaller window

- - - - -
354208eb by Moritz Angermann at 2020-09-09T09:41:03+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.

- - - - -
14d49f1f by Moritz Angermann at 2020-09-09T09:41:03+08:00
B is b

- - - - -
10b5b59d by Moritz Angermann at 2020-09-09T09:41:03+08:00
Fix CCall

|Now mark used registers properly for the Register Allocator.

- - - - -
7f14441c by Moritz Angermann at 2020-09-09T09:41:03+08:00
:sob:

- - - - -
ee7eb6fd by Moritz Angermann at 2020-09-09T09:41:03+08:00
:sob: :sob:

- - - - -
11fef52e by Moritz Angermann at 2020-09-09T09:41:04+08:00
:sob: Segfault no 3. This showed up in T4114

- - - - -
759f0e0d by Moritz Angermann at 2020-09-09T09:41:04+08:00
Add mkComment to `Instruction`

- - - - -
2f356679 by Moritz Angermann at 2020-09-09T09:41:04+08:00
Use mkComment for debugging

- - - - -
f86eff0b by Moritz Angermann at 2020-09-09T09:41:04+08:00
Fix T4114 crashes

T4114 causes this codepath to show up.

- - - - -
5827e725 by Moritz Angermann at 2020-09-09T09:41:04+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/d088f7d1af476d5bdc7cc750ce91e8f48ba222d8...5827e725749091d5c5db57464a6264a618842ee8

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d088f7d1af476d5bdc7cc750ce91e8f48ba222d8...5827e725749091d5c5db57464a6264a618842ee8
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/f988ba2a/attachment-0001.html>


More information about the ghc-commits mailing list