summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Use IgnoreParenCasts. No functionality change.Anders Carlsson2008-11-151-10/+1
| | | | llvm-svn: 59371
* Fix silly bug spotted by Daniel DunbarAnders Carlsson2008-11-151-1/+1
| | | | llvm-svn: 59358
* Handle complex return values.Anders Carlsson2008-11-151-1/+6
| | | | llvm-svn: 59345
* Add a new expression node, CXXOperatorCallExpr, which expresses aDouglas Gregor2008-11-141-1/+3
| | | | | | | | | | | | | | | | | | | function call created in response to the use of operator syntax that resolves to an overloaded operator in C++, e.g., "str1 + str2" that resolves to std::operator+(str1, str2)". We now build a CXXOperatorCallExpr in C++ when we pick an overloaded operator. (But only for binary operators, where we actually implement overloading) I decided *not* to refactor the current CallExpr to make it abstract (with FunctionCallExpr and CXXOperatorCallExpr as derived classes). Doing so would allow us to make CXXOperatorCallExpr a little bit smaller, at the cost of making the argument and callee accessors virtual. We won't know if this is going to be a win until we can parse lots of C++ code to determine how much memory we'll save by making this change vs. the performance penalty due to the extra virtual calls. llvm-svn: 59306
* Easy IRgen improvement for bitfields, don't emit x >> 0.Daniel Dunbar2008-11-131-2/+3
| | | | | | | - Logic such as this quite possibly should be optional builder behavior. llvm-svn: 59213
* 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-136-24/+24
| | | | | | | | | | - 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-132-2/+13
| | | | | | | | | | - 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
* 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
* Start a README.txt of possible optimizations to do in IRgen.Daniel Dunbar2008-11-121-0/+24
| | | | llvm-svn: 59130
* Handle ?: in EmitBranchOnBoolExpr.Daniel Dunbar2008-11-121-0/+17
| | | | llvm-svn: 59129
* Rename ?: operator blocks to cond.true and cond.false (I don't knowDaniel Dunbar2008-11-121-2/+2
| | | | | | what "cond.?" means, and this avoids quoting). llvm-svn: 59128
* Comment/indentation fix.Daniel Dunbar2008-11-121-2/+2
| | | | llvm-svn: 59127
* Lower ?: into select when the selected values are cheap and side-effect-free.Chris Lattner2008-11-121-0/+37
| | | | | | This cuts another 200 lines off expr.ll, forming 23 selects. llvm-svn: 59124
* emit better codegen for ||/&&, shrinking expr.ll by another 240 lines.Chris Lattner2008-11-121-19/+31
| | | | | | | | This happens for stuff like this: x = cond1 || cond2 || cond3 || cond4; llvm-svn: 59123
* use ConstantFoldsToSimpleInteger instead of code emission to doChris Lattner2008-11-121-24/+22
| | | | | | constant folding. llvm-svn: 59121
* IRgen improvements on unreachable code:Daniel Dunbar2008-11-122-38/+76
| | | | | | | | | | | | | | | | | | | | | | | - 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
* Handle Unary ! in EmitBranchOnBoolExpr, so that we can efficientlyChris Lattner2008-11-121-1/+6
| | | | | | codegen stuff like "if (!(X && Y))" llvm-svn: 59115
* Use EmitBranchOnBoolExpr in VisitConditionalOperator. ThisChris Lattner2008-11-121-8/+17
| | | | | | shrinks code yet again by a bit. llvm-svn: 59114
* Move EmitBranchOnBoolExpr and ConstantFoldsToSimpleInteger toChris Lattner2008-11-124-112/+119
| | | | | | | | | | 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-122-14/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-122-4/+4
| | | | llvm-svn: 59103
* Use createBasicBlock here too.Daniel Dunbar2008-11-121-2/+2
| | | | llvm-svn: 59095
* Disable generation of basic block names in NDEBUG mode.Daniel Dunbar2008-11-122-1/+9
| | | | | | | Revert to enabling generation of instruction names when not in NDEBUG mode. llvm-svn: 59094
* Rework IRgen invariant w.r.t. current insert point.Daniel Dunbar2008-11-117-49/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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-112-1/+6
| | | | | | invariants. llvm-svn: 59085
* Emit debug region end in unified return block.Daniel Dunbar2008-11-111-6/+7
| | | | llvm-svn: 59081
* Codegen support for fastcall & stdcall CC.Anton Korobeynikov2008-11-111-1/+4
| | | | | | Patch by Ilya Okonsky! llvm-svn: 59080
* Try to not emit the dead side of ?: if the condition is a constant.Chris Lattner2008-11-111-4/+21
| | | | llvm-svn: 59061
* Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof ↵Sebastian Redl2008-11-113-25/+11
| | | | | | expressions, both of values and types. llvm-svn: 59057
* Add CodeGenFunction::EmitBranch.Daniel Dunbar2008-11-116-41/+40
| | | | | | | - Emits an unconditional branch, with extra logic to avoid generating spurious branches out of dummy blocks. llvm-svn: 59037
* short circuit && and || when possible. This substantially reducesChris Lattner2008-11-114-28/+64
| | | | | | | | 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
* Make codegen smart enough to not emit the dead side of an if whoseChris Lattner2008-11-111-5/+49
| | | | | | | condition is a constant. This shrinks -O0 codegen by quite a bit on some cases. llvm-svn: 59033
* implement debug info for typeof()Chris Lattner2008-11-111-6/+9
| | | | llvm-svn: 59032
* Add CodeGenFunction::EmitDummyBlock for marking places where we makeDaniel Dunbar2008-11-113-7/+16
| | | | | | | "dummy" blocks (blocks just used to make sure we have a place to dump code to). llvm-svn: 59022
* Remove CodeGenFunction::StartBlock.Daniel Dunbar2008-11-112-14/+4
| | | | | | - 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-119-68/+73
| | | | | | - No functionality change. llvm-svn: 59017
* don't preserve names on IR instructions. This matches llvm-gcc's behavior andChris Lattner2008-11-101-1/+2
| | | | | | speeds up the compiler by ~8% at -emit-llvm -O0. llvm-svn: 58977
* Fix even more bugs in debug info support:Chris Lattner2008-11-101-5/+0
| | | | | | | | | 1. emit proper debug info for forward decls of structs. 2. emit DW_TAG_member nodes around members of a field like llvm-gcc does. This slows down debug info generation, but is required for correctness. llvm-svn: 58973
* reimplement debug info generation in terms of DebugInfo.h instead ofChris Lattner2008-11-103-722/+410
| | | | | | | using MachineModuleInfo. This runs at about the same speed as the old code, but fixes a bunch of bugs and is simpler and shorter. llvm-svn: 58971
* Support named operands in inline asm statements.Anders Carlsson2008-11-091-6/+51
| | | | llvm-svn: 58940
* Avoid redundant cast<>s / simplify type dispatch.Daniel Dunbar2008-11-082-45/+34
| | | | llvm-svn: 58892
* "Fix" PR3021, don't crash on generating record types when we can'tDaniel Dunbar2008-11-081-2/+6
| | | | | | generate the type of a member. llvm-svn: 58889
* LinkageSpecDecl is c++ specific, move it to DeclCXXChris Lattner2008-11-041-0/+1
| | | | llvm-svn: 58704
* Add a new expression class, ObjCSuperExpr, to handle the Objective-C ↵Douglas Gregor2008-11-043-6/+10
| | | | | | 'super'. Remove ObjCThis from PredefinedExpr llvm-svn: 58698
* Implement lowering of va_arg in clang directly. (This is 32-bit X86 only for ↵Anders Carlsson2008-11-044-4/+55
| | | | | | now). llvm-svn: 58681
* Fix bug in va_copyAnders Carlsson2008-11-041-1/+1
| | | | llvm-svn: 58680
* privatize some methods.Chris Lattner2008-11-031-0/+3
| | | | llvm-svn: 58602
* Move IRBuilder type definition to common file.Daniel Dunbar2008-11-0110-45/+61
| | | | | | - No functionality change. llvm-svn: 58546
OpenPOWER on IntegriCloud