Commit Graph

510 Commits

Author SHA1 Message Date
marco
5f8057775b --- Merging r30757 into '.':
U    compiler/generic/symcpu.pas
U    compiler/arm/symcpu.pas
U    compiler/symtable.pas
U    compiler/ia64/symcpu.pas
U    compiler/m68k/symcpu.pas
U    compiler/powerpc64/symcpu.pas
U    compiler/symconst.pas
U    compiler/mips/symcpu.pas
U    compiler/x86_64/symcpu.pas
U    compiler/i8086/symcpu.pas
U    compiler/powerpc/symcpu.pas
U    compiler/avr/symcpu.pas
U    compiler/symsym.pas
U    compiler/i386/symcpu.pas
U    compiler/alpha/symcpu.pas
U    compiler/jvm/symcpu.pas
U    compiler/sparc/symcpu.pas
U    compiler/pmodules.pas
U    compiler/aarch64/symcpu.pas
U    rtl/inc/text.inc
--- Recording mergeinfo for merge of r30757 into '.':
 U   .

# revisions: 30757
------------------------------------------------------------------------
r30757 | florian | 2015-05-01 22:58:31 +0200 (vr, 01 mei 2015) | 3 lines
Changed paths:
   M /trunk/compiler/aarch64/symcpu.pas
   M /trunk/compiler/alpha/symcpu.pas
   M /trunk/compiler/arm/symcpu.pas
   M /trunk/compiler/avr/symcpu.pas
   M /trunk/compiler/generic/symcpu.pas
   M /trunk/compiler/i386/symcpu.pas
   M /trunk/compiler/i8086/symcpu.pas
   M /trunk/compiler/ia64/symcpu.pas
   M /trunk/compiler/jvm/symcpu.pas
   M /trunk/compiler/m68k/symcpu.pas
   M /trunk/compiler/mips/symcpu.pas
   M /trunk/compiler/pmodules.pas
   M /trunk/compiler/powerpc/symcpu.pas
   M /trunk/compiler/powerpc64/symcpu.pas
   M /trunk/compiler/sparc/symcpu.pas
   M /trunk/compiler/symconst.pas
   M /trunk/compiler/symsym.pas
   M /trunk/compiler/symtable.pas
   M /trunk/compiler/x86_64/symcpu.pas
   M /trunk/rtl/inc/text.inc

o fixes handling of iso i/o parameters/program parameters:
  * explicit reset is needed
  * variable must be declared again
------------------------------------------------------------------------

git-svn-id: branches/fixes_3_0@33408 -
2016-04-02 14:47:24 +00:00
Jonas Maebe
e0ca083cce --- Merging r30038 into '.':
U    compiler/ncgvmt.pas
--- Merging r30217 into '.':
U    compiler/comprsrc.pas
--- Merging r30261 into '.':
A    tests/webtbs/tw27691.pp
U    compiler/pmodules.pas
--- Merging r30265 into '.':
U    compiler/fmodule.pas
G    compiler/pmodules.pas
--- Merging r30272 into '.':
A    tests/webtbs/tw27517.pp
U    compiler/pexpr.pas
--- Merging r30427 into '.':
U    compiler/x86/cpubase.pas
--- Merging r30465 into '.':
U    compiler/utils/ppuutils/ppudump.pp
--- Merging r30487 into '.':
U    rtl/inc/cgenstr.inc
--- Merging r30502 into '.':
U    compiler/x86/nx86inl.pas
U    compiler/arm/narminl.pas
U    compiler/ppcgen/ngppcinl.pas
A    tests/webtbs/tw27811.pp
--- Merging r30656 into '.':
U    compiler/psub.pas
--- Merging r30765 into '.':
U    compiler/arm/narmcnv.pas
U    compiler/sparc/ncpucnv.pas
U    compiler/m68k/n68kcnv.pas
U    compiler/mips/ncpucnv.pas
U    compiler/ppcgen/ngppccnv.pas
   C compiler/aarch64/ncpucnv.pas
A    tests/webtbs/tw28007.pp

git-svn-id: branches/fixes_3_0@32665 -
2015-12-14 12:36:29 +00:00
florian
5c67fcc43f + change always floating point divisions into multiplications if they are a power of two,
this is an exact operation so it is always allowed
* change only divisions by normal numbers into multiplications

git-svn-id: trunk@29085 -
2014-11-16 20:47:38 +00:00
Tomas Hajny
3ee3542744 * boolean constant instead of IFDEFs for detection of microcontroller support
git-svn-id: trunk@29052 -
2014-11-10 12:34:59 +00:00
sergei
b70c5efa65 * SPARC peephole: check that result of GetNextInstructionUsingReg is actually an instruction, because GetNextInstruction can stop at a label. Resolves #26798.
The same issue on MIPS targets was fixed by r28380, but I forgot to apply it also to SPARC.

git-svn-id: trunk@28722 -
2014-09-28 22:18:59 +00:00
Károly Balogh
0cf7357ee2 * fix GetResFlags DFA optimizer warning on Sparc and AVR too
git-svn-id: trunk@28500 -
2014-08-20 13:52:28 +00:00
sergei
e4fea2ebc8 * Dummy implementations of a_bit_scan_reg_reg and g_stackpointer_alloc in tcg, removes the need to override these methods in every descendant code generator solely to avoid "constructing a class with abstract method" warning.
git-svn-id: trunk@28175 -
2014-07-06 11:34:04 +00:00
sergei
77d97303a9 * SPARC: cleanup and simplify 64-bit code generator. Call cg.a_op64_const_reg_reg where possible to make use of its optimization abilities.
git-svn-id: trunk@27985 -
2014-06-16 19:22:52 +00:00
sergei
51f6092672 * SPARC: OP_NOT can always be done in 32 bits, because for 8 and 16-bit operations the high bits of result are adjusted immediately afterwards.
* "carry clear" flag can be converted into register using a single instruction.

git-svn-id: trunk@27984 -
2014-06-16 19:15:01 +00:00
sergei
f20b6c73ef * SPARC: convert carry flag into register without branching.
git-svn-id: trunk@27619 -
2014-04-20 19:30:59 +00:00
sergei
f3801d13de * SPARC: cleaned up and actualized TAsmCond (stuff copy-pasted from x86 removed, conditions for unordered floating-point comparisons added). Fixes Mantis #9362 on this target.
git-svn-id: trunk@27593 -
2014-04-17 14:15:45 +00:00
sergei
58882e2934 * SPARC: UNIMP instruction has 22-bit "opcode", not 12-bit.
git-svn-id: trunk@27592 -
2014-04-17 14:08:33 +00:00
svenbarth
02495c17bd Fix a typo. The CPU specific version of "ttypesym" should be called "tcputypesym" and not "tcpuypesym".
git-svn-id: trunk@27531 -
2014-04-11 14:30:59 +00:00
Jonas Maebe
d452686c39 * moved pbestrealtype from symdef to symcpu
git-svn-id: trunk@27441 -
2014-04-01 21:41:37 +00:00
Jonas Maebe
dae5d1ff62 + added class reference types of the architecture-specific t*def/t*sym
classes

git-svn-id: trunk@27396 -
2014-03-30 21:04:32 +00:00
Jonas Maebe
b57c95043f + support overriding tdef/tsym methods with target-specific functionality:
o made all (non-abstract) tdef and tsym constructors virtual
   o added c*def/c*sym classref types for every (non-abstract) t*def/t*sym
     class
   o added cpusym unit for every architecture that derives a tcpu*def/tcpu*sym
     class from the base classes, and initialises the c*def/c*sym classes with
     them. This is done so that the llvm target will be able to derive from
     the tcpu*def/sym classes without umpteen ifdefs, and it also means that
     the WPO can devirtualise everything because the c* variables are only
     initialised with one class type
   o replaced all t*def/t*sym constructor calls with c*def/c*sym constructor
     calls

git-svn-id: trunk@27361 -
2014-03-29 22:31:55 +00:00
sergei
e163a2c813 * MIPS and SPARC: determine whether case expression is in range using a single unsigned comparison (like it is done on other targets).
git-svn-id: trunk@27088 -
2014-03-10 23:02:05 +00:00
Jonas Maebe
4065483a50 * completed thlcgobj.location_force_fpureg(), use it everywhere and removed
ncgutil/thlcg2ll.location_force_fpureg()

git-svn-id: trunk@27071 -
2014-03-10 09:01:05 +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