Commit Graph

16875 Commits

Author SHA1 Message Date
sergei
fc5f45f65c * sqr(real) and sqrt(real): remove typeconv node inserted by initial call processing (see explanation in comments), allowing these functions to be evaluated using precision of argument. In particular, sqrt(single) and sqrt(double) now emit 'sqrtss' and 'sqrtsd' instructions on x86 targets with -Cfsse3. Non-x86 targets already have the necessary support in code generators.
* abs(real): handle the same way as sqrt and sqr, i.e. without casting to bestreal and back.

git-svn-id: trunk@27808 -
2014-05-21 14:53:47 +00:00
nickysn
feb840b47f * support reg=NR_NO in thlcgcpu.reference_reset_base on i8086. This fixes test
webtbs/tw26162.pp in the i8086 far data memory models.

git-svn-id: trunk@27807 -
2014-05-21 13:26:02 +00:00
nickysn
683478f00c + added a proper far pointer inc/dec implementation (operating only on the offset,
without touching the segment)

git-svn-id: trunk@27805 -
2014-05-19 16:24:25 +00:00
sergei
7e1c370c17 * Write RTTI for function arguments as children of function RTTI, resolves #24540,#25002,#25128 (bugs are basically duplicate, so adding only first of them to the testsuite).
git-svn-id: trunk@27797 -
2014-05-16 20:09:32 +00:00
sergei
3eec9996bc * Moved method check_hints from tmodule to tused_unit and modified it so warning messages are output with position info from associated unitsym. Resolves #25057.
git-svn-id: trunk@27795 -
2014-05-15 21:16:36 +00:00
Jonas Maebe
5e76203bc3 * don't hard-code size of linebuf entries
* use reallocmem when growing linebuf instead of getmem+move

git-svn-id: trunk@27792 -
2014-05-15 09:08:05 +00:00
florian
417d444376 * do not crash with an internal error if an indexed access is done on a constant pointer node
git-svn-id: trunk@27789 -
2014-05-14 17:35:09 +00:00
florian
a6ad604207 * compilation fixed
git-svn-id: trunk@27771 -
2014-05-11 13:57:28 +00:00
florian
0bce584bae + set defines if fast fma is available
git-svn-id: trunk@27768 -
2014-05-11 12:15:27 +00:00
Jonas Maebe
362ff5ad01 * only check for _PROPERTY as a regular token, so that
{$modeswitch properties-} also affects global properties
    (mantis #25861)

git-svn-id: trunk@27758 -
2014-05-10 16:03:02 +00:00
michael
36c662f69f * Extention -> extension (By Reinier, bug ID #25979)
git-svn-id: trunk@27750 -
2014-05-10 15:29:29 +00:00
Jonas Maebe
2075bf157e * insert JVM checkcast instructions when a voidpointer is implicitly
converted to an incompatible type

git-svn-id: trunk@27744 -
2014-05-10 12:47:34 +00:00
Jonas Maebe
ea0b9efd20 + support for simplifying empty try-except statements
o required for the JVM target, as exception tables with start=end
     are invalid there

git-svn-id: trunk@27742 -
2014-05-10 12:47:28 +00:00
Jonas Maebe
5fa09fa2f4 * changed tcallnode.fforcedprocname from shortstring into tsymstr,
so it doesn't truncate mangled names for the JVM target (it's
    used there since r27149)
   o adapted a number of WPO helpers to use tsymstr instead of
     shortstring, but the WPO devirtualization functionality is
     still limited to shortstrings internally

git-svn-id: trunk@27741 -
2014-05-10 12:47:25 +00:00
Jonas Maebe
9f6d6f4aa8 * copy tcallnode.fforcedprocname field
git-svn-id: trunk@27740 -
2014-05-10 12:47:22 +00:00
Károly Balogh
2d38cf0dbd assemble: don't include exec directly, but use GetProcessID to generate the unique file ID, because that maps to exec/FindTask on Amiga anyway
git-svn-id: trunk@27737 -
2014-05-04 23:16:52 +00:00
Károly Balogh
633eeb79ed m68k/ra68kmot.pas: fixed a pointer to signed int cast warning, so it now compiles with warnings on
git-svn-id: trunk@27735 -
2014-05-04 22:22:03 +00:00
Károly Balogh
3b787b7187 m68k/ra68k.pas: fixed some multi level comment warnings, so it now compiles with warnings on
git-svn-id: trunk@27734 -
2014-05-04 22:21:24 +00:00
Károly Balogh
94d1a04422 m68k/cpuasm.pas was an empty and unused file since the first SVN commit. other platforms also doesn't have such file, so removed.
git-svn-id: trunk@27733 -
2014-05-04 21:51:15 +00:00
Jonas Maebe
13fbf5b6ef * fixup for r27725: limit change to subn
git-svn-id: trunk@27732 -
2014-05-04 11:40:32 +00:00
nickysn
89e9fac562 * TVMTBuilder.intf_allocate_vtbls: fixed the Ioffset calculation in i8086 far
data memory models

git-svn-id: trunk@27728 -
2014-05-03 17:05:50 +00:00
Jonas Maebe
e704dd8d74 * treat "u32bit-u32bit" as a signed value when removing automatic
64 bit upcasts, as the result can be negative when evaluated in
    64 bit (reported on irc, please file bug reports)

git-svn-id: trunk@27725 -
2014-05-03 15:06:16 +00:00
nickysn
791cd932fd + support i8086 far data memory models in tcg8086.g_intf_wrapper
git-svn-id: trunk@27722 -
2014-05-03 14:17:54 +00:00
florian
8207e0ef22 + make use of vfnmsub*/vfmsub*/vfnmadd* instructions if possible
git-svn-id: trunk@27721 -
2014-05-02 21:07:46 +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
906d828ee0 * tcg8086.g_copyvaluepara_openarray: fix for the case where ref.segment is
specified, but equal to DS in the current memory model -> call the high level
  code generator with a near pointer type in order to force the segment to be
  ignored

git-svn-id: trunk@27716 -
2014-05-01 22:28:07 +00:00
nickysn
c9c29a3cd4 + ignore the source segment, when the destination cgpara is a near pointer in
tcg8086.a_loadaddr_ref_cgpara

git-svn-id: trunk@27715 -
2014-05-01 21:56:04 +00:00
nickysn
c9f8703679 + set ref.segment to NR_SS for all temps/localvars on i8086. This allows the
segment to survive e.g. several nested vecnodes, which cause the base register
  to change from BP to something else. In the cases where the ss: prefix is not
  needed, it is removed by make_simple_ref.
+ remove the ss: prefix in the several cases where make_simple_ref isn't called
  (namely spilling and tcg8086.a_call_reg_far)

git-svn-id: trunk@27714 -
2014-05-01 21:18:47 +00:00
nickysn
38aec68d6f * ti8086vecnode.update_reference_reg_mul: remove the segment before calling
base, because base may in some cases call cg.a_loadaddr_ref_reg, which will
  overwrite the next register, if the source reference contains a segment

git-svn-id: trunk@27713 -
2014-05-01 19:39:52 +00:00
florian
2fa066b003 * optimize vmovaps/vmovapd after avx instructions
git-svn-id: trunk@27712 -
2014-05-01 19:20:35 +00:00
florian
8060d4a3f7 * when updating registers in RegUsedAfterInstruction, new reg. allocs should be ignored
git-svn-id: trunk@27711 -
2014-05-01 19:20:32 +00:00
nickysn
3dfc6ac7e1 * fixed the passing of extended floating type parameters on i8086 for
pocall_register after r24761 (it is the same change as in r24766, but for
  pocall_register)

git-svn-id: trunk@27709 -
2014-05-01 16:45:49 +00:00
nickysn
906412411f * fixed the passing of pushaddr paramaters for pocall_register in i8086 far data
memory models

git-svn-id: trunk@27708 -
2014-05-01 16:43:35 +00:00
nickysn
24bf272c69 * fixed the passing of array of const parameters in i8086 far data memory models
git-svn-id: trunk@27700 -
2014-05-01 12:46:29 +00:00
Jonas Maebe
724a6e9019 * fixed -Sx (mantis #25930)
git-svn-id: trunk@27697 -
2014-04-30 19:43:34 +00:00
Jonas Maebe
270c2d700e * allow the "then" part of an if-statement to be terminated by any endtoken,
instead of only by "else" (mantis #25781)

git-svn-id: trunk@27696 -
2014-04-30 19:25:06 +00:00
nickysn
de1b8cf5d6 * use def_cgsize(parentfpvoidpointertype) instead of OS_ADDR in
tcgloadparentfpnode.pass_generate_code (should've been part of r27690)

git-svn-id: trunk@27693 -
2014-04-30 17:37:47 +00:00
nickysn
4ab9c6f206 + fixed tcgtypeconvnode.second_class_to_intf for i8086 far data memory models
git-svn-id: trunk@27692 -
2014-04-30 14:05:35 +00:00
nickysn
cb33e51425 * tcgloadparentfpnode.pass_generate_code converted to the high level code
generator. This fixes nested access to parentfp in i8086 memory models where
  DS<>SS.

git-svn-id: trunk@27690 -
2014-04-29 23:32:22 +00:00
nickysn
a7e5896504 + parentfpvoidpointertype changed to a near 'ss' pointer on i8086
git-svn-id: trunk@27689 -
2014-04-29 23:17:22 +00:00
nickysn
7da8719036 + support near pointers, bound to a segment register in hlcg.reference_reset_base
on i8086

git-svn-id: trunk@27688 -
2014-04-29 23:15:20 +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
nickysn
a17c04c3e0 * fixed array to pointer conversion in i8086 far data memory models
git-svn-id: trunk@27683 -
2014-04-28 12:36:38 +00:00
nickysn
e8b9d9bf41 * converted tcgtypeconvnode.second_nil_to_methodprocvar to the high level code
generator, so it handles i8086 near and far pointers generically
- removed t8086typeconvnode.second_nil_to_methodprocvar, since it's no longer
  necessary

git-svn-id: trunk@27678 -
2014-04-28 01:05:14 +00:00
nickysn
187c2af20e * tcgtypeconvnode.second_proc_to_procvar converted to the high level code
generator, so it can now handle i8086 near and far pointers generically
- removed almost all of t8086typeconvnode.second_proc_procvar, since it's no
  longer needed. Only a few assertions are left there to ensure that we don't
  accidentally attempt to take the address of a near procedure in a far code
  memory model, because the calling conventions are incompatible.

git-svn-id: trunk@27677 -
2014-04-27 23:18:05 +00:00
florian
24a9dd43b9 * do not crash with an ie on illegal boolean expressions in conditional compilation directives, resolves #25951
git-svn-id: trunk@27676 -
2014-04-27 15:50:37 +00:00
florian
99e1bb32a2 + apply cse to more inline nodes
git-svn-id: trunk@27675 -
2014-04-27 14:28:17 +00:00
florian
6dd2edb10d * better complexity estimation for some inline nodes
git-svn-id: trunk@27674 -
2014-04-27 14:28:01 +00:00
nickysn
214eaebf99 * fixed length(ansistring/widestring/dynarray) in i8086 far data memory models
git-svn-id: trunk@27673 -
2014-04-27 02:26:35 +00:00
nickysn
63f0731913 * 16/8-bit alu fix in tcgunaryminusnode.emit_float_sign_change
git-svn-id: trunk@27672 -
2014-04-26 18:58:22 +00:00
florian
33602db802 * try to registers more cleverly during fma code generation
git-svn-id: trunk@27671 -
2014-04-26 18:11:13 +00:00
nickysn
5dcbaa4b2d - rm the cpu16bitalu and cpu64bitalu ifdefs from tcg.a_load_ref_cgpara as well
(basically the same change as in r27664, but in tcg, instead of thcgobj)

git-svn-id: trunk@27666 -
2014-04-26 14:33:46 +00:00
nickysn
9758a53fa6 - rm the ifdef cpu16bitalu and cpu64bitalu from thlcgobj.a_load_ref_cgpara,
because they:
  - worsen readability (especially if we add cpu8bitalu as well, for
    completeness)
  - are not needed, because the else clause of the previous if ensures that we
    have (sizeleft<=sizeof(aint)) and sizeof(aint) follows the target cpu alu
    size

git-svn-id: trunk@27664 -
2014-04-26 13:46:36 +00:00
nickysn
d8d35a32c9 - rm bogus ifdef cpu16bitalu from tparamanager.allocparaloc and .freecgpara
(leftover from my initial hacky implementation of returning int64 function
  results in ax:bx:cx:dx, that is no longer in use?)

git-svn-id: trunk@27662 -
2014-04-26 13:37:53 +00:00
nickysn
1d4de72aa7 + 8-bit ALU support in tcgcasenode.genlinearcmplist
git-svn-id: trunk@27660 -
2014-04-26 12:41:58 +00:00
nickysn
3e308e0ad7 * 16/8-bit alu fix in thlcg2ll.location_force_reg for the 32->64 conversion of LOC_CONSTANT sources
git-svn-id: trunk@27654 -
2014-04-25 13:20:18 +00:00
nickysn
88df284423 * fixed overflow checking for the 64-bit unary minus on 16 and 8-bit platforms
git-svn-id: trunk@27653 -
2014-04-25 12:33:45 +00:00
nickysn
a47ab44ec8 * unified the 8-bit and 16-bit alu handling in tshlshrnode.pass_typecheck
git-svn-id: trunk@27642 -
2014-04-23 12:53:31 +00:00
nickysn
7d8fb1833f * 16-bit alu handling in tshlshrnode.pass_typecheck simplified via the use of
get_common_intdef

git-svn-id: trunk@27641 -
2014-04-23 12:43:48 +00:00
nickysn
a17797f3ca * tshlshrnode.simplify: in the case of 16-bit or 8-bit shl/shr, AND the right
side constant with 31 (instead of 15 or 7), because that's how the 16-bit and
  8-bit x86 shl/shr instructions behave (even on 16-bit CPUs like 286). The
  change does not affect 32-bit and 64-bit platforms, because there the shift
  is always done in at least 32 bits.

git-svn-id: trunk@27638 -
2014-04-23 00:23:27 +00:00
pierre
0d3bccaa1b Do not consider ansi/wide/unicode strings as taggable for stabs
git-svn-id: trunk@27637 -
2014-04-22 22:32:14 +00:00
nickysn
aa3f450832 * 8/16-bit alu fixes in tnotnode.simplify
git-svn-id: trunk@27636 -
2014-04-22 22:04:31 +00:00
pierre
356ea656e4 Try to avoid problems with generic types for stabs/stabx
git-svn-id: trunk@27635 -
2014-04-22 21:28:45 +00:00
pierre
9a40ff19a1 Avoid problems on implicit functions for gas
git-svn-id: trunk@27634 -
2014-04-22 16:36:50 +00:00
pierre
778e15251e avoid unbalanced .ef complaint in GDB for stabx
git-svn-id: trunk@27633 -
2014-04-22 15:50:22 +00:00
pierre
19ba1b43a1 Add possibility to use GNU assembler gas on naitve AIX
git-svn-id: trunk@27632 -
2014-04-22 15:48:55 +00:00
sergei
196436b7e7 * ARM: Test if range check of floating point constants is necessary in the same way as on other targets. This should have been part of r10940 6 years ago...
git-svn-id: trunk@27630 -
2014-04-22 06:51:54 +00:00
nickysn
313240b9e8 * use a better way (suggested by Jonas) to determine whether a procedure is from
the same unit

git-svn-id: trunk@27629 -
2014-04-21 23:14:16 +00:00
pierre
b258b6dc04 Fix constant string stabx writing
git-svn-id: trunk@27626 -
2014-04-21 21:02:55 +00:00
nickysn
efb3cfcbc7 - don't write the default unit code section in the beginning of each asm file,
when using {$hugecode on}, to avoid bogus nasm warnings

git-svn-id: trunk@27623 -
2014-04-21 01:02:21 +00:00
nickysn
8a606761cd * don't push cs in ti8086callnode.extra_interrupt_code in the far code memory
models, because in these models, interrupt procedures are treated as far and
  an appropriate far call (or push cs+near call if in the same segment) is made
  anyway

git-svn-id: trunk@27622 -
2014-04-21 00:56:51 +00:00
nickysn
70a7ecd0fa + use 'push cs + call near' (which is both shorter and faster), instead of far
call, when calling a far proc in the same segment

git-svn-id: trunk@27621 -
2014-04-21 00:44:45 +00:00
pierre
d7c5b4502f Fix AIX assembler issue by enabling WriteExtraFooter with modified output
git-svn-id: trunk@27620 -
2014-04-20 23:08:38 +00:00
sergei
f20b6c73ef * SPARC: convert carry flag into register without branching.
git-svn-id: trunk@27619 -
2014-04-20 19:30:59 +00:00
sergei
1ec5026465 * Call fpc_shortstr_to_shortstr instead of fpc_shortstr_assign. It is the same procedure with different order of parameters (suited for generation from node level). Now fpc_shortstr_assign remains needed only for bootstrapping.
git-svn-id: trunk@27618 -
2014-04-20 19:27:05 +00:00
sergei
2ee0c8de45 * i386: For integer comparisons with zero, emit "test $-1,%reg" instead of "test %reg,%reg". It is more spilling-friendly, because it transforms into "test $-1,spilltemp" and does not require a register.
* Improved peephole optimizer to remove these instructions if preceded by flag-setting instruction that operates on same location and followed by conditional jump, and change them back into "test %reg,%reg" otherwise.

git-svn-id: trunk@27617 -
2014-04-20 19:16:58 +00:00
nickysn
597f110eb9 + added support for units with code larger than 64kb in the far code i8086
memory models. Enabled by the new directive {$hugecode on}. The directive is
  ignored in the near code memory models. When enabled, it forces each procedure
  to be in a separate segment and disables mixing near and far procedures (so
  'near' and {$F-} are ignored in this mode). Note that {$hugecode on} does not
  count as a different memory model, because you can freely link modules (units)
  compiled with {$hugecode on} and {$hugecode off}.

git-svn-id: trunk@27615 -
2014-04-20 19:03:14 +00:00
sergei
819f6de01a * ARM: fixed floating point comparison flags for VFP hardfloat (part of Mantis #9362).
git-svn-id: trunk@27611 -
2014-04-20 17:06:32 +00:00
Jonas Maebe
e0a910e813 * factored out left/right swapping code in smallset operations
* force the left operand into a register if both the left and
    right are constants (can happen because not all set add-nodes
    are handled in taddnode.simplify) because the code below
    expects at least one register operand. Fixes the compilation of a.o.
    taddset2 with -O3 on ppc (constant propagagation -> 2 constant
    operands)

git-svn-id: trunk@27607 -
2014-04-20 14:35:00 +00:00
Jonas Maebe
212f4d1152 * pass the size of the set rather than of the constant to
a_bit_test_const_loc_reg() (bug in hlcgobj conversion)

git-svn-id: trunk@27606 -
2014-04-20 14:34:57 +00:00
nickysn
bf6ad0ff78 * fixed tcg8086.g_flags2reg, so it behaves the same way as tcgx86.g_flags2reg
after r27581 in regard to floating point comparisons. The tcmpnan.pp test now
  almost works (i.e. fails due to only one error, instead of many).

git-svn-id: trunk@27605 -
2014-04-19 22:54:29 +00:00
sergei
5fe27ae815 * powerpc/powerpc64: Fixed floating point compares to be IEEE-754 compliant. Mantis #9362.
git-svn-id: trunk@27604 -
2014-04-19 19:54:24 +00:00
Jonas Maebe
0dbfb99afa * always use assembler directives that support unaligned data on AIX, as
otherwise data in initialised packed records gets aligned wrongly. This
    should probably also be done for other targets that automatically
    align .short/.long/...

git-svn-id: trunk@27600 -
2014-04-19 18:48:40 +00:00
sergei
a8eb55fa7c * powerpc/powerpc64: merged identical a_jmp_flags methods into base code generator class.
git-svn-id: trunk@27598 -
2014-04-19 18:34:10 +00:00
sergei
af52c874d0 - Removed some stuff that is not used anywhere.
git-svn-id: trunk@27595 -
2014-04-18 18:34:53 +00:00
sergei
f3801d13de * SPARC: cleaned up and actualized TAsmCond (stuff copy-pasted from x86 removed, conditions for unordered floating-point comparisons added). Fixes Mantis #9362 on this target.
git-svn-id: trunk@27593 -
2014-04-17 14:15:45 +00:00
sergei
58882e2934 * SPARC: UNIMP instruction has 22-bit "opcode", not 12-bit.
git-svn-id: trunk@27592 -
2014-04-17 14:08:33 +00:00
nickysn
9a44ab2fc2 * always treat interrupt routines as far, so their address can be taken even in
{$F-} mode

git-svn-id: trunk@27591 -
2014-04-16 23:37:28 +00:00
nickysn
d6ad2b1f8a + added support for mixing near and far procedures in the i8086 far code memory
models. The $F directive and the 'near' and 'far' procedure modifiers should
  now work as expected in the far code memory models (they are still ignored in
  the near code memory models). The compiler defaults to the {$F+} state,
  because {$F-} requires adding 'far' to a lot of procedures in the rtl,
  packages and tests.

git-svn-id: trunk@27590 -
2014-04-16 23:09:18 +00:00
sergei
c0431dba4e * Moved method g_flag2reg from tcgppc (in both powerpc and powerpc64) to tcgppcgen class, since it is identical for both targets.
git-svn-id: trunk@27589 -
2014-04-16 15:00:49 +00:00
sergei
4c3a4646ec * Fixed floating-point comparisons for softfloat targets (part of Mantis #9362).
git-svn-id: trunk@27584 -
2014-04-15 23:36:21 +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
sergei
98de3c4e40 * tcg8086.g_flags2reg: call virtual method a_jmp_flags instead of duplicating its functionality, it prevents further changes to this method when adding support for unordered comparison results.
git-svn-id: trunk@27579 -
2014-04-14 00:20:06 +00:00
Károly Balogh
daefb42925 m68k: don't find helper 'opcodes' as real opcodes... (i guess is the right solution for the problem which r22796 originally aimed to fix)
git-svn-id: trunk@27577 -
2014-04-13 23:20:29 +00:00
Károly Balogh
9ad7540ddf reverted change in r22796, the previously disabled code is actually required by the amunits package
git-svn-id: trunk@27574 -
2014-04-13 22:06:51 +00:00
Károly Balogh
5535df29d4 support SP and FP alias in the assembler reader too
git-svn-id: trunk@27573 -
2014-04-13 21:03:06 +00:00
Károly Balogh
7ee09b9620 instead of supporting SP only, have register A7 defined, and have SP as an alias
git-svn-id: trunk@27572 -
2014-04-13 21:02:16 +00:00
pierre
365666c833 Fix remaining failure for make testppudump at compiler level
git-svn-id: trunk@27568 -
2014-04-13 19:31:55 +00:00
nickysn
ce0bd81273 + show an error message 'procedure must be far' if an attempt is made to convert
a near proc to a procvar in a i8086 far code memory model

git-svn-id: trunk@27567 -
2014-04-13 19:29:28 +00:00
florian
18233f2c0c * fix compilation of i8086 compiler
git-svn-id: trunk@27566 -
2014-04-13 19:28:59 +00:00
florian
6fd98d604a * compilation fixed
git-svn-id: trunk@27565 -
2014-04-13 19:21:57 +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
d404d15c1e * forgot to commit the changes to i386/symcpu.pas in r27549
git-svn-id: trunk@27563 -
2014-04-13 18:44:35 +00:00
nickysn
d8d3706462 + override hlcg.a_call_name for i8086 and dispatch to the appropriate type of
call (near or far), according to whether the procdef is near or far, instead
  of relying on the default for the memory model

git-svn-id: trunk@27562 -
2014-04-13 15:17:43 +00:00
nickysn
86b9a0eed1 + added the $F switch to the turbo and macSwitchTable, as that takes precedence
over dir_forcefarcalls

git-svn-id: trunk@27561 -
2014-04-13 15:14:43 +00:00
nickysn
fc6eac6a98 + added $F directive handling, sets cs_force_far_calls (not implemented yet)
git-svn-id: trunk@27560 -
2014-04-13 13:07:18 +00:00
nickysn
6fe362a1b0 + added method is_far to i8086's tcpuprocdef and tcpuprocvardef
+ added helper function to i8086's symcpu is_proc_far that dispatches the call
  to the proper is_far method (because we can't make a cpu specific descendant
  of tabstractprocdef and add it there)
* all checks for (po_far in procoptions) in the i8086 code generator replaced
  with calls to is_proc_far

git-svn-id: trunk@27559 -
2014-04-13 12:41:46 +00:00
sergei
3e20a136f3 * tx86addnode.second_addfloat: use single and double-precision memory locations without loading them on FPU stack if possible.
git-svn-id: trunk@27558 -
2014-04-13 12:37:30 +00:00
nickysn
0ef858a6ca * fixed the reading of x86 pointer defs in ppudump after the ppuwrite_platform
changes

git-svn-id: trunk@27557 -
2014-04-13 11:40:20 +00:00
nickysn
9ab2aa7463 * fixed ppudump after r27434
git-svn-id: trunk@27556 -
2014-04-13 09:56:17 +00:00
nickysn
40a6a9c820 + added i8086 specific implementation of thlcgcpu.a_load_loc_ref, which handles
6-byte method pointers and other i8086 types that use loc.registerhi
* changed the i8086 specific code in tcgassignmentnode.pass_generate_code to
  use hlcg.a_load_loc_ref

git-svn-id: trunk@27555 -
2014-04-13 01:38:43 +00:00
nickysn
2e7aab0155 * refactored i8086's thlcgcpu.location_force_mem:
o The checks for types that need special handling moved to separate methods,
    because they'll probably be used by the other hlcg.a_load*loc* methods as
    well.
  o Use voidcodepointertype and voidpointertype to avoid the ifs for checking
    the memory model.

git-svn-id: trunk@27554 -
2014-04-12 21:59:32 +00:00
nickysn
02988023b7 * tcgloadnode.pass_generate_code: fixes for i8086 far data model fixes in the
handling of method procsyms + even more ifdef i8086s removed

git-svn-id: trunk@27551 -
2014-04-12 19:59:04 +00:00
nickysn
68ff3fb1e2 * tcgloadnode.pass_generate_code: rm the ifdef'd i8086 code from the handling of
non-method procsyms by using def_cgsize(pd.address_type) to determine the
  address size

git-svn-id: trunk@27550 -
2014-04-12 16:26:51 +00:00
nickysn
fc71081b74 * i8086 and i386-specific code from tabstractprocdef.is_pushleftright moved to
symi86

git-svn-id: trunk@27549 -
2014-04-12 15:34:08 +00:00
nickysn
0a515311e6 * tabstractprocdef.address_type i8086-specific code moved to symcpu, ifdef i8086 removed
git-svn-id: trunk@27548 -
2014-04-12 15:09:17 +00:00
nickysn
9f4dd78701 * the ifdef i8086 in taddrnode.pass_typecheck removed via using tabstractprocdef.address_type
git-svn-id: trunk@27547 -
2014-04-12 14:49:54 +00:00
nickysn
37168c8625 * use voidcodepointertype to determine tprocvardef.size; ifdef i8086 removed
git-svn-id: trunk@27546 -
2014-04-12 14:19:30 +00:00
nickysn
89584164b1 + added virtual methods tabstractprocdef.declared_far and .declared_near, which
are called, when the 'near' or 'far' directive is parsed in a procedure
  definition. This allows overriding and implementing them on architectures,
  which support near and far calls.

git-svn-id: trunk@27545 -
2014-04-12 12:55:05 +00:00
nickysn
b41892f048 * set po_far in the i8086-specific descendants of tprocdef and tprocvardef,
instead of in tabstractprocdef.create; ifdef i8086 removed

git-svn-id: trunk@27544 -
2014-04-12 12:17:10 +00:00
nickysn
015c3269a7 * don't print a 'smart link requires external linker' warning in _any_ of the
following cases:
  1) external linking is already enabled
  2) target does not support an internal linker
  3) the 'omit linking stage' option is used

git-svn-id: trunk@27543 -
2014-04-12 08:19:23 +00:00
nickysn
b9af57b97a * use voidcodepointertype when creating the methodpointertype in
psystem.create_intern_types; ifdef i8086 removed.

git-svn-id: trunk@27541 -
2014-04-11 23:41:53 +00:00
nickysn
902d118ec8 * i8086 far data memory model fixes in tobjectdef.vmtmethodoffset
git-svn-id: trunk@27539 -
2014-04-11 23:05:42 +00:00
nickysn
8d9fda9264 * use voidcodepointertype.size in tobjectdef.vmtmethodoffset, avoid ifdef i8086
git-svn-id: trunk@27538 -
2014-04-11 22:09:30 +00:00
nickysn
be08957a96 * use voidcodepointertype in traisenode.pass_typecheck to avoid ifdef i8086
git-svn-id: trunk@27537 -
2014-04-11 21:59:07 +00:00
nickysn
542719c8f5 + added symdef.voidcodepointertype
git-svn-id: trunk@27536 -
2014-04-11 20:47:45 +00:00
svenbarth
e85075de7f Fix for Mantis #25604.
nmat.pas:
  * correctly disable type checks if one of the arguments for MOD, DIV, SHR, SHL, NOT, -X and +X is a generic type parameter

+ added tests

git-svn-id: trunk@27535 -
2014-04-11 16:43:53 +00:00
svenbarth
c623824374 Fix for Mantis #25605.
symtable.pas, search_objectpascal_helper:
  * handle more symbol types than just properties and methods; afterall helpers can have types, static variables and constants as well

+ added test

git-svn-id: trunk@27534 -
2014-04-11 16:13:44 +00:00
svenbarth
256c852631 Fix for Mantis #23776.
ninl.pas, tinlinenode.pass_typecheck:
  * don't generate a type error if Length() is used inside generics with a generic argument

+ added test

git-svn-id: trunk@27533 -
2014-04-11 15:57:21 +00:00
svenbarth
b0670ee34c Fix for Mantis #25600.
ptype.pas, read_named_type.array_dec:
  * generate a valid range definition if we are inside a generic and the array bounds are not ordinals (Note: the check for "parse_generic" should be improved to really detect erratic indexes that are not related to generics in any way)

+ added test

git-svn-id: trunk@27532 -
2014-04-11 14:57:23 +00:00
svenbarth
02495c17bd Fix a typo. The CPU specific version of "ttypesym" should be called "tcputypesym" and not "tcpuypesym".
git-svn-id: trunk@27531 -
2014-04-11 14:30:59 +00:00
pierre
9c78abafce Add SmartFilesCount number to AddAsmCommand call for SmartAsm
git-svn-id: trunk@27530 -
2014-04-11 13:37:00 +00:00
Jonas Maebe
d9dab6f2f1 * changed the severity of messages showing overloaded routines with all
parameters from hint to error in case they give more information
    about definition errors

git-svn-id: trunk@27521 -
2014-04-10 21:07:17 +00:00
Jonas Maebe
4a0528399e * check all overloaded routines for mangled name conflicts on the JVM
platform, as different Pascal declarations are mapped to the same
    JVM representation

git-svn-id: trunk@27520 -
2014-04-10 21:07:14 +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
e21783a281 * i8086 small and tiny memory model ppus made incompatible. Rationale:
o the maintenance effort will be less - previously we had to test 4
    combinations:
      tiny program with tiny rtl
      tiny program with small rtl
      small program with tiny rtl
      small program with small rtl
    I only tested both tiny and small programs with the small rtl, so I missed
    a bug, which caused small programs built with the tiny rtl to always give
    a "Nil pointer assignment" error. Now we only need to test two cases:
      tiny program with tiny rtl
      small program with small rtl
  o I'm planning a bug fix for interrupt procedures in the tiny model, which
    will make their prolog differ between small and tiny. Currently, they're
    not used in the rtl, but that may change. And even if it doesn't,
    interrupt procedures may also be used by user units.

git-svn-id: trunk@27516 -
2014-04-10 16:31:06 +00:00
pierre
179390d63d Use script gnu ar for go32v2 target
git-svn-id: trunk@27515 -
2014-04-10 16:20:14 +00:00
pierre
ca156aa64a Force external linker for nasm smartlinking
git-svn-id: trunk@27512 -
2014-04-10 15:02:04 +00:00
pierre
816dfa69c1 Avoid new line after lock prefix for nasm
git-svn-id: trunk@27511 -
2014-04-10 14:56:30 +00:00
pierre
e0744b9759 Fix section output for user section in smart mode
git-svn-id: trunk@27510 -
2014-04-10 14:18:48 +00:00
pierre
62b3375033 Use slash instead of backslash inside linker script to allow use of cross-linker
git-svn-id: trunk@27509 -
2014-04-10 13:24:42 +00:00
nickysn
e725af86fe * fixed the handling of the register parameters of i8086 interrupt procedures
git-svn-id: trunk@27502 -
2014-04-07 22:19:10 +00:00
sergei
e951887154 * Fixed linking of non-PIC code to indirect functions in shared objects.
git-svn-id: trunk@27496 -
2014-04-06 23:04:57 +00:00
nickysn
9f2e59de3a + implemented far pointer arithmetic in the i8086 add node simplify method
git-svn-id: trunk@27495 -
2014-04-06 18:51:53 +00:00
nickysn
4563b2994d + handle constint+pointerconst in taddnode.simplify
git-svn-id: trunk@27491 -
2014-04-06 16:36:09 +00:00
florian
701cdf8ea2 * fix for #25956: left is not necessarily the array load node when accessing an open array/array of const element
git-svn-id: trunk@27487 -
2014-04-06 15:15:16 +00:00
nickysn
8d1ed088c8 + implemented far pointer arithmetic (operating only on the offset, without
touching the segment)

git-svn-id: trunk@27485 -
2014-04-06 13:12:29 +00:00
nickysn
198960b17c * preserve the segment of the reference in tx86vecnode.update_reference_reg_mul
on i386 and x86_64 as well

git-svn-id: trunk@27481 -
2014-04-05 14:46:35 +00:00
nickysn
f00f7d6ee7 * override tcgvecnode.update_reference_reg_mul for i8086 and add code that
preserves the reference segment (because reference_reset_base, which is
  sometimes used by the base method, kills the segment)

git-svn-id: trunk@27480 -
2014-04-05 14:02:52 +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
sergei
5c48804240 * Moved local label infrastructure into tasmreader, reduces number of global vars. Functionality is not changed.
git-svn-id: trunk@27477 -
2014-04-05 09:43:13 +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
sergei
adc8cdb5af * Calling tlabelsym.mangledname should not define the label. This was causing "already defined" errors if a label was referenced before it was defined.
+ Test.
+ Check duplicate labels in assembler blocks. This was impossible due to above bug and duplicate labels were detected only at assembling stage where no location information could be provided.

git-svn-id: trunk@27472 -
2014-04-05 01:17:36 +00:00
nickysn
e43791cf7c * ti8086callnode.extra_call_ref_code: do not change the base register to BX if
it's BP, because that breaks memory models with DS<>SS

git-svn-id: trunk@27471 -
2014-04-04 21:43:40 +00:00
nickysn
9da1ee0138 * i8086 far data model fixes in the copying of openarray value params
git-svn-id: trunk@27470 -
2014-04-04 20:18:47 +00:00
svenbarth
8ae36f3ef4 tstaticvarsym.ppuload: read the section string outside of the symansistr define to match the code of ppuwrite
git-svn-id: trunk@27467 -
2014-04-04 16:18:08 +00:00
svenbarth
5c1b8fdad9 Fix for Mantis #19697. For this we need to have the internal static var symbol know that it came from a static field var symbol so that we can check that for generic or not.
symsym.pas, tfieldvarsym:
  + add new field fieldvarsym which holds a reference to a tfieldvarsym if the static sym was created based on such a symbol
  + add necessary methods and code to correctly load from and store to PPU
  + add new constructor create_from_fieldvar
symcreat.pas, make_field_static: 
  * use new create_from_fieldvar constructor instead of the default one
hlcgobj.pas, finalize_static_data:
  * check whether the static var is based on a generic's class var
ppu.pas:
  * increase PPU version

+ added test

git-svn-id: trunk@27466 -
2014-04-04 16:15:41 +00:00
svenbarth
b9a59c33f4 Fix for Mantis #25915.
* ptype.pas, id_type:
    generate the "identifier not found" message only if the identifier was really not found and not when the identifier is a non-type
* pexpr.pas, statement_syssym: 
    don't generate the "type id expected" error message for Default() anymore; this is already handled by single_type

+ added test (though this again will not help much as output is not parsed...)

git-svn-id: trunk@27464 -
2014-04-04 15:48:06 +00:00
svenbarth
689996d84f Fix for Mantis #25959.
* pdecsub.pas, parse_proc_direc:
    when a hint directive is parsed we need to check whether the new token can still be a directive

+ added test (though that won't help much as we don't check the compiler output yet... :/ )

git-svn-id: trunk@27463 -
2014-04-04 14:04:32 +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
4832682c58 * fixed i8086 far pointer typed constants that are initialized with nil
git-svn-id: trunk@27458 -
2014-04-03 21:39:00 +00:00
nickysn
36aae69e2b + initialize the initialloc for push_addr_param parameters correctly in i8086
far data memory models

git-svn-id: trunk@27455 -
2014-04-03 17:24:41 +00:00
nickysn
cf1d60b8eb + added size info to the 'Var X located at' comment generated in the asm output
git-svn-id: trunk@27454 -
2014-04-03 16:54:01 +00:00
nickysn
ec6dfb5853 + added tcgsize2str function
git-svn-id: trunk@27453 -
2014-04-03 16:50:50 +00:00
nickysn
a79a891940 * handle the result of FPC_CATCHES via the high level code generator (which makes it i8086 far pointer safe)
git-svn-id: trunk@27451 -
2014-04-02 14:25:19 +00:00
sergei
96dd464bf2 * Moved fixup_jmps to target-specific classes for powerpc,powerpc64 and MIPS, cleaned out remaining $ifdef's. A slight functionality change is that fixup_jmps is now called before adding the procedure end symbol, not after, but that should not matter.
git-svn-id: trunk@27450 -
2014-04-02 14:17:23 +00:00
sergei
eeb15fc445 * Added virtual method tprocinfo.postprocess_code and moved target-specific processing from base class into target-specific descendant classes (ARM and AVR, other targets still to do).
git-svn-id: trunk@27449 -
2014-04-02 13:14:06 +00:00
Jonas Maebe
edff5a9aa1 * fixed m68k typo in r27438
git-svn-id: trunk@27443 -
2014-04-01 21:48:28 +00:00
Jonas Maebe
f017e16722 * increased ppu version after all symdef changes
git-svn-id: trunk@27442 -
2014-04-01 21:41:40 +00:00
Jonas Maebe
d452686c39 * moved pbestrealtype from symdef to symcpu
git-svn-id: trunk@27441 -
2014-04-01 21:41:37 +00:00
Jonas Maebe
a251b270b6 - removed no longer used jvmdef unit from uses clause
git-svn-id: trunk@27440 -
2014-04-01 21:41:33 +00:00
Jonas Maebe
93d50bc287 * moved jvm-specific classdef-related fields from tenumdef to a platform-
specific descendant

git-svn-id: trunk@27439 -
2014-04-01 21:41:30 +00:00
Jonas Maebe
9c7c64a3af * moved amiga/morphos-specific libsym-related field from tprocdef to
cpu-specific descendants (unfortunately causes some duplication, but the
    code is trivial and there is no easy way to avoid it)
  * also moved the use of the field in ncal to cpu-specific files (with same
    caveat)

git-svn-id: trunk@27438 -
2014-04-01 21:41:27 +00:00
Jonas Maebe
5053a39501 * moved ARM-specific tprocdef.total_stackframe_size field to cpu-specific
descendant

git-svn-id: trunk@27437 -
2014-04-01 21:41:24 +00:00
Jonas Maebe
f101118cd6 * moved MIPS-specific tprocdef.total_local_size field to cpu-specific
descendant

git-svn-id: trunk@27436 -
2014-04-01 21:41:21 +00:00
Jonas Maebe
d020a32b9a - removed no longer used tprocdef.fpu_used field for i386/i8086 (the one
place where it was used, we now handle the consequence directly)

git-svn-id: trunk@27435 -
2014-04-01 21:41:18 +00:00
Jonas Maebe
806bf0b88e - removed storing/loading unused byte for tprocdef.fpu_used
git-svn-id: trunk@27434 -
2014-04-01 21:41:14 +00:00
florian
0a7b795744 * fix for the regressions caused by r27417
git-svn-id: trunk@27433 -
2014-04-01 19:34:21 +00:00
nickysn
5f57274b74 + proper i8086 Seg() implementation (i.e. support segments other than DS)
git-svn-id: trunk@27432 -
2014-04-01 19:11:39 +00:00
sergei
8c693a3300 * Win64 apparently expects records with single field of floating-point type to be passed the same way as that only field, i.e. in xmm register. Fixes tests/cg/tcalext6.pp.
git-svn-id: trunk@27431 -
2014-04-01 17:04:47 +00:00
sergei
db621780d5 * x86_64-win64: fixed handling of RELOC_RELATIVE_1..RELOC_RELATIVE_5 COFF relocations, they were off by 4 bytes, causing failure in tests/test/tcalext.pp.
git-svn-id: trunk@27430 -
2014-04-01 16:26:56 +00:00
florian
73cf0b62f2 * relaxed conditions for floats in int registers, this improved softfloat code significantly
git-svn-id: trunk@27417 -
2014-03-31 21:14:16 +00:00
sergei
68b97bee5a * ARM: Implemented floating-point negation and abs() for softfloat using integer instructions. Fixes webtbs/tw4534.pp, and also yields much faster code than existing implementation.
Background: these operations are defined as flipping or clearing the upper bit of number, respectively, and never result in precision loss or raise floating-point exceptions.

git-svn-id: trunk@27411 -
2014-03-31 15:03:15 +00:00
nickysn
d6cb55297c + symx86.pas added to ppc8086.lpi
git-svn-id: trunk@27405 -
2014-03-31 09:24:55 +00:00
Jonas Maebe
8364232049 + symx86 unit, forgot to commit (part of r27397)
git-svn-id: trunk@27399 -
2014-03-30 22:03:55 +00:00
nickysn
e86e108dc5 + added the newly added source files from r27379 to ppc8086.lpi
git-svn-id: trunk@27398 -
2014-03-30 21:25:33 +00:00
Jonas Maebe
338c064beb * moved x86-specific tpointerdef functionality to architecture-specific
descendants

git-svn-id: trunk@27397 -
2014-03-30 21:04:36 +00:00
Jonas Maebe
dae5d1ff62 + added class reference types of the architecture-specific t*def/t*sym
classes

git-svn-id: trunk@27396 -
2014-03-30 21:04:32 +00:00
Jonas Maebe
43992495cb * moved jvm tprocdef name mangling to jvm-specific descendant class
git-svn-id: trunk@27395 -
2014-03-30 21:04:29 +00:00
Jonas Maebe
f4c0daddb4 * moved jvm-specific exprasm field from tprocdef to jvm-specific descendant
git-svn-id: trunk@27394 -
2014-03-30 21:04:25 +00:00
nickysn
0a9f738167 + tcg8086.g_copyvaluepara_openarray: support source to be in a different segment
git-svn-id: trunk@27393 -
2014-03-30 19:55:11 +00:00
nickysn
4763723c75 + support compact, large and huge memory models in x86/cpubase.segment_regs_equal()
git-svn-id: trunk@27392 -
2014-03-30 19:36:21 +00:00
nickysn
1f8280e8f1 * load the destination segment in tcg8086.g_copyvaluepara_openarray from SS
instead of DS, because the destination is on the stack, but in some memory
  models DS may be different than SS

git-svn-id: trunk@27391 -
2014-03-30 19:10:21 +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
nickysn
f4a0c08736 * fixed nested access to parent local variables in i8086 far data memory models
git-svn-id: trunk@27388 -
2014-03-30 17:50:35 +00:00
florian
8dfcc2b399 * do not reuse tmp. registers in tbasecgarm.handle_load_store
git-svn-id: trunk@27387 -
2014-03-30 17:28:45 +00:00
Jonas Maebe
11c7d5223c * moved ifdef'd jvm code from tprocvardef to jvm-specific descendant
git-svn-id: trunk@27386 -
2014-03-30 17:15:57 +00:00
Jonas Maebe
a05b078fa0 * made ppuload_platform() virtual (should have been part of r27378)
git-svn-id: trunk@27385 -
2014-03-30 17:15:53 +00:00
Jonas Maebe
721fd887c3 * moved all jvm-specific code from symsym to jvm/symcpu
git-svn-id: trunk@27384 -
2014-03-30 16:55:09 +00:00
Jonas Maebe
4a7e6b8b8f * instantiate the cpu-specific version of all defs/syms when loading them
from ppu (was only done for absolutevarsym until now)

git-svn-id: trunk@27383 -
2014-03-30 16:55:06 +00:00
nickysn
9ae26316e8 * fixed the handling of const resourcestrings in the i8086 far data memory models
git-svn-id: trunk@27380 -
2014-03-30 16:30:51 +00:00
Jonas Maebe
4a79481c51 * isolated segment-related functionality of tabsolutevarsym into i386/i8086-
specific descendent classes and moved the code that deals with this in the
    code generator also to target-specific classes -> only ifdefs left in
    pdecvar

git-svn-id: trunk@27379 -
2014-03-30 15:42:53 +00:00
Jonas Maebe
2474369dde * made all ppuwrite methods in leaf classes "final", because you cannot
override them safely in subclasses to add more data (they finalise
    writing their ibentry)
  * removed "virtual" from all ppuload constructors for similar reason
    as above
  + added virtual (empty) ppuwrite_plaform() method that is called from
    tstoreddef/tstoredsym.ppuwrite(), which can be safely overridden in
    child classes to add extra data (called centrally from a new
    tstoreddef/sym.writeentry() method)
  + added virtual (empty) ppuload_platform() method that is called from
    tstoreddef/tstoredsym.ppuload(), which can be safely overridden in
    child classes to read the extra data (unfortunately cannot be called
    from one single location, and these calls had to be added for each
    generic subclass separately)

git-svn-id: trunk@27378 -
2014-03-30 15:42:49 +00:00
marco
70088d12a8 * eliminate classes unit from the compiler by copying an array of string based
extractstrings to cclasses.

git-svn-id: trunk@27372 -
2014-03-30 12:03:10 +00:00
nickysn
66d7beb7fe * i8086 far data memory model fix for except_buf_size
git-svn-id: trunk@27371 -
2014-03-30 12:00:20 +00:00
marco
56277b18db * move fpcsubst to utils/ because it uses classes
git-svn-id: trunk@27370 -
2014-03-30 11:45:51 +00:00
nickysn
5ae9443d66 * moved the EXCEPT_BUF_SIZE const to be local to ncgutils.get_exception_temps,
because that's the only place where it's used

git-svn-id: trunk@27369 -
2014-03-30 11:27:07 +00:00
sergei
1744988962 * Modified behavior of CExtended type in overload selection: it is made more compatible to Extended than to Double and Single. Also an Extended parameter selects a CExtended overload (if available) instead of Double.
+ Test.

git-svn-id: trunk@27366 -
2014-03-30 07:31:58 +00:00
Jonas Maebe
b57c95043f + support overriding tdef/tsym methods with target-specific functionality:
o made all (non-abstract) tdef and tsym constructors virtual
   o added c*def/c*sym classref types for every (non-abstract) t*def/t*sym
     class
   o added cpusym unit for every architecture that derives a tcpu*def/tcpu*sym
     class from the base classes, and initialises the c*def/c*sym classes with
     them. This is done so that the llvm target will be able to derive from
     the tcpu*def/sym classes without umpteen ifdefs, and it also means that
     the WPO can devirtualise everything because the c* variables are only
     initialised with one class type
   o replaced all t*def/t*sym constructor calls with c*def/c*sym constructor
     calls

git-svn-id: trunk@27361 -
2014-03-29 22:31:55 +00:00
Jonas Maebe
b5fd71c3b9 * removed {$ifndef i8086} in tx86vecnode, instead reset cvecnode to
tcgvecnode in the n8086mem initcode

git-svn-id: trunk@27360 -
2014-03-29 22:31:49 +00:00
Jonas Maebe
57859963d6 - removed {$ifdef compress} code (it hasn't been activated/maintained since
a very long time)

git-svn-id: trunk@27359 -
2014-03-29 22:31:46 +00:00
Jonas Maebe
6b16c05a98 * fixed compilation for i8086 with 2.6.x (it gave an unreachable code
warning)

git-svn-id: trunk@27358 -
2014-03-29 22:31:43 +00:00
Jonas Maebe
0edb7b2288 * fixed r27320 for darwin, as its mangled names get prefixed with '_'
and hence the generated mangled name did not start with a '$' as
    expected

git-svn-id: trunk@27357 -
2014-03-29 22:31:36 +00:00
nickysn
17a8c03e41 * declare the group dgroup even in i8086 far data memory models
git-svn-id: trunk@27348 -
2014-03-29 19:35:54 +00:00
florian
c38e52bb27 * create shorter code for -<single/double> when generating avx code
git-svn-id: trunk@27347 -
2014-03-29 19:35:41 +00:00
nickysn
0082db46ea * i8086 far data memory model fix in tcgloadnode.generate_nested_access.
The system unit now compiles in the compact and large memory models again.

git-svn-id: trunk@27341 -
2014-03-29 18:32:01 +00:00
nickysn
75f29aacc3 * i8086 far data memory model fixes in tcgsubscriptnode.pass_generate_code
git-svn-id: trunk@27340 -
2014-03-29 18:30:32 +00:00
nickysn
d43d7e59b5 * partially converted the threadvar handling in tcgloadnode.pass_generate_code
to use the hlcg in order to support the i8086 far data memory models. Only the
  instructions that handle the case when there's no thread manager installed
  (FPC_THREADVAR_RELOCATE=nil) are converted, since that's what's used on the
  msdos target. The rest still uses the low level code generator.

git-svn-id: trunk@27336 -
2014-03-29 16:22:48 +00:00
nickysn
409b047b59 * i8086 far data memory model fixes for the handling of dynamic (ansi/wide/
unicode) strings and dynarrays in tcgvecnode.pass_generate_code

git-svn-id: trunk@27334 -
2014-03-29 14:39:22 +00:00
nickysn
4e60d2316f * support implicit pointer types (classes, dynarrays, ansistrings, etc.) in
i8086's thlcgcpu.getaddressregister and thlcgcpu.reference_reset_base

git-svn-id: trunk@27333 -
2014-03-29 14:00:24 +00:00
nickysn
ce59c4616f * assume SS for the segment of references that have BP as base in
thlcgcpu.a_loadaddr_ref_reg

git-svn-id: trunk@27332 -
2014-03-29 13:25:11 +00:00
florian
a4b6e99db1 * increase refs of hidden high parameter if the corresponding open/const array is used
git-svn-id: trunk@27331 -
2014-03-29 13:10:54 +00:00
florian
601d210763 * formatting
git-svn-id: trunk@27330 -
2014-03-29 13:10:50 +00:00
nickysn
10f9b5c6e4 + added all compiler files to the ppc8086 lazarus project for easier navigation
git-svn-id: trunk@27328 -
2014-03-29 09:33:40 +00:00
nickysn
7f014c5040 * replaced ifdef i8086 with hlcg.reference_reset_base in tcgloadnode.pass_generate_code
git-svn-id: trunk@27327 -
2014-03-28 23:38:57 +00:00
nickysn
891ab86254 * fixed ncgutil.gen_load_vmt_register and tcgloadvmtaddrnode.pass_generate_code
for i8086 far data memory models by using the high level code generator

git-svn-id: trunk@27326 -
2014-03-28 23:16:14 +00:00
nickysn
8b2cde4a99 * fixed tcgstringconstnode.pass_generate_code for i8086 far data memory models
by using the high level code generator

git-svn-id: trunk@27325 -
2014-03-28 22:34:30 +00:00
nickysn
0aab7fcc9c * fixed tcgtypeconvnode.second_cstring_to_pchar for i8086 far data memory models by using the high level code generator
git-svn-id: trunk@27324 -
2014-03-28 18:36:14 +00:00
nickysn
e465ab355b * converted tcgaddrnode.pass_generate_code to use the high level code generator,
which makes the i8086 overridden class unnecessary

git-svn-id: trunk@27323 -
2014-03-28 16:19:49 +00:00
nickysn
ead05754b4 + implemented hlcg.a_loadaddr_ref_reg for i8086, which uses tosize to determine whether the destination is a far pointer, instead of using the presence of ref.segment
git-svn-id: trunk@27321 -
2014-03-28 14:49:43 +00:00
svenbarth
a08e8ff982 Fix for Mantis #25929
* ninl.pas, tinlinenode.handle_default.getdefaultvarsym:
    prefix the default variable's name with a "$zero" instead of a "zero" and use only the string from the second character on for comparisons so that findwithhash() and checkduplicates() generate consistent results

+ added test

git-svn-id: trunk@27320 -
2014-03-28 14:45:18 +00:00
pierre
e65da0deb8 Fix mipsel compilation by reinstalling rev27188 commit reverted in 27200
git-svn-id: trunk@27318 -
2014-03-28 13:51:47 +00:00
nickysn
e6c6bdf662 + added n8086mem.pas to the ppc8086 lazarus project
git-svn-id: trunk@27317 -
2014-03-28 13:00:16 +00:00
sergei
e4819e863b + Consider target_info.cprefix in symbol names.
git-svn-id: trunk@27315 -
2014-03-28 09:07:58 +00:00
sergei
ebdbf21650 * tx86addnode.second_cmpfloatsse and tx86addnode.second_cmpfloatavx are identical except instruction opcodes -> merged into second_cmpfloatvector, cleaned up, and allowed constant operands at both sides.
git-svn-id: trunk@27314 -
2014-03-28 09:04:28 +00:00
nickysn
b1f69349f8 * use voidpointertype.size to obtain the current data (self) pointer size,
instead of checking the i8086 memory model manually in tprocvardef.size

git-svn-id: trunk@27313 -
2014-03-28 00:40:08 +00:00
nickysn
359bd9a13a * fixed class name in comment
git-svn-id: trunk@27312 -
2014-03-28 00:16:03 +00:00
nickysn
2644d7566c * refactored tcgtypeconvnode.second_pointer_to_array to use
hlcg.reference_reset_base, which removes the need for i8086-specific ifdefs

git-svn-id: trunk@27311 -
2014-03-28 00:10:29 +00:00
nickysn
81875346cf * fixed tcginlinenode.second_SizeOfTypeOf for i8086 far data memory models by
using the high level code generator for all operations, that involve pointers

git-svn-id: trunk@27310 -
2014-03-28 00:07:39 +00:00
nickysn
26b53607f8 + added method reference_reset_base with support for different pointer types to
the high level code generator. All hlcg code, except for the jvm code
  generator, updated to use the new method. I didn't update jvm (it still uses
  the method from cgutils), because I'm not familiar with that platform, so I
  might get the types wrong.

git-svn-id: trunk@27309 -
2014-03-28 00:01:18 +00:00
nickysn
7f88dc9d95 + added symdef.voidstackpointertype - the pointer type that will be used in the
high level code generator for obtaining references to parameters, local
  variables and temps on the stack.

git-svn-id: trunk@27308 -
2014-03-27 23:23:20 +00:00
Tomas Hajny
9fb4db7a2f * add support for Latin-2 character sets (ISO & IBM)
git-svn-id: trunk@27304 -
2014-03-27 22:48:13 +00:00
marco
ec394b2495 * remove stale uses strutils;
git-svn-id: trunk@27301 -
2014-03-27 18:18:39 +00:00
sergei
31edfdc05f * i386: push references with size OS_F64 using less instructions.
git-svn-id: trunk@27300 -
2014-03-27 14:48:23 +00:00
sergei
965540eab3 * Let tx86addnode.check_left_and_right_fpureg() act as when its argument was=true (removed argument and renamed to force_left_and_right_fpureg). Its action when force_fpureg=false is now coded separately.
git-svn-id: trunk@27299 -
2014-03-27 11:42:24 +00:00
Károly Balogh
3b9e2a620b added a remark about a possible QEMU issue with CMP/CMPI .W and .B on ColdFire
git-svn-id: trunk@27291 -
2014-03-26 17:08:16 +00:00
Károly Balogh
1af6d17b4d don't enforce BPL length, use SUBQ in g_concatcopy
git-svn-id: trunk@27290 -
2014-03-26 15:43:25 +00:00
Károly Balogh
9ae38cdc1c back to more conservative sign extension. this really needs separate handling for ColdFire and normal 68k, because the CF executes 32bit arithmetics only while normal 68k will do any size happily.
git-svn-id: trunk@27289 -
2014-03-26 15:02:50 +00:00
nickysn
22acb2e44b * moved the i8086 specific code from tpointerconstnode.create to the i8086
descendant class

git-svn-id: trunk@27285 -
2014-03-25 22:00:23 +00:00
nickysn
bd75abb64b + fill the treference.segment in tcgtypeconvnode.second_pointer_to_array when
the source type is a far (or huge) pointer

git-svn-id: trunk@27279 -
2014-03-25 01:46:45 +00:00
nickysn
a9f56d2714 * refactored tcgtypeconvnode.second_ansistring_to_pchar to use the high level
code generator and work in all i8086 memory models. Removed the i8086-specific
  overriden version.

git-svn-id: trunk@27278 -
2014-03-25 01:27:58 +00:00
nickysn
897802c7c4 + fill the treference segment correctly in the load node for localvarsyms and
paravarsyms that are passed by reference in a i8086 far data memory model

git-svn-id: trunk@27277 -
2014-03-25 00:50:18 +00:00
nickysn
122f66b11a + support passing far addresses in tcg8086.a_loadaddr_ref_cgpara
git-svn-id: trunk@27276 -
2014-03-25 00:45:22 +00:00
nickysn
ee7a6dfc2e * set the para sizes correctly for push_addr_params in i8086 far data memory
models. This breaks compilation of the system unit in the compact and large
  memory models once again, but the generated code wasn't correct in the first
  place, so it's not really a loss.

git-svn-id: trunk@27275 -
2014-03-25 00:40:48 +00:00
nickysn
3cd9cef182 + added a far pointer aware implementation of hlcg.getaddressregister for i8086.
This should allow writing memory model independent code in the FPC code
  generator.

git-svn-id: trunk@27274 -
2014-03-25 00:18:32 +00:00
florian
9464dad2b4 * handle vldr/vstr references with offsets correctly
git-svn-id: trunk@27273 -
2014-03-24 19:20:29 +00:00
florian
01b311f6cf * do not insert constant tables on arm thumb in it* sequences
git-svn-id: trunk@27272 -
2014-03-24 19:20:01 +00:00
nickysn
510fa9596f * add 'option quiet' to wlink to suppress its info messages
git-svn-id: trunk@27271 -
2014-03-24 18:13:29 +00:00
nickysn
eddab86312 * pass the -b option to wlib to avoid creating .bak files
git-svn-id: trunk@27270 -
2014-03-24 17:35:11 +00:00
florian
3309254474 * do not write a space before the condition for instructions without operands, not sure why this was there
git-svn-id: trunk@27268 -
2014-03-24 17:09:28 +00:00
florian
23c8517418 * applying opXYX2opsXY to ADD makes no sense on thumb-2 (at least as far as I can see)
git-svn-id: trunk@27267 -
2014-03-24 17:01:38 +00:00
Károly Balogh
7093efe4c4 fixed comment, no functional changes
git-svn-id: trunk@27266 -
2014-03-24 16:53:29 +00:00
nickysn
71720533d7 * fixed the comparison of near pointers in i8086 far data memory models
+ added charfarpointertype and charnearpointertype to symdef
* the system unit compiles in the i8086 compact memory model now

git-svn-id: trunk@27251 -
2014-03-24 00:34:52 +00:00
nickysn
2b57a50233 * i8086 far data model implementation of typeconvnode.second_ansistring_to_pchar
git-svn-id: trunk@27248 -
2014-03-23 22:32:46 +00:00
nickysn
f6b18e9b8d * i8086 far data memory model fixes in defutil.def_cgsize
git-svn-id: trunk@27247 -
2014-03-23 22:14:09 +00:00
nickysn
97a3f50351 * use voidpointertype.size (supports i8086 far data memory models) instead of
sizeof(pint) to return the size of tabstractpointerdef

git-svn-id: trunk@27246 -
2014-03-23 20:34:19 +00:00
florian
7107e9d5ea * do cse on all const. intregable expressions
git-svn-id: trunk@27245 -
2014-03-23 20:11:15 +00:00
nickysn
043c0ba215 * use voidpointertype.size (which supports i8086 far data memory models) instead
of sizeof(pint) in tobjectdef.size and tobjectdef.alignment when returning the
  size and alignment of classes and interfaces

git-svn-id: trunk@27244 -
2014-03-23 19:36:33 +00:00
nickysn
5d9a193887 * use voidpointertype.size instead of sizeof(pint) in tarraydef in order to
determine the size of dynarrays correctly in the i8086 far data memory models

git-svn-id: trunk@27243 -
2014-03-23 18:33:14 +00:00
nickysn
149db35910 * i8086 far data memory model fix in ncgutil.new_exception
git-svn-id: trunk@27242 -
2014-03-23 18:11:50 +00:00
nickysn
ebdfbeaac8 * return voidpointertype.size instead of sizeof(pint) in tstringdef.size in
order to return the correct size in the far data i8086 memory models

git-svn-id: trunk@27241 -
2014-03-23 17:44:52 +00:00
nickysn
2556ada8da * instead of setting savesize in each of the tstringdef constructors, added an
tstringdef.size overriden method, which returns the proper size according to
  the string type

git-svn-id: trunk@27240 -
2014-03-23 17:29:10 +00:00
florian
686a2d2f3f + Support omitting the frame pointer on arm even in procedures with incoming parameters
on the stack, this can be enabled by -OoFORCENOSTACKFRAME. This reduces the required
  entry/exit code and makes an extra register available to the compiler. However, since this is
  based on an estimation of the required stack size, it might have two drawbacks:
  either the stack frame is estimated to big, the program requires a bigger stack than needed
  or it is estimated too small, then the compiler throws an internalerror during compilation. These
  issues can be overcome as soon as the compiler supports recompiling subroutines if needed.

git-svn-id: trunk@27239 -
2014-03-23 14:38:53 +00:00
florian
04464b8622 * do not create an fpc_zeromem node if size=0
git-svn-id: trunk@27224 -
2014-03-21 16:34:35 +00:00
florian
6f14dbdebe * avoid internal error if an empty record is assigned to a function result, resolves #25895
git-svn-id: trunk@27223 -
2014-03-21 16:31:57 +00:00
florian
303e8c609d * internalerror unified
git-svn-id: trunk@27222 -
2014-03-21 16:31:17 +00:00
florian
842e027a9f + prove of concept how FMA4 could be supported in inline assembler
git-svn-id: trunk@27214 -
2014-03-20 21:25:38 +00:00
Jonas Maebe
f936a48afa * don't change the forward/interface definition of regular forward/interface
functions whose implementation is declared "external". This results in less
    efficient code (all calls will go through a stub), but it prevents interface
    crc changes (-> no recompilations in case of circular dependencies) and it
    also keeps the interface stable (if the external implementation is changed
    afterwards to another external routine or to a local implementation, the
    mangled name of the routine does not change) (mantis #24121)

git-svn-id: trunk@27213 -
2014-03-20 21:03:07 +00:00
florian
a79be2b05c + support for FMA instructions in inline assembler
+ extended avx test code with FMA

git-svn-id: trunk@27209 -
2014-03-20 20:06:56 +00:00
florian
aa107b914c * merged avx2 branch, developed by Torsten Grundke
git-svn-id: trunk@27200 -
2014-03-20 12:03:52 +00:00
Jonas Maebe
1ac4021178 * moved po_has_inlininginfo from procoptions to procimploptions so that
the availability of the body of a function declared as "inline" no
    longer changes the CRC and hence no longer triggers recompilations
    (mantis #24121)

git-svn-id: trunk@27192 -
2014-03-19 21:53:10 +00:00
Jonas Maebe
72c1e2a8ce * write newline after synthetickind
git-svn-id: trunk@27191 -
2014-03-19 21:53:06 +00:00
Jonas Maebe
c47b4cbe86 * fixed spacing of "alias names"
git-svn-id: trunk@27190 -
2014-03-19 21:53:02 +00:00
Jonas Maebe
7d8e9cf0f6 * moved tprocdef.isempty to a new set called implprocoptions that
contains flags related to the procdef's implementation (and that
    don't influence the interface crc)

git-svn-id: trunk@27189 -
2014-03-19 21:52:59 +00:00
florian
b2b26f84cf * partially merged the mips-embedded branch of Michael Ring:
- startup code/controller units are not merged yet
  - assembler call does not pass the needed CPU type yet

git-svn-id: trunk@27188 -
2014-03-19 21:25:38 +00:00
nickysn
8ff628afe1 + added i_msdos.pas and t_msdos.pas to ppc8086.lpi
git-svn-id: trunk@27186 -
2014-03-19 16:20:25 +00:00
florian
0e5cf6529e + peephole optimizations AndMovzToAnd, MovMov2Mov1 and MovMov2MovMov1 for x86-64
git-svn-id: trunk@27181 -
2014-03-18 21:54:42 +00:00
Jonas Maebe
4dfc731bdc + support for nested classes in the WPO devirtualisation and VMT
optimization infrastructure (mantis #25869)

git-svn-id: trunk@27167 -
2014-03-16 19:46:17 +00:00
Jonas Maebe
80863a8361 * fixed warning/compilation
git-svn-id: trunk@27166 -
2014-03-16 19:46:10 +00:00
Jonas Maebe
5dd4389f78 * made internalerror unique
git-svn-id: trunk@27165 -
2014-03-16 19:45:56 +00:00
sergei
3fb304cbe2 - Removed Win64 SEH code specific to results of managed types returned in registers. Since r26228 managed types are always returned in parameters.
git-svn-id: trunk@27162 -
2014-03-16 15:48:49 +00:00
Jonas Maebe
8d4c372d50 * removed ifdef jvm from ncgvmt
git-svn-id: trunk@27154 -
2014-03-16 11:24:44 +00:00
Jonas Maebe
73a3f5ced4 * moved ncgutil.maybechangeloadnodereg() to hlcg.maybe_change_load_node_reg()
and moved ifdef'd jvm code to overridden method

git-svn-id: trunk@27153 -
2014-03-16 11:24:40 +00:00
Jonas Maebe
dab8754bb6 * moved joinreg64 from cg64f32 to cgobj (joinreg128 is also declared
there)

git-svn-id: trunk@27152 -
2014-03-16 11:24:36 +00:00
Jonas Maebe
d8e228e82d - removed unnecessary JVM-specific code
git-svn-id: trunk@27151 -
2014-03-16 11:24:32 +00:00
Jonas Maebe
d46c353849 * migrated JVM-specific second_nil_to_methodprocvar code to njvmcnv
git-svn-id: trunk@27150 -
2014-03-16 11:24:29 +00:00
Jonas Maebe
84442d05f9 * renamed fobjcforcedprocname to fforcedprocname and also use it for the
JVM target to force virtual method calls to be name-based rather than
    VMT-entry-based

git-svn-id: trunk@27149 -
2014-03-16 11:24:25 +00:00
Jonas Maebe
908bbed312 * moved jvm-specific tarrayreftype from cgutils to jvm/cpubase
git-svn-id: trunk@27148 -
2014-03-16 11:24:21 +00:00
sergei
c003f934c5 * Included cs_opt_peephole into genericlevel1optimizerswitches, so it is re-enabled for all targets after r27106.
- Removed cs_opt_peephole from level1optimizerswicthes on i386 and i8086, it is redundant due to the above change.

git-svn-id: trunk@27147 -
2014-03-15 21:23:29 +00:00