summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGRecordLayoutBuilder.cpp
Commit message (Collapse)AuthorAge
...
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-23
| | | | | | | | | 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
* de-constify llvm::Type, patch by David Blaikie!Chris Lattner2011-07-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135370 91177308-0d34-0410-b5e6-96231b3b80d8
* clang side to match the LLVM IR type system rewrite patch.Chris Lattner2011-07-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134831 91177308-0d34-0410-b5e6-96231b3b80d8
* IRgen: Add a -fuse-register-sized-bitfield-access option, for testing.Daniel Dunbar2011-06-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* Introduce Type::isSignedIntegerOrEnumerationType() andDouglas Gregor2011-05-20
| | | | | | | | | | | | | | 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
* Finish off rules for z-length bitfields in ms_structFariborz Jahanian2011-05-03
| | | | | | | structs. // rdar://8823265 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130783 91177308-0d34-0410-b5e6-96231b3b80d8
* More rule enforcement of zero bitfields for ms_struct.Fariborz Jahanian2011-05-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130696 91177308-0d34-0410-b5e6-96231b3b80d8
* Some refactoring of my ms_struct patch.Fariborz Jahanian2011-04-27
| | | | | | | // rdar://8823265 related. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130311 91177308-0d34-0410-b5e6-96231b3b80d8
* With ms_struct attribut, Zero-length bitfields following Fariborz Jahanian2011-04-26
| | | | | | | 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
* Simplify AppendTailPadding() by converting its parameter to CharUnits. NoKen Dyck2011-04-24
| | | | | | | change in functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130108 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate literal 8s from LayoutUnionField by converting NumBytesToAppend toKen Dyck2011-04-24
| | | | | | | CharUnits. No change in functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130107 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate literal 8s from LayoutBitField(), converting variables toKen Dyck2011-04-24
| | | | | | | | 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
* Convert AccessInfo::AccessAlignment to CharUnits. No change in functionalityKen Dyck2011-04-24
| | | | | | | intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130087 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert CGBitFieldInfo::FieldByteOffset to CharUnits. No change inKen Dyck2011-04-24
| | | | | | | functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130085 91177308-0d34-0410-b5e6-96231b3b80d8
* When laying out bases in, always try the "base subobject" LLVM type. If itAnders Carlsson2011-04-17
| | | | | | | | | | | | | | | 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
* Use a SmallVector for field types in CGRecordLayoutBuilder now that ↵Anders Carlsson2011-04-17
| | | | | | llvm::StructType::get takes an ArrayRef. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129667 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typo in comment.Nick Lewycky2011-03-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128088 91177308-0d34-0410-b5e6-96231b3b80d8
* A much-delayed response to Ken Dyck's review: make this somewhat moreJohn McCall2011-02-26
| | | | | | | | char-width agnostic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126542 91177308-0d34-0410-b5e6-96231b3b80d8
* improve support for big endian targets, fixing PR8171, patchChris Lattner2011-02-17
| | | | | | | by Heikki Kultala! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125784 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor CGRecordLayoutBuilder to use CharUnits more consistently.John McCall2011-02-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125605 91177308-0d34-0410-b5e6-96231b3b80d8
* Perform zero-initialization of virtual base classes when emitting John McCall2011-02-15
| | | | | | | | | | | | | | 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
* Convert RecordLayout::Alignment to CharUnits from bit units. No change inKen Dyck2011-02-15
| | | | | | | functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125549 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a helper function, ASTContext::toBits(), that converts sizes inKen Dyck2011-02-11
| | | | | | | | 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
* Drop the 'InBits' part from the name of RecordSizeInBits as the value is inKen Dyck2011-02-10
| | | | | | | character units. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125281 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate some signed-to-unsigned comparision warnings introduced inKen Dyck2011-02-10
| | | | | | | r125156. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125280 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert RecordLayout::Size to CharUnits from bits. No changes toKen Dyck2011-02-09
| | | | | | | functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125156 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert RecordLayout::NonVirtualAlign to CharUnits. No change inKen Dyck2011-02-08
| | | | | | | functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125069 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert RecordLayout::NonVirtualSize from bit units to CharUnits.Ken Dyck2011-02-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124646 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix another obscure corner layout case.Argyrios Kyrtzidis2010-12-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121436 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a LayoutBase member function. No functionality change.Anders Carlsson2010-12-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120924 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace calls to AppendBytes with calls to AppendPadding when the bytes ↵Anders Carlsson2010-12-04
| | | | | | appended are padding. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120922 91177308-0d34-0410-b5e6-96231b3b80d8
* CGRecordLayoutBuilder does not need to be exported from this module.John McCall2010-11-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120489 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't store the maximum alignment, we can trivially compute it.Anders Carlsson2010-11-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120268 91177308-0d34-0410-b5e6-96231b3b80d8
* More work on laying out virtual bases.Anders Carlsson2010-11-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120257 91177308-0d34-0410-b5e6-96231b3b80d8
* Begin work on actually laying out virtual bases.Anders Carlsson2010-11-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120140 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename RecordLayout::getPrimaryBaseWasVirtual to isPrimaryBaseVirtual.Anders Carlsson2010-11-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120133 91177308-0d34-0410-b5e6-96231b3b80d8
* Add CXXRecordDecl::getIndirectPrimaryBases.Anders Carlsson2010-11-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120129 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify code.Anders Carlsson2010-11-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120109 91177308-0d34-0410-b5e6-96231b3b80d8
* CGRecordLayout types are always struct types.Anders Carlsson2010-11-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120106 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove FIXME; we don't ever want to lay out empty bases.Anders Carlsson2010-11-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119957 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename BaseLLVMType to NonVirtualBaseLLVMType.Anders Carlsson2010-11-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119956 91177308-0d34-0410-b5e6-96231b3b80d8
* Add getCGRecordLayout helper function. No functionality change.Anders Carlsson2010-11-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119955 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove debugging printf.Nick Lewycky2010-11-09
| | | | | | | Fix linux build. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118497 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce the concept of a non-virtual base type to CGRecordLayoutBuilder as ↵Anders Carlsson2010-11-09
| | | | | | a first step towards fixing PR6995. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118491 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename getBaseClassOffset to getBaseClassOffsetInBits and introduce a ↵Anders Carlsson2010-10-31
| | | | | | 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
* IRgen: Move CGBitFieldInfo strategy computation helpers to static memberDaniel Dunbar2010-09-02
| | | | | | functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112913 91177308-0d34-0410-b5e6-96231b3b80d8
* Go back to asking CodeGenTypes whether a type is zero-initializable.John McCall2010-08-22
| | | | | | | | | | | 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
* AST: Rename PragmaPackAttr to MaxFieldAlignmentAttr, which is more accurate.Daniel Dunbar2010-05-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104795 91177308-0d34-0410-b5e6-96231b3b80d8
* Correctly initialize bases with member pointers. This should fix PR6441 but ↵Anders Carlsson2010-05-18
| | | | | | that test case is a bit weird and I'd like to investigate further before closing that bug. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104025 91177308-0d34-0410-b5e6-96231b3b80d8
* Keep track of the LLVM field numbers for non-virtual bases.Anders Carlsson2010-05-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104013 91177308-0d34-0410-b5e6-96231b3b80d8