Commit Graph

15831 Commits

Author SHA1 Message Date
florian
80f8f66c6e * set file positions correctly in PeepHoleOptPass1
git-svn-id: trunk@25906 -
2013-11-01 19:01:31 +00:00
florian
4148637c8c * fold mov/lea/mov as well if possible
git-svn-id: trunk@25905 -
2013-11-01 19:01:29 +00:00
florian
524cde8140 + MatchReference
* refactored some code

git-svn-id: trunk@25904 -
2013-11-01 19:01:26 +00:00
florian
440cb33e80 * continue to use lea to adjust the stack pointer, it is the recommended way
git-svn-id: trunk@25903 -
2013-11-01 19:01:24 +00:00
florian
5eb578a44c * generate sub instead of add from lea if appropriate
git-svn-id: trunk@25902 -
2013-11-01 19:01:22 +00:00
florian
f56d2d4b09 * be able to replace lea by add when spilling
git-svn-id: trunk@25901 -
2013-11-01 19:01:20 +00:00
florian
d575a435c3 * some debugging infrastructure
git-svn-id: trunk@25900 -
2013-11-01 19:01:17 +00:00
florian
bfbb0c5b9d * optimize mov/lea
git-svn-id: trunk@25899 -
2013-11-01 19:01:14 +00:00
florian
3c58cad96b * make use of lea if possible
git-svn-id: trunk@25898 -
2013-11-01 19:01:11 +00:00
florian
945b318012 + get rid of unnecessary 64 bit conversions too if one of the operands is 8 or 16 bit
git-svn-id: trunk@25897 -
2013-11-01 19:01:09 +00:00
florian
d201bcb1cd * get rid of 64 bit operations on 64 bit targets as well if possible
git-svn-id: trunk@25896 -
2013-11-01 19:01:06 +00:00
florian
c8743c4826 * support 32 bit operations on x86-64 in the code generator
git-svn-id: trunk@25895 -
2013-11-01 19:01:02 +00:00
Jonas Maebe
7b97752d0b - removed commented out duplicate thlcg.getmmregister()
git-svn-id: trunk@25887 -
2013-10-31 12:30:53 +00:00
nickysn
8bfe2a56dd * optimized SAR by 31 to use only one SAR instruction in tcg8086.a_op_const_reg
git-svn-id: trunk@25883 -
2013-10-30 16:53:59 +00:00
nickysn
f288859fba * i386 optimization - remove the test/or %y, %y instruction in the sequence:
shl/sal/shr/sar $x, %y
  test/or %y, %y
  jz/jnz/setz/setnz/cmovz/cmovnz ...

git-svn-id: trunk@25881 -
2013-10-29 17:34:32 +00:00
sergei
66e82f1655 + i386: generate optimized code for 64-bit arithmetic shifts by constant amount. Shifts by 63 and by less than 32 take just two instructions, shifts by 32..62 bits are done with 3 instructions.
git-svn-id: trunk@25880 -
2013-10-29 16:10:13 +00:00
sergei
486a7ef81e * tx86inlinenode.second_popcnt: use emit_ref_reg instead of appending instruction directly, this provides proper PIC handling of the reference. emit_reg_reg part is not strictly necessary, but done for consistency.
git-svn-id: trunk@25878 -
2013-10-28 16:40:42 +00:00
sergei
6a08ca3f0b * tmoddivnode.firstoptimize improvements/fixes:
* Fixed misplaced parentheses, which were preventing optimization of "unsigned mod power_of_two" into "and" expressions.
  * Handling "signed div power_of_two": properly delete the temp node, removes warnings when compiled with "-dEXTDEBUG". This however requires another temp node for storing the result.
  * Replaced direct calls to "fpc_sarint64" with inline nodes (in_sar_x_y), allowing target-specific optimizations to take place.

git-svn-id: trunk@25877 -
2013-10-28 15:55:13 +00:00
sergei
9ad98a2c4d * Handle "SarInt64" always as internal procedure, introduced virtual method tinlinenode.first_sar that by default converts it into call to "fpc_sarint64" unless target CPU is 64-bit. This provides a point to insert target-specific optimizations.
git-svn-id: trunk@25876 -
2013-10-28 14:31:36 +00:00
nickysn
12b1e0cbfd + tell wlink to add dwarf debug info to the executable when -gw2/3/4 is used
git-svn-id: trunk@25874 -
2013-10-27 20:30:00 +00:00
nickysn
9f979eb5c6 * put the i8086-msdos dwarf debug sections in USE32 class=DWARF segments because
wlink wants them this way

git-svn-id: trunk@25873 -
2013-10-27 20:28:43 +00:00
nickysn
93a706f1a0 + allow smartlinking and dwarf debug info at the same time for i8086-msdos
git-svn-id: trunk@25872 -
2013-10-27 20:26:34 +00:00
nickysn
90a092e585 + added enum Tdwarf_addr with the values of DW_AT_address_class (to be used for
the i8086-msdos debug info)

git-svn-id: trunk@25871 -
2013-10-27 18:40:59 +00:00
Jonas Maebe
c693a91e18 * fixed compilation after r25847 (mantis #25237)
git-svn-id: trunk@25870 -
2013-10-27 17:35:04 +00:00
Jonas Maebe
353c15fb34 * fixed size of temporary register used to evaluate smallset<=/>=smallset
git-svn-id: trunk@25869 -
2013-10-27 17:34:59 +00:00
florian
17dcd2fa31 * get rid of unneeded 64 bit multiplications, it makes also for signed operations no difference if a calculation is carried out with 32 or 64 bit, if the result is casted to 32 bin again
git-svn-id: trunk@25868 -
2013-10-27 16:47:37 +00:00
florian
0eeb3e8d49 * check if the pointer is really assigned when trying to remove unneeded jumps
git-svn-id: trunk@25867 -
2013-10-27 16:47:34 +00:00
nickysn
e6a4435330 + support the aitconst_XXbit_unaligned const types in the NASM asm writer. This
fixes DWARF support when using NASM.

git-svn-id: trunk@25866 -
2013-10-27 15:21:30 +00:00
paul
d16606b04c compiler: revert r25852 since 10.9 is already handled
git-svn-id: trunk@25864 -
2013-10-27 14:17:29 +00:00
sergei
fbf6192aff * tmipsaddnode.second_addfloat: don't bother reusing locations, always allocate a new register for result.
git-svn-id: trunk@25857 -
2013-10-26 18:15:24 +00:00
sergei
dd472dbfb0 * MIPS: when converting int to real, use a floating point constant directly, instead of emulating it with integers. tai_real_64bit already handles all endian issues.
git-svn-id: trunk@25856 -
2013-10-26 18:12:25 +00:00
sergei
40239e8bcc * Elaborating removal of branches with delay slots: ignore reg. deallocations that are inserted by RA between branch and its delay slot instruction.
* Also skip possible ait_marker's between branch and its immediately following target (which was preventing certain optimizations of "exit" statements on all targets because procedure's exit label is always preceded by location marker).

git-svn-id: trunk@25855 -
2013-10-26 17:45:01 +00:00
florian
de2e4632c5 * if a build-id is generated, put it into flash
git-svn-id: trunk@25853 -
2013-10-26 14:19:14 +00:00
paul
43b9308929 compiler: also skip crt1.o for osx 10.9
git-svn-id: trunk@25852 -
2013-10-26 13:36:40 +00:00
Jonas Maebe
40eafc3d82 * don't try to post-process embedded executables when linking is
disabled

git-svn-id: trunk@25851 -
2013-10-26 10:01:05 +00:00
svenbarth
c077adf499 Fix for Mantis #25132
defcmp.pas, objectdef_is_related:
  * use "equal_defs" instead of "=", as the former also handles equivalence of specializations

+ added test

git-svn-id: trunk@25848 -
2013-10-25 19:50:56 +00:00
svenbarth
798bb91e90 Extract tdef.is_related plus its overrides in tobjectdef, trecorddef and tstringdef into a new function def_is_related in unit defcmp.
defcmp.pas:
  + add new function "def_is_related" which combines the "is_related" overloads of "tobjectdef", "trecorddef" and "tstringdef" (it returns "false" for other def types which is what "tdef.is_related" did)
  * compare_defs_ext & compatible_childmethod_resultdef: change call from "x.is_related" to "def_is_related(x,...)"
symtype.pas, tdef:
  - remove "is_related" method
symdef.pas:
  - remove "is_related" in "tobjectdef", "trecorddef" and "tstringdef"
  * tobjectdef.needs_inittable: for checking whether a Corba interface somehow inherits from a IInterface don't use "is_related" anymore (we want to avoid the dependency after all), but mimic the necessary functionality of "def_is_related"
htypechk.pas, nadd.pas, ncal.pas, ncnv.pas, ngtcon.pas, nld.pas, optvirt.pas, pdecobj.pas, pdecvar.pas, pexpr.pas, pgenutil.pas:
  * change call from "x.is_related" to "def_is_related(x,...)"
symtable.pas
  + use unit defcmp
  * change call from "x.is_related" to "def_is_related(x,...)"
jvm/njvmcnv.pas, jvm/njvmflw.pas:
  * change call from "x.is_related" to "def_is_related(x,...)"

git-svn-id: trunk@25847 -
2013-10-25 19:44:27 +00:00
Jonas Maebe
b70e64dc67 * fixed some bugs in the camelCase conversion performed on the JVM target by
-CTlowercaseprocstart
   o convert all consecutive uppercase characters at the start to lowercase
     instead of only the first one. Exception: if there is more than one
     such character and the last one is followed by a lowercase character,
     assume the last uppercase character belongs to the second word (like
     in FPCIsGreat) and don't lowercase that one
 + test

git-svn-id: trunk@25845 -
2013-10-23 22:44:45 +00:00
svenbarth
76f6de5cf1 Refactor tobjectdef.find_implemented_interface out into unit defcmp so that the recently introduced cycle between symdef and defcmp can be broken again.
defcmp.pas:
  + add function "find_implemented_interface"
  * change method call of "find_implemented_interface" into function call
symdef.pas:
  - tobjectdef: remove method "find_implemented_interface"
  - remove use of unit "defcmp"
pgenutil.pas:
  * change method call of "find_implemented_interface" into function call
  + add use of unit "defcmp"
ncgcnv.pas, ncnv.pas, pdecobj.pas, pdecsub.pas, pdecvar.pas:
  * change method call of "find_implemented_interface" into function call

git-svn-id: trunk@25844 -
2013-10-23 19:05:00 +00:00
Jonas Maebe
555634b755 * (re)set upper bits of register when appropriate for all operations in
a_op_reg_reg() (except for NOT, which was already handled correctly)
    + test

git-svn-id: trunk@25840 -
2013-10-22 07:41:52 +00:00
nickysn
a0723ccfd5 * also check if ECX is nonvolatile in is_ecx_used. Not strictly necessary for the current set of i386 calling conventions, but good as an extra safety precaution in case new calling conventions are added or the code is adapted and used on other platforms.
git-svn-id: trunk@25839 -
2013-10-21 16:48:58 +00:00
svenbarth
d908dbeec1 Fix for Mantis #25215.
compiler/scanner.pas, tscannerfile.readtoken:
  * after trying to read a _INTCONST check whether a valid first character for an identifier follows and give a syntax error if that is not the case

+ added test

git-svn-id: trunk@25835 -
2013-10-20 12:15:49 +00:00
svenbarth
d91d4afb0f Fix for Mantis #25210 .
compiler/pdecobj.pas, object_dec:
  * since revision 25518 the global symtable of the current module is no longer popped and pushed again so that the defaware symtablestack can add the helper; thus we need to do this not only for static symtables, but for global ones as well
  * adjusted comment to reflect current situation

git-svn-id: trunk@25834 -
2013-10-20 11:33:01 +00:00
nickysn
645cd11b9d * fixed the assignment of global functions to nested procvars in i8086 far code
models

git-svn-id: trunk@25831 -
2013-10-19 20:42:39 +00:00
nickysn
378afb69b2 * optimization in tcg386.g_intf_wrapper: use the much more efficient case 1
for virtual methods, that use the register calling convention, but have at
  least one free register (i.e. not used as a parameter and not required to be
  preserved by the function)

git-svn-id: trunk@25830 -
2013-10-19 17:40:38 +00:00
nickysn
bfd31e7516 * optimizations in tcg8086.g_copyvaluepara_openarray:
- when elesize=2, avoid the SHR CX,1 instruction
  - use rep movsw even for odd elesizes, unless cs_opt_size is set

git-svn-id: trunk@25829 -
2013-10-19 15:07:55 +00:00
nickysn
aca22a59f7 * optimizations in tcg386.g_copyvaluepara_openarray in order to avoid the
second IMUL

git-svn-id: trunk@25828 -
2013-10-19 12:56:58 +00:00
nickysn
0f69362edd - rm LEA reg,imm from x86ins.dat, as that's not a valid x86 instruction,
using it in inline asm causes an internal error and removing it didn't show
  any regressions after running the testsuite on i386-linux.

git-svn-id: trunk@25827 -
2013-10-18 23:26:58 +00:00
nickysn
ff9ce0d20d * tcg8086.g_copyvaluepara_openarray improvements:
- use a_op_const_reg for the multiplication, instead of emitting directly
    instructions, which are 186+
  - avoid using IMUL twice, when the element size is not power of two
  - rm the system_i386_win32 leftovers

git-svn-id: trunk@25826 -
2013-10-18 22:35:51 +00:00
nickysn
8744fbefbb * add $parentfp as a first parameter on i8086, instead of last. This makes
regular non-nested procedures compatible with nested var procvars and fixes
  the tmaclocalprocparam*.pp tests on i8086

git-svn-id: trunk@25825 -
2013-10-18 21:37:06 +00:00