summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Slight cleanup, and fix for va_arg on architectures where va_list is a Eli Friedman2009-01-201-0/+7
| | | | | | struct. llvm-svn: 62585
* Block pointer types are not aggregate types.Daniel Dunbar2009-01-091-1/+4
| | | | llvm-svn: 61973
* Handle typedefs to VLAs (Emit the size expr when we encounter the typedefAnders Carlsson2008-12-201-15/+15
| | | | llvm-svn: 61290
* Make sure to generate code for arguments that have a variably modified type.Anders Carlsson2008-12-201-0/+10
| | | | llvm-svn: 61288
* Change EmitVLASize to take a QualType that must be a variably modified type.Anders Carlsson2008-12-201-21/+32
| | | | | | | | | | | | Emit the size even if the declared type is a variably modified type. This lets us handle void f(int n) { int (*a)[n]; printf("size: %d\n", sizeof(*a)); } llvm-svn: 61285
* Split up emitting of VLA sizes and getting the size of a VLA.Anders Carlsson2008-12-201-17/+25
| | | | llvm-svn: 61284
* Add map of VLA types and their sizesAnders Carlsson2008-12-121-0/+27
| | | | llvm-svn: 60939
* Change more code over to using the new Expr::EvaluateAnders Carlsson2008-12-011-6/+4
| | | | llvm-svn: 60324
* Rename NamedDecl::getIdentifierName() to ::getNameAsCString() and make itChris Lattner2008-11-241-1/+2
| | | | | | | | | assert if the name is not an identifier. Update callers to do the right thing and avoid this method in unsafe cases. This also fixes an objc warning that was missing a space, and migrates a couple more to taking IdentifierInfo and QualTypes instead of std::strings. llvm-svn: 59936
* An expression is not foldable if it can't be fully evaluated. Fixes PR3060Anders Carlsson2008-11-221-2/+4
| | | | llvm-svn: 59887
* Introduction the DeclarationName class, as a single, general method ofDouglas Gregor2008-11-171-1/+1
| | | | | | | | representing the names of declarations in the C family of languages. DeclarationName is used in NamedDecl to store the name of the declaration (naturally), and ObjCMethodDecl is now a NamedDecl. llvm-svn: 59441
* rename Expr::tryEvaluate to Expr::Evaluate.Chris Lattner2008-11-161-1/+1
| | | | llvm-svn: 59426
* Normalize many BasicBlock names.Daniel Dunbar2008-11-131-2/+2
| | | | | | | | | | - 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
* Quick fix for crash in IRgen when we can tryEvaluate a condition toDaniel Dunbar2008-11-121-2/+5
| | | | | | | | | something that is not an int. - Ignore these cases for now, added FIXME that we should also boolize them. llvm-svn: 59184
* Handle ?: in EmitBranchOnBoolExpr.Daniel Dunbar2008-11-121-0/+17
| | | | llvm-svn: 59129
* Handle Unary ! in EmitBranchOnBoolExpr, so that we can efficientlyChris Lattner2008-11-121-1/+6
| | | | | | codegen stuff like "if (!(X && Y))" llvm-svn: 59115
* Move EmitBranchOnBoolExpr and ConstantFoldsToSimpleInteger toChris Lattner2008-11-121-0/+85
| | | | | | | | | | CodeGenFunction.cpp. Change VisitConditionalOperator to use constant fold instead of codegen'ing a constant conditional. Change ForStmt to use EmitBranchOnBoolExpr, this shrinks expr.c very slightly to 40239 lines. llvm-svn: 59113
* Rework IRgen invariant w.r.t. current insert point.Daniel Dunbar2008-11-111-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - EmitStmt is no longer required to finish with a current insertion point defined (i.e. it does not need to make dummy blocks). Instead, it can clear the insertion point in the builder which indicates that the current insertion point is unreachable. - CodeGenFunction provides HaveInsertPoint and EnsureInsertPoint which respectively test if there is an insert point and ensure an insertion point exists (by making a dummy block). - Clearly mark functions in CodeGenFunction which can be called with no insertion point defined. Currently this is a limited set, and EmitStmt simply EnsureInsertPoint()s before emitting subsequent IR. Remove EmitDummyBlock, which is no longer needed. Clients who haven't already cleared the insertion point (typically via EmitBranch) can do so by hand. Remove isDummyBlock, which has effectively been renamed to HaveInsertPoint. The main thrust of this change is that we no longer have create dummy blocks just to destroy them a short time later in EmitBlock in the common case that there is no unreachable code following something like a goto. Additionally, this means that we are not using the hokey condition in isDummyBlock that a block without a name is a dummy block. Guess how well that works when we never emit block names! llvm-svn: 59089
* Emit debug region end in unified return block.Daniel Dunbar2008-11-111-6/+7
| | | | llvm-svn: 59081
* short circuit && and || when possible. This substantially reducesChris Lattner2008-11-111-0/+30
| | | | | | | | the size of the -O0 output on some cases. For example, on expr.c from 176.gcc, it shrinks the .ll file from 43164 to 42835 lines, and removed references to two external symbols. llvm-svn: 59034
* Remove CodeGenFunction::StartBlock.Daniel Dunbar2008-11-111-10/+0
| | | | | | - Was confusing and only used in one small part of the code. llvm-svn: 59020
* Centralize basic block creation in CodeGenFunction::createBasicBlock.Daniel Dunbar2008-11-111-5/+5
| | | | | | - No functionality change. llvm-svn: 59017
* Implement lowering of va_arg in clang directly. (This is 32-bit X86 only for ↵Anders Carlsson2008-11-041-0/+35
| | | | | | now). llvm-svn: 58681
* Don't run the verifier as part of IRgen, this is now down (per module)Daniel Dunbar2008-10-281-7/+0
| | | | | | in the driver (this means we no longer run the verifier per function, however). llvm-svn: 58307
* Debug info bug fix, function start wasn't getting generated correctlyDaniel Dunbar2008-10-181-7/+12
| | | | | | for Obj-C methods. llvm-svn: 57769
* Change CGDebugInfo::setLocation to just ignore invalid locations. ThisDaniel Dunbar2008-10-171-6/+2
| | | | | | | | | simplifies clients. Also, add assert that RegionStack is empty when the CGDebugInfo is destroyed. llvm-svn: 57684
* Simplify code to emit the unified return block and move it to the endDaniel Dunbar2008-09-271-12/+4
| | | | | | of the function. llvm-svn: 56752
* Print current function on verification failures.Daniel Dunbar2008-09-171-1/+4
| | | | llvm-svn: 56291
* Make sure to store the exception in the catch parameter.Anders Carlsson2008-09-111-0/+5
| | | | llvm-svn: 56102
* Move ABI specific code for functions / calls to CGCall.cpp:Daniel Dunbar2008-09-091-37/+3
| | | | | | - Factor out EmitFunction{Pro,Epi}log llvm-svn: 56031
* Factor CodeGenFunction::StartFunction out of GenerateCode andDaniel Dunbar2008-09-091-27/+41
| | | | | | StartObjCMethod. llvm-svn: 56030
* Use a unified return block.Daniel Dunbar2008-09-091-12/+30
| | | | | | | - For the time being this means our emitted code is somewhat worse, especially for aggregates. This will be fixed. llvm-svn: 56013
* Avoid superfluous errors regarding variable-length arrays (casts).Daniel Dunbar2008-09-041-2/+3
| | | | llvm-svn: 55759
* Stub out CodeGenFunction::EmitObjCForCollectionStmt.Anders Carlsson2008-08-301-0/+20
| | | | | | Add CodeGenFunction::EmitMemSetToZero and make AggExprEmitter::EmitAggregateClear use it. llvm-svn: 55573
* Objective-C @synthesize support.Daniel Dunbar2008-08-261-8/+12
| | | | | | | | | | | - Only supports simple assignment and atomic semantics are ignored. - Not quite usable yet because the methods do not actually get added to the class metadata. - Added ObjCPropertyDecl::getSetterKind (one of Assign, Copy, Retain). - Rearrange CodeGenFunction so synthesis can reuse function prolog / epilog code. llvm-svn: 55365
* Do typechecking and codegen for K&R-style function declarations Eli Friedman2008-08-251-4/+17
| | | | | | | correctly. Not a regression, but made more obvious by my recent fix which made function type compatibility checking a bit more strict. llvm-svn: 55339
* Change WarnUnsupported to ErrorUnsupported (in name and in practice).Daniel Dunbar2008-08-161-3/+3
| | | | | | | - We are beyond the point where this shows up often and when it does generating miscompiled files is bad. llvm-svn: 54836
* More #include cleaningDaniel Dunbar2008-08-111-5/+0
| | | | | | | | | | | - Kill unnecessary #includes in .cpp files. This is an automatic sweep so some things removed are actually used, but happen to be included by a previous header. I tried to get rid of the obvious examples and this was the easiest way to trim the #includes in one fell swoop. - We now return to regularly scheduled development. llvm-svn: 54632
* More #include cleaningDaniel Dunbar2008-08-111-0/+2
| | | | | | | | - Drop {Decl.h,DeclObjC.h,IdentifierTable.h} from Expr.h - Moved Sema::getCurMethodDecl() out of line (dependent on ObjCMethodDecl via dyn_cast). llvm-svn: 54629
* More #include cleaningDaniel Dunbar2008-08-111-1/+1
| | | | | | - Remove internal uses of AST.h llvm-svn: 54628
* Avoid creating dummy block when no indirect gotos are present.Daniel Dunbar2008-08-041-0/+3
| | | | llvm-svn: 54322
* Add CodeGen support for indirect goto.Daniel Dunbar2008-08-041-1/+34
| | | | | | | | | | - Follows emission scheme used by llvm-gcc, i.e. invent an id for each label whose address is taken and replace each indirect goto by a switch to each possible target. - Currently we emit a switch for each indirect goto instead of merging them as llvm-gcc does. llvm-svn: 54318
* Rework codegen emission of globalsDaniel Dunbar2008-07-291-2/+3
| | | | | | | | | | | | | | | | | | | | - No (intended) functionality change. - Primary purpose is to clearly separate (lazy) construction of globals that are a forward declaration or tentative definition from those that are the final definition. - Lazy construction is now encapsulated in GetAddrOf{Function,GlobalVar} while final definitions are constructed in EmitGlobal{Function,Var}Definition. - External interface for dealing with globals is now limited to EmitGlobal and GetAddrOf{Function,GlobalVar}. - Also updated helper functions dealing with statics, annotations, and ctors to be private. llvm-svn: 54179
* Fix rdar://6103124, the only dummy blocks are ones without names. Named blocksChris Lattner2008-07-251-1/+1
| | | | | | are important part of control flow structures. llvm-svn: 54078
* Fixed bugzilla bug# 2489.Sanjiv Gupta2008-07-041-0/+20
| | | | | | This was broken when the GenerateCode function was splitted to use GenerateFunction. llvm-svn: 53136
* Change self/_cmd to be instances of ImplicitParamDecl instead of ParmVarDecl.Chris Lattner2008-06-171-133/+20
| | | | | | Patch by David Chisnall! llvm-svn: 52422
* Basic support for volatile loads and stores. Stores the volatile Eli Friedman2008-06-131-0/+2
| | | | | | | | | | 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
* First cut at setting attributes for functions and calls; this puts us Eli Friedman2008-06-011-31/+0
| | | | | | | | | | | | | | | much closer to passing the gcc struct layout tests. It might be possible to refactor this a bit, but I'm not sure there's actually enough common code for that to be useful. To get the calling convention completely correct, a bit of platform-specific code is necessary even for x86-Linux. On x86-Linux, the alignment of function parameters is extremely strange; as far as I can tell, it's always 4 except for SSE vectors or structs containing SSE vectors. I'm continuing to investigate this. llvm-svn: 51839
* Support for code generation of Objective-C top-level language constructs.Anton Korobeynikov2008-06-011-5/+16
| | | | | | Implemented by David Chisnall! llvm-svn: 51835
* Generate subprogram debug info with -g.Sanjiv Gupta2008-05-251-10/+9
| | | | | | Also take care of freeing memory at the right places. llvm-svn: 51553
OpenPOWER on IntegriCloud