Commit Graph

127 Commits

Author SHA1 Message Date
Pierre Muller
da683ade18 Add dwarf CFI for powerpc64 cpu 2023-11-23 21:19:52 +01:00
Jonas Maebe
0fcc57fb4b PPC64: don't save TOC in pure assembler routines
Fix by Pierre
2022-02-12 15:26:27 +01:00
Jonas Maebe
629c1de460 TOC handling: clean up
Also fix on 32 bits PowerPC
2022-02-06 22:10:06 +01:00
Jonas Maebe
83c18df69a ppc64: fix rtoc handling
Save on procedure entry if it performs a call, rather than (only) before every
indirect call
2022-02-05 17:36:08 +01:00
florian
637976e83f * patch by Marģers to unify internal error numbers, resolves #37888
git-svn-id: trunk@47103 -
2020-10-13 19:59:01 +00:00
pierre
d4c9e1f260 Replace outdated cgop2string function by tcgsize2str function from cgbase unit to fix EXTDEBUG cycle on powerpc64le-linux
git-svn-id: trunk@46689 -
2020-08-25 13:29:16 +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
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
pierre
65ba2733e3 Remove overflow check that cannot happen because of types
git-svn-id: trunk@38496 -
2018-03-10 22:04:56 +00:00
Jonas Maebe
880d438704 * renamed t<cpuname>procinfo to tcpuprocinfo for all targets, so we can
inherit from it for LLVM without a thousand ifdefs

git-svn-id: trunk@35141 -
2016-12-16 22:41:21 +00:00
marco
d2fe24ae20 * fix some more occured->occured
git-svn-id: trunk@35120 -
2016-12-13 12:55:32 +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
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
1cb8c0d00c * specify the def of assembler level symbols defined via
tasmdata.DefineAsmSymbol() and all routines that call it
   o will be used to automatically generate AB_INDIRECT sybols when
     necessary

git-svn-id: trunk@34164 -
2016-07-20 20:52:59 +00:00
Jonas Maebe
33ed32b024 * when targeting the ELFv2 ABI, don't reserve space for the (never used)
words in the linkage area reserved for use by the compiler and linker

git-svn-id: trunk@30206 -
2015-03-14 18:35:56 +00:00
Jonas Maebe
fb27dff638 * generate ".abiversion 2" directive when targeting ppc64/ELFv2
* generate code to load the TOC register if it's required, and
    emit the the ".localentry" directive to indicate to the linker
    where the actual function body starts
  * support the ".localentry" directive in the ppc64 assembler reader
   o disable the fpc_qword_to_double() assembler implementation for
     ELFv2, because we can't manually insert the .localentry directive
     before the stack allocation code
  * perform indirect calls on ppc64 via R12 in ncgcal, as R12 needs to
    contain the function address on entry on ppc64/ELFv2 (and it's
    a volatile register, so there's no problem with always using
    it)

git-svn-id: trunk@30198 -
2015-03-14 18:35:31 +00:00
Jonas Maebe
fc21845686 * fixed the allocation of R12 on ppc32/ppc64 when used to hold the value of
the stack pointer during the prolog. This was done previously in
    tcg.g_proc_entry(), but that routine is called after register allocation
    and hence has no influence. Also cleaned up the deallocation of that
    register by moving the previously ifdef'd code to thlcgppcgen
    (mantis #27634)

git-svn-id: trunk@30164 -
2015-03-11 17:49:44 +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
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
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
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
florian
4d5119bf1c * fixes several issues which cause warnings by the dfa code when using it to detect uninitialized variables
git-svn-id: trunk@26161 -
2013-12-01 17:02:08 +00:00
sergei
d25330e367 * Removed tasmdata.realname (it is not used anywhere) and changed tasmdata.name to pshortstring. The name string is owned by tmodule and referenced by tasmdata. This removes 80-char limit on tasmdata.name, Mantis #25009.
git-svn-id: trunk@25523 -
2013-09-19 10:06:43 +00:00
florian
7361e19799 + support for handling OS_128/OS_S128 on 64 Bit CPUs as far as needed for method pointers in registers
git-svn-id: trunk@22344 -
2012-09-06 15:12:12 +00:00
Jonas Maebe
edd42aa42a * moved subsetref/reg and bit_set/test support from cgobj to hlcgobj for
future use by high level code generator targets
   o this in turn required that all a_load*_loc* methods are called via
     hlcg rather than via cg, since a location can be a subsetref/reg and
     and those are no longer handled in tcg
   o that then required moving several force_location_* routines into
     thlcg because they use a_load_loc*, but did not take tdef size
     parameters (which are required by the thlcg a_load_loc* routines)
   o the only practical consequence is that from now on, you have to
     use hlcg.location_force_mem/reg() (fpureg not yet) and
     hlcg.gen_load_loc_cgpara() instead of the removed versions from ncgutil,
     and hlcg.a_load*loc*() instead of cg.a_load*loc* if a subsetref/reg
     might be involved

git-svn-id: trunk@21287 -
2012-05-13 12:33:10 +00:00
Jonas Maebe
0278d67764 * use generic ppc version of a_loadaddr_ref_reg() for AIX/ppc64
* also recognize addr_pic_no_got as a PIC'ed address

git-svn-id: trunk@21052 -
2012-04-25 20:28:27 +00:00
Jonas Maebe
b33b744f78 * enabled null pointer load checking for AIX/ppc64
git-svn-id: trunk@21051 -
2012-04-25 20:28:23 +00:00
Jonas Maebe
cec20e1c34 * specify the branch opcode to use for a_call_name_direct/a_jmp_name_direct,
because it's sometimes different for AIX and other platforms (AIX uses
    absolute branches for entry/exit code helpers)

git-svn-id: trunk@21050 -
2012-04-25 20:28:18 +00:00
Jonas Maebe
a473cf14d6 - removed ppc64-specific a_load_ref_cgpara(), the generic one can also
handle of its special cases nowadays

git-svn-id: trunk@20962 -
2012-04-21 20:17:40 +00:00
Jonas Maebe
4123df9cb8 * moved g_external_wrapper() code from powerpc64/cgcpu to ppcgen/cgppc,
made it 32/64 bit neutral and adjusted it so it can be used for
   linux/ppc64, aix/ppc and aix/ppc64

git-svn-id: trunk@20795 -
2012-04-11 18:01:14 +00:00
Jonas Maebe
95966da949 + AIX support for a_call_reg()
* renamed some ppc64 stackframe offset constants to the same names as their
    32 bit counterparts so they can be used in shared ppc code

git-svn-id: trunk@20794 -
2012-04-11 18:01:01 +00:00
florian
aa529b0705 * fix fullcycle after -Sew for the compiler was introduced
git-svn-id: trunk@19757 -
2011-12-04 21:17:40 +00:00
Jonas Maebe
84c23f6b42 * fixed range check warning when doing a native ppc64 compile
git-svn-id: trunk@19595 -
2011-11-04 22:49:04 +00:00
florian
4868b09844 * patch by alexvin to replace $ifopt by $push/$pop, resolves #20332
git-svn-id: trunk@19239 -
2011-09-25 21:19:50 +00:00
tom_at_work
446eacaf47 * another compilation failure due to cleanup of changes to r16272
git-svn-id: trunk@16281 -
2010-10-31 18:37:49 +00:00
tom_at_work
f1a7cf78fe * fixed compilation after cleaning up for r16272
git-svn-id: trunk@16280 -
2010-10-31 18:26:33 +00:00
tom_at_work
e215b215d6 * fix code generation for interface wrappers: adjustment of self pointers with offsets > 16 bit crashed because it tried to allocate a virtual register, but the register allocator is not called for these wrappers. Always use the R11 register, which is scratch on ppc64, for now.
git-svn-id: trunk@16272 -
2010-10-31 14:47:42 +00:00
Jonas Maebe
356026f849 * use new_section() instead of tai_section.create() everywhere
- sort of reverted r14134, which is no longer required after the above
    change (new_section() inserts the alignment itself)
  * made the tai_section.create() constructor private so it cannot be
    called directly anymore

git-svn-id: trunk@15482 -
2010-06-26 10:50:14 +00:00
Jonas Maebe
283018a3bf * changed tprocdef.funcretloc[] from a tlocation into a tcgpara so it can
represent complex locations (required for full x86-64 ABI support,
    which is not yet implemented) -> lots of special result handling
    code has been removed and replaced by the parameter handling
    routines
  + added support for composite parameters (and hence function
    results) to tcg.a_load_ref_cgpara() (so it can be used for
    handling, e.g., 64 bit parameters on 32 bit platforms)
  * the above fixed writing past the end of allocated memory when
    handling records returned in registers on x86-64 whose size is
    not a multiple of 8 bytes (mantis #16357)
  - removed the x86-64 and PPC specific versions of a_load_ref_cgpara(),
    as they are now handled correctly by the generic version
  * moved the responsibility of allocating tcgpara cpu registers
    (using paramanager.allocparaloc()) from the callers of
    cg.a_load*_cgpara() to the cg.a_load*_cgpara() methods
    themselves (so the register allocation can be done efficiently
    when dealing with function results)
  * for the above, renamed paramanager.alloc/freeparaloc() to
    paramanager.alloc/freecgpara(), and use paramanager.allocparaloc()
    to allocate individual pcgparalocations instead
  * fixed the register size of SSE2 function result registers for
    x86-64 (when used for floating point), which results in removing
    a few superfluous "movs? %xmm0,%xmm0" instructions
  * fixed compilation of paramanagers of avr, m68k and mips after r13695
    and also updated them for these new changes

git-svn-id: trunk@15350 -
2010-05-30 21:12:57 +00:00
Jonas Maebe
9bc15a5f61 * renamed a_param_* to a_load_*_cgpara
git-svn-id: trunk@15305 -
2010-05-22 09:07:21 +00:00
florian
515774b864 * merged armthum branch
-- Zusammenführen der Unterschiede zwischen Projektarchiv-URLs in ».«:
U    rtl/arm/setjump.inc
A    rtl/arm/thumb2.inc
U    rtl/arm/divide.inc
A    rtl/embedded/arm/stm32f103.pp
U    rtl/inc/system.inc
U    compiler/alpha/cgcpu.pas
U    compiler/sparc/cgcpu.pas
U    compiler/i386/cgcpu.pas
U    compiler/ncgld.pas
U    compiler/powerpc/cgcpu.pas
U    compiler/avr/cgcpu.pas
U    compiler/aggas.pas
U    compiler/powerpc64/cgcpu.pas
U    compiler/x86_64/cgcpu.pas
U    compiler/cgobj.pas
U    compiler/psystem.pas
U    compiler/aasmtai.pas
U    compiler/m68k/cgcpu.pas
U    compiler/ncgutil.pas
U    compiler/rautils.pas
U    compiler/arm/raarmgas.pas
U    compiler/arm/armatts.inc
U    compiler/arm/cgcpu.pas
U    compiler/arm/armins.dat
U    compiler/arm/rgcpu.pas
U    compiler/arm/cpubase.pas
U    compiler/arm/agarmgas.pas
U    compiler/arm/cpuinfo.pas
U    compiler/arm/armop.inc
U    compiler/arm/narmadd.pas
U    compiler/arm/aoptcpu.pas
U    compiler/arm/armatt.inc
U    compiler/arm/aasmcpu.pas
U    compiler/systems/t_embed.pas
U    compiler/psub.pas
U    compiler/options.pas

git-svn-id: trunk@13801 -
2009-10-04 09:03:44 +00:00
Jonas Maebe
7d459cf12a * the compiler now explicitly keeps track of the minimally guaranteed
alignment for each memory reference (mantis #12137, and
    test/packages/fcl-registry/tregistry1.pp on sparc). This also
    enables better code generation for packed records in many cases.
  o several changes were made to the compiler to minimise the chances
    of accidentally forgetting to set the alignment of memory references
    in the future:
    - reference_reset*() now has an extra alignment parameter
    - location_reset() can now only be used for non LOC_(C)REFERENCE,
      use location_reset_ref() for those (split the tloc enum so the
      compiler can catch errors using range checking)

git-svn-id: trunk@12719 -
2009-02-08 13:00:24 +00:00
Jonas Maebe
a23630260b + "weakexternal" support for imported procedures and variables.
the syntax is exactly the same as for "external", except for
    the keyword. It is currently only active for Darwin targets.
    It should also work at least for Linux targets, but only with
    the GNU assembler (which is why it is not activated there)
  + test for this functionality

git-svn-id: trunk@12009 -
2008-11-01 18:38:32 +00:00
tom_at_work
8a5a6db065 * rol/ror inlines for powerpc/powerpc64 (only for 32/64 bit operands for now)
git-svn-id: trunk@11770 -
2008-09-13 16:29:42 +00:00
florian
1afb1aa9cc + ror/rol functions
+ internal compiler support for ror/rol on i386

git-svn-id: trunk@11466 -
2008-07-27 17:12:32 +00:00
yury
491f0fa1d8 * Replaced all user defined warnings by TODO comments to reduce compiler noise.
git-svn-id: trunk@11443 -
2008-07-23 11:00:03 +00:00
tom_at_work
ee76679326 * cleaned up r10705 for ppc, improved comments
git-svn-id: trunk@10721 -
2008-04-19 19:54:09 +00:00
Jonas Maebe
263984f874 * fixed a_load_ref_reg for OS_S8->OS_16 for ppc32, ppc64 and sparc
(and on ppc64 also for OS_S8->OS_32 and OS_S16->OS_32)
  * adapted tcnvint6 to check for ppc64 OS_S16->OS_32 conversion
    (the old comparison was performed using a 32 bit compare and
     therefore did not notice the wrong result)

git-svn-id: trunk@10705 -
2008-04-18 20:04:55 +00:00
tom_at_work
e540356be4 * fixed merge errors introduced by merge from resources branch, re-applied r9721
git-svn-id: trunk@10485 -
2008-03-13 19:45:01 +00:00
michael
174de3eab1 Merged revisions 9693-10480 via svnmerge from
svn+ssh://svn.freepascal.org/FPC/svn/fpc/branches/resources

........
  r9694 | michael | 2008-01-09 21:31:18 +0100 (Wed, 09 Jan 2008) | 1 line
  
  * Initial check-in
........
  r9695 | michael | 2008-01-09 21:35:58 +0100 (Wed, 09 Jan 2008) | 1 line
  
  * New version from Giulio Bernardi
........
  r9697 | michael | 2008-01-09 21:41:54 +0100 (Wed, 09 Jan 2008) | 1 line
  
  * Patch from Giulio Bernardi with resource support
........
  r9698 | michael | 2008-01-09 21:46:33 +0100 (Wed, 09 Jan 2008) | 1 line
  
  * Patch from Giulio Bernardi to add more resource testing
........
  r9699 | michael | 2008-01-09 21:57:26 +0100 (Wed, 09 Jan 2008) | 1 line
  
  * New tool from Giulio Bernardi
........
  r9700 | michael | 2008-01-09 21:58:23 +0100 (Wed, 09 Jan 2008) | 1 line
  
  * New tool from Giulio Bernardi
........
  r9701 | michael | 2008-01-09 22:01:54 +0100 (Wed, 09 Jan 2008) | 1 line
  
  * Added fcl-res
........
  r9702 | michael | 2008-01-09 22:01:58 +0100 (Wed, 09 Jan 2008) | 1 line
  
  * Added fcl-res
........
  r9703 | michael | 2008-01-10 08:54:26 +0100 (Thu, 10 Jan 2008) | 1 line
  
  * Fixed double code
........
  r9704 | jonas | 2008-01-10 10:59:20 +0100 (Thu, 10 Jan 2008) | 2 lines
  
    - removed duplicate code
........
  r9705 | jonas | 2008-01-10 11:25:21 +0100 (Thu, 10 Jan 2008) | 2 lines
  
    + added missing fcl-res dependencies
........
  r9706 | jonas | 2008-01-10 11:58:30 +0100 (Thu, 10 Jan 2008) | 2 lines
  
    + dependencies for fpintres and fpextres
........
  r9707 | yury | 2008-01-10 12:47:51 +0100 (Thu, 10 Jan 2008) | 3 lines
  
  * Fixed compilation of resource, which is included in a unit located in different folder than main source.
  * .res files must be copied to units output folder, otherwise .res files will not be found when only compiled units path is available and compiler does not know anything about sources folder.
  * Improved resource related error messages.
........
  r9708 | michael | 2008-01-10 12:52:13 +0100 (Thu, 10 Jan 2008) | 1 line
  
  * Removed double source after end.
........
  r9709 | michael | 2008-01-10 12:52:48 +0100 (Thu, 10 Jan 2008) | 1 line
  
  * No longer needed
........
  r9710 | tom_at_work | 2008-01-10 22:09:08 +0100 (Thu, 10 Jan 2008) | 1 line
  
  * properly align FPC_RESLOCATION so that linking does not fail on some architectures (e.g. ppc64)
........
  r9711 | tom_at_work | 2008-01-10 23:53:12 +0100 (Thu, 10 Jan 2008) | 1 line
  
  * fix splitting of 64 bit load/stores from/to unaligned memory locations into multiple load/stores, which in some cases generated wrong code
........
  r9712 | michael | 2008-01-11 11:00:08 +0100 (Fri, 11 Jan 2008) | 1 line
  
  * Fixed bug in BSS section on 64-bit platforms
........
  r9720 | giulio | 2008-01-12 10:02:04 +0100 (Sat, 12 Jan 2008) | 1 line
  
  Updated fcl-res documentation: occurrences of reslib changed to fcl-res.
........
  r9740 | giulio | 2008-01-13 19:36:44 +0100 (Sun, 13 Jan 2008) | 3 lines
  
   - Don't try to compile resources on systems with a non windows-like resource support.
   - Don't add the .or file to the list of object files if resource compiling failed.
........
  r10201 | giulio | 2008-02-04 11:35:44 +0100 (Mon, 04 Feb 2008) | 5 lines
  
  * resource compiling supported on OS/2 via wrc
  * CompileResourceFiles and CollectResourceFiles don't do target-specific checks anymore
  * refactored a bit
........
  r10389 | giulio | 2008-02-25 21:32:52 +0100 (Mon, 25 Feb 2008) | 2 lines
  
  Deleted test file which was committed by mistake
........
  r10472 | giulio | 2008-03-10 12:22:18 +0100 (Mon, 10 Mar 2008) | 2 lines
  
  changed define FPC_HAS_RESOURCES to FPC_HAS_WINLIKERESOURCES
........

git-svn-id: trunk@10481 -
2008-03-12 21:33:48 +00:00