Commit Graph

811 Commits

Author SHA1 Message Date
Károly Balogh
01febdd7f3 plain 68000 also doesn't support 123(dX)
git-svn-id: trunk@27098 -
2014-03-11 20:47:37 +00:00
Károly Balogh
a82a3ec38e let the assembler decide about the size of the Bcc and BRA instructions, this makes code generated here work on a 68000 (and probably a lot smaller in size, no more forced 32bit displacements)
git-svn-id: trunk@27084 -
2014-03-10 18:50:05 +00:00
Károly Balogh
6bd062b59f according to the M68K PRM and also GNU AS, plain 68000 has no BRA.L
git-svn-id: trunk@27083 -
2014-03-10 18:36:10 +00:00
Károly Balogh
1e65caa37a fixed the 68020 codepath for emit_div/mod
git-svn-id: trunk@27081 -
2014-03-10 18:01:53 +00:00
Károly Balogh
73f8c956e0 don't save the FP explicitly on a syscall, as they preserve all regs anyway except scratch regs
git-svn-id: trunk@27078 -
2014-03-10 13:39:51 +00:00
Jonas Maebe
4065483a50 * completed thlcgobj.location_force_fpureg(), use it everywhere and removed
ncgutil/thlcg2ll.location_force_fpureg()

git-svn-id: trunk@27071 -
2014-03-10 09:01:05 +00:00
Károly Balogh
875a7418b3 disable broken 68020 codepath and fall back to generic until it gets fixed
git-svn-id: trunk@27070 -
2014-03-10 01:36:05 +00:00
Károly Balogh
9ec1d4ee89 fixed spilling operation type for some ColdFire instructions
git-svn-id: trunk@27064 -
2014-03-09 23:04:28 +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
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
svenbarth
2a65c05a8c Clean up dead code.
m68k/n68kcnv.pas:
  - pass_generate_code is used from the parent class
  - ungetcpuregister is not needed here

git-svn-id: trunk@26848 -
2014-02-22 21:29:31 +00:00
svenbarth
908c0f7293 M68k: Correctly handle the case of assigning a Boolean expression to a 64-bit Boolean. Fixes tw20889.
* m68k/n68kcnv.pas, tm68ktypeconvnode.second_int_to_bool:
    Take an inspiration from the x86 code generator and correctly handle assignment of values with a size < 8 to 64-bit Booleans

git-svn-id: trunk@26847 -
2014-02-22 21:27:19 +00:00
svenbarth
435dec656f * m68k/n68kcnv.pas, tm68ktypeconvnode.second_int_to_bool:
use the size of the destination instead of the source for the destination register; fixes tenum6

git-svn-id: trunk@26835 -
2014-02-22 14:35:30 +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
2791e8ad15 use optimized cg loading functions in 64bit compares instead of hardcoded move.ls (move.l #X,dn is 48bit long, clr.l/moveq.l is 16bit long)
git-svn-id: trunk@26570 -
2014-01-23 03:03:44 +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
pierre
6d4a9aad66 pass new asm extra opt using -ao option
git-svn-id: trunk@26539 -
2014-01-21 00:16:26 +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
Károly Balogh
80b253c111 be consistent in naming. renamed VOLATILE_ADDRESSREGISTER to VOLATILE_ADDRESSREGISTERS
git-svn-id: trunk@26463 -
2014-01-15 01:31:41 +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
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
pierre
39219cc30f Also handle fpu_soft
git-svn-id: trunk@23179 -
2012-12-18 15:07:13 +00:00
pierre
2a610e74b7 Also handle fpu_soft
git-svn-id: trunk@23178 -
2012-12-18 15:06:24 +00:00
pierre
080034982f Use GasCpuTypeStr array: GAS uses different names for cpu variants
git-svn-id: trunk@23177 -
2012-12-18 15:04:57 +00:00
pierre
0af0da69b1 New GasCpuTypeStr array: GAS uses different names for cpu variants
git-svn-id: trunk@23176 -
2012-12-18 15:00:38 +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
svenbarth
5adb28a935 m68k/aasmcpu.pas, taicpu.spilling_get_operation_type:
+ NEGX is a readwrite instruction

git-svn-id: trunk@23093 -
2012-12-02 11:48:57 +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
9d4d7d748c m68k/n68kadd.pas:
+ add support for 64-bit comparisons; the code is based on the code of mips/ncpuadd.pas, but heavily adjusted for m68k

git-svn-id: trunk@22913 -
2012-11-01 21:27:02 +00:00
svenbarth
772072d8c9 m68k/n68kmat.pas, tm68kmoddivnode:
+ add routine "call_rtl_moddiv_reg_reg" which handles the calling of "fpc_div_longint", "fpc_div_dword", "fpc_mod_longint" and "fpc_mod_dword"
  * emit_mod_reg_reg & emit_div_reg_reg: use the new method instead of doing the call oneself

=> "Str(SomeInt, SomeStr)" and "Writeln(SomeInt)" now works

git-svn-id: trunk@22893 -
2012-10-31 21:27:05 +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
masta
e327b4581c Use TRegNameTable instead of array[tregisterindex] of string[10]
TRegNameTable is defined in compiler/rgbase.pas and is an array of
strings, limited to the maximum length of the used register names.

r22792 added a long register name but did not scale the string-size
enough, resulting in the compiler built breaking for arm.

git-svn-id: trunk@22817 -
2012-10-22 10:23:21 +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
svenbarth
f0aad6dbc4 * m68k/n68kadd.pas, t68kaddnode.second_cmpordinal:
for "CMP" it is important to note that the first operand (which can be basically a register, a constant or a reference) is substracted from the second operand (which needs to be a data register) and not the other way round

git-svn-id: trunk@22798 -
2012-10-21 13:59:05 +00:00
svenbarth
05fc3bc427 * m68k/ra68kmot.pas, tm68kmotreader.gettoken:
if "firsttoken" isn't set we must not take the possibility into account that the token could be an opcode

git-svn-id: trunk@22796 -
2012-10-21 13:54:55 +00:00
Jonas Maebe
6497d3c994 - removed no longer used/supported af_allowdirect flag (direct assembler
reader support)

git-svn-id: trunk@22794 -
2012-10-21 13:42:58 +00:00
florian
04543b179f o merge of the branch laksen/arm-embedded of Jeppe Johansen:
fixes a couple of arm-embedded stuff, 
  adds some controllers, start of fpv4_s16 support, for a complete list of
  changes see below:
------------------------------------------------------------------------
r22787 | laksen | 2012-10-20 22:00:36 +0200 (Sa, 20 Okt 2012) | 1 line

Properly do NR_DEFAULTFLAGS detection/allocation/deallocation
------------------------------------------------------------------------
r22782 | laksen | 2012-10-20 07:44:55 +0200 (Sa, 20 Okt 2012) | 1 line

Fixed flags detections code for wide->short optimization code for Thumb-2
------------------------------------------------------------------------
r22778 | laksen | 2012-10-19 20:23:14 +0200 (Fr, 19 Okt 2012) | 1 line

Added coprocessor registers, and support for 6 operands(MCR/MRC instructions, etc)
------------------------------------------------------------------------
r22647 | laksen | 2012-10-14 21:28:08 +0200 (So, 14 Okt 2012) | 1 line

Added register specifications to lpc1768.pp. From Joan Duran
------------------------------------------------------------------------
r22646 | laksen | 2012-10-14 21:10:20 +0200 (So, 14 Okt 2012) | 4 lines

Fixed some minor formating issues
Implemented a small heap mananger
Implemented console IO
Changed default LineEnding to CrLf(to ease console IO parsing)
------------------------------------------------------------------------
r22599 | laksen | 2012-10-09 08:58:58 +0200 (Di, 09 Okt 2012) | 1 line

Added all STM32F1 configurations
------------------------------------------------------------------------
r22597 | laksen | 2012-10-08 22:10:45 +0200 (Mo, 08 Okt 2012) | 1 line

Added initial support for the Cortex-M4F FPv4_S16 FPU
------------------------------------------------------------------------
r22596 | laksen | 2012-10-08 22:04:14 +0200 (Mo, 08 Okt 2012) | 1 line

Added FPv4_d16 FPU instructions, and a few extra registers
------------------------------------------------------------------------
r22592 | laksen | 2012-10-08 16:07:40 +0200 (Mo, 08 Okt 2012) | 2 lines

Added support for IT block merging
Added a peephole pattern check for UXTB->UXTH chains
------------------------------------------------------------------------
r22590 | laksen | 2012-10-08 14:30:00 +0200 (Mo, 08 Okt 2012) | 3 lines

Add CBNZ/CBZ instructions
Create preliminary Thumb-2 PeepHoleOptPass2 code, hacked together from the ARM mode code
Added a number of simple size optimizations for common Thumb-2 instructions
------------------------------------------------------------------------
r22582 | laksen | 2012-10-08 06:49:39 +0200 (Mo, 08 Okt 2012) | 3 lines

Fix optimizations of Thumb-2 code
Fix problem with loading of condition operand for IT instructions
Properly split IT blocks when register allocator tries to spill inside a block.
------------------------------------------------------------------------
r22581 | laksen | 2012-10-08 05:15:40 +0200 (Mo, 08 Okt 2012) | 4 lines

Fixed assembler calling command line for cpus>ARMv5TE. EDSP instructions will generate errors while assembling, due to RTL assembler routines
Updated boot code for all Cortex-M3 controllers, and sc32442b to use weak linking for exception tables.
Cortex-M3 devices now also share initialization routine to simplify maintenance
STM32F10x classes now have specific units which fit the interrupt source names and counts
------------------------------------------------------------------------
r22580 | laksen | 2012-10-08 05:10:44 +0200 (Mo, 08 Okt 2012) | 2 lines

Added support for .section, .set, .weak, and .thumb_set directive for GAS assembler reader
IFDEF'ed JVM specific assembler directives, to prevent ait_* set to exceed 32 elements
------------------------------------------------------------------------
r22579 | laksen | 2012-10-08 02:10:52 +0200 (Mo, 08 Okt 2012) | 3 lines

Remove all traces of the interrupt vector table generation mechanism
Clean up cpuinfo tables
Fixed ARMv7M bug(BLX <label> doesn't exist on that version)

git-svn-id: trunk@22792 -
2012-10-21 08:39:52 +00:00
svenbarth
7ffd6c61a1 m68k/n68kmat.pas, tm68knotnode.pass_generate_code:
* correctly handle the case "expectloc = LOC_JUMP"
  * make internal error unique

git-svn-id: trunk@22790 -
2012-10-20 21:05:17 +00:00
svenbarth
5bb0e5992b * m68k/n68kadd.pas, t68kaddnode.second_cmpboolean:
don't use "location.loc" if second_pass was not called on the node yet, but "expectloc"
* added test

git-svn-id: trunk@22789 -
2012-10-20 20:32:46 +00:00
svenbarth
b6eac7a31b n68kmat.pas, tm68knotnode.pass_generate_code:
fix the double running of second_pass in the way it was intended to work: check for left.expectloc instead of left.location.loc

git-svn-id: trunk@22788 -
2012-10-20 20:31:01 +00:00
svenbarth
f746d9603a * m68k/n68kadd.pas, t68kaddnode.second_cmpsmallset:
respect more location combinations than just LOC_CONSTANT and LOC_REGISTER
* added test

git-svn-id: trunk@22786 -
2012-10-20 19:39:29 +00:00
svenbarth
72a01f17f5 * m68k/n68kmat.pas, tm68knotnode.pass_generate_code:
It is a bad idea (TM) to do a second_pass twice on the same node
* added test

git-svn-id: trunk@22785 -
2012-10-20 18:23:35 +00:00
pierre
6bc6036fd5 Set cai_align and cai_cpu
git-svn-id: trunk@22769 -
2012-10-19 15:38:39 +00:00
pierre
963e211644 Try to add all add_move_instruction calls
git-svn-id: trunk@22768 -
2012-10-19 15:38:11 +00:00
pierre
0b404fea69 * more 68000 fixref changes
git-svn-id: trunk@22764 -
2012-10-19 12:34:41 +00:00
pierre
f81954760b More 68000 restrictions taken into account for fixref and TST instruction
git-svn-id: trunk@22762 -
2012-10-19 11:54:05 +00:00
pierre
b104d9c9e6 Add some missing instructions to spilling_get_operation_type method
git-svn-id: trunk@22760 -
2012-10-19 10:18:16 +00:00
pierre
d472b40149 Move conversion to address register of base reference to common code in fixref
git-svn-id: trunk@22759 -
2012-10-19 09:57:49 +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
a01677e546 Removed debug line
git-svn-id: trunk@22751 -
2012-10-18 20:12:37 +00:00
svenbarth
ca6ca31953 The message scan_f_illegal_char seems to have gained additional parameters since it was
introduced. Take that into account to avoid an access violation.

git-svn-id: trunk@22749 -
2012-10-18 20:12:28 +00:00
svenbarth
75baec5985 Mark all integer registers as volatile.
git-svn-id: trunk@22747 -
2012-10-18 20:12:20 +00:00
svenbarth
d9a61f2082 * make internal error unique
* add MULU and MULS to taicpu.get_spilling_operation_type

git-svn-id: trunk@22746 -
2012-10-18 20:12:16 +00:00
svenbarth
ff0eebf1ff Also change RTL helper FPC_DIV_CARDINAL to FPC_DIV_DWORD
git-svn-id: trunk@22745 -
2012-10-18 20:12:12 +00:00
svenbarth
8e07ddb2bc * made internal errors for M68K unique
* fixed comment
* added comment regarding the potential usage of an address register instead of an int one

git-svn-id: trunk@22744 -
2012-10-18 20:12:07 +00:00
svenbarth
786e814d49 Use the correct frame pointer register: A6 on Unixes and A5 on everything else. The only
open question is embedded systems (currently it counts as "everything else").

git-svn-id: trunk@22741 -
2012-10-18 20:11:49 +00:00
svenbarth
43d8da7aa3 Replace DBRA instruction for Coldfire with a SUB/BRA combination in the for-loop-code-
generation and the assembly helpers in the RTL as DBRA is not supported by Coldfire.

git-svn-id: trunk@22740 -
2012-10-18 20:11:45 +00:00
svenbarth
d5523e6af6 For now completely disable (I)MUL/(I)DIV support for Coldfire and pass through the RTL routines
(of which the names had changed from FPC_MUL_LONGWORD->FPC_MUL_DWORD and FPC_MOD_CARDINAL->
FPC_MOD_DWORD).
Also disable the usage of FPU opcodes for Coldfire.

git-svn-id: trunk@22739 -
2012-10-18 20:11:39 +00:00
svenbarth
dea2a205c9 Fixed reference handling mostly for Coldfire CPUs. While they are conceptually based on
M68000 CPUs they are nevertheless more restricted in some cases, so these need to be
handled explicitely (especially if symbols are involved).

git-svn-id: trunk@22738 -
2012-10-18 20:11:33 +00:00
svenbarth
72a47ea27a m68k/cgcpu.pas, tcg68k.g_proc_exit:
* generate special return code for non-68020 CPU which don't support RTD instruction (based on
  out code a few lines further down)

git-svn-id: trunk@22736 -
2012-10-18 20:11:25 +00:00
svenbarth
0217efc398 m68k/ag68kgas.pas, getreferencestring:
It seems that GNU as needs the syntax "offset(register.size*scale)" if the base address
  register is ommited instead of "offset(,register.size*scale)". Now the System unit
  assembles and nearly the complete RTL can be built.

git-svn-id: trunk@22734 -
2012-10-18 20:11:15 +00:00
svenbarth
cfadcf3769 m68k/cgcpu.pas, tcg68k.a_op_const_reg:
leave "and" and "or" as "and" and "or" as according to the assembly language reference the
  assembler should automatically choose the correct instruction (though Coldfire still should
  be tested for ORI/ANDI to CCR

git-svn-id: trunk@22733 -
2012-10-18 20:11:09 +00:00
svenbarth
f501a8fecc m68k/cgcpu.pas, tcg68k.a_op_const_reg:
* use andi/ori for constant values
  * use a scratch register if target is an address register (there seems to exist an omnious
    anda/ora instruction though, but GNU as doesn't seem to handle it... maybe I haven't set
    the CPU type correctly, so I'll need to investigate this so we can hopefully remove the
    need for a scratch register for certain CPU types ;) )

git-svn-id: trunk@22732 -
2012-10-18 20:11:02 +00:00
svenbarth
9402a068a5 m68k/n68kcnv.pas, tm68ktypeconvnode.second_int_to_bool:
* remove comments regarding needed LOC_JUMP implementation
* don't call flags2reg if the location is LOC_JUMP as there isn't a register to set the flags to
  (this allows fpc_mul_qword and fpc_mul_int64 to be assembled)

git-svn-id: trunk@22731 -
2012-10-18 20:10:56 +00:00
svenbarth
07c3cff61d m68k/n68kcnv.pas, tm68ktypeconvnode.second_int_to_bool:
implement case "LOC_JUMP" (with a more or less blindly copy from
  x86/nx86cnv.pas, tx86typeconvnode.second.int_to_bool; this now allows that the system unit can
  be compiled, but not yet assembled

git-svn-id: trunk@22728 -
2012-10-18 20:10:43 +00:00
svenbarth
05e37e3ab1 m68k/cgcpu.pas, tcg68k: implement a_jmp_name
git-svn-id: trunk@22726 -
2012-10-18 20:10:33 +00:00
svenbarth
e87f0e1df4 m68k/ra68kmot.pas, tm68kmotreader.Assemble:
the asmr_d_*_reading messages need an argument which specifies in which style the assembler code
  is read; this is most importantly used on i386; on m68k we currently don't have multiple styles,
  so simply disable these messages

git-svn-id: trunk@22725 -
2012-10-18 20:10:29 +00:00
svenbarth
83da4592d3 m68k/aasmcpu, taicpu.spilling_get_operation_type: add support for A_SUBX
git-svn-id: trunk@22724 -
2012-10-18 20:10:24 +00:00
Jeppe Johansen
0087661fb5 Added FPv4_d16 FPU instructions, and a few extra registers
git-svn-id: branches/laksen/arm-embedded@22596 -
2012-10-08 20:04:14 +00:00
florian
283ff05127 * merged avx support in inline assembler developed by Torsten Grundke
git-svn-id: trunk@22568 -
2012-10-06 19:47:18 +00:00
florian
4dee21c60e + NR_DEFAULTFLAGS and RS_DEFAULTFLAGS for all CPUs with flags added
git-svn-id: trunk@22181 -
2012-08-22 19:38:27 +00:00
florian
4d86d25c6c * -O4 switch for optimizations which are correct but which might have unexpected effects
like field reordering (possible problems cracker classes) or using ebp as normal register (broken
      stack traces from dump_stack)
    + niln is also valid in a cse domain
    * parameters passed by reference shall have a complexity >1
    * load nodes from outer scopes shall have a complexity >1
    * better cse debugging
    + more node types added to cse
    * consider parameters passed by reference in cse
    * take care of cse in parameters in simple cases

git-svn-id: trunk@22050 -
2012-08-09 18:58:54 +00:00
florian
b330bba0bc + introduce -Oofastmath
* limit the application of the tree transformation introduced in r21986 to safe cases and -Oofastmath

git-svn-id: trunk@22040 -
2012-08-08 19:35:45 +00:00
florian
eb1efdff8a + introduce cstylearrayofconst because pocall_mwcall was forgotten at several places
git-svn-id: trunk@22012 -
2012-08-05 08:48:23 +00:00
Jonas Maebe
0a1157da38 * fixed memory leaks in the compiler introduced in r21862 by marking and
releasing temporarily created function result locations

git-svn-id: trunk@21953 -
2012-07-23 13:49:29 +00:00
Jonas Maebe
3798b79fd7 + optimization that (re)orders instance fields of Delphi-style classes in
order to minimise memory losses due to alignment padding. Not yet enabled
    by default at any optimization level, but can be (de)activated separately
    via -Oo(no)orderfields
   o added separate tdef.structalignment method that returns the alignment
     of a type when it appears in a record/object/class (factors out
     AIX-specific double alignment in structs)
   o changed the handling of the offset of a delegate interface
     implemented via a field, by taking the field offset on demand
     rather than at declaration time (because the ordering optimization
     causes the offsets of fields to be unknown until the entire
     declaration has been parsed)

git-svn-id: trunk@21947 -
2012-07-22 16:47:19 +00:00
Jonas Maebe
d6066ed51a * fixed compilation for i386/m68k after r21878/21879
git-svn-id: trunk@21884 -
2012-07-11 17:41:18 +00:00
Jonas Maebe
7a0ae38700 + also specify the parameter def when allocating a parameter via
getintparaloc + adapted all call sites of getintparaloc. This
    led to a number of additional, related changes:
   o corrected the type information for some getintparaloc parameters
   o don't allocate some intparalocs in cases they aren't used
   o changed "const tvardata" parameter into "constref tvardata" for
     fpc_variant_copy_overwrite to make pass-by-reference semantics
     explicit
   o moved a number of routines that now have to call find_system_type()
     from cgobj to hlcgobj so that cgobj doesn't have to start depending
     on the symtable unit
   o added versions of the cpureg alloc/dealloc methods to hlcgobj that
     call through to their cgobj counter parts, so we can call save/restore
     the cpu registers before/after calling system helpers from hlcgobj
     (not implemented in hlcgobj itself, because all basic register
      allocator functionality is still part of cgobj/cgcpu)

git-svn-id: trunk@21696 -
2012-06-24 15:02:12 +00:00
Jonas Maebe
c3ea451aea * set tcgpara.vardef when creating parameter info
git-svn-id: trunk@21693 -
2012-06-24 15:01:54 +00:00
Jonas Maebe
2d48396587 - removed redundant checks
git-svn-id: trunk@21692 -
2012-06-24 15:01:48 +00:00
Jonas Maebe
587244c088 * factored out common code from get_funcretloc()
* set tcgpara.def for the function return location (field introduced for and
    already used by the JVM code generator, required for future hlcg
    functionality)

git-svn-id: trunk@21691 -
2012-06-24 15:01:42 +00:00
Jonas Maebe
0fc422f244 * moved definition of maxcpuregister and tcpuregisterset from cgbase to
cgutils, and define them so they are no larger than what is required by
    the current target platform
  * added cgutils to the uses clause of several units that use the
    tcpuregisterset type

git-svn-id: trunk@21624 -
2012-06-15 18:24:35 +00:00
Jonas Maebe
708a2532fc * consistently define empty saved_mm_registers arrays as containing a single
RS_INVALID superregister (instead of sometimes RS_NO and sometimes
    RS_INVALID)
  * check for RS_INVALID in tcg.g_save_registers() and ignore such entries

git-svn-id: trunk@21622 -
2012-06-15 18:24:25 +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
85a3fd3357 + ossinttype/osuinttype defs that correspond to OS_SINT/OS_INT for use in
the high level code generator

git-svn-id: trunk@21279 -
2012-05-12 16:03:15 +00:00
Jonas Maebe
aee5380ae0 * merged trunk up to r20882
o support for the new codepage-aware ansistrings in the jvm branch
   o empty ansistrings are now always represented by a nil pointer rather than
     by an empty string, because an empty string also has a code page which
     can confuse code (although this will make ansistrings harder to use
     in Java code)
   o more string helpers code shared between the general and jvm rtl
   o support for indexbyte/word in the jvm rtl (warning: first parameter
     is an open array rather than an untyped parameter there, so
     indexchar(pcharvar^,10,0) will be equivalent to
     indexchar[pcharvar^],10,0) there, which is different from what is
     intended; changing it to an untyped parameter wouldn't help though)
   o default() support is not yet complete
   o calling fpcres is currently broken due to limitations in
     sysutils.executeprocess() regarding handling unix quoting and
     the compiler using the same command lines for scripts and directly
     calling external programs
   o compiling the Java compiler currently requires adding ALLOW_WARNINGS=1
     to the make command line

git-svn-id: branches/jvmbackend@20887 -
2012-04-15 15:54:10 +00:00
Jonas Maebe
ac43eb9b70 + generic implementation of ReplaceForbiddenAsmSymbolChars() instead
of the AVR-specific ifdef'ed variant
   o since the only special character we use in mangled names on all platforms
     is $, added a new field to tasminfo called "dollarsign" that holds the
     character $'s should be replaced with (if it doesn't have to be replaced,
     leave it at $)

git-svn-id: trunk@20801 -
2012-04-11 18:01:57 +00:00
florian
2f5ce095ce * RefsHaveIndexReg -> cpurefshaveindexreg
* cpurefshaveindexreg defined properly in fpcdefs.inc

git-svn-id: trunk@20504 -
2012-03-10 19:43:52 +00:00
pierre
33800a0b59 * Avoid warnings and add create_varargs_paraloc_info method
git-svn-id: trunk@19575 -
2011-11-03 10:04:54 +00:00
Jonas Maebe
28740dce2d - removed extra "fordefinition" parameter again from tprocdef.mangledname(),
since the definition-specific adorning of JVM mangled names is Jasmin-
    specific, and such code has no place in symdef
  * moved code to adorn JVM mangled names for Jasmin definitions to agjasmin

git-svn-id: branches/jvmbackend@18346 -
2011-08-20 07:49:31 +00:00
Jonas Maebe
0ee702b3a2 * tprocdef.mangledname now gets an extra boolean parameter indicating
whether the mangled name is for defining a symbol, or for referencing
    it later (e.g. for a call or load of its address). The reason is that
    on the JVM both cases are different.
  + jvmdef unit to encode types according to the JVM rules
  + tprocdef.jvmmangledname() to encode a procdef's JVM mangled name
    (the common part of defining/referencing it; tprocdef.mangledname
     afterwards adorns it as required)

git-svn-id: branches/jvmbackend@18288 -
2011-08-20 07:22:00 +00:00
Jonas Maebe
72e9cfee24 * create/destroy also the high level code generator for all architectures,
so it can be used in generic code

git-svn-id: branches/jvmbackend@18280 -
2011-08-20 07:21:16 +00:00
florian
26850e3425 * fix full cycle after adding new boolean types
git-svn-id: branches/pasboolxx@17847 -
2011-06-27 20:11:08 +00:00
florian
77f2d6cc0d * introduce usage of TCGInt in the code generator units
git-svn-id: trunk@17459 -
2011-05-14 17:58:23 +00:00
svenbarth
96116a6c3a Several adjustments because virtual methods in helpers are just normal methods and a VMT isn't generated for them either.
* $CPU/cgcpu.pas: disable the generation of VMT loading code
* dbgstabs.pas, dbgdwarf.pas: treat virtual methods of helpers as normal methods
* ncgcal.pas: don't register virtual helper methods for WPO 
* ncgrtti.pas: write virtual helper methods as normal methods to RTTI
* nobj.pas: correctly handle final and override cases in helpers
* pdecvar.pas: property getters
* rautils.pas: no VMT offset in records

git-svn-id: branches/svenbarth/classhelpers@17150 -
2011-03-20 10:41:45 +00:00
paul
b317139006 compiler: fix compilation problems caused by tprocdef._class -> tprocdef.struct rename which was found by make fullcycle
git-svn-id: branches/paul/extended_records@16530 -
2010-12-10 06:50:58 +00:00
joost
07bf44517c * Merged XPCom branch into trunk, added support for constref and changed
the IInterface implementation to be XPCom-compatible
--- Merging r15997 through r16179 into '.':
U    rtl/inc/variants.pp
U    rtl/inc/objpash.inc
U    rtl/inc/objpas.inc
U    rtl/objpas/classes/persist.inc
U    rtl/objpas/classes/compon.inc
U    rtl/objpas/classes/classesh.inc
A    tests/test/tconstref1.pp
A    tests/test/tconstref2.pp
A    tests/test/tconstref3.pp
U    tests/test/tinterface4.pp
A    tests/test/tconstref4.pp
U    tests/webtbs/tw10897.pp
U    tests/webtbs/tw4086.pp
U    tests/webtbs/tw15363.pp
U    tests/webtbs/tw2177.pp
U    tests/webtbs/tw16592.pp
U    tests/tbs/tb0546.pp
U    compiler/sparc/cpupara.pas
U    compiler/i386/cpupara.pas
U    compiler/pdecsub.pas
U    compiler/symdef.pas
U    compiler/powerpc/cpupara.pas
U    compiler/avr/cpupara.pas
U    compiler/browcol.pas
U    compiler/defcmp.pas
U    compiler/powerpc64/cpupara.pas
U    compiler/ncgrtti.pas
U    compiler/x86_64/cpupara.pas
U    compiler/opttail.pas
U    compiler/htypechk.pas
U    compiler/tokens.pas
U    compiler/objcutil.pas
U    compiler/ncal.pas
U    compiler/symtable.pas
U    compiler/symsym.pas
U    compiler/m68k/cpupara.pas
U    compiler/regvars.pas
U    compiler/arm/cpupara.pas
U    compiler/symconst.pas
U    compiler/mips/cpupara.pas
U    compiler/paramgr.pas
U    compiler/psub.pas
U    compiler/pdecvar.pas
U    compiler/dbgstabs.pas
U    compiler/options.pas
U    packages/fcl-fpcunit/src/testutils.pp

git-svn-id: trunk@16180 -
2010-10-17 20:58:22 +00:00
pierre
7f200ab27e * Use asmsearchsym in assembler readers
git-svn-id: trunk@16104 -
2010-10-08 07:58:18 +00:00
Jonas Maebe
f13f6627c4 * moved use_fixed_stack from cgutils to a method in paramgr so it can
be used outside the code generator
  * renamed tabstractprocdef.requiredargarea into callerargareasize,
    and also added calleeargareasize field; added init_paraloc_info(side)
    method to init the parameter locations and init those size fields and
    replaced all "if not procdef.has_paraloc_info then ..." blocks with
    procdef.init_paraloc_info(callersize)"
  * moved detection of stack tainting parameters from psub to
    symdef/tabstractprocdef
  + added tcallparanode.contains_stack_tainting_call(), which detects
    whether a parameter contains a call that makes use of stack paramters
  * record for each parameter whether or not any following parameter
    contains a call with stack parameters; if not, in case the current
    parameter itself is a stack parameter immediately place it in its
    final location also for use_fixed_stack platforms rather than
    first putting it in a temporary location (part of mantis #17442)
  * on use_fixed_stack platforms, always first evaluate parameters
    containing a stack tainting call, since those force any preceding
    stack parameters of the current call to be stored in a temp location
    and copied to the final location afterwards

git-svn-id: trunk@16050 -
2010-09-26 21:24: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
Jonas Maebe
b6e4896805 * small typo corrections by Adriaan Van Os (mantis #15652)
git-svn-id: trunk@14844 -
2010-02-02 10:41:38 +00:00
florian
5acf377e31 * enable node cse for all cpus as level 2 optimization
git-svn-id: trunk@14703 -
2010-01-17 12:28:28 +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
34c985cfa6 * added register type parameter to cgsize2subreg(), as the subreg can
depend on that (and correct a number of cases where this was wrong)
  * set the correct subreg type for xmm x86_64 parameter registers
    (resolved mantis #14067)

git-svn-id: trunk@13410 -
2009-07-19 13:57:23 +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
a4cc881693 * fixed compilation after addition of support for weak symbols
git-svn-id: trunk@12716 -
2009-02-08 10:21:17 +00:00
Jonas Maebe
b1c3f76ff9 * changed the supported targets for assembler writers to a set, and
(hopefully correctly) limited all assembler writers to only the
    OSes they support (mantis #11801)

git-svn-id: trunk@12622 -
2009-01-28 15:12:43 +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
yury
b70bf05ad5 * I hope it's proper fix for r10688.
git-svn-id: trunk@10690 -
2008-04-18 10:51:56 +00:00
yury
e71d631c24 * Fix for tw10233 for all CPUs.
git-svn-id: trunk@10688 -
2008-04-18 07:38:25 +00:00
yury
771479e65c * Improved fix for bug #10233 for better Delphi compatibility and efficiency:
- Explicit typecasts like LongBool(byte_value) do not change ordinal value.
  - Explicit typecasts like ByteBool(longint_value) do not change ordinal value and can lead to data loss if longint_value is outside of ByteBool range.
  - Explicit typecasts like ByteBool(LongBool) handle type ranges correctly.
  - Updated test tw10233.pp. It is passed by Delphi as well.

git-svn-id: trunk@10672 -
2008-04-15 22:19:29 +00:00
yury
cf235145cb * Fixed a_load_reg_reg for arm.
* Fixed sign/zero-extension in second_int_to_bool for all CPUs. x86 and pppc were not affected by this bug, but I fixed it for all CPUs for consistency.
* cg/tcnvint1 is passed on arm now.

git-svn-id: trunk@10669 -
2008-04-15 20:44:27 +00:00
Jonas Maebe
62e66d2a56 * explicit typecasting of any ordinal type to a boolean of the same
size must happen without any mangling of the value (mantis #11027)
  * moved checking for signed-to-unsigned (or vice versa) type
    conversions in assignments from htypechk to ncnv (where there
    was already code for similar checks) and added support for
    bool_to_bool there as well

git-svn-id: trunk@10521 -
2008-03-21 14:44:58 +00:00
peter
8f239d04b6 * cleanup and simplify the set type handling
git-svn-id: trunk@10432 -
2008-03-02 17:48:27 +00:00
Jonas Maebe
8349cde7db * changed byte/word/longbool to be Delphi-compatible (+ similar changes
for qwordbool) + test:
    o assigning true to such a variable now sets them to $ff/$ffff/$ffffffff
    o these types are now all signed
    o converting an integer type to a byte/word/long/qwordbool using an
      explicit type cast keeps the integer's original value stored in the
      bool, instead of forcing it to ord(true)/ord(false)
    (mantis #10233 and #10613, implemented for all architectures, testsuite
     tested for ppc32, sparc and x86)
  * fixed some places where the rtl depended on longbool(true) having the
    value 1
  * extended several boolean tests (and adapted some to no longer assume
    that byte/word/long/qwordbool(true)=1)
  + support for converting to qwordbool in second_int_to_bool for x86, ppc
    and sparc

git-svn-id: trunk@9898 -
2008-01-24 21:30:55 +00:00
florian
94ea214f32 * more spilling fixes
git-svn-id: trunk@9820 -
2008-01-20 16:13:20 +00:00
florian
50294418bc * spilling for neg, ext and extb fixed
git-svn-id: trunk@9819 -
2008-01-20 16:07:42 +00:00
Jonas Maebe
18eb495d0f * give a regular error message instead of an internal error on x86
when using non-PIC references in assembler code when the compiler
    is configured to generate PIC code (on ppc, sparc and arm, no
    error message is given at all currently)

git-svn-id: trunk@9364 -
2007-12-01 11:28:15 +00:00
Károly Balogh
8674e35f45 * removed a_call_reg hack, not needed after peter's latest fix
git-svn-id: trunk@9130 -
2007-11-04 15:27:31 +00:00
Károly Balogh
14f958682c + first attempt to implement a_call_reg
+ various other changes

git-svn-id: trunk@9127 -
2007-11-04 01:40:02 +00:00
Károly Balogh
1536e9e65b + de-uglified the previous hack
+ made Amiga syscalls to save/restore the frame pointer (do we really need a frame pointer?)
 + some disabled debug comments (to asm source)
 + compiler is now able to generate some VERY basic, but working Amiga-m68k executables

git-svn-id: trunk@9051 -
2007-11-01 19:31:58 +00:00
Károly Balogh
12bcb539e6 + fix(?) stack return address with an ugly hack...
git-svn-id: trunk@9047 -
2007-11-01 16:04:16 +00:00
Károly Balogh
91abb3aeb9 + first (failed) attempt to have a working stackframe generation
git-svn-id: trunk@9040 -
2007-11-01 14:16:17 +00:00
Károly Balogh
b91c0756c4 + made m68k to compile system unit again
git-svn-id: trunk@9017 -
2007-10-31 22:33:00 +00:00
florian
00d6a03b2c + default code now preserves mm registers
* save|restore_standard_registers => save|restore_registers

git-svn-id: trunk@8954 -
2007-10-27 12:02:28 +00:00
florian
3a630340be * fixed m68k compilation and put it in fullcycle
git-svn-id: trunk@8953 -
2007-10-27 11:24:50 +00:00
peter
9f0ca44c94 * new tf_smartlink_library flag
* use create_smartlink[_sections|_library] to check what to 
    do for smartlinking

git-svn-id: trunk@8715 -
2007-10-01 16:55:08 +00:00
peter
6b8aed593f * remove registers{int/mmx/fpu} from firstpass
* small cleanups of unused variables in firstpass
  * node_resources_fpu() created to get an approximation of the
    required fpu registers
  * for the moment use node_complexity in the CG until the
    node_resource_int() is created

git-svn-id: trunk@8655 -
2007-09-26 21:12:01 +00:00
florian
bd4bb505b3 * put Charlie's writeln debugger between DEBUG_CHARLIE conditional compilation symbols
git-svn-id: trunk@8503 -
2007-09-16 11:43:04 +00:00
florian
abfdda6129 * small m68k cleanups
git-svn-id: trunk@8500 -
2007-09-16 10:21:17 +00:00
Károly Balogh
0c6f533ba3 + made m68k compiler to compile again
git-svn-id: trunk@8467 -
2007-09-13 22:30:27 +00:00
yury
3b7e458f02 * Properly set location of float return value if it is passed as var parameter (it is always happens for safecall functions). It fixes bugs #8523 and #8977.
+ test.

git-svn-id: trunk@7728 -
2007-06-18 23:23:46 +00:00
daniel
182fca72f2 * Change spill_* routines to return Taicpu instead of Tai to increase
strong typing.
  * Fix PowerPC R0 register allocation

git-svn-id: trunk@7317 -
2007-05-12 15:43:16 +00:00
Jonas Maebe
e815b923d5 * a_loadfpu_* gets two size parameters: fromsize and tosize
* fixed downsizing the precision of floating point values
  * floating point constants are now treated using only the minimal
    precision required (e.g. 2.0 is now a single, 1.1 extended etc)
    (Delphi compatible)

git-svn-id: trunk@5927 -
2007-01-12 18:33:51 +00:00
Jonas Maebe
1d96dcc50d * renamed nf_swaped to nf_swapped
git-svn-id: trunk@5818 -
2007-01-05 12:47:22 +00:00
florian
d1b6522866 * fixed pushing of parameters on m68k
git-svn-id: trunk@5800 -
2007-01-03 21:46:49 +00:00
pierre
8bd9d88641 * remove C like code to be able to compile unit
git-svn-id: trunk@5794 -
2007-01-02 23:30:23 +00:00
Károly Balogh
abcf865224 + more a_param_* implemented
git-svn-id: trunk@5792 -
2007-01-02 22:11:52 +00:00
Jonas Maebe
a23fa2e81e * moved (unfinished) routines related to writing taicpu's to ppu files
from x86/aasmcpu to aasmtai and (new) aasmsym, so that when they're
    finished they're available for all targets
  * added dummy implementation of tai_cpu_abstract.pass1 and pass2 so there
    are no more hundreds of warnings on non-x86 about constructing taicpu
    instances with abstract methods

git-svn-id: trunk@5787 -
2007-01-02 18:28:05 +00:00
Károly Balogh
e5249a8b56 + some messy m68k changes (first attempt to implement a_param_*)
git-svn-id: trunk@5782 -
2007-01-02 00:11:52 +00:00
Károly Balogh
f4b44b8a97 + unbroke m68k-amiga syscalls
git-svn-id: trunk@5586 -
2006-12-13 20:19:43 +00:00
florian
6d2e5027b3 * preserve opsize
git-svn-id: trunk@5555 -
2006-12-07 20:42:59 +00:00
Károly Balogh
d6844efccc + fixed dbra errors
git-svn-id: trunk@5544 -
2006-12-05 19:03:20 +00:00
Jonas Maebe
05a07a7dd2 * better fix for previous revision
* also applied to x86 and m68k

git-svn-id: trunk@5512 -
2006-11-30 20:55:32 +00:00
Károly Balogh
119cdbb772 - fixed bra #.label assembler errors hopefully
git-svn-id: trunk@5492 -
2006-11-26 16:19:54 +00:00
florian
ab919747a6 * several m68k fixes
* push_value_para partially cleaned up

git-svn-id: trunk@5435 -
2006-11-20 22:13:49 +00:00
florian
2b7fb31a9e * return float values in fpu registers only in non emulation mode
git-svn-id: trunk@5429 -
2006-11-19 22:25:23 +00:00
peter
0557ddc342 * removed typed const, it is now handled by staticvarsym
* globalvarsym renamed to staticvarsym
  * fixed invalid regvar use in init when the finalize also uses the var

git-svn-id: trunk@5290 -
2006-11-08 21:04:22 +00:00
florian
4cbb67aa00 * some fpu emulation code from arm to generic code generator moved
* several m68k fixes

git-svn-id: trunk@5218 -
2006-11-04 10:23:35 +00:00
peter
4ea7562084 * compile fix
git-svn-id: trunk@5216 -
2006-11-04 00:31:39 +00:00
peter
658c46b903 * remove tdictionary and tindexarray
* symtables based on TFPHashObjectList and TFPObjectList
  * rename torddef.typ to torddef.ordtype
  * rename tfloatdef.typ to tfloatdef.floattype
  * rename tdef.deftype to tdef.typ
  * remove obsolete browser code, browcol is kept so the ide
    can still be compiled

git-svn-id: trunk@5192 -
2006-11-03 00:30:30 +00:00
peter
9eb07499bf * fix non-x86 for iasmop
git-svn-id: trunk@5151 -
2006-11-01 16:23:43 +00:00
peter
cb246eb781 * Remove dos,strings units, use SysUtils instead
* replace split* functions with Extract* functions
  * Add Directory caching

git-svn-id: trunk@5102 -
2006-10-30 23:29:35 +00:00
florian
85d63d9fa9 * settings refactored
git-svn-id: trunk@5094 -
2006-10-30 18:02:58 +00:00
peter
3078a1927f * remove ttype
* rename old ttype variables *type to *def
  * rename resulttypepass to pass_typecheck
  * rename pass_2 to pass_generate_code

git-svn-id: trunk@5077 -
2006-10-29 22:19:39 +00:00
florian
2a54d957b2 * fixed two small errors
* supported_optimizerswitches now takes generic flags also into account

git-svn-id: trunk@4865 -
2006-10-11 21:14:47 +00:00
florian
a61abb25cb * reorganized optimizer switch sets
git-svn-id: trunk@4862 -
2006-10-11 18:16:10 +00:00
Jonas Maebe
90cacb4cf5 * changed result type of dwarf_reg from byte to shortint to avoid
warning about comparison which can never be true

git-svn-id: trunk@4183 -
2006-07-14 17:25:16 +00:00
peter
0ec2921bbe * split newasmsymbol to refasmsymbol and defineasmsymbol
git-svn-id: trunk@3057 -
2006-03-27 11:45:18 +00:00
peter
870be04a3f * use dwarf_reg()
git-svn-id: trunk@3046 -
2006-03-26 20:15:32 +00:00
peter
37c81492ad Merged revisions 2827,2831,2837,2932-2980 via svnmerge from
svn+ssh://peter@www.freepascal.org/FPC/svn/fpc/branches/linker/compiler

r2827 (peter)
  * smartlinking of resourcestrings


r2831 (peter)
  * process_ea 64bit fixes


r2837 (peter)
  * linker script

git-svn-id: trunk@2981 -
2006-03-19 22:12:52 +00:00
Jonas Maebe
8a6ebdf274 - disabled loop unrolling for level 3 optimizations since it only causes
crashes (and even if it didn't, on its own it mainly causes code
    bloat)

git-svn-id: trunk@2941 -
2006-03-17 17:42:39 +00:00
peter
b7fe6797bf Merged revisions 2921-2922,2925 via svnmerge from
http://svn.freepascal.org/svn/fpc/branches/linker/compiler

........
r2921 | peter | 2006-03-15 08:35:00 +0100 (Wed, 15 Mar 2006) | 2 lines

  * pass ObjectWriter to ObjectOuput

........
r2922 | peter | 2006-03-15 12:40:30 +0100 (Wed, 15 Mar 2006) | 2 lines

  * refactor asmdata

........
r2925 | peter | 2006-03-15 16:09:39 +0100 (Wed, 15 Mar 2006) | 3 lines

  * add cfi to asmdata
  * move asmlist, asmcfi, asmdata to own unit

........

git-svn-id: trunk@2932 -
2006-03-16 08:52:22 +00:00
peter
588cccb3ca * remove some obsolete i386 specific code
* use a_optimize_const to remove useless opcodes

git-svn-id: trunk@2910 -
2006-03-13 16:37:08 +00:00
peter
d8dc5679e3 * aktcputype and aktoptimizecputype was missing in the previous optimization commits
git-svn-id: trunk@2907 -
2006-03-13 12:29:56 +00:00
peter
2888a21593 * list supported optimization options in -i
* support $OPTIMIZATION and $O+

git-svn-id: trunk@2904 -
2006-03-13 11:17:56 +00:00
peter
b6e35a200e * rewrite of optimizer options
git-svn-id: trunk@2901 -
2006-03-13 09:05:50 +00:00
Károly Balogh
314e1672b7 + fixed m68k for latest changes
git-svn-id: trunk@2834 -
2006-03-10 14:23:08 +00:00
Károly Balogh
3b2fe2b622 * some more tiny m68k hacks...
git-svn-id: trunk@2804 -
2006-03-07 23:01:55 +00:00
Károly Balogh
e785aee0a1 + added ifndef NOTARGETAMIGA
git-svn-id: trunk@2404 -
2006-02-02 11:55:33 +00:00
peter
54d4e9e4b9 * palmos patch from mazen
git-svn-id: trunk@2400 -
2006-02-02 07:12:43 +00:00
Károly Balogh
a9dbab1035 - tiny bits of mess cleanup
git-svn-id: trunk@2399 -
2006-02-02 00:11:49 +00:00
florian
2c1e796f1f * fixed regallocator for m68k
git-svn-id: trunk@2395 -
2006-02-01 20:26:28 +00:00
Károly Balogh
9a879981ed * even more m68k mess
a tiny fix, and some code from ppc cg, to serve as base

git-svn-id: trunk@2391 -
2006-02-01 15:19:58 +00:00
Károly Balogh
37024dc4d0 + more m68k mess... ignore :)
git-svn-id: trunk@2384 -
2006-01-31 16:58:50 +00:00
Károly Balogh
8d8e9b8806 + more 68k mess, committed to transfer between dev machines, ignore
git-svn-id: trunk@2382 -
2006-01-31 01:39:24 +00:00
Károly Balogh
db07870443 totally messy m68k changes. cleanup in progress
git-svn-id: trunk@2352 -
2006-01-27 14:20:35 +00:00
peter
47c1bb60b4 * remove svn:executable from *.pp and *.pas
git-svn-id: trunk@1997 -
2005-12-20 08:11:59 +00:00
Károly Balogh
739ae4c254 + 1st attempt to have explicit funcretloc for Amiga/m68k
git-svn-id: trunk@1978 -
2005-12-18 03:58:27 +00:00
Károly Balogh
12b1ff0df2 + added n68kcal.pas, forgot to add previously
git-svn-id: trunk@1977 -
2005-12-17 16:44:31 +00:00
Károly Balogh
238964e443 Various m68k fixes/additions:
- fixes in asmreader, basic stuff works again, the rest is untested
  - removed lot of unnecessary ungetcpuregister()s
  - various other fixes i forgot
  + basic amigaos syscalls support. still lacks explicit funcretloc

git-svn-id: trunk@1943 -
2005-12-13 20:42:15 +00:00
florian
d7a5ca107b * fixed m68k compilation while sitting bored in the train
git-svn-id: trunk@1823 -
2005-11-25 23:08:46 +00:00
peter
1f8c074ab4 * make m68k compile
git-svn-id: trunk@1138 -
2005-09-19 11:46:23 +00:00
peter
a3ab2053c9 * support multiple asmlabel types, renamed getlabel to
getjumplabel and added type para to getlabel for specific types
  * moved lineinfo generation from assemble and aggas to dbgstabs

git-svn-id: trunk@1120 -
2005-09-18 21:16:10 +00:00
florian
804207239d *c <int64>:=-<longint> fixed (bug 4253)
git-svn-id: trunk@796 -
2005-08-05 19:00:30 +00:00
Károly Balogh
bbfea4d03f an attempt to fix a bit more stuff in m68k
git-svn-id: trunk@794 -
2005-08-04 21:28:25 +00:00
Károly Balogh
e7b1c386b7 some dirty 68k changes/experiments...
git-svn-id: trunk@792 -
2005-08-04 20:00:20 +00:00
Jonas Maebe
8bc4e0a32f * inline and compilerproc are now procoptions instead of proccall types
(so both can be combined with each other, as well as with other calling
     conventions)
  * defined COMPPROCINLINEFIXED so SYSTEMINLINE is again activated

git-svn-id: trunk@658 -
2005-07-18 15:27:14 +00:00
peter
4ace790492 * remove $Log
git-svn-id: trunk@231 -
2005-06-07 09:47:55 +00:00
Károly Balogh
94281c5589 few fixes and advancements. 68k cg now compiles empty system unit without crashing.
git-svn-id: trunk@224 -
2005-06-05 23:36:35 +00:00
Károly Balogh
62121a9029 made m68k to compile again
git-svn-id: trunk@212 -
2005-06-05 13:07:13 +00:00
fpc
790a4fe2d3 * log and id tags removed
git-svn-id: trunk@42 -
2005-05-21 09:42:41 +00:00
fpc
50778076c3 initial import
git-svn-id: trunk@1 -
2005-05-16 18:37:41 +00:00
peter
e417e34496 * truncate log 2005-02-14 17:13:06 +00:00
peter
35e466d971 * remove copy_value_on_stack and a_param_copy_ref 2005-01-20 17:47:01 +00:00
peter
04c97cc129 * load jmp_buf_size from system unit 2005-01-20 16:38:45 +00:00
Károly Balogh
6bae9c8f6d * made m68k to compile again 2005-01-08 04:10:36 +00:00
florian
54ceea9e60 * some m68k stuff updated 2004-11-27 16:16:02 +00:00
peter
6c9c4c686c * small m68k updates to bring it up2date
* give better error for external local variable
2004-11-09 22:32:59 +00:00
peter
c95a859f0a * generic tlocation
* move tlocation to cgutils
2004-10-31 21:45:02 +00:00
peter
66df745917 * small regvar for para fixes
* function tvarsym.is_regvar added
  * tvarsym.getvaluesize removed, use getsize instead
2004-10-11 15:48:15 +00:00
peter
65c3ba277c * ungetregister is now only used for cpuregisters, renamed to
ungetcpuregister
  * renamed (get|unget)explicitregister(s) to ..cpuregister
  * removed location-release/reference_release
2004-09-25 14:23:54 +00:00
florian
8a9758c5e2 * logs truncated 2004-06-20 08:55:28 +00:00
florian
e9bb27df36 * spilling of doubles on sparc fixed 2004-06-20 08:47:33 +00:00
florian
588e2c38bf * dwarf branch merged 2004-06-16 20:07:06 +00:00
florian
b5bf8cefad + <pointer> - <pointer> result is divided by the pointer element size now
this is delphi compatible as well as resulting in the expected result for p1+(p2-p1)
2004-05-20 21:54:33 +00:00
Károly Balogh
5b31a1c142 * added some basic code for later syscall support on M68k/Amiga 2004-05-12 13:28:01 +00:00
florian
2555cc8496 * register numbers for address registers fixed 2004-05-06 22:01:54 +00:00
florian
5168141540 * m68k compiler compilation fixed 2004-05-06 20:30:51 +00:00
florian
71f80e8bef * continued to fix m68k compiler compilation 2004-05-01 23:29:01 +00:00
florian
c68ea95074 + syscall directive support for MorphOS added 2004-04-28 15:19:03 +00:00
florian
c63660d3b9 * several updates for compilation 2004-04-27 15:46:01 +00:00
florian
842754a456 - removed offsetfixup reference 2004-04-27 15:00:37 +00:00
florian
9706934fdc * fixed using new reg. tables 2004-04-27 13:54:10 +00:00
florian
9e26b177e6 * initial revision 2004-04-27 05:43:42 +00:00
florian
b19572b41d + gas registers 2004-04-26 11:05:14 +00:00
florian
1f18d7ac1b * some m68k stuff fixed 2004-04-25 21:26:16 +00:00
florian
e750e24f3b * fixed compilation 2004-04-19 21:15:12 +00:00
florian
a702d678aa * more adaptions for m68k 2004-04-18 21:13:59 +00:00
olle
4fecc1a56f * big transformation of Tai_[const_]Symbol.Create[data]name* 2004-03-02 00:36:32 +00:00
peter
ecfbbeffc3 * renamed xNNbittype to xNNinttype
* renamed registers32 to registersint
  * replace some s32bit,u32bit with torddef([su]inttype).def.typ
2004-02-03 22:32:53 +00:00
florian
b80d10cb70 * fixed some m68k compilation problems 2004-01-30 12:17:18 +00:00
Károly Balogh
eec59028e3 * m68k register tables 2003-12-10 02:39:33 +00:00
Károly Balogh
4050f10698 * initial revision 2003-12-10 02:30:58 +00:00
florian
bbf7300a0c * Florian's culmutative nr. 1; contains:
- invalid calling conventions for a certain cpu are rejected
    - arm softfloat calling conventions
    - -Sp for cpu dependend code generation
    - several arm fixes
    - remaining code for value open array paras on heap
2003-11-07 15:58:32 +00:00
Jonas Maebe
4f8c390198 * fixed regvars so they work with newra (at least for ppc)
* fixed some volatile register bugs
  + -dnotranslation option for -dnewra, which causes the registers not to
    be translated from virtual to normal registers. Requires support in
    the assembler writer as well, which is only implemented in aggas/
    agppcgas currently
2003-08-17 16:59:20 +00:00
Jonas Maebe
404d344d92 * lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
    processor dependent
2003-06-17 16:34:44 +00:00
Jonas Maebe
d29c96896f * fixed newra cycle for x86
* added constants for indicating source and destination operands of the
    "move reg,reg" instruction to aasmcpu (and use those in rgobj)
2003-06-14 14:53:50 +00:00
Jonas Maebe
edb2179730 + added freeintparaloc
* ppc get/freeintparaloc now check whether the parameter regs are
    properly allocated/deallocated (and get an extra list para)
  * ppc a_call_* now internalerrors if pi_do_call is not yet set
  * fixed lot of missing pi_do_call's
2003-06-07 18:57:04 +00:00
daniel
41e0bc4cec * Register allocator finished 2003-06-03 13:01:59 +00:00
peter
60978ba89c * aktprocdef renamed to current_procdef
* procinfo renamed to current_procinfo
  * procinfo will now be stored in current_module so it can be
    cleaned up properly
  * gen_main_procsym changed to create_main_proc and release_main_proc
    to also generate a tprocinfo structure
  * fixed unit implicit initfinal
2003-04-27 11:21:32 +00:00
peter
72ad478f97 * fix compile for ppc,sparc,m68k 2003-04-23 21:10:54 +00:00
peter
2bb32541be * fix m68k compile 2003-04-23 13:40:33 +00:00
florian
0284016ee9 * fixed several issues with powerpc
+ applied a patch from Jonas for nested function calls (PowerPC only)
  * ...
2003-04-23 12:35:34 +00:00
daniel
25059e21b6 + Implemented the actual register allocator
+ Scratch registers unavailable when new register allocator used
  + maybe_save/maybe_restore unavailable when new register allocator used
2003-04-22 10:09:34 +00:00
daniel
86bcea6ef5 * Code generator converted to new register notation
- Horribily outdated todo.txt removed
2003-02-19 22:00:14 +00:00
carl
236a807071 * bugfix of emissions of jmp instructions 2003-02-15 22:19:40 +00:00
carl
3c97889b0f * some small m68k bugfixes 2003-02-12 22:11:13 +00:00
carl
59d3edeec7 * Several bugfixes for m68k target (register alloc., opcode emission)
+ VIS target
  + Generic add more complete (still not verified)
2003-02-02 19:25:54 +00:00
daniel
6e507ba483 * Added register conversion 2003-01-09 15:49:56 +00:00
daniel
55a161bbbf * Tregister changed into a record 2003-01-08 18:43:56 +00:00
florian
b59b436130 * x86-64 compiles
+ very basic support for float128 type (x86-64 only)
2003-01-05 13:36:53 +00:00
carl
3214bab118 * maxoperands -> max_operands (for portability in rautils.pas)
* fix some range-check errors with loadconst
  + add ncgadd unit to m68k
  * some bugfix of a_param_reg with LOC_CREFERENCE
2002-12-14 15:02:03 +00:00
florian
121ca40b39 * some variant <-> dyn. array stuff 2002-12-05 14:27:25 +00:00
carl
6413a958a5 * rename an error message 2002-12-01 22:12:36 +00:00
carl
62e2cd1c67 * merges from Pierre's fixes in m68k fixes branch 2002-11-30 23:33:02 +00:00
peter
f3fc72095f * splitted defbase in defutil,symutil,defcmp
* merged isconvertable and is_equal into compare_defs(_ext)
  * made operator search faster by walking the list only once
2002-11-25 17:43:16 +00:00
peter
a496dbe1ff * pass proccalloption to ret_in_xxx and push_xxx functions 2002-11-18 17:31:54 +00:00
mazen
a835405a27 * fixed a compilation bug accmulator-->accumulator, in definition of return_result_reg 2002-11-17 18:26:15 +00:00
mazen
41153e2b1a + return_result_reg and function_result_reg are now used, in all plateforms, to pass functions result between called function and its caller. See the explanation of each one 2002-11-17 17:49:08 +00:00
carl
3e7b597352 + update for compilation 2002-11-09 16:10:35 +00:00
carl
de26052432 + flag_2_cond implemented 2002-10-14 16:32:36 +00:00
carl
4be0f8c217 + a_call_reg 2002-09-22 14:15:31 +00:00
Jonas Maebe
a15d8cfe39 * a_load_reg_reg() now has two size parameters: source and dest. This
allows some optimizations on architectures that don't encode the
    register size in the register name.
2002-09-17 18:54:01 +00:00
carl
6e30bbfd42 + a_call_reg 2002-09-08 15:12:45 +00:00
carl
752beef0dd * cardinal -> longword 2002-09-07 20:40:23 +00:00
peter
dcd9e0107c * old logs removed and tabs fixed 2002-09-07 15:25:00 +00:00
daniel
fff92ef11e * Fixed PowerPC & M68000 compilation 2002-09-03 19:04:18 +00:00
peter
4b81e16fe2 * tempgen cleanup
* tt_noreuse temp type added that will be used in genentrycode
2002-08-23 16:14:48 +00:00
carl
63ed5b6f99 - remove some unused files in m68k directory 2002-08-19 18:19:06 +00:00
carl
ed77671a9b + optimize64_op_const_reg implemented (optimizes 64-bit constant opcodes)
* more fixes to m68k for 64-bit operations
2002-08-19 18:17:47 +00:00
florian
41eda73784 * fixed compilation problems 2002-08-18 09:02:12 +00:00
florian
e313bab4ff * first part of procinfo rewrite 2002-08-17 09:23:33 +00:00
carl
745efb2c47 * issameref() to test if two references are the same (then emit no opcodes)
+ ret_in_reg to replace ret_in_acc
    (fix some register allocation bugs at the same time)
  + save_std_register now has an extra parameter which is the
    usedinproc registers
2002-08-16 14:24:57 +00:00
carl
588abc6631 * jmpbuf size allocation for exceptions is now cpu specific (as it should)
* more generic nodes for maths
  * several fixes for better m68k support
2002-08-15 15:15:55 +00:00
carl
c33d99adb7 - a_load_sym_ofs_reg removed
* loadvmt now calls loadaddr_ref_reg instead
2002-08-15 08:13:54 +00:00
carl
b0bf9a2512 * fix small compilation problem 2002-08-14 19:31:26 +00:00
carl
7866026667 + m68k type conversion nodes
+ started some mathematical nodes
  * out of bound references should now be handled correctly
2002-08-14 19:16:34 +00:00
Jonas Maebe
3ab3c91e0a - remove valuelow/valuehigh fields from tlocation, because they depend
on the endianess of the host operating system -> difficult to get
    right. Use lo/hi(location.valueqword) instead (remember to use
    valueqword and not value!!)
2002-08-14 18:41:47 +00:00
florian
af4302bc67 * more fixes for ppc calling conventions 2002-08-13 21:40:55 +00:00
carl
654ddac250 + m68k problems with cvs fixed?()! 2002-08-13 18:58:54 +00:00
carl
1edae761ef + m68k problems with cvs fixed?()! 2002-08-13 18:51:29 +00:00
carl
77346f3219 * rename swatoperands to swapoperands
+ m68k first compilable version (still needs a lot of testing):
      assembler generator, system information , inline
      assembler reader.
2002-08-13 18:45:32 +00:00
carl
a86c9a1c12 * rename swatoperands to swapoperands
+ m68k first compilable version (still needs a lot of testing):
      assembler generator, system information , inline
      assembler reader.
2002-08-13 18:30:22 +00:00
carl
c68b2dfbee * rename swatoperands to swapoperands
+ m68k first compilable version (still needs a lot of testing):
      assembler generator, system information , inline
      assembler reader.
2002-08-13 18:01:50 +00:00
carl
b0cb623e27 - removed and renamed 2002-08-13 17:35:10 +00:00
carl
9da171faf2 + stab register indexes for powerpc (moved from gdb to cpubase)
+ tprocessor enumeration moved to cpuinfo
  + linker in target_info is now a class
  * many many updates for m68k (will soon start to compile)
  - removed some ifdef or correct them for correct cpu
2002-08-12 15:08:39 +00:00
peter
425bb45ddc * renamed current_library to objectlibrary 2002-08-11 14:32:25 +00:00
peter
ac71268ce6 * saving of asmsymbols in ppu supported
* asmsymbollist global is removed and moved into a new class
    tasmlibrarydata that will hold the info of a .a file which
    corresponds with a single module. Added librarydata to tmodule
    to keep the library info stored for the module. In the future the
    objectfiles will also be stored to the tasmlibrarydata class
  * all getlabel/newasmsymbol and friends are moved to the new class
2002-08-11 13:24:10 +00:00
carl
a4d74cfd17 + try to commit this ** file again 2002-08-11 08:06:09 +00:00
carl
f94cec7ddb - removed unused m68k stuff 2002-08-09 19:21:50 +00:00
carl
f46268dbf6 + more m68k fixes 2002-08-06 15:14:30 +00:00
carl
834283b0ba + updated m68k 2002-08-05 17:26:09 +00:00
carl
5c6c9c0499 - remove no longer used files 2002-08-05 17:20:59 +00:00
carl
3034065498 + restart m68k support 2002-07-29 17:51:32 +00:00
carl
21b3a10f02 + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
+ try to fix temp allocation (still in ifdef)
+ generic constructor calls
+ start of tassembler / tmodulebase class cleanup
2002-05-16 19:46:34 +00:00
carl
9b12acc70a * renamed some constants 2002-04-20 21:38:45 +00:00
florian
ac4bbd85f0 * renamed 2000-11-30 22:41:55 +00:00
florian
d1f882fd59 * moved to m68k 2000-11-30 22:22:50 +00:00
peter
d93a445b58 * moved into m68k subdir 2000-11-30 20:30:33 +00:00
michael
e7aca136a1 + Initial import 2000-07-13 06:29:38 +00:00
peter
e525797c51 * updated copyright to 2000 2000-01-07 01:14:18 +00:00
florian
a0badc3a30 * initial revision 1999-09-17 09:59:19 +00:00
florian
fbbf8a505c * m68k compiler is again compilable (only gas writer, no assembler reader) 1999-09-16 23:05:51 +00:00