Commit Graph

806 Commits

Author SHA1 Message Date
Károly Balogh
10fa12bbae m68k: take rounding requirements into account in a_loadfpu_reg_reg and a_loadfpu_ref_reg
git-svn-id: trunk@48414 -
2021-01-25 00:27:59 +00:00
Károly Balogh
da1746426b m68k: do not optimize away fmove fpureg0, intreg0; fmove intreg0; fpureg0; constructs, they're used for rounding to single on FPUs with no resultprecision encoding
git-svn-id: trunk@48413 -
2021-01-25 00:12:53 +00:00
pierre
4111e13017 Avoid inlining of real constant for m68k if type is not best precision
git-svn-id: trunk@48224 -
2021-01-19 22:33:32 +00:00
Károly Balogh
6190258f5d m68k: new CPU capability - the LINK instruction supports LONG displacements (68020+)
git-svn-id: trunk@47849 -
2020-12-26 00:21:31 +00:00
Károly Balogh
16a21eea87 m68k: the LEA+MOVEM to MOVEM optimization is not feasible on a ColdFire
git-svn-id: trunk@47847 -
2020-12-25 09:07:21 +00:00
florian
0ab69ea0ad + m68k: LEA, MOVE(M) to MOVE(M) predecremented optimization and MOVE(M), LEA to MOVE(M) postincremented optimization
git-svn-id: trunk@47762 -
2020-12-11 22:14:17 +00:00
florian
a0a8a6911a * m68k: proper values for first_*_reg
git-svn-id: trunk@47761 -
2020-12-11 22:14:16 +00:00
florian
817ef6949a * m68k: MOVE, TST, Jxx/Sxx to MOVE, Jxx optimization
git-svn-id: trunk@47751 -
2020-12-10 21:51:26 +00:00
florian
bb8c3fd153 * made optimization JSR, RTS to JMP more bullet proof, added comment
git-svn-id: trunk@47750 -
2020-12-10 21:09:20 +00:00
Károly Balogh
7f96a26de0 m68k: in g_concatcopy, check the actual alignment of references being copied rather than always excluding word and dword sized direct copies on a 68000
git-svn-id: trunk@47744 -
2020-12-10 04:17:06 +00:00
florian
a849e51a3c + m68k: JSR, RTS to JMP optimization
git-svn-id: trunk@47740 -
2020-12-09 20:57:06 +00:00
florian
fbb2e63fea + #QLvember work: stack frame optimization for m68k
git-svn-id: trunk@47629 -
2020-11-29 10:16:00 +00:00
florian
5ca2356638 * take care of po_noreturn in more cases
git-svn-id: trunk@47623 -
2020-11-28 16:02:51 +00:00
Károly Balogh
7444733f5d m68k: fix DB/DW/DD handling in inline assembler, update BuildConstant() method to current standards. issue reported/initial patch by Marcel Kilgus in QLForum.co.uk
git-svn-id: trunk@47548 -
2020-11-24 05:42:38 +00:00
Károly Balogh
e5d2c1a980 m68k: fixed parsing of constants to absolute addresses
git-svn-id: trunk@47419 -
2020-11-15 03:55:42 +00:00
Károly Balogh
a82a587a1b m68k: fixed parsing of absolute addresses in the assembler reader
git-svn-id: trunk@47418 -
2020-11-15 03:43:26 +00:00
Károly Balogh
53928dc0ed m68k: fix references like <symbol>(An) to parse properly in the assembler reader
git-svn-id: trunk@47356 -
2020-11-08 23:56:00 +00:00
Károly Balogh
eda7d535bd * m68k: enabled vasm assembler support for the Sinclair QL, and added linking
git-svn-id: trunk@47312 -
2020-11-04 21:01:34 +00:00
Károly Balogh
519701960c m68k: initial commit to add the Sinclair QL as a compiler target
git-svn-id: trunk@47307 -
2020-11-04 14:20:28 +00:00
Károly Balogh
9d425ff4ca m68k: change the stack push order in the register calling convention to left-to-right. This should fix parameter handling in nested procedures (tnest5)
git-svn-id: trunk@47279 -
2020-11-02 02:01:24 +00:00
Károly Balogh
55d4ffa9de m68k: add missing FINT and FINTRZ instructions to spilling_get_operation_type()
git-svn-id: trunk@47266 -
2020-10-31 21:57:59 +00:00
florian
637976e83f * patch by Marģers to unify internal error numbers, resolves #37888
git-svn-id: trunk@47103 -
2020-10-13 19:59:01 +00:00
Károly Balogh
de180d7656 * m68k: fix index register usage in memory references, when the index is 8 or 16 bit wide and unsigned
git-svn-id: trunk@46886 -
2020-09-17 20:51:25 +00:00
florian
f798141d30 * simplified code
git-svn-id: trunk@46333 -
2020-08-08 14:48:24 +00:00
florian
995d2d280a - no need to call add_move_instruction if data is moved between different register classes
git-svn-id: trunk@46332 -
2020-08-08 14:48:24 +00:00
florian
e2bf83b573 * do not spill_replace if the register is used another time in the instruction
git-svn-id: trunk@46331 -
2020-08-08 14:48:23 +00:00
Károly Balogh
f20c76d73b m68k: fixed a long standing issue, where FPU registers would be clamped to single precision during spilling
git-svn-id: trunk@46307 -
2020-08-07 07:54:26 +00:00
florian
28f25b2df0 * reworked usage of tcgnotnode.handle_locjump
git-svn-id: trunk@46275 -
2020-08-05 21:15:32 +00:00
Jonas Maebe
eb7ba1690e * mark all external assemblers using an LLVM tool using af_llvm
+ added support for constructing target triplets
  * pass "-target triplet" when using an LLVM assembler
   o removed no longer needed $DARWINVERSION and $ARCH parameters
  * consistently use as_clang_gas when clang is used to assembler GAS-style
    assembly, and rename as_llcm_clang to as_clang_llvm (for consistency)
  * support pipe assembling when using clang on *nix in all cases

git-svn-id: trunk@45807 -
2020-07-19 14:30:35 +00:00
Jonas Maebe
e7d1a77f9a * rename the ARM/AArch64-Darwin targets to ARM/AArch64-iOS
* rename the m68k/PowerPC-MacOS targets to m68k/PowerPC-MacOSClassic
  * repurpose the AArch64/Darwin target for AArch64/macOS
   o make AArch64-Darwin default target for a hosted AArch64-Darwin compiler

git-svn-id: trunk@45758 -
2020-07-10 21:52:24 +00:00
Károly Balogh
58af742f3a m68k: atari syscalls might also destroy D2 and A2
git-svn-id: trunk@45469 -
2020-05-23 11:13:07 +00:00
Károly Balogh
c38efe6d18 m68k: tabs to spaces and indentation fix, no functional change
git-svn-id: trunk@45389 -
2020-05-16 19:15:52 +00:00
Károly Balogh
2c8db3bb9e m68k: add support for bitfield instructions as CPU capability
git-svn-id: trunk@45383 -
2020-05-16 13:47:18 +00:00
Károly Balogh
04a42bef84 m68k: fixed instruction code formatting in the generated include
git-svn-id: trunk@45314 -
2020-05-08 21:06:59 +00:00
Károly Balogh
6753f86987 m68k: migrate the compiler to the new instruction tables and drop the old ones
git-svn-id: trunk@45312 -
2020-05-08 12:33:04 +00:00
Károly Balogh
bc9b8af04b m68k: add the converted includes, based on m68kins.dat
git-svn-id: trunk@45311 -
2020-05-08 12:11:13 +00:00
Károly Balogh
d5874b0088 m68k: added a full instruction table (minus CF MAC/EMAC instructions for now), based on vasm, and the required tool to process it
git-svn-id: trunk@45310 -
2020-05-08 12:05:11 +00:00
Károly Balogh
fc5c35362b m68k: preparations for upcoming full instruction tables, mostly converting code away from using sets of opcodes
git-svn-id: trunk@45307 -
2020-05-07 23:30:13 +00:00
Károly Balogh
89d9679b53 m68k: have an arch-specific second_length implementation, to make sure length() doesn't return its result in an address register
git-svn-id: trunk@45201 -
2020-05-01 12:06:43 +00:00
nickysn
a8fe46c0f5 + introduced labelmaxlen in tasminfo and added code in ReplaceForbiddenAsmSymbolChars that limits the
output label to that length

git-svn-id: branches/z80@45066 -
2020-04-25 12:59:25 +00:00
Károly Balogh
56ad37133e m68k-amiga: hack to avoid a linker (vlink) warning about merging sections with different flags together. Amiga doesn't support true read only sections anyway
git-svn-id: trunk@44757 -
2020-04-17 23:09:16 +00:00
Jonas Maebe
592df7fa59 * disable cs_opt_regvar on all platforms when compiled for LLVM (LLVM does
that itself, our LLVM code generator can't handle it, and if it did then
    afterwards we would have to spill 90% of those register variables again
    to make them SSA)

git-svn-id: trunk@44062 -
2020-01-29 22:21:07 +00:00
florian
b7c6e01b03 * cleaning up tcgsize: it makes no sense to declare every combination and type
the different vector types must be either handled in the high level cg or
    by using the shuffle parameter

git-svn-id: trunk@43860 -
2020-01-04 21:54:53 +00:00
Jonas Maebe
1e3f72403e * renamed getintparaloc to getcgtempparaloc
o it can be used for more than integer parameters

git-svn-id: trunk@43781 -
2019-12-24 22:12:25 +00:00
florian
e1e8986462 * patch by J. Gareth Moreton, issue #36271, part 3: support for the other architectures
git-svn-id: trunk@43441 -
2019-11-10 16:11:40 +00:00
pierre
7d12e8cc6d Avoid warnings for m68k compiler
git-svn-id: trunk@43391 -
2019-11-05 10:00:48 +00:00
pierre
1bed61195e Fix m68k errors with -CriotR option
git-svn-id: trunk@43165 -
2019-10-10 21:57:07 +00:00
Károly Balogh
eb71d11b99 m68k: also handle OS_64 register sizes in cgsize2subreg
git-svn-id: trunk@43045 -
2019-09-20 13:48:30 +00:00
Károly Balogh
435b57bdb1 m68k: allow vecnode to use word size index registers
git-svn-id: trunk@43044 -
2019-09-20 11:37:18 +00:00
Károly Balogh
19a6964088 m68k: add subregisters. on 68k, these are not as universal as on x86 and work differently, but the compiler needs this infrastructure to do 16bit math (which is a massive improvement on '000) or word-size indexes on CPUs which support it
git-svn-id: trunk@43043 -
2019-09-20 11:35:35 +00:00
Károly Balogh
aea0f3e667 m68k: build fix (premature commits are the root of all evil too)
git-svn-id: trunk@42966 -
2019-09-09 07:47:34 +00:00
Károly Balogh
d25820b830 m68k: added CPUM68K_HAS_BYTEWORDMATH and CPUM68K_HAS_INDEXWORD capabilities
git-svn-id: trunk@42964 -
2019-09-08 22:43:34 +00:00
Károly Balogh
353fc13257 m68k: cleanup of the ancient mess from cgsize2subreg
git-svn-id: trunk@42949 -
2019-09-08 13:55:19 +00:00
Károly Balogh
fa1203029f m68k: use cpu_capabilities when deciding to inject scaling into a ref. also allow scaling in more cases.
git-svn-id: trunk@42947 -
2019-09-08 13:37:22 +00:00
Károly Balogh
50fe8f70f5 m68k: make sure we're not trying to allocate a subregister for float paras when R_SUBWHOLE <> R_SUBNONE
git-svn-id: trunk@42946 -
2019-09-08 13:34:39 +00:00
Károly Balogh
16fc8c8d9a m68k: added some handling for the explicit precision FPU instructions in the spilling and optimizer. fixed a_fsabs and a_fdabs names
git-svn-id: trunk@42943 -
2019-09-08 09:21:17 +00:00
Károly Balogh
fd1d227175 m68k: more refactoring for fpu_capabilities instead of hardwired fpu types. 68040 and 68060 fpu types should now work
git-svn-id: trunk@42929 -
2019-09-06 07:56:06 +00:00
Károly Balogh
db2875ceba m68k: added the remaining instructions with explicit rounding precision. fixed fsflmul to be fsglmul (this is also typo in the original 68k PRM)
git-svn-id: trunk@42928 -
2019-09-06 07:25:45 +00:00
Károly Balogh
2a87b885b1 m68k: added the most important FPU instructions with explicit rounding precision (eg. FSADD/FDADD)
git-svn-id: trunk@42927 -
2019-09-05 21:51:36 +00:00
Károly Balogh
5eee29e5d1 m68k: refactor some code to not fail when the tasmop set will be bigger than 256 elements
git-svn-id: trunk@42926 -
2019-09-05 21:49:27 +00:00
Károly Balogh
de095c4631 m68k: refactoring to use fpu_capabilities at more places instead of hardwiring certain fpu types
git-svn-id: trunk@42925 -
2019-09-05 21:43:51 +00:00
Károly Balogh
36286441b2 m68k: try to optimize realconst operands into B/W/L sized integer operands. these are shorter to encode - which almost always means faster on m68k
git-svn-id: trunk@42923 -
2019-09-05 19:32:57 +00:00
florian
69786ffe73 somehow committing went wrong, second part of last commit:
+ AArch64: support for vX.8b/vX.16b register names
+ support for more than 256 registers in the register dat files
- removed totherregisterset
+ AArch64: use vmov to load immediates if possible
+ AArch64: use eor to clear mm registers

git-svn-id: trunk@42917 -
2019-09-03 21:07:33 +00:00
Károly Balogh
0ef47f6426 m68k: tabs 2 spaces, no functional changes
git-svn-id: trunk@42829 -
2019-08-26 13:08:39 +00:00
Károly Balogh
d29f44e1c7 m68k: rework of the inline nodes to use fpu_capabilities. added fast path for round/trunc (enabled for fastmath only)
git-svn-id: trunk@42814 -
2019-08-25 12:12:15 +00:00
Károly Balogh
3662afe93b m68k: added more cpu capabilities. changed the CG at a few places to actually use them
git-svn-id: trunk@42763 -
2019-08-22 15:38:08 +00:00
Károly Balogh
4936358bee m68k: fpu capabilities support
git-svn-id: trunk@42739 -
2019-08-19 15:07:22 +00:00
Károly Balogh
90bab63e51 m68k/vasm: remove bits of Linux support. this combination has never really been tested or supported, and got broken recently. m68k-elf-linux has good enough GNU binutils anyway
git-svn-id: trunk@42597 -
2019-08-07 09:04:57 +00:00
Jonas Maebe
ce598c15ec * factored out the conditions under which add nodes need to perform
overflow checks
   o in particular ensure that cpu-specific overrides don't perform overflow
     checks when nf_internal is set

git-svn-id: trunk@42573 -
2019-08-03 12:19:50 +00:00
Jonas Maebe
3fee990218 * on Mach-O, PECOFF and ELF platforms, write local symbols as hidden/
private_extern (or plain global in case of PECOFF, as the effect is
    the same there): visible across object files, but they become local
    when linked into a binary/library. This enables cross-unit inlining
    of functions accessig implementation-only symbols.

git-svn-id: trunk@42340 -
2019-07-07 21:33:43 +00:00
pierre
828a248287 Systematically include fpcdefs.inc at sart of all units used by compiler
git-svn-id: trunk@42322 -
2019-07-03 13:35:05 +00:00
Jonas Maebe
a0e35fd1bc * synchronised with trunk till r42118
git-svn-id: branches/debug_eh@42119 -
2019-05-25 13:19:06 +00:00
Jonas Maebe
77658b925b * disable regular array -> dynamic array type coversion support unless
{$modeswitch arraytodynarray} is active (mantis #35576)
   o changed compiler to compile without this modeswitch
   o added the modeswitch to a test that depends on it

git-svn-id: trunk@42118 -
2019-05-25 12:31:32 +00:00
Jonas Maebe
a7bd37d17a * synchronised with trunk till r40776
git-svn-id: branches/debug_eh@41867 -
2019-04-13 15:16:09 +00:00
Károly Balogh
5358851f84 * clean up some things regarding explicit paraloc handling. this should fix m68k-amiga and powerpc-morphos builds after r41716
git-svn-id: trunk@41730 -
2019-03-18 01:19:18 +00:00
Jonas Maebe
ac883969a9 * synchronised with trunk till r41423
git-svn-id: branches/debug_eh@41424 -
2019-02-23 17:08:03 +00:00
Jonas Maebe
8b9e90dc7a * keep track of whether a routine has a C-style variadic parameter in the
procoptions even when it's through an array-of-const parameter
  * always call create_varargs_paraloc_info() instead of create_paraloc_info()
    in the former case, even when no varargs parameters are specified (because
    on some platforms even some non-variadic parameters need to be passed
    differently, such as on ARM with gnueabihf)

git-svn-id: trunk@41420 -
2019-02-23 15:42:45 +00:00
Jonas Maebe
882d676bc9 * synchronised with trunk till r40635
git-svn-id: branches/debug_eh@40636 -
2018-12-24 22:12:19 +00:00
Jonas Maebe
acf02ab64b * when creating wrappers, add a prefix to parameter names to prevent them
hiding the method name of the wrapped routine
   o also add a few more '&' prefixes to the generated wrapper code to
     prevent issues when keywords are used as identifiers

git-svn-id: trunk@40634 -
2018-12-24 22:10:06 +00:00
Jonas Maebe
9630eb7ce9 * synchronised with trunk till r40466
git-svn-id: branches/debug_eh@40467 -
2018-12-04 19:54:31 +00:00
Jonas Maebe
122d0d36d6 + volatile() expression that marks an expression as volatile
* disable matching volatile references in the assembler optimisers, so they
    can't be removed (more conservative than needed, but better than removing
    too many)
   o the CSE optimiser will ignore them by default, because they're an unknown
     inline node for it
  * also removed no longer used fpc_in_move_x and fpc_in_fillchar_x inline node
    identifiers from rtl/inc/innr.inc, and placed fpc_in_unaligned_x at the
    right place

git-svn-id: trunk@40465 -
2018-12-04 19:53:20 +00:00
Károly Balogh
6629e72d79 m68k: reinstate the inc/dec tempregister type hack again in an isolated way (it was removed in r40385, as it was breaking llvm target)
git-svn-id: trunk@40453 -
2018-12-02 18:54:04 +00:00
Jonas Maebe
4cd6f59bc3 * changed create_hlcodegen into a procvar, so that we don't have to insert
hlcgllvm in the uses clause of every unit that calls create_hlcodegen
   o prevents dependency cycles that can cause llvm codegen units to init
     before the cpu variants, which is bad since the llvm versions have to
     override the cpu variants in their init code (+ added checks in the
     init code that they are in fact initialised later)

git-svn-id: branches/debug_eh@40410 -
2018-11-29 21:31:15 +00:00
Jonas Maebe
bfc7c58a69 * synchronised with trunk till r40348
git-svn-id: branches/debug_eh@40349 -
2018-11-18 12:01:50 +00:00
pierre
2761448f44 * Disable range check for m68k/aoptcpu unit
* Add missing change of var parameter p to next instruction
    in TryToOptimizeMove method after instruction removal.

git-svn-id: trunk@40324 -
2018-11-16 10:27:42 +00:00
pierre
53a27fe7b3 Disable range check in m68k:tiscv32 and riscv64 cgcpu units
git-svn-id: trunk@40319 -
2018-11-15 16:58:40 +00:00
florian
9b0ff05ee8 - get rid of MaxOps, it is redundant with max_operands
* MatchOpType with three operands is only available of max_operands>2

git-svn-id: trunk@40190 -
2018-11-02 21:32:29 +00:00
pierre
96460b70b2 Remove another wrong typecast when testing that a tai is an instruction
git-svn-id: trunk@40131 -
2018-11-01 07:01:02 +00:00
pierre
a015c779ff Remove unneeded typecasts in TryTOptimizeMove
git-svn-id: trunk@40123 -
2018-10-31 23:19:39 +00:00
Jonas Maebe
8555ec1438 + fpc_eh_return_data_regno() intrinsic to get the return register numbers
for the Dwarf EH exception handler result

git-svn-id: branches/debug_eh@40070 -
2018-10-28 18:16:38 +00:00
pierre
0bcf9a51d9 Avoid range check error when compiled with -CR
git-svn-id: trunk@40000 -
2018-10-20 18:49:53 +00:00
pierre
3715dbdf41 Avoid run time error if compiled with -CR option
git-svn-id: trunk@39999 -
2018-10-20 18:44:05 +00:00
pierre
92acd38f40 Fix for bug report #34380
git-svn-id: trunk@39986 -
2018-10-18 20:21:54 +00:00
Jonas Maebe
0b246f3dbd * converted Boolean8 to an internal type, and mapped Boolean to the
new internal pasbool1(type) (part of mantis #34411)
   o apply the _Bool x86-64 parameter passing rules only to pasbool1

git-svn-id: trunk@39949 -
2018-10-16 21:14:18 +00:00
Károly Balogh
ddf8788c7a m68k: try to generate better code from some pointermath - when the left is an address register and we do add/sub, also allocate an address register as temp, also only require that left and right sizes are same, when right is not a const
git-svn-id: trunk@39174 -
2018-06-05 16:45:02 +00:00
Jonas Maebe
4686f61002 * keep track of the temp position separately from the offset in references,
so that they can still be freed after the reference has been changed
    (e.g. in case of array indexing or record field accesses) (mantis #33628)

git-svn-id: trunk@38814 -
2018-04-22 17:03:16 +00:00
nickysn
518cdf9674 * replaced the saved_XXX_registers arrays with virtual methods inside
tcpuparamanager, very similar to the existing get_volatile_registers_XXX. The
  new methods are called get_saved_registers_XXX, where XXX is the register
  type ("int", "address", "fpu" or "mm")

git-svn-id: trunk@38794 -
2018-04-19 21:22:16 +00:00
Károly Balogh
66d180187a m68k: fix build after r38206
git-svn-id: trunk@38210 -
2018-02-11 18:20:51 +00:00
Károly Balogh
64e7c90147 m68k: some quickhacks to support PalmOS reg-relative globals and quick-n-dirty small code PIC. needs some cleanup, but the basic idea will be useful a potential for MacOS and Amiga .library support as well, among others
git-svn-id: trunk@37900 -
2018-01-04 08:33:43 +00:00
Károly Balogh
57b2064cdd m68k/palmos: support the prc-tools specific @END hack for globals when writing data symbols
git-svn-id: trunk@37897 -
2018-01-04 07:57:29 +00:00