Commit Graph

16956 Commits

Author SHA1 Message Date
nickysn
8b7863d076 + added warning in case a far pointer is declared on a platform that does not
support them

git-svn-id: trunk@28084 -
2014-06-27 09:26:08 +00:00
sergei
acd3ea8750 * m68k: Fixed parameter passing to conform to ABI:
* records are passed by value
  * records with size of 1,2 or 4 are returned in registers
  * parameters with size<4 are justified on the stack according to big-endian target

Now everything except floating-point parameters is compatible with C code compiled with "-malign-int -mrtd".
Compatibility with "-mno-align-int" is achievable by changing target_info.maxCrecordalign to 2, but doings so causes a lot more troubles because RTL (incorrectly) assumes that records declared with {$PACKRECORDS C} are aligned to pointer size.

+ Reuse parameter locations. Since everything is passed on stack, it reduces code size quite a bit.
- tm68kparamanager.getintparaloc removed, generic implementation has been tested and works as expected.

git-svn-id: trunk@28083 -
2014-06-27 06:58:39 +00:00
nickysn
140ce2a880 + added the compact and large memory models to the compiler command line option
help screen

git-svn-id: trunk@28082 -
2014-06-26 22:56:55 +00:00
nickysn
ce87e72721 * show an error if the user attempts to create a dos .com file in an i8086
memory model other than tiny

git-svn-id: trunk@28081 -
2014-06-26 22:52:57 +00:00
Károly Balogh
5276de5627 m68k: restored orglen variable to g_concatcopy which was actually used, but still got removed in r28072
git-svn-id: trunk@28080 -
2014-06-26 19:46:57 +00:00
Károly Balogh
3028f3ac78 m68k: disabled PEA debug comment accidentally left in
git-svn-id: trunk@28077 -
2014-06-26 16:50:42 +00:00
Károly Balogh
d93e7b3367 m68k: cleaned ancient silly debug mess from a_loadaddr_ref_reg. no functional changes.
git-svn-id: trunk@28076 -
2014-06-26 16:47:55 +00:00
Károly Balogh
1388cb9bae m68k: implemented a proper a_loadaddr_ref_cgpara instead of the disabled mess in the source, utilizing the PEA instruction
git-svn-id: trunk@28075 -
2014-06-26 16:39:17 +00:00
sergei
4c3eb391ef * m68k: cleaned out unused variables in cgcpu.pas
* Fixed reference strength in a_call_reg.

git-svn-id: trunk@28072 -
2014-06-26 08:27:38 +00:00
Jeppe Johansen
857a849173 Added an additional check to the MulAdd2MLA optimization. The operands of the multiplication weren't checked.
git-svn-id: trunk@28071 -
2014-06-26 06:05:08 +00:00
sergei
3ffa32a660 - m68k: removed garbage (tab characters, commented out code, unused variables, debug output and alike). Functionality unchanged.
git-svn-id: trunk@28070 -
2014-06-26 06:01:29 +00:00
nickysn
dc17b55505 * switch to asmmode_i8086_intel instead of asmmode_i386_intel on i8086 when tp
or delphi mode is selected. This fixes the error "Selected assembler reader
  not supported" in programs that specify $mode tp/delphi, but do not explicitly
  set $asmmode intel.

git-svn-id: trunk@28068 -
2014-06-25 22:02:03 +00:00
nickysn
9b560ffd64 * x86 intel syntax inline asm: allow a segment override (segcs,segds,seges,etc.)
to be followed by an instruction on the same line as the override

git-svn-id: trunk@28066 -
2014-06-25 21:06:19 +00:00
sergei
ad59098457 + m68k: initial implementation of g_stackpointer_alloc method, it has to exist for targets with non-fixed stack.
git-svn-id: trunk@28064 -
2014-06-25 17:43:37 +00:00
nickysn
0d4edf118e + added upper limits to the heapmin and heapmax values set by the $M directive
git-svn-id: trunk@28056 -
2014-06-25 09:33:04 +00:00
sergei
1e9f57467d - m68k: removed "-dNOOPT" at build time, enabling the branch optimizer. Not tested thoroughly, but it does not change compiler behavior unless "-O1" or higher is supplied at command line.
git-svn-id: trunk@28054 -
2014-06-25 09:03:48 +00:00
Károly Balogh
531ac093ed m68k: implemented a simple a_cmp_const_ref_label. uses TST instruction to test ref contents against zero
git-svn-id: trunk@28053 -
2014-06-25 06:56:58 +00:00
sergei
c79cd3beca * m68k: fixed/completed the inverse_cond function.
git-svn-id: trunk@28052 -
2014-06-25 05:23:30 +00:00
nickysn
9f31fcc2ca + added support for HeapMax in the far data i8086 memory models as well
git-svn-id: trunk@28051 -
2014-06-24 22:54:54 +00:00
nickysn
db011dfb7a + added a warning if HeapMax<HeapMin is specified with the $M directive
git-svn-id: trunk@28042 -
2014-06-24 09:16:03 +00:00
nickysn
1910177cf0 + added heapmax support to the $M directive on i8086-msdos. It is currently
only implemented in the near data memory models. The far data models support
  is still a TODO.

git-svn-id: trunk@28039 -
2014-06-23 20:17:17 +00:00
sergei
e367ccc0ee * MIPS: changed superregister number for $fcc0..$fcc7 to start from 32, so that range 0..31 can be used without translating into symbolic names.
* Change register type of second operand in CTC1 and CFC1 instructions to R_SPECIALREGISTER, so it is not output using a symbolic name. Mantis #26380.

git-svn-id: trunk@28034 -
2014-06-22 22:01:44 +00:00
sergei
53b0ef1f61 - Removed superfluous tai_align, the new_section procedure creates one itself.
git-svn-id: trunk@28027 -
2014-06-21 22:36:17 +00:00
nickysn
0f5b13d45b * allow setting a heap size of exactly 1024 bytes with the $M directive, since
that's a valid heap size value for the -Ch command line option

git-svn-id: trunk@28026 -
2014-06-21 21:51:27 +00:00
Károly Balogh
519094055c m68k: cleaned up and fixed cgcpu/fixref for coldfire at least; also enabled n68kmem node, so addressing with scaling is generated now
git-svn-id: trunk@28025 -
2014-06-21 21:36:48 +00:00
Jeppe Johansen
a1197460e1 Constrained a number of optimizations and updated reference offsets for ARM Thumb.
Embedded target can now build with optimizations.

git-svn-id: trunk@28023 -
2014-06-21 13:26:33 +00:00
nickysn
36d6fb7868 * don't add the stack segment declaration at the beginning of each object file
in the i8086 far data memory models as well

git-svn-id: trunk@28022 -
2014-06-21 10:41:57 +00:00
nickysn
ef88fec688 * nested ifdefs in TX86NasmAssembler.WriteHeader replaced with an 'if defined()'
sequence

git-svn-id: trunk@28019 -
2014-06-21 08:28:15 +00:00
nickysn
40b2d3d562 * don't add the heap segment declaration at the beginning of each object file in
the i8086 far data memory models

git-svn-id: trunk@28018 -
2014-06-21 08:15:18 +00:00
Jonas Maebe
2df1d5ec58 * don't allow default parameter values for parameter types that don't accept
constant values (i.e., anything non-value/const/constref) (mantis #263363)
   o fixed default parameter value for var-parameter in chmreader

git-svn-id: trunk@28016 -
2014-06-20 19:50:20 +00:00
Károly Balogh
195dbc15fa + second try on warning fix
git-svn-id: trunk@28015 -
2014-06-20 13:36:57 +00:00
Károly Balogh
00b55e100c + try to fix the warnings introduced in r27947, so the compiler builds with -Sew
git-svn-id: trunk@28014 -
2014-06-20 13:10:07 +00:00
Károly Balogh
2881bc81b1 m68k: tweaks and fixes in n68kmem. the node is still disabled, needs further fixes in cgcpu/fixref to work properly
git-svn-id: trunk@28011 -
2014-06-20 11:49:38 +00:00
Jeppe Johansen
0dc39b5d63 Applied patch from Michael Ring that adds some startup code for some new stm32f0 and stm32f1 controllers, and fixes naming on some LPC ARMv6m controllers.
git-svn-id: trunk@28009 -
2014-06-20 06:49:04 +00:00
sergei
c2a29a0dbb + MIPS: implemented peephole optimization which changes appropriate patterns into conditional moves, which are available on MIPS4 and higher.
git-svn-id: trunk@28008 -
2014-06-20 05:57:39 +00:00
sergei
4e7c908b0d + MIPS: added movn and movz instructions.
git-svn-id: trunk@28007 -
2014-06-19 22:44:17 +00:00
nickysn
7cfd7a66cd + create a special 'heap' segment with reserved space equal to heapsize (i.e.
the value set by -Ch or the second parameter to the $M directive). This is
  equivalent to the heapmin value in Turbo Pascal 7 and ensures that the program
  has at least this amount of heap space available (otherwise DOS will show a
  'not enough memory' error and will refuse to load the program).

git-svn-id: trunk@28002 -
2014-06-19 14:14:01 +00:00
sergei
25037f5318 - MIPS: completely removed trgcpu.add_constraints method.
While it can be correct from some point of view, it does not prevent aliasing a single-precision register into upper half of double-precision one. This is currently handled by making only even floating-point registers available to RA. At the same time, it somehow (possibly due to another bug in RA) generates a lot of unnecessary moves, as if physical double-precision registers conflict with each other. Anyway, removing it considerably improves the code without regressions in the test suite.

git-svn-id: trunk@27999 -
2014-06-19 03:59:24 +00:00
Jonas Maebe
de0041466f * fixed system.openchararraytype after r27970 (mantis #26359)
git-svn-id: trunk@27998 -
2014-06-18 20:20:04 +00:00
sergei
c260879439 * MIPS: updated registers, dropped special registers not recognized by GAS (actually, "pc" is recognized, but it is used only for MIPS16 mode, so it is easier to add back if/when this mode is supported), added FPU condition code registers ($fcc0..$fcc7).
* cpubase.pas, std_regname: changed logic to lookup known names for special registers before resorting to default name, so that $fcc0..$fcc7 can be used as operands.

git-svn-id: trunk@27992 -
2014-06-17 23:15:34 +00:00
sergei
c77225d2c4 + MIPS: added some instructions.
git-svn-id: trunk@27991 -
2014-06-17 22:52:35 +00:00
sergei
a8e30043db + MIPS: more peephole optimizations (basically updated to the state of SPARC peephole).
git-svn-id: trunk@27990 -
2014-06-17 22:50:29 +00:00
sergei
04d8e8a5dc * On 64-bit targets, handle abs(int64) internally, using the same code as for abs(longint), i.e. without branching. Both generic and x86-specific pass 2 code is already suitable for different operand sizes, only type checking needs removal of excessive conversions to 32 bits.
git-svn-id: trunk@27989 -
2014-06-17 18:45:11 +00:00
sergei
244f65525b * MIPS: dropped gas_std_regname, its functionality merged into std_regname. This fixes register names in non-instructions (reg. allocation information, variable locations, etc.) and makes assembler listings more readable.
git-svn-id: trunk@27986 -
2014-06-16 22:52:56 +00:00
sergei
77d97303a9 * SPARC: cleanup and simplify 64-bit code generator. Call cg.a_op64_const_reg_reg where possible to make use of its optimization abilities.
git-svn-id: trunk@27985 -
2014-06-16 19:22:52 +00:00
sergei
51f6092672 * SPARC: OP_NOT can always be done in 32 bits, because for 8 and 16-bit operations the high bits of result are adjusted immediately afterwards.
* "carry clear" flag can be converted into register using a single instruction.

git-svn-id: trunk@27984 -
2014-06-16 19:15:01 +00:00
sergei
d6c6c84f76 * calc_divconst_magic_unsigned: explicitly limit the shift amount to number of bits of target platform. This happens implicitly only on x86, on other 32-bit targets shifting by more than 31 bits calculates as zero.
git-svn-id: trunk@27983 -
2014-06-16 17:05:01 +00:00
Jonas Maebe
9450407ed5 * when taking the address of a method1 that is specified by subscripting
the result of a objtype.method2 call, ensure that we call method2 with
    objtype as methdpointer rather than the self node of the current routine
    (mantis #24844)

git-svn-id: trunk@27977 -
2014-06-15 17:26:12 +00:00
sergei
9593cece03 * powerpc: implement cg.a_mul_reg_reg_pair method and switch to generic code for division by constants.
git-svn-id: trunk@27976 -
2014-06-15 16:33:08 +00:00
sergei
5356f17fa5 * i386: switch the div/mod node to shared code, leaving in place the specific optimization for division by power of 2.
git-svn-id: trunk@27975 -
2014-06-15 16:20:53 +00:00
Jonas Maebe
99b4389297 * fixed tbs/tb0607 for 64 bit targets: there the nf_internal flag isn't set
for cardinal-cardinal. Now treat the result of any sub node as potentially
    negative.

git-svn-id: trunk@27971 -
2014-06-15 15:26:56 +00:00
Jonas Maebe
24f4adf657 * set the rangedef of open arrays to ptrsinttype (instead of s32inttype),
so that it's the same as the def returned by the low/high nodes
    (mantis #25703)

git-svn-id: trunk@27970 -
2014-06-15 15:26:47 +00:00
Károly Balogh
c6153010d1 m68k: plain 68000 doesn't support index scaling at all (020+ and CF only)
git-svn-id: trunk@27967 -
2014-06-15 12:28:51 +00:00
Jonas Maebe
159a35da4e * check for read/write after a newly declared property (mantis #26011)
o this reverts the support that was added for such declarations when
     mantis #4676 was fixed, but this was done for Delphi compatibility
     and
    a) current Delphi versions don't accept such declarations anymore either
    b) such declarations are meaningless
   o fixed a number of such invalid property declarations in packages

git-svn-id: trunk@27966 -
2014-06-15 10:59:47 +00:00
Jonas Maebe
5795daf2cd * removed no longer used/needed {$ifdef jvm} parts
git-svn-id: trunk@27965 -
2014-06-15 10:59:42 +00:00
nickysn
82eb84ddff + added warning in case of an $M directive with an invalid stack size specified
git-svn-id: trunk@27964 -
2014-06-15 10:14:56 +00:00
nickysn
c868a5e0ea * check whether the stack size specified in the $M directive exceeds the maximum
stack size
* allow setting a stack size of _exactly_ 1024 bytes with the $M directive

git-svn-id: trunk@27963 -
2014-06-15 09:55:13 +00:00
nickysn
d7f9265eba * limit the stack size set by the -Cs option to 65520 bytes on i8086 and other
CPUs with a 16-bit address space

git-svn-id: trunk@27960 -
2014-06-14 22:48:09 +00:00
nickysn
22a7dfa231 * stack segment moved outside of dgroup in the i8086 far data memory models, so
it no longer eats from the precious 64kb limit for static data

git-svn-id: trunk@27959 -
2014-06-14 19:34:36 +00:00
nickysn
49f93b4464 * use the 'order' wlink directive to specify the segment order, instead of using
'option dosseg'. This allows us more flexibility in setting up the segment
  order the way we like.

git-svn-id: trunk@27958 -
2014-06-14 18:04:58 +00:00
nickysn
2dc8839af5 * set class=data to all data segments/sections on i8086
git-svn-id: trunk@27957 -
2014-06-14 16:01:22 +00:00
nickysn
8ad63788c7 - do not emit a stack segment in the tiny memory model
- rm the reference to the top of the stack segment from the startup code in tiny
  model

git-svn-id: trunk@27956 -
2014-06-14 15:56:44 +00:00
sergei
05ecd3cec1 * One more fix of operand size, likely harmless because shift amount is taken modulo bit-width anyway.
git-svn-id: trunk@27955 -
2014-06-14 13:31:48 +00:00
Jonas Maebe
8634aa8ad2 * fixes for the support for overriding properties on the JVM target:
o only create an accessor wrapping the inherited accessor at a
     potentially lower visibility level if the overriding property
     itself does not specify a different accessor to use
   o simplified code
   o tests

git-svn-id: trunk@27954 -
2014-06-14 10:35:35 +00:00
Jonas Maebe
a8ed74d4d2 * remove "override" from automatically getter/setter if it's based upon an
existing getter setter (at a different visibility level) with a different
    name, since the new one will have a unique name and not override anything
    else

git-svn-id: trunk@27953 -
2014-06-14 10:35:29 +00:00
Jonas Maebe
d384db84af * don't generate a getter/setter if no explicit prefix has been specified
and the visibility of the specified getter/setter is >= the visibility
    of the property

git-svn-id: trunk@27952 -
2014-06-14 10:35:25 +00:00
Jonas Maebe
0742b65a2b * pstring -> pshortstring (fix for r27940)
git-svn-id: trunk@27951 -
2014-06-14 10:35:21 +00:00
Károly Balogh
0045f34322 tabs to spaces and indentation fix, no functional changes
git-svn-id: trunk@27950 -
2014-06-14 09:09:53 +00:00
sergei
15bf176bc0 * Fixed building on x86_64 with 2.6.4, which generates unsigned division with sign-extended left for "(-qword) mod qword". Mantis #26336.
git-svn-id: trunk@27948 -
2014-06-14 03:12:08 +00:00
svenbarth
c6496f8ec5 Fix for Mantis #26278.
pbase.pas:
  + add an overload for identifier_not_found for which the file position can be supplied
pexpr.pas, factor_read_id:
  * store the file position before reading the identiifer token
  * use the new identiifer_not_found overload to explicitely set the file position
  * set the file position of the created node

git-svn-id: trunk@27947 -
2014-06-13 21:36:55 +00:00
sergei
be6d6d90d7 + Division-by-constant optimization for x86_64 (merged i386 code adapted for different operand sizes, so the result should be suitable for i386 as well).
git-svn-id: trunk@27945 -
2014-06-13 12:32:45 +00:00
sergei
d83fb7790e * Fixed masking high bits when calculating 32-bit magic numbers for unsigned division on 64-bit CPU, namely on x86_64. Original powerpc64 code did calculations always in 64 bits, that's why incorrect masking went unnoticed.
git-svn-id: trunk@27943 -
2014-06-13 12:27:04 +00:00
Jonas Maebe
2075dc5a53 * support for raising the visibility of inherited properties on the JVM
target (generate new getters/setters with increased visibility that
    call the inherited ones, if necessary)

git-svn-id: trunk@27940 -
2014-06-12 11:08:44 +00:00
Jonas Maebe
5f99ec6197 * factored out overridden properties into a virtual method
git-svn-id: trunk@27939 -
2014-06-12 11:08:41 +00:00
Jonas Maebe
2bd39f62cb * factored out associating properties with their getters/setters/fiels
o moved JVM-specific code from pdecvar (and pjvm) to jvm/symcpu

git-svn-id: trunk@27938 -
2014-06-12 11:08:38 +00:00
Jonas Maebe
47c6b08ece * changed write-only parameter of parse_symlist() into an out-parameter
git-svn-id: trunk@27937 -
2014-06-12 11:08:33 +00:00
Károly Balogh
7963351440 m68k: removed comment generation line accidentally left in from the previous commit
git-svn-id: trunk@27936 -
2014-06-11 22:42:26 +00:00
Károly Balogh
ed3ce4087a m68k: try to generate a bit smaller code in g_adjust_self; also changed two JMPs to S_NO from S_L, because JMP is unsized anyway
git-svn-id: trunk@27935 -
2014-06-11 22:33:09 +00:00
sergei
dc628b8969 * x86: Completely skip instructions that do not exist for target CPU bit width. The existing behavior of writing mnemonics and properties but no encoding allows an invalid instruction to be recognized by assembler reader or even generated by compiler, but it but won't assemble anyway.
git-svn-id: trunk@27934 -
2014-06-11 22:31:40 +00:00
sergei
e7cd5319f0 * Put under {$ifndef x86_64} more cases of instructions that do not exist in 64-bit mode.
git-svn-id: trunk@27933 -
2014-06-11 12:51:38 +00:00
sergei
c28271ab99 * NASM writer: don't force 'near' size for all non-far branches and calls, it disables NASM's capability to optimize branches into short form where possible, and thus only increases size of generated code.
- LDS and LES instructions do not exist on x86_64.

git-svn-id: trunk@27932 -
2014-06-11 12:32:21 +00:00
sergei
b594eee70b * Moved x86_64 mod/div code to x86, with minimal changes to ensure it compiles on i386/i8086. Merging optimized division-by-const code from i386 is pending...
git-svn-id: trunk@27930 -
2014-06-11 01:42:46 +00:00
masta
0cb1a129b3 {ARM} Implement usage of generic division-by-const optimization
This utilizes the code commited in r27904 to convert a division by const
into a 32x32->64 bit multiplication for ARM.

git-svn-id: trunk@27929 -
2014-06-10 20:49:18 +00:00
Jonas Maebe
145e9c1aae * don't generate debug info for class fields in generic types
-> fixes failed compilation of webtbs/25600 with debug info
      (broken since 6 June, possibly because of r27874)
  * don't allocate class fields defined in generic types, as the
    only reason for this was to have valid debug info

git-svn-id: trunk@27928 -
2014-06-10 19:05:10 +00:00
Jeppe Johansen
96b73b0076 Fixed generation of abs calls for thumb and thumb-2 targets.
git-svn-id: trunk@27926 -
2014-06-10 17:48:09 +00:00
Károly Balogh
1b11541c90 m68k: simplification and cleanup of g_proc_entry. the generated code shouldn't change
git-svn-id: trunk@27922 -
2014-06-10 09:15:26 +00:00
sergei
cd27d64cd5 + Support (as target-independent as possible) optimization of division by constants:
The code generator gets two new methods, a_mul_reg_reg_pair and g_div_const_reg_reg. The first one is basically 32x32 to 64 bits multiplication (or any other size, with result having twice the size of arguments), which must be implemented for every target. The second one actually does the job, its default implementation taken from powerpc64 and is sufficiently good for all three-address targets.

+ Enabled optimized division for MIPS target, target-specific changes are under 30 lines.

git-svn-id: trunk@27904 -
2014-06-08 22:50:24 +00:00
nickysn
73d7f2aa18 * let the compiler generate the stack segment in i8086 near data memory models
as well. Even though, in these models, the stack is dynamically allocated
  (because it goes on top of the heap, but the heap is variable size), there are
  still benefits:
  1) the program will run on a larger stack during initialization, before the
     actual stack (and heap) are ready
  2) in cases, when the system is extremely low on memory, DOS will reject to
     load the program if there's not enough memory for the stack the program
     requires. This way the startup code can be further simplified by omitting
     the 'not enough memory' check in the future (when we add the minimum heap
     size to the executable reserved space as well).

git-svn-id: trunk@27903 -
2014-06-08 21:14:57 +00:00
sergei
ed46a07f62 * Using x86-specific capability of shifting with carry flag helps to reduce amount of instructions.
git-svn-id: trunk@27899 -
2014-06-08 14:01:41 +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
sergei
c184d9740c + Implemented target-independent optimization of signed "mod 2**N" as
"sign:=left sar sizeof(left)*8-1; result:=(((left xor sign)-sign) and 2**N-1) xor sign)-sign;"
  This solution yields larger code than one suggested by Mantis #21152, however its speed on i386 is approximately the same, and it is also suitable for all operand sizes, all powers of two and all targets.

git-svn-id: trunk@27891 -
2014-06-07 22:19:10 +00:00
sergei
92cf25b9a5 * Reworked i386 division by constant optimization to reuse code from powerpc64. The algorithm is slightly different, signed version is one instruction shorter, unsigned one is one instruction longer (typically). The new algorithm is easily scalable for x86_64 target, unlike the old one.
git-svn-id: trunk@27884 -
2014-06-07 00:20:05 +00:00
sergei
90d2009a31 * Moved procedures calculating "magic" numbers for division by constants from powerpc64/cgcpu.pas to cgutils.pas, so they can be reused for all targets.
* "Shift" parameter for signed calculation changed from aint to byte, since it only holds values up to 63. It is consistent with unsigned routine.

git-svn-id: trunk@27883 -
2014-06-07 00:00:53 +00:00
Károly Balogh
af95876eba arm: an attempt to improve the a_op_const_ref patch in r27881
git-svn-id: trunk@27882 -
2014-06-06 20:48:31 +00:00
Károly Balogh
5b262df7d0 arm: have a CPU specific op_const_ref, so the reference doesn't get fixed up both in a_load_reg_ref and a_load_ref_reg
git-svn-id: trunk@27881 -
2014-06-06 17:44:45 +00:00
Károly Balogh
17657ca11d m68k: more minor reference usage tweaking, hopefully fixes Mantis 26286
git-svn-id: trunk@27880 -
2014-06-06 16:41:40 +00:00
svenbarth
49a9f4c1ea Fix for Mantis #26123.
pdecobj.pas, object_dec:
  * Always check for genericdef and genericlist and not genericdef and ifnot then genericlist.

+ added test

git-svn-id: trunk@27877 -
2014-06-06 15:19:45 +00:00
Károly Balogh
381cf72023 m68k: minor bits, addq/subq works also on address regs, remove reference validity check in a_op_const_ref because we have fixref() later anyway
git-svn-id: trunk@27876 -
2014-06-06 15:15:03 +00:00
svenbarth
34394d6925 Fix for Mantis #26180. Accept undefineddef as first parameter type of an Assert if it is used inside a generic.
ninl.pas, tinlinenode.pass_typecheck:
  * if the first parameter of an Assert is a undefineddef node then accept it as well if the node is part of a generic function/method

+ added test

git-svn-id: trunk@27875 -
2014-06-06 14:39:27 +00:00
svenbarth
aca48a4cf2 Fix for Mantis #26288. Types declared inside a generic must have the df_generic flag set. Period.
ptype.pas, read_named_type:
  * array_dec & procvar_dec: set df_generic of the array/procvar if parse_generic was originally set

+ added test

git-svn-id: trunk@27874 -
2014-06-06 14:22:17 +00:00
svenbarth
4a0d27ebfe Fix for Mantis #26271: Don't trash local variables that are used for the Default() intrinsic.
* ngenutil.pas, tnodeutils.trashable_sym:
    check for vo_is_default_var flag and don't consider such as trashable

+ added test

git-svn-id: trunk@27872 -
2014-06-06 13:59:52 +00:00
svenbarth
1bbcc08a8b Fix for Mantis #26176. Don't handle "type helper" as unique.
ptype.pas:
  * read_named_type: change hadtypetoken from a value to a var parameter and set it to false if a type helper is parsed so that calling code does not handle it as unique
  * read_anon_type: handle that hadtypetoken is now a var parameter

pgenutil.pas, generate_specialization:
  * handle that hadtypetoken of read_named_type is now a var parameter

+ added test

git-svn-id: trunk@27870 -
2014-06-06 13:26:21 +00:00
svenbarth
9ab5affd55 Contrary to popular believe the VMT for a generic needs to be at least generated so that check for inherited methods can be done correctly. This does however not mean that the VMT is written to the object file which is handled at a completely different place. Fixes Mantis #26193.
pdecl.pas, types_dec:
  * invoke the VMT builder for generic classes as well

+ added test

git-svn-id: trunk@27869 -
2014-06-06 13:05:39 +00:00
Károly Balogh
df7af34de9 m68k: very early optimizer implementation experiments
git-svn-id: trunk@27862 -
2014-06-06 07:38:50 +00:00
svenbarth
639a59df92 Added support for partial specialization. This should fix a few problems with generics, the tests for which will be added in the next days after I've verified them.
For partial specialization only the declaration is reparsed, but not method bodies.

The way generic parameters are passed around inside the compiler is changed: instead of creating new type symbols we keep a (name,def) pair so that the code in insert_generic_parameter_types can decide whether it needs to add a type symbol (for new undefined defs) or not (for real types and undefined defs that were passed on from the parent generic). This required the tfpobjectlist type of the genericlist variables/parameters to be changed to tfphashobjectlist.

For correctly parsing Delphi specializations as parameters in functions of records (or objects) the relationship between the def and its typesym must already be established during the parsing. For this the checks for forcing a "type is not completely defined" message needed to be adjusted to correctly handle nested types as well. This should as a sideeffect also allow the usage of nested constants, etc like was fixed for classes some months ago.

ToDo: 
  - if a generic is specialized with only fully defined types then we could generate the in the unit where it's used. This is not yet done.
  - currently we don't specialize generics that are currently parsed; maybe this could be improved in the future for better type compatibility checks
  - check whether the pausing of token recording for partial specializations works correct in context of hint modifiers

pgenutil.pas:
  * parse_generic_parameters: return a tfphashobjectlist instead of a tfpobjectlist (requires a few type adjustments in various other declarations)
  * maybe_insert_generic_rename_symbol, insert_generic_parameter_types: change genericlist from tfpobjectlist to tfphashobjectlist
  * parse_generic_specialization_types_internal: use is_generic instead of checking for df_generic
  * generate_specialization:
      + add a nested function to disable the requirement to check for method bodies
      * use the "simple" parameter parsing only for error recovery
      * instead of already creating a new type symbol for a parameter we use the found symbol's name and its def and maybe create it later on (therefor the type of tfpobjectlist was changed to tfphashobjectlist)
      * a partial specialization is specialized into the symtable of the def it is specialized in instead of one of the two global symtables
      * for now we handle partial specializations of generics we are currently parsing like before
      * don't continue recording generic tokens while we do a partial specialization
      * use the new unset_forwarddef function on the newly created defs
  * insert_generic_parameter_types: only create a new type symbol if the found type symbol does not yet have an owner (thus was freshly created for this generic declaration)

pdecobj.pas, object_dec:
  * change type of genericlist from tfpobjectlist to tfphashobjectlist
  * set the type sym for all object types that can be generic or inside a generic (needed for correctly parsing Delphi style generic declarations)

pdecsub.pas, parse_proc_head:
  * consume_generic_interface: always generate the specialization name as now all generics are "specialized" inside a generic
  * the assumption that the def index numbers are the same is no longer true as the genericdef might contain the defs of partial specializations which are not generated for full specializations

pdecvar.pas, read_record_fields:
  * we also need to check nested types whether they contain a not yet completely parsed record or object

ptype.pas:
  * read_named_type: 
      * change genericlist from tfpobjectlist to tfphashobjectlist
      * pass the typesymbol along to record_dec
  * resolve_forward_types: use is_generic instead of checking for df_generic
  * single_type: 
      * use is_generic instead of checking for df_generic
      * no need to check generic parameters
  * parse_record_members:
      + add parameter for the record's type symbol
      * setup the typesym <=> def relationship
  + record_dec: add parameter for the type symbol and pass it to parse_record_members
  * read_named_type, expr_type: use is_generic instead of checking for df_generic
  * array_dec & procvar_dec: change genericlist from tfpobjectlist to tfphashobjectlist

symdef.pas, tstoreddef:
  * improve the checks used in is_generic and is_specialization to really only work on true generics and true (and partial) specializations respectively
  * don't search the type parameters in the symtable, but store them in the PPU and load them from there
  - remove fillgenericparas method (including the calls in the descendants tarraydef, tprocvardef, tobjectdef and trecorddef)

defcmp.pas, compare_defs_ext:
  * handle partial specializations: specializations with only undefineddefs are compatible to generic defs

pdecl.pas, types_dec:
  * switch generictypelist from tfpobjectlist to tfphashobjectlist

ppu.pas:
  * increase PPU version

+ added tests that ensure that "not completely defined" checks for records (and objects) still work correctly

git-svn-id: trunk@27861 -
2014-06-05 20:05:05 +00:00
sergei
bcddc40150 * powerpc64: removed references to global variables 'cg' (it is implicit 'self' in methods of tcg descendants) and 'current_asmdata.currasmlist' (the asmlist to use is passed as argument).
git-svn-id: trunk@27860 -
2014-06-05 16:06:36 +00:00
Károly Balogh
0fe656e82d m68k: simplified code generated by g_concatcopy and cleaned up the old mess from the code
git-svn-id: trunk@27859 -
2014-06-05 12:42:36 +00:00
sergei
217ab9879c * Enabled internal handling of Abs(longint) for all targets. It has been implemented in cross-platform way ages ago (see tcginlinenode.second_abs_long), but not enabled on MIPS,SPARC and m68k.
- RTL: removed MIPS,SPARC and m68k-specific implementations of Abs(longint), and marked the generic one as  required for bootstrapping purposes only.

git-svn-id: trunk@27857 -
2014-06-05 10:35:51 +00:00
sergei
c76dedfd31 * MIPS: re-enable peephole optimizations which got disabled by r27106 and were not restored in r27147. Unfortunately such things are hard to detect reliably in automated way.
git-svn-id: trunk@27852 -
2014-06-04 22:34:46 +00:00
nickysn
70732aedbb * ti8086nodeutils.InsertMemorySizes: stack segment creation moved to a separate
method

git-svn-id: trunk@27851 -
2014-06-04 13:44:10 +00:00
sergei
4202343033 * MIPS: emit ".set nomips16" and ".set noreorder" directives for procedures declared as "assembler nostackframe", as it is done for regular procedures. Handwritten assembler routines typically utilize delay slots, and it is desirable that assembler does not mess it up.
git-svn-id: trunk@27847 -
2014-06-04 00:26:44 +00:00
nickysn
a52d8abe38 * changed the default stack size in the i8086 far data memory models to 16 KB
git-svn-id: trunk@27841 -
2014-06-01 14:38:54 +00:00
Jonas Maebe
02d36c56f7 * fixed compilation (changes after testing :/ )
git-svn-id: trunk@27840 -
2014-06-01 14:34:47 +00:00
Jonas Maebe
5e1a895e95 * removed JVM-specific creation of methodpointertype and
nestedprocpointertype; this was done initially before the JVM target knew
    about the voidpointertype, but is no longer necessary (also fixes
    mantis #26251)

git-svn-id: trunk@27838 -
2014-06-01 14:13:36 +00:00
sergei
274c2fc82f * handle_ln_const: if/else branches were swapped, correct values are: ln(0)=-Inf and ln(-#)=NaN.
* handle_ln_const and handle_sqrt_const handle all arguments, not just invalid ones, so calling code can be simplified.

git-svn-id: trunk@27837 -
2014-06-01 01:20:06 +00:00
Károly Balogh
f3bbad26c3 m68k: use MOVEA without size to load values to address regs. use a_op_const_reg in a_op_const_ref for smarter const loading when necessary
git-svn-id: trunk@27828 -
2014-05-30 05:29:22 +00:00
nickysn
47a7a9835a * added hack to support stack exceeding 32kb in size in the i8086 far data
memory models

git-svn-id: trunk@27827 -
2014-05-29 17:07:01 +00:00
svenbarth
2c6d3f1428 Read the deref of the fieldvarsym into the correct variable. I wonder how this ever went past the test suite O.o
symsym.pas, tstaticvarsym.ppuload:
  * read the deref of the fieldvarsym into fieldvarsymderef, not defaultconstsymderef

git-svn-id: trunk@27826 -
2014-05-29 16:24:47 +00:00
nickysn
e9cb275f66 * put the i8086-msdos stack segment in a separate object file
git-svn-id: trunk@27825 -
2014-05-29 16:04:15 +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
Károly Balogh
2936335f68 removed silly ancient writeln debug from me...
git-svn-id: trunk@27821 -
2014-05-28 18:36:58 +00:00
nickysn
3cc8ff11e3 + generate the stack segment for i8086 far data memory models from within fpc
itself (instead of having a fixed 16k stack in the startup code). This allows
  setting the stack size in these models with the -Cs option.

git-svn-id: trunk@27820 -
2014-05-27 23:29:50 +00:00
sergei
3c1368903f * Updated header: this file is in cp866 encoding.
git-svn-id: trunk@27819 -
2014-05-27 22:45:04 +00:00
sergei
743326dc70 * abs(): when translated to generic fpc_abs_real() helper, typecast result back to original precision, similar to how it is done for sqr and sqrt. Fixes compilation on m68k after r27808 (m86k looks like the only target still needing this generic handling).
git-svn-id: trunk@27818 -
2014-05-25 11:55:55 +00:00
Károly Balogh
28323135f8 m68k: minor optimizations to g_proc_exit() - use LEA for stackpointer math which is better than ADDing large constants, also only modify the SP reg once
git-svn-id: trunk@27817 -
2014-05-25 01:34:00 +00:00
nickysn
02dff17ae0 * taddrnode: fixed getting the address of nested procs in tp mode in i8086 far
data memory models

git-svn-id: trunk@27816 -
2014-05-23 22:38:07 +00:00
sergei
37625211f5 * Fixed sqrt procedure selection on arm-wince after r27809.
git-svn-id: trunk@27815 -
2014-05-23 21:58:23 +00:00
nickysn
cb05907e18 * fixed the global function to nested procvar conversion in the i8086 far data
memory models

git-svn-id: trunk@27814 -
2014-05-23 20:59:07 +00:00
nickysn
24fcac9f87 + added support for nested procvars in the i8086 far data memory models
git-svn-id: trunk@27812 -
2014-05-22 23:44:09 +00:00
sergei
1c7a5d5adc * x86: fix spilling of sqrtss and sqrtsd instructions, they cannot have memory as destination.
git-svn-id: trunk@27810 -
2014-05-22 07:19:13 +00:00
sergei
22e099d000 * sqrt(real): for targets with emulated floating point, invoke float64_sqrt or float32_sqrt from softfpu code. Testing on ARM CPU shows that float64_sqrt executes about twice faster and offers better accuracy than fpc_sqrt_real from genmath.inc.
* softfpu.pp: changed float64_sqrt into a function, so it is consistent with other compiler-invoked routines.

git-svn-id: trunk@27809 -
2014-05-21 15:07:13 +00:00
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