Commit Graph

307 Commits

Author SHA1 Message Date
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
Owen Anderson 41a750271b Update for LLVM API change.
llvm-svn: 78946
2009-08-13 21:57:51 +00:00
Anders Carlsson ec143777ba Add CK_ToUnion and use it for aggregate expression codegen.
llvm-svn: 78429
2009-08-07 23:22:37 +00:00
Owen Anderson 0b75f23b94 Update for LLVM API change.
llvm-svn: 77722
2009-07-31 20:28:54 +00:00
Mike Stump 658fe02d17 Canonicalize else spacing.
llvm-svn: 77629
2009-07-30 22:28:39 +00:00
Owen Anderson 9793f0e4d7 Update for LLVM API change.
llvm-svn: 77514
2009-07-29 22:16:19 +00:00
Ted Kremenek c23c7e6a51 Change uses of:
Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
  Type::getAsRecordType() -> Type::getAs<RecordType>()
  Type::getAsPointerType() -> Type::getAs<PointerType>()
  Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>()
  Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>()
  Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>()
  Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>()
  Type::getAsReferenceType() -> Type::getAs<ReferenceType>()
  Type::getAsTagType() -> Type::getAs<TagType>()
  
And remove Type::getAsReferenceType(), etc.

This change is similar to one I made a couple weeks ago, but that was partly
reverted pending some additional design discussion. With Doug's pending smart
pointer changes for Types, it seemed natural to take this approach.

llvm-svn: 77510
2009-07-29 21:53:49 +00:00
Owen Anderson b7a2fe6f81 Update for LLVM API change.
llvm-svn: 77012
2009-07-24 23:12:58 +00:00
Mon P Wang acedf7768f Preserve address space information through member accesses, e.g.,
__attribute__((address_space(1))) struct {int arr[ 3 ]; }  *p1;
   ... = p1->arr[2];  // load from address space 1

llvm-svn: 76717
2009-07-22 03:08:17 +00:00
Ted Kremenek 8a286fbdb9 Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methods
until Doug Gregor's Type smart pointer code lands (or more discussion occurs).
These methods just call the new Type::getAs<XXX> methods, so we still have
reduced implementation redundancy. Having explicit getAsXXXType() methods makes
it easier to set breakpoints in the debugger.

llvm-svn: 76193
2009-07-17 17:50:17 +00:00
Ted Kremenek b825c0ddc5 Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents.
llvm-svn: 76139
2009-07-17 01:20:38 +00:00
Owen Anderson 170229f68d Update for LLVM API change, and contextify a bunch of related stuff.
llvm-svn: 75705
2009-07-14 23:10:40 +00:00
Owen Anderson ae86c19e68 Update for LLVM API change.
llvm-svn: 75446
2009-07-13 04:10:07 +00:00
Anders Carlsson 5b2095ce16 Implement code generation of ChooseExpr for aggregate types.
llvm-svn: 75021
2009-07-08 18:33:14 +00:00
Fariborz Jahanian 5f21d2f69a Implemented memmove_collectable API for Next runtime
when struct variables with GC'able members are copied into.
Will provide a test case later.

llvm-svn: 74984
2009-07-08 01:18:33 +00:00
Argyrios Kyrtzidis cfbfe78e9e De-ASTContext-ify DeclContext.
Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating".
Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit.

llvm-svn: 74506
2009-06-30 02:36:12 +00:00
Anders Carlsson 43c52cdc29 Use PushConditionalTempDestruction/PopConditionalTempDestruction for the ternary operator.
llvm-svn: 72842
2009-06-04 03:00:32 +00:00
Eli Friedman dd27484888 PR4316: Fix IRGen for cast-to-union extension.
llvm-svn: 72803
2009-06-03 20:45:06 +00:00
Anders Carlsson 8eb93e72f7 Emit destructors correctly for temporaries.
llvm-svn: 72655
2009-05-31 00:34:10 +00:00
Anders Carlsson fd2af0cf86 Add lvalue irgen support for CXXBindTemporaryExpr.
llvm-svn: 72649
2009-05-30 23:30:54 +00:00
Anders Carlsson 3be22e27b6 More temporary support.
llvm-svn: 72648
2009-05-30 23:23:33 +00:00
Anders Carlsson 4b2434da54 Remove VarDecl from CXXConstructExpr.
llvm-svn: 72633
2009-05-30 20:56:46 +00:00
Mike Stump df0fe27b66 Fixup the rest of the trivial cases of the codegen of volatile. If
any body can spot codegen bugs with volatile, or knows of any in the
bug database, let me know.

llvm-svn: 72572
2009-05-29 15:46:01 +00:00
Eli Friedman 2a69547f38 PR4281: Fix bogus CodeGen assertion. The issue is that
getUnqualifiedType() doesn't strip off all qualifiers for non-canonical 
types.

llvm-svn: 72552
2009-05-28 23:04:00 +00:00
Fariborz Jahanian 7c1baf46d6 No write-barrier for initializations.
llvm-svn: 72492
2009-05-27 19:54:11 +00:00
Anders Carlsson ddcbfe7b53 IRgen support for calls to functions that return references to aggregate exressions.
llvm-svn: 72479
2009-05-27 16:45:02 +00:00
Mike Stump 3e97f3b35d Fix typo. I also fixed the hard to read case differences, so that no
one else is tempted to copy the style, incorrectly.

llvm-svn: 72448
2009-05-27 01:42:21 +00:00
Mike Stump ec3cbfe8c6 Fixup codegen for volatile structs in the trivial cases (a a=a and a=a=a).
llvm-svn: 72439
2009-05-26 22:03:21 +00:00
Mike Stump 25306cacc6 Esnure that if we have a volatile structure as the destination, that
we actually have a destination.

llvm-svn: 72429
2009-05-26 18:57:45 +00:00
Mike Stump b9f2518626 Propagate volatile for implicit property refernces.
llvm-svn: 72353
2009-05-23 23:52:31 +00:00
Mike Stump 9afc476d4a Propagate volatile around for property references.
llvm-svn: 72352
2009-05-23 23:48:13 +00:00
Mike Stump 5e9e61b8d2 Track volatile aggregate copies better. I'm hoping someone else will decide
how to get the backend to know that the operation is volatile.

llvm-svn: 72348
2009-05-23 22:29:41 +00:00
Mike Stump 332ec2ce81 Fix thinko, and implement aggregate volatile reads.
llvm-svn: 72347
2009-05-23 22:01:27 +00:00
Mike Stump 23abd46b79 More volatile fixes. Can't testcase these yet as ultimately volatile
is still ignored.

llvm-svn: 72344
2009-05-23 21:40:07 +00:00
Mike Stump ca9fc09c61 Collapse a few FIXMEs together and refactor to make fixing the code easier.
llvm-svn: 72342
2009-05-23 20:28:01 +00:00
Mike Stump 8673657275 One step to fixing up codegen for a=b, where a is a volatile struct.
llvm-svn: 72315
2009-05-23 04:13:59 +00:00
Mike Stump a35af82429 Fix typo.
llvm-svn: 72308
2009-05-23 02:02:29 +00:00
Anders Carlsson c82b86dfaa Have AggExprEmitter::VisitCXXConstructExpr make new variables if necessary. Stub out VisitCXXExprWithTemporaries.
llvm-svn: 72103
2009-05-19 04:48:36 +00:00
Mike Stump 18bb9284ff Reflow some comments.
llvm-svn: 71937
2009-05-16 07:57:57 +00:00
Anders Carlsson 1619a5041c Make codegen for constructors work again.
llvm-svn: 70785
2009-05-03 17:47:16 +00:00
Chris Lattner a4185c543e fix PR4067: [Linux kernel] cannot aggregate codegen stmtexpr as lvalue
llvm-svn: 70067
2009-04-25 19:35:26 +00:00
Chris Lattner 2f343dd5c8 fix PR4026: Clang can't codegen __func__ without implicit cast
llvm-svn: 69747
2009-04-21 23:00:09 +00:00
Anders Carlsson b7f8f594f3 Implement basic code generation of constructor calls. We can now compile:
struct S {
S(int, int);
};

void f() {
S s(10, 10);
}

llvm-svn: 69330
2009-04-17 00:06:03 +00:00
Eli Friedman 20bb5e02a5 Minor work related to removing the assumption that value initialization
implies an all-zero bit pattern.

llvm-svn: 68994
2009-04-13 21:47:26 +00:00
Douglas Gregor bcced4ec31 Propagate the ASTContext to various AST traversal and lookup functions.
No functionality change (really).

llvm-svn: 68726
2009-04-09 21:40:53 +00:00
Eli Friedman 9127aa1caf Minor cleanup.
llvm-svn: 67896
2009-03-28 03:10:45 +00:00
Eli Friedman d6a7b72944 Remove dead code.
llvm-svn: 67477
2009-03-22 20:54:47 +00:00
Mike Stump bc7d67ce08 Add codegen support for aggregate BlockDeclRefExprs.
llvm-svn: 67207
2009-03-18 15:54:29 +00:00
Chris Lattner ca05dfef65 brain thinking memcpy, fingers thinking memset :)
llvm-svn: 65701
2009-02-28 18:31:01 +00:00
Chris Lattner 3ef668c27a after going around in circles a few times, finally cave and emit structure
copies with memcpy instead of memmove.  This matches what GCC does and if it
causes a problem with a particular libc we can always fix it with a target
hook.

llvm-svn: 65699
2009-02-28 18:18:58 +00:00
Chris Lattner d7cfc246f6 rip out __builtin_overload
llvm-svn: 64961
2009-02-18 22:14:55 +00:00
Daniel Dunbar e9fcadd2a6 Use EmitVAListRef instead of EmitLValue directly to handle array decay
case on x86_64.

llvm-svn: 64333
2009-02-11 22:25:55 +00:00
Douglas Gregor bf7207a11f Make CodeGen produce an error if we come across a non-constant initializer list that involves the GNU array-range designator extension
llvm-svn: 63327
2009-01-29 19:42:23 +00:00
Douglas Gregor 0202cb406e Introduce a new expression node, ImplicitValueInitExpr, that
represents an implicit value-initialization of a subobject of a
particular type. This replaces the (ab)use of CXXZeroValueInitExpr
within initializer lists for the "holes" that occur due to the use of
C99 designated initializers.

The new test case is currently XFAIL'd, because CodeGen's
ConstExprEmitter (in lib/CodeGen/CGExprConstant.cpp) needs to be
taught to value-initialize when it sees ImplicitValueInitExprs.

llvm-svn: 63317
2009-01-29 17:44:32 +00:00
Douglas Gregor 5169570e28 Clean up designated initialization of unions, so that CodeGen doesn't
have to try to guess which member is being initialized.

llvm-svn: 63315
2009-01-29 16:53:55 +00:00
Douglas Gregor 17bd094a6b Improvements to code-generation and semantic analysis of designated
initializers.

  - We now initialize unions properly when a member other than the
    first is named by a designated initializer.
  - We now provide proper semantic analysis and code generation for
    GNU array-range designators *except* that side effects will occur
    more than once. We warn about this.

llvm-svn: 63253
2009-01-28 23:36:17 +00:00
Douglas Gregor 347f7eabb9 Code generation support for C99 designated initializers.
The approach I've taken in this patch is relatively straightforward,
although the code itself is non-trivial. Essentially, as we process
an initializer list we build up a fully-explicit representation of the
initializer list, where each of the subobject initializations occurs
in order. Designators serve to "fill in" subobject initializations in
a non-linear way. The fully-explicit representation makes initializer
lists (both with and without designators) easy to grok for codegen and
later semantic analyses. We keep the syntactic form of the initializer
list linked into the AST for those clients interested in exactly what
the user wrote.

Known limitations:
  - Designating a member of a union that isn't the first member may
    result in bogus initialization (we warn about this)
  - GNU array-range designators are not supported (we warn about this)

llvm-svn: 63242
2009-01-28 21:54:33 +00:00
Eli Friedman 3f66b84c86 Support CodeGen for __extension__ operator on aggregates.
llvm-svn: 63101
2009-01-27 09:03:41 +00:00
Eli Friedman 7139af42ce Rename Expr::isConstantExpr to Expr::isConstantInitializer; this more
accurately states what the function is trying to do and how it is 
different from Expr::isEvaluatable.  Also get rid of a parameter that is both 
unused and inaccurate.

llvm-svn: 62951
2009-01-25 02:32:41 +00:00
Nuno Lopes 7ffcf93b24 add codegen support to union casts
init of static vars still not working. I'll get back to it tomorrow or so

llvm-svn: 62278
2009-01-15 20:14:33 +00:00
Sebastian Redl 020cddcfee Prevent a segfault for vaarg expressions on unsupported architectures.
llvm-svn: 62008
2009-01-09 21:09:38 +00:00
Douglas Gregor 91f84216f7 Unifies the name-lookup mechanisms used in various parts of the AST
and separates lexical name lookup from qualified name lookup. In
particular:
  * Make DeclContext the central data structure for storing and
    looking up declarations within existing declarations, e.g., members
    of structs/unions/classes, enumerators in C++0x enums, members of
    C++ namespaces, and (later) members of Objective-C
    interfaces/implementations. DeclContext uses a lazily-constructed
    data structure optimized for fast lookup (array for small contexts,
    hash table for larger contexts). 

  * Implement C++ qualified name lookup in terms of lookup into
    DeclContext.

  * Implement C++ unqualified name lookup in terms of
    qualified+unqualified name lookup (since unqualified lookup is not
    purely lexical in C++!)

  * Limit the use of the chains of declarations stored in
    IdentifierInfo to those names declared lexically.

  * Eliminate CXXFieldDecl, collapsing its behavior into
    FieldDecl. (FieldDecl is now a ScopedDecl).

  * Make RecordDecl into a DeclContext and eliminates its
    Members/NumMembers fields (since one can just iterate through the
    DeclContext to get the fields).

llvm-svn: 60878
2008-12-11 16:49:14 +00:00
Eli Friedman f5d08c9ee4 Disabling this code due to regression on test/CodeGen/bitfield.c. See
PR3152.

llvm-svn: 60389
2008-12-02 01:17:45 +00:00
Eli Friedman c59bb48e80 Fix for PR2969: generate a memcpy from a constant for constant
initializers.  llvm-gcc appears to be more aggressive, but incorrect, 
for constructs like "const int a[] = {1,2,3};"; that said, current 
optimizers will do the appropriate optimizations when safe.

llvm-svn: 60270
2008-11-30 02:11:09 +00:00
Fariborz Jahanian 9ac535162b Implemented ir-gen for 'implicit' properties using the new AST nodes.
llvm-svn: 59886
2008-11-22 22:30:21 +00:00
Fariborz Jahanian 8a1810f06b New AST node to access "implicit" setter/getter using property dor syntax.
Issuing diagnostics when assigning to read-only properties.
This is work in progress.

llvm-svn: 59874
2008-11-22 18:39:36 +00:00
Chris Lattner 0f137df0aa reapply the (corrected) patch to use the new llvm intrinsics for memcpy/memmove etc.
llvm-svn: 59824
2008-11-21 16:43:15 +00:00
Chris Lattner b7f4ce3de7 temporarily revert Sangiv's patch.
llvm-svn: 59821
2008-11-21 16:26:37 +00:00
Sanjiv Gupta 371298488b mem[cpy,set,move] intrinsics are now overloaded.
llvm-svn: 59806
2008-11-21 07:57:42 +00:00
Daniel Dunbar a612e79be4 Normalize many BasicBlock names.
- Use dotted notation for blocks related to a particular statement
   type.
 - Use .end for landing pads.

No functionality change in NDEBUG mode. :)

llvm-svn: 59210
2008-11-13 01:38:36 +00:00
Daniel Dunbar c56e67644f Add CodeGenFunction::EmitBranch.
- Emits an unconditional branch, with extra logic to avoid generating
   spurious branches out of dummy blocks.

llvm-svn: 59037
2008-11-11 09:41:28 +00:00
Daniel Dunbar 75283ff38a Centralize basic block creation in CodeGenFunction::createBasicBlock.
- No functionality change.

llvm-svn: 59017
2008-11-11 02:29:29 +00:00
Anders Carlsson 13abd7e98b Implement lowering of va_arg in clang directly. (This is 32-bit X86 only for now).
llvm-svn: 58681
2008-11-04 05:30:00 +00:00
Daniel Dunbar cb4638599c Move IRBuilder type definition to common file.
- No functionality change.

llvm-svn: 58546
2008-11-01 01:53:16 +00:00
Chris Lattner 084bc32e0d make codegen reject initializes with designators, like this:
t.c:1:13: error: cannot codegen this designators yet
int a[10] = {2, 4, [8]=9, 10};
            ^~~~~~~~~~~~~~~~~

llvm-svn: 58220
2008-10-26 23:53:12 +00:00
Daniel Dunbar 0bc8e86d6e Move EmitAggregate{Copy,Clear} into CodeGenFunction.
- No functionality change.

llvm-svn: 56010
2008-09-09 20:49:46 +00:00
Anders Carlsson 2e744e8aa6 Stub out CodeGenFunction::EmitObjCForCollectionStmt.
Add CodeGenFunction::EmitMemSetToZero and make AggExprEmitter::EmitAggregateClear use it.

llvm-svn: 55573
2008-08-30 19:51:14 +00:00
Anders Carlsson 7e1e57103e Simplify some calls to Builder.CreateCall
llvm-svn: 55567
2008-08-30 16:17:45 +00:00
Daniel Dunbar 4b8c6db927 Add Objective-C property setter support.
- Change Obj-C runtime message API, drop the ObjCMessageExpr arg in
   favor of just result type and selector. Necessary so it can be
   reused in situations where we don't want to cons up an
   ObjCMessageExpr.
 - Update aggregate binary assignment to know about special property
   ref lvalues.
 - Add CodeGenFunction::EmitCallArg overload which takes an already
   emitted rvalue.

Add CodeGenFunction::StoreComplexIntoAddr.

Disabled logic in Sema for parsing Objective-C dot-syntax that
accesses methods. This code does not search in the correct order and
the AST node has no way of properly representing its results.

Updated StmtDumper to print a bit more information about
ObjCPropertyRefExprs.

llvm-svn: 55561
2008-08-30 05:35:15 +00:00
Daniel Dunbar 55310df79c Initial support for Obj-C dot-syntax for getters.
llvm-svn: 55410
2008-08-27 06:57:25 +00:00
Daniel Dunbar 28ff072b70 Drop a dead call to isConstantExpr()
llvm-svn: 55244
2008-08-23 18:44:10 +00:00
Daniel Dunbar c8317a44cf Implement Obj-C ivar references to aggregates.
Implement Obj-C lvalue message sends (aggregate returns).

Update several places to emit more precise ErrorUnsupported warnings
  for currently unimplemented Obj-C features (main missing chunks are
  property references, Obj-C exception handling, and the for ... in
  syntax).

llvm-svn: 55234
2008-08-23 10:51:21 +00:00
Daniel Dunbar 97db84ce6d Trim CGObjCRuntime::GenerateMessageSend[Super]
- Returns an RValue.
 - Reduced to only taking the CodeGenFunction, Expr, and Receiver.
 - Becomes responsible for emitting the arguments.

Add CodeGenFunction::EmitCallExprExt
 - Takes optional extra arguments to insert at the head of the call.
 - This allows the Obj-C runtimes to call into this and isolates the
   argument and call instruction generation code to one place. Upshot
   is that we now pass structures (more) correctly.

Also, fix one aspect of generating methods which take structure
arguments (for NeXT). This probably needs to be merged with the
SetFunctionAttributes code in CodeGenModule.cpp

llvm-svn: 55223
2008-08-23 03:46:30 +00:00
Daniel Dunbar a7c8cf6200 Change WarnUnsupported to ErrorUnsupported (in name and in practice).
- We are beyond the point where this shows up often and when it does
   generating miscompiled files is bad.

llvm-svn: 54836
2008-08-16 00:56:44 +00:00
Daniel Dunbar ad319a73f2 More #include cleaning
- Remove internal uses of AST.h

llvm-svn: 54628
2008-08-11 05:00:27 +00:00
Chris Lattner c893a67fe3 update to make IRBuilder API change.
llvm-svn: 54548
2008-08-08 19:57:58 +00:00
Daniel Dunbar e8bdce441b Fix EmitNullInitializationToLValue for bitfield lvalues.
- PR2643

llvm-svn: 54397
2008-08-06 05:32:55 +00:00
Chris Lattner 7adf076088 Finally fix PR2189. This makes a fairly invasive but important change to
move getAsArrayType into ASTContext instead of being a method on type.
This is required because getAsArrayType(const AT), where AT is a typedef
for "int[10]" needs to return ArrayType(const int, 10).

Fixing this greatly simplifies getArrayDecayedType, which is a good sign.

llvm-svn: 54317
2008-08-04 07:31:14 +00:00
Daniel Dunbar b39b1cd7c3 Fix implicit initialization of structures.
<rdar://problem/6113085>

llvm-svn: 54237
2008-07-30 21:00:24 +00:00
Chris Lattner 0f398c4472 remove uses of QualType::getCanonicalType() from codegen for PR2189
llvm-svn: 54107
2008-07-26 22:37:01 +00:00
Chris Lattner b1d329da07 "Support for Objective-C message sends which return structures. Also includes a small fix for constant string handling that should have been in the last patch (sorry!) and a hook for generating selectors (rest of this implementation to follow in the next patch)."
Patch by David Chisnall!

llvm-svn: 52681
2008-06-24 17:04:18 +00:00
Ted Kremenek 08e171183f This patch is motivated by numerous strict-aliasing warnings when compiling
clang as a Release build.

The big change is that all AST nodes (subclasses of Stmt) whose children are
Expr* store their children as Stmt* or arrays of Stmt*. This is to remove
strict-aliasing warnings when using StmtIterator. None of the interfaces of any
of the classes have changed (except those with arg_iterators, see below), as the
accessor methods introduce the needed casts (via cast<>). While this extra
casting may seem cumbersome, it actually adds some important sanity checks
throughout the codebase, as clients using StmtIterator can potentially overwrite
children that are expected to be Expr* with Stmt* (that aren't Expr*). The casts
provide extra sanity checks that are operational in debug builds to catch
invariant violations such as these.

For classes that have arg_iterators (e.g., CallExpr), the definition of
arg_iterator has been replaced. Instead of it being Expr**, it is an actual
class (called ExprIterator) that wraps a Stmt**, and provides the necessary
operators for iteration. The nice thing about this class is that it also uses
cast<> to type-checking, which introduces extra sanity checks throughout the
codebase that are useful for debugging.

A few of the CodeGen functions that use arg_iterator (especially from
OverloadExpr) have been modified to take begin and end iterators instead of a
base Expr** and the number of arguments. This matches more with the abstraction
of iteration. This still needs to be cleaned up a little bit, as clients expect
that ExprIterator is a RandomAccessIterator (which we may or may not wish to
allow for efficiency of representation).

This is a fairly large patch. It passes the tests (except CodeGen/bitfield.c,
which was already broken) on both a Debug and Release build, but it should
obviously be reviewed.

llvm-svn: 52378
2008-06-17 02:43:46 +00:00
Eli Friedman 327944b343 Basic support for volatile loads and stores. Stores the volatile
qualifier in the lvalue, and changes lvalue loads/stores to honor 
the volatile flag.  Places which need some further attention are marked 
with FIXMEs.

Patch by Cédric Venet.

llvm-svn: 52264
2008-06-13 23:01:12 +00:00
Eli Friedman 21911e89d5 A few more cases for aggregate values.
llvm-svn: 51596
2008-05-27 15:51:49 +00:00
Eli Friedman df649f3da5 Emit memmove, not memcpy, for structure copies; this is unfortunately
required for correctness in cases of copying a struct to itself or to 
an overlapping struct (itself for cases like *a = *a, and overlapping 
is possible with unions).

Hopefully, this won't end up being a perf issue; LLVM *should* be able 
to optimize memmove to memcpy in a lot of cases, and for small copies 
the generated code *should* be mostly comparable. (In reality, LLVM 
is currently horrible at optimizing memmove, but that's a bug, not a 
fundamental issue.)

gcc currently generates wrong code; that's 
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32667.

llvm-svn: 51566
2008-05-26 12:59:39 +00:00
Dan Gohman 5d30975e5e Change uses of llvm::Type::isFirstClassType to use the new
llvm::Type::isSingleValueType. Currently these two functions have
the same behavior, but soon isFirstClassType will return true for
struct and array types.

Clang may some day want to use of isFirstClassType for some of
these some day as an optimization, but it'll require some
consideration.

llvm-svn: 51446
2008-05-22 22:12:56 +00:00
Eli Friedman 4b0e2a30e0 Implement codegen for comma operator for structs.
llvm-svn: 51304
2008-05-20 07:56:31 +00:00
Eli Friedman f23b6fa41f Fix the emission of expressions like char a[10] = "asdf"; previously,
they were causing bad code to be emitted.  There are two fixes here: one 
makes sure we emit a string that is long enough, and one makes sure we 
properly handle string initialization in init lists.

llvm-svn: 51259
2008-05-19 17:51:16 +00:00
Eli Friedman 6e31321043 Don't try to take the address of a bitfield; fixes PR2310.
llvm-svn: 50966
2008-05-12 15:06:05 +00:00
Chris Lattner dbcc2ca6b2 simplify some builder calls.
llvm-svn: 50694
2008-05-06 00:56:42 +00:00
Chris Lattner 61705c1a6e update to follow mainline llvm API change.
llvm-svn: 49607
2008-04-13 07:32:11 +00:00
Chris Lattner aa9c7aed0f Add support for C++ default arguments, and rework Parse-Sema
interaction for function parameters, fixing PR2046.

Patch by Doug Gregor!

llvm-svn: 49369
2008-04-08 04:40:51 +00:00
Gabor Greif d36afd7d65 tracking API changes arising from r49277
llvm-svn: 49279
2008-04-06 20:42:52 +00:00
Chris Lattner 579a05d767 Fix PR2049, updating Eli's patch that fixes to mainline. This produces incorrect
code, but the codegen doesn't crash.  I'll file a bugzilla for the AST being wrong.

llvm-svn: 49226
2008-04-04 18:42:16 +00:00
Chris Lattner f3bc75afcf Since isComplexType() no longer returns true for _Complex integers, the code
generator needs to call isAnyComplexType().  This fixes PR1960.

llvm-svn: 49220
2008-04-04 16:54:41 +00:00
Chris Lattner 3e593cdb98 simplify the clang codegen by using the new Builder.CreateStructGEP method.
llvm-svn: 48534
2008-03-19 05:19:41 +00:00
Chris Lattner 7a51313d8a Make a major restructuring of the clang tree: introduce a top-level
lib dir and move all the libraries into it.  This follows the main
llvm tree, and allows the libraries to be built in parallel.  The
top level now enforces that all the libs are built before Driver,
but we don't care what order the libs are built in.  This speeds
up parallel builds, particularly incremental ones.

llvm-svn: 48402
2008-03-15 23:59:48 +00:00