Commit Graph

317 Commits

Author SHA1 Message Date
Jonas Maebe
68457f0dc5 - disabled cs_opt_use_load_modify_store by default, because it does not
handle LOC_(C)SUBSETREF/REG. The optimisation itself has been fixed
    in trunk (r45301-r45305), the changes are too invasive to merge to
    fixes_3_2 at this time (mantis #37018)

git-svn-id: branches/fixes_3_2@45317 -
2020-05-09 11:07:58 +00:00
pierre
875af11d02 Merge of commits 39916, 39925 and 39963
------------------------------------------------------------------------
r39916 | yury | 2018-10-12 14:43:17 +0000 (Fri, 12 Oct 2018) | 1 line

* Fixed checks for exceeding limit of locals space. Prevent range and overflow errors during the checks. Introduced the MaxLocalsSize constant which provides the maximum possible size of locals space (stack frame) depending of bitness of a cpu.
------------------------------------------------------------------------
--- Merging r39916 into '.':
U    compiler/tgobj.pas
U    compiler/globtype.pas
--- Recording mergeinfo for merge of r39916 into '.':
 U   .
------------------------------------------------------------------------
r39925 | pierre | 2018-10-13 12:00:31 +0000 (Sat, 13 Oct 2018) | 1 line

 Set MaxLocalsSize according to address size not register size
------------------------------------------------------------------------
--- Merging r39925 into '.':
G    compiler/globtype.pas
--- Recording mergeinfo for merge of r39925 into '.':
 G   .
------------------------------------------------------------------------
r39963 | yury | 2018-10-17 19:12:27 +0000 (Wed, 17 Oct 2018) | 1 line

* Fixed range check errors.
------------------------------------------------------------------------
--- Merging r39963 into '.':
G    compiler/tgobj.pas
--- Recording mergeinfo for merge of r39963 into '.':
 G   .

git-svn-id: branches/fixes_3_2@40834 -
2019-01-10 12:22:58 +00:00
florian
0c6cf12fbf + support for the directive $EXCESSPRECISION
git-svn-id: trunk@39443 -
2018-07-12 21:39:50 +00:00
florian
0eea2141f6 * patch by J. Gareth Moreton: clarity in directive conflict error messages, resolves #33754
git-svn-id: trunk@39407 -
2018-07-07 14:46:01 +00:00
florian
4f5f3c4a09 + support for vmov.xx vreg,#imm on arm
git-svn-id: trunk@39297 -
2018-06-24 12:39:59 +00:00
svenbarth
97acf24290 + add a new modeswitch ArrayOperators which is set by default in Delphi modes that enables the internal array operators (currently only "+")
git-svn-id: trunk@39259 -
2018-06-20 19:53:43 +00:00
nickysn
600b460ecd + added new debug output option -godwarfomflinnum for generating line number
information in OMF LINNUM records, in addition to the DWARF debug information.
  This enables source level debugging on i8086-msdos, when using the Open Watcom
  Debugger, provided the source was compiled with this option and the external
  linker (wlink) was used for generating the executable (the internal linker
  does not yet support generating debug information).

git-svn-id: trunk@39014 -
2018-05-17 14:38:50 +00:00
florian
512328deee * include loop unrolling in -O3, as it is done carefully, it is beneficial on average
git-svn-id: trunk@38687 -
2018-04-04 21:39:44 +00:00
florian
31f78ea2b6 + implementation of the vectorcall calling convention by J. Gareth Moreton
+ tests

git-svn-id: trunk@38206 -
2018-02-11 17:50:37 +00:00
svenbarth
90bd408de4 * fix for Mantis #32355: adjust the meaning of the typehelpers modeswitch for Delphi modes in that it enables the "type helper" syntax as it is in the non-Delphi modes; extending primitive types with record helpers is now always enabled in Delphi modes
+ added test

git-svn-id: trunk@37225 -
2017-09-15 21:09:21 +00:00
florian
94c3ac027b * fixed spelling: fpc_mode -> gpc_mode
git-svn-id: trunk@36632 -
2017-07-03 20:48:53 +00:00
nickysn
012153201a * moved the conversion of "x:=x op k" to inline nodes to a separate optimization
pass, so that it can be done after other optimizations, such as constant
  propagation

git-svn-id: trunk@35961 -
2017-04-26 22:44:01 +00:00
Jonas Maebe
4c68ea1000 * use pocalls_cdecl and cstylearrayofconst more consistently instead of
ad hoc set constants containing varying number cdecl-like calling
    conventions
   o added pocall_sysv_abi_cdecl and pocall_ms_abi_cdecl to cstylearrayofconst
   o also allow C-style blocks with mwpascal instead of cdecl (mwpascal = cdecl
     with "const" = "constref" for record parameters)
   o did not touch cases related to name mangling and import/export names,
     because those are a real mess and easily break things left and right :/

git-svn-id: trunk@35479 -
2017-02-25 11:46:35 +00:00
Jonas Maebe
265c8e7bbc + support for specifying ms_abi_default, ms_abi_cdelc, sysv_abi_default, and
sysv_abi_cdecl calling conventions on x86-64 to force using the SYSV/
    Microsoft ABI on platforms that don't use it by default (mainly to ease
    porting pure assembler routines)

git-svn-id: trunk@35425 -
2017-02-11 19:57:12 +00:00
svenbarth
a9888eba70 * also generate Big Obj COFF files with the GNU utilities (needs 2.25 or newer), at least as long as the new option -a5 isn't given, which disables this
Note 1: using an older AS might fail anyway if the amount of sections is too high (like in packages\odata\src\sharepoint.pp)
Note 2: it might be an idea to keep track of the created sections in the asmlists and only enable the option if *really* necessary (like with the internal COFF output generator), though this might lead to false positives due to multiple sections with the same name (since I'd prefer to use the KISS principle only a counter would be used)

git-svn-id: trunk@35381 -
2017-02-03 22:45:32 +00:00
florian
29a2c433f7 * -Sr option for iso mode: in case no command line parameter is passed, the file name for program parameters is derived from their variable name
git-svn-id: trunk@35257 -
2017-01-07 14:50:58 +00:00
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