Commit Graph

463 Commits

Author SHA1 Message Date
Richard Smith 6331c408b5 Deal with a horrible C++11 special case. If a non-literal type has a constexpr
constructor, and that constructor is used to initialize an object of static
storage duration such that all members and bases are initialized by constant
expressions, constant initialization is performed. In this case, the object
can still have a non-trivial destructor, and if it does, we must emit a dynamic
initializer which performs no initialization and instead simply registers that
destructor.

llvm-svn: 150419
2012-02-13 22:16:19 +00:00
Richard Smith 5a294e6a2c CWG issue 1405: mutable members are allowed in literal types, but can't undergo
lvalue-to-rvalue conversions in constant expressions.

llvm-svn: 150145
2012-02-09 03:29:58 +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
Matt Beaumont-Gay 934bbf50fb Placate gcc's -Wreturn-type
llvm-svn: 149104
2012-01-27 00:46:27 +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
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
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
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
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
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
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
Douglas Gregor ba34552e79 Introduce a module import declaration, so that we properly represent, e.g.,
__import_module__ std.vector;

in the AST.

llvm-svn: 145725
2011-12-02 23:23:56 +00:00
Richard Smith d572f82e49 Fix wrong-code bug when a const automatic variable of struct type has both a
mutable member and a constant initializer. We'd previously promoted such
variables to global constants, resulting in nasal demons if the mutable member
was modified.

This is only a temporary fix. The subtle interplay between isConstantInitializer
and CGExprConstant is very bug-prone; there are some other issues in this area
which I will be addressing in subsequent, more major reworking of this code.

llvm-svn: 145654
2011-12-02 00:30:33 +00:00
Benjamin Kramer 3df1a2dd59 The cheap version of getName() is sufficient here.
llvm-svn: 145399
2011-11-29 14:46:55 +00:00
Benjamin Kramer 5642e19065 CodeGen: Simplify code.
llvm-svn: 145040
2011-11-21 15:47:23 +00:00
Benjamin Kramer ddbb2b85ab CodeGen: allow __asm renaming on static local variables.
Fixes PR4777.

llvm-svn: 145015
2011-11-20 21:05:04 +00:00
John McCall 08ef466048 Enter the cleanups for a block outside the enclosing
full-expression.  Naturally they're inactive before we enter
the block literal expression.  This restores the intended
behavior that blocks belong to their enclosing scope.

There's a useful -O0 / compile-time optimization that we're
missing here with activating cleanups following straight-line
code from their inactive beginnings.

llvm-svn: 144268
2011-11-10 08:15:53 +00:00
Eli Friedman eadd3e81a0 Fix the alignment on scalar parameter variables so that it matches what the AST thinks it should be. Per report on cfe-dev.
llvm-svn: 143645
2011-11-03 20:31:28 +00:00
Benjamin Kramer 76399eb2ad de-tmpify clang.
llvm-svn: 140637
2011-09-27 21:06:10 +00:00
David Blaikie 83d382b1ca Switch assert(0/false) llvm_unreachable.
llvm-svn: 140367
2011-09-23 05:06:16 +00:00
Peter Collingbourne 2dbb708b8a OpenCL: introduce support for function scope __local variables
llvm-svn: 140068
2011-09-19 21:14:35 +00:00
Douglas Gregor 79a91418bd Switch LangOptions over to a .def file that describes header of the
language options. Use that .def file to declare the LangOptions class
and initialize all of its members, eliminating a source of annoying
initialization bugs.

AST serialization changes are next up.

llvm-svn: 139605
2011-09-13 17:21:33 +00:00
Julien Lerouge 5a6b6987dc Bring llvm.annotation* intrinsics support back to where it was in llvm-gcc: can
annotate global, local variables, struct fields, or arbitrary statements (using
the __builtin_annotation), rdar://8037476.

llvm-svn: 139423
2011-09-09 22:41:49 +00:00
John McCall a5efa7386a Track whether an AggValueSlot is potentially aliased, and do not
emit call results into potentially aliased slots.  This allows us
to properly mark indirect return slots as noalias, at the cost
of requiring an extra memcpy when assigning an aggregate call
result into a l-value.  It also brings us into compliance with
the x86-64 ABI.

llvm-svn: 138599
2011-08-25 23:04:34 +00:00
John McCall 8d6fc9583d Use stronger typing for the flags on AggValueSlot and require
creators to tell us whether something needs GC barriers.
No functionality change.

llvm-svn: 138581
2011-08-25 20:40:09 +00:00
Fariborz Jahanian 5c4b2ca699 blocks - capturing logic of byref block variable's expression
statement initializer makes safe assumption when a substatement 
is encounterred (with a fix me).

llvm-svn: 138528
2011-08-25 00:06:26 +00:00
Eric Christopher b58b3e879d Make constant aggregate constant initializers private linkage.
After talking with John making this the case for all of these is
the right way to go.

Fixes rdar://9804564 and PR10414

llvm-svn: 138418
2011-08-24 00:33:55 +00:00
Eric Christopher d28d107099 Whitespace and 80-col cleanup.
llvm-svn: 138413
2011-08-23 23:44:09 +00:00
Eric Christopher 31ab13047d Whitespace.
llvm-svn: 138404
2011-08-23 22:38:00 +00:00
Fariborz Jahanian 797f1e23f6 checking for __block variable captured by given
stmt expression, recursively walk down all substatements 
of the stmt expression. // rdar://10001085

llvm-svn: 138334
2011-08-23 16:47:15 +00:00
Fariborz Jahanian b50801f049 block IRgen - Fixes a crash when determining if given block variable
is captured by a given statement expression. // rdar://10001085

llvm-svn: 138314
2011-08-23 00:27:49 +00:00
Francois Pichet 00c7e6ceb1 Implement function template specialization at class scope extension in Microsoft mode. A new AST node is introduced: ClassScopeFunctionSpecialization. This node holds a FunctionDecl that is not yet specialized; then during the class template instantiation the ClassScopeFunctionSpecialization will spawn the actual function specialization.
Example:
template <class T>
class A {
public:
  template <class U> void f(U p) {  }
  template <> void f(int p) {  } // <== class scope specialization
};

This extension is necessary to parse MSVC standard C++ headers, MFC and ATL code.
BTW, with this feature in, clang can parse (-fsyntax-only) all the MSVC 2010 standard header files without any error.

llvm-svn: 137573
2011-08-14 03:52:19 +00:00
John McCall b726a55729 Fix a couple of problems with initialization and assignment to
__block variables where the act of initialization/assignment
itself causes the __block variable to be copied to the heap
because the variable is of block type and is being assigned
a block literal which captures the variable.

rdar://problem/9814099

llvm-svn: 136337
2011-07-28 07:23:35 +00:00
Chandler Carruth d48db2115a Rename getInstantiationLineNumber to getExpansionLineNumber in both
SourceManager and FullSourceLoc.

llvm-svn: 135969
2011-07-25 21:09:52 +00:00
Chris Lattner 0e62c1cc0b remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.

llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Jay Foad 040dd82f44 Convert IRBuilder::CreateGEP and IRBuilder::CreateInBoundsGEP to use
ArrayRef.

llvm-svn: 135761
2011-07-22 08:16:57 +00:00
Chris Lattner 2192fe50da de-constify llvm::Type, patch by David Blaikie!
llvm-svn: 135370
2011-07-18 04:24:23 +00:00
John McCall 97eab0a271 Okay, that rule about zero-length arrays applies to destroying
them, too.

llvm-svn: 135038
2011-07-13 08:09:46 +00:00
John McCall 30317fda63 Generalize Cleanup::Emit's "isForEH" parameter into a set
of flags.  No functionality change.

llvm-svn: 134997
2011-07-12 20:27:29 +00:00
John McCall 4bd0fb1f09 Switch field destruction over to use the new destroyer-based API
and kill a lot of redundant code.

llvm-svn: 134988
2011-07-12 16:41:08 +00:00
John McCall 178360e1cd Fix a lot of problems with the partial destruction of arrays:
- an off-by-one error in emission of irregular array limits for
   InitListExprs
 - use an EH partial-destruction cleanup within the normal
   array-destruction cleanup
 - get the branch destinations right for the empty check
Also some refactoring which unfortunately obscures these changes.

llvm-svn: 134890
2011-07-11 08:38:19 +00:00
John McCall c2f0001c80 More compiler workarounds. I have to admit that I was not
expecting so much concentrated oddity on what seemed like a
trivial feature.  Thanks to François Pichet for doing the
MSVC legwork here.

llvm-svn: 134813
2011-07-09 09:09:00 +00:00
John McCall 7c4df104ce GCC 4.2 compatibility hack.
llvm-svn: 134785
2011-07-09 02:30:03 +00:00
John McCall 82fe67bb82 A number of array-related IR-gen cleanups.
- Emit default-initialization of arrays that were partially initialized
    with initializer lists with a loop, rather than emitting the default
    initializer N times;
  - support destroying VLAs of non-trivial type, although this is not
    yet exposed to users; and
  - support the partial destruction of arrays initialized with
    initializer lists when an initializer throws an exception.

llvm-svn: 134784
2011-07-09 01:37:26 +00:00
Douglas Gregor 82e1af20cb Don't zero-initialize default-initialized local variables that have
trivial default constructors. This generated-code regression was
caused by r131796, which had simplified the handling of default
initialization in Sema. Fixes <rdar://problem/9694300>.

llvm-svn: 134260
2011-07-01 21:08:19 +00:00
Fariborz Jahanian 326701e2c7 objc-arc: fix a IRGen crash when checking for
accessibility of an initializer which is a compound 
statement. // rdar://9694706

llvm-svn: 134091
2011-06-29 20:00:16 +00:00
John McCall 55e1fbc848 LValue carries a type now, so simplify the main EmitLoad/Store APIs
by removing the redundant type parameter.

llvm-svn: 133860
2011-06-25 02:11:03 +00:00
John McCall 1bd2556ccc Honor objc_precise_lifetime in GC mode by feeding the value
in the variable to an inline asm which gets run when the variable
goes out of scope.

llvm-svn: 133840
2011-06-24 23:21:27 +00:00
John McCall 23c29fea92 Change the IR-generation of VLAs so that we capture bounds,
not sizes;  so that we use well-typed allocas;  and so that we
properly recurse through the full set of variably-modified types.

llvm-svn: 133827
2011-06-24 21:55:10 +00:00
Benjamin Kramer 8a9cc4fe28 Remove dead variables.
llvm-svn: 133346
2011-06-18 10:34:07 +00:00
John McCall d463132f27 Objective-C fast enumeration loop variables are not retained in ARC, but
they should still be officially __strong for the purposes of errors, 
block capture, etc.  Make a new bit on variables, isARCPseudoStrong(),
and set this for 'self' and these enumeration-loop variables.  Change
the code that was looking for the old patterns to look for this bit,
and change IR generation to find this bit and treat the resulting         
variable as __unsafe_unretained for the purposes of init/destroy in
the two places it can come up.

llvm-svn: 133243
2011-06-17 06:42:21 +00:00
John McCall 1553b19067 Restore correct use of GC barriers.
llvm-svn: 133144
2011-06-16 04:16:24 +00:00
John McCall 101236969f Suppress a warning in -Asserts builds.
llvm-svn: 133110
2011-06-15 23:40:09 +00:00
John McCall 31168b077c Automatic Reference Counting.
Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.

llvm-svn: 133103
2011-06-15 23:02:42 +00:00
Devang Patel 7bf741ac36 Do not emit stoppoint before emitting debug info for parameters.
- llvm.dbg.declare already receives line number information from ParmDecl
- Additional extra stoppoint messes up gdb's understanding of where function body starts.

llvm-svn: 133065
2011-06-15 17:57:08 +00:00
Devang Patel 1b291b22d0 Rework r132576.
Emit debug info only if there is an insertion point. The debug info should not force an insertion point. Codegen may later on decide to not emit code for some reason, see extensive comment in CodeGenFunction::EmitStmt(), and debug info should not get in the way.

llvm-svn: 132610
2011-06-04 00:38:02 +00:00
Devang Patel 887e215e64 Emit debug info only if there is an insertion point. The debug info should not force an insertion point. Codegen may later on decide to not emit code for some reason, see extensive comment in CodeGenFunction::EmitStmt(), and debug info should not get in the way.
llvm-svn: 132576
2011-06-03 19:21:47 +00:00
Eli Friedman b857842c48 Add unnamed_addr to internal globals which are only used as an operand to memcpy. (Spotted by looking at IR.)
llvm-svn: 132226
2011-05-27 22:32:55 +00:00
Richard Smith 3f1b5d077b Implement support for C++0x alias templates.
llvm-svn: 130953
2011-05-05 21:57:07 +00:00
Eli Friedman 43dca6a8d2 Simplify code a bit by using CallArgList::add. No intended functionality change.
llvm-svn: 130699
2011-05-02 17:57:46 +00:00
Richard Smith dda56e4b4a Support for C++11 (non-template) alias declarations.
llvm-svn: 129567
2011-04-15 14:24:37 +00:00
Devang Patel 095421b4a8 Fix typo.
llvm-svn: 128921
2011-04-05 20:28:21 +00:00
John McCall 7306487077 Move all the significant __block code into CGBlocks.cpp. No functionality
change.

llvm-svn: 128608
2011-03-31 01:59:53 +00:00
Peter Collingbourne 599cb8e430 Add support for language-specific address spaces. On top of that,
add support for the OpenCL __private, __local, __constant and
__global address spaces, as well as the __read_only, _read_write and
__write_only image access specifiers.  Patch originally by ARM;
language-specific address space support by myself.

llvm-svn: 127915
2011-03-18 22:38:29 +00:00
John McCall 91ca10fe64 Extract a function to emit an arbitrary expression as if it were the initializer
for a local variable.

llvm-svn: 127227
2011-03-08 09:11:50 +00:00
Douglas Gregor 19da4e4397 Revert r126422 "Use private linkage to avoid symbol conflicts in
corner cases like the one in PR9301." which caused PR9416. 

llvm-svn: 127136
2011-03-06 23:28:21 +00:00
Devang Patel 68a1525290 Encode argument numbering in debug info so that code generator can emit them in order.
This fixes few blocks.exp regressions.

llvm-svn: 126960
2011-03-03 20:13:15 +00:00
Devang Patel bd6f7f9770 revert r126858.
llvm-svn: 126874
2011-03-02 20:31:22 +00:00
Devang Patel 31e5fb52d1 Encode argument numbering in debug info so that code generator can emit them in order.
This fixes few blocks.exp regressions.

Reapply r126795 with a fix (one character change) for gdb testsuite regressions.

llvm-svn: 126858
2011-03-02 19:11:22 +00:00
Devang Patel a54696de8a Revert r126794.
llvm-svn: 126848
2011-03-02 17:54:58 +00:00
Devang Patel 3bc2dedb40 Encode argument numbering in debug info so that code generator can emit them in order.
This fixes few blocks.exp regressions.

llvm-svn: 126795
2011-03-01 22:59:40 +00:00
Rafael Espindola eb4fd01f7a Use private linkage to avoid symbol conflicts in corner cases like the one
in PR9301.

llvm-svn: 126422
2011-02-24 20:31:44 +00:00
John McCall 147d021b75 Emit the structure layout of the block literal parameter to a block
invocation function into the debug info.  Rather than faking up a class,
which is tricky because of the custom layout we do, we just emit a struct
directly from the layout information we've already got.

Also, don't emit an unnecessarily parameter alloca for this "variable".

llvm-svn: 126255
2011-02-22 22:38:33 +00:00
John McCall 9e2e22f5c6 Establish the iteration variable of an ObjC for-in loop before
emitting the collection expression.  Fixes some really, really broken
code.

llvm-svn: 126193
2011-02-22 07:16:58 +00:00
John McCall c533cb7008 Reorganize the emission of local variables.
llvm-svn: 126189
2011-02-22 06:44:22 +00:00
John McCall a9a2e8a58d The flags we're supposed to write into a byref struct are *not* the
_Block_object_* flags;  it's just BLOCK_HAS_COPY_DISPOSE or not.

Also, we don't need to chase forwarding pointers prior to calling
_Block_object_dispose;  _Block_object_dispose in fact already does
this.

rdar://problem/9006315

llvm-svn: 125823
2011-02-18 02:58:31 +00:00
Chris Lattner 43e7f31f11 implement basic support for __label__. I wouldn't be shocked if there are
bugs from other clients that don't expect to see a LabelDecl in a DeclStmt,
but if so they should be easy to fix.

This implements most of PR3429 and rdar://8287027

llvm-svn: 125817
2011-02-18 02:08:43 +00:00
Chris Lattner c8e630e4db Step #1/N of implementing support for __label__: split labels into
LabelDecl and LabelStmt.  There is a 1-1 correspondence between the
two, but this simplifies a bunch of code by itself.  This is because
labels are the only place where we previously had references to random
other statements, causing grief for AST serialization and other stuff.

This does cause one regression (attr(unused) doesn't silence unused
label warnings) which I'll address next.

This does fix some minor bugs:
1. "The only valid attribute " diagnostic was capitalized.
2. Various diagnostics printed as ''labelname'' instead of 'labelname'
3. This reduces duplication of label checking between functions and blocks.

Review appreciated, particularly for the cindex and template bits.

llvm-svn: 125733
2011-02-17 07:39:24 +00:00
Nick Lewycky 8d2226208d Ensure that the NRVO flag has some block to insert into. Fixes PR9178!
llvm-svn: 125694
2011-02-16 23:59:08 +00:00
Devang Patel 25468059e5 Simplify test to check an aggregate argument that has non trivial constructor or destructor.
This patch rewrites r125142.

llvm-svn: 125632
2011-02-16 01:11:51 +00:00
John McCall e3dc1707b5 Assorted cleanup:
- Have CGM precompute a number of commonly-used types
  - Have CGF copy that during initialization instead of recomputing them
  - Use TBAA info when initializing a parameter variable
  - Refactor the scalar ++/-- code

llvm-svn: 125562
2011-02-15 09:22:45 +00:00
Devang Patel 14524e0f24 If an aggregate argument is passed indirectly because it has non trivial
destructor or copy constructor than let debug info know about it.

Radar 8945514.

llvm-svn: 125142
2011-02-09 00:37:30 +00:00
John McCall ad7c5c1657 Reorganize CodeGen{Function,Module} to eliminate the unfortunate
Block{Function,Module} base class.  Minor other refactorings.

Fixed a few address-space bugs while I was there.

llvm-svn: 125085
2011-02-08 08:22:06 +00:00
John McCall 351762cda2 A few more tweaks to the blocks AST representation:
- BlockDeclRefExprs always store VarDecls
  - BDREs no longer store copy expressions
  - BlockDecls now store a list of captured variables, information about
    how they're captured, and a copy expression if necessary
    
With that in hand, change IR generation to use the captures data in       
blocks instead of walking the block independently.        

Additionally, optimize block layout by emitting fields in descending
alignment order, with a heuristic for filling in words when alignment
of the end of the block header is insufficient for the most aligned
field.

llvm-svn: 125005
2011-02-07 10:33:21 +00:00
John McCall e4df6c8d96 Convert the exception-freeing cleanup over to the conditional cleanups code,
fixing a crash which probably nobody was ever going to see.  In doing so,
fix a horrendous number of problems with the conditional-cleanups code.
Also, make conditional cleanups re-use the cleanup's activation variable,
which avoids some unfortunate repetitiveness.

llvm-svn: 124481
2011-01-28 08:37:24 +00:00
Fariborz Jahanian 2f2fa7284b Fixes an IRgen bug where __block variable is
referenced in the block-literal initializer
of that variable. // rdar://8893785

llvm-svn: 124332
2011-01-26 23:08:27 +00:00
Ken Dyck 9a6486934c Replace calls to CharUnits::fromQuantity() with ones to
ASTContext::toCharUnitsFromBits() when converting from bit sizes to char units.

llvm-svn: 123720
2011-01-18 02:01:14 +00:00
Peter Collingbourne 0ff0b37627 Move name mangling support from CodeGen to AST. In the
process, perform a number of refactorings:

- Move MiscNameMangler member functions to MangleContext
- Remove GlobalDecl dependency from MangleContext
- Make MangleContext abstract and move Itanium/Microsoft functionality
  to their own classes/files
- Implement ASTContext::createMangleContext and have CodeGen use it

No (intended) functionality change.

llvm-svn: 123386
2011-01-13 18:57:25 +00:00
Rafael Espindola c56f847a96 Add support for declaring register contraints in variables. They are only used
in asm statements:

register int foo asm("rdi");

asm("..." : ... "r" (foo) ...

We also only accept these variables if the constraint in the asm statement is "r".

This fixes most of PR3933.

llvm-svn: 122643
2010-12-30 22:59:32 +00:00
Nick Lewycky 8a7d90b152 Correct function name in comment.
llvm-svn: 122640
2010-12-30 20:21:55 +00:00
Benjamin Kramer acc6b4e2fd Simplify mem{cpy, move, set} creation with IRBuilder.
llvm-svn: 122634
2010-12-30 00:13:21 +00:00
Fariborz Jahanian 50198098b9 IR Gen. part of API support for __block cxx
objects imported into blocks. //rdar://8594790.
Will have a test case coming (as well as one
sent to llvm test suite).

llvm-svn: 120713
2010-12-02 17:02:11 +00:00
Chris Lattner 27a3631bac Improve codegen for initializer lists to use memset more aggressively
when an initializer is variable (I handled the constant case in a previous
patch).  This has three pieces:

1. Enhance AggValueSlot to have a 'isZeroed' bit to tell CGExprAgg that
   the memory being stored into has previously been memset to zero.
2. Teach CGExprAgg to not emit stores of zero to isZeroed memory.
3. Teach CodeGenFunction::EmitAggExpr to scan initializers to determine
   whether they are profitable to emit a memset + inividual stores vs
   stores for everything.

The heuristic used is that a global has to be more than 16 bytes and
has to be 3/4 zero to be candidate for this xform.  The two testcases
are illustrative of the scenarios this catches.  We now codegen test9 into:

 call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 400, i32 4, i1 false)
 %.array = getelementptr inbounds [100 x i32]* %Arr, i32 0, i32 0
 %tmp = load i32* %X.addr, align 4
 store i32 %tmp, i32* %.array

and test10 into:

  call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 392, i32 8, i1 false)
  %tmp = getelementptr inbounds %struct.b* %S, i32 0, i32 0
  %tmp1 = getelementptr inbounds %struct.a* %tmp, i32 0, i32 0
  %tmp2 = load i32* %X.addr, align 4
  store i32 %tmp2, i32* %tmp1, align 4
  %tmp5 = getelementptr inbounds %struct.b* %S, i32 0, i32 3
  %tmp10 = getelementptr inbounds %struct.a* %tmp5, i32 0, i32 4
  %tmp11 = load i32* %X.addr, align 4
  store i32 %tmp11, i32* %tmp10, align 4

Previously we produced 99 stores of zero for test9 and also tons for test10.
This xforms should substantially speed up -O0 builds when it kicks in as well
as reducing code size and optimizer heartburn on insane cases.  This resolves
PR279.

llvm-svn: 120692
2010-12-02 07:07:26 +00:00
Chris Lattner 4fc8fb09d0 attempt to fix a buildbot failure, apparently apache fails to build.
llvm-svn: 120688
2010-12-02 04:27:29 +00:00
Chris Lattner e6af88628f Enhance the init generation logic to emit a memset followed by a few stores when
a global is larger than 32 bytes and has fewer than 6 non-zero values in the
initializer.  Previously we'd turn something like this:

char test8(int X) {
  char str[10000] = "abc";

into a 10K global variable which we then memcpy'd from.  Now we generate:

  %str = alloca [10000 x i8], align 16
  %tmp = getelementptr inbounds [10000 x i8]* %str, i64 0, i64 0
  call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 10000, i32 16, i1 false)
  store i8 97, i8* %tmp, align 16
  %0 = getelementptr [10000 x i8]* %str, i64 0, i64 1
  store i8 98, i8* %0, align 1
  %1 = getelementptr [10000 x i8]* %str, i64 0, i64 2
  store i8 99, i8* %1, align 2

Which is much smaller in space and also likely faster.

This is part of PR279

llvm-svn: 120645
2010-12-02 01:58:41 +00:00
Chris Lattner b85025fedd add some infrastructure that will let us codegen
http://llvm.org/bugs/show_bug.cgi?id=279#c3 better.

No functionality change yet.

llvm-svn: 120530
2010-12-01 02:05:19 +00:00
Chris Lattner 46a7ad7605 get some i32/i8/i1 constants from Builder, which is much less painful than
using ConstantInt::get.

llvm-svn: 120527
2010-12-01 01:47:15 +00:00
Fariborz Jahanian 3a4ea9a76c Declaring local static in global block
literal declaration caused crash in CodeGen.
This patch fixes it. pr8707

llvm-svn: 120486
2010-11-30 23:07:14 +00:00
Francois Pichet df946c3702 Fix warning: enumeration value 'IndirectField' not handled in switch.
llvm-svn: 119924
2010-11-21 06:49:41 +00:00
Fariborz Jahanian a00076cda5 Fixes synthesis of type for the object which holds info.
about a __block cxx object.

llvm-svn: 119411
2010-11-17 00:21:28 +00:00
Fariborz Jahanian 9db7b8b1ef Some cleanup of block API code.
llvm-svn: 119174
2010-11-15 19:19:38 +00:00
John McCall cdf7ef5437 Simplify the logic for emitting guard variables for template static
data members by delaying the emission of the initializer until after
linkage and visibility have been set on the global.  Also, don't
emit a guard unless the variable actually ends up with vague linkage,
and don't use thread-safe statics in any case.

llvm-svn: 118336
2010-11-06 09:44:32 +00:00
John McCall 8e7cb6dcfa Ensure that static local variables in function templates inherit the
visibility of their function.

llvm-svn: 118065
2010-11-02 21:04:24 +00:00
John McCall 1c9c3fd50a Death to blocks, or at least the word "block" in one particular obnoxiously
ambiguous context.

llvm-svn: 116567
2010-10-15 04:57:14 +00:00
John McCall 569eafce63 Re-enable EH cleanups to destroy __block variables, now that we have a moment to
deal with the consequences.  Fixes rdar://problem/8224178.

llvm-svn: 115816
2010-10-06 18:56:43 +00:00
John McCall 7a626f63f7 one piece of code is responsible for the lifetime of every aggregate
slot.  The easiest way to do that was to bundle up the information
we care about for aggregate slots into a new structure which demands
that its creators at least consider the question.

I could probably be convinced that the ObjC 'needs GC' bit should
be rolled into this structure.
Implement generalized copy elision.  The main obstacle here is that
IR-generation must be much more careful about making sure that exactly

llvm-svn: 113962
2010-09-15 10:14:12 +00:00
John McCall 68ff03728a Implement ARM static local initialization guards, which are more compact than
Itanium guards and use a slightly different compiled-in API.

llvm-svn: 113330
2010-09-08 01:44:27 +00:00
Fariborz Jahanian 366a94822b Local static block variable referecned in its
block-literal initializer expression causes IRgen to crash.
This patch fixes by saving it in StaticLocalDecl map
already used for such purposes. (radar 8390455).

llvm-svn: 113307
2010-09-07 23:26:17 +00:00
Fariborz Jahanian 087206dbcd Truncate block variable of bool type to i1 when its
value is used. This matches with non-block variable
use of bool type. (Fixes radar 8390062).

llvm-svn: 113027
2010-09-03 23:07:53 +00:00
John McCall 56f57589af A constant initializer never matches the type of the variable it's
initializing;  it at best matches the element type of the variable
it's initializing.  Fixes PR8073.

llvm-svn: 112992
2010-09-03 18:58:50 +00:00
Daniel Dunbar be13194655 Revert "Another i1 vs. i8 type mismatch issue. This time", it breaks some projects.
llvm-svn: 112922
2010-09-03 00:35:23 +00:00
Fariborz Jahanian 05bbef63b6 Another i1 vs. i8 type mismatch issue. This time
a 'bool' byref variable in memory. Fixes radar 8382559.

llvm-svn: 112835
2010-09-02 17:28:31 +00:00
John McCall 8e7d656a4a De-memberify the VarDecl and FunctionDecl StorageClass enums.
This lets us remove Sema.h's dependency on Expr.h and Decl.h.

llvm-svn: 112156
2010-08-26 03:08:43 +00:00
Daniel Dunbar 0381634a61 IRgen: Change Emit{Load,Store}OfScalar to take a required Alignment argument and
update callers as best I can.
 - This is a work in progress, our alignment handling is very horrible / sketchy -- I am just aiming for monotonic improvement.
 - Serious review appreciated.

llvm-svn: 111707
2010-08-21 02:24:36 +00:00
Daniel Dunbar a94e3d1124 IRgen: Use Ty consistently in this function.
llvm-svn: 111705
2010-08-21 02:17:08 +00:00
John McCall 8b0f4ff317 Further adjustments to -Wglobal-constructors; works for references and direct
initializations now.

llvm-svn: 110063
2010-08-02 21:13:48 +00:00
John McCall 775f9f9919 Turn off EH cleanups for __block variables; they caused some internal buildbot
failures.  There's a radar tracking this.

llvm-svn: 109170
2010-07-22 21:25:44 +00:00
John McCall cda666ccd8 Rename LazyCleanup -> Cleanup. No functionality change for these last three
commits.

llvm-svn: 109000
2010-07-21 07:22:38 +00:00
John McCall a464ff9d15 Switch some random local-decl cleanups over to using lazy cleanups. Turn on
the block-release unwind cleanup:  we're never going to test it if we don't turn
it on.

llvm-svn: 108992
2010-07-21 06:13:08 +00:00
John McCall 70013b640f When deferring the emission of declarations with initializers in C++, remember
the order they appeared in the translation unit.  If they get emitted, put them
in their proper order.  Fixes rdar://problem/7458115

llvm-svn: 108477
2010-07-15 23:40:35 +00:00
John McCall 2b7fc3828e Teach IR generation how to lazily emit cleanups. This has a lot of advantages,
mostly in avoiding unnecessary work at compile time but also in producing more
sensible block orderings.

Move the destructor cleanups for local variables over to use lazy cleanups.
Eventually all cleanups will do this;  for now we have some awkward code
duplication.

Tell IR generation just to never produce landing pads in -fno-exceptions.
This is a much more comprehensive solution to a problem which previously was
half-solved by checks in most cleanup-generation spots.

llvm-svn: 108270
2010-07-13 20:32:21 +00:00
John McCall bd30929e4d Validated by nightly-test runs on x86 and x86-64 darwin, including after
self-host.  Hopefully these results hold up on different platforms.  

I tried to keep the GNU ObjC runtime happy, but it's hard for me to test.
Reimplement how clang generates IR for exceptions.  Instead of creating new
invoke destinations which sequentially chain to the previous destination,
push a more semantic representation of *why* we need the cleanup/catch/filter
behavior, then collect that information into a single landing pad upon request.

Also reorganizes how normal cleanups (i.e. cleanups triggered by non-exceptional
control flow) are generated, since it's actually fairly closely tied in with
the former.  Remove the need to track which cleanup scope a block is associated
with.

Document a lot of previously poorly-understood (by me, at least) behavior.

The new framework implements the Horrible Hack (tm), which requires every
landing pad to have a catch-all so that inlining will work.  Clang no longer
requires the Horrible Hack just to make exceptions flow correctly within
a function, however.  The HH is an unfortunate requirement of LLVM's EH IR.

llvm-svn: 107631
2010-07-06 01:34:17 +00:00
Douglas Gregor bac7490ffc Remove unnecessary ASTContext parameter from
CXXRecordDecl::getDestructor(); no functionality change.

llvm-svn: 107394
2010-07-01 14:13:13 +00:00
Chris Lattner 5e016ae983 finally get around to doing a significant cleanup to irgen:
have CGF create and make accessible standard int32,int64 and 
intptr types.  This fixes a ton of 80 column violations 
introduced by LLVMContextification and cleans up stuff a lot.

llvm-svn: 106977
2010-06-27 07:15:29 +00:00
Anders Carlsson 04775f8413 Change EmitReferenceBindingToExpr to take a decl instead of a boolean.
llvm-svn: 106949
2010-06-26 16:35:32 +00:00
Anders Carlsson ea836bc41c Switch over to the new caching version of getMangledName.
llvm-svn: 106549
2010-06-22 16:16:50 +00:00
Chandler Carruth 8509824cdb Move CodeGenOptions.h *back* into Frontend. This should have been done when the
dependency edge was reversed such that CodeGen depends on Frontend.

llvm-svn: 106065
2010-06-15 23:19:56 +00:00
Abramo Bagnara d73405829b Added AccessSpecDecl node.
llvm-svn: 105525
2010-06-05 05:09:32 +00:00
Alexis Hunt ed05325dbe Convert DeclNodes to use TableGen.
The macros required for DeclNodes use have changed to match the use of
StmtNodes. The FooFirst enumerator constants have been named firstFoo
to match usage elsewhere.

llvm-svn: 105165
2010-05-30 07:21:58 +00:00
Dan Gohman 3743b8cf49 This cast is no longer required.
llvm-svn: 104916
2010-05-28 01:39:35 +00:00
Fariborz Jahanian 5f81b9f3f6 Patch to fix a irgen crash accessing an initialized local static
variable in a local function. Fixes pr7101.

llvm-svn: 104743
2010-05-26 21:45:50 +00:00
John McCall 7cb0220e53 If a function definition has any sort of weak linkage, its static local
variables should have that linkage.  Otherwise, its static local
variables should have internal linkage.  To avoid computing this excessively,
set a function's linkage before we emit code for it.

Previously we were assigning weak linkage to the static variables of
static inline functions in C++, with predictably terrible results.  This
fixes that and also gives better linkage than 'weak' when merging is required.

llvm-svn: 104581
2010-05-25 04:30:21 +00:00
Douglas Gregor 9154b5dffe Ensure that destructors are called for NRVO'd objects when the
function does not return. Thanks to Eli for pointing out this corner
case.

llvm-svn: 103941
2010-05-17 15:52:46 +00:00
Douglas Gregor 170125648c When applying the named return value optimization, we still need to
destroy the variable along the exceptional edge; it's only during
normal execution that we avoid destroying this variable.

llvm-svn: 103872
2010-05-15 16:39:56 +00:00
Douglas Gregor 290c93ec0d Implement a simple form of the C++ named return value optimization for
return statements. We perform NRVO only when all of the return
statements in the function return the same variable. Fixes some link
failures in Boost.Interprocess (which is relying on NRVO), and
probably improves performance for some C++ applications.

llvm-svn: 103867
2010-05-15 06:46:45 +00:00
John McCall 4a39ab8078 Emit the globals, metadata, etc. associated with static variables even when
they're unreachable.  This matters because (if they're POD, or if this is C)
the scope containing the variable might be reachable even if the variable
isn't.  Fixes PR7044.

llvm-svn: 103052
2010-05-04 20:45:42 +00:00
Fariborz Jahanian 751f7bc03c Fixes a Code Gen. Crash when calling destructor on a __block
variabe. Blocks and their construction/destruction is
wip though. 

llvm-svn: 102985
2010-05-04 00:26:07 +00:00
John McCall 5828ee7a27 Just bail out immediately when emitting an unreachable function-local static
variable.  Surprisingly, this does seem to be the right way to solve this.

llvm-svn: 102961
2010-05-03 21:39:56 +00:00
Anders Carlsson f8a71f08d1 Add the same 'ForVirtualBase' parameter to EmitCXXDestructorCall.
llvm-svn: 102882
2010-05-02 23:29:11 +00:00
Douglas Gregor 19043f0a6a I hate default statements. Fixes PR6874.
llvm-svn: 102160
2010-04-23 02:02:43 +00:00
Fariborz Jahanian 4d55b2d049 Some renaming of methods, fixes typo
(related to PR6769).

llvm-svn: 101794
2010-04-19 18:15:02 +00:00
Fariborz Jahanian 3fef72f0ba Local static variables must be available module-wise
as they are accessible in static methods in a class
local to the same function. Fixes PR6769.

llvm-svn: 101756
2010-04-18 21:01:23 +00:00
Mon P Wang cc2ab0cdc9 Reapply patch for adding support for address spaces and added a isVolatile field to memcpy, memmove, and memset.
llvm-svn: 100305
2010-04-04 03:10:52 +00:00
Mon P Wang f7f3bff646 Revert r100193 since it causes failures in objc in clang
llvm-svn: 100200
2010-04-02 18:43:42 +00:00
Mon P Wang 4b82a88764 Reapply patch for adding support for address spaces and added a isVolatile field to memcpy, memmove, and memset.
llvm-svn: 100193
2010-04-02 18:04:30 +00:00
Bob Wilson adb58e32cc Revert Mon Ping's 99930 due to broken llvm-gcc buildbots.
llvm-svn: 99949
2010-03-30 22:28:46 +00:00
Mon P Wang 231e99743a Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset
llvm-svn: 99930
2010-03-30 21:02:45 +00:00
John McCall 7ec5043c2c Change CodeGenModule to rely on the Module's symbol table instead of
shadowing it in the GlobalDeclMap.  Eliminates the string-uniquing
requirement for mangled names, which should help C++ codegen times a little.
Forces us to do string lookups instead of pointer lookups, which might hurt
codegen times a little across the board.  We'll see how it plays out.

Removing the string-uniquing requirement implicitly fixes any bugs like
PR6635 which arose from the fact that we had multiple uniquing tables for
different kinds of identifiers.

llvm-svn: 99012
2010-03-19 23:29:14 +00:00
Fariborz Jahanian c6140734c5 Fix a rare corner case bug which exposed a serious block API generation
when initialized variable is a byref block variable and is referenced recursively
in the initializer (you guessed it, it is block implementation of
fibonacci number). Fix, on the other hand is trvial, by generating the
API for byref variable before API for its initializer. We will have this
test added to our internal test suite as a clang-style test is not possible
due to very convoluted IR sequence. Fixes radar 7745514.

llvm-svn: 98393
2010-03-12 21:40:43 +00:00
Chris Lattner 4d94109903 set alignment on static locals properly, patch by Arnaud de Grandmaison!
llvm-svn: 98204
2010-03-10 23:59:59 +00:00
Daniel Dunbar a7566f163a IRgen: Add CreateMemTemp, for creating an temporary memory object for a particular type, and flood fill. - CreateMemTemp sets the alignment on the alloca correctly, which fixes a great many places in IRgen where we were doing the wrong thing.
- This fixes many many more places than the test case, but my feeling is we need to audit alignment systematically so I'm not inclined to try hard to test the individual fixes in this patch. If this bothers you, patches welcome!

PR6240.

llvm-svn: 95648
2010-02-09 02:48:28 +00:00
Daniel Dunbar 3d33fab7fc Reapply r95393, without the change to CGExpr. I was wrong in assuming that the
element type always matched the converted LLVM type for ExprType.

llvm-svn: 95596
2010-02-08 22:53:07 +00:00
Anders Carlsson cee2d2f016 Use the right linkage for static variables inside C++ inline functions.
llvm-svn: 95512
2010-02-07 02:03:08 +00:00
Douglas Gregor a643780483 Revert r95393, which broke Clang's self-host.
llvm-svn: 95430
2010-02-05 21:10:36 +00:00
Daniel Dunbar 363589bded IRgen: Use hasAggregateLLVMType instead of isSingleValueType() for cases that
need to deal with aggregates specially; this is consistent with the rest of IRgen.

Also, simplify EmitParmDecl and don't worry about using Decl::getNameAsString.

llvm-svn: 95393
2010-02-05 17:51:33 +00:00
Anders Carlsson 3b227bd629 Revert the new reference binding code; I came up with a way simpler solution for the reference binding bug that is preventing self-hosting.
llvm-svn: 95223
2010-02-03 16:38:03 +00:00
Anders Carlsson ab0ddb57b1 Start creating CXXBindReferenceExpr nodes when binding complex types to references.
llvm-svn: 94964
2010-01-31 18:34:51 +00:00
Ken Dyck 160146eba2 Change the return type of ASTContext::getDeclAlignInBytes() to CharUnits and,
now that the "InBytes" part of the name is implied by the return type, rename
it to getDeclAlign().

llvm-svn: 94681
2010-01-27 17:10:57 +00:00
Ken Dyck 98ca79435a Introduce CodeGenModule::GetTargetTypeStoreSize() to calculate the store size
of LLVM types in character units.

llvm-svn: 94542
2010-01-26 13:48:07 +00:00
Anders Carlsson 20bbbd489b Make sure to always mark a global variable as not being constant if it has a C++ initializer.
llvm-svn: 94504
2010-01-26 04:02:23 +00:00
Ken Dyck 40775003e6 Roll out ASTContext::getTypeSizeInChars(), replacing instances of
"ASTContext::getTypeSize() / 8". Replace [u]int64_t variables with CharUnits
ones as appropriate. 

Also rename RawType, fromRaw(), and getRaw() in CharUnits to QuantityType, 
fromQuantity(), and getQuantity() for clarity.

llvm-svn: 93153
2010-01-11 17:06:35 +00:00
Anders Carlsson 61a401caec Pass ReturnValueSlot to EmitCall. No functionality change yet.
llvm-svn: 92138
2009-12-24 19:25:24 +00:00
Ken Dyck 8c89d59c82 Move the implementation of ASTContext::getTypeSizeInChars() to the .cpp file to
avoid #including CharUnits.h in ASTContext.h.

llvm-svn: 91903
2009-12-22 14:23:30 +00:00
Ken Dyck 01e620efaa Change the return type of ASTContext::getTypeSizeInChars() from uint64_t to the
new opaque value type, CharUnits. This will help us avoid accidentally mixing 
quantities that are in bit and character units.

llvm-svn: 91689
2009-12-18 15:55:54 +00:00
Ken Dyck acfe6aa83a Rename getByteSize() and getTypeSizeInBytes() in ASTContext to getCharWidth()
and getTypeSizeInChars() to reflect their basis in character type units, not
that of a possibly independent architecture-specific byte.

llvm-svn: 91688
2009-12-18 15:24:05 +00:00
Mike Stump aff69af918 Add cleanups for exceptional edges. WIP.
llvm-svn: 90940
2009-12-09 03:35:49 +00:00
Benjamin Kramer ba8451b243 Use StringRef in CGDebugInfo::EmitFunctionStart.
llvm-svn: 90856
2009-12-08 14:04:35 +00:00
Benjamin Kramer 43c7c5befd Use a Twine to concatenate the name instead of going through std::string.
llvm-svn: 90854
2009-12-08 13:07:37 +00:00
Chris Lattner e99c110d06 implement rdar://7346691 by codegen'ing struct/array initializers
to a memset or a memcpy from a global when possible.

llvm-svn: 90658
2009-12-05 08:22:11 +00:00
Chris Lattner ffcd06ea7c simplify a condition and add a testcase.
llvm-svn: 90652
2009-12-05 06:49:57 +00:00
Anders Carlsson ce2cd01647 Handle static_assert inside functions.
llvm-svn: 90461
2009-12-03 17:26:31 +00:00
Mike Stump a68e2a2967 Add missing branch to exit. Seemingly obvious when I look at the
code, but to track this down was laborious.

llvm-svn: 90356
2009-12-02 23:28:08 +00:00
Daniel Dunbar c76493a65d Don't pass false (default) for isVolatile parameter to CreateLoad.
llvm-svn: 90098
2009-11-29 21:23:36 +00:00
Douglas Gregor 48a409eb39 Rename CleanupScope -> DelayedCleanupBlock. No functionality change.
llvm-svn: 89769
2009-11-24 16:21:10 +00:00
Daniel Dunbar 785406bd19 Teach CodeGenFunction::EmitDecl to ignore Using and UsingShadow decls.
llvm-svn: 89633
2009-11-23 00:07:06 +00:00
Mike Stump 643818bdd8 Trim whitespace.
llvm-svn: 89219
2009-11-18 18:52:31 +00:00
Chandler Carruth bc55fe26c6 Move CompileOptions -> CodeGenOptions, and sink it into the CodeGen library.
This resolves the layering violation where CodeGen depended on Frontend.

llvm-svn: 86998
2009-11-12 17:24:48 +00:00
Douglas Gregor 4ef1d400d9 Make sure that Type::getAs<ArrayType>() (or Type::getAs<subclass of
ArrayType>()) does not instantiate. Update all callers that used this
unsafe feature to use the appropriate ASTContext::getAs*ArrayType method.

llvm-svn: 86596
2009-11-09 22:08:55 +00:00
Fariborz Jahanian 09cc10f9f8 This patch extends CleanupScope to support destruction
of array objects on block exit. Patch is by Anders Calrsson.

llvm-svn: 86032
2009-11-04 17:57:40 +00:00
Tanya Lattner f9d41df093 Merge constant array and structures. This will create a global variables for arrays and structs that are constant and their initializer is constant. It is on by default but can be disable with the flag -fno-merge-all-constants.
llvm-svn: 85991
2009-11-04 01:18:09 +00:00
Mike Stump 53f9ded62b Refine volatile handling, specifically, we must have the canonical
type to look at the volatile specifier.  I found these all from just
hand auditing the code.

llvm-svn: 85967
2009-11-03 23:25:48 +00:00
Fariborz Jahanian c9076fecdf Patch for destruction of array of objects on block exit.
llvm-svn: 85512
2009-10-29 16:22:54 +00:00
Mike Stump 70197d5441 Fix 80-col violation.
llvm-svn: 84719
2009-10-21 00:42:55 +00:00
Nuno Lopes 8550cb250c ignore 'using' directive in CodeGenFunction::EmitDecl(). this fixes PR5085
llvm-svn: 84255
2009-10-16 14:40:52 +00:00
Benjamin Kramer abd5b90e4c Simplify pointer creation with the new Type::getInt*Ptr methods.
llvm-svn: 83964
2009-10-13 10:07:13 +00:00
Devang Patel 3028a43f57 Revert 83567.
llvm-svn: 83676
2009-10-09 22:06:15 +00:00
Devang Patel abf71fa9fc Record location info before emiting alloca for arguments. This allows arguments to have proper location info.
llvm-svn: 83567
2009-10-08 18:53:37 +00:00
Anders Carlsson e33eed5c1e Set alignment on static function level decls and VLAs. Fixes PR5060.
llvm-svn: 82868
2009-09-26 18:16:06 +00:00
Mike Stump 2114d7c299 Improve debug info generation for __block variables.
llvm-svn: 82508
2009-09-22 02:12:52 +00:00
Anders Carlsson ccbabc9645 Fix another byref bug. This should hopefully get QuickLookPlugins building successfully.
llvm-svn: 81681
2009-09-13 17:55:13 +00:00
Mike Stump 6768683933 Add FIXME for alignments that won't be honored.
llvm-svn: 81620
2009-09-12 18:58:28 +00:00
Anders Carlsson f8e94f2008 Add support for __block variables with alignment greater than __alignof(void *).
llvm-svn: 81602
2009-09-12 02:44:18 +00:00
Anders Carlsson 0168f4b202 For __block variables, cache the LLVM types as well as which LLVM field where the variable is stored.
llvm-svn: 81599
2009-09-12 02:14:24 +00:00
Anders Carlsson ecf9bf0158 GlobalDecl doesn't have an explicit constructor anymore.
llvm-svn: 81481
2009-09-10 23:43:36 +00:00
Anders Carlsson 10f2c10b83 Make the forwarding member of block byref structs be a pointer to the block byref struct itself.
llvm-svn: 81423
2009-09-10 01:32:12 +00:00
Daniel Dunbar 277aa36d68 Suppress build warning.
llvm-svn: 81384
2009-09-09 22:32:15 +00:00
Mike Stump 11289f4280 Remove tabs, and whitespace cleanups.
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Anders Carlsson 71d1d92d37 Make BuildByRefType take a ValueDecl instead of a QualType and an alignment.
llvm-svn: 81315
2009-09-09 02:51:03 +00:00
Anders Carlsson 49033712e4 Remove an ErrorUnsupported call.
llvm-svn: 79261
2009-08-17 18:24:57 +00:00
Anders Carlsson 5b106a7545 Add an IsInitializer flag to EmitAnyExpr. This is used to prevent temporaries from being destroyed when they're bound to a reference variable.
llvm-svn: 79179
2009-08-16 07:36:22 +00:00