Anders Carlsson
6ba38151f7
Simplify wide bit-field layout in CGRecordLayoutBuilder, and also fix a bug where assigning to a bit-field member would overwrite other parts of the struct.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101681 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 22:54:57 +00:00
Anders Carlsson
d62328e6a0
Unnamed bit-fields in a union should be laid out with a type that doesn't affect alignment.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101673 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 21:04:52 +00:00
Anders Carlsson
86664465ba
Factor union field layout code out into a separate function. No functionality change.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101671 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 20:49:27 +00:00
Anders Carlsson
046c294a43
Vtable -> VTable renames across the board.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101666 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 20:15:18 +00:00
Anders Carlsson
1c7658fd32
Make CGRecordLayoutBuilder deal with wide bit-fields. Will land tests shortly (Daniel, please review).
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101472 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 16:23:02 +00:00
Daniel Dunbar
2df2569679
IRgen: Change CGBitFieldInfo to take the AccessInfo as constructor arguments, it is now an immutable object.
...
Also, add some checking of various invariants that should hold on the CGBitFieldInfo access.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101345 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 05:09:32 +00:00
Daniel Dunbar
7fb6195004
IRgen: Eliminate now unused fields from CGBitFieldInfo.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101344 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 05:09:28 +00:00
Daniel Dunbar
ab970f90ce
IRgen: Enhance CGBitFieldInfo with enough information to fully describe the "policy" with which a bit-field should be accessed.
...
- For now, these policies are computed to match the current IRgen strategy, although the new information isn't being used yet (except in -fdump-record-layouts).
- Design comments appreciated.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101178 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 20:58:55 +00:00
Daniel Dunbar
9b28daf9b6
IRgen: Factor out ComputeBitFieldInfo.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101066 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 21:01:28 +00:00
Daniel Dunbar
93c62967d4
IRgen: Add CGRecordLayout::dump, and dump (irgen) record layouts as part of -fdump-record-layouts.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101051 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 18:14:18 +00:00
Daniel Dunbar
7f2896406c
IRgen: Move the bit-field access type into CGBitFieldInfo, and change bit-field LValues to just store the base address of object containing the bit-field.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100745 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-08 02:59:45 +00:00
Daniel Dunbar
efbf487da8
IRgen: Move BitFieldIsSigned bit into CGBitFieldInfo.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100513 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-06 01:07:44 +00:00
Daniel Dunbar
c7a984af71
Simplify.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100512 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-06 01:07:41 +00:00
Daniel Dunbar
2eec0b2e3e
IRgen: Lift BitFieldInfo to CGBitFieldInfo at namespace level.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100433 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-05 16:20:44 +00:00
Daniel Dunbar
198bcb44b6
IRGen: Move the auxiliary data structures tracking AST -> LLVM mappings out of CodeGenTypes, to per-record CGRecordLayout structures.
...
- I did a cursory check that this was perf neutral, FWIW.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99978 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-31 01:09:11 +00:00
Daniel Dunbar
490fc90271
CGRecordLayoutBuilder: Switch unions to use same mechanism for tracking field and bit-field info as structs.
...
- Anders, please check.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99977 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-31 00:55:13 +00:00
Daniel Dunbar
270e203b50
IRGen: Hide CGRecordLayoutBuilder class, because I can.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99967 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-31 00:11:27 +00:00
Daniel Dunbar
2924ade97e
IRgen: Move CGRecordLayout to its own happy little file.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99945 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 22:26:10 +00:00
Anders Carlsson
2c12d0319a
Improve handling of emitting 'null' pointers to data members.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95066 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-02 05:17:25 +00:00
Anders Carlsson
21fd7d7347
Fix an incorrect union layout assert. Fixes PR6164.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94754 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 18:22:03 +00:00
Anders Carlsson
4b3e5be334
Baby steps towards fixing PR5589. If a class needs a vtable pointer, add one.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91545 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 17:27:20 +00:00
Anders Carlsson
c2456824a1
No need to add tail padding if the resulting LLVM struct type will have the same size as the final record size.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90820 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 01:24:23 +00:00
Anders Carlsson
1a5e0d7f18
Have ASTRecordLayout keep track of the key function, in preparation of fixing a synthetic ctor/dtor bug.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90168 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-30 23:41:22 +00:00
Mike Stump
a84b4044b7
Fixup key function calculations.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89412 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20 00:02:19 +00:00
Mike Stump
88bd0094d8
This doesn't work yet.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89307 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 03:53:54 +00:00
Fariborz Jahanian
e504170f68
Prevent a code gen. crash on empty unions - pr5408.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86287 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 20:47:40 +00:00
Anders Carlsson
5017a157c6
Store the key function of a record decl inside CGRecordLayout.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83900 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-12 21:16:22 +00:00
Mike Stump
1eb4433ac4
Remove tabs, and whitespace cleanups.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 15:08:12 +00:00
Anders Carlsson
366200045f
If the alignment of the chosen field in a union is greater than the alignment of the union, we need to use a packed LLVM struct. Fixes <rdar://problem/7184250>.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 22:56:02 +00:00
Anders Carlsson
d0eb3b93e8
Packed unions should be packed. Fixes an assert Daniel reported.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80808 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 17:51:33 +00:00
Anders Carlsson
fc3eaa47fa
More work towards zero-initializing structs that contain member pointers in constant expressions.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79805 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 01:25:01 +00:00
Anders Carlsson
341bdf8d56
Remove the PaddingFields member from CGRecordLayout, it wasn't used anyway.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79799 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 01:01:04 +00:00
Owen Anderson
0032b2781b
Update for LLVM API change.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78946 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-13 21:57:51 +00:00
Anders Carlsson
a5dd722bdf
Take #pragma pack into account when laying out structs. Fixes rdar://problem/7095436.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78490 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-08 19:38:24 +00:00
Anders Carlsson
a860e755f1
Introduce a new PragmaPack attribute, and use it for #pragma pack. The PackedAttr now only represents __attribute__((packed)).
...
This is necessary because #pragma pack and __attribute__((packed)) have different semantics. No functionality change yet, but this lays the groundwork for fixing a record layout bug.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78483 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-08 18:23:56 +00:00
Anders Carlsson
df31e09112
Assert that the LLVM type has the same size as the RecordDecl size.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78481 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-08 18:01:57 +00:00
Owen Anderson
47a434ff3d
Update for LLVM API change.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 23:18:46 +00:00
Anders Carlsson
de9f2c937a
Simplify alignment handling in the record builder.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78069 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-04 16:29:15 +00:00
Fariborz Jahanian
8a8a629844
No longer need to keep base class offsets in the offset
...
table as it has its own place now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77491 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 18:50:06 +00:00
Anders Carlsson
c2cc1d5e29
More CGRecordLayoutBuilder cleanup.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77335 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 17:56:36 +00:00
Fariborz Jahanian
cad8665394
Some minor changes toward support of data
...
member access in the presense of non-virtual bases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77246 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 20:57:45 +00:00
Anders Carlsson
abdad358b5
Enable the new struct type builder now that the constant struct builder works. (The old code will still be there until we know that everything works well.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77190 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 15:31:55 +00:00
Anders Carlsson
c1efe36ca7
Fix a tail padding bug in the record layout builder code. The bug was found by an existing test.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77189 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 14:55:54 +00:00
Anders Carlsson
4c98efdf06
Check in a half finished new constant struct builder (Obviously not used yet).
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76969 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 15:20:52 +00:00
Anders Carlsson
728d7cd2e2
Get rid of the size parameter to AppendField. No functionality change.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76931 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 02:45:50 +00:00
Anders Carlsson
94ae95f17e
Don't just store the field/bit field info one field, do it for all fields in the union.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76907 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 22:52:34 +00:00
Anders Carlsson
177d4d8700
Fix another thinko.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76903 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 21:52:03 +00:00
Anders Carlsson
faaec2234f
Correct a thinko in bitfield layout code. Fixes PR4611.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76898 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 21:16:33 +00:00
Anders Carlsson
4b5584b38b
We don't need to keep track of the packed alignment, just whether the struct is packed or not. Fixes PR4610.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76884 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 17:24:40 +00:00
Anders Carlsson
8330ceeebb
Move the LLVM field number for bit fields into the BitFieldInfo structure, since it's meaning is completely different than for non-bit fields.
...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76882 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 17:01:21 +00:00