summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Added a test case for __weak field decls. Change SetVarDeclObjCAttributeFariborz Jahanian2008-11-202-10/+9
| | | | | | to static function. Added comments. llvm-svn: 59738
* Rename IdentifierInfo::isName to ::isStr. Use a nifty trickChris Lattner2008-11-201-1/+1
| | | | | | | from Sebastian to enforce that a literal string is passed in, and use this to avoid having to call strlen on it. llvm-svn: 59706
* More objc gc stuff. Read/Write barriers for local static/extern,Fariborz Jahanian2008-11-202-18/+47
| | | | | | | diagnostics on use of __weak attribute on fields, Early support for read/write barriers for objc fields. llvm-svn: 59682
* More of objective-c's gc code-gen. Treat objective-cFariborz Jahanian2008-11-192-3/+10
| | | | | | objects as __strong when attribute unspecified. llvm-svn: 59654
* Few more changes due to Daniel's feedback.Fariborz Jahanian2008-11-193-19/+26
| | | | llvm-svn: 59645
* Add spec ref to comment.Daniel Dunbar2008-11-191-2/+6
| | | | llvm-svn: 59622
* Fix redundant load of bit-fields on assignment (to get the updatedDaniel Dunbar2008-11-194-25/+46
| | | | | | | | | value). - Use extra argument to EmitStoreThroughLValue to provide place to write update bit-field value if caller requires it. - This fixes several FIXMEs. llvm-svn: 59615
* Pointer width for PIC16 is 16 bits. Modify getMemCpy, getMemMove and ↵Sanjiv Gupta2008-11-191-0/+3
| | | | | | getMemSet accordingly. llvm-svn: 59613
* fix save-oChris Lattner2008-11-191-1/+1
| | | | llvm-svn: 59611
* simplifyChris Lattner2008-11-191-1/+1
| | | | llvm-svn: 59610
* Discard unused runtime function declarations (for readability).Daniel Dunbar2008-11-191-0/+6
| | | | llvm-svn: 59594
* Generate strong write barriers for __strong objects.Fariborz Jahanian2008-11-195-16/+76
| | | | | | Also, took care of Daniel's commments. llvm-svn: 59575
* Patch for generation of weak write barriers for objcFariborz Jahanian2008-11-184-8/+39
| | | | | | __weak objects. llvm-svn: 59560
* Generate objc_read_weak for __weak objc loads.Fariborz Jahanian2008-11-185-1/+35
| | | | llvm-svn: 59553
* Some basic support toward objective-c's GC code gen.Fariborz Jahanian2008-11-183-4/+68
| | | | llvm-svn: 59543
* This reworks some of the Diagnostic interfaces a bit to change how diagnosticsChris Lattner2008-11-182-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | are formed. In particular, a diagnostic with all its strings and ranges is now packaged up and sent to DiagnosticClients as a DiagnosticInfo instead of as a ton of random stuff. This has the benefit of simplifying the interface, making it more extensible, and allowing us to do more checking for things like access past the end of the various arrays passed in. In addition to introducing DiagnosticInfo, this also substantially changes how Diagnostic::Report works. Instead of being passed in all of the info required to issue a diagnostic, Report now takes only the required info (a location and ID) and returns a fresh DiagnosticInfo *by value*. The caller is then free to stuff strings and ranges into the DiagnosticInfo with the << operator. When the dtor runs on the DiagnosticInfo object (which should happen at the end of the statement), the diagnostic is actually emitted with all of the accumulated information. This is a somewhat tricky dance, but it means that the accumulated DiagnosticInfo is allowed to keep pointers to other expression temporaries without those pointers getting invalidated. This is just the minimal change to get this stuff working, but this will allow us to eliminate the zillions of variant "Diag" methods scattered throughout (e.g.) sema. For example, instead of calling: Diag(BuiltinLoc, diag::err_overload_no_match, typeNames, SourceRange(BuiltinLoc, RParenLoc)); We will soon be able to just do: Diag(BuiltinLoc, diag::err_overload_no_match) << typeNames << SourceRange(BuiltinLoc, RParenLoc)); This scales better to support arbitrary types being passed in (not just strings) in a type-safe way. Go operator overloading?! llvm-svn: 59502
* Change the diagnostics interface to take an array of pointers to Chris Lattner2008-11-181-3/+4
| | | | | | | | strings instead of array of strings. This reduces string copying in some not-very-important cases, but paves the way for future improvements. llvm-svn: 59494
* Introduction the DeclarationName class, as a single, general method ofDouglas Gregor2008-11-175-16/+17
| | | | | | | | 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
* A few corrections to the expr constant work. Not enabled at the Eli Friedman2008-11-171-2/+3
| | | | | | moment. llvm-svn: 59435
* More expr constant work. (Off by default).Anders Carlsson2008-11-171-8/+25
| | | | llvm-svn: 59433
* rename Expr::tryEvaluate to Expr::Evaluate.Chris Lattner2008-11-163-4/+4
| | | | llvm-svn: 59426
* More constant expr work.Anders Carlsson2008-11-161-6/+18
| | | | llvm-svn: 59405
* daniel prefers completed thoughts.Chris Lattner2008-11-161-1/+1
| | | | llvm-svn: 59404
* Start implementing support for @synchonized with the darwin ObjC API.Chris Lattner2008-11-156-2/+134
| | | | | | Patch by Fariborz! llvm-svn: 59377
* Check in code that uses tryEvaluate for emitting constant exprs (not used yet).Anders Carlsson2008-11-151-0/+29
| | | | llvm-svn: 59375
* Handle padding in the constant CFString struct. Fixes PR3046.Anders Carlsson2008-11-151-8/+46
| | | | llvm-svn: 59372
* 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
OpenPOWER on IntegriCloud