Commit Graph

16458 Commits

Author SHA1 Message Date
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
Károly Balogh
a82a3ec38e let the assembler decide about the size of the Bcc and BRA instructions, this makes code generated here work on a 68000 (and probably a lot smaller in size, no more forced 32bit displacements)
git-svn-id: trunk@27084 -
2014-03-10 18:50:05 +00:00
Károly Balogh
6bd062b59f according to the M68K PRM and also GNU AS, plain 68000 has no BRA.L
git-svn-id: trunk@27083 -
2014-03-10 18:36:10 +00:00
Károly Balogh
075645d2b3 do not generate zero divisor checks if a divisor is a constant
git-svn-id: trunk@27082 -
2014-03-10 18:16:17 +00:00
Károly Balogh
1e65caa37a fixed the 68020 codepath for emit_div/mod
git-svn-id: trunk@27081 -
2014-03-10 18:01:53 +00:00
Károly Balogh
73f8c956e0 don't save the FP explicitly on a syscall, as they preserve all regs anyway except scratch regs
git-svn-id: trunk@27078 -
2014-03-10 13:39:51 +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
Károly Balogh
875a7418b3 disable broken 68020 codepath and fall back to generic until it gets fixed
git-svn-id: trunk@27070 -
2014-03-10 01:36:05 +00:00
Károly Balogh
9e74fd4d33 include libsym handling for m68k as well, Amiga needs it
git-svn-id: trunk@27066 -
2014-03-10 00:32:57 +00:00
Károly Balogh
7e1051324d include exec on Amiga only in the implementation part
git-svn-id: trunk@27065 -
2014-03-09 23:05:13 +00:00
Károly Balogh
9ec1d4ee89 fixed spilling operation type for some ColdFire instructions
git-svn-id: trunk@27064 -
2014-03-09 23:04:28 +00:00
nickysn
b4bb09254e * use a 16-bit integer for property indexes on 16- and 8-bit targets
git-svn-id: trunk@27062 -
2014-03-09 21:25:31 +00:00
nickysn
dcc2354760 * disallow 64-bit property index specifiers on 64-bit CPUs, since they were not
handled correctly there anyway (they were silently truncated to 32-bit)

git-svn-id: trunk@27061 -
2014-03-09 21:05:53 +00:00
pierre
044891fd94 Avoid range check error in a_op_const_reg_reg
git-svn-id: trunk@27060 -
2014-03-09 19:49:29 +00:00
florian
2c5a0ffc89 * make windres the default resource compiler on x86_64-win64
git-svn-id: trunk@27041 -
2014-03-09 10:52:10 +00:00
florian
08a4e1efe1 * handle for ... in on arrays of constant correctly, resolves also #25838
+ tests

git-svn-id: trunk@27039 -
2014-03-09 09:03:22 +00:00
sergei
9c54cdc85d * x86: Cleaned out addr_far,addr_far_ref used to encode far calls/jumps. NASM (and FPC x86 assembler based on it) already have opsize=S_FAR for this purpose.
git-svn-id: trunk@27037 -
2014-03-08 22:54:43 +00:00
florian
7eace968e7 + UNICODESTRINGS feature flag
git-svn-id: trunk@27026 -
2014-03-07 21:25:38 +00:00
pierre
7b359d06c4 Use GNU ar also for x86_64 solaris
git-svn-id: trunk@27022 -
2014-03-07 12:39:48 +00:00
Jonas Maebe
009c96a0bd * fixed setting up the global switch for main programs without a "program"
header on platforms not in systems_unit_program_exports

git-svn-id: trunk@26975 -
2014-03-06 18:41:03 +00:00
Jeppe Johansen
10522e9779 Disabled a_adjust_sp optimized steps for now.
Integrated proper stack frame calculation.
Changed rjmp to jmp in ATMEGA128 interrupt vectors.

git-svn-id: trunk@26964 -
2014-03-05 19:17:46 +00:00
Jonas Maebe
98517b9ac9 * set imaginary register start for JVM at register number 2, since there
are only 2 (fake) "real" registers

git-svn-id: trunk@26957 -
2014-03-04 19:42:43 +00:00
Jonas Maebe
ffac2feb59 * since we only build the deref for tprocdef.localst when we're
going to write it to the ppu since r26083, also only deref it
    if that's the case (mantis #25814)

git-svn-id: trunk@26956 -
2014-03-04 19:42:39 +00:00
nickysn
9743a9122d * moved creation of voidpointertype, so that voidpointertype.size is available
earlier

git-svn-id: trunk@26951 -
2014-03-04 14:10:02 +00:00
sergei
87684e1cf1 * MIPS: clean up
git-svn-id: trunk@26946 -
2014-03-04 08:42:45 +00:00
Jeppe Johansen
7fdb125356 Added AVR support to fpc and root Makefile.
Rebuilt root Makefile.

git-svn-id: trunk@26944 -
2014-03-04 08:02:10 +00:00
Jeppe Johansen
2227045e23 Replace forbidden chars in more places in the GAS assembler writer.
Add support for .set and .weak on AVR.
Fix 64 bit negation on AVR.
Add cpu_capabilities to cpuinfo.pas and fixed some peephole optimizations.
Pass >4 byte parameters by reference.

git-svn-id: trunk@26943 -
2014-03-04 08:01:23 +00:00
sergei
5e8f8f4755 * Use GOT-relative constants for i386 PIC jump tables, they don't need runtime relocations. Now almost ABI-compliant on Linux/BSD (Darwin targets unchanged). Also clean up i8086-specific stuff: using tai_const.create_type_sym(aitconst_ptr,...) generates near pointers on i8086, which is the desired goal.
git-svn-id: trunk@26942 -
2014-03-03 21:06:49 +00:00
sergei
d613ab8578 * x86: improve x87 qword to float conversion, using single-precision constants saves space and removes need in separate load on FPU stack. No precision loss occurs because 2**64 is representable exactly even in single precision.
git-svn-id: trunk@26941 -
2014-03-03 20:41:42 +00:00
Károly Balogh
13210ff7d4 use MVZ/MVS ColdFire instructions to load constants where applicable
git-svn-id: trunk@26935 -
2014-03-03 00:53:52 +00:00
nickysn
2908fa9123 + added type parentfpvoidpointertype, which is a void pointer with the same size
as the hidden parentfp parameter, passed to nested procs. On i8086 it is
  always a near pointer, unlike voidpointer (which changes according to the
  memory model). This fixes nested procs in i8086 far data memory models.

git-svn-id: trunk@26934 -
2014-03-02 22:55:52 +00:00
nickysn
9321d9916d * use voidpointer.size instead of sizeof(pint) in tparamanager.push_size in
order to properly support i8086 far data memory models

git-svn-id: trunk@26933 -
2014-03-02 22:51:37 +00:00
nickysn
229ebf33a8 + support getting the address of far references on i8086 in
tcgx86.a_loadaddr_ref_reg

git-svn-id: trunk@26932 -
2014-03-02 22:21:16 +00:00
Jeppe Johansen
66f5b71fe9 Fixed passing of 32bit arguments on 8-bit architectures.
Added initial RTL startup code for AVR.

git-svn-id: trunk@26931 -
2014-03-02 20:53:21 +00:00
florian
23c724f885 * prevent a temp. register allocated during spilling being immediately spilled again, resolves #25164
git-svn-id: trunk@26930 -
2014-03-02 19:47:05 +00:00
nickysn
cb0f7e265d + fixed get_frame for i8086 far data memory models
git-svn-id: trunk@26929 -
2014-03-02 19:36:35 +00:00
nickysn
75134c2a26 + default_x86_data_pointer_type implemented as function that returns the proper
type in far data memory models

git-svn-id: trunk@26928 -
2014-03-02 19:35:36 +00:00
nickysn
a7117a6157 + enabled the compact and large i8086 memory models (they don't work yet, so
that's why they're not added to the compiler help screen yet)

git-svn-id: trunk@26927 -
2014-03-02 19:26:49 +00:00
Jeppe Johansen
e33550b67d Added support for X,Y,and Z register aliases plus low/high forms, and post-incrementation in AVR assembler reader.
Cleaned up parameter and funcretloc information generation in AVR paramanger, and made it closer to GCC's calling convention.
Fixed a number of codegenerator bugs generating invalid or broken instructions: CP operands were swapped, a number of instructions had immediate operands, and stack frame epilogue wasn't complete.
Added a bunch of peephole optimizations that clears the generated code up a lot.

git-svn-id: trunk@26925 -
2014-03-02 15:37:24 +00:00
florian
68f1a51164 * set PIC defines earlier, resolve #25788
git-svn-id: trunk@26924 -
2014-03-02 15:35:08 +00:00
Károly Balogh
1d5f74fae0 m68k implementation of g_save_registers and g_restore_registers using movem.l
git-svn-id: trunk@26923 -
2014-03-02 14:58:05 +00:00
nickysn
5242ed7864 * changed TResStrInitTable.Count and TWStrInitTablesTable.Count to nativeint
git-svn-id: trunk@26921 -
2014-03-02 13:27:59 +00:00
Károly Balogh
8730b1bf45 cleaned up g_proc_exit, optimized generated code and also added some comments about possible ABI variations. the changes also fix two tests on my system related to cdecl procedures
git-svn-id: trunk@26918 -
2014-03-01 23:52:00 +00:00
Károly Balogh
bd4cc3b8f3 cleaned up, reindented, simplified and allowed some minor optimizations in tcg64f68k
git-svn-id: trunk@26914 -
2014-03-01 18:25:05 +00:00
nickysn
73e6ffe675 * the TableCount and InitCount fields in the INITFINAL table changed to
nativeint (generates smaller and more efficient code on i8086)

git-svn-id: trunk@26913 -
2014-03-01 14:33:10 +00:00
Jeppe Johansen
95589fb1e2 Apply DataMov2Data to MLA and MLS too. Those have over 4 operands.
git-svn-id: trunk@26912 -
2014-03-01 14:21:04 +00:00
nickysn
b672bc754a - rm references to system_i386_darwin and system_i386_iphonesim from
tcg8086.init_register_allocators

git-svn-id: trunk@26910 -
2014-03-01 12:52:31 +00:00
nickysn
a31b7d485f * tcg8086.init_register_allocator: instantiate trgintcpu instead of trgcpu for
the integer registers in all cases

git-svn-id: trunk@26909 -
2014-03-01 12:50:26 +00:00
nickysn
6e9083aa84 * fixed inc/dec with constant truncating the high parts of the constant on
16-bit and 8-bit CPUs

git-svn-id: trunk@26908 -
2014-03-01 10:33:14 +00:00
nickysn
fc29e10349 * allow the use of inc/dec when adding/subtracting 32 or 64-bit constants with
the highest word equal to one and the lower parts zero

git-svn-id: trunk@26907 -
2014-03-01 10:25:46 +00:00
sergei
f69e6ec389 * Some fixes to NASM writer:
* Correctly output names of sec_user sections and sec_threadvar on Windows targets
  * Use ALIGNB directive to align without warnings in bss and alike sections.
  * Do not output 'begin/end asmlist x' for empty asmlists.

git-svn-id: trunk@26898 -
2014-02-27 13:37:03 +00:00
nickysn
c00b56ae49 * added the -w-orphan-labels parameter to all tasminfo instances for nasm.
The -w-oprhan-labels option prevents the 'label alone on a line without a
  colon might be in error' warning.

git-svn-id: trunk@26889 -
2014-02-26 20:54:38 +00:00
svenbarth
47b4a52c8f Also respect the supplied version suffix when printing the compiler path name using -PB. Fixes Mantis #25791
* compiler/utils/fpc.pp:
    also apply the versionstr suffix to ppcbin if versionstr is set like is done when really executing the compiler

git-svn-id: trunk@26887 -
2014-02-26 19:13:06 +00:00
sergei
46f8e78d1f + Support GOT/gp-relative constants in GAS and internal assemblers, MIPS and i386.
* Change MIPS jump tables in PIC mode to use gp-relative constants, making them ABI-compliant and not requiring dynamic relocations.

git-svn-id: trunk@26886 -
2014-02-26 14:54:47 +00:00
sergei
31d160aaf5 * x86: clean up and place jump tables into sec_rodata on all targets. Effectively it does not change anything, because sec_rodata with relocations still go into writable data at assembler level.
git-svn-id: trunk@26885 -
2014-02-26 11:06:22 +00:00
nickysn
888ecdaee4 * fixed the type conversions of the 'and' operator to be Delphi compatible. Fixes Mantis #25179
git-svn-id: trunk@26882 -
2014-02-25 18:06:29 +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
8f6d8b849e * Generate interface wrappers together with data structures of class they belong to, and place everything into single assembler slice (since all wrappers are always referenced by VPTR, attempting to smartlink them is useless). This removes separate iteration pass over symtables and reduces amount of smartlink files.
git-svn-id: trunk@26868 -
2014-02-24 15:33:15 +00:00
Károly Balogh
0591caf022 have an explicit define for OS4, so we can easily identify it in shared sources among Amiga-like systems, independent from the CPU define
git-svn-id: trunk@26859 -
2014-02-23 23:49:40 +00:00
svenbarth
2a65c05a8c Clean up dead code.
m68k/n68kcnv.pas:
  - pass_generate_code is used from the parent class
  - ungetcpuregister is not needed here

git-svn-id: trunk@26848 -
2014-02-22 21:29:31 +00:00
svenbarth
908c0f7293 M68k: Correctly handle the case of assigning a Boolean expression to a 64-bit Boolean. Fixes tw20889.
* m68k/n68kcnv.pas, tm68ktypeconvnode.second_int_to_bool:
    Take an inspiration from the x86 code generator and correctly handle assignment of values with a size < 8 to 64-bit Booleans

git-svn-id: trunk@26847 -
2014-02-22 21:27:19 +00:00
florian
6697939903 * replaced some aren't, weren't, can't by are not, were not, cannot
git-svn-id: trunk@26842 -
2014-02-22 16:07:27 +00:00
florian
76b2074e59 * updated year in logo from 2013 to 2014
git-svn-id: trunk@26841 -
2014-02-22 15:58:03 +00:00
florian
13cb468a8e * fixed modification information for some avx instructions
git-svn-id: trunk@26840 -
2014-02-22 15:52:33 +00:00
svenbarth
0321a77d72 Fix the generation of alignment instructions for m68k. This not only fixes quite some tests, but most importantly the native m68k compiler!
* aggas.pas, TGNUAssembler.WriteTree.doalign:
    instead of strangely checking for the previous instruction always use .balignw if the previous code was code and we should not use a specific instruction

git-svn-id: trunk@26839 -
2014-02-22 15:36:30 +00:00
florian
c00d752813 + create avx code in abs as well
* improved abs code generation with sse(2)

git-svn-id: trunk@26838 -
2014-02-22 15:35:14 +00:00
svenbarth
435dec656f * m68k/n68kcnv.pas, tm68ktypeconvnode.second_int_to_bool:
use the size of the destination instead of the source for the destination register; fixes tenum6

git-svn-id: trunk@26835 -
2014-02-22 14:35:30 +00:00
florian
ab3f5744e0 * skip dec/inc type checking in unspecialized generic methods, resolves #25603
git-svn-id: trunk@26830 -
2014-02-22 09:20:57 +00:00
Károly Balogh
31ec76422a redirect .s files to the RAM: drive on Amiga while compiling
git-svn-id: trunk@26829 -
2014-02-22 08:43:11 +00:00
Károly Balogh
74533a7c90 avoid generating addressing like <label>+8(aX), since this might fail during linking if label is more than 32k away, fixes linking with lineinfo unit here
git-svn-id: trunk@26826 -
2014-02-22 02:12:03 +00:00
svenbarth
60a07770f1 Fix cycling after addition of the new case simplification.
nset.pas, tcasenode.simplify: don't assume a specific order of the case labels

+ added test based on ppu.pas, tppu.getaint where no matching case label was found because of the ordering

git-svn-id: trunk@26825 -
2014-02-21 22:49:19 +00:00
svenbarth
500920030b Implement simplification of ordinal case nodes if the case expression is constant (might be useful when inlining).
+ nset.pas, tcasenode: add simplify method; for ordinal constant case expressions either return a copy of the correct block or return a nothing node if the constant did not match anything

+ added test to check that nothing is broken

git-svn-id: trunk@26824 -
2014-02-21 20:36:41 +00:00
nickysn
83dd2aed4a * refactored the pass_typecheck code for and/or/xor/comparisons, so that the logic is simpler, but still yields exactly the same result
git-svn-id: trunk@26823 -
2014-02-21 14:55:00 +00:00
florian
6364cf412d * do not crash on invalid property declaration, resolves #23980
git-svn-id: trunk@26818 -
2014-02-19 19:44:06 +00:00
nickysn
3c332bf276 * not(is_signed(ld) xor is_signed(rd)) changed to (is_signed(ld)=is_signed(rd)) for better readability
git-svn-id: trunk@26817 -
2014-02-19 16:49:03 +00:00
Jonas Maebe
5729c9c8ef * fixed shl/shr with constant value>=32 on 64 bit platforms
git-svn-id: trunk@26809 -
2014-02-18 16:46:36 +00:00
Jonas Maebe
7033ddf679 * converted tshshrnode to thlcgobj
o make sure that the return register has the correct size

git-svn-id: trunk@26808 -
2014-02-18 16:46:29 +00:00
florian
6e1bf4d040 * properly simplify not(<const. cbool>), resolves #25255
git-svn-id: trunk@26803 -
2014-02-16 20:20:58 +00:00
florian
d185122799 * optimize type conversions away if bits has been masked by a previous and operation
git-svn-id: trunk@26802 -
2014-02-16 18:40:35 +00:00
florian
ac85d44899 * do OpCmp2OpS optimization also if after cmp follows an appropriate mov
git-svn-id: trunk@26801 -
2014-02-16 18:39:55 +00:00
florian
150363c09e * thlcgobj.a_load_regconst_subsetreg_intern takes care if the whole register is modified
git-svn-id: trunk@26799 -
2014-02-16 15:13:43 +00:00
florian
07579cf0b7 * cleanup
git-svn-id: trunk@26798 -
2014-02-16 13:15:16 +00:00
florian
3dddd01309 * do not location_force_reg in tcgshlshrnode.second_integer if left is already in a register
git-svn-id: trunk@26797 -
2014-02-16 13:15:13 +00:00
svenbarth
ddb78fefdc Add a modeswitch for type helpers as discussed in core on 24th October 2013. It is disabled by default in all modes (afterall type helper support in Delphi started only beginning with XE3)
+ globtype.pas: add new modeswitch to modeswitch enum and name array
* ptype.pas & pdecobj.pas: check for new modeswitch instead of modeswitch class
* ppu.pas: increase ppu version as we've added a new modeswitch which requires correctly compiled units

* adjusted tests to enabled the modeswitch when necessary
+ added three new tests that check for correct functionality of modeswitch typehelpers

git-svn-id: trunk@26796 -
2014-02-16 12:58:24 +00:00
sergei
da910d654c + SPARC: two more peephole optimizations
git-svn-id: trunk@26795 -
2014-02-16 12:29:31 +00:00
florian
cbefdcf887 * patch by Martin Friebe to avoid wrong debugger output, resolves #25584
git-svn-id: trunk@26794 -
2014-02-16 10:11:20 +00:00
nickysn
f04acb2db7 * parse the memory model command line options and define the FPC_MM_* macro
in the first pass of reading parameters, so that #ifdefs based on the memory
  models can be used in fpc.cfg

git-svn-id: trunk@26793 -
2014-02-16 09:59:21 +00:00
florian
1882ab8d5a * i8086 has no cpu_capabilites
git-svn-id: trunk@26791 -
2014-02-16 08:27:29 +00:00
florian
0d6cc46a5e + CPU type corei
git-svn-id: trunk@26790 -
2014-02-16 08:27:27 +00:00
florian
84f7f5f934 * popcnt has a separate cpuid flag so we should separate it from sse
git-svn-id: trunk@26789 -
2014-02-16 08:27:24 +00:00
florian
75a13f7e47 * do not allow VCOMISD/VCOMISS to use a memory location as target
git-svn-id: trunk@26774 -
2014-02-14 21:26:51 +00:00
sergei
df6837fa12 * Fixed cloning of varargs parameters in tcallnode.dogetcopy, resolves #23981.
git-svn-id: trunk@26758 -
2014-02-13 01:12:58 +00:00
sergei
ed1555b918 * Moved generation of .ent/.end directives out of generic code generator.
* Generation of .ent/.end directives for Alpha is dropped, but that target has more important issues to solve.

git-svn-id: trunk@26757 -
2014-02-12 17:30:48 +00:00
sergei
e1cf19d05d + Require -d and -u command line options to have an argument, Mantis #25082.
+ Check that argument of -d and -u is a Pascal identifier, Mantis #17056.

git-svn-id: trunk@26755 -
2014-02-12 04:44:35 +00:00
sergei
3c5345cb4e + Write 'non-executable stack' marker to object files also on FreeBSD (verified for version 9.0 for i386).
+ Write correct ABI value into ELF header for FreeBSD.

git-svn-id: trunk@26745 -
2014-02-10 05:46:46 +00:00
sergei
74089039e7 - Don't output 'begin/end asmlist xxx' comments for empty asmlists.
git-svn-id: trunk@26744 -
2014-02-09 21:29:20 +00:00
florian
37b34edbc6 * do not reuse registers when calculating addresses in pic mode
git-svn-id: trunk@26743 -
2014-02-09 21:12:07 +00:00
sergei
07ce8f46a4 * loadvmtaddrnode accesses global data only when left.nodetype=typen.
git-svn-id: trunk@26742 -
2014-02-09 17:44:14 +00:00
florian
25fc10b556 * do not store references to dyn. arrays
git-svn-id: trunk@26741 -
2014-02-09 08:41:51 +00:00
florian
3e4198ea45 * take care of dyn. arrays in cse
git-svn-id: trunk@26740 -
2014-02-08 21:47:46 +00:00
florian
a8643410c4 * fix trgx86.do_spill_replace for bmi rotating/shifting instructions
git-svn-id: trunk@26739 -
2014-02-08 21:38:23 +00:00
florian
be0a29da95 * fix modification information for bmi instructions
git-svn-id: trunk@26738 -
2014-02-08 21:38:21 +00:00
florian
9d84b83475 * fix comment
git-svn-id: trunk@26737 -
2014-02-08 21:38:18 +00:00
sergei
d7c7ee2c2a * MIPS: fixed 8/16 bit arithmetic shifting to be done without using an additional register.
git-svn-id: trunk@26736 -
2014-02-08 21:13:58 +00:00
sergei
d29300df13 * tMIPSELnotnode.second_boolean: reuse common handle_locjump method.
git-svn-id: trunk@26735 -
2014-02-08 21:10:01 +00:00
yury
e0c8a4701e * Fixed compilation for mips-linux.
git-svn-id: trunk@26732 -
2014-02-08 19:08:21 +00:00
florian
e5aa0e4316 * set pi_uses_exceptions flag only if the try...finally frame is not an implicit frame
git-svn-id: trunk@26731 -
2014-02-08 16:43:23 +00:00
florian
1df293679d * fixed setting of pi_uses_exception flags and unified usage, they should be set in pass_1
git-svn-id: trunk@26729 -
2014-02-08 14:59:07 +00:00
florian
53ddaf03ff * fixes masking error in tx8664shlshrnode.pass_generate_code
* cleaned up tx8664shlshrnode.pass_generate_code and fix register loading of the right node, resolves #25664

git-svn-id: trunk@26716 -
2014-02-08 10:15:47 +00:00
florian
1366498255 + nf_addr_taken: it marks nodes which address is taken
+ check if tnodeflags is 4 bytes or less
* do not do cse on expressions which address is taken

git-svn-id: trunk@26713 -
2014-02-07 20:40:42 +00:00
yury
c58340f8dd * Enabled safecall for mips.
git-svn-id: trunk@26709 -
2014-02-07 14:12:33 +00:00
yury
73c26bd6be * mipsel-android: Regenerated makefiles. From now the mipsel-android target can be built and used.
git-svn-id: trunk@26705 -
2014-02-07 12:37:17 +00:00
masta
2d2cab0e7a Fix some internalerror codes in the ARM CG
git-svn-id: trunk@26701 -
2014-02-07 12:15:08 +00:00
florian
30352c7f7b * fix several issues with loop strength reduction to make it working
* debugging code for strength reduction

git-svn-id: trunk@26694 -
2014-02-06 20:48:19 +00:00
florian
c5523fc780 * do not search a node tree which has been found being subject to cse further on
git-svn-id: trunk@26691 -
2014-02-06 19:27:11 +00:00
yury
bb269e53ac * mipsel-android: Don't export local symbols from executable.
git-svn-id: trunk@26690 -
2014-02-06 19:11:08 +00:00
yury
56b3287e29 + Added compiler support for mipsel-android target.
git-svn-id: trunk@26686 -
2014-02-06 17:02:43 +00:00
sergei
52af9a2c89 * Changed passing of hidden parameters to constructors of class-style objects: VMT is always passed in the first ('self') parameter, and the second one ('vmt', although this name is now misleading) contains flag specifying the constructor behavior and meaning of 'self'. Together with r26656 this removes methodpointer sharing between two parameter node trees, it becomes possible not to put methodpointer into temp, but use node tree below 'self' parameter to do virtual calls. This also matches behavior of Delphi.
git-svn-id: trunk@26683 -
2014-02-06 12:26:47 +00:00
florian
829764e96b + replace registers to spill in mov instructions and convert them into ldr/str
git-svn-id: trunk@26677 -
2014-02-05 18:19:41 +00:00
sergei
a1dfaa54dd * Fixed exception handling in constructors of TP-style objects to correctly handle cases of statically allocated objects (must call destructor but do not free memory) and objects without destructor (must free memory if it was allocated dynamically).
+ Test extended.

git-svn-id: trunk@26676 -
2014-02-05 18:19:13 +00:00
Jonas Maebe
a1eb9a0f99 * fixed spilling of CMOVcc instruction: it "reads" operand two (in the sense
that the value of operand two is used/kept in case the condition is false)
    (fixes mantis #25672)

git-svn-id: trunk@26674 -
2014-02-05 00:27:21 +00:00
Jonas Maebe
ba5297be37 * support disabling the i386 peephole optimizer with -Oonopeephole
git-svn-id: trunk@26673 -
2014-02-05 00:27:16 +00:00
florian
9e4c130bc4 * do not allocate unnecessarily an extra pair of registers when multiplying int64s on arm
git-svn-id: trunk@26672 -
2014-02-04 22:02:51 +00:00
Jeppe Johansen
6861cbcf16 Allow FoldShiftLdrStr for all sizes of LDR/STR, and disable it for references that post/pre increment the base register on Thumb-2 targets.
git-svn-id: trunk@26671 -
2014-02-04 17:29:13 +00:00
masta
a72a3f4e01 Little cleanup after r26669, no functional changes
git-svn-id: trunk@26670 -
2014-02-04 08:04:08 +00:00
masta
80d2ee8ad0 Don't reuse registers on ARM 64 bits shift
git-svn-id: trunk@26669 -
2014-02-03 23:47:28 +00:00
sergei
9c1f917e3a * a_call_ref functionality cannot be implemented efficiently at code generator level, because references need specific preparations at earlier points. Moved this support to tcgcallnode and its x86 descendants, and got rid of all ifdef's around.
+ x86 targets now directly call procedure variables located in references.
- a_call_ref method removed from tcg and thlcgobj.

git-svn-id: trunk@26666 -
2014-02-03 13:28:56 +00:00
sergei
0d3f36eebf - Remove references to global variable 'cg' from methods of tcg and some of its descendants.
git-svn-id: trunk@26665 -
2014-02-03 12:27:48 +00:00
sergei
7104157a57 * Changed tabstractprocdef.address_size to return the def, which can be used to get other properties like size and alignment. Removes one of i8086 ifdef's.
git-svn-id: trunk@26664 -
2014-02-03 10:47:54 +00:00
sergei
53556f529d * gen_alloc_symtable: don't use current_procinfo.procdef, the necessary procdef is passed in 'pd' parameter.
git-svn-id: trunk@26663 -
2014-02-03 10:21:56 +00:00
sergei
949907f1f3 * Don't emit "Temps allocated between..." comment in assembler listing if procedure has no temps.
git-svn-id: trunk@26660 -
2014-02-03 09:55:46 +00:00
sergei
e0082262cc * Don't generate VMT checking code twice (gen_load_vmt_register generates it already).
git-svn-id: trunk@26657 -
2014-02-03 00:27:05 +00:00
sergei
a5d5ce8eb2 * TP-style object destructors do not need actual VMT in hidden parameter, a constant flag indicating need to free memory is sufficient.
* Destructor called from exception block in constructor must have this flag set in order to free memory.
+ Test.

git-svn-id: trunk@26656 -
2014-02-03 00:20:42 +00:00
Jonas Maebe
868b4f50e9 * use spilling_operation_type() instead of a big table to determine whether
instructions overwrite operand 0 (fixes wrongly handled rlwimi and some
    others, and also adds support for loads/stores)

git-svn-id: trunk@26653 -
2014-02-02 15:32:54 +00:00
Jonas Maebe
de0ced1522 * A_INSLWI, A_INSLWI_, A_INSRWI, A_INSRWI_ also modify operand 0
git-svn-id: trunk@26652 -
2014-02-02 15:32:00 +00:00
Jonas Maebe
6a4afd3a33 * changed uses of "exit" in constructors to if/then constructs, to
avoid the constructor result/SSA bug in 2.6.x

git-svn-id: trunk@26651 -
2014-02-02 09:09:51 +00:00
Jonas Maebe
4e9c54278e * the function result of constructors always is self, always is valid and is
not stored in procdef.funcretsym -> fix check so that SSA is not performed
    on it in constructors when exit is used

git-svn-id: trunk@26650 -
2014-02-02 09:09:44 +00:00
florian
e6b68d19c8 * reordered decision how arguments for inlining are handled
* improved comments for inline argument handling
* replace arguments more aggressively with a copy of their original node tree when inlining

git-svn-id: trunk@26649 -
2014-02-01 22:26:23 +00:00
Jeppe Johansen
07b2982e77 Don't do ARM FoldShiftLdrStr peephole optimization if there's an offset in the reference.
Use UXTH+UXTB instructions instead of two shifts on processors that supports that.
Eliminate internalerror when constant pointers are typecast as arrays.

git-svn-id: trunk@26647 -
2014-02-01 13:29:35 +00:00
florian
2a7dcf6c7b * formatting
git-svn-id: trunk@26646 -
2014-02-01 13:08:30 +00:00
florian
e3f9982ee1 * make_not_regable is a matter of code generation so do it in pass_1
git-svn-id: trunk@26645 -
2014-02-01 13:08:28 +00:00
florian
fbcfb63826 + implement tcasenode.pass_typecheck
git-svn-id: trunk@26644 -
2014-02-01 13:08:26 +00:00
florian
d71bfe4c6f * var parameters can be put in registers if the callee is inlined
git-svn-id: trunk@26643 -
2014-02-01 13:08:24 +00:00
florian
cd6f4d4469 * fix tsubscriptnode to handle left.location being an fpu or mm register as well.
git-svn-id: trunk@26642 -
2014-02-01 13:08:21 +00:00
masta
81517fdf70 Rerun peephole optimizers on the whole block
Up until now if a peephole optimizer matched we've only restarted from
the current instruction. This patch restarts optimizations on the whole
block if the previous run had at least one match.

As this can take considerable time this will only be enabled if -O3 or
higher is specified.

git-svn-id: trunk@26640 -
2014-01-31 23:21:52 +00:00
masta
3f8549365a Don't schedule LDRD on ARM
The load scheduler does not handle LDRD correctly right now, but it does
not prevent A_LDR with PF_D set from beeing scheduled.

git-svn-id: trunk@26637 -
2014-01-30 21:53:03 +00:00
florian
28a8dc42c6 * fix tcgx86.a_op_reg_reg on x86-64 and make use of it
git-svn-id: trunk@26636 -
2014-01-30 20:24:41 +00:00
florian
7d7bf1d877 + make use of SHLX/SHRX on CPUs supporting BMI2
git-svn-id: trunk@26635 -
2014-01-30 20:24:39 +00:00
florian
8fba876904 * apply cse to static symbols on x86-64 as well, if their address can be stored
git-svn-id: trunk@26634 -
2014-01-30 20:24:36 +00:00
florian
d8c0f11ff9 + cs_userbp optimizer switch, so on x86-64 the compiler can make use of rbp if it is not needed as frame pointer
git-svn-id: trunk@26633 -
2014-01-30 19:44:17 +00:00
florian
a3f58e84be * rbp can be used for normal purpose under certain conditions so it shouldn't interfere with all other registers
git-svn-id: trunk@26632 -
2014-01-30 19:44:14 +00:00
florian
546f4a5d46 * force records with LOC_CONSTANT into memory when they are subscripted
git-svn-id: trunk@26630 -
2014-01-30 19:44:09 +00:00
florian
1d73f49330 * do not force the index location to a register for vec. nodes if the index is already in a register
git-svn-id: trunk@26629 -
2014-01-30 17:34:35 +00:00
florian
cd235d8409 + simplify shl/shr x, if (x mod bitsizeof(left))=0
git-svn-id: trunk@26628 -
2014-01-30 17:34:33 +00:00
florian
b1f54b2853 * indentation fixed
git-svn-id: trunk@26627 -
2014-01-30 17:34:31 +00:00
florian
8989a40b4f * more flags to mark changes fixed
git-svn-id: trunk@26626 -
2014-01-30 17:34:28 +00:00
florian
809549a31f * addr nodes can be also considered in cse
git-svn-id: trunk@26625 -
2014-01-30 17:19:06 +00:00
florian
3a11dd1055 * create the addr node for cse with create_internal to avoid errors when taking the address of a temp.
git-svn-id: trunk@26624 -
2014-01-30 17:19:04 +00:00
florian
fc7dc9e54c * do cse after the init/final code has been inserted, this might enable new cse opportunities
git-svn-id: trunk@26623 -
2014-01-30 17:19:01 +00:00
Jeppe Johansen
257b1affaa Fixed previous fix of LsrAnd2Lsr optimization.
Added an extra condition for <ARMv6 processors in MLA/MLS optimization.

git-svn-id: trunk@26620 -
2014-01-29 22:22:58 +00:00
Jeppe Johansen
f773334374 Fixed LsrAnd2Lsr peephole optimization for ARM.
git-svn-id: trunk@26619 -
2014-01-29 21:35:28 +00:00
Jonas Maebe
859676d7d3 * fixed r26519 for darwin/x86-64, see comments (mantis #25644)
git-svn-id: trunk@26618 -
2014-01-29 21:26:45 +00:00
Jonas Maebe
c05da62b0e * detect static data use by record methods and methods of nested classes/
records, so we avoid inlining them (mantis #25598)

git-svn-id: trunk@26617 -
2014-01-29 21:26:38 +00:00
Jonas Maebe
b611882337 * some minor formatting fixes
git-svn-id: trunk@26616 -
2014-01-29 19:26:17 +00:00
Jonas Maebe
a6d28b5630 * pass on the "eval" state (whether or not subexpressions should be evaluated)
when encountering a "(" in a preprocessor expression (broken after r25465,
    mantis #25296)

git-svn-id: trunk@26615 -
2014-01-29 19:26:12 +00:00
Jonas Maebe
2f741121e9 * don't give an internal error when freeing an error token in the preprocessor
(mantis #25573)

git-svn-id: trunk@26614 -
2014-01-29 19:26:03 +00:00
Jeppe Johansen
3b4f59c316 Fixed MLA/MLS peephole optimization and moved it to the generic ARM peephole optimizer.
git-svn-id: trunk@26613 -
2014-01-29 17:28:13 +00:00
Jeppe Johansen
184baa3f99 Fixed invalid peephole optimization of ADD/SUB(SP) instructions for ARMv7*M targets.
git-svn-id: trunk@26612 -
2014-01-29 17:12:57 +00:00
Jonas Maebe
2adfb6cdda * don't endlessly recurse when printing the typename of a procvardef that
refers to itself via a pointerdef in its parameter or result type(s)
    (mantis #25551)

git-svn-id: trunk@26610 -
2014-01-28 20:14:31 +00:00
Jonas Maebe
6d5bef3e1d * removed code duplication in tpointerdef.GetTypeName
git-svn-id: trunk@26609 -
2014-01-28 20:14:28 +00:00
Jonas Maebe
89d97a3c2e * only consider tc_pointer_to_array typeconversions to determine whether a
pointer->array type conversion implies an implicit dereference operation
    (mantis #25622)

git-svn-id: trunk@26608 -
2014-01-28 20:14:24 +00:00
Jonas Maebe
9c4505045b * fixed formatting
git-svn-id: trunk@26607 -
2014-01-28 20:14:10 +00:00
masta
9e0af11ad8 Rerun the peephole optimizer after removing the current instruction.
This lets the optimizer pickup on more possible optimizations.

git-svn-id: trunk@26606 -
2014-01-28 16:00:51 +00:00
masta
57ff589ec7 Always set p to the next instruction after removing p from asml.
Some time ago we introduced GetNextInstructionUsingReg, which might
return an instruction a couple of instructions away from our current
location. Most of the code then just returned the new instruction (hp1)
instead of the instruction following p. This could prevent the peephole
optimizer from finding possible optimizations.

git-svn-id: trunk@26605 -
2014-01-28 16:00:47 +00:00
masta
c644503daf Add MovLdr2Ldr peephole optimizer for ARM
The existing LdrLdr2LdrMov optimizer will generate a lot of
sequences like this:

ldr regA, [...]
mov regB, regA
ldr regB, [regB, ...]

this now gets changed to

ldr regA, [...]
ldr regB, [regA, ...]

this saves an instruction and might open up more possibilities for the load scheduler.

git-svn-id: trunk@26603 -
2014-01-28 13:20:35 +00:00
masta
77d12f61a2 Handle LDRD and STRD correctly in RegInInstruction for ARM
LDRD and STRD only have the first even numbered register in their instruction operands,
this additional code will also check for the register following it.
Example:
  ldrd r0, [r13]

The old code will only detect r0 as in use, not the implicit r1.

git-svn-id: trunk@26602 -
2014-01-28 13:20:26 +00:00
pierre
754790f641 Use new static library not supproted message
git-svn-id: trunk@26598 -
2014-01-27 22:29:07 +00:00
pierre
6feab20b01 regenerated after: Add different message for static libraary not supported
git-svn-id: trunk@26597 -
2014-01-27 22:28:29 +00:00
pierre
b4d0cf5593 * Add different message for static libraary not supported
git-svn-id: trunk@26596 -
2014-01-27 22:26:29 +00:00
sergei
ff3fe06af9 * Changed condition around declaration of 'cgpara' to be the same as around its usage.
- Removed one of $ifdef's.

git-svn-id: trunk@26595 -
2014-01-27 01:41:51 +00:00
nickysn
5832c323b1 - don't define FPC_HAS_INTERNAL_BSF and FPC_HAS_INTERNAL_BSR on i8086. BSF/BSR
is 386+ only and the internal handling was not used anyway on i8086, due to
  some nested defines in systemh.inc missing on i8086.

git-svn-id: trunk@26592 -
2014-01-26 20:02:15 +00:00
nickysn
5e0359d389 * 16/8-bit ALU fix for 64-bit pred/succ after r26580
git-svn-id: trunk@26590 -
2014-01-26 15:44:58 +00:00
florian
48ae2d215a + concatcopy variants using sse and avx, only activated if optimization for size is done because at least on an i7-4770 it has shown no benefit
git-svn-id: trunk@26588 -
2014-01-26 12:37:54 +00:00
florian
060aa2a7fe + SSE and AVX unit cpu flags
git-svn-id: trunk@26587 -
2014-01-26 12:37:52 +00:00
florian
2ec5a649d7 * set Ch_* for more operations
* Ch_* flags for VMOVSD and VMOVSS are now set for the 2 operand variants

git-svn-id: trunk@26586 -
2014-01-26 12:37:50 +00:00
nickysn
e83ef05b74 - disable cs_opt_nodecse from -O2 on i8086, because it breaks building packages
since r26579

git-svn-id: trunk@26583 -
2014-01-26 02:08:08 +00:00
florian
c44b5d1043 * take care of tempinitcode when creating def information for tempcreatenodes
git-svn-id: trunk@26581 -
2014-01-25 09:40:51 +00:00
florian
cb8100bccf * do not reuse registers in prec/succ
git-svn-id: trunk@26580 -
2014-01-25 09:40:48 +00:00
florian
1b355ce1e4 * apply cse to all non-regable variables if possible
git-svn-id: trunk@26579 -
2014-01-25 08:50:13 +00:00
nickysn
be85998313 * fixes in optimize_op_const:
* Do the sign extension of the 'a' parameter internally in a local variable,
    so that it does not become visible outside the function.
  * Use a zero extended version of 'a' (instead of sign extension) for the
    parameter of ispowerof2().

git-svn-id: trunk@26571 -
2014-01-23 14:05:11 +00:00
Károly Balogh
2791e8ad15 use optimized cg loading functions in 64bit compares instead of hardcoded move.ls (move.l #X,dn is 48bit long, clr.l/moveq.l is 16bit long)
git-svn-id: trunk@26570 -
2014-01-23 03:03:44 +00:00
Károly Balogh
667ec17cae tiny optimization for clearing address regs
git-svn-id: trunk@26569 -
2014-01-23 02:29:45 +00:00
Károly Balogh
047395df5f implemented add/sub ops in a_op_reg_ref, since these are used often. also fixed up reference handling in a_op_const_ref a bit
git-svn-id: trunk@26568 -
2014-01-23 02:07:24 +00:00
Károly Balogh
cd4bb364e5 reenabled and fixed up tcg68k.op_const_ref a bit
git-svn-id: trunk@26567 -
2014-01-22 23:15:01 +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
masta
0736bf4ded Try to change typical constant AND-masking operations into shifts for ARM
If the constant only contains a string of ones starting from lsb or msb
we can shift out the bits accordingly, opening up some possibilities for
the peephole optimizer to fold at least one shift into another
operation.

git-svn-id: trunk@26565 -
2014-01-22 20:21:02 +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
pierre
42140bd11f Add forgotten new file, should fix bug report 25571
git-svn-id: trunk@26554 -
2014-01-21 14:17:29 +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