Commit Graph

37659 Commits

Author SHA1 Message Date
Hartmut Kaiser 7d888fa180 Updated VC++ build system
llvm-svn: 43631
2007-11-02 01:44:08 +00:00
Evan Cheng e453ff4913 Missing a getNumOperands check.
llvm-svn: 43630
2007-11-02 01:26:22 +00:00
Fariborz Jahanian 71234d8a9e AST for @finally statement.
llvm-svn: 43629
2007-11-02 00:18:53 +00:00
Fariborz Jahanian 9e63b98de7 AST build for @catch clause (this is work in progress).
llvm-svn: 43628
2007-11-01 23:59:59 +00:00
Neil Booth ae077d232c Add back line whose removal somehow crept into prior patch
llvm-svn: 43627
2007-11-01 22:51:07 +00:00
Neil Booth 618d0fc377 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 5e2eb261af Simplified Serialization code for SourceLocation and SourceRange, and
updated it to the recently updated Serialization API.

Changed clients of SourceLocation serialization to call the
appropriate new methods.

Updated Decl serialization code to put new skeleton serialization code
in place that is much better than the older trait-specialization
approach.

llvm-svn: 43625
2007-11-01 22:25:41 +00:00
Ted Kremenek 478c6982a8 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
Fariborz Jahanian 65590b2504 Bunch of class declarations for objective-c's @try-catch statement.
llvm-svn: 43623
2007-11-01 21:12:44 +00:00
Duncan Sands 44b8721de8 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
Devang Patel e11664a0ef Rename classes and collections that maintain record layout information.
Now, at AST level record info is maintained by ASTRecordLayout class.
Now, at code gen  level record info is maintained by CGRecordLayout class.

llvm-svn: 43619
2007-11-01 19:11:01 +00:00
Ted Kremenek 26a7f3fd56 Implemented serialization of QualTypes within ASTContext. Clarified
ownership model of some type pointers.  Added FIXMEs to serialization.

Added comments to ASTContext indicating which variables we are intentionally
*not* serializing.

llvm-svn: 43618
2007-11-01 18:11:32 +00:00
Fariborz Jahanian ac73ff8868 Remaining work to collect objective-c's type qualifiers and use them to encode
method types.

llvm-svn: 43617
2007-11-01 17:18:37 +00:00
Steve Naroff 63006473d5 - Remove _interface_ prefix for the synthesized tag names.
- Also removed a tab from the generated struct (minor).

llvm-svn: 43616
2007-11-01 17:12:31 +00:00
Ted Kremenek 53155f379e Changed serialization/deserialization of BuiltinTypes to explicitly serialize
each type.  This ensures that the order in which the types are serialized
is clear and remains persistent.

llvm-svn: 43615
2007-11-01 17:10:34 +00:00
Ted Kremenek baa461893b Reverted unnecessary inlining of operator!=, since negating operator== is
just as efficient and much more succinct.

llvm-svn: 43614
2007-11-01 16:35:25 +00:00
Devang Patel 32714064b1 Propagate bitfield info.
llvm-svn: 43613
2007-11-01 16:29:56 +00:00
Steve Naroff 50d4205ff9 Implement rewrite rule for commenting out protocol references. For example:
extern id /*<NSObject>*/ NSAllocateObject(Class aClass, unsigned extraBytes, NSZone *zone);

extern void NSDeallocateObject(id /*<NSObject>*/object);

extern id /*<NSObject>*/ NSCopyObject(id /*<NSObject>*/object, unsigned extraBytes, NSZone *zone);

llvm-svn: 43612
2007-11-01 13:24:47 +00:00
Duncan Sands e0e774b6fd Don't barf on empty basic blocks. Do not rely on assert
doing something - this needs to work for release builds
too.  I chose to just abort rather than following the
fancy logic of abortIfBroken, because (1) it is a pain
to do otherwise, and (2) nothing is going to work if the
module is this broken.

llvm-svn: 43611
2007-11-01 10:50:26 +00:00
Bill Wendling 87f460f8ba Silence a warning saying that the variables always resolve to "true" in an
expression.

llvm-svn: 43610
2007-11-01 09:38:19 +00:00
Bill Wendling b7cabbe295 Silence, accersed warning
llvm-svn: 43609
2007-11-01 08:51:44 +00:00
Bill Wendling 2b3f7a7e3b Get rid of compilation warning during release builds
llvm-svn: 43608
2007-11-01 08:24:40 +00:00
Chris Lattner 68613c7d31 Add the start of chapter 6, still much to go.
llvm-svn: 43607
2007-11-01 06:49:54 +00:00
Evan Cheng fe1ac52836 - Coalesce extract_subreg when both intervals are relatively small.
- Some code clean up.

llvm-svn: 43606
2007-11-01 06:22:48 +00:00
Owen Anderson 2ed651ace7 Fix test/Transforms/DeadStoreElimination/PartialStore.ll, which had been
silently failing because of an incorrect run line for some time.

llvm-svn: 43605
2007-11-01 05:29:16 +00:00
Chris Lattner b338a6b9f3 add support for vector type compatibility checking. Patch by Nate Begeman.
llvm-svn: 43604
2007-11-01 05:03:41 +00:00
Chris Lattner dff7a3e919 remove verifier command line option: this should be part of the API, not
a command line optn.

llvm-svn: 43603
2007-11-01 04:43:13 +00:00
Chris Lattner 059a8df289 add a broken gcc version, thanks to P. Durante for pointing this out.
llvm-svn: 43602
2007-11-01 04:20:16 +00:00
Owen Anderson fe41d79112 Now with less tabs!
llvm-svn: 43601
2007-11-01 03:54:23 +00:00
Steve Naroff 2f55b98725 Tweak RewriteInterfaceDecl() to generate a typedef (if one hasn't already been generated).
llvm-svn: 43600
2007-11-01 03:35:41 +00:00
Chris Lattner c3ebf29ef6 Implement test/Sema/init.c by treating functions as constants.
llvm-svn: 43599
2007-11-01 02:45:17 +00:00
Dale Johannesen 440f9abab4 Test that expand_vector_elt(v2i64) works in 32-bit mode.
llvm-svn: 43598
2007-11-01 02:38:24 +00:00
Chris Lattner 6ab19ed78d Fix InstCombine/2007-10-31-StringCrash.ll by removing an obvious
(in hindsight) infinite recursion.  Simplify the code.

llvm-svn: 43597
2007-11-01 02:30:35 +00:00
Chris Lattner 74709473ed Fix InstCombine/2007-10-31-RangeCrash.ll
llvm-svn: 43596
2007-11-01 02:18:41 +00:00
Ted Kremenek fb764e52b0 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 df0768e1b1 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
Anders Carlsson 41b7c6b250 Put constant CFStrings in the __DATA,__cfstring section.
llvm-svn: 43593
2007-11-01 00:41:52 +00:00
Anders Carlsson 1e27f9b296 Stub out codegen for __builtin_constant_p. Remove any implicit cast exprs in the call to __builtin___CFStringMakeConstantString.
llvm-svn: 43592
2007-11-01 00:39:26 +00:00
Devang Patel 0b59b45870 Remove unnecessary method.
llvm-svn: 43591
2007-11-01 00:11:37 +00:00
Devang Patel ad175428c6 start adding pading fields.
llvm-svn: 43590
2007-11-01 00:07:12 +00:00
Fariborz Jahanian 7a9c47480d 1) More additions for objective-c's qualifier type.
2) Fixed a test failure (which should have failed all along!).

llvm-svn: 43589
2007-10-31 23:53:01 +00:00
Anders Carlsson e89b84ab29 Fix a typo that prevented pointer-to-int conversions from working.
llvm-svn: 43588
2007-10-31 23:18:02 +00:00
Devang Patel f5fcb9870a Refactor code into a separate method.
llvm-svn: 43587
2007-10-31 23:17:19 +00:00
Fariborz Jahanian c3cda76362 Fixed a bug exposed by fixing the assert in previous patch (one of the tests asserted).
llvm-svn: 43586
2007-10-31 23:08:24 +00:00
Fariborz Jahanian aa9a95ca4f Changed direction of assert. Added more comments.
llvm-svn: 43585
2007-10-31 22:57:04 +00:00
Ted Kremenek 6aff871a84 Implemented more of serialization/deserialization for ASTContext. We now
(hypothetically) read in/write out most of the types.  Bugs likely exist.

llvm-svn: 43584
2007-10-31 22:44:07 +00:00
Ted Kremenek fb41f72916 constified several pointer arguments for methods in the Deserializer.
llvm-svn: 43583
2007-10-31 22:42:03 +00:00
Steve Naroff 9c4fdddd0c Fix two rewriter bugs:
- For @class, don't generate multiple typedefs.
- Handle the following edge case interface...

@interface NSMiddleSpecifier : NSObject {}

@end

...which was incorrectly being rewritten to...

struct _interface_NSMiddleSpecifier {
        struct _interface_NSObject _NSObject;
};
{}

llvm-svn: 43582
2007-10-31 22:11:35 +00:00
Anders Carlsson 0370eb2034 Handle function calls that return aggregate expressions.
llvm-svn: 43581
2007-10-31 22:04:46 +00:00
Fariborz Jahanian d822d68b74 More infrastructure to recognize objective-c's type qualifiers (in,inout, etc.)
llvm-svn: 43580
2007-10-31 21:59:43 +00:00