Commit Graph

273 Commits

Author SHA1 Message Date
florian
5c67fcc43f + change always floating point divisions into multiplications if they are a power of two,
this is an exact operation so it is always allowed
* change only divisions by normal numbers into multiplications

git-svn-id: trunk@29085 -
2014-11-16 20:47:38 +00:00
nickysn
63305cc2e6 + added directive {$HUGEPOINTERARITHMETICNORMALIZATION} to control the
cs_hugeptr_arithmetic_normalization local setting
+ added the cs_hugeptr_comparison_normalization local setting and corresponding
  directive {$HUGEPOINTERCOMPARISONNORMALIZATION} to set it
* the {HUGEPOINTERNORMALIZATION} changed to set both of the huge pointer
  normalization settings, according to the specified compiler type ('BORLANDC',
  'MICROSOFTC' or 'WATCOMC')

git-svn-id: trunk@28151 -
2014-07-04 14:43:46 +00:00
nickysn
aee568e6fc * cs_hugeptr_normalization renamed to cs_hugeptr_arithmetic_normalization,
because we're going to also introduce cs_hugeptr_comparison_normalization as
  an independent option

git-svn-id: trunk@28149 -
2014-07-04 13:14:06 +00:00
nickysn
b3bb9df19f + added a $HUGEPOINTERNORMALIZATION switch
git-svn-id: trunk@28088 -
2014-06-27 13:56:12 +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
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
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
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
aa107b914c * merged avx2 branch, developed by Torsten Grundke
git-svn-id: trunk@27200 -
2014-03-20 12:03:52 +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
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
florian
7eace968e7 + UNICODESTRINGS feature flag
git-svn-id: trunk@27026 -
2014-03-07 21:25:38 +00:00
svenbarth
ddb78fefdc Add a modeswitch for type helpers as discussed in core on 24th October 2013. It is disabled by default in all modes (afterall type helper support in Delphi started only beginning with XE3)
+ globtype.pas: add new modeswitch to modeswitch enum and name array
* ptype.pas & pdecobj.pas: check for new modeswitch instead of modeswitch class
* ppu.pas: increase ppu version as we've added a new modeswitch which requires correctly compiled units

* adjusted tests to enabled the modeswitch when necessary
+ added three new tests that check for correct functionality of modeswitch typehelpers

git-svn-id: trunk@26796 -
2014-02-16 12:58:24 +00:00
florian
d8c0f11ff9 + cs_userbp optimizer switch, so on x86-64 the compiler can make use of rbp if it is not needed as frame pointer
git-svn-id: trunk@26633 -
2014-01-30 19:44:17 +00:00
florian
4aebcdaa94 * enable node dfa for life information with -O3:
- all known issues with it are fixed
  - the resulting warnings about uninitialized warnings are better than that ones from the old code
  - with node dfa in place, stuff like dead store removal, strength reduction and ssa can be finished now
  - drawback: with node dfa enabled, the compiler is 2-3% slower, there is still some room for improvement though

git-svn-id: trunk@26165 -
2013-12-01 17:02:19 +00:00
florian
1a4584f4c6 + dead store elimination, based on a patch by Jeppe Johansen
git-svn-id: trunk@25962 -
2013-11-06 21:10:26 +00:00
florian
b928b1e9c9 * reorganized generic optimization switches
git-svn-id: trunk@25959 -
2013-11-06 21:10:17 +00:00
nickysn
ac66f3ae1b + added new field 'define' to ttargetswitchinfo, which specifies a system macro
to be defined while the target switch is active
* the CLD target switch defines 'FPC_ENABLED_CLD' once again

git-svn-id: trunk@25594 -
2013-09-28 14:14:32 +00:00
nickysn
bd0585274e * tsettings.enablecld converted to a targetswitch ts_cld
git-svn-id: trunk@25592 -
2013-09-28 13:41:58 +00:00
nickysn
52a5ffc386 * use apptype to indicate that the target is a DOS .COM file, instead of introducing a new field in tsettings (as suggested by Sven)
git-svn-id: trunk@25544 -
2013-09-24 12:13:47 +00:00
nickysn
567cdf875b + added new i8086 compiler options -Wtexe and -Wtcom for specifying the MS-DOS
binary format (.exe or .com)
* the default format for i8086 tiny model binaries changed to .exe

git-svn-id: trunk@25528 -
2013-09-21 16:44:14 +00:00
Jonas Maebe
a14ceba791 + -CTinitlocals switch for the JVM that initialises all local variables
that may trigger JVM bytecode verification errors if they are used
    before they are initialised (this includes passing them as a "var"
    parameter) + test
  * sorted -CT parameters alphabetically and alligned them

git-svn-id: trunk@25387 -
2013-08-29 22:21:23 +00:00
Jonas Maebe
6013606a97 + -CTlowercaseprocstart switch to lowercase the first character of routines
so that code written according to Delphi coding standards can be compiled
    into JVM bytecode with routine names conforming to JVM coding standards

git-svn-id: trunk@25385 -
2013-08-29 22:21:15 +00:00
sergei
5c4abfa75a + Implemented saving/restoring registers using PUSH/POP instructions on i386 targets with non-fixed stack. Provides some advantage in code size (e.g. the compiler becomes about 20KBytes smaller).
* This should be applicable to i8086 targets as well (but needs testing), by copying changes from i386/cgcpu.pas to i8086/cgcpu.pas and removing "$ifdef i386" lines in cgx86.pas.

git-svn-id: trunk@25224 -
2013-08-07 09:59:07 +00:00
nickysn
a9c949e551 * the memory model const sets introduced in r24812 moved to i8086/cpuinfo.pas
git-svn-id: trunk@24816 -
2013-06-08 19:52:28 +00:00
nickysn
9eecec4910 + added const sets for the i8086 memory models based on the code and data model type
git-svn-id: trunk@24812 -
2013-06-08 14:36:12 +00:00
nickysn
b409d600ee + implemented the tiny memory model for i8086-msdos; we now produce working dos .com files as well
git-svn-id: trunk@24793 -
2013-06-02 23:02:10 +00:00
nickysn
ed29f7a92d + far pointer support in tpointerconstnode
git-svn-id: trunk@24566 -
2013-05-24 12:41:53 +00:00
nickysn
5ed1222e64 * changed the default i8086 calling convention to pocall_pascal
git-svn-id: branches/i8086@24290 -
2013-04-21 18:03:36 +00:00
nickysn
51d61cc593 * define the i8086 default calling convention separately from the other x86 architectures
git-svn-id: branches/i8086@24272 -
2013-04-19 23:30:53 +00:00
florian
1ab42714c3 + fix compilation by adding a Int32 type, no sure why it is needed
git-svn-id: branches/i8086@24055 -
2013-03-29 15:15:12 +00:00
florian
63f6afffd5 + make empty proc. removal switchable by removeemptyprocs
git-svn-id: trunk@23621 -
2013-02-14 21:40:04 +00:00
paul
f9277d2043 compiler: add comment for all application types
git-svn-id: trunk@23602 -
2013-02-13 02:05:07 +00:00
florian
3ca7a5ff8e - remove switch -Wx for arm thumb interworking, one should use -CTHUMBTINTERWORKING=ON instead
git-svn-id: trunk@23572 -
2013-02-04 21:46:27 +00:00
Jonas Maebe
4022c29500 * mark each target switch with whether it's global or not, so a compiler
directive can be added that enables changing the local ones

git-svn-id: trunk@23562 -
2013-02-02 15:22:13 +00:00
florian
7184306a4c + option -Wx to generate thumb interworking safe code on arm
git-svn-id: trunk@23463 -
2013-01-20 15:26:59 +00:00
florian
fce9e953b4 + nested exit support
git-svn-id: trunk@23309 -
2013-01-04 19:09:04 +00:00
Jonas Maebe
4aa05f5133 + support for automatically generating setters/getters for properties on the
JVM target, since Java bytecode itself has no support for properties and
    hence exposing properties to external Java code can only be done through
    getters/setters. Use the new parameters to do so:
      -CTautogetterprefix=XXX
      -CTautosetterprefix=YYY
    The getter/setter will get the same visibility as the property. If a
    getter/setter with the same naming convention was already specified for a
    property and this getter/setter is declared in the same class as the
    property, then the visibility of this existing getter/setter is
    modified and no new routine is generated.

    Newly generated getters/setters are virtual methods, because that is
    the only way in Java bytecode to allow redefining these getters/setters
    in child classes. However, that also means that using these switches can
    change the behvaviour of code, since normally the used property definition
    is only determined by the declared type of its associated class instance,
    and not by the actual instance type. The compiler will therefore warn when
    such an automatically generated getter/setter is overridden by another
    automatically generated getter/setter in a child class.

git-svn-id: trunk@22959 -
2012-11-08 20:18:08 +00:00
florian
761fcca4ec + is_dynamicstring
+ implement low/high for dynamic strings, resolves #15244 and #22936
+ basic support for $zerobasedstrings directive

git-svn-id: trunk@22933 -
2012-11-04 21:48:53 +00:00
Jeppe Johansen
8b17a358e4 Remove all traces of the interrupt vector table generation mechanism
Clean up cpuinfo tables
Fixed ARMv7M bug(BLX <label> doesn't exist on that version)

git-svn-id: branches/laksen/arm-embedded@22579 -
2012-10-08 00:10:52 +00:00
florian
f25f44605e - get rid of m_all, use a set instead for tokens, this allows to disable/enable tokens depending on the language mode
git-svn-id: trunk@22506 -
2012-09-30 21:03:35 +00:00
Jonas Maebe
8a4c12ab36 * include -Oofastmath in -O4
git-svn-id: trunk@22268 -
2012-08-30 08:00:33 +00:00
Jonas Maebe
f5de7e34d3 * only remove the calculation of unused parameters of inline routines if
they don't have explicit side-effects, and if -Oodeadvalues (part of -O4)
    is active (because it can result in the removal of range check errors,
    segmentation faults, etc)

git-svn-id: trunk@22254 -
2012-08-26 21:04:46 +00:00
florian
4d86d25c6c * -O4 switch for optimizations which are correct but which might have unexpected effects
like field reordering (possible problems cracker classes) or using ebp as normal register (broken
      stack traces from dump_stack)
    + niln is also valid in a cse domain
    * parameters passed by reference shall have a complexity >1
    * load nodes from outer scopes shall have a complexity >1
    * better cse debugging
    + more node types added to cse
    * consider parameters passed by reference in cse
    * take care of cse in parameters in simple cases

git-svn-id: trunk@22050 -
2012-08-09 18:58:54 +00:00
florian
b330bba0bc + introduce -Oofastmath
* limit the application of the tree transformation introduced in r21986 to safe cases and -Oofastmath

git-svn-id: trunk@22040 -
2012-08-08 19:35:45 +00:00
florian
eb1efdff8a + introduce cstylearrayofconst because pocall_mwcall was forgotten at several places
git-svn-id: trunk@22012 -
2012-08-05 08:48:23 +00:00
Jonas Maebe
3798b79fd7 + optimization that (re)orders instance fields of Delphi-style classes in
order to minimise memory losses due to alignment padding. Not yet enabled
    by default at any optimization level, but can be (de)activated separately
    via -Oo(no)orderfields
   o added separate tdef.structalignment method that returns the alignment
     of a type when it appears in a record/object/class (factors out
     AIX-specific double alignment in structs)
   o changed the handling of the offset of a delegate interface
     implemented via a field, by taking the field offset on demand
     rather than at declaration time (because the ordering optimization
     causes the offsets of fields to be unknown until the entire
     declaration has been parsed)

git-svn-id: trunk@21947 -
2012-07-22 16:47:19 +00:00
florian
3a9e3991be * the switch -Oouseebp allows the i386 compiler to use ebp as normal register
the drawback of this is that get_caller_frame and get_caller_addr might not work
  anymore because they make the wrong assumption (i.e. not required by the abi)
  that ebp contains always a valid (not necessarily the current) frame pointer

git-svn-id: trunk@21918 -
2012-07-15 19:23:36 +00:00
Jonas Maebe
b0462d27cc * by default, no longer initialize enumeration fields of classes/objects
with the enum instance corresponding to ordinal 0 in JVM constructors,
    because a virtual method called by a parent constructor may already
    have assigned a different value (see tests/test/jvm/tenum2.pp). This
    will result in null pointer exceptions when using such fields without
    first explicitly assigning a value to them though.

    The old behaviour can be restored with the new -CTenumfieldinit command
    line parameter

git-svn-id: trunk@21736 -
2012-06-29 21:24:35 +00:00
Jonas Maebe
ca29bb10af - zapped some gremlins in comments
git-svn-id: trunk@21503 -
2012-06-06 18:55:38 +00:00