Commit Graph

637 Commits

Author SHA1 Message Date
Jonas Maebe
bc3d495285 * extra error checking in gen_load_cgpara_loc
git-svn-id: trunk@29824 -
2015-02-23 22:47:59 +00:00
Jonas Maebe
b8c8ef8489 * support transfering a cgpara that is stored in multiple paralocs into a
single register, by first storing everything consecutively to memory and
    then loading it. Required for "homogeneous float aggregates" on AArch64

git-svn-id: trunk@29815 -
2015-02-23 22:47:32 +00:00
pierre
9b468ba728 Change code so that the condition to use global or local symbol matches
the code written in hlcg.gen_proc_symbol to avoid change from AB_LOCAL
to AB_GLOBAL, which generates erroneous code (at least for targets using GOT)

git-svn-id: trunk@29450 -
2015-01-12 12:24:15 +00:00
florian
6e671e2e85 * gen_load_cgpara_loc with OS_(S)32 for 8 bit ALUs fixed
git-svn-id: trunk@28746 -
2014-10-04 18:28:21 +00:00
Jonas Maebe
b745dcc64c * moved g_external_wrapper() to the hlcg, and also g_intf_wrapper() because
for some platforms it depends on that routine

git-svn-id: branches/hlcgllvm@28492 -
2014-08-19 20:22:54 +00:00
Jonas Maebe
a637fbe596 * moved all g_exception_*() methods to hlcgobj and cleaned them up (no more
hardcoded registers for the most part)
  + added extra g_exception_discard_reason() that can be called when we only
    want to get rid of the currently pushed exception reason, and don't have
    to load it (so it can do nothing on platforms that don't use push/pop)

git-svn-id: branches/hlcgllvm@28481 -
2014-08-19 20:22:24 +00:00
Jonas Maebe
9a683a0288 * converted new_exception to hlcgobj
o also gets rid of the ifdefs

git-svn-id: branches/hlcgllvm@28377 -
2014-08-10 19:40:32 +00:00
Jonas Maebe
6e1d370417 * split off the texceptaddr declaration into rtl/inc/excepth.inc, so it can
be included at the start of the implementation of the system unit (before
    the rest of except.inc)
  * catch declarations in/loading from the system unit of the TExceptAddr type
  * use this type instead of hardcoded size constants in the compiler
  * in generic code that is active for all targets, puts its use in a virtual
    method since it's only valid for targets using setjmp/longjmp-style
    exception handling (and the record is not defined at all in the JVM RTL)

git-svn-id: branches/hlcgllvm@28376 -
2014-08-10 19:40:29 +00:00
Jonas Maebe
142d5d6d06 - removed get_jumpbuf_size/align, use rec_jmp_buf instead
git-svn-id: branches/hlcgllvm@28371 -
2014-08-10 19:40:16 +00:00
Jonas Maebe
7949bebb8d * synchronised with r28168 of trunk
git-svn-id: branches/hlcgllvm@28169 -
2014-07-05 21:30:28 +00:00
sergei
53b0ef1f61 - Removed superfluous tai_align, the new_section procedure creates one itself.
git-svn-id: trunk@28027 -
2014-06-21 22:36:17 +00:00
Jonas Maebe
bacd303208 * synchronized with trunk up to r27758
git-svn-id: branches/hlcgllvm@27779 -
2014-05-12 16:12:34 +00:00
nickysn
9da1ee0138 * i8086 far data model fixes in the copying of openarray value params
git-svn-id: trunk@27470 -
2014-04-04 20:18:47 +00:00
nickysn
36aae69e2b + initialize the initialloc for push_addr_param parameters correctly in i8086
far data memory models

git-svn-id: trunk@27455 -
2014-04-03 17:24:41 +00:00
nickysn
cf1d60b8eb + added size info to the 'Var X located at' comment generated in the asm output
git-svn-id: trunk@27454 -
2014-04-03 16:54:01 +00:00
nickysn
66d7beb7fe * i8086 far data memory model fix for except_buf_size
git-svn-id: trunk@27371 -
2014-03-30 12:00:20 +00:00
nickysn
5ae9443d66 * moved the EXCEPT_BUF_SIZE const to be local to ncgutils.get_exception_temps,
because that's the only place where it's used

git-svn-id: trunk@27369 -
2014-03-30 11:27:07 +00:00
florian
a4b6e99db1 * increase refs of hidden high parameter if the corresponding open/const array is used
git-svn-id: trunk@27331 -
2014-03-29 13:10:54 +00:00
nickysn
891ab86254 * fixed ncgutil.gen_load_vmt_register and tcgloadvmtaddrnode.pass_generate_code
for i8086 far data memory models by using the high level code generator

git-svn-id: trunk@27326 -
2014-03-28 23:16:14 +00:00
nickysn
149db35910 * i8086 far data memory model fix in ncgutil.new_exception
git-svn-id: trunk@27242 -
2014-03-23 18:11:50 +00:00
Jonas Maebe
73a3f5ced4 * moved ncgutil.maybechangeloadnodereg() to hlcg.maybe_change_load_node_reg()
and moved ifdef'd jvm code to overridden method

git-svn-id: trunk@27153 -
2014-03-16 11:24:40 +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
Jonas Maebe
e9268a0a14 * synchronised with trunk up till r26975
git-svn-id: branches/hlcgllvm@26976 -
2014-03-06 21:36:58 +00:00
Jeppe Johansen
2227045e23 Replace forbidden chars in more places in the GAS assembler writer.
Add support for .set and .weak on AVR.
Fix 64 bit negation on AVR.
Add cpu_capabilities to cpuinfo.pas and fixed some peephole optimizations.
Pass >4 byte parameters by reference.

git-svn-id: trunk@26943 -
2014-03-04 08:01:23 +00:00
Jeppe Johansen
66f5b71fe9 Fixed passing of 32bit arguments on 8-bit architectures.
Added initial RTL startup code for AVR.

git-svn-id: trunk@26931 -
2014-03-02 20:53:21 +00:00
sergei
53556f529d * gen_alloc_symtable: don't use current_procinfo.procdef, the necessary procdef is passed in 'pd' parameter.
git-svn-id: trunk@26663 -
2014-02-03 10:21:56 +00:00
sergei
949907f1f3 * Don't emit "Temps allocated between..." comment in assembler listing if procedure has no temps.
git-svn-id: trunk@26660 -
2014-02-03 09:55:46 +00:00
Jonas Maebe
4e9c54278e * the function result of constructors always is self, always is valid and is
not stored in procdef.funcretsym -> fix check so that SSA is not performed
    on it in constructors when exit is used

git-svn-id: trunk@26650 -
2014-02-02 09:09:44 +00:00
florian
e6a9e385d3 * spelling fixed
git-svn-id: trunk@26435 -
2014-01-12 20:17:44 +00:00
nickysn
420f30bacd * fixed the handling of OS_PAIR/OS_SPAIR-sized parameters in ncgutil.gen_load_cgpara_loc. This fixes 32-bit regvar'd parameters on i8086.
git-svn-id: trunk@26278 -
2013-12-24 23:07:44 +00:00
sergei
409e176ded * Factored reusable (SEH-related) piece of code into separate procedure.
git-svn-id: trunk@26157 -
2013-12-01 11:47:12 +00:00
Jonas Maebe
d14ce7817f * factored out setlocalloc and the code to set the initial paravarsym
location from ncgutil into hlcgobj, and override/implement it for llvm
    (use the symbolic parameter names)

git-svn-id: branches/hlcgllvm@26052 -
2013-11-11 11:16:16 +00:00
nickysn
c51c75936b * 16/8-bit ALU fixes in ncgutil.gen_free_symtable
git-svn-id: trunk@25762 -
2013-10-13 16:48:15 +00:00
nickysn
1dabaf5ded * 16/8-bit ALU fixes in ncgutil.add_regvars
git-svn-id: trunk@25761 -
2013-10-13 16:41:32 +00:00
nickysn
d1f0eea902 * 16/8-bit ALU fixes in ncgutil.gen_alloc_regvar
git-svn-id: trunk@25760 -
2013-10-13 16:31:16 +00:00
nickysn
fd05d0c14e * 16/8-bit ALU fix in maybechangeloadnodereg. This fixes the tbopr and trox2
tests on i8086.

git-svn-id: trunk@25752 -
2013-10-13 11:35:56 +00:00
sergei
b8a76c5da2 - Removed gen_proc_symbol procedure, no longer used, replaced by thlcgobj.gen_proc_symbol method.
git-svn-id: trunk@25335 -
2013-08-23 10:54:57 +00:00
sergei
c3350d13f9 * MIPS: floating point parameters on stack should be loaded to/from FPU registers directly, without using temp.
git-svn-id: trunk@25122 -
2013-07-17 11:00:46 +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
Jonas Maebe
5051453806 + support for LOC_(C)MMREGISTER in hlcg
o migrated location_force_mmregister_scalar from ncgutil to hlcgobj

git-svn-id: trunk@24661 -
2013-05-31 12:05:14 +00:00
nickysn
47fe8e03b1 * refactored ncgutil.gen_load_cgpara_loc to use cgpara.locations_count
git-svn-id: trunk@24532 -
2013-05-19 18:49:21 +00:00
nickysn
ecb5a4866d * refactored the int64 result passing in ax:bx:cx:dx to use 4 paralocs, instead of the GetNextReg hack
git-svn-id: trunk@24527 -
2013-05-19 12:50:15 +00:00
florian
d4c7afbfe8 + generate thumb_func directives for thumb as well
git-svn-id: trunk@24377 -
2013-04-29 18:23:01 +00:00
florian
0e41df598e * merge i8086 branch by Nikolay Nikolov
git-svn-id: trunk@24324 -
2013-04-25 20:23:51 +00:00
nickysn
a5c5b05362 * initial support for system procs that use calling conventions that push left to right on i8086 or i386
git-svn-id: branches/i8086@24282 -
2013-04-21 13:26:12 +00:00
sergei
d54d38b4ab * Moved all code responsible for writing VMTs and interface wrappers (nobj.TVMTWriter, ncgutil.gen_intf_wrappers, ptype.write_persistent_type_info) into a new unit ncgvmt.pas.
This improves compiling speed a bit (two iterations over symtables replaced by one, code generator is created once per unit rather than once per class).
In perspective it makes possible to reduce amount of generated smartlink sections and global labels.

git-svn-id: trunk@24269 -
2013-04-19 13:31:27 +00:00
nickysn
3870f76cda * ncgutil: set pushexceptaddr_frametype_cgsize and setjmp_result_cgsize according to cpu16bitaddr, instead of cpu16bitalu
git-svn-id: branches/i8086@24233 -
2013-04-12 13:38:18 +00:00
florian
075abd6220 + support of stackframesize for arm thumb
+ estimatedtempsize to get a good estimatation for architectures which require to know the stack size before

git-svn-id: trunk@24188 -
2013-04-07 21:00:38 +00:00
florian
43b6139b66 + setlocalloc resets currentregloc
git-svn-id: trunk@24118 -
2013-04-01 19:52:46 +00:00
florian
364f170765 * cosmetic formatting changes
git-svn-id: trunk@24117 -
2013-04-01 19:52:43 +00:00
nickysn
1e28790e99 * fpc_PushExceptAddr's parameter Ft changed from LongInt to SmallInt on 16-bit CPUs for better efficiency
git-svn-id: branches/i8086@24036 -
2013-03-28 15:44:50 +00:00
nickysn
f38114b34b * the result of FPC_SETJMP changed to 16-bit int on 16-bit CPUs
git-svn-id: branches/i8086@24001 -
2013-03-25 18:12:18 +00:00
nickysn
8d2b7df6d6 * fixed functions returning longint on i8086
git-svn-id: branches/i8086@23803 -
2013-03-12 13:35:19 +00:00
sergei
5e46732bc8 + One more missing call to unget_para (MIPS-specific)
git-svn-id: trunk@23766 -
2013-03-10 04:08:43 +00:00
sergei
54aefb1ba0 * gen_load_cgpara_loc, MIPS-specific: added missing calls to unget_para, and disabled part that loads upper and lower halves of Double values from integer registers. It produces invalid code, but that's hidden by MIPS code generator copying all parameters to stack (so this code is never executed).
git-svn-id: trunk@23622 -
2013-02-15 22:05:24 +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
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
florian
4f30ac0247 * put records with 16 bytes size into two register on 64 bit targets if possible
* don't put records containing floats into integer registers
* copy&paste error in tcg128.a_load128_const_reg fixed

git-svn-id: trunk@23317 -
2013-01-05 22:58:32 +00:00
florian
c781f21a46 * records with two times the size of a register can be kept in registers
git-svn-id: trunk@23313 -
2013-01-04 21:48:41 +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
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
pierre
be5839e44a Add warning/error message about possible problems with nostackframe modifier
git-svn-id: trunk@22677 -
2012-10-16 22:42:28 +00:00
Jeppe Johansen
8b17a358e4 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: branches/laksen/arm-embedded@22579 -
2012-10-08 00:10:52 +00:00
pierre
4b7a6ecc14 move currentregloc setting to ncgutil to avoid sysym unit ependency in aasmtai unit
git-svn-id: trunk@22513 -
2012-10-02 09:25:49 +00:00
pierre
fcaff0489c * psub.pas : translate tregister for registerhi also
(avoids imaginary register number in "# Var I in register .." assembler comments.
  * dbgdwarf.pas : Support register variables as register pairs.
      Does not yet handle case of changing registers.
  * symsym.pas : add currentregloc field to tabstractnormalvarsym class,
     to be able to track changing registers used for a given variable.
  * aasmtai.pas : Update currentregloc field of tai_varloc.create sym parameter.
  * ncgutil.pas : Only generate a tai_varloc if the new registers are different for the variable.

git-svn-id: trunk@22508 -
2012-10-01 14:21:13 +00:00
Jonas Maebe
944c1172ee * implementation of fix from r22376 without using introspection
git-svn-id: trunk@22446 -
2012-09-23 21:25:39 +00:00
Jonas Maebe
1219797d94 * support LOC_(C)SUBSETREG/REF in gen_load_vmt_register() (mantis #22869)
git-svn-id: trunk@22380 -
2012-09-13 12:35:31 +00:00
pierre
fd844d08e0 Avoid wrong typecast in DoReplace function as revealed by extcycle
git-svn-id: trunk@22376 -
2012-09-12 14:06:48 +00:00
florian
d93cee995b * fix register method pointer for ppc64 and x86_64-linux
git-svn-id: trunk@22351 -
2012-09-07 15:15:10 +00:00
florian
7361e19799 + support for handling OS_128/OS_S128 on 64 Bit CPUs as far as needed for method pointers in registers
git-svn-id: trunk@22344 -
2012-09-06 15:12:12 +00:00
florian
7901662eb3 + mark method pointers as regable
git-svn-id: trunk@22337 -
2012-09-06 15:11:42 +00:00
florian
d8161c185c + track usage of flags by using a new register RS_/NR_DEFAULTFLAGS
git-svn-id: trunk@22179 -
2012-08-22 19:37:51 +00:00
Jonas Maebe
288d1ec74a * support referencing "result" in nostackframe pure assembler routines if
the result location is a simple location (a single register/reference)
    (mantis #22490)
  * print an error when accessing "result" in a nostack pure assembler routine
    if the result location is not simple

git-svn-id: trunk@22166 -
2012-08-21 19:51:40 +00:00
Jonas Maebe
9197ce100e * converted tcg.g_copyvaluepara_openarray() to thlcg
git-svn-id: trunk@21878 -
2012-07-11 15:23:08 +00:00
Jonas Maebe
aba6923187 * moved g_test_self() from cgobj to hlcgobj
git-svn-id: trunk@21861 -
2012-07-11 08:25:51 +00:00
pierre
bc0c94c204 fpcdefs.inc: Set fpc_compiler_has_fixup_jmps for powerpcXX and mips CPUs.
psub.pas: Use new fpc_compiler_has_fixup_jmps conditional.
 mips/aasmcpu.pas: MIPS specific fixup_jmps function,
   The insttruction distance calculation is not exact as
   some pseudo-instruction can be expanded to a variable number of real instructions
   real calculation would only be possible if we first 
   convert pseudo-instuctions to real instructions before calling fixup_jmps.

 ncgutil.pas: Revert commit r21791
 ncgcon.pas: Revert commit r21786
 mips/cgcpu.pas: Partial revert of commit r21798, no need to always use A_J,
 as fixup_jmps now handles out of range branches.

git-svn-id: trunk@21822 -
2012-07-09 08:59:13 +00:00
pierre
b63bc6be13 MIPS: use OC_EQ instead of OC_NE for new_exception to avoid branch out of range error
git-svn-id: trunk@21791 -
2012-07-05 21:04:03 +00:00
Jonas Maebe
7c21cba1e2 * migrated g_copyshortstring, g_incrrefcount and g_array_rtti_helper to thlcg
git-svn-id: trunk@21699 -
2012-06-24 21:36:28 +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
florian
2162df1802 * patch by Jeppe Johansen: fix gen_load_cgpara_loc for mips(el)
git-svn-id: trunk@21417 -
2012-05-28 16:21:30 +00:00
Jonas Maebe
baa8fa39a8 * converted code to trash variables (-gt) to operate at the node tree level,
and also use this code to trash local variables in inlined routines
   o fixes mantis #22088
   o makes it possible to also implement it for the jvm target in the future

git-svn-id: trunk@21393 -
2012-05-26 11:32:39 +00:00
florian
21573f50c5 * allow LOC_CONSTANT to be used as vmt pointers in the cg, resolves #21914
git-svn-id: trunk@21349 -
2012-05-20 19:02:36 +00:00
Jonas Maebe
9d860904fe * merged AIX changes from ncgutil.gen_proc_symbol_end() into
hlcgobj.gen_proc_symbol_end() and removed the routine from ncgutil (it's
    not used anymore)

git-svn-id: trunk@21337 -
2012-05-19 14:39:12 +00:00
florian
6c8eed21c4 + implement auto inlining (-Ooautoinline)
+ implement trashing of local variables if subroutine is inlined
* fix some errors releated to interproc. gotos and inlining
+ node_count function
* inline cannot be used with iochecking and safecall calling conventions
* track inherited usage
* don't inline if inherited is used

git-svn-id: trunk@21335 -
2012-05-19 13:30:02 +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
3ba801d37c * fix loading 64 bit floating point parameters passed half in an integer
register and half on the stack into a VFP register on ARM (mantis
    #21917)

git-svn-id: trunk@21286 -
2012-05-13 12:14:34 +00:00
sergei
3aaa62b2e3 * Removed separate 64-bit specific copy of location_force_reg, reusing part of 32-bit version to handle 64-bit cases. The difference is that the handling of LOC_CREGISTER locations that was previously available only for 32-bit targets is now applied to 64-bit targets too, reducing amount of redundant move instructions.
git-svn-id: trunk@21079 -
2012-04-27 13:15:46 +00:00
Jonas Maebe
834026bfb5 * synchronised with trunk up to r21067
git-svn-id: branches/jvmbackend@21068 -
2012-04-26 21:24:20 +00:00
Jonas Maebe
d7247c9bd9 * prevent duplicate symbol errors when compiling code with debug info
on AIX due to the extra inserted local symbols (although in case e.g
   multiple procedures contain a typed constant with the same name, only
   one can be accessible)
  * removed '.' suffix of local symbols inserted for debug info of typed
    constants for AIX (gdb couldn't find those symbols; it seems the
    address calculated by gdb for typed constants is still not correct
    though)

git-svn-id: trunk@20966 -
2012-04-21 20:18:03 +00:00
Jonas Maebe
b0f32fc5c2 * since we don't check interfaces yet during whole program optimization,
assume that all virtual methods that can be called via interfaces that
    appear in the program are in fact called (fixes WPO when applied to
    MSEIDE)

git-svn-id: trunk@20952 -
2012-04-21 11:00:56 +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
247033cce1 + stabx support for AIX, which is a variant of stabs. Note that we only
support the stabx as understood by gdb, which is a mixture of regular
    stabs and stabx (e.g., class/object definitions are completely different
    in real stabx). This means that gdb can be used to debug aix programs,
    but the native dbx will complain about lots of debug information
    constructs

git-svn-id: trunk@20842 -
2012-04-11 18:06:38 +00:00
Jonas Maebe
481b3d99a9 * just like Darwin and Classic Mac OS, AIX uses the system crt* files and
hence contains a dummy "main" that refers to the system unit
    FPC_SYSTEMMAIN, which in turn jumps to the main program's PASCALMAIN
  * we call FPC_SYSTEMMAIN instead of jumping to it like on Darwin, so that
    the TOC gets set correctly

git-svn-id: trunk@20792 -
2012-04-11 18:00:43 +00:00
Jonas Maebe
39242c2cfa - removed changes from r20660 (ARM hard float patch): ARM VFP regvars are
in LOC_CMMREGISTER, not in LOC_CFPUREGISTER (and they also are there in
    case the softfp calling convention is used), and this change broke SPARC

git-svn-id: trunk@20667 -
2012-03-30 09:52:36 +00:00
Jonas Maebe
6ba8dc7146 + support for the ARM hard float EABI on Linux (patch by Peter Green):
o new eabihf (hard float) abi
   o vfpv3_d16 variant of VFP (default variant used by EABI assemblers: VFPv3
     with only 16 double registers instead of 32) and pass it to GNU as
   o make the odd numbered single precision floating point VFP registers
     available for explicit allocation for use by the calling convention
  * fixed copy/paste error in stdname of S30 register
  -> use -dFPC_ARMHF to create an ARM eabi hard float compiler
  (mantis #21554)

git-svn-id: trunk@20660 -
2012-03-29 20:50:09 +00:00
svenbarth
bd19a16be9 Add support for Default() intrinsic. For now this is only (fully) supported
in code and not in constants. In the case of primitive types constant nodes
are used while complex types like arrays, records and objects use a local
variable which is initialized to zero once at the entry of the method (the
variable is reused if Default() is used for the same type multiple times in
the same method). For this a new compilerproc was added which uses FillChar
to initialize the given memory area to zero.
This fixes Mantis #9420.

+ psystem.pas: Added Default symbol to system unit
+ htypechk.pas: Added function "is_valid_for_default" which checks recursively
                whether the given type can be used with Default at all. 
                Forbidden types are files, helpers, ObjC and C++ types. This
                check is used for records, arrays and objects only if the mode
                is a non-Delphi one, as Delphi ignores these types on lower
                levels.
+ msg/errore.msg: Added error message for unsupported types for Default()
+ symconst.pas: Added a new enum value vo_is_default_var which is used for the
                local variables utilized by Default() so their initalization
                and finalization can be avoided.
+ pexpr.pas: Add handling of Default() intrinsic to "statement_syssym"
+ ninl.pas: Extended tinlinenode by a method which returns the correct node for
            a Default() and used that method in handle_typecheck.
* ncgutil.pas: Check for new flag "vo_is_default_var" when initializing and
               finalizing local variables.
* ppu.pas: increase PPU version
+ psub.pas: 
  * Added a new routine which zeros defaultvars of a symtable.
  * Use this routine inside "initializevars".
  * Also use this routine to initialize the staticsymtable of the unit/program.
* Adjusted ppudump, because of the new enum value.
+ Added implementation of fpc_zeromem to system unit.
+ Added tests for Default()

git-svn-id: trunk@20629 -
2012-03-25 16:02:27 +00:00
sergei
06192a8137 Values of managed variables are never ever used after decrementing reference on the variable, so there is no point of having a 'decrement reference' as a separate operation. We can always do 'finalize', i.e. clear the contents after decref.
* Modified fpc_ansistr_decr_ref and fpc_widestr_decr_ref so they always zero the pointer passed by reference. Other _decr_ref helpers already do it.
- Removed tcg.g_decrrefcount, calling cg.g_finalize instead.
- finalize_data_node and tcg.g_finalize: removed code generation for zeroing locations, because it is now done by RTL helpers. This further reduces code size.

As a total result of this change and r20118, the size of Lazarus executable is reduced by about 12%.

git-svn-id: trunk@20119 -
2012-01-19 23:11:09 +00:00
sergei
cbad0abab5 + Platform-specific exception support for x86_64-win64. Enable by cycling with OPT=-dTEST_WIN64_SEH.
git-svn-id: trunk@20098 -
2012-01-16 23:13:31 +00:00
Jonas Maebe
3b32e6986b * fixed maketojumpbool() for 32 bit targets when used with a
64 bit destination

git-svn-id: trunk@19923 -
2011-12-30 12:12:39 +00:00
pierre
b6de7f0d6b * Suppress Comaprison might be always false if first_mm_imreg is zero
git-svn-id: trunk@19584 -
2011-11-03 10:13:26 +00:00