Commit Graph

142 Commits

Author SHA1 Message Date
Károly Balogh
3b9e2a620b added a remark about a possible QEMU issue with CMP/CMPI .W and .B on ColdFire
git-svn-id: trunk@27291 -
2014-03-26 17:08:16 +00:00
Károly Balogh
1af6d17b4d don't enforce BPL length, use SUBQ in g_concatcopy
git-svn-id: trunk@27290 -
2014-03-26 15:43:25 +00:00
Károly Balogh
9ae38cdc1c back to more conservative sign extension. this really needs separate handling for ColdFire and normal 68k, because the CF executes 32bit arithmetics only while normal 68k will do any size happily.
git-svn-id: trunk@27289 -
2014-03-26 15:02:50 +00:00
Károly Balogh
bca09a8f69 reverted parts of r27117 because it caused regressions
git-svn-id: trunk@27118 -
2014-03-12 19:22:04 +00:00
Károly Balogh
c7d1cef334 support sign/zero extension to subreg sizes, not just always to 32bit
git-svn-id: trunk@27117 -
2014-03-12 18:27:50 +00:00
Károly Balogh
552ab2938e avoid some unnecessary sign extensions
git-svn-id: trunk@27111 -
2014-03-12 04:16:52 +00:00
Károly Balogh
3a464dbdcf don't swap the base and index registers if we have a scalefactor
git-svn-id: trunk@27109 -
2014-03-12 02:34:30 +00:00
Károly Balogh
7b05113322 addressing improvements: fixref can swap base/index registers if better fits 68k pattern, less need to move around registers. also fix reference in a_op_const_ref.
git-svn-id: trunk@27108 -
2014-03-12 01:32:44 +00:00
Károly Balogh
13210ff7d4 use MVZ/MVS ColdFire instructions to load constants where applicable
git-svn-id: trunk@26935 -
2014-03-03 00:53:52 +00:00
Károly Balogh
1d5f74fae0 m68k implementation of g_save_registers and g_restore_registers using movem.l
git-svn-id: trunk@26923 -
2014-03-02 14:58:05 +00:00
Károly Balogh
8730b1bf45 cleaned up g_proc_exit, optimized generated code and also added some comments about possible ABI variations. the changes also fix two tests on my system related to cdecl procedures
git-svn-id: trunk@26918 -
2014-03-01 23:52:00 +00:00
Károly Balogh
bd4cc3b8f3 cleaned up, reindented, simplified and allowed some minor optimizations in tcg64f68k
git-svn-id: trunk@26914 -
2014-03-01 18:25:05 +00:00
Károly Balogh
74533a7c90 avoid generating addressing like <label>+8(aX), since this might fail during linking if label is more than 32k away, fixes linking with lineinfo unit here
git-svn-id: trunk@26826 -
2014-02-22 02:12:03 +00:00
Károly Balogh
667ec17cae tiny optimization for clearing address regs
git-svn-id: trunk@26569 -
2014-01-23 02:29:45 +00:00
Károly Balogh
047395df5f implemented add/sub ops in a_op_reg_ref, since these are used often. also fixed up reference handling in a_op_const_ref a bit
git-svn-id: trunk@26568 -
2014-01-23 02:07:24 +00:00
Károly Balogh
cd4bb364e5 reenabled and fixed up tcg68k.op_const_ref a bit
git-svn-id: trunk@26567 -
2014-01-22 23:15:01 +00:00
nickysn
85dd9e5789 + added a size parameter to optimize_op_const and do a sign extension of the 'a' parameter up from the specified size, so that things like (i and $ffffffff) get optimized away the same way as (i and -1)
git-svn-id: trunk@26561 -
2014-01-22 15:00:34 +00:00
Károly Balogh
b37ebeaabd disabled a_loadaddr_ref_cgpara() for m68k, this code was copy-pasted from x86 probably and could never work properly as it is
git-svn-id: trunk@26462 -
2014-01-15 01:27:02 +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
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
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
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
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
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
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
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
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
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
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
39219cc30f Also handle fpu_soft
git-svn-id: trunk@23179 -
2012-12-18 15:07:13 +00:00
svenbarth
1bc47815be m68k/cgcpu.pas, tcg64k.fixref:
* in the case of ref.base + ref.symbol always add the base to the index; with this the compiler now cycles for Coldfire

git-svn-id: trunk@22931 -
2012-11-04 20:29:22 +00:00
svenbarth
a4f390e4d9 m68k/cgcpu.pas, tcg64f68k:
+ a_op64_reg_reg: add support for "NEG" and "NOT" of 64-bit values
  + a_op64_const_reg: make sure that we know whether a NEG or NOT with a constant is performed

git-svn-id: trunk@22930 -
2012-11-04 20:27:01 +00:00
svenbarth
22552e468b m68k/cgcpu.pas, tcg68k.g_concatcopy:
* in case of copying from the parameter location to the local location we need to use the alignment size for the source as byte/word values are passed as LongInts (this is how the ABI is specified)

git-svn-id: trunk@22924 -
2012-11-04 16:11:16 +00:00
svenbarth
30f006d751 m68k/cgcpu.pas, tcg64f68k.a_op64_const_reg:
* use the correct register for the high value

git-svn-id: trunk@22923 -
2012-11-04 16:08:37 +00:00
svenbarth
49d953aea2 m68k/cgcpu.pas:
+ add methods "call_rtl_mul_const_reg" and "call_rtl_mul_reg_reg" which can call the RTL helpers "fpc_mul_longint" and "fpc_mul_longword" (based on AVR code)
  * use the new call methods for the RTL to correctly pass the parameters (on the stack, not in registers...)

git-svn-id: trunk@22892 -
2012-10-31 20:58:16 +00:00
svenbarth
a3a3cad8ee m68k/cgcpu.pas, tcg68k.a_load_const_ref:
* don't do a sign_extend, but use the correct move size to copy the const; this fixes the setting of the line ending style inside of "Assign"

=> output of strings does now work correctly!

git-svn-id: trunk@22890 -
2012-10-31 20:26:29 +00:00
svenbarth
c3c7ec8839 m68k/cgcpu.pas, a_load_const_reg:
don't use the given size for MOVEQ, but only S_L

git-svn-id: trunk@22888 -
2012-10-31 19:22:27 +00:00
svenbarth
b94a120f84 m68k/cgcpu.pas, a_load_const_ref & a_load_const_reg:
use the correct size when moving a constant to a reference or register

git-svn-id: trunk@22887 -
2012-10-31 19:05:22 +00:00
svenbarth
842bb90283 * m68k/cgcpu.pas, tcg68k.a_load_ref_reg:
"sign_extend" expects the old size, not the new size. This fixes the handling of "InOutRes" which is a Word...

git-svn-id: trunk@22840 -
2012-10-24 05:01:27 +00:00
svenbarth
65a4d8baa2 Revert 22814. While this revision might fix compiler linking for Coldfire it breaks running any Coldfire up during OpenStdIO... I prefer running apps instead of a linking compiler.
Seems that I need to think this "fixref" stuff for symbols through a bit more...

git-svn-id: trunk@22826 -
2012-10-23 05:14:17 +00:00
svenbarth
cb8db8fa23 * m68k/cgcpu.pas, tcg68k.fixref:
always handle the symbol if base is set

git-svn-id: trunk@22814 -
2012-10-21 19:46:41 +00:00
svenbarth
5d28872a21 * m68k/cgcpu.pas, tcg68k.fixref:
also make m68k's fixref apply to the assumption that a register isn't modified in the cg

git-svn-id: trunk@22802 -
2012-10-21 17:19:09 +00:00