Commit Graph

301 Commits

Author SHA1 Message Date
Károly Balogh
38837ee973 m68k: make the new register calling convention the default
git-svn-id: trunk@34828 -
2016-11-06 22:01:25 +00:00
pierre
4d09dfca95 Remember usage of checkpointer (-gc) option:
Use new cs_checkpointer_called moduleswitches set element.
     Use new uf_checkpointer_called PPU flag (reusing obsolete uf_local_browser flag value)
     Emit warning if compiled library/program has any code using checkpointer.
  
 * ppu.pas: New constant: uf_checkpointer_called
 * globtype.pas: New constant: cs_checkpointer_called
 * fppu.pas: Set uf_checkpointer_called flag if cs_checkpointer_called is set in current_settings.module_switches
 * i8086/n8086mem.pas: Include cs_checkpointer_called in current_settings.moduleswitches
 *  ncgmem.pas: Likewise.
 * msg/errore.msg: Add new message saying that -gc and -Ur options are incompatible
   Add description to -gc option, saying it is experimental.
   Add warning at link time for program/library if checkpointer is used in any unit or main code.
 * options.pas: if -gc and -Ur options are used, never enable checkpointer code,
   instead output a warning that release is incompatible with -gc option.
 * pmodules.pas: proc_program: Check all modules for uf_checkpointer_called flag,
   emit a warning if checkpointer is used.
 * utils/ppuutils/ppudump.pp: Add code for uf_codepointer_called option.

git-svn-id: trunk@34567 -
2016-09-27 14:46:09 +00:00
yury
db590da1e6 * Added a new debug option switch -godwarfcpp - Simulate C++ debug information in DWARF. It is more correct way to workaround LLDB issues than in r34558. This option can be used for debuggers, which does not support Pascal correctly.
git-svn-id: trunk@34562 -
2016-09-26 13:05:17 +00:00
svenbarth
86b9381673 Add new Delphi compatible switch {$G+/-}, {$IMPORTEDDATA ON/OFF} which handles generation of indirect references for cross unit variable accesses if needed for the target.
globtype.pas:
  + tlocalswitch: extend by cs_imported_data
globals.pas:
  * default_settings: cs_imported_data is set by default (Delphi compatible)
switches.pas:
  * turboSwitchTable: G is used for cs_imported_data
scandir.pas:
  + new directive handler dir_importeddata
  * InitScannerDirectives: handle IMPORTEDDATA with dir_importeddata

git-svn-id: trunk@33281 -
2016-03-18 22:04:57 +00:00
florian
cb4773432b + hardfloat directive (arm only): use hard float calling conventions regardless of the abi, resolves #29715
git-svn-id: trunk@33196 -
2016-03-06 15:47:31 +00:00
pierre
40193ea1db Add pi_has_open_array_parameter to proc_info.flags as this requires special handling for i8086 huge memory model to restore DS register correctly
git-svn-id: trunk@32922 -
2016-01-11 15:02:10 +00:00
nickysn
bfa96171e0 * changed the asizeint and asizeuint to 32-bit on CPUs with 16-bit address
space, in order to allow data structures larger than 32k (and less than 64k)

git-svn-id: trunk@32529 -
2015-11-25 15:35:38 +00:00
Jeppe Johansen
0046af39eb Fixed #29025.
Some architecture bit-nesses were missing.

git-svn-id: trunk@32442 -
2015-11-21 17:05:00 +00:00
florian
70b8789262 o basic extended pascal support:
+ automatically loaded helper unit
  * Makefiles adapted
  * mode switch
  * mode switches reorganized
+ TimeStamp support

git-svn-id: trunk@32330 -
2015-11-15 15:13:36 +00:00
Károly Balogh
3675fc75cb VLink Support:
* fixed for MorphOS, added for Amiga/m68k
* enabled as default when running natively on these systems (cross still defaults to GNU LD)
* added -XV command line switch to enable/disable it
* dropped the 'fpc' prefix from vlink binary name on MorphOS

git-svn-id: trunk@32324 -
2015-11-15 01:18:30 +00:00
nickysn
b26e10d53c + generate proper win16 prologue/epilogue for exported routines (we don't yet
actually export them from the .exe or .dll, but they can now be used as
  callbacks)
+ support win16 smart callbacks via the $K switch

git-svn-id: trunk@31835 -
2015-09-26 18:04:59 +00:00
nickysn
e0aa6bf85f * the FarProcsPushOddBP target switch made local instead of global (BP7 compatibility)
git-svn-id: trunk@31833 -
2015-09-26 15:14:15 +00:00
Jonas Maebe
2cf8e50771 * fixed unwanted disabling of a codepage set via -FcXXX/{$codepage XXX}
when {$modeswitch systemcodepage} gets disabled without having been
    enabled first (such as when initially setting the syntax mode)
    (mantis #28718)

git-svn-id: trunk@31831 -
2015-09-25 18:31:58 +00:00
Jonas Maebe
4564bffb85 * use binutils 2.19+ linker script "augmentation" functionality to specify
how the fpc sections have to be linked *on Linux*. This prevents the
    "did you forget -T" warnings from ld, and in general is more correct than
    our previous approach of specifying a complete linker script without -T
    and hoping that there won't be any unexpected interactions with ld's
    built-in linker script (fixed version of r31664, thanks to Alan Modra)
   o use the new -X9 command line option to generate linker scripts that
     are compatible with binutils older than 2.19 (reverts to the old
     behaviour)

git-svn-id: trunk@31675 -
2015-09-14 07:24:54 +00:00
Jonas Maebe
e06a759e20 - reverted r31664, it causes crashes with some ld versions :/
git-svn-id: trunk@31670 -
2015-09-13 20:14:46 +00:00
Jonas Maebe
cd41bf672c * use binutils 2.19+ linker script "augmentation" functionality to specify
how the fpc sections have to be linked *on Linux*. This prevents the
    "did you forget -T" warnings from ld, and in general is more correct than
    our previous approach of specifying a complete linker script without -T
    and hoping that there won't be any unexpected interactions with ld's
    built-in linker script
   o use the new -X9 command line option to generate linker scripts that
     are compatible with binutils older than 2.19 (reverts to the old
     behaviour)

git-svn-id: trunk@31664 -
2015-09-13 19:06:14 +00:00
Jeppe Johansen
3cb9be73bc Moved tcontrollerdatatype out into cpuinfo.
Added cputype and fputype info to tcontrollerdatatype arrays.

git-svn-id: trunk@31574 -
2015-09-07 20:36:54 +00:00
florian
a645de74d7 * fix warning
git-svn-id: trunk@31571 -
2015-09-07 20:06:07 +00:00
nickysn
bdfd23cc2e + new target switch "FarProcsPushOddBP", which causes the i8086 compiler to push
odd values of BP if the procedure is far. Enabled this by default for Win16.

git-svn-id: trunk@31569 -
2015-09-07 19:05:18 +00:00
Jonas Maebe
1b43930749 - removed long deprecated/buggy assembler cse optimiser for i386
o bumped ppu version because optimiser settings can be embedded in generic
     token streams

git-svn-id: trunk@30835 -
2015-05-09 17:25:07 +00:00
florian
06fd4223e9 + optimization setting level4
+ change tail calls into jmp if a ret without constant follows

git-svn-id: trunk@29653 -
2015-02-08 11:24:30 +00:00
Jonas Maebe
5d4837329b * changed {$modeswitch blocks} to {$modeswitch cblocks} to avoid confusion
with the Pascal meaning of the term "block"

git-svn-id: trunk@29594 -
2015-02-01 15:50:06 +00:00
Jonas Maebe
eb419b58c5 - disable inlining of routines that contain a call to a C-style varargs
function, as we don't save/restore the synthetic paravarsyms that
    are created for this

git-svn-id: trunk@29584 -
2015-01-30 19:31:22 +00:00
Jonas Maebe
146e3bcb9e * synchronised with trunk till r29513
git-svn-id: branches/blocks@29516 -
2015-01-21 23:28:34 +00:00
Jonas Maebe
e97f31541e - reverted partial commit of merge
git-svn-id: branches/blocks@29515 -
2015-01-21 23:24:37 +00:00
Jonas Maebe
a76bbf363d * synchronised with trunk r29513
git-svn-id: branches/blocks@29514 -
2015-01-21 23:18:29 +00:00
nickysn
b193073e32 + support the $fpcmemorymodel macro in fpc.cfg
git-svn-id: trunk@29315 -
2014-12-23 18:55:57 +00:00
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
Jonas Maebe
bd09b88a5b + support for http://en.wikipedia.org/wiki/Blocks_(C_language_extension)
o blocks are implemented as a variation of procedure variables
   o declaration of a block variable: "test: procedure(c: char) is block;"
     (C equivalent: (void)(^test)(char c) )
   o the compiler automatically converts procedures/functions whose address
     is passed to a block parameter or assigned to a block variable into
     a "block". This consists of
    1) generating a block descriptor (containing the size of the "block
       literal" (see below) and the signature of the invocation function
       encoded as an Objective-C selector)
    2) generating a wrapper function around the original funcion (with C
       calling convention), that has an extra first hidden parameter
       (marked as vo_is_parentfp in the compiler) whose type is a pointer
       to the describing "block literal"
    3) generating the "block literal", which contains a pointer to an
       external variable indicating whether this block captures context or
       not, some flags (see compiler/blockutl.get_block_literal_flags for
       info), a pointer to the wrapper function and a pointer to the
       descriptor. In the future, it will also contain captured variables.
   o right now, only global procedures/functions can be converted to blocks
     (because they don't require state capturing). The next steps are (Object
     Pascal) methods (not Objective-C methods, because Objective-C method
     procvars don't exist) and finally nested functions
   o on Mac OS X, the functionality will only work on Mac OS X 10.7 and later,
     because we have to use the so-called "ABI.2010.3.16" to ensure that
     our blocks aren't called as variadic functions by the runtime (which
     came out after the Mac OS X 10.6 release)
   o while the currently implemented functionality does not require any
     library support at all, there's no use enabling it on other platforms
     because unless it has been confirmed to work with a blocks runtime,
     there's no point in using blocks (they're just somewhat bulky procvars
     right now). Enabling it on other platforms (in combination with the
     GNUStep Objective-C run time), should simply be a matter of adding
     the right {$linklib xxx} statement to rtl/inc/blockrtl.pp file, adding
     that file to Makefile.fpc for that platform and adding that platform
     to the compiler/systems.systems_blocks_supported set

git-svn-id: branches/blocks@28232 -
2014-07-18 09:15:22 +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