1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
Commit Graph

6060 Commits

Author SHA1 Message Date
Ted Kremenek
0f3c05d800 Added two new overloaded versions of BatchEmitOwnedPtrs and
BatchReadOwnedPtrs.

llvm-svn: 44105
2007-11-14 08:05:03 +00:00
Evan Cheng
fd33cb316f Clean up sub-register implementation by moving subReg information back to
MachineOperand auxInfo. Previous clunky implementation uses an external map
to track sub-register uses. That works because register allocator uses
a new virtual register for each spilled use. With interval splitting (coming
soon), we may have multiple uses of the same register some of which are
of using different sub-registers from others. It's too fragile to constantly
update the information.

llvm-svn: 44104
2007-11-14 07:59:08 +00:00
Owen Anderson
7b92dab615 Start the process of making MachineLoopInfo possible by templating Loop.
llvm-svn: 44097
2007-11-14 02:33:58 +00:00
Hartmut Kaiser
ab5f11b679 Fixed a compilation error.
llvm-svn: 44083
2007-11-13 23:04:28 +00:00
Hartmut Kaiser
1ba24a4989 Fixed a strange construct. Please review.
llvm-svn: 44082
2007-11-13 23:04:06 +00:00
Owen Anderson
3bf3917599 Wow. I definitely shouldn't write code when I'm tird.
Make my previous patch actually do what it was intended to do.

llvm-svn: 44061
2007-11-13 19:56:28 +00:00
Dale Johannesen
5fd9e7a615 Add parameter to getDwarfRegNum to permit targets
to use different mappings for EH and debug info;
no functional change yet.
Fix warning in X86CodeEmitter.

llvm-svn: 44056
2007-11-13 19:13:01 +00:00
Bill Wendling
cc75435ebf Unify CALLSEQ_{START,END}. They take 4 parameters: the chain, two stack
adjustment fields, and an optional flag. If there is a "dynamic_stackalloc" in
the code, make sure that it's bracketed by CALLSEQ_START and CALLSEQ_END. If
not, then there is the potential for the stack to be changed while the stack's
being used by another instruction (like a call).

This can only result in tears...

llvm-svn: 44037
2007-11-13 00:44:25 +00:00
Ted Kremenek
4bca0b284d Renamed serialization method "Materialize" to "Create". This is an API change.
llvm-svn: 44034
2007-11-13 00:25:08 +00:00
Ted Kremenek
9b762fbd2b Fixed bug with inconsistent serialization/deserialization in matching
calls to BatchEmitOwnedPtrs and BatchReadOwnedPtrs.

llvm-svn: 44032
2007-11-13 00:13:57 +00:00
Ted Kremenek
960f531bbe Added versions of ReadPtr that takes an explicit SerializedPtrID. This allows
clients of the Deserializer to read the pointer ID before they are ready
to deserialize the object (which can mean registering a pointer reference
with the backpatcher).

Changed some methods that took an argument "SerializedPtrID" to "const SerializedPtrID&" (pass-by-reference).  This is to accommodate a future
revision of SerializedPtrID where it may be much fatter than an unsigned
integer.

llvm-svn: 44021
2007-11-12 19:11:15 +00:00
Duncan Sands
e82bbb4fef Compile fix.
llvm-svn: 44013
2007-11-12 13:43:23 +00:00
Owen Anderson
aba398a5ce Add a flag for indirect branch instructions.
Target maintainers: please check that the instructions for your target are correctly marked.

llvm-svn: 44012
2007-11-12 07:39:39 +00:00
Evan Cheng
d887bfa88e Refactor some code.
llvm-svn: 44010
2007-11-12 06:35:08 +00:00
Owen Anderson
4a8d490c4d Fix rewriting of PHI nodes.
Could someone more familiar with machine-level stuff review this for me?

llvm-svn: 44005
2007-11-12 02:13:07 +00:00
Owen Anderson
bc0825ac4f Remove unnecessary #include's.
llvm-svn: 44003
2007-11-12 01:19:28 +00:00
Owen Anderson
40abf86e03 As Chris and Evan pointed out, BreakCriticalMachineEdges doesn't really need
to be a pass of its own.  Instead, move it out into a helper method.

llvm-svn: 44002
2007-11-12 01:05:09 +00:00
Ted Kremenek
b16c8aac59 Fixed a bug introduced by my last patch. Now we properly clear out the BatchIDVec
vector before reusing it.

llvm-svn: 43984
2007-11-10 19:33:26 +00:00
Ted Kremenek
72b9e78ab1 Fixed hack in BatchReadOwnedPtrs to no longer use the array of pointers passed in for
deserialization as a temporary location for storing serialized pointer identifiers. The
definition of SerializedPtrID will likely change significantly in the future, and the
current implementation caused compilation errors on some 64-bit machines.

llvm-svn: 43983
2007-11-10 19:28:49 +00:00
Ted Kremenek
107cb494e2 Added "random access" to the Deserializer to allow a client to jump to any
serialized block in the bitstream, including a block in an entirely different
nesting than the current block. This is useful for deserializing objects from
a bitstream in an order different from the order that they were serialized.

llvm-svn: 43973
2007-11-10 02:02:34 +00:00
Ted Kremenek
93329cbed2 Made Deserializer a friend class of BitstreamReader.
Moved some of the logic in BitstreamReader::ExitBlock into a utility function
BitstreamReader::PopBlockScope. The latter is a private method. It will also
be called by Deserializer to manipulate the current "block scope."

llvm-svn: 43972
2007-11-10 02:00:38 +00:00
Duncan Sands
edf7e3b5f4 Move MinAlign to MathExtras.h.
llvm-svn: 43944
2007-11-09 13:41:39 +00:00
Anton Korobeynikov
8ab03c9d1c Make this header public
llvm-svn: 43938
2007-11-09 12:16:58 +00:00
Duncan Sands
7df7c7aed1 Fix some load/store logic that would be wrong for
apints on big-endian machines if the bitwidth is
not a multiple of 8.  Introduce a new helper,
MVT::getStoreSizeInBits, and use it.

llvm-svn: 43934
2007-11-09 08:57:19 +00:00
Evan Cheng
7d8deec92f Much improved pic jumptable codegen:
Then:
        call    "L1$pb"
"L1$pb":
        popl    %eax
		...
LBB1_1: # entry
        imull   $4, %ecx, %ecx
        leal    LJTI1_0-"L1$pb"(%eax), %edx
        addl    LJTI1_0-"L1$pb"(%ecx,%eax), %edx
        jmpl    *%edx

        .align  2
        .set L1_0_set_3,LBB1_3-LJTI1_0
        .set L1_0_set_2,LBB1_2-LJTI1_0
        .set L1_0_set_5,LBB1_5-LJTI1_0
        .set L1_0_set_4,LBB1_4-LJTI1_0
LJTI1_0:
        .long    L1_0_set_3
        .long    L1_0_set_2

Now:
        call    "L1$pb"
"L1$pb":
        popl    %eax
		...
LBB1_1: # entry
        addl    LJTI1_0-"L1$pb"(%eax,%ecx,4), %eax
        jmpl    *%eax

		.align  2
		.set L1_0_set_3,LBB1_3-"L1$pb"
		.set L1_0_set_2,LBB1_2-"L1$pb"
		.set L1_0_set_5,LBB1_5-"L1$pb"
		.set L1_0_set_4,LBB1_4-"L1$pb"
LJTI1_0:
        .long    L1_0_set_3
        .long    L1_0_set_2

llvm-svn: 43924
2007-11-09 01:32:10 +00:00
Ted Kremenek
43cd07be2c Updated Deserializer class to provide more information about the current
block that is being visited in the bitstream.  The client can also now
skip blocks before reading them, and query the current abbreviation number
as seen from the perspective of the Deserializer.  This allows the client
to be more interactive in the deserialization process (if they so choose).

llvm-svn: 43916
2007-11-09 00:43:51 +00:00
Owen Anderson
8f46b986d9 Make BreakCriticalMachineEdges available as a pass that can be depended on.
llvm-svn: 43910
2007-11-08 22:20:23 +00:00
Ted Kremenek
4457e36ffe Added typedef "SerializedPtrID" to represent the pointer handle written to disk
instead of just using "unsigned".  This gives us more flexibility in changing
the definition of the handle later, and is more self-documenting.

Added tracking of block stack in the Deserializer.  Now clients can query
if they are still within a block using the methods GetCurrentBlockLocation()
and FinishedBlock().

llvm-svn: 43903
2007-11-08 19:50:46 +00:00
Lauro Ramos Venancio
d8f2190c19 [ARM] Implement __builtin_thread_pointer.
llvm-svn: 43892
2007-11-08 17:20:05 +00:00
Owen Anderson
1e15f3cd4f Fix MachineDominators' getAnalysisUsage.
llvm-svn: 43868
2007-11-08 01:22:53 +00:00
Owen Anderson
6b14317130 Oops, forgot to commit this file.
llvm-svn: 43867
2007-11-08 01:22:24 +00:00
Ted Kremenek
93c65108de Revised BatchEmitOwnedPtrs to work better with constant pointers.
llvm-svn: 43861
2007-11-08 00:55:31 +00:00
Ted Kremenek
eaafbccdd8 Revised implementation of BatchReadOwnedPtrs() that deserializes an
array of pointers to not allocate a second array to contain the pointer ids.

Fixed bug in the same member function where deserialized pointers were
not being registered with the backpatcher.

llvm-svn: 43855
2007-11-08 00:04:50 +00:00
Ted Kremenek
076d1903ec Fixed bug where we did not properly serialize owned objects due to a missing
dereference.

llvm-svn: 43853
2007-11-07 23:32:06 +00:00
Ted Kremenek
bd19c49b62 Added version of BatchEmitOwnedPtrs and BatchReadOwnedPtrs that emits/reads
an array of pointers of the same type.

llvm-svn: 43852
2007-11-07 23:18:40 +00:00
Ted Kremenek
28ffec0b56 Added methods to batch emit and deserialize owned pointers. This allows
to group the pointer IDs together in the bitstream before their referenced
contents (which will lend itself to more efficient encoding).

llvm-svn: 43845
2007-11-07 22:30:29 +00:00
Hartmut Kaiser
a23dfa2c76 Fixed compilation errors on VC++.
llvm-svn: 43836
2007-11-07 19:33:31 +00:00
Ted Kremenek
846a3448a1 Implemented generic serialization of APFloat.
llvm-svn: 43829
2007-11-07 18:39:22 +00:00
Ted Kremenek
f4bc385d1b Implemented serialization of signed integers.
llvm-svn: 43828
2007-11-07 18:24:34 +00:00
Ted Kremenek
ac282bd929 Added special version of ReadPtr() that returns a deserialized pointer
by value.  This version prohibits backpatching of pointers, so it
useful when a pointee is always known to be deserialized beforehand.

llvm-svn: 43799
2007-11-07 00:47:33 +00:00
Ted Kremenek
7c8260f21b Fixed default ctor for APInt to properly initialize BitWidth to a
non-random value.

llvm-svn: 43795
2007-11-07 00:27:59 +00:00
Ted Kremenek
8dedf8270e Serializer no longer automatically emits a root-level block in the bitstream.
llvm-svn: 43784
2007-11-06 22:22:25 +00:00
Ted Kremenek
844153d465 Augmented ReadPtr and ReadOwnedPtr to control whether or not a pointer is allowed to be backpatched
or can be registered with the deserializer to backpatch other pointers.

llvm-svn: 43783
2007-11-06 22:21:14 +00:00
Chris Lattner
edf6668dda make smallptrset more const and type correct, which caught a few
minor bugs.

llvm-svn: 43782
2007-11-06 22:12:43 +00:00
Ted Kremenek
3609f43f5c Renamed "Flush()" to "FlushRecord()".
llvm-svn: 43772
2007-11-06 19:49:50 +00:00
Ted Kremenek
16a9212602 Added support for processing abbreviations in the Deserializer.
Added some #ifdef-controlled messages for debugging backpatching.

llvm-svn: 43771
2007-11-06 19:49:16 +00:00
Rafael Espindola
ec025c3042 Move the LowerMEMCPY and LowerMEMCPYCall to a common place.
Thanks for the suggestions Bill :-)

llvm-svn: 43742
2007-11-05 23:12:20 +00:00
Ted Kremenek
7c710e0210 Added support in serializer and deserializer to create arbitrary blocks.
Added detection of end-of-stream in deserializer.

llvm-svn: 43736
2007-11-05 21:36:35 +00:00
Ted Kremenek
dbc286177c Added default creation of root-level block by bitstream serializer.
llvm-svn: 43732
2007-11-05 20:47:27 +00:00
Ted Kremenek
8250360a77 Fixed bug where tombstone key and empty key for DenseMap used for
pointer backpatching in deserializer were improperly created and
resulted in an assertion failure.

llvm-svn: 43721
2007-11-05 18:13:03 +00:00
Evan Cheng
ec35b58b0a Move SimpleRegisterCoalescing.h to lib/CodeGen since there is now a common
register coalescer interface: RegisterCoalescing.

llvm-svn: 43714
2007-11-05 17:41:38 +00:00
Gordon Henriksen
8188f028a2 Deleting redundant copy of block extractor pass. See also PR1775.
llvm-svn: 43694
2007-11-05 01:54:05 +00:00
Duncan Sands
d1bdbd010b Eliminate the remaining uses of getTypeSize. This
should only effect x86 when using long double.  Now
12/16 bytes are output for long double globals (the
exact amount depends on the alignment).  This brings
globals in line with the rest of LLVM: the space
reserved for an object is now always the ABI size.
One tricky point is that only 10 bytes should be
output for long double if it is a field in a packed
struct, which is the reason for the additional
argument to EmitGlobalConstant.

llvm-svn: 43688
2007-11-05 00:04:43 +00:00
Duncan Sands
662fb070a7 Change uses of getTypeSize to getABITypeSize, getTypeStoreSize
or getTypeSizeInBits as appropriate in ScalarReplAggregates.
The right change to make was not always obvious, so it would
be good to have an sroa guru review this.  While there I noticed
some bugs, and fixed them: (1) arrays of x86 long double have
holes due to alignment padding, but this wasn't being spotted
by HasStructPadding (renamed to HasPadding).  The same goes
for arrays of oddly sized ints.  Vectors also suffer from this,
in fact the problem for vectors is much worse because basic
vector assumptions seem to be broken by vectors of type with
alignment padding.   I didn't try to fix any of these vector
problems.  (2) The code for extracting smaller integers from
larger ones (in the "int union" case) was wrong on big-endian
machines for integers with size not a multiple of 8, like i1.
Probably this is impossible to hit via llvm-gcc, but I fixed
it anyway while there and added a testcase.  I also got rid of
some trailing whitespace and changed a function name which
had an obvious typo in it.

llvm-svn: 43672
2007-11-04 14:43:57 +00:00
Evan Cheng
1771f6da9c There are times when the coalescer would not coalesce away a copy but the copy
can be eliminated by the allocator is the destination and source targets the
same register. The most common case is when the source and destination registers
are in different class. For example, on x86 mov32to32_ targets GR32_ which
contains a subset of the registers in GR32.

The allocator can do 2 things:
1. Set the preferred allocation for the destination of a copy to that of its source.
2. After allocation is done, change the allocation of a copy destination (if
   legal) so the copy can be eliminated.

This eliminates 443 extra moves from 403.gcc.

llvm-svn: 43662
2007-11-03 07:20:12 +00:00
Ted Kremenek
0501d830a5 Added overloaded version of Deserializer::ReadOwnedPtr which allows
the target pointer to be passed by reference.  This can result in less
typing, as the object to be deserialized can be inferred from the
argument.

llvm-svn: 43647
2007-11-02 18:04:20 +00:00
Owen Anderson
e6b623ba1c VAArgInst does, in fact, read memory.
llvm-svn: 43633
2007-11-02 04:01:21 +00:00
Neil Booth
d04447b7ae When converting to integer, do bit manipulations in the destination
memory rather than in a copy of the APFloat.  This avoids problems
when the destination is wider than our significand and is cleaner.

Also provide deterministic values in all cases where conversion
fails, namely zero for NaNs and the minimal or maximal value
respectively for underflow or overflow.

llvm-svn: 43626
2007-11-01 22:43:37 +00:00
Ted Kremenek
d2f2a98e09 Removed ReadVal from SerializeTrait<T>, and also removed it from
Deserializer.

There were issues with Visual C++ barfing when instantiating
SerializeTrait<T> when "T" was an abstract class AND
SerializeTrait<T>::ReadVal was *never* called:

template <typename T>
struct SerializeTrait {
 <SNIP>
  static inline T ReadVal(Deserializer& D) { T::ReadVal(D); }
 <SNIP>
};

Visual C++ would complain about "T" being an abstract class, even
though ReadVal was never instantiated (although one of the other
member functions were).

Removing this from the trait is not a big deal.  It was used hardly
ever, and users who want "read-by-value" deserialization can simply
call the appropriate methods directly instead of relying on
trait-based-dispatch.  The trait dispatch for
serialization/deserialization is simply sugar in many cases (like this
one).

llvm-svn: 43624
2007-11-01 22:23:34 +00:00
Duncan Sands
eb464e976f Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.
The meaning of getTypeSize was not clear - clarifying it is important
now that we have x86 long double and arbitrary precision integers.
The issue with long double is that it requires 80 bits, and this is
not a multiple of its alignment.  This gives a primitive type for
which getTypeSize differed from getABITypeSize.  For arbitrary precision
integers it is even worse: there is the minimum number of bits needed to
hold the type (eg: 36 for an i36), the maximum number of bits that will
be overwriten when storing the type (40 bits for i36) and the ABI size
(i.e. the storage size rounded up to a multiple of the alignment; 64 bits
for i36).

This patch removes getTypeSize (not really - it is still there but
deprecated to allow for a gradual transition).  Instead there is:

(1) getTypeSizeInBits - a number of bits that suffices to hold all
values of the type.  For a primitive type, this is the minimum number
of bits.  For an i36 this is 36 bits.  For x86 long double it is 80.
This corresponds to gcc's TYPE_PRECISION.

(2) getTypeStoreSizeInBits - the maximum number of bits that is
written when storing the type (or read when reading it).  For an
i36 this is 40 bits, for an x86 long double it is 80 bits.  This
is the size alias analysis is interested in (getTypeStoreSize
returns the number of bytes).  There doesn't seem to be anything
corresponding to this in gcc.

(3) getABITypeSizeInBits - this is getTypeStoreSizeInBits rounded
up to a multiple of the alignment.  For an i36 this is 64, for an
x86 long double this is 96 or 128 depending on the OS.  This is the
spacing between consecutive elements when you form an array out of
this type (getABITypeSize returns the number of bytes).  This is
TYPE_SIZE in gcc.

Since successive elements in a SequentialType (arrays, pointers
and vectors) need to be aligned, the spacing between them will be
given by getABITypeSize.  This means that the size of an array
is the length times the getABITypeSize.  It also means that GEP
computations need to use getABITypeSize when computing offsets.
Furthermore, if an alloca allocates several elements at once then
these too need to be aligned, so the size of the alloca has to be
the number of elements multiplied by getABITypeSize.  Logically
speaking this doesn't have to be the case when allocating just
one element, but it is simpler to also use getABITypeSize in this
case.  So alloca's and mallocs should use getABITypeSize.  Finally,
since gcc's only notion of size is that given by getABITypeSize, if
you want to output assembler etc the same as gcc then getABITypeSize
is the size you want.

Since a store will overwrite no more than getTypeStoreSize bytes,
and a read will read no more than that many bytes, this is the
notion of size appropriate for alias analysis calculations.

In this patch I have corrected all type size uses except some of
those in ScalarReplAggregates, lib/Codegen, lib/Target (the hard
cases).  I will get around to auditing these too at some point,
but I could do with some help.

Finally, I made one change which I think wise but others might
consider pointless and suboptimal: in an unpacked struct the
amount of space allocated for a field is now given by the ABI
size rather than getTypeStoreSize.  I did this because every
other place that reserves memory for a type (eg: alloca) now
uses getABITypeSize, and I didn't want to make an exception
for unpacked structs, i.e. I did it to make things more uniform.
This only effects structs containing long doubles and arbitrary
precision integers.  If someone wants to pack these types more
tightly they can always use a packed struct.

llvm-svn: 43620
2007-11-01 20:53:16 +00:00
Bill Wendling
51375114ca Get rid of compilation warning during release builds
llvm-svn: 43608
2007-11-01 08:24:40 +00:00
Evan Cheng
7c2d41dcc1 - Coalesce extract_subreg when both intervals are relatively small.
- Some code clean up.

llvm-svn: 43606
2007-11-01 06:22:48 +00:00
Ted Kremenek
88302abf8a Rewrote backpatcher. Backpatcher now stores the "has final pointer"
flag in the **key** of the backpatch map, as opposed to the mapped
value which contains either the final pointer, or a pointer to a chain
of pointers that need to be backpatched.  The bit flag was moved to
the key because we were erroneously assuming that the backpatched
pointers would be at an alignment of >= 2 bytes, which obviously
doesn't work for character strings.  Now we just steal the bit from the key.

llvm-svn: 43595
2007-11-01 00:57:37 +00:00
Ted Kremenek
5517254faa Added typedef "value_type" to DenseMap (similar typedef appears in std::map).
Added method FindAndConstruct() to DenseMap, which does the same thing as
operator[], except that it refers value_type& (a reference to both the
key and mapped data pair).  This method is useful for clients that wish
to access the stored key value, as opposed to the key used to do the
actual lookup (these need not always be the same).

Redefined operator[] to use FindAndConstruct() (same logic).

llvm-svn: 43594
2007-11-01 00:54:57 +00:00
Ted Kremenek
b94840e211 constified several pointer arguments for methods in the Deserializer.
llvm-svn: 43583
2007-10-31 22:42:03 +00:00
Ted Kremenek
deeab7cc87 Implemented deserialization of references. References are handled
just like pointers, except that they cannot be backpatched.  This
means that references are essentially non-owning pointers where the
referred object must be deserialized prior to the reference being
deserialized.  Because of the nature of references, this ordering of
objects is always possible.

Fixed a bug in backpatching code (returning the backpatched pointer
would accidentally include a bit flag).

llvm-svn: 43570
2007-10-31 19:58:32 +00:00
Ted Kremenek
f6f2eb1c4f Added Serializer::EmitRef to deal with emitting arbitrary references.
Modified Serializer::EmitPtr to handle const pointers.

llvm-svn: 43565
2007-10-31 18:23:21 +00:00
Ted Kremenek
4284b7c63c Changed access control within FoldingSet for some ivars from "private"
to "protected".  This allows iterators to work.

llvm-svn: 43559
2007-10-31 17:12:47 +00:00
Duncan Sands
c945dfa9af Add a newline at the end of the file.
llvm-svn: 43550
2007-10-31 08:49:24 +00:00
Owen Anderson
ae0530aaf4 Add the skeleton of a better PHI elimination pass.
llvm-svn: 43542
2007-10-31 03:37:57 +00:00
Owen Anderson
4314cf9d58 Some fixes to get MachineDomTree working better.
llvm-svn: 43541
2007-10-31 03:30:14 +00:00
Ted Kremenek
d3e5310f68 Added member function "size()" to FoldingSet to return the number of
nodes in the FoldingSet.

llvm-svn: 43531
2007-10-30 23:35:55 +00:00
Dale Johannesen
7167117945 Add missing SSE builtins: CVTPD2PI, CVTPS2PI,
CVTTPD2PI, CVTTPS2PI, CVTPI2PD, CVTPI2PS.

llvm-svn: 43523
2007-10-30 22:15:38 +00:00
Dale Johannesen
c4bfe4a99e Fix argument types for PSLLQ, PSRLQ.
llvm-svn: 43490
2007-10-30 01:44:33 +00:00
Evan Cheng
5fe81cf64e Enable more fold (sext (load x)) -> (sext (truncate (sextload x)))
transformation. Previously, it's restricted by ensuring the number of load uses
is one. Now the restriction is loosened up by allowing setcc uses to be
"extended" (e.g. setcc x, c, eq -> setcc sext(x), sext(c), eq).

llvm-svn: 43465
2007-10-29 19:58:20 +00:00
Dan Gohman
65be3b6502 Add explicit keywords.
llvm-svn: 43464
2007-10-29 19:52:04 +00:00
Chris Lattner
3d6151bcd1 Model stacksave and stackrestore as both writing memory, since we
don't model their dependences on allocas correctly.  This fixes
PR1745.

llvm-svn: 43442
2007-10-29 05:47:52 +00:00
Owen Anderson
229333c94b Add a first attempt at dominator information for MBB's. Use with caution: this has been tested to compile. It has not yet been confirmed to generate correct analysis.
llvm-svn: 43438
2007-10-29 04:50:50 +00:00
Ted Kremenek
27c96e0d86 Updated backpatching logic during object deserialization to perform
eager backpatching instead of waithing until all objects have been
deserialized.  This allows us to reduce the memory footprint needed
for backpatching.

llvm-svn: 43422
2007-10-28 21:17:59 +00:00
Duncan Sands
b494fb97a4 The guaranteed alignment of ptr+offset is only the minimum of
of offset and the alignment of ptr if these are both powers of
2.  While the ptr alignment is guaranteed to be a power of 2,
there is no reason to think that offset is.  For example, if
offset is 12 (the size of a long double on x86-32 linux) and
the alignment of ptr is 8, then the alignment of ptr+offset
will in general be 4, not 8.  Introduce a function MinAlign,
lifted from gcc, for computing the minimum guaranteed alignment.
I've tried to fix up everywhere under lib/CodeGen/SelectionDAG/.
I also changed some places that weren't wrong (because both values
were a power of 2), as a defensive change against people copying
and pasting the code.
Hopefully someone who cares about alignment will review the rest
of LLVM and fix up the remaining places.  Since I'm on x86 I'm
not very motivated to do this myself...

llvm-svn: 43421
2007-10-28 12:59:45 +00:00
Ted Kremenek
254ef9c99c Fixed bug where default SerializeTrait<>::Materialize would not return the materialized object pointer.
llvm-svn: 43413
2007-10-26 23:44:59 +00:00
Ted Kremenek
3f3b4818ef Added serialization support for APInt.
llvm-svn: 43405
2007-10-26 21:50:10 +00:00
Ted Kremenek
5b2ac3504a Fixed incorrect "path name" in preamble (comment) of header file.
llvm-svn: 43402
2007-10-26 20:44:02 +00:00
Ted Kremenek
0347caa918 Fixed incorrect "path name" in preamble (comment) of header file.
llvm-svn: 43401
2007-10-26 20:42:45 +00:00
Ted Kremenek
87e1cadc06 Added default implementation of SerializeTrait<> that dispatches to
calling member functions of the target type to perform type-specific
serialization.
                         
Added version of ReadPtr that allows passing references to uintptr_t
(useful for smart pointers).

llvm-svn: 43396
2007-10-26 20:23:27 +00:00
Gordon Henriksen
609997aa7d More fleshing out of docs/Passes.html, plus some typo fixes and
improved wording in source files.

llvm-svn: 43377
2007-10-26 03:03:51 +00:00
Evan Cheng
53696b7e9f Loosen up iv reuse to allow reuse of the same stride but a larger type when truncating from the larger type to smaller type is free.
e.g.
Turns this loop:
LBB1_1: # entry.bb_crit_edge
        xorl    %ecx, %ecx
        xorw    %dx, %dx
        movw    %dx, %si
LBB1_2: # bb
        movl    L_X$non_lazy_ptr, %edi
        movw    %si, (%edi)
        movl    L_Y$non_lazy_ptr, %edi
        movw    %dx, (%edi)
		addw    $4, %dx
		incw    %si
		incl    %ecx
		cmpl    %eax, %ecx
		jne     LBB1_2  # bb
	
into

LBB1_1: # entry.bb_crit_edge
        xorl    %ecx, %ecx
        xorw    %dx, %dx
LBB1_2: # bb
        movl    L_X$non_lazy_ptr, %esi
        movw    %cx, (%esi)
        movl    L_Y$non_lazy_ptr, %esi
        movw    %dx, (%esi)
        addw    $4, %dx
		incl    %ecx
        cmpl    %eax, %ecx
        jne     LBB1_2  # bb

llvm-svn: 43375
2007-10-26 01:56:11 +00:00
Ted Kremenek
2bfb73a3f4 Updated backpatching during object deserialization to support "smart"
pointers that employ unused bits in a pointer to store extra data.

llvm-svn: 43373
2007-10-25 23:40:35 +00:00
Ted Kremenek
d29fe31fcd Added special treatment of serializing NULL pointers.
llvm-svn: 43357
2007-10-25 18:42:52 +00:00
Ted Kremenek
9749790ef5 Created header file to include minimal forward references needed for
object serialization.

llvm-svn: 43352
2007-10-25 18:19:29 +00:00
Duncan Sands
f37520fcff Fix comment typos.
llvm-svn: 43338
2007-10-25 12:28:12 +00:00
Chris Lattner
09c4d1b720 remove unimplemented ctor, add some comments.
llvm-svn: 43328
2007-10-25 05:19:24 +00:00
Owen Anderson
dc3329dbf7 Make it possible for DomTreeBase to be constructed from MachineFunction's as well as just Function's.
llvm-svn: 43321
2007-10-25 00:16:57 +00:00
Ted Kremenek
195382dce2 Implemented prototype serialization of pointers, including support
for backpatching.

Added Deserialize::ReadVal.

llvm-svn: 43319
2007-10-25 00:10:21 +00:00
Ted Kremenek
b3085f2d74 Split Serialization.h into separate headers: Serialize.h and
Deserialize.h Serialization.h now includes trait speciailizations for
unsigned long, etc.

llvm-svn: 43307
2007-10-24 19:06:40 +00:00
Chris Lattner
ef90913394 add a nice predicate to check to see if nan
llvm-svn: 43304
2007-10-24 18:54:28 +00:00
Hartmut Kaiser
b72a8fcf9c Silenced a VC++ warning.
llvm-svn: 43276
2007-10-24 00:06:31 +00:00
Ted Kremenek
bb85c21ffc Added "ReadEnum" and "WriteEnum" to serialization classes.
llvm-svn: 43265
2007-10-23 22:17:03 +00:00
Owen Anderson
52b33065a4 Make DomTreeBase not a FunctionPass.
llvm-svn: 43263
2007-10-23 21:42:49 +00:00
Ted Kremenek
72fe268f74 Added preliminary implementation of generic object serialization to bitcode.
llvm-svn: 43261
2007-10-23 21:29:33 +00:00
Owen Anderson
962303b4ef Unbreak the build. Forgot to commit this file.
llvm-svn: 43260
2007-10-23 21:04:37 +00:00
Owen Anderson
33b9693ab8 Make DomTree and PostDomTree thin wrappers around DomTreeBase, rather than inheriting from it.
llvm-svn: 43259
2007-10-23 20:58:37 +00:00
Evan Cheng
dc2f1b1741 isSubRegOf() is a dup of isSubRegister.
llvm-svn: 43249
2007-10-23 06:51:50 +00:00
Dan Gohman
68fc6d7395 Move the SCEV object factors from being static members of the individual
SCEV subclasses to being non-static member functions of the ScalarEvolution
class.

llvm-svn: 43224
2007-10-22 18:31:58 +00:00
Chris Lattner
ecea068eb2 add a mechanism for the JIT to invoke a function to lazily create functions as they are referenced.
llvm-svn: 43210
2007-10-22 02:50:12 +00:00
Anton Korobeynikov
bcee4726bf Reg2Mem cleanup and optimizations:
- enable phi instructions demotion to stack
 - create alloca instructions in the entry block

llvm-svn: 43208
2007-10-21 23:05:16 +00:00
Chris Lattner
712119a5ed Add a convenience method for creating EE's.
llvm-svn: 43206
2007-10-21 22:57:11 +00:00
Evan Cheng
ded6550885 Local spiller optimization:
Turn a store folding instruction into a load folding instruction. e.g.
     xorl  %edi, %eax
     movl  %eax, -32(%ebp)
     movl  -36(%ebp), %eax
     orl   %eax, -32(%ebp)
=>
     xorl  %edi, %eax
     orl   -36(%ebp), %eax
     mov   %eax, -32(%ebp)
This enables the unfolding optimization for a subsequent instruction which will
also eliminate the newly introduced store instruction.

llvm-svn: 43192
2007-10-19 21:23:22 +00:00
Chris Lattner
45b8558ec5 rename ExpandOperation to ExpandOperationResult, as suggested
by Duncan

llvm-svn: 43177
2007-10-19 15:28:47 +00:00
Rafael Espindola
d8d4372845 Add support for byval function whose argument is not 32 bit aligned.
To do this it is necessary to add a "always inline" argument to the
memcpy node. For completeness I have also added this node to memmove
and memset.  I have also added getMem* functions, because the extra
argument makes it cumbersome to use getNode and because I get confused
by it :-)

llvm-svn: 43172
2007-10-19 10:41:11 +00:00
Chris Lattner
f02434cdaf add a new target hook.
llvm-svn: 43165
2007-10-19 03:31:45 +00:00
Dale Johannesen
b23b0bfa8f More ppcf128 issues (maybe the last)?
llvm-svn: 43160
2007-10-19 00:59:18 +00:00
Evan Cheng
0449186690 - Added getOpcodeAfterMemoryUnfold(). It doesn't unfold an instruction, but only returns the opcode of the instruction post unfolding.
- Fix some copy+paste bugs.

llvm-svn: 43153
2007-10-18 22:40:57 +00:00
Evan Cheng
c852780685 Use SmallVectorImpl instead of SmallVector with hardcoded size in MRegister public interface.
llvm-svn: 43150
2007-10-18 21:29:24 +00:00
Christopher Lamb
b9c6101dd5 Add an uppercase conversion utility function.
llvm-svn: 43146
2007-10-18 19:31:38 +00:00
Chris Lattner
ecbffce0b7 remove dead file
llvm-svn: 43131
2007-10-18 16:12:54 +00:00
Chris Lattner
e047abe2b4 update comment.
llvm-svn: 43128
2007-10-18 16:10:17 +00:00
Gordon Henriksen
422d66e53e Missing 'public' keyword.
llvm-svn: 43121
2007-10-18 11:31:21 +00:00
Evan Cheng
f6d1c7be14 Really fix PR1734. Carefully track which register uses are sub-register uses by
traversing inverse register coalescing map.

llvm-svn: 43118
2007-10-18 07:49:59 +00:00
Evan Cheng
05890a1438 Remove unnecessary include.
llvm-svn: 43117
2007-10-18 07:47:55 +00:00
Owen Anderson
4b407757d0 Move Split<...>() into DomTreeBase. This should make the #include's of DominatorInternals.h
in CodeExtractor and LoopSimplify unnecessary.

Hartmut, could you confirm that this fixes the issues you were seeing?

llvm-svn: 43115
2007-10-18 05:13:52 +00:00
Ted Kremenek
c00b2095fa Changed the return type of type-specific Allocate() methods to return
void*.  This is hint that we are returning uninitialized memory rather
than a constructed object.

Patched ImutAVLTree to conform to this new interface.

llvm-svn: 43106
2007-10-18 00:30:14 +00:00
Ted Kremenek
7d21c85cca ImutAVLTree now allocates tree nodes from the BumpPtrAllocator using
the new type-aligned Allocate() method.

llvm-svn: 43100
2007-10-17 22:17:01 +00:00
Ted Kremenek
bf43a92ef5 Removed inclusion of cassert, which is no longer needed.
llvm-svn: 43099
2007-10-17 22:12:14 +00:00
Ted Kremenek
24219dc48a Minor cosmetic cleanups in the calculation of alignments for
StringMapEntry objects.  No functionality change.

llvm-svn: 43097
2007-10-17 22:09:45 +00:00
Ted Kremenek
a9c650d43e Added template function alignof() which provides a clean
function-based interface to getting the alignment of a type.

llvm-svn: 43096
2007-10-17 22:08:55 +00:00
Gordon Henriksen
a6050b38d2 Switching TargetMachineRegistry to use the new generic Registry.
llvm-svn: 43094
2007-10-17 21:28:48 +00:00
Ted Kremenek
307fa3bed5 Updated StringMap to use llvm::AlignOf to compute the alignment of map
entries.

llvm-svn: 43089
2007-10-17 21:13:50 +00:00
Ted Kremenek
9008297075 Added member template functions to MallocAllocator and
BumpPtrAllocator that implement allocations that return a properly
typed pointer.  For BumpPtrAllocator, the allocated memory is
automatically aligned to the minimum alignment of the type (as
calculated by llvm::AlignOf::Alignment).

llvm-svn: 43087
2007-10-17 21:10:21 +00:00
Ted Kremenek
d82172cc2c Added llvm::AlignOf, a template class whose purpose is to portably
compute the minimum memory alignment of arbitrary types.

llvm-svn: 43086
2007-10-17 20:56:47 +00:00
Dan Gohman
231159e8a3 Define a helper function ConstantVector::getSplatValue for testing for
and working with broadcasted constants.

llvm-svn: 43076
2007-10-17 17:51:30 +00:00
Hartmut Kaiser
ed12f66488 Updated VC++ build system.
Silenced some VC warnings.

I'm getting linker errors, though: unresolved externals:

llvm::Split<class llvm::BasicBlock *,struct llvm::GraphTraits<class llvm::BasicBlock *> >(class llvm::DominatorTreeBase<class llvm::BasicBlock> &,class llvm::BasicBlock *)

and

llvm::Split<struct llvm::Inverse<class llvm::BasicBlock *>,struct llvm::GraphTraits<struct llvm::Inverse<class llvm::BasicBlock *> > >(class llvm::DominatorTreeBase<class llvm::BasicBlock> &,class llvm::BasicBlock *)

Where are these defined?

llvm-svn: 43073
2007-10-17 14:56:40 +00:00
Duncan Sands
0a5a15c3a0 Return Expand from getOperationAction for all extended
types.  This is needed for SIGN_EXTEND_INREG at least.
It is not clear if this is correct for other operations.
On the other hand, for the various load/store actions
it seems to correct to return the type action, as is
currently done.
Also, it seems that SelectionDAG::getValueType can be
called for extended value types; introduce a map for
holding these, since we don't really want to extend
the vector to be 2^32 pointers long!
Generalize DAGTypeLegalizer::PromoteResult_TRUNCATE
and DAGTypeLegalizer::PromoteResult_INT_EXTEND to handle
the various funky possibilities that apints introduce,
for example that you can promote to a type that needs
to be expanded.

llvm-svn: 43071
2007-10-17 13:49:58 +00:00
Evan Cheng
4bba09dc4e Apply Chris' suggestions.
llvm-svn: 43069
2007-10-17 06:53:44 +00:00
Evan Cheng
7e785103df Update comments.
llvm-svn: 43064
2007-10-17 02:16:40 +00:00
Evan Cheng
be47f9df2e Clean up code that calculate MBB live-in's.
llvm-svn: 43060
2007-10-17 02:10:22 +00:00
Owen Anderson
1235d1218b Move splitBlock into DomTreeBase from DomTree.
llvm-svn: 43059
2007-10-17 02:03:17 +00:00
Owen Anderson
315471786b Fix some formatting.
llvm-svn: 43049
2007-10-16 22:59:15 +00:00
Owen Anderson
43fefb53a6 Template DominatorTreeBase by node type. This is the next major step towards
having dominator information on MBB's.

llvm-svn: 43036
2007-10-16 19:59:25 +00:00
Duncan Sands
b709e0a2cd Document the fact that the verifier currently requires the
top bit of a ValueType to be zero.  Enforce this by ensuring
an assertion failure if someone tries to create a ValueType
without this property.  I chose this minimal approach rather
than a more official integration of the notion of reserved
bits into ValueType because I'm hoping that the verifier will
be changed to no longer require this :)

llvm-svn: 43031
2007-10-16 13:34:11 +00:00
Duncan Sands
9d622a6de1 Initial infrastructure for arbitrary precision integer
codegen support.  This should have no effect on codegen
for other types.  Debatable bits: (1) the use (abuse?)
of a set in SDNode::getValueTypeList; (2) the length of
getTypeToTransformTo, which maybe should be refactored
with a non-inline part for extended value types.

llvm-svn: 43030
2007-10-16 09:56:48 +00:00
Evan Cheng
69092e7585 Code clean up.
llvm-svn: 43026
2007-10-16 08:04:24 +00:00
Devang Patel
b4a9a2e418 Add removeModuleProvider()
llvm-svn: 43002
2007-10-15 19:56:32 +00:00
Ted Kremenek
89ca477326 Fixed incorrect renaming of method name (forgot two characters).
llvm-svn: 42999
2007-10-15 19:15:48 +00:00
Ted Kremenek
432c112649 Added more doxygen comments.
Renamed internal method of ImutAVLTree::RemoveMutableFlag to MarkImmutable.
Added enum for bit manipulation (more self-documentating).

llvm-svn: 42998
2007-10-15 18:52:34 +00:00
Chris Lattner
292bebbb6f add a new CreateStackTemporary helper method.
llvm-svn: 42994
2007-10-15 17:47:20 +00:00
Chris Lattner
452ebc199e One mundane change: Change ReplaceAllUsesOfValueWith to *optionally*
take a deleted nodes vector, instead of requiring it.

One more significant change:  Implement the start of a legalizer that
just works on types.  This legalizer is designed to run before the 
operation legalizer and ensure just that the input dag is transformed
into an output dag whose operand and result types are all legal, even
if the operations on those types are not.

This design/impl has the following advantages:

1. When finished, this will *significantly* reduce the amount of code in
   LegalizeDAG.cpp.  It will remove all the code related to promotion and
   expansion as well as splitting and scalarizing vectors.
2. The new code is very simple, idiomatic, and modular: unlike 
   LegalizeDAG.cpp, it has no 3000 line long functions. :)
3. The implementation is completely iterative instead of recursive, good
   for hacking on large dags without blowing out your stack.
4. The implementation updates nodes in place when possible instead of 
   deallocating and reallocating the entire graph that points to some 
   mutated node.
5. The code nicely separates out handling of operations with invalid 
   results from operations with invalid operands, making some cases
   simpler and easier to understand.
6. The new -debug-only=legalize-types option is very very handy :), 
   allowing you to easily understand what legalize types is doing.

This is not yet done.  Until the ifdef added to SelectionDAGISel.cpp is
enabled, this does nothing.  However, this code is sufficient to legalize
all of the code in 186.crafty, olden and freebench on an x86 machine.  The
biggest issues are:

1. Vectors aren't implemented at all yet
2. SoftFP is a mess, I need to talk to Evan about it.
3. No lowering to libcalls is implemented yet.
4. Various operations are missing etc.
5. There are FIXME's for stuff I hax0r'd out, like softfp.

Hey, at least it is a step in the right direction :).  If you'd like to help,
just enable the #ifdef in SelectionDAGISel.cpp and compile code with it.  If
this explodes it will tell you what needs to be implemented.  Help is 
certainly appreciated.

Once this goes in, we can do three things:

1. Add a new pass of dag combine between the "type legalizer" and "operation
   legalizer" passes.  This will let us catch some long-standing isel issues
   that we miss because operation legalization often obfuscates the dag with
   target-specific nodes.
2. We can rip out all of the type legalization code from LegalizeDAG.cpp,
   making it much smaller and simpler.  When that happens we can then 
   reimplement the core functionality left in it in a much more efficient and
   non-recursive way.
3. Once the whole legalizer is non-recursive, we can implement whole-function
   selectiondags maybe...

llvm-svn: 42981
2007-10-15 06:10:22 +00:00
Chris Lattner
c3a75c628d remove dead enum, make setNodeId public.
llvm-svn: 42977
2007-10-15 05:30:55 +00:00
Chris Lattner
828830d360 Fix 80 col violation
llvm-svn: 42976
2007-10-15 05:30:27 +00:00
Neil Booth
1463947f03 Consolidate logic for creating NaNs. Silence compiler warning.
llvm-svn: 42966
2007-10-14 10:39:51 +00:00