Commit Graph

295 Commits

Author SHA1 Message Date
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