Jonas Maebe
e9268a0a14
* synchronised with trunk up till r26975
...
git-svn-id: branches/hlcgllvm@26976 -
2014-03-06 21:36:58 +00:00
sergei
2c02e8a726
- i386, x86_64, SPARC: removed paramanager.getintparaloc overrides, it is handled by generic implementation since r24716.
...
(This probably can be removed for all targets, but I don't want to do it without prior testing).
git-svn-id: trunk@26870 -
2014-02-24 16:01:14 +00:00
sergei
da910d654c
+ SPARC: two more peephole optimizations
...
git-svn-id: trunk@26795 -
2014-02-16 12:29:31 +00:00
sergei
534ecbda9f
* SPARC: r26561 caused a_op_const_reg_reg used for zero-extending 8-bit values to be optimized away. Fixed by replacing it with an explicit instruction.
...
git-svn-id: trunk@26566 -
2014-01-22 21:37:37 +00:00
nickysn
85dd9e5789
+ added a size parameter to optimize_op_const and do a sign extension of the 'a' parameter up from the specified size, so that things like (i and $ffffffff) get optimized away the same way as (i and -1)
...
git-svn-id: trunk@26561 -
2014-01-22 15:00:34 +00:00
sergei
ab44638635
+ SPARC: initial peephole optimizer.
...
git-svn-id: trunk@26555 -
2014-01-21 14:22:59 +00:00
sergei
cda81e1d18
* SPARC: emit "x shl 1" as "x+x", it yields shorter code.
...
git-svn-id: trunk@26553 -
2014-01-21 13:50:35 +00:00
pierre
5e6669890a
Handle asmextraopt in powerpc, mips and sparc assemblers
...
git-svn-id: trunk@26542 -
2014-01-21 00:19:17 +00:00
sergei
c673c32ad9
+ SPARC: generate position-independent case jump tables, as specified by ABI.
...
Generate them also for non-PIC mode: absolute code is just 2 instructions shorter, trying to save them is probably not worth the effort.
git-svn-id: trunk@26468 -
2014-01-15 15:31:53 +00:00
sergei
720b9bf560
* SPARC: reworked 64-bit comparisons so their result is always in flags. Comparisons are emitted as subtractions, sides are optionally swapped to avoid using Z flag (since it is not set correctly in multi-word subtraction). This generates significantly shorter code: when both sides are in registers it is just 3 instructions for equal/unequal and 2 instructions otherwise.
...
git-svn-id: trunk@26433 -
2014-01-12 15:11:47 +00:00
sergei
d2a9308181
+ SPARC: implemented register spill replacement.
...
git-svn-id: trunk@26364 -
2014-01-03 08:14:43 +00:00
sergei
0afd95e840
* SPARC, tmoddivnode improvements/fixes:
...
* don't bother reusing locations
* don't optimize division into shift if overflow checking is enabled
* if denominator is a constant and fits into 13 bit range, use it directly and save a register.
git-svn-id: trunk@26363 -
2014-01-03 08:09:32 +00:00
sergei
36d0c8a5a7
* x86 and SPARC: fixed handling 64-bit (qwordbool) values in tcgnotnode (partial fix for Mantis #25255 ).
...
* Moved handling LOC_JUMP locations to helper method of base class, it appears to be the same for all targets.
git-svn-id: trunk@26353 -
2014-01-02 10:29:44 +00:00
sergei
471d0a5164
+ SPARC: support optimized 32x32 to 64 bit multiplications.
...
git-svn-id: trunk@26331 -
2013-12-30 23:40:47 +00:00
sergei
4168388235
+ SPARC: support 8 and 16-bit arithmetic shifts.
...
git-svn-id: trunk@26330 -
2013-12-30 23:37:21 +00:00
sergei
63c1a05718
* SPARC: Removed hacks with g1_used that were used for g_intf_wrapper to be operational without initialized reg.allocator, and replaced them with a proper solution (which is basically a clone from MIPS cg).
...
git-svn-id: trunk@26321 -
2013-12-30 13:08:51 +00:00
sergei
05489d6e05
* SPARC: fixed g_intf_wrapper for non-virtual methods once again, my initial assumption was not correct: a wrapper does not necessarily reference methods from the class that implements the interface, it may be methods from parent classes, which can be located arbitrarily far away in address space.
...
Now using code from g_external_wrapper, which has no distance limit and is only one instruction longer.
git-svn-id: trunk@26319 -
2013-12-30 11:51:57 +00:00
sergei
bf94257310
* SPARC: simplified and fixed a_load_const_reg method, was generating redundant instructions for constants with non-zero bits 10..12.
...
git-svn-id: trunk@26318 -
2013-12-30 09:59:41 +00:00
sergei
34cde7a07a
* SPARC, tsparcaddnode.second_cmp64bit: don't copy LOC_CREGISTER locations, and handle comparison with constants without loading them into register (if possible).
...
git-svn-id: trunk@26309 -
2013-12-29 10:12:19 +00:00
sergei
f8a60522d4
- SPARC: removed 3 code generator methods, they provide no difference in generated code from generic code generator.
...
git-svn-id: trunk@26307 -
2013-12-29 10:00:09 +00:00
sergei
d70a880f33
* SPARC: properly justify parameters on stack with size less than 4, fixes failure on tests/cg/tcalext5.pp
...
git-svn-id: trunk@26294 -
2013-12-28 09:23:10 +00:00
sergei
176d8434e4
* SPARC: completely rewrote PIC-related code, got it twice shorter in source lines and much less instructions in generated code.
...
+ Enable registers %i0..%i5 and %o7 for use by reg.allocator.
Some notable properties of this implementation are:
o pi_needs_got flag can be safely set during pass 2, so not setting it occasionally in pass 1 does not result in internal error.
o Reg.allocator configuration is independent from PIC. If procedure requires GOT, register %l7 is allocated at the prologue, making it unavailable to RA.
o GOT is stored in fixed %l7 register, but it is trivial to switch over to virtual register.
git-svn-id: trunk@26293 -
2013-12-27 19:53:38 +00:00
sergei
eaba90dda7
* SPARC: since peephole optimizer recognizes only one conditional branching instruction, generate all branches using A_Bxx opcode, and change it to A_FBxx if necessary when writing assembler. This enables optimization of floating-point branches.
...
* Assembler reader: rewrote branch condition matching part, don't try to match integer suffixes to floating-point branches and vice versa.
git-svn-id: trunk@26290 -
2013-12-27 06:45:49 +00:00
sergei
890d757573
+ SPARC: override g_external_wrapper method and emit PIC-safe jump without distance limit. Mantis #25455 .
...
git-svn-id: trunk@26286 -
2013-12-26 07:37:22 +00:00
sergei
e6a9bfdc1d
* SPARC, g_concatcopy and g_concatcopy_unaligned: removed strange (probably long outdated) comments and unnecessary operations.
...
* g_concatcopy: avoid taking address of references if possible.
git-svn-id: trunk@26281 -
2013-12-25 10:45:25 +00:00
sergei
03fb83cc01
* SPARC: fixed PIC interface wrappers for non-virtual methods. The fix uses branching with 8 MB distance limit, but in particular case of interface wrappers this limit applies to code size of a single unit, not to entire program, and is therefore hard enough to reach.
...
git-svn-id: trunk@26279 -
2013-12-25 08:13:10 +00:00
sergei
65d24e000f
* SPARC: generate PIC prologue as recommended by ABI, it does not require FPC_GETGOT helper.
...
git-svn-id: trunk@26264 -
2013-12-22 14:20:18 +00:00
sergei
6469d41e2a
* SPARC: removed 32 bit shift code, and adjusted 64-bit shifts to take advantage of 3-address instructions (a port of r26142 for MIPS)
...
git-svn-id: trunk@26263 -
2013-12-22 14:09:24 +00:00
sergei
58cc531dd9
* SPARC: convert from int64/qword to float using genmath helpers. Removes dependency on softfloat code.
...
git-svn-id: trunk@26262 -
2013-12-22 14:02:34 +00:00
sergei
5ccdfcf106
* SPARC: optimized a_op_const_reg and a_op_const_reg_reg, take advantage of optimize_op_const functionality.
...
git-svn-id: trunk@26261 -
2013-12-22 13:54:49 +00:00
sergei
9a486d73ba
+ SPARC: support FNEGd/FNEGq internal instructions, and use them to implement floating-point negation more efficiently.
...
git-svn-id: trunk@26259 -
2013-12-21 16:27:24 +00:00
sergei
c3fe0c7379
* On SPARC, using shifts for zero-extending to OS_16 is more efficient than ANDing with 65535 (two instructions and no temp registers vs. three instructions and a temp register).
...
git-svn-id: trunk@26257 -
2013-12-20 19:00:44 +00:00
florian
4d5119bf1c
* fixes several issues which cause warnings by the dfa code when using it to detect uninitialized variables
...
git-svn-id: trunk@26161 -
2013-12-01 17:02:08 +00:00
Jonas Maebe
5ef93e85b8
+ added extra "orgsupreg" parameter to do_spill_read/do_spill_written/
...
do_spill_replace routines, will be necessary by llvm register
allocator to determine the tdef corresponding to that register
* replaced uses of taicpu with tai_cpu_abstract_sym in the register
allocator so that it can work both with taicpu and taillvm instructions
git-svn-id: branches/hlcgllvm@26043 -
2013-11-11 11:15:43 +00:00
Jonas Maebe
99de108c68
* renamed all paramanagers to tcpuparamanager so the llvm paramanager can
...
derive from them without ifdefs
git-svn-id: branches/hlcgllvm@26039 -
2013-11-11 11:15:27 +00:00
Jonas Maebe
353c15fb34
* fixed size of temporary register used to evaluate smallset<=/>=smallset
...
git-svn-id: trunk@25869 -
2013-10-27 17:34:59 +00:00
svenbarth
c48d572996
Implement support for saving and restoring address registers.
...
cgobj.pas, tcg:
* g_save_registers: add the amount of used address registers to size as well
* g_save_registers: save all used address registers
* g_restore_registers: restore all stored address registers
m68k/cpubase.pas:
* rename saved_standard_address_registers to saved_address_registers
all other platform's cpubase.{inc,pas} (except alpha, ia64 and vis which are not up to date):
* add a saved_address_registers variable with one entry of RS_INVALID
At least a "make fullcycle" did complete.
git-svn-id: trunk@25664 -
2013-10-05 21:43:42 +00:00
Jonas Maebe
7566ddcc8f
* add a tdef to each parameter location and set it for all target
...
backends (not yet used, will be used in high level code generator)
git-svn-id: trunk@24761 -
2013-06-02 10:24:02 +00:00
paul
51825b6f2e
compiler: change ret_in_param to accept tabstractprocdef instead of tproccalloption to allow check more options (required for record constructor implementation)
...
git-svn-id: trunk@23394 -
2013-01-16 01:14:23 +00:00
Jonas Maebe
69c29a415f
* pass the procdef to getintparaloc instead of only the proccalloption, so
...
that the type of the parameters can be determined automatically
o added compilerproc declarations for all helpers called in the compiler
via their assembler name, so we can look up the corresponding procdef
git-svn-id: trunk@23325 -
2013-01-06 15:05:40 +00:00
sergei
c766c50907
* Proper fix for SPARC cycling with -dCHECK_PIC, pi_needs_got additionally must be set in following cases:
...
1) tguidconstnode.pass_1 (location is LOC_CREFERENCE)
2) tonnode.pass_1 (generic secondpass references VMT of exception class)
3) Conversion from unsigned to floating-point involves 'magic constant' as GOT-relative data object.
4) Case jumptable address is loaded relative to GOT.
(1) and (2) also provide more accurate setting of pi_needs_got for all targets.
git-svn-id: trunk@23188 -
2012-12-18 17:56:56 +00:00
sergei
0aa7204707
+ Added codes of dynamic relocations to TElfTarget; since most targets use similar dynamic relocation model differing only in code values, this will allow to do majority of handling in the base class.
...
git-svn-id: trunk@23154 -
2012-12-16 09:36:34 +00:00
florian
69d96d9bf9
* modified patch by Mark Morgan Lloyd to pass cpu type to the assembler, resolves #23390
...
git-svn-id: trunk@23107 -
2012-12-03 21:54:37 +00:00
sergei
c4d8396158
* Function RelocName made a member of TElfTarget, so it can be used outside of TElfExeOutput class.
...
* Methods ReportNonDSOReloc and ReportRelocOverflow moved to TElfExeOutput, they are applicable to all target-specific descendants.
git-svn-id: trunk@23094 -
2012-12-02 13:05:53 +00:00
sergei
d79761c607
* Changed TElfTarget from class to record, so it can contain data members while remaining statically allocated.
...
* Moved target-dependent constants into ElfTarget records, eliminates a lot of $ifdef's in ogelf.pas.
+ Added TElfTarget.loadsection hook and pass unknown sections to it.
git-svn-id: trunk@23090 -
2012-12-02 11:15:35 +00:00
florian
e190f76dd9
* removed spaces from sparc cpu name strings so they can be much easier used
...
git-svn-id: trunk@22891 -
2012-10-31 20:57:14 +00:00
Jonas Maebe
6497d3c994
- removed no longer used/supported af_allowdirect flag (direct assembler
...
reader support)
git-svn-id: trunk@22794 -
2012-10-21 13:42:58 +00:00
sergei
6d70009f06
+ ELF linker. Works on x86_64-linux and i386-linux good enough to pass the testsuite, but still requires a lot of work in nearly all aspects. In particular, no attempt to resolve symbols from shared libs is done, everything is just treated as imports. Symbol versioning isn't supported either.
...
x86_64 is the most elaborated, has some degree of indirect function (GNU_IFUNC) and TLS support, so it is even able to link with static libc/pthreads code (tw14265) and produce an executable that can launch (but still fails due to invalid DWARF unwind info).
i386 produces working shared libraries if they are compiled with -Cg, without one your mileage may vary. tw14265 does not link yet due to missing COMDAT group support.
git-svn-id: trunk@22775 -
2012-10-19 17:21:08 +00:00
pierre
e01c7603b8
Rectify last commit: po_assembler alone still sets up a stack frame
...
git-svn-id: trunk@22722 -
2012-10-18 12:44:24 +00:00
pierre
124499474c
Do not add first_param_offset for po_nostackframe and po_assembler in calc_stack_size
...
git-svn-id: trunk@22716 -
2012-10-18 09:22:16 +00:00