paul
19d71655eb
utils: fix few errors with sharepath in samplecfg
...
git-svn-id: trunk@26424 -
2014-01-11 16:15:02 +00:00
paul
4df2637e99
fpc: pass sharepath to fpc.cfg maker using samplecfg
...
git-svn-id: trunk@26423 -
2014-01-11 14:41:45 +00:00
pierre
7a03a7485f
Fix typing error in cross-cycle at level 2
...
git-svn-id: trunk@26417 -
2014-01-10 17:43:30 +00:00
pierre
12d56bad5c
Use os name only to look for units/$target/rtl if target has tf_use_8_3 to find installed directories
...
git-svn-id: trunk@26416 -
2014-01-10 15:11:44 +00:00
nickysn
372e9dfdf1
* improved the readability of the code of taddnode.try_make_mul32to64() even
...
more by factoring out some of the node tests to nested functions
git-svn-id: trunk@26414 -
2014-01-10 00:22:15 +00:00
nickysn
ac177a445e
* use is_64bit() in taddnode.try_make_mul32to64() for better readability
...
git-svn-id: trunk@26413 -
2014-01-09 18:04:07 +00:00
Jonas Maebe
ffd6a4ea47
* set the code page of rawbytestring typed constants to the same value as
...
when assigning a string constant to a rawbytestring (system code page with
{$modeswitch systemcodepage}, CP_ACP without) (mantis #25332 )
git-svn-id: trunk@26397 -
2014-01-05 18:26:10 +00:00
paul
79ef05407a
compiler: fix error message (was error message about resourcestring for property)
...
git-svn-id: trunk@26389 -
2014-01-05 07:12:41 +00:00
paul
f9c3c598b6
compiler: remove big codepage maps from the compiler executable - they will be loaded from -FM path when needed
...
git-svn-id: trunk@26388 -
2014-01-05 06:06:18 +00:00
nickysn
c2ba9ebfe5
+ added different mul helpers for the 32 to 64-bit muls, since they can usually
...
be implemented more efficiently than the 64 to 64-bit ones.
git-svn-id: trunk@26386 -
2014-01-05 03:01:18 +00:00
paul
93883d1264
compiler: load binary unicode mappings in cpavailable() call instead of separate loadbinarycp() call
...
git-svn-id: trunk@26379 -
2014-01-04 16:42:20 +00:00
paul
52d1cbc544
compiler:
...
+ add -FM command line option to pass directory for unicode binary files
+ enable dynamic loading of charset files (don't disable runtime charset files for the moment)
git-svn-id: trunk@26378 -
2014-01-04 15:44:18 +00:00
nickysn
b8203a3406
* fixed tcg8086.gen_cmp32_jmp1 for the less than/greater than cases
...
git-svn-id: trunk@26370 -
2014-01-03 18:06:21 +00:00
nickysn
270444508a
* fixed not(boolean32) and not(boolean64) on i8086
...
git-svn-id: trunk@26369 -
2014-01-03 15:18:07 +00:00
Jonas Maebe
ab4844bdff
* give an internal error when trying to set/get procdef properties that are
...
not available
git-svn-id: trunk@26367 -
2014-01-03 12:23:27 +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
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
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
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
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
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
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
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
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
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
florian
880201e56c
+ pointerconstn is also a constant node
...
git-svn-id: trunk@26305 -
2013-12-28 20:20:00 +00:00
florian
de3a116a28
* handle records with size 0 as function results correctly
...
git-svn-id: trunk@26303 -
2013-12-28 20:19:56 +00:00
florian
561ec1f782
* unified internal errors
...
git-svn-id: trunk@26302 -
2013-12-28 20:19:54 +00:00
florian
2081b9cad7
* do not convert a boolean to a 32 bit int first when converting to a 64 bit int, this causes data loss when casting e.g. a qwordbool to a qword
...
git-svn-id: trunk@26301 -
2013-12-28 20:19:51 +00:00
florian
27ac68cdc7
* be more careful when removing dead stores
...
* take care also of staticvarsyms when removing dead stores
git-svn-id: trunk@26298 -
2013-12-28 20:19:42 +00:00
florian
e9777503d1
* check addr_taken when propagating constants
...
* do constant propagation on static var syms as well
git-svn-id: trunk@26297 -
2013-12-28 20:19:40 +00:00
florian
b1ee6f282c
* set successor node for load nodes as well, they can be generated when inlining
...
git-svn-id: trunk@26296 -
2013-12-28 20:19:38 +00:00
florian
89663e499b
* fold shifting of constants equally to cpus
...
* test adapted, e.g. 1 shl 63 needs now an explicit cast to qword for the one: qword(1) shl 63
git-svn-id: trunk@26295 -
2013-12-28 20:19:35 +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
1a3b46967e
+ Two more checks for access to global data and setting the pi_needs_got flag, intended for targets that require decision about PIC code generation strictly before pass 2.
...
git-svn-id: trunk@26292 -
2013-12-27 13:41:36 +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
nickysn
fdd36b4603
* on i8086 with regvars on, do not notify the register allocator of moves to BX.
...
This fixes compilation of unit math (and the whole RTL) with regvars enabled.
git-svn-id: trunk@26282 -
2013-12-25 12:19:21 +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
nickysn
420f30bacd
* fixed the handling of OS_PAIR/OS_SPAIR-sized parameters in ncgutil.gen_load_cgpara_loc. This fixes 32-bit regvar'd parameters on i8086.
...
git-svn-id: trunk@26278 -
2013-12-24 23:07:44 +00:00
yury
eea69a2947
* ppudump: Fixed json and xml output of inline types in array declaration.
...
git-svn-id: trunk@26277 -
2013-12-24 12:32:55 +00:00
nickysn
af49e50a3c
* do not cause an internal error when location_reg2string is called on a
...
location where the registers have been translated (i.e. not imaginary), but
GetNextReg is necessary to get some of the registers (only on 16/8-bit CPUs).
The missing registers are indicated as '??'. This avoids a crash when
compiling a system unit on i8086 with regvars enabled and withous -sr, while
still giving the full list of registers when compiling with -sr.
git-svn-id: trunk@26276 -
2013-12-24 00:01:28 +00:00
nickysn
338d72f564
* extracted the code from psub.translate_registers for generating the name of
...
the registers from a tlocation to a new function called location_reg2string
+ added support for 16-bit and 8-bit ALUs in location_reg2string
git-svn-id: trunk@26275 -
2013-12-23 22:58:32 +00:00
yury
996ee048be
* ppudump: Properly handle type definitions inside a class definition for json and xml output.
...
git-svn-id: trunk@26273 -
2013-12-23 14:45:03 +00:00
nickysn
99770d367f
* 16-bit and 8-bit ALU fixes in tcgtempdeletenode.pass_generate_code
...
git-svn-id: trunk@26272 -
2013-12-23 14:09:28 +00:00
nickysn
39c54bf077
* handle ait_varloc in the nasm writer. This allows compiling the system unit
...
for i8086 with regvars and -sr for debugging purposes.
git-svn-id: trunk@26271 -
2013-12-23 13:27:22 +00:00
yury
bc14407ffe
* ppudump: Deref index -1 is valid for absolute symbols. Handle this.
...
git-svn-id: trunk@26270 -
2013-12-23 12:26:28 +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
8ecad469a6
* Reverted r26256 since it produced wrong results if argument of inc/dec is actually unaligned. Added description of the issue and slightly increased node complexity at which address is cached, so operations on record/class fields do not take address.
...
git-svn-id: trunk@26258 -
2013-12-21 10:33:38 +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
sergei
b376f56bf3
* Use typed pointer to store address of x when processing inc(x)/dec(x) with range checking enabled. This preserves alignment of x and prevents generating unaligned code on alignment-sensitive targets.
...
git-svn-id: trunk@26256 -
2013-12-20 17:13:41 +00:00
sergei
5cd0684d45
* tcg.a_load_ref_reg_unaligned: if loading signed 16-bit value, treat upper half as signed 8-bit to ensure that result is properly extended. This routine is used only by SPARC target (other CPUs use specific implementations), and it generates pretty inefficient code, therefore it's probably worth to drop it altogether and implement SPARC-specific version. Mantis #25440 .
...
git-svn-id: trunk@26255 -
2013-12-20 17:07:00 +00:00
sergei
f2096de53a
* tcg386.g_proc_exit: instead of recalculating stack size, use current_procinfo.final_localsize which was calculated in g_proc_entry.
...
* tcgx86.g_proc_entry: don't over-allocate stack in SEH finalizer procedures.
git-svn-id: trunk@26251 -
2013-12-19 10:32:32 +00:00
sergei
258e8c58a4
+ Added trecorddef.buildderefimpl, necessary since advanced records have been implemented. Fixes compiler crash on webtbs/tw18688.pp on x86_64-win64.
...
git-svn-id: trunk@26250 -
2013-12-18 16:26:50 +00:00
nickysn
be5f49b3e5
* tx86addnode.second_cmpfloat: on i8086 only load the high byte of the FPU
...
status word after fstsw (and before sahf), because 8-bit memory transfers are
faster on the i8088, due to the 8-bit data bus
git-svn-id: trunk@26245 -
2013-12-16 23:52:28 +00:00
nickysn
ada9ccf6a6
* tx86addnode.second_cmpfloat: do not emit a fwait after fstsw as my own testing
...
on a true i8087 showed that the fwait isn't necessary
git-svn-id: trunk@26244 -
2013-12-16 23:17:44 +00:00
sergei
6ea9ce1077
* Force managed types to be always returned in parameters, independent of target (primitive types were already handled that way; the patch affects small records with fields of managed types).
...
* Generating code to finalize result on exception at callee side is no longer necessary.
git-svn-id: trunk@26228 -
2013-12-13 19:54:46 +00:00
nickysn
a7b4953795
+ proper (i.e. not broken) implementation of arctan() for the 8087 and 80287
...
git-svn-id: trunk@26226 -
2013-12-12 23:46:51 +00:00
sergei
179586f589
+ SEH support for Win32. Enable by cycling with OPT=-dTEST_WIN32_SEH.
...
Although basic things work (no regressions in test suite, also with TEST_OPT=-O2), there are some secondary issues/TODOs:
- Exception frame around PASCALMAIN is not properly removed in DLLs
- No stack traces yet
- Stack overallocated in finalizer procedures, their entry/exit code needs cleanup
- Signals unit is probably completely broken.
git-svn-id: trunk@26225 -
2013-12-12 12:43:46 +00:00
sergei
1ee9373fa6
* Changed function create_pd into method of ttryfinallynode, so it can be reused for Win32 SEH and, in the future, for DWARF-based exception handling on other targets.
...
* Additional two minor changes: reset po_delphi_nested_cc on result, so it is independent of current {$modeswitch nestedprocvar} state, and removed call to alloc_proc_symbol (which belongs to pass 2).
git-svn-id: trunk@26222 -
2013-12-12 08:38:06 +00:00
sergei
ffba5aee60
* MIPS: emit PIC-friendly instruction sequences instead of "J" when fixing up branches outside of 128K range. Resolves #25399 .
...
git-svn-id: trunk@26215 -
2013-12-11 10:56:07 +00:00
sergei
0e0273d53f
* Partially reverted r26192, preserving registers in presence of exceptions needs a different solution.
...
git-svn-id: trunk@26210 -
2013-12-10 12:43:24 +00:00
Jeppe Johansen
d24cbbf9f5
Changed debug information to dwarf for ARM_embedded, and set local minimum alignment to 4.
...
Fixed a bug where ARMv7M targets would not use the DIV instructions.
Moved many size-optimizing Thumb2 peephole optimizations to PostPeepHoleOptsCpu. Previously those optimizations could make it impossible to reuse the shared arm peephole optimizations.
Reenabled a fixed MLA/MLS peephole optimization.
Refactored some FindRegDealloc+regLoadedWithNewValue into RegEndOfLife calls.
Fixed some broken UXTB/UXTH optimizations. Previously they would also match UXT* instructions with ROR shifter ops.
git-svn-id: trunk@26198 -
2013-12-08 16:50:15 +00:00
florian
5aae381d10
* as nodes can appear directly in statements for checking of type conversions
...
git-svn-id: trunk@26195 -
2013-12-08 09:05:28 +00:00
sergei
e26ce9e442
* Fix code generation of for-loops. Keeping a copy of to-value in register during pass 2 is basically a hack, because register may be destroyed if an exception is raised and handled in loop body. This went unnoticed because generic setjmp-based exception handling is restoring registers to the state at entry to try block, and Win64 SEH also has some register-preserving features. However, for Win32 SEH it is not true.
...
Instead, to-value is now copied to a temp during pass 1, and this temp is forced into memory if loop body contains try..finally or try..except block.
git-svn-id: trunk@26192 -
2013-12-07 09:18:18 +00:00
sergei
563b74b16a
* Cleanup code generation for try..finally nodes.
...
git-svn-id: trunk@26191 -
2013-12-07 07:31:59 +00:00
sergei
f508442a7e
* Emit everything to the same asmlist (fixing copy-paste error).
...
git-svn-id: trunk@26187 -
2013-12-06 07:10:39 +00:00
nickysn
09a3fc74e3
* use the fwait prefixed FSTCW, followed by FWAIT, instead of FNSTCW in
...
tx86inlinenode.second_trunc_real, when generating code for the 8087
git-svn-id: trunk@26186 -
2013-12-05 23:33:33 +00:00
nickysn
2d45ea43af
* use the 'wait' prefix (on the same line as the instruction), instead of
...
'db 09bh' (on the previous line) for the fwait prefixed 8087 instructions in
the nasm assembly output, because it looks prettier this way :)
git-svn-id: trunk@26185 -
2013-12-05 21:31:16 +00:00
sergei
f42c1b3720
* Return dynamic arrays in parameter, this was the only managed type still returned in register. Returning managed types in registers requires catching and re-raising exceptions at callee side in order to finalize result and avoid memory leaks. While such behavior makes little difference with generic setjmp-based exception handling, it becomes very inefficient as SEH-styled exception handling is being introduced.
...
The new behavior is also Delphi-compatible.
git-svn-id: trunk@26180 -
2013-12-04 13:43:22 +00:00
nickysn
3555b76495
- rm FDISI,FENI,FSAVE,FSTCW,FSTENV and FSTSW from the requires_fwait_on_8087()
...
list, because these instructions already have a built in FWAIT prefix even
when targeting the 287/387+ both with the internal asm writer and with the
NASM back end.
git-svn-id: trunk@26178 -
2013-12-03 23:56:45 +00:00
nickysn
e9a4896565
- rm the 287/387+ FPU instructions from the requires_fwait_on_8087() list
...
git-svn-id: trunk@26176 -
2013-12-03 22:48:52 +00:00
Károly Balogh
71e492db1b
made arm-linux system unit compilable on anything but Thumb2 after r26161
...
git-svn-id: trunk@26175 -
2013-12-03 16:36:34 +00:00
yury
7e8ce16f6b
* ppudump: Output the "default" option for properties.
...
git-svn-id: trunk@26173 -
2013-12-03 14:31:33 +00:00
Jonas Maebe
2274150698
* fixed compilation with -Oodfa on big endian systems
...
git-svn-id: trunk@26169 -
2013-12-02 13:42:48 +00:00
florian
4aebcdaa94
* enable node dfa for life information with -O3:
...
- all known issues with it are fixed
- the resulting warnings about uninitialized warnings are better than that ones from the old code
- with node dfa in place, stuff like dead store removal, strength reduction and ssa can be finished now
- drawback: with node dfa enabled, the compiler is 2-3% slower, there is still some room for improvement though
git-svn-id: trunk@26165 -
2013-12-01 17:02:19 +00:00
florian
6924cc0458
* optimize CheckAndWarn
...
git-svn-id: trunk@26164 -
2013-12-01 17:02:17 +00:00
florian
35206c3d93
* make ResetProcessing more efficient
...
git-svn-id: trunk@26163 -
2013-12-01 17:02:15 +00:00
florian
e914612423
* the win64 exception handling code messes with asm nodes, so mark the helper procedure that they contain assembler
...
git-svn-id: trunk@26162 -
2013-12-01 17:02:13 +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
florian
99eadb91b3
* run CheckAndWarn to get proper locations for warnings about uninitialized variables
...
* several fixes to liveness analysis
* get rid of old version defines
+ tests
git-svn-id: trunk@26159 -
2013-12-01 17:01:51 +00:00
florian
c357212b45
+ search crt* files also in /usr/lib/x86_64-linux-gnu, multiarch supporting distros require this
...
git-svn-id: trunk@26158 -
2013-12-01 15:39:05 +00:00
sergei
409e176ded
* Factored reusable (SEH-related) piece of code into separate procedure.
...
git-svn-id: trunk@26157 -
2013-12-01 11:47:12 +00:00
sergei
d72478eb64
* Function tjvmaddnode.cmpnode2topcmp is, in fact, not specific to any target. Moved it to generic tcgaddnode and reused in tmipsaddnode, where the same functionality was implemented in different way.
...
git-svn-id: trunk@26151 -
2013-11-28 11:52:47 +00:00
sergei
e16e19b170
* MIPS: removed specific handling of 32-bit shifts, generic code does the job just well.
...
* Tweak 64-bit shifts to take advantage of 3-address instructions (i.e. don't operate on same register).
git-svn-id: trunk@26142 -
2013-11-27 11:33:52 +00:00
Jonas Maebe
5e0589f0a5
* fixed debug information for strings (index starts from 1, not from 0)
...
(mantis #25226 )
git-svn-id: trunk@26140 -
2013-11-26 19:59:53 +00:00
sergei
2a112ad01b
* MIPS: don't optimize reference twice for 64-bit loads and stores. Now loading/storing 64-bit value to global variable takes typically 3 instructions.
...
git-svn-id: trunk@26139 -
2013-11-25 14:27:35 +00:00
sergei
97a706c672
+ Add definitions for ELF header flags.
...
git-svn-id: trunk@26137 -
2013-11-25 13:59:12 +00:00
sergei
06735eaefc
+ MIPS peephole optimizer: eliminate redundant moves of floating point registers.
...
git-svn-id: trunk@26136 -
2013-11-25 13:57:19 +00:00
sergei
0bef197c84
* MIPS unary minus node: override the entire second_float method, not just emit_float_sign_change. Makes use of two-address neg.d/neg.s instructions, eliminating extra register moves.
...
git-svn-id: trunk@26135 -
2013-11-25 13:54:38 +00:00
Jonas Maebe
7be4e20307
* also don't put a value in registers if it is converted from a type that can
...
be held in one kind of register to a type that can be held in another kind
of register (mantis #25361 )
git-svn-id: trunk@26128 -
2013-11-24 12:49:23 +00:00
Károly Balogh
34702dbfc5
fixed staticlibprefix for Amiga and MorphOS
...
git-svn-id: trunk@26127 -
2013-11-24 04:19:59 +00:00
Károly Balogh
3d07b35d77
do not append directory separator when it is already there, as // equals /../ on Amiga, fixes smartlinked RTL build
...
git-svn-id: trunk@26126 -
2013-11-24 03:09:24 +00:00
Károly Balogh
ba89914471
use the new HASAMIGA instead of the non-existing AmigaShell
...
git-svn-id: trunk@26124 -
2013-11-24 01:22:07 +00:00
Károly Balogh
da3603e663
introduce HASAMIGA define to easily identify various Amiga flavors (similarly to HASUNIX)
...
git-svn-id: trunk@26123 -
2013-11-24 01:19:52 +00:00
nickysn
6fdadb6248
* 8087 fixes in tx86addnode.second_cmpfloat:
...
- use FSTSW instead of FNSTSW
- insert a FWAIT after the FSTSW, because the value is immediately loaded
afterwards by the integer unit of the CPU
git-svn-id: trunk@26110 -
2013-11-19 23:22:49 +00:00
nickysn
7ae59a62c5
* emit a FWAIT after a floating point store, when targeting the 8087 and 80287
...
git-svn-id: trunk@26109 -
2013-11-19 23:11:26 +00:00
paul
6e7cc22207
compiler: don't allow to assign to for-in loop variable (bug #0025318 )
...
git-svn-id: trunk@26108 -
2013-11-19 05:29:37 +00:00
nickysn
0020a2ed10
+ when targeting the i8087, emit FWAIT prefix manually for the 8087 instructions
...
that require it in the NASM asm writer, since NASM doesn't do it itself.
git-svn-id: trunk@26107 -
2013-11-19 01:26:57 +00:00
nickysn
12b2f86e99
+ added function requires_fwait_on_8087(), which checks whether a given
...
instruction needs adding a FWAIT prefix on the i8087.
git-svn-id: trunk@26106 -
2013-11-18 23:38:57 +00:00
nickysn
85e1f444c5
* is_ecx_used modified to only check the callee side, but after a call to
...
init_paraloc_info to ensure that the callee side paraloc info is created.
git-svn-id: trunk@26103 -
2013-11-17 15:46:56 +00:00
nickysn
fbca7ee2cb
* check callerside if calleeside isn't available in is_ecx_used. Based on the
...
patch by Do-wan Kim, mantis #25269 .
git-svn-id: trunk@26101 -
2013-11-16 19:39:15 +00:00
sergei
bca2c464da
* Don't generate x87 instructions for sin and cos on win64, somehow managed to not commit this part in r25995. Mantis #17273 .
...
git-svn-id: trunk@26094 -
2013-11-15 10:37:59 +00:00
Jonas Maebe
b6d279d4aa
* don't transform div-by-power-of-2 into a shift when overflow checking is
...
enabled (mantis #23849 )
git-svn-id: trunk@26089 -
2013-11-14 15:47:49 +00:00
Jonas Maebe
9b1a36fcdb
* don't call buildderef for the local symtable of procdefs unless we will
...
write it to the ppu
git-svn-id: trunk@26083 -
2013-11-13 20:52:38 +00:00
florian
92508a9801
* take of life of tlabelnode.left, the test does not test this however because I'am not aware of any example to force a left node for a label
...
git-svn-id: trunk@26082 -
2013-11-13 19:26:37 +00:00
sergei
3ce0b33302
* Win64 SEH: when creating a finalization procedure, put its def into the same symtable with sym. By default, defs are added into symtablestack.top, which may be set to something temporary like exceptsymtable. In such cases it is possible that def is destroyed before sym, leaving sym with invalid pointers.
...
git-svn-id: trunk@26077 -
2013-11-13 12:27:27 +00:00
pierre
2370669f86
Avoid infinite recursion on generic classes for IDE browser
...
git-svn-id: trunk@26068 -
2013-11-12 16:39:20 +00:00
Jonas Maebe
864a72ee69
* fixed (harmless) range errors
...
git-svn-id: trunk@26067 -
2013-11-12 16:11:17 +00:00
nickysn
dc432918da
+ enabled the use of the DIV/IDIV instruction for 16-bit div/mod on i8086
...
* ti8086.moddivnode.pass_generate_code: use cg.a_op_const_reg, instead of
emit_const_reg, in order to support generating plain 8086/8088 code
(shr/shl/sar reg,const is 186+ if const is >= 2).
git-svn-id: trunk@26063 -
2013-11-11 22:34:41 +00:00
nickysn
bd083c0b8e
* ti8086moddivnode.pass_generate_code converted to 16-bit. Note that this code
...
is still not active, due to the cpuneedsdiv32helper define, but will
eventually be enabled for 16-bit divisions.
git-svn-id: trunk@26062 -
2013-11-11 21:01:13 +00:00
Jonas Maebe
8d1fb0ee1c
* added a safety check to gen_load_cgpara_loc()
...
git-svn-id: trunk@26024 -
2013-11-10 23:27:05 +00:00
Jonas Maebe
8a0caea0c0
+ override g_save_registers() and g_restore_registers() with do-nothing versions
...
for high level code generator targets
git-svn-id: trunk@26023 -
2013-11-10 21:33:38 +00:00
Jonas Maebe
1b6e4e572f
- removed duplicate thlcg2ll a_label method (it's declared the same in
...
thlcgobj and not virtual in either class)
git-svn-id: trunk@26022 -
2013-11-10 21:32:39 +00:00
Jonas Maebe
8cdde466bb
* include fpcdefs.inc
...
git-svn-id: trunk@26021 -
2013-11-10 21:30:55 +00:00
Jonas Maebe
62e1df9e76
* fixed indentation
...
git-svn-id: trunk@26020 -
2013-11-10 21:25:34 +00:00
Jonas Maebe
c1cec52897
* fixed alignment of bitpacked arrays of ordinals/enums: the prevous code
...
always returned the alignment of enum/ordinal by itself, which could be
either bigger or smaller than what was required
* for non-bitpacked regular arrays, always use the alignment of the elements
instead of sometimes the natural alignment of the size of the elements
(which can be different)
git-svn-id: trunk@26019 -
2013-11-10 21:22:28 +00:00
nickysn
dea947f87b
* fixed tcgx86.a_op_const_ref for shl/shr/sar/rol/ror on i8086 and x86_64
...
git-svn-id: trunk@26018 -
2013-11-10 20:39:47 +00:00
florian
412dc6586f
* the writestr helper initializes the target string, so mark it as being written
...
before the call to the helper to get proper life information
git-svn-id: trunk@26017 -
2013-11-10 20:20:40 +00:00
florian
8be7cfa05f
* check the scope of a variable when checking dfa based uninitialized variables,
...
dfa is procedure local only so consider only variables of the current scope
git-svn-id: trunk@26016 -
2013-11-10 20:20:38 +00:00
florian
57586b69c7
* implicit try...finally frames are added after dfa so we don't have to take care if the subroutine needs/uses those or not
...
git-svn-id: trunk@26015 -
2013-11-10 20:20:36 +00:00
florian
3cb747f4a7
* mark the node which is the entry of the user code with a flag
...
* check for uninitialized variables at the node which is marked as the start of the user code
git-svn-id: trunk@26014 -
2013-11-10 20:20:27 +00:00
florian
24d88edf37
* fixes arm building after 26004
...
git-svn-id: trunk@26012 -
2013-11-10 17:46:03 +00:00
Jonas Maebe
f348e89112
- removed too early assignment of have_first_symbol:=true, making the later
...
check of "if not have_first_symbol and dosub then" always evaluate to
false (found by looking at the results of constant propagation :)
git-svn-id: trunk@26011 -
2013-11-10 15:08:28 +00:00
florian
a0f0d0de40
* make use of the noreturn directive for internalerror
...
* clean up of the internalerror procedure variable in the constexp unit
git-svn-id: trunk@26004 -
2013-11-10 09:01:03 +00:00
florian
1d4a4d0684
+ noreturn directive
...
git-svn-id: trunk@26003 -
2013-11-10 09:00:59 +00:00
nickysn
039979fdcc
* handle 4-byte records in registers as well in location_force_mem on i8086
...
git-svn-id: trunk@26002 -
2013-11-09 21:57:29 +00:00
Jonas Maebe
0302453912
* disabled the lea->add transformation added in r25907 because it breaks
...
webtbs/tw15694.pp. Such transformation require liveness analysis of
the flags
git-svn-id: trunk@26001 -
2013-11-09 18:42:23 +00:00
nickysn
b8de1370a0
* fixed assignment of i8086 method pointers, when the source is in a register
...
git-svn-id: trunk@25999 -
2013-11-09 16:50:56 +00:00
sergei
2b1e5f7014
* Mantis #17273 : don't generate x87 instructions on win64 target.
...
git-svn-id: trunk@25995 -
2013-11-08 13:31:07 +00:00
pierre
a091c26750
* Use mips everywhere for big endian mips target
...
git-svn-id: trunk@25992 -
2013-11-07 21:38:43 +00:00
nickysn
d0f988f7a8
* don't use LEA in the code generator on i8086, as this breaks it quite badly.
...
While it is possible to use 16-bit LEA on the i8086, it's probably not worth
doing it in the code generator, because of the unpleasant register
restrictions that 16-bit references have.
git-svn-id: trunk@25989 -
2013-11-07 17:00:58 +00:00
Jonas Maebe
2bb67ec47d
* corrected usage of CPUNO32BITOPS
...
git-svn-id: trunk@25988 -
2013-11-07 15:20:15 +00:00
florian
bbabb77ec9
* disable 32 bit operation optimization for powerpc64
...
git-svn-id: trunk@25979 -
2013-11-06 21:11:08 +00:00
florian
424d5cafb2
* cleanup
...
* handling of result node simplified
git-svn-id: trunk@25978 -
2013-11-06 21:11:06 +00:00
florian
cca520abd9
+ warn for uninitialized out parameters when dfa is enabled
...
git-svn-id: trunk@25977 -
2013-11-06 21:11:03 +00:00
florian
722c59bcb1
* use the correct node in CalcLife
...
git-svn-id: trunk@25976 -
2013-11-06 21:11:01 +00:00
florian
2fc4a7fdd7
* better DFA debugging information
...
git-svn-id: trunk@25975 -
2013-11-06 21:10:58 +00:00
florian
89f34965e9
* fix dfa of for nodes, loopiteration node introduced to get proper life information for the loop
...
git-svn-id: trunk@25974 -
2013-11-06 21:10:55 +00:00
florian
63757c84ad
* fix life information of block nodes
...
git-svn-id: trunk@25973 -
2013-11-06 21:10:52 +00:00
florian
1e4737c46d
* fix life information of for nodes
...
git-svn-id: trunk@25972 -
2013-11-06 21:10:50 +00:00
florian
31f3bb900c
* fix UpdateLifeInfo if n<>node
...
git-svn-id: trunk@25971 -
2013-11-06 21:10:48 +00:00
florian
1f05011113
* set successor of blocknodes properly
...
git-svn-id: trunk@25970 -
2013-11-06 21:10:45 +00:00
florian
b3c2a8ddb1
* set always resultnode as last node
...
git-svn-id: trunk@25969 -
2013-11-06 21:10:43 +00:00
florian
0a762e416f
* always create a resultnode, also for procedures
...
git-svn-id: trunk@25968 -
2013-11-06 21:10:40 +00:00
florian
1fb3c2e0c2
* the successor of the last node is the resultnode if one exists
...
* create def/use info for temp. nodes
git-svn-id: trunk@25967 -
2013-11-06 21:10:38 +00:00
florian
20942d8b45
* fix life information generation of for nodes
...
git-svn-id: trunk@25966 -
2013-11-06 21:10:34 +00:00
florian
fa8abf7fcb
* handle constructors correctly during dfa: the result note must point to self
...
* handle inline nodes correctly during dfa: they can create/destroy defs
git-svn-id: trunk@25965 -
2013-11-06 21:10:32 +00:00
florian
6f03d04fe1
* when using a pointer as array, the pointer is never written, only read
...
git-svn-id: trunk@25964 -
2013-11-06 21:10:30 +00:00
florian
9fdd64e94c
* indention and new line fixes
...
git-svn-id: trunk@25963 -
2013-11-06 21:10:28 +00:00
florian
1a4584f4c6
+ dead store elimination, based on a patch by Jeppe Johansen
...
git-svn-id: trunk@25962 -
2013-11-06 21:10:26 +00:00
florian
aef0841fe4
* unified internalerror
...
git-svn-id: trunk@25961 -
2013-11-06 21:10:23 +00:00
florian
b928b1e9c9
* reorganized generic optimization switches
...
git-svn-id: trunk@25959 -
2013-11-06 21:10:17 +00:00
florian
e8787c4b48
+ constant propagation, based on a patch by Jeppe Johansen
...
git-svn-id: trunk@25958 -
2013-11-06 21:10:15 +00:00
florian
d39b9059d6
* improve simplification of arithmetic nodes, based on a patch by Jeppe Johansen
...
git-svn-id: trunk@25957 -
2013-11-06 21:10:13 +00:00
Jonas Maebe
3ed60082d3
* don't generate typed constant initialisers for set and enum constants
...
declared local to functions on the JVM target, because we don't generate
field constants for them (fixes run time error when declaring a symbolic
enum/set constant in a function on the JVM target)
git-svn-id: trunk@25953 -
2013-11-06 16:10:58 +00:00
Jonas Maebe
3c7ad95f7d
* simplified RegInInstruction() and fixed range errors
...
git-svn-id: trunk@25950 -
2013-11-06 10:46:22 +00:00
Jonas Maebe
98a230d20f
* don't call swapendian for shortint (it's 1 byte -> upcast to word and then
...
swapped, which is wrong)
git-svn-id: trunk@25949 -
2013-11-06 09:44:29 +00:00
Károly Balogh
628149d923
support label offsets for ARM like GAS, allows things like ADR r4, .label + 256
...
git-svn-id: trunk@25938 -
2013-11-05 18:10:54 +00:00
Károly Balogh
b67e4fb8b3
added the ADR ARM pseudo instruction to instruction list
...
git-svn-id: trunk@25936 -
2013-11-05 13:16:33 +00:00
florian
b147693cc5
* comment updated
...
git-svn-id: trunk@25913 -
2013-11-01 20:22:46 +00:00
florian
1843ed59b5
* set p to a valid instruction
...
git-svn-id: trunk@25912 -
2013-11-01 20:09:28 +00:00
florian
ce9398f8d8
* do not reuse register on x86 either
...
git-svn-id: trunk@25911 -
2013-11-01 20:08:30 +00:00