summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* reduce nesting, use memchr instead of explicit loop, eliminate aChris Lattner2009-03-101-93/+86
| | | | | | temporary std::string to fix a fixme. llvm-svn: 66530
* Expand %= into ${:uid} so that the code generator emits a unique ID for theChris Lattner2009-03-101-13/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | asm. This allows us to properly handle the case when an optimizer duplicates the asm, such as here: void bar() { int i; for (i = 0; i < 3; ++i) asm("foo %=" : : "r"(0)); } we now produce: _bar: xorl %eax, %eax ## InlineAsm Start foo 0 ## InlineAsm End ## InlineAsm Start foo 1 ## InlineAsm End ## InlineAsm Start foo 2 ## InlineAsm End ret instead of: _bar: xorl %eax, %eax ## InlineAsm Start foo 1 ## InlineAsm End ## InlineAsm Start foo 1 ## InlineAsm End ## InlineAsm Start foo 1 ## InlineAsm End ret This also fixes a fixme by eliminating a static. llvm-svn: 66528
* add some helper methods to AsmStmt and add some comments.Chris Lattner2009-03-101-4/+2
| | | | llvm-svn: 66521
* slightly simplify some code, pull the 'is simple asm' case up inChris Lattner2009-03-101-24/+30
| | | | | | ConvertAsmString and shrink it a bit. No functionality change. llvm-svn: 66520
* if we die in IR generation of a compound statement, include Chris Lattner2009-03-051-1/+4
| | | | | | | | | | | | | | it in the stack trace, giving us stuff like: Stack dump: 0. Program arguments: clang t.c -emit-llvm 1. <eof> parser at end of file 2. t.c:1:5: LLVM IR generation of declaration 'a' 3. t.c:1:9: LLVM IR generation of compound statement ('{}') 4. t.c:2:3: LLVM IR generation of compound statement ('{}') Abort llvm-svn: 66154
* add a special case for codegen that improves the case where we haveChris Lattner2009-03-041-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | multiple sequential cases to a) not create tons of fall-through basic blocks and b) not recurse deeply. This fixes codegen on 100K deep cases, and improves codegen on moderate cases from this: switch i32 %tmp, label %sw.epilog [ i32 1000, label %sw.bb i32 1001, label %sw.bb1 i32 1002, label %sw.bb2 i32 1003, label %sw.bb3 i32 1004, label %sw.bb4 ... sw.bb: ; preds = %entry br label %sw.bb1 sw.bb1: ; preds = %entry, %sw.bb br label %sw.bb2 sw.bb2: ; preds = %entry, %sw.bb1 br label %sw.bb3 sw.bb3: ; preds = %entry, %sw.bb2 br label %sw.bb4 to: switch i32 %tmp, label %sw.epilog [ i32 1000, label %sw.bb i32 1001, label %sw.bb i32 1002, label %sw.bb i32 1003, label %sw.bb i32 1004, label %sw.bb sw.bb: ;; many preds llvm-svn: 66015
* inline asm calls should be nounwind. Chris, please review.Anders Carlsson2009-03-021-1/+4
| | | | llvm-svn: 65866
* Make sure to reset the DidCallStackSave variable before emitting a compound ↵Anders Carlsson2009-02-221-0/+1
| | | | | | statement. Fixes PR3649. llvm-svn: 65291
* Add CodeGen support for the nodebug attribute.Anders Carlsson2009-02-131-2/+2
| | | | llvm-svn: 64445
* Handle the case where EmitBlock might be called multiple times for the same ↵Anders Carlsson2009-02-101-2/+8
| | | | | | block. Fixes PR3536. llvm-svn: 64252
* Remove the last remnants of the Obj-C EH stack code.Anders Carlsson2009-02-101-113/+1
| | | | llvm-svn: 64205
* Start removing the old Obj-C EH stack now that the cleanup stack is used ↵Anders Carlsson2009-02-101-43/+12
| | | | | | instead. llvm-svn: 64203
* Replace a bunch of EmitBranch calls with EmitBranchThroughCleanup. No ↵Anders Carlsson2009-02-091-5/+5
| | | | | | functionality change (yet). llvm-svn: 64159
* Save and restore the DidCallStackSave variableAnders Carlsson2009-02-091-0/+4
| | | | llvm-svn: 64157
* When we're at the stack depth we want, there isn't anything to do.Mike Stump2009-02-081-0/+4
| | | | llvm-svn: 64095
* Wire up break and continue processing to the new stack depth adjuster.Mike Stump2009-02-081-39/+49
| | | | | | | | If people could beat on it and let me know if there are any new semantics required by newer language standards or DRs or any little details I goofed on, I'd be happy to fix any issues found. llvm-svn: 64079
* When emitting blocks, keep track of which cleanup scope they have. Minor ↵Anders Carlsson2009-02-081-0/+6
| | | | | | fixes and cleanup. llvm-svn: 64053
* Add support for emitting cleanup blocks. Make EmitCompoundStatement emit ↵Anders Carlsson2009-02-071-1/+6
| | | | | | cleanup blocks if necessary llvm-svn: 64051
* Ensure we track all the stack depths for all break and continue pointsMike Stump2009-02-071-4/+16
| | | | | | | correctly. This should lay the ground work to throw the big switch and start code gening break and continue in the presense of vlas. llvm-svn: 64046
* Format for 80-cols.Mike Stump2009-02-071-2/+2
| | | | llvm-svn: 64030
* Arrange to have the correct StackDepth for while statements.Mike Stump2009-02-071-8/+8
| | | | llvm-svn: 64021
* Fit into 80-col.Mike Stump2009-02-071-3/+3
| | | | llvm-svn: 64020
* Fixup goto codegen in and around VLAs.Mike Stump2009-02-071-19/+65
| | | | llvm-svn: 64014
* If an input constraint refers to an output constraint, it should have the ↵Anders Carlsson2009-01-271-1/+6
| | | | | | same constraint info as the output constraint. Fixes PR3417 llvm-svn: 63127
* silence a couple unused variable 'result' warnings.Chris Lattner2009-01-211-2/+2
| | | | llvm-svn: 62674
* CG support for inline asm constraints with symbolic names. Fixes PR3345Anders Carlsson2009-01-181-2/+18
| | | | llvm-svn: 62444
* Add sema support for symbolic names in inline asm statements.Anders Carlsson2009-01-181-1/+1
| | | | llvm-svn: 62441
* Change TargetInfo::validateInputConstraint to take begin/end name iterators ↵Anders Carlsson2009-01-171-1/+3
| | | | | | instead of the number of outputs. No functionality change. llvm-svn: 62433
* Handle multi-value inputsAnders Carlsson2009-01-121-5/+18
| | | | llvm-svn: 62069
* More inline asm fixesAnders Carlsson2009-01-111-1/+4
| | | | llvm-svn: 62049
* Handle readwrite constraints correctlyAnders Carlsson2009-01-111-1/+2
| | | | llvm-svn: 62043
* Use a common function for emitting asm inputs and remove a FIXMEAnders Carlsson2009-01-111-31/+26
| | | | llvm-svn: 62041
* Fix for PR3246: an empty clobber list is the empty string, not a null Eli Friedman2008-12-211-2/+3
| | | | | | | | | | string. That said, we should probably try and track down the correct clobber lists for the targets that don't have them (PPC, ARM, and Sparc), so that we can generate correct code. llvm-svn: 61298
* Extend the unsupported error to include break and continue, and fix a Eli Friedman2008-12-201-8/+12
| | | | | | warning by using an unsigned index. llvm-svn: 61292
* Check the entire StackSaveValues stack for VLAs when dealing with goto and ↵Anders Carlsson2008-12-201-6/+10
| | | | | | return statements. Noticed by Eli Friedman. llvm-svn: 61289
* Add some ErrorUnsupported calls and turn on VLA codegen again.Anders Carlsson2008-12-201-1/+21
| | | | llvm-svn: 61283
* Store the size of the EH stack inside each BreakContinue struct so we know ↵Anders Carlsson2008-12-131-6/+10
| | | | | | when a break/continue won't cross a try block. llvm-svn: 60998
* Work in preparation for VLAs. Make sure to restore the stack if necessary ↵Anders Carlsson2008-12-121-14/+29
| | | | | | (Saving the stack isn't implemented right now :) llvm-svn: 60925
* Use Expr::Evaluate for case statements. Fixes PR2525Anders Carlsson2008-11-221-3/+3
| | | | llvm-svn: 59881
* Start implementing support for @synchonized with the darwin ObjC API.Chris Lattner2008-11-151-1/+1
| | | | | | Patch by Fariborz! llvm-svn: 59377
* Supply finished flag to EmitBlock for common statements which useDaniel Dunbar2008-11-131-9/+6
| | | | | | | | | | landing pads. - Primarily a cleanliness issue instead of a performance issue (this eliminates all blocks w/o predecessors on 176.gcc/expr.c), but this also allows subsequent code to recognize it is unreachable and potentially avoid IRgen. llvm-svn: 59211
* Normalize many BasicBlock names.Daniel Dunbar2008-11-131-10/+10
| | | | | | | | | | - 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
* Add IsFinished arg to EmitBlock.Daniel Dunbar2008-11-131-1/+7
| | | | | | | | | | - Indicates that caller is done with the block and it can be dropped if it has no predecessors. Useful for callers who need to make landing pads but which may not be reached. No functionality change. llvm-svn: 59207
* For if blocks with no else, name the join block ifend instead of theDaniel Dunbar2008-11-131-6/+5
| | | | | | | | more confusing ifelse. Use dotted names for if blocks (if.then vs ifthen). llvm-svn: 59201
* IRgen improvements on unreachable code:Daniel Dunbar2008-11-121-36/+62
| | | | | | | | | | | | | | | | | | | | | | | - Split out "simple" statements which can easily handle IR generation when there is no insert point. These are generally statements which start by emitting a new block or are only containers for other statements. - This fixes a regression in emitting dummy blocks, notably for case statements. - This also fixes spurious emission of a number of debug stoppoint intrinsic instructions. Remove unneeded sw.body block, just clear the insertion point. Lift out CodeGenFunction::EmitStopPoint which calls into the CGDebugInfo class when generating debug info. Normalize definitions of Emit{Break,Continue}Stmt and usage of ErrorUnsupported. llvm-svn: 59118
* Move EmitBranchOnBoolExpr and ConstantFoldsToSimpleInteger toChris Lattner2008-11-121-92/+6
| | | | | | | | | | 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
* Make emission of 'if' conditions much more sophisticated when weChris Lattner2008-11-121-14/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | have a condition that is an &&/||. Before we used to compile things like this: int test() { if (x && y) foo(); else bar(); } into: %0 = load i32* @x ; <i32> [#uses=1] %1 = icmp ne i32 %0, 0 ; <i1> [#uses=1] br i1 %1, label %land_rhs, label %land_cont land_rhs: ; preds = %entry %2 = load i32* @y ; <i32> [#uses=1] %3 = icmp ne i32 %2, 0 ; <i1> [#uses=1] br label %land_cont land_cont: ; preds = %land_rhs, %entry %4 = phi i1 [ false, %entry ], [ %3, %land_rhs ] ; <i1> [#uses=1] br i1 %4, label %ifthen, label %ifelse ifthen: ; preds = %land_cont %call = call i32 (...)* @foo() ; <i32> [#uses=0] br label %ifend ifelse: ; preds = %land_cont %call1 = call i32 (...)* @bar() ; <i32> [#uses=0] br label %ifend ifend: ; preds = %ifelse, %ifthen Now we turn it into the much more svelte code: %0 = load i32* @x ; <i32> [#uses=1] %1 = icmp ne i32 %0, 0 ; <i1> [#uses=1] br i1 %1, label %land_lhs_true, label %ifelse land_lhs_true: ; preds = %entry %2 = load i32* @y ; <i32> [#uses=1] %3 = icmp ne i32 %2, 0 ; <i1> [#uses=1] br i1 %3, label %ifthen, label %ifelse ifthen: ; preds = %land_lhs_true %call = call i32 (...)* @foo() ; <i32> [#uses=0] br label %ifend ifelse: ; preds = %land_lhs_true, %entry %call1 = call i32 (...)* @bar() ; <i32> [#uses=0] br label %ifend ifend: ; preds = %ifelse, %ifthen Note the lack of a phi node. This shrinks the -O0 .ll file for 176.gcc/expr.c from 43176 to 40267 lines. llvm-svn: 59111
* Clean up some code to use isZero instead of calling getZExtValue.Chris Lattner2008-11-121-1/+1
| | | | llvm-svn: 59103
* Rework IRgen invariant w.r.t. current insert point.Daniel Dunbar2008-11-111-26/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* Change EmitBranch to always clear the insert point to clarify irgenDaniel Dunbar2008-11-111-1/+2
| | | | | | invariants. llvm-svn: 59085
OpenPOWER on IntegriCloud