Commit Graph

350 Commits

Author SHA1 Message Date
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
nickysn
5d75bf4f92 * always use IMUL instead of MUL on i386, when doing a 32->32 multiplication
without overflow checking

git-svn-id: trunk@26498 -
2014-01-18 02:56:51 +00:00
nickysn
820b667e1b - rm the OP_IMUL to SHL optimization from tcgx86.a_op_const_reg and tcgx86.a_op_const_ref, because it's already done in optimize_op_const, which is called in the beginning of both methods.
git-svn-id: trunk@26491 -
2014-01-17 18:34:13 +00:00
florian
e210d5f30e + cpu_capabilites for x86_64 and i386
* take advantage of bmi2 instruction rorx

git-svn-id: trunk@26482 -
2014-01-16 21:47:28 +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
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
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
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
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
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
florian
7fc1d70e49 * do reg2=reg1*const by lea if possible
git-svn-id: trunk@25908 -
2013-11-01 19:01:36 +00:00
florian
3c58cad96b * make use of lea if possible
git-svn-id: trunk@25898 -
2013-11-01 19:01:11 +00:00
nickysn
67fdcb02f2 * in tcgx86.make_simple_ref, on the i8086, emit 'mov es, reg', instead of
'push reg/pop es', since that is a lot faster on 8088..80386

git-svn-id: trunk@25700 -
2013-10-06 19:52:38 +00:00
nickysn
6be9627e74 * use all kinds of copy and not just copy_string in Tcgx86.g_concatcopy, when
segments are specified on the i8086

git-svn-id: trunk@25698 -
2013-10-06 19:04:13 +00:00
nickysn
bd0585274e * tsettings.enablecld converted to a targetswitch ts_cld
git-svn-id: trunk@25592 -
2013-09-28 13:41:58 +00:00