Daniel Dunbar
d3f3d932ee
IRgen: Add a -fuse-register-sized-bitfield-access option, for testing.
...
- Changes bit-field access policy to try to use (aligned) register sized accesses.
The idea here is that by using larger accesses we expose more coalescing
potential to the backend when we have situations like adjacent bit-fields in the
same structure (which is common), and that the backend should be smart enough to
narrow the accesses down when no coalescing is done or when it is shown not to
be profitable.
--
$ clang -m32 -O3 -S -o - t.c
_f0: ## @f0
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
movb (%eax), %cl
andb $-128, %cl
orb $1, %cl
movb %cl, (%eax)
movb 1(%eax), %cl
andb $-128, %cl
orb $1, %cl
movb %cl, 1(%eax)
movb 2(%eax), %cl
andb $-128, %cl
orb $1, %cl
movb %cl, 2(%eax)
movb 3(%eax), %cl
andb $-128, %cl
orb $1, %cl
movb %cl, 3(%eax)
popl %ebp
ret
$ clang -m32 -O3 -S -o - t.c -Xclang -fuse-register-sized-bitfield-access
_f0: ## @f0
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
movl $-2139062144, %ecx ## imm = 0xFFFFFFFF80808080
andl (%eax), %ecx
orl $16843009, %ecx ## imm = 0x1010101
movl %ecx, (%eax)
popl %ebp
ret
--
llvm-svn: 133532
2011-06-21 18:54:46 +00:00
Douglas Gregor
6ab2fa8f78
Introduce Type::isSignedIntegerOrEnumerationType() and
...
Type::isUnsignedIntegerOrEnumerationType(), which are like
Type::isSignedIntegerType() and Type::isUnsignedIntegerType() but also
consider the underlying type of a C++0x scoped enumeration type.
Audited all callers to the existing functions, switching those that
need to also handle scoped enumeration types (e.g., those that deal
with constant values) over to the new functions. Fixes PR9923 /
<rdar://problem/9447851>.
llvm-svn: 131735
2011-05-20 16:38:50 +00:00
Fariborz Jahanian
fc0fe6eb52
Finish off rules for z-length bitfields in ms_struct
...
structs. // rdar://8823265
llvm-svn: 130783
2011-05-03 20:21:04 +00:00
Fariborz Jahanian
eb39741c0b
More rule enforcement of zero bitfields for ms_struct.
...
llvm-svn: 130696
2011-05-02 17:20:56 +00:00
Fariborz Jahanian
595ec5d43c
Some refactoring of my ms_struct patch.
...
// rdar://8823265 related.
llvm-svn: 130311
2011-04-27 17:14:21 +00:00
Fariborz Jahanian
bcb23a180b
With ms_struct attribut, Zero-length bitfields following
...
non-bitfield members are ignore. // rdar://8823265 wip
llvm-svn: 130257
2011-04-26 23:52:16 +00:00
Ken Dyck
272b6fa0f0
Simplify AppendTailPadding() by converting its parameter to CharUnits. No
...
change in functionality intended.
llvm-svn: 130108
2011-04-24 16:53:44 +00:00
Ken Dyck
7a0b19f978
Eliminate literal 8s from LayoutUnionField by converting NumBytesToAppend to
...
CharUnits. No change in functionality intended.
llvm-svn: 130107
2011-04-24 16:47:33 +00:00
Ken Dyck
345a6de9b4
Eliminate literal 8s from LayoutBitField(), converting variables to
...
CharUnits or replacing the 8s with char align. No change in functionality
intended.
llvm-svn: 130106
2011-04-24 16:40:29 +00:00
Ken Dyck
27337a8800
Convert AccessInfo::AccessAlignment to CharUnits. No change in functionality
...
intended.
llvm-svn: 130087
2011-04-24 10:13:17 +00:00
Ken Dyck
f76759c6fa
Convert CGBitFieldInfo::FieldByteOffset to CharUnits. No change in
...
functionality intended.
llvm-svn: 130085
2011-04-24 10:04:59 +00:00
Anders Carlsson
fcaaa697ec
When laying out bases in, always try the "base subobject" LLVM type. If it
...
turns out that a field or base needs to be laid out in the tail padding of
the base, CGRecordLayoutBuilder::ResizeLastBaseFieldIfNecessary will convert
it to an array of i8.
I've audited the new test results to make sure that they are still valid. I've
also verified that we pass a self-host with this change.
This (finally) fixes PR5589!
llvm-svn: 129673
2011-04-17 21:56:13 +00:00
Anders Carlsson
b6d31e7dcc
Use a SmallVector for field types in CGRecordLayoutBuilder now that llvm::StructType::get takes an ArrayRef.
...
llvm-svn: 129667
2011-04-17 21:32:41 +00:00
Nick Lewycky
d2348d8d3f
Fix typo in comment.
...
llvm-svn: 128088
2011-03-22 17:35:47 +00:00
John McCall
8a3c55567e
A much-delayed response to Ken Dyck's review: make this somewhat more
...
char-width agnostic.
llvm-svn: 126542
2011-02-26 08:41:59 +00:00
Chris Lattner
fb59c7c7d8
improve support for big endian targets, fixing PR8171, patch
...
by Heikki Kultala!
llvm-svn: 125784
2011-02-17 22:09:58 +00:00
John McCall
4d9f14234f
Refactor CGRecordLayoutBuilder to use CharUnits more consistently.
...
llvm-svn: 125605
2011-02-15 22:21:29 +00:00
John McCall
0217dfc2ba
Perform zero-initialization of virtual base classes when emitting
...
a zero constant for a complete class. rdar://problem/8424975
To make this happen, track the field indexes for virtual bases
in the complete object. I'm curious whether we might be better
off making CGRecordLayoutBuilder *much* more reliant on
ASTRecordLayout; we're currently duplicating an awful lot of the ABI
layout logic.
llvm-svn: 125555
2011-02-15 06:40:56 +00:00
Ken Dyck
7ad11e70b6
Convert RecordLayout::Alignment to CharUnits from bit units. No change in
...
functionality intended.
llvm-svn: 125549
2011-02-15 02:32:40 +00:00
Ken Dyck
b0fcc59e19
Add a helper function, ASTContext::toBits(), that converts sizes in
...
CharUnits to sizes in bits, and use it to tidy up the places where the
conversion was done explicitly.
llvm-svn: 125332
2011-02-11 01:54:29 +00:00
Ken Dyck
89d9f360cd
Drop the 'InBits' part from the name of RecordSizeInBits as the value is in
...
character units.
llvm-svn: 125281
2011-02-10 12:36:29 +00:00
Ken Dyck
f18bf0d2e1
Eliminate some signed-to-unsigned comparision warnings introduced in
...
r125156.
llvm-svn: 125280
2011-02-10 12:20:05 +00:00
Ken Dyck
c8ae55050d
Convert RecordLayout::Size to CharUnits from bits. No changes to
...
functionality intended.
llvm-svn: 125156
2011-02-09 01:59:34 +00:00
Ken Dyck
bec0285d7f
Convert RecordLayout::NonVirtualAlign to CharUnits. No change in
...
functionality intended.
llvm-svn: 125069
2011-02-08 02:02:47 +00:00
Ken Dyck
316d6f69bc
Convert RecordLayout::NonVirtualSize from bit units to CharUnits.
...
llvm-svn: 124646
2011-02-01 01:52:10 +00:00
Argyrios Kyrtzidis
648fcbef5b
Fix another obscure corner layout case.
...
llvm-svn: 121436
2010-12-10 00:11:00 +00:00
Anders Carlsson
a518b2a5a1
Add a LayoutBase member function. No functionality change.
...
llvm-svn: 120924
2010-12-04 23:59:48 +00:00
Anders Carlsson
d74cad80b0
Replace calls to AppendBytes with calls to AppendPadding when the bytes appended are padding.
...
llvm-svn: 120922
2010-12-04 23:53:18 +00:00
John McCall
bcd38217f3
CGRecordLayoutBuilder does not need to be exported from this module.
...
llvm-svn: 120489
2010-11-30 23:17:27 +00:00
Anders Carlsson
acf877be12
Don't store the maximum alignment, we can trivially compute it.
...
llvm-svn: 120268
2010-11-28 23:06:23 +00:00
Anders Carlsson
a459adb2ff
More work on laying out virtual bases.
...
llvm-svn: 120257
2010-11-28 19:18:44 +00:00
Anders Carlsson
1f95ee3016
Begin work on actually laying out virtual bases.
...
llvm-svn: 120140
2010-11-25 01:59:35 +00:00
Anders Carlsson
7f95cd1817
Rename RecordLayout::getPrimaryBaseWasVirtual to isPrimaryBaseVirtual.
...
llvm-svn: 120133
2010-11-24 23:12:57 +00:00
Anders Carlsson
4131f00a1f
Add CXXRecordDecl::getIndirectPrimaryBases.
...
llvm-svn: 120129
2010-11-24 22:50:27 +00:00
Anders Carlsson
6277615cbb
Simplify code.
...
llvm-svn: 120109
2010-11-24 19:57:04 +00:00
Anders Carlsson
36e2fa8209
CGRecordLayout types are always struct types.
...
llvm-svn: 120106
2010-11-24 19:37:16 +00:00
Anders Carlsson
39a6b22023
Remove FIXME; we don't ever want to lay out empty bases.
...
llvm-svn: 119957
2010-11-22 00:03:08 +00:00
Anders Carlsson
a7dd96ce77
Rename BaseLLVMType to NonVirtualBaseLLVMType.
...
llvm-svn: 119956
2010-11-21 23:59:45 +00:00
Anders Carlsson
e64fbe2a6c
Add getCGRecordLayout helper function. No functionality change.
...
llvm-svn: 119955
2010-11-21 23:56:06 +00:00
Nick Lewycky
30d939681c
Remove debugging printf.
...
Fix linux build.
llvm-svn: 118497
2010-11-09 09:53:02 +00:00
Anders Carlsson
c1351cac17
Introduce the concept of a non-virtual base type to CGRecordLayoutBuilder as a first step towards fixing PR6995.
...
llvm-svn: 118491
2010-11-09 05:25:47 +00:00
Anders Carlsson
fd88a6160d
Rename getBaseClassOffset to getBaseClassOffsetInBits and introduce a getBaseClassOffset which returns the offset in CharUnits. Do the same thing for getVBaseClassOffset.
...
llvm-svn: 117881
2010-10-31 23:22:37 +00:00
Daniel Dunbar
c7f9bbafe4
IRgen: Move CGBitFieldInfo strategy computation helpers to static member
...
functions.
llvm-svn: 112913
2010-09-02 23:53:28 +00:00
John McCall
614dbdcd55
Go back to asking CodeGenTypes whether a type is zero-initializable.
...
Make CGT defer to the ABI on all member pointer types.
This requires giving CGT a handle to the ABI.
It's way easier to make that work if we avoid lazily creating the ABI.
Make it so.
llvm-svn: 111786
2010-08-22 21:01:12 +00:00
Daniel Dunbar
401304462a
AST: Rename PragmaPackAttr to MaxFieldAlignmentAttr, which is more accurate.
...
llvm-svn: 104795
2010-05-27 01:12:46 +00:00
Anders Carlsson
be48c548c5
Correctly initialize bases with member pointers. This should fix PR6441 but that test case is a bit weird and I'd like to investigate further before closing that bug.
...
llvm-svn: 104025
2010-05-18 16:51:41 +00:00
Anders Carlsson
061ca524b7
Keep track of the LLVM field numbers for non-virtual bases.
...
llvm-svn: 104013
2010-05-18 05:22:06 +00:00
Anders Carlsson
af9e5afe54
Start laying out bases as individual fields. We still use ugly i8 arrays but this is a step in the right direction.
...
llvm-svn: 104012
2010-05-18 05:12:20 +00:00
Anders Carlsson
58fe1756fb
Use a more appropriate LLVM type for the vtable pointer.
...
llvm-svn: 103078
2010-05-05 05:47:36 +00:00
Daniel Dunbar
5981377698
IRgen: Fix another case where we generated an invalid access component when we
...
immediately narrowed the access size. Fix this (and previous case) by just
choosing a better access size up-front.
llvm-svn: 102068
2010-04-22 15:22:33 +00:00