Commit Graph

90 Commits

Author SHA1 Message Date
florian
6404478ea4 * cleanup of VER3_0 defines 2021-11-17 22:19:57 +01:00
Károly Balogh
cdc7fec019 m68k: D2 is considered volatile on macosclassic
git-svn-id: trunk@49294 -
2021-04-29 22:06:26 +00:00
Károly Balogh
9d425ff4ca m68k: change the stack push order in the register calling convention to left-to-right. This should fix parameter handling in nested procedures (tnest5)
git-svn-id: trunk@47279 -
2020-11-02 02:01:24 +00: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
Károly Balogh
58af742f3a m68k: atari syscalls might also destroy D2 and A2
git-svn-id: trunk@45469 -
2020-05-23 11:13:07 +00:00
pierre
7d12e8cc6d Avoid warnings for m68k compiler
git-svn-id: trunk@43391 -
2019-11-05 10:00:48 +00:00
Károly Balogh
50fe8f70f5 m68k: make sure we're not trying to allocate a subregister for float paras when R_SUBWHOLE <> R_SUBNONE
git-svn-id: trunk@42946 -
2019-09-08 13:34:39 +00:00
Jonas Maebe
77658b925b * disable regular array -> dynamic array type coversion support unless
{$modeswitch arraytodynarray} is active (mantis #35576)
   o changed compiler to compile without this modeswitch
   o added the modeswitch to a test that depends on it

git-svn-id: trunk@42118 -
2019-05-25 12:31:32 +00:00
Károly Balogh
5358851f84 * clean up some things regarding explicit paraloc handling. this should fix m68k-amiga and powerpc-morphos builds after r41716
git-svn-id: trunk@41730 -
2019-03-18 01:19:18 +00:00
Jonas Maebe
8b9e90dc7a * keep track of whether a routine has a C-style variadic parameter in the
procoptions even when it's through an array-of-const parameter
  * always call create_varargs_paraloc_info() instead of create_paraloc_info()
    in the former case, even when no varargs parameters are specified (because
    on some platforms even some non-variadic parameters need to be passed
    differently, such as on ARM with gnueabihf)

git-svn-id: trunk@41420 -
2019-02-23 15:42:45 +00:00
pierre
3715dbdf41 Avoid run time error if compiled with -CR option
git-svn-id: trunk@39999 -
2018-10-20 18:44:05 +00:00
nickysn
518cdf9674 * replaced the saved_XXX_registers arrays with virtual methods inside
tcpuparamanager, very similar to the existing get_volatile_registers_XXX. The
  new methods are called get_saved_registers_XXX, where XXX is the register
  type ("int", "address", "fpu" or "mm")

git-svn-id: trunk@38794 -
2018-04-19 21:22:16 +00:00
Károly Balogh
9f974369a1 palmos: for C and syscall functions, expect return values in A0. mark D2 and A2 as volatile during function calls
git-svn-id: trunk@37896 -
2018-01-04 07:52:11 +00:00
Károly Balogh
02ed753fab m68k: yet another attempt to fix small struct alignments on stack
git-svn-id: trunk@36605 -
2017-06-27 02:36:55 +00:00
Károly Balogh
22ae3cd186 m68k: revert the r36568 and the followup fix attempts altogether, as they broke Amiga support entirely. there will be a cleanup before another fixing attempt
git-svn-id: trunk@36598 -
2017-06-26 16:02:26 +00:00
Károly Balogh
a14b2fd80a m68k: modify some alignment calculations in the register calling convention code, hopefully it fixes some Amiga regressions introduced in r36568
git-svn-id: trunk@36596 -
2017-06-25 19:33:21 +00:00
Károly Balogh
41f72a0e6d m68k: some initial support for C ABIs which use an address register to return structs by address
git-svn-id: trunk@36592 -
2017-06-24 19:03:58 +00:00
Károly Balogh
b481129f4e m68k: for cdecls with the SVR4 ABI return results both in A0 and D0
git-svn-id: trunk@36588 -
2017-06-23 19:21:20 +00:00
Károly Balogh
26d5500b7c m68k: one more alignment fix, hopefully fixes regressions not fixed by r36569
git-svn-id: trunk@36570 -
2017-06-22 02:41:36 +00:00
Károly Balogh
8ed84afdd4 m68k: try to fix some breakages caused by r36568
git-svn-id: trunk@36569 -
2017-06-22 02:11:42 +00:00
Károly Balogh
23f4304881 m68k: hopefully fix passing of smaller-than-alignment sized records/structs for stdcall/cdecl
git-svn-id: trunk@36568 -
2017-06-22 01:14:02 +00:00
Károly Balogh
78a7710192 m68k: with the register calling convention, pass records by reference
git-svn-id: trunk@35279 -
2017-01-12 18:06:13 +00:00
Károly Balogh
0cb555c07c syscalls: move the reference implementation of parseparaloc to paramgr. removes two identical copies from CPU specific code and enables basereg convention for AROS/x86_64. also, other minor fixes and cleanups in related code.
git-svn-id: trunk@35047 -
2016-12-03 19:00:41 +00:00
Károly Balogh
4ee4099fca m68k: introduce a register calling convention, inspired by VBCC. volatile registers are used to pass arguments
git-svn-id: trunk@34821 -
2016-11-06 18:00:29 +00:00
Károly Balogh
51cb5aefbe m68k: use target_info.stackalign to align the stack instead of expecting a hardwired longword alignment. this is required for atari, and beneficial on all '000 targets
git-svn-id: trunk@34666 -
2016-10-08 14:01:32 +00:00
Jonas Maebe
fa3b0ca312 * support marking defs created via the getreusable*() class methods as
"don't free even if not registered"; use for defs that may not be written
    to a ppu file, but that must nevertheless survive the compilation of the
    current module
  * mark all defs created for para locations as "don't free even if not
    registered", because we don't discard and recalculate all para locations
    after a module has been compiled (since that's not needed)
   o solves issues if the paralocations for a routine in the interface of
     unit A are calculated while the implementation of unit B gets
     compiled, and a new reusable type is allocated at that point which
     is not used anywhere else (after r32160)

git-svn-id: trunk@32235 -
2015-11-04 20:46:18 +00:00
Jonas Maebe
f402b0d7df * changed getpointerdef() into a tpointerdef.getreusable() class method
o allows removing the ugly x86 hacks

git-svn-id: trunk@31144 -
2015-06-22 08:17:49 +00:00
Jonas Maebe
67b8aceaee * synchronized with privatetrunk till r30095
git-svn-id: branches/hlcgllvm@30101 -
2015-03-05 20:32:15 +00:00
Károly Balogh
a99c9c29b6 m68k: basic 68881 FPU register save/restore support. probably still needs some work here and there.
git-svn-id: trunk@29644 -
2015-02-07 22:13:07 +00:00
Jonas Maebe
5c75b6dd6b * synchronised with trunk up till r28402
git-svn-id: branches/hlcgllvm@28403 -
2014-08-13 16:04:30 +00:00
sergei
b7da785688 * m68k: support stack cleanup at caller side, fixed calculation of pushed parameters size and offsets and cleaned out another pile of junk.
* Parameter offsets are now calculated similar to other targets, target_info,first_parm_offset is applied only to callee side, while at caller side offsets start from 0.
* For cdecl procedures, parameters are removed by caller, for the rest it's still done by callee (resembles i386 target, except there is no 'register' calling convention).

git-svn-id: trunk@28185 -
2014-07-08 19:08:56 +00:00
Jonas Maebe
7949bebb8d * synchronised with r28168 of trunk
git-svn-id: branches/hlcgllvm@28169 -
2014-07-05 21:30:28 +00:00
sergei
acd3ea8750 * m68k: Fixed parameter passing to conform to ABI:
* records are passed by value
  * records with size of 1,2 or 4 are returned in registers
  * parameters with size<4 are justified on the stack according to big-endian target

Now everything except floating-point parameters is compatible with C code compiled with "-malign-int -mrtd".
Compatibility with "-mno-align-int" is achievable by changing target_info.maxCrecordalign to 2, but doings so causes a lot more troubles because RTL (incorrectly) assumes that records declared with {$PACKRECORDS C} are aligned to pointer size.

+ Reuse parameter locations. Since everything is passed on stack, it reduces code size quite a bit.
- tm68kparamanager.getintparaloc removed, generic implementation has been tested and works as expected.

git-svn-id: trunk@28083 -
2014-06-27 06:58:39 +00:00
sergei
3ffa32a660 - m68k: removed garbage (tab characters, commented out code, unused variables, debug output and alike). Functionality unchanged.
git-svn-id: trunk@28070 -
2014-06-26 06:01:29 +00:00
Jonas Maebe
bacd303208 * synchronized with trunk up to r27758
git-svn-id: branches/hlcgllvm@27779 -
2014-05-12 16:12:34 +00:00
Károly Balogh
73db4db6f8 use the whole reg for return values
git-svn-id: trunk@27116 -
2014-03-12 18:22:04 +00:00
Jonas Maebe
e9268a0a14 * synchronised with trunk up till r26975
git-svn-id: branches/hlcgllvm@26976 -
2014-03-06 21:36:58 +00:00
Károly Balogh
b398430b4c * get_volatile_registers* now defines proper volatile register range for all cases using the pre-defined values
* removed the two huge and ugly case switches while parsing Amiga-specific paralocs, using a simple unified function now

git-svn-id: trunk@26466 -
2014-01-15 02:49:03 +00:00
Jonas Maebe
99de108c68 * renamed all paramanagers to tcpuparamanager so the llvm paramanager can
derive from them without ifdefs

git-svn-id: branches/hlcgllvm@26039 -
2013-11-11 11:15:27 +00:00
Károly Balogh
584e3638ab * get the count of params from the correct list
this fixes varargs a bit, particularly fixes an unhandled TList bounds exception while compiling packages/fcl-base/src/eventlog.pp

git-svn-id: trunk@25636 -
2013-10-04 11:24:20 +00:00
svenbarth
235c06ab34 Implement volatile address registers. Fixes quite some tests, but also breaks others... (overall more are fixed than are broken :) )
paramgr.pas, tparamanager:
  + add virtual get_volatile_registers_address method which by default returns an empty set
cgobj.pas, tcg:
  * allocallcpuregisters: also allocate address registers if needed
  * deallocallcpuregisters: also deallocate address registers if needed
ncgcal.pas, tcgcallnode.pass_generate_code:
  * (de)allocate address registers
  * keep result from being deallocated if it should be an address register (currently by no architecture...)
m68k/cpupara.pas, tm68kparamanager:
  + get_volatile_registers_address: return a0 and a1 as volatile registers
m68k/n68kmat.pas, tm68kmoddivnode.call_rtl_divmod_reg_reg:
  * (de)allocate address registers

git-svn-id: trunk@25633 -
2013-10-03 20:33:11 +00:00
svenbarth
0cb2bda0a5 Correctly handle loads of different sizes. Fixes 1 test. Might be more, but some other bugs might hide it.
m68k/cgcpu.pas, tcg68k:
  * a_load_ref_cgpara: use pashsize instead of paraloc^.size as the latter could be OS_NO and thus a "move" instead of a "move.x" will be generated resulting in a word move when a long or byte move might have been necessary
  * a_load_reg_ref: use the smallest size when moving the value to a reference
  * a_load_ref_ref: when the size is different always use a temporary register for a ref to ref move
  * a_load_ref_ref: when doing a fixed move for Coldfire use the correct ref (that's another embarrasing error...) and size (fixes usage of String[Index] for a const array parameter)
  * a_load_ref_reg: use the smallest size when moving the value from a reference
  * g_concatcopy: don't use source.alignment as that doesn't contain the correct value and also load the value into the temp register using the correct size (fixes passing of small values as parameters, like chars)

git-svn-id: trunk@25624 -
2013-10-02 20:14:16 +00:00
Jonas Maebe
9938169d2c * don't use the paracgsize in get_paraloc_def(), because it generally
contains the tcgsize of the entire parameter rather than only of
    what is left (-> calculate it from the remaining parameter length)

git-svn-id: trunk@24776 -
2013-06-02 14:05:07 +00:00
Jonas Maebe
7566ddcc8f * add a tdef to each parameter location and set it for all target
backends (not yet used, will be used in high level code generator)

git-svn-id: trunk@24761 -
2013-06-02 10:24:02 +00:00
svenbarth
b455ae9534 m68k/cpupara.pas, tm68kparamanager.getintparaloc:
* initialize paraloc^.size to OS_INT instead of leaving it at 0

This fixes tests/test/cg/ttryexc1.pp. The problem was that the raise node generated code which resulted in a word(!) move of the raised object's address to the stack location for fpc_raiseexception. This then resulted in an error when freeing the exception object.

git-svn-id: trunk@23465 -
2013-01-20 16:33:10 +00:00
Jonas Maebe
69c29a415f * pass the procdef to getintparaloc instead of only the proccalloption, so
that the type of the parameters can be determined automatically
   o added compilerproc declarations for all helpers called in the compiler
     via their assembler name, so we can look up the corresponding procdef

git-svn-id: trunk@23325 -
2013-01-06 15:05:40 +00:00
pierre
548a687a17 LOC_FPUREGISTER is not used for func_getretloc ig using fpu_soft
git-svn-id: trunk@23175 -
2012-12-18 14:58:53 +00:00
pierre
34279864ef Remove double cgutils in uses clause
git-svn-id: trunk@22758 -
2012-10-19 07:31:18 +00:00
svenbarth
825fa86824 Added missing unit for tcpuregisterset
git-svn-id: trunk@22754 -
2012-10-18 20:39:35 +00:00
svenbarth
75baec5985 Mark all integer registers as volatile.
git-svn-id: trunk@22747 -
2012-10-18 20:12:20 +00:00