Commit Graph

50 Commits

Author SHA1 Message Date
Devang Patel ec51171319 Add assert for the case that is not handled.
struct { char a; short b:2; };

llvm-svn: 43859
2007-11-08 00:32:12 +00:00
Devang Patel 7c7a07d949 Keep track of beginning offset for the bit field that does not start at byte boundry.
llvm-svn: 43857
2007-11-08 00:17:59 +00:00
Devang Patel ef2d838fef Stay within 80 columns.
llvm-svn: 43843
2007-11-07 21:04:59 +00:00
Devang Patel b1ecfc6e25 Start struct bit field laout work.
This is far from complete.

llvm-svn: 43801
2007-11-07 01:57:13 +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
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
Devang Patel f5fcb9870a Refactor code into a separate method.
llvm-svn: 43587
2007-10-31 23:17:19 +00:00
Devang Patel 6029cbf872 Check whether next slot meets field type's alignment requirements.
If it does not then assert at the moment.

llvm-svn: 43576
2007-10-31 21:01:37 +00:00
Devang Patel 1c8788bbd0 Keep track of field offsets during structure layout.
Take 2.

llvm-svn: 43573
2007-10-31 20:08:22 +00:00
Devang Patel 75ef2f0b45 Take 2.
Make target info available to clang code generator.  This is far from complete but this helps clang codegen module make progress.

At the moment target triplet and target description strings are hard coded in clang::TargetInfo

llvm-svn: 43572
2007-10-31 20:01:01 +00:00
Chris Lattner 5087e267c2 temporarily revert devang's patch to link in the llvm codegen etc.
llvm-svn: 43544
2007-10-31 04:53:03 +00:00
Devang Patel df62bc067a Keep track of field offsets during structure layout.
llvm-svn: 43539
2007-10-31 01:23:10 +00:00
Devang Patel 46c7003052 Make target info available to clang code generator.
This is far from complete but this helps clang codegen module
make progress.

llvm-svn: 43536
2007-10-31 00:59:29 +00:00
Devang Patel 82ae5f255f Avoid unnecessary PATypeHolder copy.
llvm-svn: 43530
2007-10-30 23:22:14 +00:00
Devang Patel ffe1e218f2 Fix 80 col violations.
llvm-svn: 43516
2007-10-30 20:59:40 +00:00
Devang Patel f5bda316c5 Use
+  llvm::DenseMap<Type *, llvm::PATypeHolder> TypeHolderMap;
instead of
-  llvm::DenseMap<Type *, llvm::PATypeHolder *> TypeHolderMap;

llvm-svn: 43514
2007-10-30 20:46:47 +00:00
Devang Patel 134b3f4b55 Add RecordOrganizer::layoutUnionFields()
llvm-svn: 43472
2007-10-29 20:50:19 +00:00
Devang Patel ed93c3c3b3 Codegen union member references.
llvm-svn: 43390
2007-10-26 19:42:18 +00:00
Devang Patel 29e3824453 Cache llvm::Type through PATypeHolder.
llvm-svn: 43355
2007-10-25 18:32:36 +00:00
Devang Patel bc50aab635 Move RecordOrganizer into CodeGenTypes.cpp
llvm-svn: 43310
2007-10-24 20:38:06 +00:00
Devang Patel ea37aa7d64 Constify methods and reuse RecordOrganizer object.
llvm-svn: 43284
2007-10-24 00:56:23 +00:00
Devang Patel f2423473b1 Add notes.
llvm-svn: 43282
2007-10-24 00:32:16 +00:00
Devang Patel c4e224e59c untabify
llvm-svn: 43280
2007-10-24 00:26:24 +00:00
Hartmut Kaiser 5277af121a Fixed a strange construct, please review.
llvm-svn: 43278
2007-10-24 00:07:36 +00:00
Devang Patel 65c4afb940 Handle nested structs.
typdef struct A { int i; struct A *next; } A

llvm-svn: 43268
2007-10-23 23:26:46 +00:00
Devang Patel 3e11ccea96 Begin struct layout work.
llvm-svn: 43236
2007-10-23 02:10:49 +00:00
Fariborz Jahanian da6c012ee7 Added a new class for Interfaces qualified by protocol list.
Protocols are now sorted and made unique in the list.
Enhanced pretty printer for @interface (So, I can see the protocol list).

llvm-svn: 42776
2007-10-08 23:06:41 +00:00
Chris Lattner 793d10ca38 fix some warnings, patch by Justin Handville
llvm-svn: 42010
2007-09-16 19:23:47 +00:00
Chris Lattner fb2eb6941a eliminate some VC++ warnings, patch contributed by Hartmut Kaiser
llvm-svn: 41692
2007-09-04 02:34:27 +00:00
Steve Naroff 5c13180a27 Fix the following redefinition errors submitted by Keith Bauer...
[dylan:~/llvm/tools/clang] admin% cat tentative_decls.c 
// incorrectly generates redefinition error
extern int array[3];
int array[3];

// incorrectly generates a redefinition error
extern void nup(int a[3]);
void nup(int a[3]) {}

It turns out that this exposed a fairly major flaw in the type system,
array types were never getting uniqued! This is because all array types
contained an expression, which aren't unique.

To solve this, we now have 2 array types, ConstantArrayType and
VariableArrayType. ConstantArrayType's are unique, VAT's aren't.

This is a fairly extensive set of fundamental changes. Fortunately,
all the tests pass. Nevertheless, there may be some collateral damage:-)
If so, let me know!

llvm-svn: 41592
2007-08-30 01:06:46 +00:00
Chris Lattner 1c1f932433 Change EnumDecl to store its corresponding integer type
directly in it.  Remove TargetInfo::getEnumPolicy, as there is only
one policy that we support right now.

llvm-svn: 41548
2007-08-28 18:24:31 +00:00
Chris Lattner 304ff47b1a teach codegen to lay out enum types.
llvm-svn: 41501
2007-08-27 17:44:34 +00:00
Chris Lattner e7a160b37d int X[] isn't a VLA. This improves support for stdio.h on darwin.
llvm-svn: 41423
2007-08-26 05:02:07 +00:00
Chris Lattner 57c269b5d3 implement rudimentary union layout support.
llvm-svn: 41421
2007-08-26 04:50:19 +00:00
Anders Carlsson b04ea61b79 Implement code generation for constant CFStrings.
llvm-svn: 41206
2007-08-21 00:21:21 +00:00
Anders Carlsson f087c0c1c6 Add preliminary support for converting struct types.
llvm-svn: 41145
2007-08-17 22:00:32 +00:00
Chris Lattner acbd22aaec silence some warnings.
llvm-svn: 40761
2007-08-02 21:50:34 +00:00
Chris Lattner 2ac26568d4 silence a warning by treating ocuvectors the same as vectors.
llvm-svn: 40037
2007-07-19 05:13:51 +00:00
Chris Lattner 0e9d6226ca Refactor code so that isIntegerConstantExpr has an ASTContext available.
llvm-svn: 39884
2007-07-15 23:26:56 +00:00
Chris Lattner 4481b428db A significant refactoring of the type size stuff to also
compute type alignment.  This info is needed for struct layout.

llvm-svn: 39850
2007-07-14 01:29:45 +00:00
Chris Lattner d2b88ab313 Implement codegen for + and - with pointers. Patch contributed by
Keith Bauer.

llvm-svn: 39793
2007-07-13 03:05:23 +00:00
Chris Lattner 6eea886b9e implement support for llvm codegen of vectors. That was much easier than
I expected :)

llvm-svn: 39720
2007-07-10 00:23:39 +00:00
Chris Lattner c8c3dadaa0 fix codegen of void-returning functions
llvm-svn: 39693
2007-06-27 18:08:49 +00:00
Chris Lattner 54fb19efaa implement support for struct and complex returns.
llvm-svn: 39674
2007-06-22 22:02:34 +00:00
Chris Lattner c6395936ae Split complex types out from being members of BuiltinType to being their own
types.

llvm-svn: 39672
2007-06-22 20:56:16 +00:00
Chris Lattner f033c147c9 remove location tracking for target info
llvm-svn: 39671
2007-06-22 19:05:19 +00:00
Chris Lattner 3e3a1e9cda implement lowering of complex types
llvm-svn: 39668
2007-06-22 18:15:26 +00:00
Chris Lattner e1e93a5e5d assert, don't crash, on int[]
llvm-svn: 39664
2007-06-20 17:12:11 +00:00
Chris Lattner 2052bc8107 Split type analysis out to its own file, now the integer constant expr evaluation
is ready.

llvm-svn: 39660
2007-06-16 00:12:05 +00:00