Commit Graph

234 Commits

Author SHA1 Message Date
Jonas Maebe
5c75b6dd6b * synchronised with trunk up till r28402
git-svn-id: branches/hlcgllvm@28403 -
2014-08-13 16:04:30 +00:00
sergei
9b9ea15d68 + m68k: initial implementation of do_spill_replace (supports only MOVE instructions for now). Tested with qemu for Coldfire target.
git-svn-id: trunk@28274 -
2014-07-30 01:20:59 +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
Jonas Maebe
246caf3526 * never alias/coalesce cpu registers that are not usable by the register
allocator (such as stack/framepointers) with virtual registers, otherwise
    they can get changed in case the virtual register gets changed (read-only
    use would be ok, but we don't keep track of which virtual registers are
    only read

git-svn-id: trunk@27104 -
2014-03-11 23:18:45 +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
florian
23c724f885 * prevent a temp. register allocated during spilling being immediately spilled again, resolves #25164
git-svn-id: trunk@26930 -
2014-03-02 19:47:05 +00:00
florian
829764e96b + replace registers to spill in mov instructions and convert them into ldr/str
git-svn-id: trunk@26677 -
2014-02-05 18:19:41 +00:00
Károly Balogh
587acf6452 fix infinite spilling on m68k, patch by Florian, additional IE workaround by me, based on a similar hack in the ARM cg...
git-svn-id: trunk@26465 -
2014-01-15 02:09:02 +00:00
Károly Balogh
70f9b098e0 no longer define a segment field for m68k
git-svn-id: trunk@26464 -
2014-01-15 02:06:10 +00:00
sergei
d2a9308181 + SPARC: implemented register spill replacement.
git-svn-id: trunk@26364 -
2014-01-03 08:14:43 +00:00
Jonas Maebe
b7803ab974 + llvm support for the register allocator. While llvm works with virtual
registers itself, it requires them to be in SSA form. Therefore we
    spill all registers that are written more than once to memory.
  + support in the generic register allocator for generating code that is
    SSA-safe
  + spilling helpers for llvm

git-svn-id: branches/hlcgllvm@26044 -
2013-11-11 11:15:47 +00:00
Jonas Maebe
5ef93e85b8 + added extra "orgsupreg" parameter to do_spill_read/do_spill_written/
do_spill_replace routines, will be necessary by llvm register
    allocator to determine the tdef corresponding to that register
  * replaced uses of taicpu with tai_cpu_abstract_sym in the register
    allocator so that it can work both with taicpu and taillvm instructions

git-svn-id: branches/hlcgllvm@26043 -
2013-11-11 11:15:43 +00:00
Jonas Maebe
5599870a4e * moved the register colouring and spill temp allocation to a virtual method,
and made the related data structures protected instead of private, so they
    can be overridden

git-svn-id: branches/hlcgllvm@26042 -
2013-11-11 11:15:38 +00:00
svenbarth
32a18199c5 Print aX or aregX for address registers if DEBUG_REGISTERLIFE is defined.
rgobj.pas, trgobj.generate_interference_graph:
  * pass "regtype" instead of "R_INTREGISTER" to newreg so that "aX" or "aregX" is print for address registers

git-svn-id: trunk@25665 -
2013-10-05 21:48:28 +00:00
florian
dc567acc9a * accumulate register weight instead of taking only the maximum
git-svn-id: trunk@25433 -
2013-09-07 17:44:41 +00:00
florian
c2f7ccb253 * coalesce more aggressive
git-svn-id: trunk@25177 -
2013-07-26 19:06:20 +00:00
sergei
8b8553991a + MIPS: prevent coalescing written-to registers with $sp,$fp,$zero and $at.
+ Implemented subset of "spill replace" functionality, replacing moves from/to spilled registers with loads/stores to spill locations. This helps to reduce amount of instructions.

git-svn-id: trunk@24900 -
2013-06-15 04:04:08 +00:00
florian
23c84fd27c * more fixes for segment register usage
git-svn-id: trunk@24584 -
2013-05-24 19:02:09 +00:00
florian
b85addb451 + color segment register
git-svn-id: trunk@24579 -
2013-05-24 17:57:28 +00:00
svenbarth
d15304c25e Also check for the type of the register when replacing it. In certain circumstances this can still lead to access to invalid memory resulting either in an access violation or invalid registers.
git-svn-id: trunk@22779 -
2012-10-19 19:35:45 +00:00
pierre
322b793506 Try to do something for m68k integer/address registers; not working yet :!(
git-svn-id: trunk@22771 -
2012-10-19 15:52:57 +00:00
svenbarth
2ada9a528b Fix a critical bug in the register allocator (at least for CPUs with seperate address
registers like the M68k): check whether the register type of the base/index register
of the instruction's reference is the same as the one we are doing register allocation
for. Otherwise the address registers can become corrupted.

git-svn-id: trunk@22748 -
2012-10-18 20:12:24 +00:00
florian
95830d5a4a + DEBUG_REGISTERLIFE define
git-svn-id: trunk@22396 -
2012-09-15 17:20:57 +00:00
florian
f75e39e660 + aliasing of registers, allows to split live ranges
git-svn-id: trunk@22395 -
2012-09-15 17:20:53 +00:00
florian
f9dd5bf5e6 + live_start and live_end_properties
git-svn-id: trunk@22109 -
2012-08-17 19:35:51 +00:00
florian
c2d067940a * get rid of hash chars, modern tools and IDEs can use normal comments as documentation if needed
git-svn-id: trunk@22108 -
2012-08-17 19:35:46 +00:00
florian
b78f9826fb * call AllocMem instead of GetMem/FillChar
git-svn-id: trunk@22095 -
2012-08-15 17:47:15 +00:00
florian
ecdec2e431 * disable reg. allocator optimization introduced in r21812 for now because it caused some trouble, see #22405
git-svn-id: trunk@22036 -
2012-08-08 16:29:03 +00:00
masta
f9cdf3d4ca Be more specific in spilling debug messages
Output "Spilling: " instead of "XXX: " in front of spilling debug
messages. This makes the output easier to process.

git-svn-id: trunk@21890 -
2012-07-12 01:11:29 +00:00
masta
aef81cad68 Add debug information about register spilling
If DEBUG_SPILLING is defined we'll output "XXX: Spill read/write".

git-svn-id: trunk@21816 -
2012-07-08 09:24:14 +00:00
florian
9833f642fe * coalesce if either u or v are precolored, tested on arm and i386, it gives for both a small advantage
git-svn-id: trunk@21812 -
2012-07-07 21:20:26 +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
6f336a5d13 * the register allocator always knows the exact number of the first imaginary
supreg of the current register type, so use that rather than the maximum of
    all possible register types

git-svn-id: trunk@21623 -
2012-06-15 18:24:30 +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
florian
6211a83865 * write variable locations of 64 bit integer values on 32 bit targets correctly
* when transforming imag. register variable locations into real ones, take care of the register type

git-svn-id: trunk@18958 -
2011-09-03 19:43:50 +00:00
Jonas Maebe
00cb8f5725 * made maxregs related information protected instead of private in trgobj,
as well as insert_regalloc_info_all()
  + "register" allocator for the jvm target, which simply replaces every
    virtual register with a temp. This is done for all register types in
    one pass, so that the temps can be easily reused without worrying
    about conflicts. Small optimisation: alloc/store/dealloc/load
    sequences for a single reg are removed (many of these are generated
    because most cg nodes return their value in a register which is then
    immediately consumed by the parent)
  * map addressregisters to integer registers with size R_SUBD, because
    they require one stackslot (the subregister type is used by rgcpu
    to determine the size of the temp it has to allocate)

git-svn-id: branches/jvmbackend@18316 -
2011-08-20 07:38:11 +00:00
florian
68dd23b5a2 * write proper register locations when doing ssa, resolves #7552
git-svn-id: trunk@18278 -
2011-08-19 22:06:52 +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
22b4860dd7 * getregisterinline() can be used to replace multiple size variants
of the same register (or of a register and its aliases) -> make
    sure that all relevant constraints are applied to it as well
    (mantis #16980)

git-svn-id: trunk@15952 -
2010-09-08 21:13:02 +00:00
Jonas Maebe
b475d03612 * changed backwards_was_first and extended_backwards from supregsets into
tbitsets so that they can grow as necessary and so that we don't have
    to fill the entire 8KiB all the time

git-svn-id: trunk@15604 -
2010-07-18 22:00:55 +00:00
Jonas Maebe
8be466546a * disabled superfluous zeroing of another field
git-svn-id: trunk@15529 -
2010-07-05 21:35:47 +00:00
Jonas Maebe
fb65172a5a * commented out a number of superfluous zero-initialisations of (large)
class instance fields
  * changed a number of for-loop iteration variables from tsuperregister
    (= word) into cardinal

git-svn-id: trunk@15519 -
2010-07-03 13:09:58 +00:00
Jonas Maebe
d1538ab023 o added ARM VPFv2/VFPv3 support:
+ RTL support:
      o VFP exceptions are disabled by default on Darwin,
        because they cause kernel panics on iPhoneOS 2.2.1 at least
      o all denormals are truncated to 0 on Darwin, because disabling
        that also causes kernel panics on iPhoneOS 2.2.1 (probably
        because otherwise denormals can also cause exceptions)
    * set softfloat rounding mode correctly for non-wince/darwin/vfp
      targets
    + compiler support: only half the number of single precision
      registers is available due to limitations of the register
      allocator
    + added a number of comments about why the stackframe on ARM is
      set up the way it is by the compiler
    + added regtype and subregtype info to regsets, because they're
      also used for VFP registers (+ support in assembler reader)
    + various generic support routines for dealing with floating point
      values located in integer registers that have to be transferred to
      mm registers (needed for VFP)
    * renamed use_sse() to use_vectorfpu() and also use it for
      ARM/vfp support
    o only superficially tested for Linux (compiler compiled with -Cpvfpv6
      -Cfvfpv2 works on a Cortex-A8, no testsuite run performed -- at least
      the fpu exception handler still needs to be implemented), Darwin has
      been tested more thoroughly
  + added ARMv6 cpu type and made it default for Darwin/ARM
  + ARMv6+ implementations of atomic operations using ldrex/strex
  * don't use r9 on Darwin/ARM, as it's reserved under certain
    circumstances (don't know yet which ones)
  * changed C-test object files for ARM/Darwin to ARMv6 versions
  * check in assembler reader that regsets are not empty, because
    instructions with a regset operand have undefined behaviour in that
    case
  * fixed resultdef of tarmtypeconvnode.first_int_to_real in case of
    int64->single type conversion
  * fixed constant pool locations in case 64 bit constants are generated,
    and/or when vfp instructions with limited reach are present

  WARNING: when using VFP on an ARMv6 or later cpu, you *must* compile all
    code with -Cparmv6 (or higher), or you will get crashes. The reason is
    that storing/restoring multiple VFP registers must happen using
    different instructions on pre/post-ARMv6.

git-svn-id: trunk@14317 -
2009-12-03 22:46:30 +00:00
Jonas Maebe
93523c7767 * fixed for overflow in sort_movelist (by Paul Ishenin, mantis #15204), and
made a similar change in sort_simplify_worklist

git-svn-id: trunk@14296 -
2009-12-03 11:07:37 +00:00
florian
0c8546f94c * more MIPS code of David Zhang integrated
git-svn-id: trunk@14228 -
2009-11-20 14:46:45 +00:00
Jonas Maebe
718694d1d6 * always specify an explicit alignment for tgobj.gettemp (so e.g.
shortstring temps don't get maximum alignment)
  * changed some gettemptyed() calls into gettemp() calls (gettemptyped
    means that this temp can only be used for temps of that type,
    which is necessary for refcounted types but not for floats)

git-svn-id: trunk@12036 -
2008-11-08 22:20:47 +00:00
yury
0bcaf8845f * Fixed 'mixed signed/unsigned' warnings.
* Suppressed 2 unreachable code warnings.
* Now x86 compiler compiles without warnings and notes! It will be great to keep such state in future...

git-svn-id: trunk@11455 -
2008-07-23 13:16:46 +00:00
yury
cf7390ea81 * Fixed 'mixed signed/unsigned' and pointer conversion warnings.
git-svn-id: trunk@11439 -
2008-07-23 09:36:07 +00:00
peter
6744b747b8 * remove goto, that prevents optimizations
git-svn-id: trunk@10083 -
2008-01-28 18:13:32 +00:00
Jonas Maebe
8d9bfcaa7d * fixed memory corruption in trgobj.add_to_movelist on 64 bit platforms
git-svn-id: trunk@9523 -
2007-12-25 23:39:28 +00:00