Граф коммитов

117 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor bcfd1f55bf Extend the ASTContext constructor to delay the initialization of
builtin types (When requested). This is another step toward making
ASTUnit build the ASTContext as needed when loading an AST file,
rather than doing so after the fact. No actual functionality change (yet).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138985 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-02 00:18:52 +00:00
Chris Lattner c1c20114a4 switch clang to use the new-new way of creating llvm::StructType's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137472 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-12 17:43:31 +00:00
Chris Lattner 5f9e272e63 remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23 10:55:15 +00:00
Chris Lattner 2acc6e3fed de-constify llvm::Type, patch by David Blaikie!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135370 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 04:24:23 +00:00
Chris Lattner 9cbe4f0ba0 clang side to match the LLVM IR type system rewrite patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134831 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 17:41:47 +00:00
Daniel Dunbar e26bdb91b7 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
--

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133532 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-21 18:54:46 +00:00
Douglas Gregor 575a1c9dc8 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>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131735 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-20 16:38:50 +00:00
Fariborz Jahanian 855a8e79f4 Finish off rules for z-length bitfields in ms_struct
structs. // rdar://8823265


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130783 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-03 20:21:04 +00:00
Fariborz Jahanian 340fa24213 More rule enforcement of zero bitfields for ms_struct.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130696 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-02 17:20:56 +00:00
Fariborz Jahanian 14d56ef43f Some refactoring of my ms_struct patch.
// rdar://8823265 related.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130311 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-27 17:14:21 +00:00
Fariborz Jahanian 62055b0618 With ms_struct attribut, Zero-length bitfields following
non-bitfield members are ignore. // rdar://8823265 wip


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130257 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-26 23:52:16 +00:00
Ken Dyck 3256de709a Simplify AppendTailPadding() by converting its parameter to CharUnits. No
change in functionality intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130108 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-24 16:53:44 +00:00
Ken Dyck 737978d336 Eliminate literal 8s from LayoutUnionField by converting NumBytesToAppend to
CharUnits. No change in functionality intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130107 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-24 16:47:33 +00:00
Ken Dyck edda6e4327 Eliminate literal 8s from LayoutBitField(), converting variables to
CharUnits or replacing the 8s with char align. No change in functionality
intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130106 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-24 16:40:29 +00:00
Ken Dyck b9e6b2c215 Convert AccessInfo::AccessAlignment to CharUnits. No change in functionality
intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130087 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-24 10:13:17 +00:00
Ken Dyck 28ebde58dd Convert CGBitFieldInfo::FieldByteOffset to CharUnits. No change in
functionality intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130085 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-24 10:04:59 +00:00
Anders Carlsson eb9d81dff9 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!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129673 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-17 21:56:13 +00:00
Anders Carlsson 2786a81415 Use a SmallVector for field types in CGRecordLayoutBuilder now that llvm::StructType::get takes an ArrayRef.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129667 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-17 21:32:41 +00:00
Nick Lewycky c3e494047b Fix typo in comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128088 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22 17:35:47 +00:00
John McCall 92ee7ca6f4 A much-delayed response to Ken Dyck's review: make this somewhat more
char-width agnostic.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126542 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-26 08:41:59 +00:00
Chris Lattner d8df5b65fc improve support for big endian targets, fixing PR8171, patch
by Heikki Kultala!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125784 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-17 22:09:58 +00:00
John McCall fd577d6b71 Refactor CGRecordLayoutBuilder to use CharUnits more consistently.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125605 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-15 22:21:29 +00:00
John McCall 9b7da1c46d 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125555 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-15 06:40:56 +00:00
Ken Dyck dac54c124e Convert RecordLayout::Alignment to CharUnits from bit units. No change in
functionality intended. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125549 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-15 02:32:40 +00:00
Ken Dyck dd76a9ab9e 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125332 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11 01:54:29 +00:00
Ken Dyck 9186ff310c Drop the 'InBits' part from the name of RecordSizeInBits as the value is in
character units.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125281 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 12:36:29 +00:00
Ken Dyck 7198e94d55 Eliminate some signed-to-unsigned comparision warnings introduced in
r125156.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125280 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 12:20:05 +00:00
Ken Dyck 5f022d8269 Convert RecordLayout::Size to CharUnits from bits. No changes to
functionality intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125156 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 01:59:34 +00:00
Ken Dyck 68cf1a5a01 Convert RecordLayout::NonVirtualAlign to CharUnits. No change in
functionality intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125069 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 02:02:47 +00:00
Ken Dyck 5c3633fa57 Convert RecordLayout::NonVirtualSize from bit units to CharUnits.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124646 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-01 01:52:10 +00:00
Argyrios Kyrtzidis db2b42fb4d Fix another obscure corner layout case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121436 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 00:11:00 +00:00
Anders Carlsson 860453c4b4 Add a LayoutBase member function. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120924 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 23:59:48 +00:00
Anders Carlsson 57d2d236d2 Replace calls to AppendBytes with calls to AppendPadding when the bytes appended are padding.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120922 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 23:53:18 +00:00
John McCall d0de0ce304 CGRecordLayoutBuilder does not need to be exported from this module.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120489 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 23:17:27 +00:00
Anders Carlsson fc86d55b6b Don't store the maximum alignment, we can trivially compute it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120268 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-28 23:06:23 +00:00
Anders Carlsson 1d7dc22407 More work on laying out virtual bases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120257 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-28 19:18:44 +00:00
Anders Carlsson 8f2c6899dd Begin work on actually laying out virtual bases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120140 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-25 01:59:35 +00:00
Anders Carlsson c9e814ba19 Rename RecordLayout::getPrimaryBaseWasVirtual to isPrimaryBaseVirtual.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120133 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24 23:12:57 +00:00
Anders Carlsson 46170f9c7d Add CXXRecordDecl::getIndirectPrimaryBases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120129 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24 22:50:27 +00:00
Anders Carlsson 3379e9bd71 Simplify code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120109 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24 19:57:04 +00:00
Anders Carlsson ba2c2eec87 CGRecordLayout types are always struct types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120106 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24 19:37:16 +00:00
Anders Carlsson a03613d6e3 Remove FIXME; we don't ever want to lay out empty bases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119957 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-22 00:03:08 +00:00
Anders Carlsson 9a5a3f2f3b Rename BaseLLVMType to NonVirtualBaseLLVMType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119956 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-21 23:59:45 +00:00
Anders Carlsson f4a15b0df4 Add getCGRecordLayout helper function. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119955 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-21 23:56:06 +00:00
Nick Lewycky cb0511cc29 Remove debugging printf.
Fix linux build.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118497 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 09:53:02 +00:00
Anders Carlsson 3d155e683a Introduce the concept of a non-virtual base type to CGRecordLayoutBuilder as a first step towards fixing PR6995.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118491 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 05:25:47 +00:00
Anders Carlsson a14f597957 Rename getBaseClassOffset to getBaseClassOffsetInBits and introduce a getBaseClassOffset which returns the offset in CharUnits. Do the same thing for getVBaseClassOffset.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117881 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-31 23:22:37 +00:00
Daniel Dunbar e7a80bd66a IRgen: Move CGBitFieldInfo strategy computation helpers to static member
functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112913 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 23:53:28 +00:00
John McCall f16aa103d3 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111786 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 21:01:12 +00:00
Daniel Dunbar 8a2c92cab2 AST: Rename PragmaPackAttr to MaxFieldAlignmentAttr, which is more accurate.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104795 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-27 01:12:46 +00:00