ack.git
7 years agoProperly export symbols.
David Given [Sat, 29 Oct 2016 21:52:17 +0000 (23:52 +0200)]
Properly export symbols.

7 years agoGet top working with the PowerPC; use it to eliminate useless branches and
David Given [Sat, 29 Oct 2016 21:37:11 +0000 (23:37 +0200)]
Get top working with the PowerPC; use it to eliminate useless branches and
moves.

7 years agoMerge from default (merging in George Koehler's PowerPC changes).
David Given [Sat, 29 Oct 2016 20:40:40 +0000 (22:40 +0200)]
Merge from default (merging in George Koehler's PowerPC changes).

7 years agoAdd support for preserved registers.
David Given [Sat, 29 Oct 2016 18:22:44 +0000 (20:22 +0200)]
Add support for preserved registers.

7 years agoMore opcodes.
David Given [Sat, 29 Oct 2016 11:32:09 +0000 (13:32 +0200)]
More opcodes.

7 years agoMore opcodes.
David Given [Sat, 29 Oct 2016 10:55:34 +0000 (12:55 +0200)]
More opcodes.

7 years agoEmit negative constants correctly.
David Given [Sat, 29 Oct 2016 10:55:21 +0000 (12:55 +0200)]
Emit negative constants correctly.

7 years agoMore opcodes. sti can now cope with non-standard sizes (really need a better
David Given [Sat, 29 Oct 2016 10:48:05 +0000 (12:48 +0200)]
More opcodes. sti can now cope with non-standard sizes (really need a better
fix for this). Hack in crude support for mismatched stack pushes and pops (ints
vs longs).

7 years agoActually, the locals need to go above the spills and saved regs, so fp == lb.
David Given [Sat, 29 Oct 2016 10:00:33 +0000 (12:00 +0200)]
Actually, the locals need to go above the spills and saved regs, so fp == lb.

7 years agoLots more opcodes. Rearrange the stack layout so that fp->ab is a fixed value
David Given [Sat, 29 Oct 2016 09:57:56 +0000 (11:57 +0200)]
Lots more opcodes. Rearrange the stack layout so that fp->ab is a fixed value
(needed for CHAINFP and FPTOAB). Wire up lfrs to calls via a phi when
necessary, to allow call-bra-lfr chains.

7 years agoDon't generate phis if unnecessary (because this breaks the
David Given [Sat, 29 Oct 2016 08:55:48 +0000 (10:55 +0200)]
Don't generate phis if unnecessary (because this breaks the
critical-edge-splitting guarantee and causes insertion of phi copies to fail).

7 years agoMangle label names (turns out that the ACK assembler can't really cope with
David Given [Thu, 27 Oct 2016 21:17:16 +0000 (23:17 +0200)]
Mangle label names (turns out that the ACK assembler can't really cope with
labels that are the same name as instructions...).

7 years agoSwaps work (at least for registers). More opcodes. Rearrange the stack layout
David Given [Thu, 27 Oct 2016 19:50:58 +0000 (21:50 +0200)]
Swaps work (at least for registers). More opcodes. Rearrange the stack layout
so we can always trivially find fp, which lets CHAINFP work.

7 years agoAllow emission of strings containing ".
David Given [Thu, 27 Oct 2016 19:48:46 +0000 (21:48 +0200)]
Allow emission of strings containing ".

7 years agoFix bug where some phis weren't being inserted when a given variable definition
David Given [Thu, 27 Oct 2016 19:40:25 +0000 (21:40 +0200)]
Fix bug where some phis weren't being inserted when a given variable definition
needed more than one phi (due to the dominance frontier containing more than
one basic block).

7 years agoRemove the bytes1, bytes2, bytes4, bytes8 attributes; remove the concept of a
David Given [Tue, 25 Oct 2016 21:04:20 +0000 (23:04 +0200)]
Remove the bytes1, bytes2, bytes4, bytes8 attributes; remove the concept of a
register 'type'; now use int/float/long/double throughout to identify
registers. Lots of register allocator tweaks and table bugfixes --- we now get
through the dreading Mathlib.mod!

7 years agoPhi copies are now inserted as part of type inference. More opcodes.
David Given [Mon, 24 Oct 2016 20:14:08 +0000 (22:14 +0200)]
Phi copies are now inserted as part of type inference. More opcodes.

7 years agoMore opcodes.
David Given [Mon, 24 Oct 2016 18:15:22 +0000 (20:15 +0200)]
More opcodes.

7 years agoMore opcodes.
David Given [Mon, 24 Oct 2016 10:08:40 +0000 (12:08 +0200)]
More opcodes.

7 years agoMore opcodes, including the difficult and fairly stupid los/sts.
David Given [Sun, 23 Oct 2016 20:24:08 +0000 (22:24 +0200)]
More opcodes, including the difficult and fairly stupid los/sts.

7 years agoMassive change to how IR types are handled; we use the type code for matching
David Given [Sun, 23 Oct 2016 19:54:14 +0000 (21:54 +0200)]
Massive change to how IR types are handled; we use the type code for matching
rather than the size. Much cleaner and simpler.

7 years agoRe-re-add the type inference layer, now I know more about how things work.
David Given [Sat, 22 Oct 2016 21:04:13 +0000 (23:04 +0200)]
Re-re-add the type inference layer, now I know more about how things work.
Remove that terrible float promotion code.

7 years agoMore opcodes.
David Given [Sat, 22 Oct 2016 18:32:51 +0000 (20:32 +0200)]
More opcodes.

7 years agoRemove GETRET; values are now returned directly by CALL. Fix a bug in
David Given [Sat, 22 Oct 2016 10:13:57 +0000 (12:13 +0200)]
Remove GETRET; values are now returned directly by CALL. Fix a bug in
convertstackops which was resulting in duplicate IR groups.

7 years agoMore opcodes.
David Given [Sat, 22 Oct 2016 09:26:28 +0000 (11:26 +0200)]
More opcodes.

7 years agoHacky workaround the way the Modula-2 compiler generates non-standard sized
David Given [Sat, 22 Oct 2016 08:48:22 +0000 (10:48 +0200)]
Hacky workaround the way the Modula-2 compiler generates non-standard sized
loads and saves. More opcodes; simplified table using macros.

7 years agoTypo fix.
David Given [Fri, 21 Oct 2016 22:48:55 +0000 (00:48 +0200)]
Typo fix.

7 years agoBetter (and more correct) floating point conversions; fif; various new opcodes.
David Given [Fri, 21 Oct 2016 22:48:26 +0000 (00:48 +0200)]
Better (and more correct) floating point conversions; fif; various new opcodes.

7 years agofef4 and fef8 is now cleaner, albeit slower; add some more register alias
David Given [Fri, 21 Oct 2016 22:02:15 +0000 (00:02 +0200)]
fef4 and fef8 is now cleaner, albeit slower; add some more register alias
stuff.

7 years agoAdd (pretty crummy) support for register aliases and static pairs of registers.
David Given [Fri, 21 Oct 2016 21:31:00 +0000 (23:31 +0200)]
Add (pretty crummy) support for register aliases and static pairs of registers.
We should have enough functionality now for rather buggy 8-bit ints and
doubles. Rework the table and the platform.c to match.

7 years agoAdd parsing support for register aliases.
David Given [Thu, 20 Oct 2016 19:47:28 +0000 (21:47 +0200)]
Add parsing support for register aliases.

7 years agoLots more opcodes; better eviction behaviour; better register moves. Lots more
David Given [Wed, 19 Oct 2016 21:29:05 +0000 (23:29 +0200)]
Lots more opcodes; better eviction behaviour; better register moves. Lots more
PowerPC stuff (some working).

7 years agoFloating point promotion is less buggy.
David Given [Wed, 19 Oct 2016 21:27:53 +0000 (23:27 +0200)]
Floating point promotion is less buggy.

7 years agoMerge pull request #6 from kernigh/pr-linuxppc
David Given [Wed, 19 Oct 2016 18:39:10 +0000 (20:39 +0200)]
Merge pull request #6 from kernigh/pr-linuxppc

PowerPC fixes

7 years agoRemove f14 to f31 from FREG and FSREG.
George Koehler [Wed, 19 Oct 2016 01:16:47 +0000 (21:16 -0400)]
Remove f14 to f31 from FREG and FSREG.

This would have happened later, if f14 to f31 became regvar (like r13
to r31 are now).  I am doing it now because ncg is too slow for rules
"with FREG FREG uses FREG".  We use such rules for adf 8 and other EM
instructions that operate on 2 floats.  Like my last commit cfbc537,
this commit speeds ncg by removing choices for register allocation.

7 years agoPromote values accessed via NOP.
David Given [Tue, 18 Oct 2016 21:58:03 +0000 (23:58 +0200)]
Promote values accessed via NOP.

7 years ago'!' tracing is now always emitted; tracing goes to stderr.
David Given [Tue, 18 Oct 2016 20:32:09 +0000 (22:32 +0200)]
'!' tracing is now always emitted; tracing goes to stderr.

7 years agoAdd support for floating point constants.
David Given [Tue, 18 Oct 2016 20:29:42 +0000 (22:29 +0200)]
Add support for floating point constants.

7 years agoIn powerpc ncg, add a speed hack for sti 8.
George Koehler [Tue, 18 Oct 2016 00:31:59 +0000 (20:31 -0400)]
In powerpc ncg, add a speed hack for sti 8.

ncg is too slow with this many registers.  A stack pattern "with GPR
GPR GPR" or "with REG REG REG" takes too long to pick registers,
causing ncg 8 to take about 2 seconds on each sti 8.  I introduce
REG_PAIR and there are only 4 such pairs.

For programs that use sti 8 (including C programs that copy 8-byte
structs), this speed hack improves the ncg run from several seconds to
almost instantaneous.

Also add a few COMMENT(...) lines in stacking rules.

7 years agoLots more opcodes.
David Given [Mon, 17 Oct 2016 22:31:26 +0000 (00:31 +0200)]
Lots more opcodes.

7 years agoAdd li and mr pseudoinstructions.
David Given [Mon, 17 Oct 2016 22:21:32 +0000 (00:21 +0200)]
Add li and mr pseudoinstructions.

7 years agoAdd costs to powerpc instructions.
George Koehler [Mon, 17 Oct 2016 18:57:21 +0000 (14:57 -0400)]
Add costs to powerpc instructions.

Also show how andi., andis., or., set condition codes.

7 years agoRewrite .fif8 to avoid powerpc64 fctid
George Koehler [Mon, 17 Oct 2016 04:39:59 +0000 (00:39 -0400)]
Rewrite .fif8 to avoid powerpc64 fctid

This fixes the SIGILL (illegal instruction) in startrek when firing
phasers.  The 32-bit processors in my PowerPC Mac and in QEMU don't
have fctid, a 64-bit instruction.

I got the idea from mach/proto/fp/fif8.c to extract the exponent,
clear some bits to get an integer, then subtract the integer from
the original value to get the fraction.

7 years agoAdd "kills MEMORY" to powerpc sti rules.
George Koehler [Sun, 16 Oct 2016 22:13:39 +0000 (18:13 -0400)]
Add "kills MEMORY" to powerpc sti rules.

Adjust some of the loi rules (and associated moves) so we can identify
the tokens that must be in MEMORY.

With this commit, I can navigate the Enterprise even if I comment out
my work-around from e22c888.

7 years agoBolt mcg into the PowerPC backend. It doesn't build yet, but it is generating
David Given [Sun, 16 Oct 2016 22:06:06 +0000 (00:06 +0200)]
Bolt mcg into the PowerPC backend. It doesn't build yet, but it is generating
*some* code.

7 years agoMerge in the unfinished PowerPC branch.
David Given [Sun, 16 Oct 2016 20:38:27 +0000 (22:38 +0200)]
Merge in the unfinished PowerPC branch.

7 years agoImplement saving of dirty registers onto the stack.
David Given [Sun, 16 Oct 2016 20:37:42 +0000 (22:37 +0200)]
Implement saving of dirty registers onto the stack.

7 years agoRemove IND_LABEL_W and IND_LABEL_D
George Koehler [Sun, 16 Oct 2016 20:33:24 +0000 (16:33 -0400)]
Remove IND_LABEL_W and IND_LABEL_D

Because li32 always loads a label into a GPR, it is sufficient to
coerce LABEL to REG, then use IND_RC_W or IND_RC_D for indirection
through the label.

7 years agoSimplify moves to and from IND_RC_*
George Koehler [Sun, 16 Oct 2016 20:02:25 +0000 (16:02 -0400)]
Simplify moves to and from IND_RC_*

Now that SUM_RC always has a signed 16-bit constant, it happens that
the various IND_RC_* tokens also have a signed 16-bit constant, so
we no longer need to touch the scratch register.

7 years agoRefactor how powerpc ncg pushes constants.
George Koehler [Sun, 16 Oct 2016 17:58:54 +0000 (13:58 -0400)]
Refactor how powerpc ncg pushes constants.

When loc (load constant) pushes a constant, it now checks the value of
the constant and pushes any of 7 tokens.  These tokens allow stack
patterns to recognize 16-bit signed integers (CONST2), 16-bit unsigned
integers (UCONST2), multiples of 0x10000 (CONST_HZ), and other
interesting forms of constants.

Use the new constant tokens in the rules for adi, sbi, and, ior, xor.
Adjust a few other rules to understand the new tokens.

Require that SUM_RC has a signed 16-bit constant, and OR_RC and XOR_RC
each have an unsigned 16-bit constant.  The moves from SUM_RC, OR_RC,
XOR_RC to GPR no longer touch the scratch register, because the
constant is not too big.

7 years agoAdd missing header that was causing builds to fail on Travis.
David Given [Sun, 16 Oct 2016 15:58:01 +0000 (17:58 +0200)]
Add missing header that was causing builds to fail on Travis.

7 years agoRemove unused parts of mach/powerpc/ncg/table
George Koehler [Sun, 16 Oct 2016 00:00:48 +0000 (20:00 -0400)]
Remove unused parts of mach/powerpc/ncg/table

Remove unused tokens GPRINDIRECTLO, HILABEL, LOLABEL, LABELI.  Also
remove an #if 0 ... #endif group of patterns.

7 years agoMerge from trunk.
David Given [Sat, 15 Oct 2016 22:06:14 +0000 (00:06 +0200)]
Merge from trunk.

7 years agoVarious bits of cleanup; we should almost be ready to try sending this to the
David Given [Sat, 15 Oct 2016 21:39:38 +0000 (23:39 +0200)]
Various bits of cleanup; we should almost be ready to try sending this to the
assembler soon...

7 years agoOops, forgot to add the output option spec to the string!
David Given [Sat, 15 Oct 2016 21:34:54 +0000 (23:34 +0200)]
Oops, forgot to add the output option spec to the string!

7 years agoReferences to the stack frame are now rendered properly.
David Given [Sat, 15 Oct 2016 21:33:30 +0000 (23:33 +0200)]
References to the stack frame are now rendered properly.

7 years agoStop passing proc around, and use a global instead --- much cleaner.
David Given [Sat, 15 Oct 2016 21:19:44 +0000 (23:19 +0200)]
Stop passing proc around, and use a global instead --- much cleaner.

7 years agoRegister spilling to the stack frame works, more or less.
David Given [Sat, 15 Oct 2016 20:53:56 +0000 (22:53 +0200)]
Register spilling to the stack frame works, more or less.

7 years agoFix yet another bug to do with IR register outputs.
David Given [Sat, 15 Oct 2016 17:14:25 +0000 (19:14 +0200)]
Fix yet another bug to do with IR register outputs.

7 years agoFunction termination gets routed through an exit block; we now have prologues
David Given [Sat, 15 Oct 2016 16:38:46 +0000 (18:38 +0200)]
Function termination gets routed through an exit block; we now have prologues
and epilogues. mcgg now exports some useful data as headers. Start factoring
out some of the architecture-specific bits into an architecture-specific file.

7 years agoAdd a pile of new instructions used by Pascal; I'm going to need to think about
David Given [Sat, 15 Oct 2016 11:07:59 +0000 (13:07 +0200)]
Add a pile of new instructions used by Pascal; I'm going to need to think about
how locals and the local base are handled.

7 years agoBytes were sometimes failing to be sign extended correctly.
David Given [Sat, 15 Oct 2016 10:11:40 +0000 (12:11 +0200)]
Bytes were sometimes failing to be sign extended correctly.

7 years agoAllow asm names for registers which are different from the friendly names shown
David Given [Sat, 15 Oct 2016 09:42:47 +0000 (11:42 +0200)]
Allow asm names for registers which are different from the friendly names shown
in the tracing (because PowerPC register names are just numbers).

7 years agoSome more opcodes.
David Given [Sat, 15 Oct 2016 09:22:40 +0000 (11:22 +0200)]
Some more opcodes.

7 years agoIn powerpc table, fix macros los() and his().
George Koehler [Sat, 15 Oct 2016 03:59:26 +0000 (23:59 -0400)]
In powerpc table, fix macros los() and his().

Change the operator in his() from a - minus to a + plus.  When los(n)
becomes negative, then his(n) needs to add 0x10000, not subtract it.

Also change los(n) to do the sign extension, because smalls(los(n))
should be true, not false.

Also change hi(n) and lo(n) to wrap n in parentheses, as (n), because
these are macros and n might still contain operators.

7 years agoYou can now mark a register as corrupting a certain register class; calls work,
David Given [Fri, 14 Oct 2016 23:15:08 +0000 (01:15 +0200)]
You can now mark a register as corrupting a certain register class; calls work,
or at least look like they work. The bad news is that the register allocator
has a rare talent for putting things in the wrong register.

7 years agoLog empty hops.
David Given [Fri, 14 Oct 2016 21:19:25 +0000 (23:19 +0200)]
Log empty hops.

7 years agoReworked loads and stores; it's now *different*, maybe not better.
David Given [Fri, 14 Oct 2016 21:19:02 +0000 (23:19 +0200)]
Reworked loads and stores; it's now *different*, maybe not better.

7 years agoFactor out the register allocation routines to make them easier to deal with.
David Given [Fri, 14 Oct 2016 21:17:06 +0000 (23:17 +0200)]
Factor out the register allocation routines to make them easier to deal with.

7 years agoFix stupid issue where hop output registers were being overwritten, leading to
David Given [Fri, 14 Oct 2016 21:12:29 +0000 (23:12 +0200)]
Fix stupid issue where hop output registers were being overwritten, leading to
invalid SSA form.

7 years agoOutput register equality constraints work.
David Given [Fri, 14 Oct 2016 20:17:02 +0000 (22:17 +0200)]
Output register equality constraints work.

7 years agoMake loads and stores in the table nicer; fix a place where it looked like it
David Given [Wed, 12 Oct 2016 21:12:53 +0000 (23:12 +0200)]
Make loads and stores in the table nicer; fix a place where it looked like it
was working but only accidentally.

7 years agoKeep track of register types as well as attributes --- the type being how we
David Given [Wed, 12 Oct 2016 20:58:46 +0000 (22:58 +0200)]
Keep track of register types as well as attributes --- the type being how we
find new registers when evicting values. Input constraints work (they were
being ignored before). Various bug fixing so they actually work.

7 years agoAdd code to remove unused phis, converting to pruned SSA form, to avoid
David Given [Wed, 12 Oct 2016 19:50:12 +0000 (21:50 +0200)]
Add code to remove unused phis, converting to pruned SSA form, to avoid
confusing the register allocator later.

7 years agoDon't allow the same IR to be added to the sequence list more than once
David Given [Tue, 11 Oct 2016 22:45:36 +0000 (00:45 +0200)]
Don't allow the same IR to be added to the sequence list more than once
(sometimes happens because op_dup, but makes no sense).

7 years agoClean up the allocator a bit, in preparation for making it lots more
David Given [Tue, 11 Oct 2016 21:17:30 +0000 (23:17 +0200)]
Clean up the allocator a bit, in preparation for making it lots more
complicated; no semantic changes.

7 years agoA few more opcodes.
David Given [Mon, 10 Oct 2016 22:29:18 +0000 (00:29 +0200)]
A few more opcodes.

7 years agoA little fiddling with store instructions. The PowerPC is not friendly to
David Given [Mon, 10 Oct 2016 22:23:35 +0000 (00:23 +0200)]
A little fiddling with store instructions. The PowerPC is not friendly to
iburg.

7 years agoRefactored the way hops are rendered; add support for emitting code (although
David Given [Mon, 10 Oct 2016 22:12:11 +0000 (00:12 +0200)]
Refactored the way hops are rendered; add support for emitting code (although
with no prologue or epilogue yet).

7 years agoRegister allocator now gets all the way through all of my test file without
David Given [Mon, 10 Oct 2016 21:19:46 +0000 (23:19 +0200)]
Register allocator now gets all the way through all of my test file without
crashing (albeit with register moves and swaps stubbed out). Correct code? Who
knows.

7 years agoD'oh, need multiple passes over the edge splitter in order to properly find all
David Given [Mon, 10 Oct 2016 21:18:37 +0000 (23:18 +0200)]
D'oh, need multiple passes over the edge splitter in order to properly find all
cases.

7 years agoCalculate phi congruency groups; use them to solve the
David Given [Sun, 9 Oct 2016 20:04:20 +0000 (22:04 +0200)]
Calculate phi congruency groups; use them to solve the
importing-hreg-from-the-future problem (probably poorly).

7 years agoAdd pmap_remove().
David Given [Sun, 9 Oct 2016 20:03:44 +0000 (22:03 +0200)]
Add pmap_remove().

7 years agoThe register allocator now makes a spirited attempt to honour register
David Given [Sun, 9 Oct 2016 13:09:34 +0000 (15:09 +0200)]
The register allocator now makes a spirited attempt to honour register
attributes when allocating. Unfortunately, backward edges don't work (because
the limited def-use chain stuff doesn't work across basic blocks). Needs more
thought.

7 years agoFloating point promotion was broken since the IR float change. Fix.
David Given [Sun, 9 Oct 2016 13:08:03 +0000 (15:08 +0200)]
Floating point promotion was broken since the IR float change. Fix.

7 years agoAdd some more opcodes; rearrange the registers to be more PowerPC-friendly.
David Given [Sun, 9 Oct 2016 12:45:13 +0000 (14:45 +0200)]
Add some more opcodes; rearrange the registers to be more PowerPC-friendly.

7 years agoPredicates can now take numeric arguments. The PowerPC predicates have been
David Given [Sun, 9 Oct 2016 10:32:36 +0000 (12:32 +0200)]
Predicates can now take numeric arguments. The PowerPC predicates have been
turned into generic ones (as they'll be useful everywhere). Node arguments for
predicates require the '%' prefix for consistency. Hex numbers are permitted.

7 years agoBasic register allocation works!
David Given [Sat, 8 Oct 2016 21:32:54 +0000 (23:32 +0200)]
Basic register allocation works!

7 years agoReplace pmap_get() with pmap_findleft() and pmap_findright(), to allow lookups
David Given [Sat, 8 Oct 2016 21:32:13 +0000 (23:32 +0200)]
Replace pmap_get() with pmap_findleft() and pmap_findright(), to allow lookups
in both directions.

7 years agoOnly allocate an output vreg if the instruction actually wants one.
David Given [Sat, 8 Oct 2016 10:15:21 +0000 (12:15 +0200)]
Only allocate an output vreg if the instruction actually wants one.

7 years agoInstruction predicates work now.
David Given [Sat, 8 Oct 2016 09:35:33 +0000 (11:35 +0200)]
Instruction predicates work now.

7 years agoMinor cleanup.
David Given [Sat, 8 Oct 2016 09:07:28 +0000 (11:07 +0200)]
Minor cleanup.

7 years agoFix bug where pushes were being placed in the wrong blocks.
David Given [Sat, 8 Oct 2016 08:21:24 +0000 (10:21 +0200)]
Fix bug where pushes were being placed in the wrong blocks.

7 years agoRemove stackadjust and stackoffset() from ncg.
George Koehler [Sat, 8 Oct 2016 00:52:13 +0000 (20:52 -0400)]
Remove stackadjust and stackoffset() from ncg.

This feature has never been used since its introduction, more than 3
years ago, in David Given's commit c93cb69 of May 8, 2013.  The commit
was for "PowerPC and M68K work".  I am not undoing the entire commit.
I am only removing the stackadjust and stackoffset() feature.

This commit removes the feature from my branch kernigh-linuxppc.  This
removal includes the mach/proto/ncg parts.  The default branch already
removed most of the feature, but kept the mach/proto/ncg parts.  That
removal happened in commit 81778b6 of May 13, 2013 (which was a merge;
git diff af0dede 81778b6).  The branch dtrg-experimental-powerpc
merged the default branch but without the removal.  That merge was
commit 4703db0f of Sep 15, 2016 (git diff 8c94b13 4703db0).  My branch
kernigh-linuxppc is off branch dtrg-experimental-powerpc, so I can no
longer get the removal by merging default.

David Given described the stackadjust feature in
  https://sourceforge.net/p/tack/mailman/message/30814691/

The instruction stackadjust would add a value to the offset, and the
function stackoffset() would return this offset.  One would use this
to track sp - fp, then omit the frame pointer by not keeping fp in a
register.

7 years agoOverhaul of everything phi related; critical edge splitting now happens before
David Given [Fri, 7 Oct 2016 22:21:23 +0000 (00:21 +0200)]
Overhaul of everything phi related; critical edge splitting now happens before
anything SSA happens; liveness calculations now look like they might be
working.

7 years agoAdd array_{appendall,removeall,appendallu}.
David Given [Fri, 7 Oct 2016 22:20:26 +0000 (00:20 +0200)]
Add array_{appendall,removeall,appendallu}.

7 years agoRemove most of GPRE from mach/powerpc/ncg/table
George Koehler [Fri, 7 Oct 2016 02:59:27 +0000 (22:59 -0400)]
Remove most of GPRE from mach/powerpc/ncg/table

We only need GPRE in a few places where we write {GPRE, regvar(...)}
because ncgg can't parse plain regvar(...).  In all other places, a
plain GPR works.

Also remove gpr_gpr_gpr and a few other unused and fake instructions
from the list of instructions.

7 years agoRename SCRATCH to RSCRATCH. Never stack RSCRATCH nor FSCRATCH.
George Koehler [Fri, 7 Oct 2016 00:47:42 +0000 (20:47 -0400)]
Rename SCRATCH to RSCRATCH.  Never stack RSCRATCH nor FSCRATCH.

Rename the scratch gpr (currently r11) from SCRATCH to RSCRATCH so I
can search for RSCRATCH without finding FSCRATCH.  I also want to
avoid confusion with the SCRATCH keyword of the old code generator (cg
which came before ncg).

Change the stacking rules to prevent stacking of RSCRATCH or FSCRATCH
or any other GPR or FPR that isn't an allocatable REG or FREG.  Then
ncgg rejects any rule that tries to stack a GPR or FPR, so change such
rules to stack a REG or FREG.

7 years agoRefactor the cfg and dominance stuff to make it a lot nicer.
David Given [Thu, 6 Oct 2016 19:34:21 +0000 (21:34 +0200)]
Refactor the cfg and dominance stuff to make it a lot nicer.

7 years agoWe're not using 'allocates' any more; clean up.
David Given [Thu, 6 Oct 2016 19:33:43 +0000 (21:33 +0200)]
We're not using 'allocates' any more; clean up.