Commit Graph

291 Commits

Author SHA1 Message Date
florian
a5f6505edc * fix range checking for zero based strings, resolves #39323 2021-09-05 21:03:31 +02:00
nickysn
71f5fd320a + insert hlcg.g_ptrtypecast_reg calls in tcgvecnode.update_reference_reg_mul and update_reference_reg_packed
git-svn-id: branches/wasm@48376 -
2021-01-24 02:46:31 +00:00
nickysn
34d3d39dbe + introduced the tcgvecnode.get_address_type virtual method and use its result,
instead of voidpointertype in tcgvecnode.update_reference_reg_mul and
  .update_reference_reg_packed

git-svn-id: branches/wasm@48160 -
2021-01-15 15:29:58 +00:00
nickysn
e62979c614 * converted tcgvecnode.update_reference_reg_packed to the high level code generator
git-svn-id: branches/wasm@48079 -
2021-01-05 08:08:25 +00:00
nickysn
531031c135 * converted tcgvecnode.update_reference_reg_mul to the high level code generator
git-svn-id: branches/wasm@48067 -
2021-01-04 17:19:18 +00:00
yury
627fcb4354 * Do not use the LOC_VOID location to indicate unused parameters.
* Added the tprocdef.parentfpsym property. Set parentfpsym.varstate to vs_read instead of using the pio_needs_parentfp flag.
* Replaced tcgcallparanode.push_zero_sized_value_para by tparamanager.has_strict_proc_signature.

git-svn-id: trunk@45454 -
2020-05-21 09:36:40 +00:00
yury
2808873d1b * Reworked the optimization of unused $parentfp for nested routines.
- Do not remove the $parentfp parameter as was done in the previous optimization approach. Instead when $parentfp is unused to the following:
      - On the caller side: Omit passing the value for $parentfp for targets where tcgcallparanode.push_zero_sized_value_para=false (classic CPU targets). 
          Pass 0/nil as $parentfp for targets where tcgcallparanode.push_zero_sized_value_para=true;
      - On the callee side: Prevent allocation of registers/resources for $parentfp.
  - When possible keep $parentfp in a register.
  - Set the pio_nested_access flag in tprocinfo.set_needs_parentfp() to properly handle deep nesting levels;

git-svn-id: trunk@45436 -
2020-05-19 13:17:47 +00:00
florian
50c221670f * do not generate moves unncesssarily in tcgloadparentfpnode.pass_generate_code
git-svn-id: trunk@45162 -
2020-04-28 21:25:42 +00:00
yury
1b3a3a7983 * Removed lot of unused local vars. It is useful to turn on the notes in options. :)
git-svn-id: trunk@44053 -
2020-01-28 18:45:33 +00:00
yury
4a756a2d30 * r42239 broke the tw13948b test for aarch64. Fixed this and improved the test.
git-svn-id: trunk@44052 -
2020-01-28 17:50:20 +00:00
Jonas Maebe
1e3f72403e * renamed getintparaloc to getcgtempparaloc
o it can be used for more than integer parameters

git-svn-id: trunk@43781 -
2019-12-24 22:12:25 +00:00
florian
d80dc03ccb * building on powerpc and arm fixed
git-svn-id: trunk@42241 -
2019-06-16 21:43:46 +00:00
florian
749c4d4e47 + keep (certain) arrays in registers if they are used with constants indices only
git-svn-id: trunk@42239 -
2019-06-16 21:29:48 +00:00
Jonas Maebe
281b3ad276 * fix case completeness and unreachable code warnings in compiler that would
be introduced by the next commit

git-svn-id: trunk@42046 -
2019-05-12 14:29:03 +00:00
Jonas Maebe
170ec00348 - removed withnode (was no longer used since a very long time)
git-svn-id: trunk@40777 -
2019-01-05 22:28:37 +00:00
pierre
bee9421f2a Change local variables offsetdec and extraoffset type to ASizeInt
git-svn-id: trunk@40326 -
2018-11-16 13:28:26 +00:00
nickysn
42432d4ef3 * use sizeuinttype, instead of ptruinttype for the indexdef conversion in
tcgvecnode.pass_generate_code. This avoids a meaningless conversion to 32-bit
  (and using the cwd instruction) on i8086 in the far data memory models.

git-svn-id: trunk@39472 -
2018-07-19 15:27:14 +00:00
Jonas Maebe
4686f61002 * keep track of the temp position separately from the offset in references,
so that they can still be freed after the reference has been changed
    (e.g. in case of array indexing or record field accesses) (mantis #33628)

git-svn-id: trunk@38814 -
2018-04-22 17:03:16 +00:00
florian
2251e87e41 * fix compilation for jvm, resolves #33195
git-svn-id: trunk@38283 -
2018-02-18 17:31:09 +00:00
florian
2e9f6f9dfb * wrong alignment was used in r38252: alignment for a class returns the alignment of the implict pointer, but we really need the alignment of the data structure
git-svn-id: trunk@38261 -
2018-02-16 20:56:15 +00:00
florian
a21f462a93 * references of fields for types using indirect addressing get proper alignment
git-svn-id: trunk@38252 -
2018-02-16 18:45:54 +00:00
florian
6f338bb4b5 + tcgsubscriptnode.pass_generate_code makes use of a_loadmm_reg_intreg to avoid location_force_mem calls
git-svn-id: trunk@37373 -
2017-10-01 16:13:20 +00:00
florian
8ea9e3d344 * avoid range check errors on avr
git-svn-id: trunk@36360 -
2017-05-28 08:59:51 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
Jonas Maebe
a25ebbba3e + added volatility information to all memory references
o separate information for reading and writing, because e.g. in a
     try-block, only the writes to local variables and parameters are
     volatile (they have to be committed immediately in case the next
     instruction causes an exception)
   o for now, only references to absolute memory addresses are marked
     as volatile
   o the volatily information is (should be) properly maintained throughout
     all code generators for all archictures with this patch
   o no optimizers or other compiler infrastructure uses the volatility
     information yet
   o this functionality is not (yet) exposed at the language level, it
     is only for internal code generator use right now

git-svn-id: trunk@34996 -
2016-11-27 18:17:37 +00:00
pierre
abaea9959f Fix parameter loading of FPC_CHECKPOINTER to handle correctly references with offsets
git-svn-id: trunk@34743 -
2016-10-18 21:48:59 +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
Jonas Maebe
db171702f3 * vecn: don't use left.location.reference.alignment if left is not in a
LOC_(C)REFERENCE

git-svn-id: trunk@34545 -
2016-09-20 21:43:32 +00:00
Jonas Maebe
0afbe85aab * various memory reference alignment fixes
git-svn-id: trunk@34544 -
2016-09-20 21:43:19 +00:00
yury
e3d9dbbeef * Removed unused vars.
git-svn-id: trunk@34404 -
2016-09-01 19:55:45 +00:00
svenbarth
54874cccd6 * reference the VMT's assembler symbol if it's from another unit
git-svn-id: trunk@34342 -
2016-08-19 14:00:24 +00:00
Jonas Maebe
aa1be3276f - removed default value of _typ parameter of TAsmData.(Weak)RefAsmSymbol():
it was AT_NONE, which is invalid and should never be used
  * explicitly pass the correct value for all calls to those methods elsewhere
    in the compiler

git-svn-id: trunk@34250 -
2016-08-05 07:09:16 +00:00
Jonas Maebe
a821c47252 * converted dynarray range checking to the high level code generator
git-svn-id: trunk@34115 -
2016-07-14 15:16:52 +00:00
Jonas Maebe
996e325175 * converted range checking for open arrays/array of const from the code
generator to the typecheck pass, so that it also works for platforms
    that use the parentfpstruct way to handle accesses to nested frames
    in case the array has been migrated to such a parentfpstruct
   o additionally, the number of comparisons for such range checks
     has been reduced from 3 (for signed indices) or 2 (for unsigned
     indices) to 1 in all cases
   o the range checking code is disabled for the JVM target, as the
     JVM automatically range checks all array accesses itself anyway

git-svn-id: trunk@34034 -
2016-06-30 15:33:47 +00:00
Jonas Maebe
cef5cac4fa * converted tcgvecnode.rangecheck_string to the high level code generator
git-svn-id: trunk@33961 -
2016-06-12 09:21:05 +00:00
Jonas Maebe
5af40f22e8 * handle enums with a packenum setting that is larger than necessary to store
all of their values, when kept in a bitpacked array, properly via
    pass_typecheck rather than hacking location.size in pass_generate_code:
   o the old fix was incomplete (it didn't handle non-constant indices)
   o the old fix didn't work for llvm (since it uses defs rather than
     location.size)

git-svn-id: trunk@33943 -
2016-06-09 22:00:14 +00:00
Károly Balogh
778a0b737e * removed ancient (since r5554) special handling code for m68k from tcgvecnode, which is no longer necessary
git-svn-id: trunk@33650 -
2016-05-04 21:39:37 +00:00
svenbarth
9857a27ad8 Generate and use an indirect symbol for VMTs.
Note: the merged code has been adjusted to a) use the typed constant builder and b) to not use the indirect symbol when its not necessary (non-Windows or same unit)

Merged revision(s) 28340, 28350 from branches/svenbarth/packages:
Generate an indirect VMT symbol for each generated VMT.

ncgvmt.pas, TVMTWriter:
  * writevmt: write a symbol with the indirect VMT name that references the direct VMT symbol
........
Load the VMT using the indirect symbol if the target supports packages.

ncgmem.pas, tcgloadvmtaddrnode:
  * pass_generate_code: if tf_supports_packages is set in target_info.flags we load the VMT using the indirect symbol, otherwise we load it using the direct symbol

........

git-svn-id: trunk@33448 -
2016-04-08 14:21:51 +00:00
Jonas Maebe
9788bb1316 * fixed check regarding whether a field is in the first or second word of
of 2*sizeof(aword) bitpacked record that's kept in registers
    (mantis #29669)

git-svn-id: trunk@33177 -
2016-03-06 13:20:16 +00:00
Jonas Maebe
dacfb1a6ff * load an objc classrefdef as objc_idtype, as that is also how we type
the self parameter in Objective-C class methods

git-svn-id: trunk@32913 -
2016-01-10 17:22:09 +00:00
Jonas Maebe
9e4806f21a * made Objective-C non-fragile ABI field indexing type safe for LLVM
git-svn-id: trunk@32911 -
2016-01-10 17:22:03 +00:00
Jonas Maebe
d0f97a6441 * converted open array range checking to the high level code generator
git-svn-id: trunk@32543 -
2015-11-27 14:44:29 +00:00
Jonas Maebe
9dc5f1acb4 * support LOC_(C)SUBSETREG in tcgvecnode.pass_generate_code, can also occur
for function results (patch by Do-wan Kim, mantis #29064)

git-svn-id: trunk@32516 -
2015-11-24 15:03:34 +00:00
Jonas Maebe
56a4051296 * replaced another {$ifdef x86} with a virtual method call (the pointer type
of voidpointertype corresponds to the default pointer type)

git-svn-id: trunk@32181 -
2015-10-28 18:25:26 +00:00
yury
432248cbf1 * Removed lot of unused vars.
git-svn-id: trunk@31732 -
2015-09-17 12:48:58 +00:00
Jonas Maebe
0fc1fd6ac1 * replaced current_procinfo.currtrue/falselabel with storing the true/false
labels of LOC_JUMP in the node's location. This generates some extra jumps
    for short circuit boolean and/or-expressions if optimizations are off, but
    with optimisations enabled the generated code is the same (except for JVM
    because the jump threading optimisation isn't enabled there yet).

git-svn-id: trunk@31431 -
2015-08-27 18:28:57 +00:00
Jonas Maebe
d60f60154a * fixed the def used to load non-objc loadvmtaddr nodes (for llvm)
git-svn-id: trunk@31064 -
2015-06-13 22:48:48 +00:00
Jonas Maebe
3f736f6114 * handle the loading of VMT entries at the node level, so it's done in a
type-safe way (for LLVM, and also internal consistency checking between
    the VMT as generated in nobj.pas and ncgvmt.pas)
   o also converted the VMT validity checking to the node level

git-svn-id: trunk@30950 -
2015-05-31 16:50:47 +00:00
florian
e791f534d2 * fix tcgvecnode.update_reference_reg_packed if OS_INT<>OS_ADDR
git-svn-id: trunk@30659 -
2015-04-19 10:34:14 +00:00
Jonas Maebe
61e4a1b811 + added tasmlist parameter to getintparaloc() (needed for llvm)
git-svn-id: trunk@30429 -
2015-04-04 14:29:16 +00:00