Commit Graph

41817 Commits

Author SHA1 Message Date
nickysn
cf6f408214 + implemented the tcg8086.a_cmp_*_*_label methods for i8086. How did the i8086
code generator even work without these?

git-svn-id: trunk@26362 -
2014-01-03 03:31:51 +00:00
florian
ac120d075a * moved directory handling code
git-svn-id: trunk@26361 -
2014-01-02 18:24:11 +00:00
Jonas Maebe
32b9926536 * don't check forwarddefs of copied record/objectdefs (there are none, since
such a def is just a renamed version of a def that's defined/implemented/
    checked elsewhere) -- fixes compiler crash when compiling webtbs/tw3930
    after r26332)

git-svn-id: trunk@26360 -
2014-01-02 16:21:06 +00:00
florian
1fc6316cbc * use generic 32*32 -> 64 bit multiplication on arm thumb
git-svn-id: trunk@26359 -
2014-01-02 15:23:12 +00:00
marco
0bb6469b80 * remove accidentally inserted BOM, as reported by M. Ring.
git-svn-id: trunk@26358 -
2014-01-02 14:34:28 +00:00
marco
ebe262762a * Clean out of $i textrec and filerec includes that are redundant now that cpstrrtl exposes
those records via system. 

git-svn-id: trunk@26356 -
2014-01-02 13:26:09 +00:00
masta
bcec29f1b4 Disable generation of UMULL when generating thumb1 code
git-svn-id: trunk@26355 -
2014-01-02 13:22:15 +00:00
masta
e5b3d89a5d Add CPUARM_HAS_UMULL flag
Pre armv4 and all *M variants to not support UMULL and SMULL.

The Flag now gets used for 32x32->64 and 64x64->64 optimized code.

git-svn-id: trunk@26354 -
2014-01-02 13:06:18 +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
nickysn
e1332304ef * when converting Hi() to a shr node, convert the right shr const parameter to
sinttype, instead of u32inttype. This:
  1) is consistent with what type conversion tshlshrnode.pass_typecheck inserts
     on the right side
  2) avoids the expensive conversion to 32-bit and the even more expensive
     performing the operation in 32-bit on i8086

git-svn-id: trunk@26352 -
2014-01-01 23:57:42 +00:00
nickysn
d4e01637e7 * use nativeint, instead of longint in fpc_div_dword and fpc_mod_dword, because
it produces more efficient code on 16-bit and 8-bit platforms.

git-svn-id: trunk@26351 -
2014-01-01 20:46:28 +00:00
marco
2a4385c196 * simple strtomd5 function from mantis #23397
git-svn-id: trunk@26350 -
2014-01-01 19:52:21 +00:00
nickysn
988b742d71 * avoid the meaningless conversion of the right shl/shr argument to 32-bit on
i8086 in the cases when the left argument is 32-bit.

git-svn-id: trunk@26349 -
2014-01-01 19:03:17 +00:00
masta
f8889e3d6d Use optimize_op_const in ARM cg
This uses the generic optimizations done in optimize_op_const. Due to
this we can also drop some of the optimizations done in the arm-specific
code.

git-svn-id: trunk@26348 -
2014-01-01 18:26:42 +00:00
masta
d32abdf047 Little cleanup in tarmaddnode.second_add64bit
git-svn-id: trunk@26347 -
2014-01-01 18:26:38 +00:00
masta
cec633e86e Optimized support for 32x32 => 64bit multiplications on ARM
This code uses UMULL and SMULL to perform the multiplications, which
take two 32bit source registers and two 32bit destination registers.

git-svn-id: trunk@26346 -
2014-01-01 18:26:29 +00:00
nickysn
dcb9306de8 * perform the OP_AND, OP_OR and OP_XOR optimizations for 0 and $FFFF values
independently also in tcg8086.a_op_const_ref

git-svn-id: trunk@26345 -
2014-01-01 17:45:40 +00:00
nickysn
9a1e33d2a0 * tcg8086.a_op_const_reg: perform the OP_AND, OP_OR and OP_XOR optimizations for
$0000 and $FFFF values on the low and the high words independently.

git-svn-id: trunk@26344 -
2014-01-01 14:57:44 +00:00
nickysn
9eb4419ba3 * fixed the conversion and assignment to the 64-bit boolean types on the i8086
git-svn-id: trunk@26343 -
2013-12-31 17:18:20 +00:00
nickysn
974fea30b2 * use only one temporary 16-bit register, instead of two in tcg8086.g_flags2ref
when the target ref is 32-bit.

git-svn-id: trunk@26342 -
2013-12-31 16:27:11 +00:00
nickysn
72e526b9b1 * taddnode.pass_1: set correctly expectloc to LOC_JUMP or LOC_FLAGS for compare
nodes on 16/8-bit targets. This fixes (among other things) the conversion of
  booleans to boolean16 or boolean32 on i8086.

git-svn-id: trunk@26341 -
2013-12-31 16:22:24 +00:00
nickysn
4917d8da39 - rm the special case handling of unsigned 32-bit ordinals in taddnode.pass_1,
since it performs exactly the same thing as the generic signed 32-bit handling
  in the else clause (regardless of whether cpuneedsmulhelper is defined or not)

git-svn-id: trunk@26340 -
2013-12-31 15:44:29 +00:00
florian
f393c3ff37 * propagate constants into the header of a for loop
+ test which avoids this so we do not miss regressions on for loops with variable boundaries

git-svn-id: trunk@26339 -
2013-12-31 13:16:09 +00:00
florian
b0441e1d64 * move setting of lnf_testatbegin into tfornode.simplify because it is a simplification
git-svn-id: trunk@26338 -
2013-12-31 13:16:06 +00:00
nickysn
bda163544a * tcg8086.g_flags2reg: restore the register back to the original size after the
16-bit inc

git-svn-id: trunk@26337 -
2013-12-31 13:15:30 +00:00
nickysn
fbd05c4e12 * Improved code generation in tcg8086.g_flags2reg for the case when target reg
size is >=16-bit:
  o Generated code is now one instruction and one byte shorter.
  o No 8-bit subregisters are used, which reduces register pressure.

git-svn-id: trunk@26336 -
2013-12-31 11:31:23 +00:00
nickysn
d57d982be7 * simpler handling of moves from a smaller to a larger cgsize in
tcg8086.a_load_reg_ref, which additionally fixes the following issues:
  o The higher parts of the source register is no longer modified.
  o The source register's size is no longer modified with makeregsize.
  o Conversion from OS_S8 to a larger size is now supported.

git-svn-id: trunk@26335 -
2013-12-31 00:33:37 +00:00
Jonas Maebe
a4c938c042 * changed some random data label names to match the label names outputted by
current clang versions, works around some bugs (or at least backward
    incompatibilities) in the Xcode 5 linker when targeting ARM

git-svn-id: trunk@26334 -
2013-12-31 00:28:46 +00:00
Jonas Maebe
5cbcfca33f * changed some Objective-C section declarations to match what's outputted by
current clang versions

git-svn-id: trunk@26333 -
2013-12-31 00:28:41 +00:00
Jonas Maebe
32b149c622 * moved a bunch of tprocdef fields that are only required when compiling the
procdef to a dynamically allocated record that is not created when loading
    the procdef from ppu

git-svn-id: trunk@26332 -
2013-12-31 00:28:28 +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
michael
399129693f * Initialize token more correct in case of * / + -
git-svn-id: trunk@26329 -
2013-12-30 21:58:14 +00:00
nickysn
5d0814016d * improvements and fixes in tcg8086.a_load_reg_reg and .a_load_ref_reg:
o When expanding from a OS_8 to a 16-bit or 32-bit tcgsize, use the R_SUBH
    subregister to initialize the high 16 bits of the register to zero. This
    generates shorter and faster code, without increasing register
    interferences, because R_SUBH has the same register constraints on i8086 as
    R_SUBL, which is already used on the same imaginary register.
  o After performing operations on the 8-bit subparts of a register that was
    initially 16-bit, call makeregsize(OS_16) to notify the register allocator
    that the register is once again 16-bit.

git-svn-id: trunk@26328 -
2013-12-30 21:20:10 +00:00
Jonas Maebe
bf59a848b4 * fixed compilation of genmath.inc for the JVM target. In the future, please
use the new float64low/high() for getting the low/high longint and
    float64setlow/high() to set it

git-svn-id: trunk@26327 -
2013-12-30 14:30:59 +00:00
Jonas Maebe
de59d6ac11 * prevent endless loop when writing an invalid utf-8 sequence longer than
32 bytes using writestr to a unicode/widestring

git-svn-id: trunk@26326 -
2013-12-30 14:30:56 +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
marco
3369466d16 * remove finherithandles for wince like r25981 did in mantis #22271 fro win32
git-svn-id: trunk@26320 -
2013-12-30 13:08:50 +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
Jonas Maebe
d2b8275b99 + support for arbitrary encodings in readstr/writestr
o set the code page of the temporary "text" file to utf-8 for writestr with
     unicodestring/widestring as destination, so that no data loss can occur
     (+ properly deal with cases whereby part of an utf-8 character is
      written to the textbuf in this case)
   o explicitly pass the code page of the destination ansistring for writestr
     with ansistring as destination and set it for the temporary "text" file
   o set the code page of the text file for readstr

git-svn-id: trunk@26317 -
2013-12-29 19:18:49 +00:00
Jonas Maebe
ddf08b4eb7 * call TranslatePlaceholderCP() when comparing code pages to avoid
unnecessary conversions between CP_ACP and the current actual
    DefaultSystemCodePage
  * call TranslatePlaceholderCP() when changing the code page of a
    text file because in some cases this code page is passed directly
    to widestringmanager.Wide2AnsiMoveProc() (which does not perform any
    translation itself)

git-svn-id: trunk@26316 -
2013-12-29 19:18:36 +00:00
nickysn
f69a76b5b1 * generate shorter code on 8-bit and 16-bit CPUs in thlcg2ll.location_force_reg,
when converting a LOC_JUMP location to a (OS_INT<x<=32)-bit reg location
  (the optimization is similar to r26314, but is for non 64-bit destinations).

git-svn-id: trunk@26315 -
2013-12-29 19:07:35 +00:00
nickysn
9ec84d1259 * generate shorter code on 8 and 16-bit CPUs in thlcg2ll.location_force_reg,
when converting a LOC_JUMP location to a 64-bit reg location by only setting
  the low OS_INT-sized register to 0 or 1 in the false/true label parts and then
  initializing the remaining registers (obtainable via GetNextReg()) to 0 in the
  common part after the jumps.

git-svn-id: trunk@26314 -
2013-12-29 17:28:35 +00:00
nickysn
6d48b32115 * fixes and improvements in tcg8086.a_load_reg_reg for the case when the src and
dest are subregisters of the same superregister, but of different sizes:
   o Do not emit spurious moves from a register to the same register.
   o Correctly support the case when converting from 16-bit to 32-bit int.
     Previously it didn't work correctly, because in this particular case, due
     to the way the GetNextReg scheme works, we have reg1=reg2.

git-svn-id: trunk@26313 -
2013-12-29 17:15:58 +00:00
nickysn
4e795eca99 * fixes for 16 and 8-bit ALUs in thlcg2ll.location_force_reg for the cases when
converting from a LOC_FLAGS or LOC_JUMP location to a 64-bit reg location.
  This fixes test/cg/tcnvint1.pp on i8086 after r26301.

git-svn-id: trunk@26312 -
2013-12-29 14:30:41 +00:00
florian
27f6fd1c2c * use new shl/shr constant folding (of r26295) only if forinline is set
* explicitly simplify tree after constant propagation

git-svn-id: trunk@26311 -
2013-12-29 14:09:03 +00:00
florian
be3749301f * fix possible issues due to new behaviour of constant shifting
git-svn-id: trunk@26310 -
2013-12-29 12:21:25 +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
florian
739166f3e7 * fix test
git-svn-id: trunk@26308 -
2013-12-29 10:03:41 +00:00