Commit Graph

171 Commits

Author SHA1 Message Date
Károly Balogh
392da9e43f * fix warnings when compiling the compiler with DFA optimizer enabled on m68k
git-svn-id: trunk@28499 -
2014-08-20 13:49:47 +00:00
Károly Balogh
9b0bf91076 m68k: do not generate CLR instructions to memory references on plain 68k. there this instruction also causes reads from the address, which is slow and can have side effects.
git-svn-id: trunk@28422 -
2014-08-16 13:03:03 +00:00
sergei
a28d6a84a7 + m68k, a_load_const_reg: use MOV3Q if applicable for data registers as well, since it allows spilling replacement of destination.
+ a_load_const_ref: use CLR and MOV3Q if possible.
* a_cmp_reg_reg_label: force size to 32 bits for ISA_A and ISA_A+ targets.
+ support for stack frames larger than 32767 bytes.

git-svn-id: trunk@28298 -
2014-08-02 12:46:34 +00:00
sergei
a42ecadddf + m68k: implemented overflow checking (does not work for multiplication yet).
+ support references as source operands for 64-bit AND and OR operations.

git-svn-id: trunk@28275 -
2014-07-30 01:46:25 +00:00
sergei
dac52f503c * m68k: fixed extension in a_load_ref_reg. Existing code cleans only bits 16-31 when loading a 8-bit register from 16-bit reference, and leaves garbage in bits 8-15.
git-svn-id: trunk@28256 -
2014-07-24 12:17:29 +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
sergei
df60309d96 * m68k: fixed the last remaining warning and removed "$WARNINGS OFF" directive.
git-svn-id: trunk@28176 -
2014-07-06 11:36:33 +00:00
sergei
b91d965096 * m68k: initial support for ROL/ROR operations, defining 'cpurox' for CPU target can actually enable them. However it cannot be done outright because these instructions do not exits on Coldfire, and internal processing of RoX,Sar,BsX, etc. can not yet be switched depending on CPU subtype.
git-svn-id: trunk@28101 -
2014-06-29 17:49:30 +00:00
sergei
535218e837 * m68k: fixed OP_NOT/OP_NEG with two registers, it must never modify the source register.
git-svn-id: trunk@28097 -
2014-06-28 05:22:03 +00:00
sergei
4df49964ca * tcg68k.a_op_reg_reg: renamed parameters 'reg1' and 'reg2' to 'src' and 'dst' to make it clear what's what.
* tcg68k.fixref method made public.

git-svn-id: trunk@28095 -
2014-06-28 05:09:34 +00:00
sergei
3851c1f494 - m68k: removed a_loadmm_* methods, no need to override because they produce internal error already in base class.
git-svn-id: trunk@28086 -
2014-06-27 12:15:00 +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
Károly Balogh
5276de5627 m68k: restored orglen variable to g_concatcopy which was actually used, but still got removed in r28072
git-svn-id: trunk@28080 -
2014-06-26 19:46:57 +00:00
Károly Balogh
3028f3ac78 m68k: disabled PEA debug comment accidentally left in
git-svn-id: trunk@28077 -
2014-06-26 16:50:42 +00:00
Károly Balogh
d93e7b3367 m68k: cleaned ancient silly debug mess from a_loadaddr_ref_reg. no functional changes.
git-svn-id: trunk@28076 -
2014-06-26 16:47:55 +00:00
Károly Balogh
1388cb9bae m68k: implemented a proper a_loadaddr_ref_cgpara instead of the disabled mess in the source, utilizing the PEA instruction
git-svn-id: trunk@28075 -
2014-06-26 16:39:17 +00:00
sergei
4c3eb391ef * m68k: cleaned out unused variables in cgcpu.pas
* Fixed reference strength in a_call_reg.

git-svn-id: trunk@28072 -
2014-06-26 08:27:38 +00:00
sergei
ad59098457 + m68k: initial implementation of g_stackpointer_alloc method, it has to exist for targets with non-fixed stack.
git-svn-id: trunk@28064 -
2014-06-25 17:43:37 +00:00
Károly Balogh
531ac093ed m68k: implemented a simple a_cmp_const_ref_label. uses TST instruction to test ref contents against zero
git-svn-id: trunk@28053 -
2014-06-25 06:56:58 +00:00
Károly Balogh
519094055c m68k: cleaned up and fixed cgcpu/fixref for coldfire at least; also enabled n68kmem node, so addressing with scaling is generated now
git-svn-id: trunk@28025 -
2014-06-21 21:36:48 +00:00
Károly Balogh
0045f34322 tabs to spaces and indentation fix, no functional changes
git-svn-id: trunk@27950 -
2014-06-14 09:09:53 +00:00
Károly Balogh
7963351440 m68k: removed comment generation line accidentally left in from the previous commit
git-svn-id: trunk@27936 -
2014-06-11 22:42:26 +00:00
Károly Balogh
ed3ce4087a m68k: try to generate a bit smaller code in g_adjust_self; also changed two JMPs to S_NO from S_L, because JMP is unsized anyway
git-svn-id: trunk@27935 -
2014-06-11 22:33:09 +00:00
Károly Balogh
1b11541c90 m68k: simplification and cleanup of g_proc_entry. the generated code shouldn't change
git-svn-id: trunk@27922 -
2014-06-10 09:15:26 +00:00
Károly Balogh
17657ca11d m68k: more minor reference usage tweaking, hopefully fixes Mantis 26286
git-svn-id: trunk@27880 -
2014-06-06 16:41:40 +00:00
Károly Balogh
381cf72023 m68k: minor bits, addq/subq works also on address regs, remove reference validity check in a_op_const_ref because we have fixref() later anyway
git-svn-id: trunk@27876 -
2014-06-06 15:15:03 +00:00
Károly Balogh
0fe656e82d m68k: simplified code generated by g_concatcopy and cleaned up the old mess from the code
git-svn-id: trunk@27859 -
2014-06-05 12:42:36 +00:00
Károly Balogh
f3bbad26c3 m68k: use MOVEA without size to load values to address regs. use a_op_const_reg in a_op_const_ref for smarter const loading when necessary
git-svn-id: trunk@27828 -
2014-05-30 05:29:22 +00:00
Károly Balogh
28323135f8 m68k: minor optimizations to g_proc_exit() - use LEA for stackpointer math which is better than ADDing large constants, also only modify the SP reg once
git-svn-id: trunk@27817 -
2014-05-25 01:34:00 +00:00
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