Commit graph

78 commits

Author SHA1 Message Date
Quentin Carbonneaux
1f7acbd88f specialize vdup into idup 2015-10-06 13:22:46 -04:00
Quentin Carbonneaux
ce72ad0ecd factor ins array edition in icpy 2015-10-06 13:17:20 -04:00
Quentin Carbonneaux
a83174f447 factor vector duplication in vdup() 2015-10-05 21:38:55 -04:00
Quentin Carbonneaux
e30fab31e1 factor some utility functions/data in util.c 2015-10-05 17:24:19 -04:00
Quentin Carbonneaux
a18e0ef50f clean the command line interface 2015-10-05 15:57:04 -04:00
Quentin Carbonneaux
ecaad8119f fix a bug for structure arguments in regs 2015-10-01 13:20:21 -04:00
Quentin Carbonneaux
2d5c07fa4e remove dead assignment 2015-09-30 11:48:50 -04:00
Quentin Carbonneaux
790f852b96 fix two invalid Tmp.spill values 2015-09-30 10:34:52 -04:00
Quentin Carbonneaux
e2174da2f1 wip on new stack slots (emit, spill) 2015-09-29 22:25:49 -04:00
Quentin Carbonneaux
ae158a5c40 more fixes for the new slot representation 2015-09-29 17:40:47 -04:00
Quentin Carbonneaux
5e5d0a1e99 wip on a simpler slot handling 2015-09-29 17:25:04 -04:00
Quentin Carbonneaux
2d5302df71 small simplification in seljmp 2015-09-22 20:47:02 -04:00
Quentin Carbonneaux
bbbc8994f9 compile retw and retl as a move in rax 2015-09-22 17:24:26 -04:00
Quentin Carbonneaux
9fcad221d0 save callee-save registers 2015-09-20 17:47:23 -04:00
Quentin Carbonneaux
fff669e54a this fixme was really more a todo 2015-09-17 21:24:46 -04:00
Quentin Carbonneaux
4d7c42d4fb fix buggy handling of stack arguments in selpar() 2015-09-17 21:12:42 -04:00
Quentin Carbonneaux
7540024f78 fix two bugs in selpar()
- One missing argument for OAlloc.
- One reference shuffling.
2015-09-17 19:56:58 -04:00
Quentin Carbonneaux
4a2c4d63f9 fix memcpy bug 2015-09-17 19:50:26 -04:00
Quentin Carbonneaux
c298820211 start work on fuction parameters 2015-09-17 19:29:49 -04:00
Quentin Carbonneaux
f7bfa2e435 heavy modification of call handling
The IR generated by calls was very bulky because two
instructions were used for marking the live range of
a clobber.

This patch attempts to store the information of what
registers are use/def/clobber in the call instruction
itself, this leads to more compact code (even more
when we'll have SSE registers).  However, I find that
the amount of extra code needed is not really
easonable.  Fortunately it is not too invasive, thus
if the complexity creeps in, it should be easy to
revert.
2015-09-15 23:01:33 -04:00
Quentin Carbonneaux
bad74e6dce emit stack fixup only when necessary 2015-09-15 23:01:33 -04:00
Quentin Carbonneaux
73b7d9b199 reshuffle instructions around call 2015-09-15 23:01:33 -04:00
Quentin Carbonneaux
f8d922b27c hack to enable proper regalloc on calls
I add the dual to dummy uses: dummy defs.  They
are compiled to nothing, but help preserving the
invariants I had when writing the register
allocator.

Clearly, there should be a better way.
2015-09-15 23:01:33 -04:00
Quentin Carbonneaux
b5a009347e fix alignment for structs on the stack 2015-09-15 23:01:33 -04:00
Quentin Carbonneaux
9bb69bf4c7 diagnose float structs 2015-09-15 23:01:33 -04:00
Quentin Carbonneaux
ece185f067 implement aggregate passing in regs 2015-09-15 23:01:33 -04:00
Quentin Carbonneaux
8201c6161e start function call lowering (wip) 2015-09-15 23:01:33 -04:00
Quentin Carbonneaux
87ab8941ed start work on aggregate types
The parser now has some code to parse the description
of structured types.

I tried to be even less specific than LLVM "type" by
creating just enough abstraction so that I can deal
with both AARCH64 and x64.  The base types used in the
definition of an aggregate are really just syntactic sugar
to give a structure a size and an alignment.  Only the
location of float components matters for the compilation.
In particular this means that the front-ends have to know
how the ABI works to pass/return small integer types.
This also means that the font-end has to be aware of the
layout of structures.

Chris Lattner has a proposition [1] for LLVM that is still
pending and goes in the direction of giving more control
of the ABI the front-end.

[1]: http://www.nondot.org/sabre/LLVMNotes/ExtendedIntegerResults.txt
2015-09-15 23:01:32 -04:00
Quentin Carbonneaux
f6349f4b6e get rid of OTrunc 2015-09-15 23:01:32 -04:00
Quentin Carbonneaux
0f0290c1db the wide bit of OAddr matters! 2015-09-15 23:01:32 -04:00
Quentin Carbonneaux
28110b1439 add a size to all operations (wip) 2015-09-15 23:01:32 -04:00
Quentin Carbonneaux
328cdc448c alloc16 comes for free, iiuc the abi 2015-09-15 23:01:32 -04:00
Quentin Carbonneaux
2c6f6b4b2d add truncation operation
It would be nicer to have some kind of subtyping where a
l variable can be used in place of a w variable but it is
more complications than a truncation insutruction.

In some cases, it might be less efficient than the above
solution by requiring two registers instead of one.
(I.e when both the truncated variable and the long variable
live together.)

We have to see what are the usage patterns.
2015-09-15 23:01:32 -04:00
Quentin Carbonneaux
9575c46feb the abi is unclear, practice suggests that change 2015-09-15 23:01:32 -04:00
Quentin Carbonneaux
95bcc46e15 OXTestw should not have 64bits arguments 2015-09-15 23:01:32 -04:00
Quentin Carbonneaux
e361a51248 new NAlign constant and fix frame size computation 2015-09-15 23:01:32 -04:00
Quentin Carbonneaux
6f09869ea1 move spill and emit to the new slot system
In emit, I worked a little to make sure that framesz works
when we change the size of the svec array (if we need more
alignments).
2015-09-15 23:01:32 -04:00
Quentin Carbonneaux
40d0582ee0 add sign/zero extension operations 2015-09-15 23:01:31 -04:00
Quentin Carbonneaux
7bbd361083 add the mul instruction 2015-09-15 23:01:31 -04:00
Quentin Carbonneaux
e1725c0cdd make sure tests emitted are encodable 2015-09-15 23:01:31 -04:00
Quentin Carbonneaux
ca8c320dec replace RMem refs with an OAddr opertation 2015-09-15 23:01:31 -04:00
Quentin Carbonneaux
16fe5c1366 compile branches on and using test 2015-09-15 23:01:31 -04:00
Quentin Carbonneaux
bccfc34ca3 make sure eflags-writing do not disappear
This is a hack implementation, ideally I would like
something cleaner.  The problem is that regalloc thinks
an instruction is dead code because it's not aware that
it writes to eflags.
2015-09-15 23:01:31 -04:00
Quentin Carbonneaux
670604e91f handle OAnd in isel 2015-09-15 23:01:31 -04:00
Quentin Carbonneaux
ae5fe31482 change strategy for phi nodes 2015-09-15 23:01:31 -04:00
Quentin Carbonneaux
67d3c2834d tentative support for fast allocs
It seems that the MEM reference type is
meaningless in too many positions.
Because of this, it is unclear if we
should keep it or just introduce a
OAddr instruction that only accepts
slots.

Regardless of the above, the spilling
module needs to use the new slot_()
function, also, the emit function needs
to fetch the size of the stack frame
from the slot[] array.

The naming is still very transitional,
here is a list of all bogus names I can
think of:

  - SLOT()
  - Tmp.spill
  - slot_
2015-09-15 23:01:31 -04:00
Quentin Carbonneaux
5fc8104e00 major lifting: get rid of RReg
I've been septic since I introduced it, this commit
proves that it costs more than it helps.  I've also fixed
a bad bug in rega() where I alloc'ed the wrong size for
internal arrays.  Enums now have names so I can use them
to cast in gdb to get the name corresponding to a constant.
2015-09-15 23:01:31 -04:00
Quentin Carbonneaux
78bf28f56e add basic support for stack allocation 2015-09-15 23:01:31 -04:00
Quentin Carbonneaux
8020748fbf fix typos in selcmp and comment 2015-09-15 23:01:31 -04:00
Quentin Carbonneaux
b6e9041a67 comment about immutables 2015-09-15 23:01:31 -04:00