Commit Graph

364 Commits

Author SHA1 Message Date
Jonas Maebe
aa1be3276f - removed default value of _typ parameter of TAsmData.(Weak)RefAsmSymbol():
it was AT_NONE, which is invalid and should never be used
  * explicitly pass the correct value for all calls to those methods elsewhere
    in the compiler

git-svn-id: trunk@34250 -
2016-08-05 07:09:16 +00:00
Jonas Maebe
1cb8c0d00c * specify the def of assembler level symbols defined via
tasmdata.DefineAsmSymbol() and all routines that call it
   o will be used to automatically generate AB_INDIRECT sybols when
     necessary

git-svn-id: trunk@34164 -
2016-07-20 20:52:59 +00:00
pierre
fb50d0860b Use BX register instead of AX to reload DS at proc entry if register convention is used
git-svn-id: trunk@34024 -
2016-06-29 20:48:51 +00:00
nickysn
c78f406d99 + implemented proper stack checking for the i8086
git-svn-id: trunk@33787 -
2016-05-24 23:57:47 +00:00
florian
d2b74be153 * always use vmov variants of instructions if avx is enabled
git-svn-id: trunk@33554 -
2016-04-24 20:03:15 +00:00
florian
a742df9035 * reverse merged r33524 as it is not safe as test results showed
--- Reverse-merging r33524 into '.':
U    compiler\i386\popt386.pas
U    compiler\x86\cgx86.pas
--- Recording mergeinfo for reverse merge of r33524 into '.':
 U   .

git-svn-id: trunk@33527 -
2016-04-17 11:33:29 +00:00
florian
f576b0c01b * make use of xor reg,reg by generating it directly instead of hoping for the peephole
optimizer which cannot do this properly due to missing information about flags. By doing
  so the size of the compiler executable gets reduced by ~1 %

git-svn-id: trunk@33524 -
2016-04-15 19:27:22 +00:00
nickysn
c4343c1a2d * don't call make_simple_ref in tcgx86.g_concatcopy on i8086, because that
screws up the handling of segmented references badly and breaks the large,
  compact and huge memory models completely

git-svn-id: trunk@33314 -
2016-03-22 13:56:10 +00:00
yury
3c6d4f1ee2 * Removed unused vars.
git-svn-id: trunk@33308 -
2016-03-21 09:21:24 +00:00
svenbarth
f297b00f5b Extend the x86 targets by the ability to handle indirect symbols.
x86/cgx86.pas, tcgx86:
  + new method make_direct_ref() which is used to convert an indirect reference into a direct one (uses the boolean field in_make_direct_ref to avoid recursive calls)
  * make_simple_ref: call make_direct_ref() before anything else
  * a_loadaddr_ref_ref: call make_direct_ref() (the loading could probably be folded into the loadaddr method, but for now that is sufficent)
i386/cgcpu.pas, tcg386:
  * a_loadaddr_ref_cgpara: call make_direct_ref(); the same remark as for a_loadaddr_ref_ref() applies here

git-svn-id: trunk@33280 -
2016-03-18 21:45:41 +00:00
svenbarth
77ede2ac9f i386/cgcpu.pas, tcg386:
* a_load_ref_cgpara: call make_simple_ref() before calling the base a_load_ref_cgpara()
x86/cgx86.pas, tcgx86:
  * a_loadfpu_ref_reg, a_loadfpu_reg_ref, g_concatcopy: call make_simple_ref() on the passed references

git-svn-id: trunk@33277 -
2016-03-18 21:22:04 +00:00
sergei
1b965e6766 * x86: Don't save/restore integer registers that are volatile per calling convention of current procedure. It implies that nothing will be saved for procedures with OLDFPCCALL, FAR16 and PASCAL and calling conventions. OLDFPCCALL restores behavior that was in effect before r25224.
git-svn-id: trunk@32542 -
2015-11-27 05:48:49 +00:00
nickysn
b26e10d53c + generate proper win16 prologue/epilogue for exported routines (we don't yet
actually export them from the .exe or .dll, but they can now be used as
  callbacks)
+ support win16 smart callbacks via the $K switch

git-svn-id: trunk@31835 -
2015-09-26 18:04:59 +00:00
yury
e04a3b4ac6 * Removed unused vars for x86 compiler.
git-svn-id: trunk@31743 -
2015-09-17 15:20:15 +00:00
florian
40a5f97239 - cclasses unit is not used
git-svn-id: trunk@31672 -
2015-09-13 21:07:21 +00:00
nickysn
bdfd23cc2e + new target switch "FarProcsPushOddBP", which causes the i8086 compiler to push
odd values of BP if the procedure is far. Enabled this by default for Win16.

git-svn-id: trunk@31569 -
2015-09-07 19:05:18 +00:00
nickysn
98ec7a2211 * eliminated the dual initialization of DS in interrupt procedures in the huge
memory model

git-svn-id: trunk@31519 -
2015-09-04 21:37:07 +00:00
nickysn
0fdc62e0f7 + initialize DS with the current unit's data segment in the function entry code
generated in the huge memory model

git-svn-id: trunk@31500 -
2015-09-03 21:44:16 +00:00
Jonas Maebe
67b8aceaee * synchronized with privatetrunk till r30095
git-svn-id: branches/hlcgllvm@30101 -
2015-03-05 20:32:15 +00:00
Jonas Maebe
2ab7f5c35d * moved x86-specific requirements from the generic bsr/bsf code to the
x86 code generator (register size constraints)

git-svn-id: trunk@29984 -
2015-02-23 22:57:18 +00:00
Jonas Maebe
fa328436ab * regenerated for iphonesim/x86-64
git-svn-id: trunk@29974 -
2015-02-23 22:56:41 +00:00
Jonas Maebe
79a06b1514 + iphonesim/x86_64 target (64 bit iOS simulator)
git-svn-id: trunk@29970 -
2015-02-23 22:56:09 +00:00
nickysn
2d3ab816b0 * Tcgx86.g_concatcopy use: copy_move (mov sequence) instead of copy_string (rep
movsb) when copying a 4 byte block on i8086, when optimizing for size. 4 movs
  are usually shorter than the instructions needed to setup rep movsb and also
  greatly reduce register pressure. This fixes i8086 snapshot building with -Os,
  Mantis #27387

git-svn-id: trunk@29639 -
2015-02-07 13:19:34 +00:00
florian
35a04ad095 * modified patch of Paul W to replace leave by mov/pop, resolves #26455
git-svn-id: trunk@29633 -
2015-02-05 20:51:12 +00:00
Jonas Maebe
b745dcc64c * moved g_external_wrapper() to the hlcg, and also g_intf_wrapper() because
for some platforms it depends on that routine

git-svn-id: branches/hlcgllvm@28492 -
2014-08-19 20:22:54 +00:00
sergei
ae627a4ba8 * tcgx86.a_op_const_reg_reg: optimize trivial cases before considering more complex ones.
git-svn-id: trunk@27892 -
2014-06-08 00:08:56 +00:00
nickysn
daf71e6d88 * fixed multiplication by 64-bit constants on x86_64, mantis #26230
git-svn-id: trunk@27822 -
2014-05-28 22:52:08 +00:00
nickysn
6e7dd647fd * Tcgx86.g_concatcopy: optimization for the case where source.segment is
specified, but equal to DS in the current memory model

git-svn-id: trunk@27720 -
2014-05-02 13:07:54 +00:00
nickysn
1eb24f9d98 + remove the segment prefix in make_simple_ref on i8086, in case it is the same
as the default segment for the reference (SS for BP-relative, DS for all
  others)

git-svn-id: trunk@27687 -
2014-04-29 23:11:10 +00:00
sergei
07e90aaa24 + Implemented IEEE 754-compliant checking for unordered results of floating-point compares on x86 targets. Mantis #9362.
git-svn-id: trunk@27581 -
2014-04-14 12:36:11 +00:00
florian
18233f2c0c * fix compilation of i8086 compiler
git-svn-id: trunk@27566 -
2014-04-13 19:28:59 +00:00
florian
d88d644925 + support for FMA intrinsic: if there is no hardware support, the compiler throws an error.
Currently it is implemented only for x86-CPUs supporting the FMA extension. While it would
  be possible to implement it in software or simulate fma(<single>,<single>,<single>) using
  double operations, it makes no sense in my opinion to do so.

git-svn-id: trunk@27564 -
2014-04-13 19:21:54 +00:00
nickysn
afcb8c3f10 * initialize DS from CS in the interrupt procedure entry code in tiny model,
because dgroup emits relocations, which results in a linker warning and broken
  code when the target format is .com file.

git-svn-id: trunk@27517 -
2014-04-10 20:02:35 +00:00
nickysn
7a873f495d * use the stack segment for SP-relative addresses in Tcgx86.g_concatcopy in
the memory models with SS<>DS (necessary, because make_simple_ref isn't called
  in the copy_string case)

git-svn-id: trunk@27479 -
2014-04-05 12:02:04 +00:00
nickysn
ee20ecfcf2 * tcgx86.make_simple_ref: in i8086 memory models with DS<>SS, add an SS: segment
override when converting SP-relative references to use a general purpose
  register

git-svn-id: trunk@27473 -
2014-04-05 08:56:40 +00:00
nickysn
b36a98ce51 + Tcgx86.g_concatcopy: added support for memory models with DS<>SS
git-svn-id: trunk@27461 -
2014-04-04 01:13:02 +00:00
nickysn
e9e4cc8bcb * Tcgx86.g_concatcopy: use boolean variables saved_ds and saved_es to keep track
whether these segment registers were saved on the stack or not

git-svn-id: trunk@27460 -
2014-04-04 00:10:36 +00:00
nickysn
096bba90da * fixed Tcgx86.g_concatcopy not using the correct push instruction size when
pushing the source segment

git-svn-id: trunk@27389 -
2014-03-30 18:09:15 +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
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
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
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
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
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
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
6b1f021fcf - Removed remaining optimizations that duplicate functionality of tcg.optimize_op_const.
- Don't call make_simple_ref if operation will be optimized away or replaced with another one, which calls make_simple_ref itself.

git-svn-id: trunk@26515 -
2014-01-19 01:19:01 +00:00
nickysn
1f7b14f38e * fixed the conversion of powerof2 mul/imuls to lea in tcgx86.a_op_const_reg_reg
git-svn-id: trunk@26509 -
2014-01-18 17:58:31 +00:00
nickysn
cc1faad3d2 + make use of the 3-operand form of IMUL on i386 and x86_64
git-svn-id: trunk@26508 -
2014-01-18 17:04:57 +00:00