Commit Graph

335 Commits

Author SHA1 Message Date
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
74af6d0dab enabled hardware mul reg, reg codepath for ColdFire too, accelerates tfloattostr test (thus some of the SoftFPU code) by a magnitude...
git-svn-id: trunk@25770 -
2013-10-13 21:36:24 +00:00
Károly Balogh
97864d7cbd trying harder to commit compilable code (manual merge fail)
git-svn-id: trunk@25764 -
2013-10-13 18:31:43 +00:00
Károly Balogh
3b99974847 set up register A6 to be saved as well. this will only happen in case A6 is not used as framepointer
git-svn-id: trunk@25759 -
2013-10-13 16:12:32 +00:00
Károly Balogh
e5eac1bd44 make the array of registers to use depending on wheter we have an FP or not, and which register we have as FP
git-svn-id: trunk@25758 -
2013-10-13 16:06:35 +00:00
Károly Balogh
db49a169cb handle more locations in tm68knotnode, fixes several tests failing to compile with 200203223
git-svn-id: trunk@25746 -
2013-10-11 02:51:23 +00:00
Károly Balogh
aedf2dc20d fixed spilling operation type for A_LEA, fixes test tb0112 to compile, but still fails to run
git-svn-id: trunk@25745 -
2013-10-11 02:03:48 +00:00
Károly Balogh
275031a0dd fix a bogus R_INTREGISTER to be R_ADDRESSREGISTER in getopstr()
git-svn-id: trunk@25744 -
2013-10-10 22:24:56 +00:00
Károly Balogh
fe3d11118c add string version of the new instructions to the right place. removed one more duplicate table.
git-svn-id: trunk@25743 -
2013-10-10 22:12:40 +00:00
Károly Balogh
dfe2f253f9 added 68040 CPU type, MOVE16 and ColdFire V4 extra instructions
git-svn-id: trunk@25742 -
2013-10-10 22:01:58 +00:00
Károly Balogh
280ee919b7 removed several debug writeln()s
git-svn-id: trunk@25741 -
2013-10-10 21:20:20 +00:00
Károly Balogh
bcab04538c removed unused table, cleanups
git-svn-id: trunk@25740 -
2013-10-10 21:19:15 +00:00
Károly Balogh
4c5f273bc5 removed redundant instruction table only used for ugly debug, and the ugly debug code itself
git-svn-id: trunk@25739 -
2013-10-10 21:16:07 +00:00
svenbarth
6fef9a2c80 Correctly implement g_intf_wrapper. Fixes nearly 200 tests and now the cross compiled compiler is at least able to print the help (compiling a simple program does not work yet though).
m68k/cgcpu.pas, tcg68k:
  + override g_adjust_self_value as we don't do register allocation for the wrapper we need to adjust the Self value using the scratch registers (could be improved however) and we also can not use the offset that the original procedure in tcg uses
  * fix g_intf_wrapper by using the correct operations and loading the correct (virtual) method offset

git-svn-id: trunk@25728 -
2013-10-09 19:56:17 +00:00
florian
babbc21afd * fix handling of register sets on m68k: it is required that they are stored as two tcpuregistersets because address registers and data registers have different register types
git-svn-id: trunk@25726 -
2013-10-09 18:15:06 +00:00
svenbarth
a4683461cf Fix around 25 tests (under them all tcalval* tests!) by indeed using the save/restore registers code I adjusted earlier.
m68k/cgcpu.pas, tcg68k:
  - remove g_save_registers and g_restore_registers which DID NOT CALL inherited!
  - also remove commented methods g_save_all_registers & g_restore_all_registers

git-svn-id: trunk@25715 -
2013-10-07 19:36:21 +00:00
Károly Balogh
1f11c39a5d * huge m68k/cgcpu.pas cleanup and improvement commit
- removed the ancient DEBUG_CHARLIE silliness... :)
- moved some repeated code patterns into separate functions
- rewrote most of of tcg68k.a_op_const_reg and tcg68k.a_op_reg_reg
- smarter code generation in tcg68k.a_cmp_const_reg_label
- added support for MULU/MULS on Coldfire in a case which is often used by the CG to index arrays to be used instead of the RTL helpers, this results in a *HUGE* speedup in tw5086 for example

git-svn-id: trunk@25702 -
2013-10-06 22:16:37 +00:00
florian
304d7ef7a1 * restores atari support/rtl partially
git-svn-id: trunk@25699 -
2013-10-06 19:36:59 +00:00
Károly Balogh
b1b90211f1 fixed spilling operation type for lots of operations (thanks Florian), fixes a few endless loops in the testsuite, at least
git-svn-id: trunk@25696 -
2013-10-06 16:51:39 +00:00
svenbarth
c48d572996 Implement support for saving and restoring address registers.
cgobj.pas, tcg:
  * g_save_registers: add the amount of used address registers to size as well
  * g_save_registers: save all used address registers
  * g_restore_registers: restore all stored address registers
m68k/cpubase.pas:
  * rename saved_standard_address_registers to saved_address_registers
all other platform's cpubase.{inc,pas} (except alpha, ia64 and vis which are not up to date):
  * add a saved_address_registers variable with one entry of RS_INVALID

At least a "make fullcycle" did complete.

git-svn-id: trunk@25664 -
2013-10-05 21:43:42 +00:00
svenbarth
b1d79494dd Fix around 30 tests by using a volatile register for restoring the stack pointer
m68k/cgcpu.pas, tcg68k.g_proc_exit:
  * use A0 (which is a volatile register) instead of A3 (which is not) to restore the stack pointer

git-svn-id: trunk@25663 -
2013-10-05 21:32:27 +00:00
svenbarth
20587d8547 And another place where I forgot to (de)allocate address registers...
m68k/cgcpu.pas, tcg68k.call_rtl_mul_const_reg & tcg68k.call_rtl_mul_reg_reg:
  * (de)allocate address registers

git-svn-id: trunk@25654 -
2013-10-05 17:53:06 +00:00
svenbarth
f8fe25f8cf Forgot to commit one location where address registers need to be allocated.
m68k/n68kmat.pas, tm68kmoddivnode.call_rtl_divmod_reg_reg:
  * (de)allocate address registers

git-svn-id: trunk@25653 -
2013-10-05 17:50:12 +00:00
Károly Balogh
55be015a4e better version of the ColdFire TST.L 123(dX) fix, fixes regressions in tcnvint1 and 2
git-svn-id: trunk@25651 -
2013-10-05 16:52:39 +00:00
Károly Balogh
6c0581da49 * do not emit TST.L #ofs(dX) instructions for the Coldfire
fixes an assembler error while compiling packages/fpgtk/src/fpgtk.pp for the Coldfire

git-svn-id: trunk@25637 -
2013-10-04 11:31:58 +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
29ff548c0b Revert some additions of add_move_instruction as this heavily breaks code when the frame pointer is involved
git-svn-id: trunk@25632 -
2013-10-03 18:58:38 +00:00
svenbarth
dd204f395d m68k: add a few more add_move_instruction to tcg68k
git-svn-id: trunk@25631 -
2013-10-03 14:36:08 +00:00
svenbarth
03623c6c1a Forgot to commit that I moved tcgsize2opsize from cgcpu to cpubase.
git-svn-id: trunk@25630 -
2013-10-03 14:34:54 +00:00
svenbarth
8e60465eb4 Fix the last failing tcnvint test (plus another one) by using comparisons that are not necessarily 32-bit.
m68k/n68kadd.pas, tn68kadd.second_cmpordinal:
  * use the size of the largest operand to select a fiting operand
  * ToDo: check whether a sign/zero extend of the value is necessary

git-svn-id: trunk@25628 -
2013-10-03 11:59:25 +00:00
svenbarth
75dc360bd4 Correctly handle 64-Bit values when converting ints to bools. Fixes 2 tests.
m68k/n68kcnv.pas, tn68kcnv.second_int_to_bool:
  * we need to check both the upper and the lower register for a 64-bit value to decide whether it's True or False

git-svn-id: trunk@25625 -
2013-10-02 20:16:42 +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
Károly Balogh
31e7b790a7 a_load_const_reg: don't sign_extend after MOVEQ, it's not needed. also use CRL.L before loading to reg instead of sign_extend when possible
git-svn-id: trunk@25615 -
2013-10-02 01:19:44 +00:00
svenbarth
2c93687c5a Fix an embarrasing error in m68k which fixes 60 tests.
m68k/cgcpu.pas, tcg68k.g_flags2reg:
  * don't sign extend the flag value which was stored to the register, but instead do a "AND 1" on it to reduce it to 1 bit; afterall Booleans in Pascal are either 0 or 1 and not 0 or $FF

+ added test

git-svn-id: trunk@25598 -
2013-09-28 20:07:57 +00:00
svenbarth
4d1fb1573e m68k: Fix handling of small sets (based on how ARM does it)
Fixes 12 tests

git-svn-id: trunk@25589 -
2013-09-28 08:17:13 +00:00
svenbarth
6f5a648516 Improve the cpu type handling for M68k just in case we should branch 2.8.0 before I can start working on M68k again.
Therefor the cpu type (-Cp...) "coldfire" was split up into "isaa", "isaa+", "isab" and "isac". The Linux RTL can currently compiled for "68020", "isab" and "isac". For the other three Bcc.L must be handled differently (only Bcc.B/W supported) and for "68000" also EXT.L needs to be handled differently.

fpcdefs.inc:
  + define CPUCAPABILITIES if capabilities can be set for a certain CPU type (currently ARM, AVR and M68k)
options.pas:
  * check for CPUCAPABILITIES instead of specific CPUs
assemble.pas:
  - the handling of the CPU type is already done in m68k/ag68kgas.pas, Tm68kGNUAssembler.MakeCmdLine (and thereby already using the gascputypestr array!)
m68k/cpuinfo.pas:
  - tcputype: remove "cpu_coldfire"
  + tcputype: add "cpu_isa_a", "cpu_isa_a_p", "cpu_isa_b" and "cpu_isa_c"
  + add "cpu_coldfire" constant which contains all Coldfire specific cpu types
  * adjust "cputypestr" and  "gascputypestr"
  + add tcpuflags and cpu_capabilities (DBRA restriction was checked with CPUCOLDFIRE, CAS/TAS will be needed for atomic operations and BRAL restriction was discovered during testing of new cpu types)
m68k/cgcpu.pas:
  * adjust checks for "cpu_coldfire"
m68k/n68kadd.pas:
  * don't use a BRA.L if it is not supported, but (at least for now) a BRA.W
aggas.pas:
  * adjusted check for Coldfire

git-svn-id: trunk@25457 -
2013-09-11 17:07:32 +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
Jonas Maebe
2dd75e707e * renamed thlcgobj.tcgsize2orddef to defutil.cgsize_orddef
git-svn-id: trunk@24743 -
2013-06-01 18:28:15 +00:00
sergei
d2995cbf14 - Removed ConcatPasString procedure, it duplicates ConcatString (it the past they probably used to differ, but today both preserve null characters).
git-svn-id: trunk@23662 -
2013-02-25 22:09:39 +00:00
svenbarth
12f3a21f09 Fix passing of Doubles on m68k processors that don't have FPU support.
m68k/cgcpu.pas, tcg68k:
	+ overload "a_loadfpu_ref_cgpara" and use the 64-bit code generator to pass Doubles if they are located in references

Fixes around nearly 100 tests.

git-svn-id: trunk@23597 -
2013-02-12 11:04:20 +00:00
svenbarth
78f0d6f70e Revert the changes from r23383 for m68k/n68kadd.pas. Memo to self: Don't change code if you don't really understand why it does things the way it does.
With this change and the change from r23465 we are down from ~950 to ~650 failures :D

git-svn-id: trunk@23466 -
2013-01-20 18:00:51 +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
paul
51825b6f2e compiler: change ret_in_param to accept tabstractprocdef instead of tproccalloption to allow check more options (required for record constructor implementation)
git-svn-id: trunk@23394 -
2013-01-16 01:14:23 +00:00
svenbarth
ccecf2c13c Fix comparisons (aka usage of flag/CCR register)
m68k/aasmcpu.pas, taicpu.spilling_get_operation_type:
  * add all Sxx instructions as "operand_write" instructions

m68k/n68kadd.pas, t68kaddnode.getresflags:
  * use the correct operation in case of swapped nodes

m68k/cgcpu.pas, tcg68k.g_flags2reg:
  - don't move a 0 to the register, because this will CLR it and thus the flags won't be valid anymore...
  - NEG would have been the wrong operation (NOT would have been correct), but it isn't needed anyway...
  * simplify the method by handling the address register case only when necessary

git-svn-id: trunk@23383 -
2013-01-14 20:31:15 +00:00
svenbarth
741992bae4 m68k/n68kmat.pas, tm68kshlshrnode.first_shlshr64bitint:
use RTL helper functions (through the inherited method) if we're not shifting by a constant

This fixes test/cg/tshlshr

git-svn-id: trunk@23378 -
2013-01-13 19:33:23 +00:00
svenbarth
252744ad24 m68k/cgcpu.pas, tcg68k.g_concatcopy:
use the correct flag for the copy loop: we jump back to the copy code as long as the value is positive aka BPL instead of BMI

This fixes around 30 tests (it fixes a quite bit more, but now some other tests seem to be broken...)

git-svn-id: trunk@23373 -
2013-01-13 16:21:59 +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
658968ef44 Add debugging generation ability for m68k compiler
git-svn-id: trunk@23187 -
2012-12-18 15:57:40 +00:00