Commit Graph

5727 Commits

Author SHA1 Message Date
Chris Lattner 00a10caeb6 improve the code that handles IR generation of byte-sized string literals to avoid
allocating an std::string.

llvm-svn: 149924
2012-02-06 22:47:00 +00:00
Chris Lattner 3def9aeaff use cheaper llvm APIs for various bits of IR generation.
llvm-svn: 149916
2012-02-06 22:16:34 +00:00
Chris Lattner 72977a18db simplify code and smallvectorize.
llvm-svn: 149915
2012-02-06 22:00:56 +00:00
Devang Patel 60fc242545 Let an ivar directly refer property TAG.
llvm-svn: 149881
2012-02-06 18:20:02 +00:00
Craig Topper 5b5935d17d Fix vector splat casts to cast element to the appropriate vector element before inserting into the vector. Fixes PR11930.
llvm-svn: 149855
2012-02-06 05:05:50 +00:00
Chris Lattner 9c81833c8d reapply the patches reverted in r149477, which enable ConstantDataArray.
llvm-svn: 149801
2012-02-05 02:30:40 +00:00
Dylan Noblesmith 2c1dd2716a Basic: import SmallString<> into clang namespace
(I was going to fix the TODO about DenseMap too, but
that would break self-host right now. See PR11922.)

llvm-svn: 149799
2012-02-05 02:13:05 +00:00
Dylan Noblesmith e27789991d Basic: import OwningPtr<> into clang namespace
llvm-svn: 149798
2012-02-05 02:12:40 +00:00
Bob Wilson 49708d41a6 Preserve alignment for Neon vld1_lane/dup and vst1_lane intrinsics.
We had been generating load/store instructions with the default alignment
for the vector element type, even when the pointer argument had less alignment.
<rdar://problem/10538555>

llvm-svn: 149794
2012-02-04 23:58:08 +00:00
Benjamin Kramer 3307c508c9 Move various diagnostic operator<< overloads out of line and remove includes of Diagnostic.h.
Fix all the files that depended on transitive includes of Diagnostic.h.
With this patch in place changing a diagnostic no longer requires a full rebuild of the StaticAnalyzer.

llvm-svn: 149781
2012-02-04 12:31:12 +00:00
Devang Patel a21bbb2423 Create new tag for the property. This is a work in progress.
llvm-svn: 149734
2012-02-04 01:15:04 +00:00
Bob Wilson 14adb360a7 Fix -ftrap-function fallout from llvm r145714. <rdar://problem/10799325>
That llvm change removed the -trap-func backend option, so that using
-ftrap-function with clang would cause the backend to complain.  Fix it
by adding the trap function name to the CodeGenOptions and passing it through
to the TargetOptions.

llvm-svn: 149679
2012-02-03 06:27:22 +00:00
Andrew Trick 877d5a712d unnecessary include of TargetMachine.h?
llvm-svn: 149638
2012-02-02 22:36:19 +00:00
Alexander Potapenko ef41fd31d4 Move the code that sets the AddressSafety
attribute into CodeGenModule::SetLLVMFunctionAttributesForDefinition().

Previously it resided in CodeGenModule::GetOrCreateLLVMFunction, which
for some reason wasn't called for ObjC class methods, see
http://code.google.com/p/address-sanitizer/issues/detail?id=33

llvm-svn: 149605
2012-02-02 11:49:28 +00:00
Eric Christopher c9e6924fb2 r149474 went a bit too far when combined with type caching. If we want
a full type go ahead and emit it if we currently only have a forward
declaration.

Fixes gdb bots for gdb1090.exp and call-ar-st.exp.

llvm-svn: 149560
2012-02-01 23:39:00 +00:00
Eric Christopher 25a11e6dbd Remove duplicated comment.
llvm-svn: 149544
2012-02-01 21:48:10 +00:00
Eric Christopher 034ba7e487 Fix comment.
llvm-svn: 149543
2012-02-01 21:44:56 +00:00
Douglas Gregor c48190c10a Add missing dependency to unbreak the CMake build
llvm-svn: 149531
2012-02-01 19:53:01 +00:00
David Chisnall af066bbb1f size() == 0 -> empty().
Spotted by rjmcall.

llvm-svn: 149526
2012-02-01 19:16:56 +00:00
Stepan Dyatkovskiy 5fecf54460 Compatability fix for SwitchInst refactoring.
The purpose of refactoring is to hide operand roles from SwitchInst user (programmer). If you want to play with operands directly, probably you will need lower level methods than SwitchInst ones (TerminatorInst or may be User). After this patch we can reorganize SwitchInst operands and successors as we want.

What was done:

1. Changed semantics of index inside the getCaseValue method:
getCaseValue(0) means "get first case", not a condition. Use getCondition() if you want to resolve the condition. I propose don't mix SwitchInst case indexing with low level indexing (TI successors indexing, User's operands indexing), since it may be dangerous.
2. By the same reason findCaseValue(ConstantInt*) returns actual number of case value. 0 means first case, not default. If there is no case with given value, ErrorIndex will returned.
3. Added getCaseSuccessor method. I propose to avoid usage of TerminatorInst::getSuccessor if you want to resolve case successor BB. Use getCaseSuccessor instead, since internal SwitchInst organization of operands/successors is hidden and may be changed in any moment.
4. Added resolveSuccessorIndex and resolveCaseIndex. The main purpose of these methods is to see how case successors are really mapped in TerminatorInst.
4.1 "resolveSuccessorIndex" was created if you need to level down from SwitchInst to TerminatorInst. It returns TerminatorInst's successor index for given case successor.
4.2 "resolveCaseIndex" converts low level successors index to case index that curresponds to the given successor.

Note: There are also related compatability fix patches for dragonegg, klee, llvm-gcc-4.0, llvm-gcc-4.2, safecode, clang.
llvm-svn: 149482
2012-02-01 07:50:21 +00:00
Argyrios Kyrtzidis a11b35a9b0 Revert r149363 which was part a series of commits that were reverted in llvm
commit 149470. This fixes test/CodeGen/PR3589-freestanding-libcalls.c.

Original log:

    ConstantArray::get() (for strings) is going away, use
    ConstantDataArray::getString instead.

    Many instances of ConstantArray::get() could be moved to
    use more efficient ConstantDataArray methods that avoid a ton
    of intermediate Constant*'s for each element (e.g.
    GetConstantArrayFromStringLiteral).  I don't plan on doing this
    in the short-term though.

llvm-svn: 149477
2012-02-01 06:36:49 +00:00
Eric Christopher ee4ab93906 For pass-by-value record arguments to functions emit a forward decl
instead of the entire class definition.

llvm-svn: 149474
2012-02-01 06:07:23 +00:00
David Chisnall 92d436b49a Support @compatibility_alias at run time (GNUstep Runtime)
Patch by Niels Grewe!

llvm-svn: 149401
2012-01-31 18:59:20 +00:00
Benjamin Kramer e76b42b298 Don't zero terminate the bitmap twice.
llvm-svn: 149377
2012-01-31 10:30:46 +00:00
Chris Lattner f4a4bec3a0 ConstantArray::get() (for strings) is going away, use
ConstantDataArray::getString instead.

Many instances of ConstantArray::get() could be moved to 
use more efficient ConstantDataArray methods that avoid a ton
of intermediate Constant*'s for each element (e.g. 
GetConstantArrayFromStringLiteral).  I don't plan on doing this
in the short-term though.

llvm-svn: 149363
2012-01-31 06:13:55 +00:00
Chris Lattner 236b357361 enhance some optimization logic to handle ConstantDataSequential
as well as ConstantArray.

llvm-svn: 149347
2012-01-31 04:36:19 +00:00
Fariborz Jahanian c93fa98e4c test for a v-table dispatch that consumes an
argument. twik to support the test case.
// rdar://10444476

llvm-svn: 149298
2012-01-30 23:39:30 +00:00
Fariborz Jahanian f2bda69cd2 objc-arc: Perform null check on receiver before sending methods which
consume one or more of their arguments. If not done, this will cause a leak
as method will not consume the argument when receiver is null.
In this patch, the null path releases consumed argument.
// rdar://10444474

llvm-svn: 149279
2012-01-30 21:40:37 +00:00
Craig Topper 2962e7b656 Remove long dead code for handling vector shift by immediate builtins.
llvm-svn: 149237
2012-01-30 08:51:36 +00:00
Craig Topper 2c82f9ecf8 Remove custom handling for cmpsd/cmpss/cmppd/cmpps builtins. The builtins are now in IntrinsicsX86.td.
llvm-svn: 149235
2012-01-30 08:38:42 +00:00
Craig Topper d6d3a05b4f Cleanup 3dnow builtin handling. Most of them were already handled by LLVM connecting intrinsics and builtins in IntrinsicsX86.td.
llvm-svn: 149233
2012-01-30 08:18:19 +00:00
Chris Lattner 595ba3a141 Simplify code by using the new getAggregateElement method that got added
recently.  This also conveniently gets clang ready for a change about to
land in mainline.

llvm-svn: 149225
2012-01-30 06:20:36 +00:00
Fariborz Jahanian 715fdd53a6 revert r149184
llvm-svn: 149205
2012-01-29 20:27:13 +00:00
John McCall ffa2c1a48e When emitting an ARC epilogue that looks like a return of 'self',
kill the retain from the return site.

This has the workaround nature.  It's badness all around.

llvm-svn: 149193
2012-01-29 07:46:59 +00:00
John McCall 6e1c012385 Get a little bit smarter about killing off the ReturnValue alloca
in the presence of straight-line cleanups.  This is a simple but
important case, particularly for ARC.

llvm-svn: 149190
2012-01-29 02:35:02 +00:00
Fariborz Jahanian 326efeb95a objc-arc: Perform null check on receiver before sending methods which
consume one or more of their arguments. If not done, this will cause a leak
as method will not consume the argument when receiver is null.
// rdar://10444474

llvm-svn: 149184
2012-01-28 18:46:31 +00:00
Benjamin Kramer 1412816686 Make the __builtin_c[lt]zs builtins target independent.
There is really no reason to have these only available on x86. It's
just __builtin_c[tl]z for shorts.

Modernize the test while at it.

llvm-svn: 149183
2012-01-28 18:42:57 +00:00
Matt Beaumont-Gay 934bbf50fb Placate gcc's -Wreturn-type
llvm-svn: 149104
2012-01-27 00:46:27 +00:00
Bob Wilson a7a61e2701 Make clz/ctz builtins defined for zero on ARM targets. rdar://10732455
ARM supports clz and ctz directly and both operations have well-defined
results for zero.  There is no disadvantage in performance to using the
defined-at-zero versions of llvm.ctlz/cttz intrinsics.  We're running into
ARM-specific code written with the assumption that __builtin_clz(0) == 32,
even though that value is technically undefined.  The code is failing now
because of llvm optimizations that are taking advantage of the undef
behavior (specifically svn r147255).  There's nothing wrong with that
optimization on x86 where any incorrect assumptions about __builtin_clz(0)
will quickly be exposed.  For ARM, though, optimizations based on that undef
behavior are likely to cause subtle bugs.  Other targets with defined-at-zero
clz/ctz support may want to override the default behavior as well.

llvm-svn: 149086
2012-01-26 22:14:27 +00:00
Eric Christopher f59218e5d9 Use createRecordFwdDecl here since that's what we're doing.
llvm-svn: 149051
2012-01-26 07:11:58 +00:00
Eric Christopher 8913bd6c63 Revert previous patch unifying all of the C++ record prep in one area,
the gdb testsuite complains too much about the ordering of items printed,
even if the offsets in the debug info are correct.

This reverts commit 027cb30af828f07750f9185782822297a5c57231.

llvm-svn: 149049
2012-01-26 07:01:04 +00:00
Eric Christopher 5720033cc1 Remove another duplicated variable.
llvm-svn: 149047
2012-01-26 06:20:57 +00:00
Peter Collingbourne 1425b4556a Use function pointers, rather than references, to pass Destroyers
around, in the process cleaning up the various gcc/msvc compiler
workarounds.

llvm-svn: 149036
2012-01-26 03:33:36 +00:00
Eric Christopher 9f94fa368a Tidy and remove some unused variables.
llvm-svn: 149015
2012-01-26 02:05:28 +00:00
Eric Christopher 5bfde1aa42 Collect this information together. No reason to have it split.
llvm-svn: 149013
2012-01-26 01:57:29 +00:00
Eric Christopher a15e6352fe Refactor into its own function.
llvm-svn: 149012
2012-01-26 01:57:13 +00:00
Eli Friedman a98d1f8ca6 Add some ABI tweaks for i386-pc-win32 triple so that we return structs in an MSVC-compatible way. Patch by Joe Groff.
llvm-svn: 148992
2012-01-25 22:46:34 +00:00
Eric Christopher bfecca3331 Clean up comment.
llvm-svn: 148982
2012-01-25 21:47:09 +00:00
NAKAMURA Takumi ccca11a3de Fixup r148926, for -Asserts.
llvm-svn: 148943
2012-01-25 08:58:21 +00:00
Chris Lattner 2d6b7b91b9 reapply r148902:
"use the new ConstantVector::getSplat method where it makes sense."

Also simplify a bunch of code to use the Builder->getInt32 instead
of doing it the hard and ugly way.  Much more progress could be made
here, but I don't plan to do it.

llvm-svn: 148926
2012-01-25 05:34:41 +00:00
Eli Friedman 5995489d27 Fix a crash for an edge case of the GNU ?: extension.
llvm-svn: 148923
2012-01-25 05:04:17 +00:00
Argyrios Kyrtzidis 5a25297c5e Revert 148902 which was part of 148901 which was reverted in r148906.
Original log:
 use the new ConstantVector::getSplat method where it makes sense.

llvm-svn: 148907
2012-01-25 02:58:12 +00:00
Eric Christopher 000b14e796 Refactor the record decl forward declaration code a bit.
llvm-svn: 148904
2012-01-25 02:06:59 +00:00
Eric Christopher 980df5d7ec Typo.
llvm-svn: 148903
2012-01-25 02:06:52 +00:00
Chris Lattner c558d7d176 use the new ConstantVector::getSplat method where it makes sense.
llvm-svn: 148902
2012-01-25 02:06:10 +00:00
Kostya Serebryany 588d6abf7d The following patch adds __attribute__((no_address_safety_analysis)) which will allow to disable
address safety analysis (such as e.g. AddressSanitizer or SAFECode) for a specific function.

When building with AddressSanitizer, add AddressSafety function attribute to every generated function
except for those that have __attribute__((no_address_safety_analysis)).

With this patch we will be able to
1. disable AddressSanitizer for a particular function
2. disable AddressSanitizer-hostile optimizations (such as some cases of load widening) when AddressSanitizer is on.

llvm-svn: 148842
2012-01-24 19:25:38 +00:00
Akira Hatanaka 377152870b Make sure the integer type used to align the vaarg address is the same as the
type of pointers. 

llvm-svn: 148753
2012-01-23 23:59:52 +00:00
Akira Hatanaka 60f5fe6857 Ignore return type if its size is zero.
llvm-svn: 148744
2012-01-23 23:18:57 +00:00
Nick Lewycky 1c8c436a85 Add support for -fno-optimize-sibling-calls. Currently only implemented in the
X86 backend in LLVM.

llvm-svn: 148689
2012-01-23 08:29:12 +00:00
Eli Friedman 5720e34955 Add an assertion that our use-marking actually covers all uses of a variable. The assertion doesn't cover quite as much as it should, but it's a good start, at least.
llvm-svn: 148625
2012-01-21 04:52:58 +00:00
Eric Christopher 45c4d47b8a When adding types to the context chain for record types, just emit
a forward declaration unless we already have a type. We can fill it in
later if it's actually used.

Fixes PR11345

llvm-svn: 148584
2012-01-20 22:10:15 +00:00
David Blaikie e4d798f078 More dead code removal (using -Wunreachable-code)
llvm-svn: 148577
2012-01-20 21:50:17 +00:00
Kostya Serebryany ca95aa03f9 use llvm:Attributes instead of unsigned
llvm-svn: 148554
2012-01-20 17:57:16 +00:00
Seth Cantrell c9196651fc test svn commit access
llvm-svn: 148388
2012-01-18 12:11:32 +00:00
Nick Lewycky 9ed5b156a2 Fix a string over-run detected by ASAN.
llvm-svn: 148375
2012-01-18 03:41:19 +00:00
Nick Lewycky 72cd229398 Fix special king of typo.
llvm-svn: 148368
2012-01-18 01:50:13 +00:00
Fariborz Jahanian 07b5f4ca03 output body of folded case again.
llvm-svn: 148361
2012-01-17 23:55:19 +00:00
Fariborz Jahanian 9ce39e299d Folding away unreachable case statement.
patch (slightly revised) by Aaron Ballman.

llvm-svn: 148359
2012-01-17 23:39:50 +00:00
Douglas Gregor a95f9aaa84 Make sure to initialize ExternalProtocolPtrTy
llvm-svn: 148358
2012-01-17 23:38:32 +00:00
Eli Friedman 65499b45f0 Add __builtin_labs and __builtin_llabs, to complete the set of __builtin_*abs. Patch by Ruben Van Boxem.
llvm-svn: 148340
2012-01-17 22:11:30 +00:00
Richard Smith dd5bdd8de7 Remove constant member pointer support from Expr-based constant emission now
that APValue-based constant emission knows how to emit member pointers.

llvm-svn: 148336
2012-01-17 21:42:19 +00:00
Dan Gohman 5932ce257f Enable the new ObjC ARC autorelease pool elimination pass.
llvm-svn: 148331
2012-01-17 20:54:51 +00:00
John McCall 9701731a3e When initializing a catch variable in ARC, be sure to emit retains
or whatever else is required for the initialization instead of
assuming it can be done with a simple store.

Fixes PR11732.

llvm-svn: 148325
2012-01-17 20:16:56 +00:00
Douglas Gregor 020de3254a Don't eagerly deserialize the 'Protocol' type when initializing code
generation for Objective-C; it may not be needed.

llvm-svn: 148317
2012-01-17 18:36:30 +00:00
David Blaikie f47fa304a4 Remove unnecessary default cases in switches over enums.
This allows -Wswitch-enum to find switches that need updating when these enums are modified.

llvm-svn: 148281
2012-01-17 02:30:50 +00:00
Tanya Lattner 20248226a9 Add support for OpenCL 1.1 logical operations.
llvm-svn: 148254
2012-01-16 21:02:28 +00:00
Fariborz Jahanian 9c882f98cc Fixes a crash during constant folding of a switch and case
statement which has an unscoped case inside it.
Patch by Aaron Ballman

llvm-svn: 148243
2012-01-16 17:35:57 +00:00
David Chisnall fa35df628a Some improvements to the handling of C11 atomic types:
- Add atomic-to/from-nonatomic cast types
- Emit atomic operations for arithmetic on atomic types
- Emit non-atomic stores for initialisation of atomic types, but atomic stores and loads for every other store / load
- Add a __atomic_init() intrinsic which does a non-atomic store to an _Atomic() type.  This is needed for the corresponding C11 stdatomic.h function.
- Enables the relevant __has_feature() checks.  The feature isn't 100% complete yet, but it's done enough that we want people testing it.

Still to do:

- Make the arithmetic operations on atomic types (e.g. Atomic(int) foo = 1; foo++;) use the correct LLVM intrinsic if one exists, not a loop with a cmpxchg.
- Add a signal fence builtin
- Properly set the fenv state in atomic operations on floating point values
- Correctly handle things like _Atomic(_Complex double) which are too large for an atomic cmpxchg on some platforms (this requires working out what 'correctly' means in this context)
- Fix the many remaining corner cases

llvm-svn: 148242
2012-01-16 17:27:18 +00:00
Douglas Gregor ec9fd13c77 De-virtualize getPreviousDecl() and getMostRecentDecl() when we know
we have a redeclarable type, and only use the new virtual versions
(getPreviousDeclImpl() and getMostRecentDeclImpl()) when we don't have
that type information. This keeps us from penalizing users with strict
type information (and is the moral equivalent of a "final" method).

Plus, settle on the names getPreviousDecl() and getMostRecentDecl()
throughout.

llvm-svn: 148187
2012-01-14 16:38:05 +00:00
Zhongxing Xu 82846eae0a Remove a redundant word.
llvm-svn: 148179
2012-01-14 09:08:15 +00:00
Richard Smith dafff94759 constexpr irgen: Add irgen support for APValue::Struct, APValue::Union,
APValue::Array and APValue::MemberPointer. All APValue values can now be emitted
as constants.

Add new CGCXXABI entry point for emitting an APValue MemberPointer. The other
entrypoints dealing with constant member pointers are no longer necessary and
will be removed in a later change.

Switch codegen from using EvaluateAsRValue/EvaluateAsLValue to
VarDecl::evaluateValue. This performs caching and deals with the nasty cases in
C++11 where a non-const object's initializer can refer indirectly to
previously-initialized fields within the same object.

Building the intermediate APValue object incurs a measurable performance hit on
pathological testcases with huge initializer lists, so we continue to build IR
directly from the Expr nodes for array and record types outside of C++11.

llvm-svn: 148178
2012-01-14 04:30:29 +00:00
Eli Friedman 09d272d025 A base subobject type doesn't make sense for unions; don't try to compute it. Based on patch by Yin Ma. Fixes PR11751.
llvm-svn: 148093
2012-01-13 03:58:31 +00:00
Eric Christopher 8c363622d3 Formatting.
llvm-svn: 147989
2012-01-12 01:26:58 +00:00
Eric Christopher ffbc4d0b68 Formatting.
llvm-svn: 147988
2012-01-12 01:26:51 +00:00
Akira Hatanaka 32604a9708 Take into account the pointer to an aggregate that is passed as a hidden
argument when Offset is initialized.

llvm-svn: 147986
2012-01-12 01:10:09 +00:00
Akira Hatanaka 02e13e5005 Call CodeGenTypes::ConvertType to get LLVM::Type*.
Remove function MipsABIInfo::GetFloatingPointTy.

llvm-svn: 147985
2012-01-12 00:52:17 +00:00
Abramo Bagnara fa95ed4074 Fixed VLA code generation.
llvm-svn: 147933
2012-01-11 08:19:46 +00:00
Akira Hatanaka ee65b744e8 Remove switch/case statements and call GetFloatingPointTy() instead to get the
floating point type.

llvm-svn: 147894
2012-01-10 23:30:49 +00:00
Akira Hatanaka 79f0461c38 Flatten float complex arguments. N32/64 requires float complex arguments be
passed in floating point registers.

llvm-svn: 147892
2012-01-10 23:12:19 +00:00
Akira Hatanaka 21ee88cc1c Remove space.
llvm-svn: 147889
2012-01-10 22:44:52 +00:00
Chandler Carruth c89aa9d964 Add support for the androideabi environment to our triple support, and
for the arm-linux-androideabi triple in particular.

Also use this to do a better job of selecting soft FP settings.

Patch by Evgeniy Stepanov.

llvm-svn: 147872
2012-01-10 19:47:42 +00:00
Joerg Sonnenberger 11aaa7102a Contrary to the other BSDs, NetBSD followed the ELF ABI for structure
passing on i386 and does not use registers.

llvm-svn: 147856
2012-01-10 16:53:17 +00:00
Bill Wendling 86131f2c8d The `-fwritable-strings' flag doesn't make the backing store strings of all
CFStrings writable.

The strings (both Unicode and ASCII) should reside in a read-only section. E.g.,
__TEXT,__cstring instead of __DATA,__data. This is done by making the global
variable created for the strings constant despite the value of that flag.
<rdar://problem/10657500>

llvm-svn: 147845
2012-01-10 08:46:39 +00:00
Eli Friedman c4b251dc2b Implement the missing pieces of Evaluate for _Complex types. With that complete, remove some code from CGExprConstant which is no longer necessary. While I'm here, a couple minor tweaks to _Complex-in-C++. (Specifically, make _Complex types literal types, and don't warn for _Complex int.)
llvm-svn: 147840
2012-01-10 04:58:17 +00:00
Fariborz Jahanian a08a74705b objc++: patch for IRgen for atomic properties of
c++ objects with non-trivial assignment/copy functions.
Also, one additional sema check. // rdar://6137845

llvm-svn: 147817
2012-01-10 00:37:01 +00:00
Akira Hatanaka 1632af603d Insert padding before unaligned long double arguments.
llvm-svn: 147791
2012-01-09 19:31:25 +00:00
Akira Hatanaka 18334dd9e9 Move the piece of code up that skips the padding argument. Without this change,
padding insertion will not work if the coerced type is not a structure.

llvm-svn: 147786
2012-01-09 19:08:06 +00:00
Fariborz Jahanian 1bed413c89 objc++: more atomic property api code for
c++ object properties. wip.

llvm-svn: 147750
2012-01-08 19:13:23 +00:00
Fariborz Jahanian 4b501a2ed8 objc++: More codegen stuff for atomic properties of c++ objects
with non-trivial copies. // rdar://6137845

llvm-svn: 147735
2012-01-07 18:56:22 +00:00
Abramo Bagnara 1cd8368eb2 Fixed TypeofExpr AST and code generation.
llvm-svn: 147730
2012-01-07 10:52:36 +00:00
Akira Hatanaka f64e1adcbb Add field PaddingType to ABIArgInfo which specifies the type of padding that
is inserted before the real argument. Padding is needed to ensure the backend
reads from or writes to the correct argument slots when the original alignment
of a byval structure is unavailable due to flattening.

llvm-svn: 147699
2012-01-07 00:25:33 +00:00
Fariborz Jahanian 7ff610b62d objc++: more code gen stuff for atomic property api,
currently turned off. // rdar://6137845
Also, fixes a test case which should be nonatomic under
new API.

llvm-svn: 147691
2012-01-06 22:33:54 +00:00
Eli Friedman 48fd89ad14 Revert r147664; it's breaking clang regression tests.
llvm-svn: 147681
2012-01-06 20:42:20 +00:00
Eli Friedman df88c54f8d Revert r147655; it's breaking the compiler_rt build on OSX.
llvm-svn: 147677
2012-01-06 20:03:09 +00:00
Fariborz Jahanian 1e1b54926b objc++: some declarations related to atomic
properties of c++ object types with non-trivial
assignment copy. Not used yet. // rdar://6137845

llvm-svn: 147666
2012-01-06 18:07:23 +00:00
Jakub Staszak a78c20d734 Silence GCC warnings.
llvm-svn: 147664
2012-01-06 17:44:30 +00:00
David Chisnall 9217435a33 If we are compiling with -fno-builtin then don't do constant folding of
builtins.

This fixes PR11711.

llvm-svn: 147655
2012-01-06 12:20:19 +00:00
Fariborz Jahanian 17eaf4089d objc++: sythesize a helper function to be used
for copying atomic properties of c++ objects
with non-trivial copy assignment in setters/getters.
Not yet used. // rdar://6137845

llvm-svn: 147636
2012-01-06 00:29:35 +00:00
Eli Friedman b1bc368ca7 Address Richard's review comments on r147561 (Evaluate support for address-of-label differences).
llvm-svn: 147631
2012-01-05 23:59:40 +00:00
Fariborz Jahanian 088f1bc295 Fixes a code gen bug for setter code for a property of
c++ object reference type with trivial copy constructor.
This causes an assert crash and bad code gen. when assert 
is off. // rdar://6137845

llvm-svn: 147573
2012-01-05 00:10:16 +00:00
Eli Friedman fd5e54da2d Add an APValue representation for the difference between two address-of-label expressions. Add support to Evaluate and CGExprConstant for generating/handling them. Remove the special-case for such differences in Expr::isConstantInitializer.
With that done, remove a bunch of buggy code from CGExprConstant for handling scalar expressions which is no longer necessary.

Fixes PR11705.

llvm-svn: 147561
2012-01-04 23:13:47 +00:00
Chris Lattner 36bc4f41bc implement rdar://10639962 by keeping track of increased alignment
information even in subscripting operations.

llvm-svn: 147557
2012-01-04 22:35:55 +00:00
David Chisnall 207a630052 Restore r147493 and remove the part of the test that was checking the wrong thing.
llvm-svn: 147530
2012-01-04 12:02:13 +00:00
Akira Hatanaka f093f5be3e Have functions return structures smaller than 128-bit in registers if ABI
is either N32 or N64. 

llvm-svn: 147520
2012-01-04 03:34:42 +00:00
Rafael Espindola f90b6d1580 Revert r147493. It broke test/CodeGenObjC/constant-strings.m.
llvm-svn: 147511
2012-01-04 01:32:19 +00:00
David Chisnall 31640e1606 Initialise constant Objective-C string isa pointers with a weak reference to the class, so that they are usable in +load methods if the string class has been compiled with clang - if it's been compiled with GCC, the ABI makes this impossible. (GNU runtimes)
llvm-svn: 147493
2012-01-03 23:18:17 +00:00
Douglas Gregor f610267581 Eliminate ObjCForwardProtocolDecl, which is redundant now that
ObjCProtocolDecl modules forward declarations properly.

llvm-svn: 147415
2012-01-01 21:23:57 +00:00
Douglas Gregor a715bfff98 Introduce the core infrastructure needed to model redeclaration chains
for Objective-C protocols, including:
  - Using the first declaration as the canonical declaration
  - Using the definition as the primary DeclContext
  - Making sure that all declarations have a pointer to the definition
  data, and that we know which declaration is the definition
  - Serialization support for redeclaration chains and for adding
  definitions to already-serialized declarations.

However, note that we're not taking advantage of much of this code
yet, because we're still re-using ObjCProtocolDecls.

llvm-svn: 147410
2012-01-01 19:51:50 +00:00
Richard Smith fddd384b73 Unrevert r147271, reverted in r147361.
Also temporarily remove the assumption from IR gen that we can emit IR for every
constant we can fold, since it isn't currently true in C++11, to fix PR11676.

Original comment from r147271:

constexpr: perform zero-initialization prior to / instead of performing a
constructor call when appropriate. Thanks to Eli for spotting this.

llvm-svn: 147384
2011-12-30 21:15:51 +00:00
Richard Smith 5fab0c9e1a Small refactoring and simplification of constant evaluation and some of its
clients. No functionality change.

llvm-svn: 147318
2011-12-28 19:48:30 +00:00
Douglas Gregor deafd0b2a4 Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDecl
covers both declarations (@class) and definitions (@interface) of an
Objective-C class.

llvm-svn: 147299
2011-12-27 22:43:10 +00:00
Richard Smith 6e52514c5d constexpr: support for evaluation and codegen of typeid constants.
llvm-svn: 147290
2011-12-27 12:18:28 +00:00
Craig Topper f2855ade2b Add intrinsics for lzcnt and tzcnt instructions.
llvm-svn: 147263
2011-12-25 06:25:37 +00:00
Eli Friedman 5c9cd7a8a3 Fix a failure (which led to a crash) in constant emission code with vector compound literals.
llvm-svn: 147111
2011-12-22 00:04:00 +00:00
David Blaikie 68e081d606 Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch
llvm-svn: 146959
2011-12-20 02:48:34 +00:00
Bill Wendling bd26cf90dc Mark the calls to the _setjmp function as returns twice. <rdar://problem/10492556>
llvm-svn: 146926
2011-12-19 23:53:28 +00:00
Eli Friedman 3184a5e482 Switch a few callers of MakeAddrLValue places over to MakeNaturalAlignAddrLValue.
llvm-svn: 146920
2011-12-19 23:03:09 +00:00
Chris Lattner 2415357a05 Fix PR5279 - don't sliently drop alignment information on stores of types that have alignment less than the natural alignment of the type when it comes from a typedef.
llvm-svn: 146908
2011-12-19 21:16:08 +00:00
Rafael Espindola 4fdc1759ca Extend the fix for PR9614 to handle inline asm in the outer decl and
the inner decl being a builtin. This is needed to support the glibc headers
in fedora 16 (2.14).

llvm-svn: 146867
2011-12-19 14:41:01 +00:00
Craig Topper 94aba2c260 More AVX2 intrinsic support including saturating add/sub and palignr.
llvm-svn: 146857
2011-12-19 07:03:25 +00:00
Eric Christopher cd88813dbf When in a limited debug information situation if we can find the original
declaration for the type then go ahead and use that, it's still smaller
than creating an all new derived type.

Part of rdar://10335756 and others.

llvm-svn: 146779
2011-12-16 23:40:18 +00:00
Eric Christopher ea225fb412 Start down the path of getting clang to internally agree on structs versus
classes.

Part of rdar://10520586 and a couple others.

llvm-svn: 146778
2011-12-16 23:40:14 +00:00
Douglas Gregor c8b0c9d8fd When generating debug info for an ObjCInterfaceDecl, try to dig out the definition.
llvm-svn: 146705
2011-12-15 23:32:29 +00:00
Douglas Gregor dc9166c8e1 Keep track of all declarations of an Objective-C class (both forward
declarations and definitions) as ObjCInterfaceDecls within the same
redeclaration chain. This new representation matches what we do for
C/C++ variables/functions/classes/templates/etc., and makes it
possible to answer the query "where are all of the declarations of
this class?"

llvm-svn: 146679
2011-12-15 20:29:51 +00:00
Douglas Gregor 0b144e160a Replace all comparisons between ObjCInterfaceDecl pointers with calls
to declaresSameEntity(), as a baby step toward tracking forward
declarations of Objective-C classes precisely. Part of
<rdar://problem/10583531>.

llvm-svn: 146618
2011-12-15 00:29:59 +00:00
Chad Rosier 1332d9b26a Per discussion on the list, remove BitcodeVerify pass to reimplement as a free function.
llvm-svn: 146530
2011-12-14 00:29:23 +00:00
Eli Friedman 3c840aad54 Make CGRecordLayoutBuilder correctly switch over to a packed class when a class has a base whose alignment will break the class layout. <rdar://problem/10551376>.
llvm-svn: 146443
2011-12-12 23:13:20 +00:00
Chad Rosier c4399f779b Add frontend flags to enable bitcode verifier pass.
llvm-svn: 146441
2011-12-12 23:05:47 +00:00
Tony Linthicum 76329bf83f Hexagon backend support
llvm-svn: 146413
2011-12-12 21:14:55 +00:00
Chandler Carruth a31b95cacf Update Clang to emit the new form of llvm.cttz and llvm.ctlz intrinsics,
setting the is_zero_undef flag appropriately to true as that matches the
semantics of these GCC builtins.

This is the Clang side of r146357 in LLVM.

llvm-svn: 146358
2011-12-12 04:28:35 +00:00
Benjamin Kramer 4257ab3ff0 Reuse forAddr to create ignored AggValueSlots.
Silences valgrind warnings about uninitalized alignment values.

llvm-svn: 146342
2011-12-11 16:34:24 +00:00
Eli Friedman de6a86b4f6 Make array new on a pointer to data member type work correctly. PR11523.
llvm-svn: 146291
2011-12-09 23:05:37 +00:00
Bill Wendling 90118a3c9b Don't get the exception obj from the slot more than once.
llvm-svn: 146202
2011-12-08 23:21:26 +00:00
Eli Friedman 516c2ad731 Fix an edge case in IRGen for conditionals. PR11509.
llvm-svn: 146189
2011-12-08 22:01:56 +00:00
Eli Friedman dae858aca3 Make sure we correctly zero-initialize unions containing a pointer to data member as the first field. PR11487.
llvm-svn: 146009
2011-12-07 01:30:11 +00:00
Nick Lewycky f4d3f7a0b9 Stack realignment is a tristate. Add -mno-stackrealign to turn off all stack
realignment, even with locals with alignment exceeding the ABI guarantee.

llvm-svn: 145909
2011-12-06 03:33:03 +00:00
Eli Friedman b8e45b28da Minor comment update.
llvm-svn: 145905
2011-12-06 03:08:26 +00:00
Joerg Sonnenberger db66ed0e4c Add -mstack-alignment=X and fix -mstackrealign handling now that the
backend options are gone.

llvm-svn: 145868
2011-12-05 23:05:23 +00:00
Eli Friedman 6d694a38fd Make EmitAggregateCopy take an alignment argument. Make EmitFinalDestCopy pass in the correct alignment when known.
The test includes a FIXME for a related case involving calls; it's a bit more complicated to fix because the RValue class doesn't keep track of alignment.

<rdar://problem/10463337>
  

llvm-svn: 145862
2011-12-05 22:23:28 +00:00
Eli Friedman a0544d6fdf Switch LValue so that it exposes alignment in CharUnits. (No functional change.)
llvm-svn: 145753
2011-12-03 04:14:32 +00:00