Commit Graph

370 Commits

Author SHA1 Message Date
nickysn
512ca83f33 - don't allocate/deallocate the fpu registers in tcg.[de]allocallcpuregisters on the i8086
git-svn-id: trunk@24505 -
2013-05-15 08:24:07 +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
florian
1eeeb309c7 * intial armv6m support, it is not working yet, constant pool insertation and conditional branch fixup is not working yet
git-svn-id: trunk@23682 -
2013-03-03 12:20:10 +00:00
paul
5d74e0578a compiler: remove unused variables and unneeded assignments
git-svn-id: trunk@23467 -
2013-01-21 01:24:36 +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
pierre
d8c2930454 Also accept R_ADDRESSREGISTER in a_load_cgparaloc_anyreg method
git-svn-id: trunk@22763 -
2012-10-19 11:55:39 +00:00
florian
2e7fe1aebd * support of avx register requires now proper usage of R_SUBMMWHOLE
git-svn-id: trunk@22574 -
2012-10-07 18:47:17 +00:00
florian
ca5fabda6d * cleanup some unused units from uses clauses
git-svn-id: trunk@22433 -
2012-09-21 18:53:46 +00:00
florian
67744ef46e * fix methodpointers in registers on big endian targets
git-svn-id: trunk@22362 -
2012-09-09 17:54:35 +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
Jonas Maebe
be8f8fec76 * converted tcg.g_releasevaluepara_openarray() to thlcg
git-svn-id: trunk@21879 -
2012-07-11 15:23:18 +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
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
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
f2c82e32cd - removed g_indirect_sym_load() from hlcgobj/hlcg2ll because this cgobj
method is only used anymore internally in cgobj.tcg and its descendants
  * made tcg.g_indirect_sym_load() protected to ensure it stays that way

git-svn-id: trunk@21392 -
2012-05-26 11:32:33 +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
641b259aed * adjusted thlcg.g_rangecheck() implementation so it can be used for all
targets and removed (the almost identical) tcg.g_rangecheck()

git-svn-id: trunk@21262 -
2012-05-08 20:02:36 +00:00
Jonas Maebe
003a30db6b - reverted r21246, it breaks tcalext3/5 on x86
git-svn-id: trunk@21258 -
2012-05-08 17:17:01 +00:00
Jonas Maebe
9568693664 * removed superfluous sign extension from a_load_subsetreg_reg() (the value
is already sign extended at that point if required)

git-svn-id: trunk@21246 -
2012-05-06 14:50:38 +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
sergei
5f93d9992a * Ignore FPU/MM registers in tcg.(de)allocallcpuregisters if they are not used in current procedure. This is consistent with logic of tcgcallnode and removes a lot of useless xmm regallocs on win64.
git-svn-id: trunk@21036 -
2012-04-25 15:42:50 +00:00
Jonas Maebe
b512744bfb * don't overwrite the reg to load in a parameter in tcg.a_load_reg_cgpara()
if the value has to be shifted first (it could be a regvar)
  * also take the cgpara's shiftval into account when loading a constant

git-svn-id: trunk@20961 -
2012-04-21 20:17:35 +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
dc70db9402 * parameter passing support for AIX:
o the last bytes of records passed by value whose size is not a multiple
     of the register size must be passed in the upper (leftmost) bytes of
     a register

git-svn-id: trunk@20804 -
2012-04-11 18:02:13 +00:00
Jonas Maebe
260958eb45 * changed last parameter of g_indirect_sym_load() to a set and also
pass on whether the symbol refers to code or data (important for
    AIX weak symbols; note that AIX does not support undefined weak
    external symbols, and FPC does not yet support weakly defining
    non-external symbols, so this functionality isn't really used yet)

git-svn-id: trunk@20802 -
2012-04-11 18:02:03 +00:00
Jonas Maebe
dabcfc2806 + LOC_(C)LOC_SUBSETREF/G support for tcg.a_loadmm_loc_reg()
git-svn-id: trunk@20663 -
2012-03-29 20:54:42 +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
8c9ad67682 + tcgexitnode,tcgbreaknode,tcgcontinuenode: added possibility to generate specialized code for leaving unwind-protected regions.
git-svn-id: trunk@19636 -
2011-11-14 22:47:37 +00:00
sergei
a32fdc3ae6 + Added a simple helper tcg.g_call, intended to replace allocallcpuregisters+a_call_name+deallocallcpuregisters sequence which is used all over the place.
* Refactored code generation for tcgonnonde and tcgtryexceptnode, simplifying both compiler and generated code. Merged compilerprocs called in sequence into larger ones (fpc_popobjectstack+fpc_destroyexception -> fpc_doneexception, fpc_popsecondobjectstack+fpc_destroyexception+fpc_reraise -> fpc_raise_nested).

git-svn-id: trunk@19506 -
2011-10-18 15:46:15 +00:00
sergei
6e23565edf + Initialize/finalize variants using dedicated helpers, produces both smaller (no RTTI loading necessary) and faster (direct path taken) code.
git-svn-id: trunk@19442 -
2011-10-09 20:34:58 +00:00
florian
4868b09844 * patch by alexvin to replace $ifopt by $push/$pop, resolves #20332
git-svn-id: trunk@19239 -
2011-09-25 21:19:50 +00:00
florian
6d996bf832 * made a_call_ref of PowerPC generic, we need to allocate a register after all on risc platforms
git-svn-id: trunk@18962 -
2011-09-03 20:37:53 +00:00
Jonas Maebe
7f22a2f223 + support for range checking calculations with hlcgobj
* added runerror number to JVM FpcRunTimeError exceptions
  * enabled calling errorproc when a run time error occurs on the
    JVM target

git-svn-id: branches/jvmbackend@18749 -
2011-08-20 08:32:31 +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
florian
fb84cb865b * rebase to trunk@17295
git-svn-id: branches/avr@17296 -
2011-04-10 19:20:48 +00:00
florian
8cfbb70326 + generic a_cmp_const_reg_label
git-svn-id: branches/avr@17294 -
2011-04-10 18:52:37 +00:00
sergei
7f62d5cfb0 * tcg.g_array_rtti_helper: if high-value is a constant, handle it without using a register.
* Now g_initialize, g_finalize, g_incrrefcount and g_decrrefcount should never more be used for open arrays, trigger internal error if it happens.

git-svn-id: trunk@17137 -
2011-03-15 09:30:55 +00:00
sergei
37d5a6c354 * tcg.g_array_rtti_helper(): When converting 'high' to 'length', use an intermediate register to do the increment, so that the original value of 'high' parameter is preserved regardless of platform and optimization settings. Should fix regressions introduced by r17068.
git-svn-id: trunk@17071 -
2011-03-04 17:00:47 +00:00
sergei
54bc8efa0b * Fixed reference counting of open array parameters passed by value. RTTI of the array itself is useless in this case, as it does not provide correct element count. Now using dedicated helpers which take RTTI of array element and the element count. Resolves #18859.
git-svn-id: trunk@17068 -
2011-03-03 18:38:46 +00:00
florian
726b24c591 * (d)allocallcpuregisters must not handle fpu registers on avr
git-svn-id: branches/avr@17025 -
2011-02-26 20:59:09 +00:00
florian
26fbfaf5a7 + introduce the usage of asizeint/asizeuint for cpus with sizeof("alu")<>sizeof(pointer)
git-svn-id: trunk@17011 -
2011-02-26 20:10:03 +00:00
paul
dad8313512 compiler: handle dispinterfaces the same way as com interfaces because they are IDispatch descendants: increment/decrement they references in assignments and parameters passing by _AddRef, _Release
git-svn-id: trunk@16755 -
2011-01-13 03:38:45 +00:00
florian
5dae691c96 * implementation of bit scan intrinsics by Richard Vida, resolves #17592
git-svn-id: trunk@16174 -
2010-10-16 15:03:30 +00:00
mazen
b127fc154a * Fixed spell error revealed by lintian.
git-svn-id: trunk@16094 -
2010-10-06 20:33:57 +00:00
Jonas Maebe
8b0301409a + i386/iphonesim target for the new iPhoneSimulator in Xcode 3.2.4 and
later: the same as i386/darwin, except
      a) uses the non-fragile Objective-C ABI/runtime
      b) does not require stubs for direct calls/jumps (not required for
         i386/darwin under 10.6 and later either, but still generated
         there for backwards compatibility)
      c) only the same packages are enabled as for ARM/Darwin
      d) MacOSAll is compiled specifically for the iPhoneSimulator SDK
    This target also defines the symbol "darwin" apart from the target
    name "iphonesim" for source code compatibility reasons.

git-svn-id: trunk@16065 -
2010-09-29 21:56:47 +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