summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Suppress a warning in -Asserts builds.John McCall2011-06-151-0/+1
| | | | llvm-svn: 133110
* Automatic Reference Counting.John McCall2011-06-151-16/+240
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Do not emit stoppoint before emitting debug info for parameters.Devang Patel2011-06-151-3/+1
| | | | | | | - llvm.dbg.declare already receives line number information from ParmDecl - Additional extra stoppoint messes up gdb's understanding of where function body starts. llvm-svn: 133065
* Rework r132576.Devang Patel2011-06-041-2/+0
| | | | | | Emit debug info only if there is an insertion point. The debug info should not force an insertion point. Codegen may later on decide to not emit code for some reason, see extensive comment in CodeGenFunction::EmitStmt(), and debug info should not get in the way. llvm-svn: 132610
* Emit debug info only if there is an insertion point. The debug info should ↵Devang Patel2011-06-031-9/+10
| | | | | | not force an insertion point. Codegen may later on decide to not emit code for some reason, see extensive comment in CodeGenFunction::EmitStmt(), and debug info should not get in the way. llvm-svn: 132576
* Add unnamed_addr to internal globals which are only used as an operand to ↵Eli Friedman2011-05-271-0/+1
| | | | | | memcpy. (Spotted by looking at IR.) llvm-svn: 132226
* Implement support for C++0x alias templates.Richard Smith2011-05-051-0/+1
| | | | llvm-svn: 130953
* Simplify code a bit by using CallArgList::add. No intended functionality ↵Eli Friedman2011-05-021-2/+2
| | | | | | change. llvm-svn: 130699
* Support for C++11 (non-template) alias declarations.Richard Smith2011-04-151-2/+3
| | | | llvm-svn: 129567
* Fix typo.Devang Patel2011-04-051-1/+1
| | | | llvm-svn: 128921
* Move all the significant __block code into CGBlocks.cpp. No functionalityJohn McCall2011-03-311-187/+7
| | | | | | change. llvm-svn: 128608
* Add support for language-specific address spaces. On top of that,Peter Collingbourne2011-03-181-4/+7
| | | | | | | | | add support for the OpenCL __private, __local, __constant and __global address spaces, as well as the __read_only, _read_write and __write_only image access specifiers. Patch originally by ARM; language-specific address space support by myself. llvm-svn: 127915
* Extract a function to emit an arbitrary expression as if it were the initializerJohn McCall2011-03-081-53/+77
| | | | | | for a local variable. llvm-svn: 127227
* Revert r126422 "Use private linkage to avoid symbol conflicts inDouglas Gregor2011-03-061-1/+1
| | | | | | corner cases like the one in PR9301." which caused PR9416. llvm-svn: 127136
* Encode argument numbering in debug info so that code generator can emit them ↵Devang Patel2011-03-031-2/+3
| | | | | | | | in order. This fixes few blocks.exp regressions. llvm-svn: 126960
* revert r126858.Devang Patel2011-03-021-3/+2
| | | | llvm-svn: 126874
* Encode argument numbering in debug info so that code generator can emit them ↵Devang Patel2011-03-021-2/+3
| | | | | | | | | | in order. This fixes few blocks.exp regressions. Reapply r126795 with a fix (one character change) for gdb testsuite regressions. llvm-svn: 126858
* Revert r126794.Devang Patel2011-03-021-3/+2
| | | | llvm-svn: 126848
* Encode argument numbering in debug info so that code generator can emit them ↵Devang Patel2011-03-011-2/+3
| | | | | | | | in order. This fixes few blocks.exp regressions. llvm-svn: 126795
* Use private linkage to avoid symbol conflicts in corner cases like the oneRafael Espindola2011-02-241-1/+1
| | | | | | in PR9301. llvm-svn: 126422
* Emit the structure layout of the block literal parameter to a blockJohn McCall2011-02-221-1/+18
| | | | | | | | | | invocation function into the debug info. Rather than faking up a class, which is tricky because of the custom layout we do, we just emit a struct directly from the layout information we've already got. Also, don't emit an unnecessarily parameter alloca for this "variable". llvm-svn: 126255
* Establish the iteration variable of an ObjC for-in loop beforeJohn McCall2011-02-221-2/+6
| | | | | | | emitting the collection expression. Fixes some really, really broken code. llvm-svn: 126193
* Reorganize the emission of local variables.John McCall2011-02-221-147/+214
| | | | llvm-svn: 126189
* The flags we're supposed to write into a byref struct are *not* theJohn McCall2011-02-181-12/+13
| | | | | | | | | | | | _Block_object_* flags; it's just BLOCK_HAS_COPY_DISPOSE or not. Also, we don't need to chase forwarding pointers prior to calling _Block_object_dispose; _Block_object_dispose in fact already does this. rdar://problem/9006315 llvm-svn: 125823
* implement basic support for __label__. I wouldn't be shocked if there areChris Lattner2011-02-181-1/+1
| | | | | | | | | bugs from other clients that don't expect to see a LabelDecl in a DeclStmt, but if so they should be easy to fix. This implements most of PR3429 and rdar://8287027 llvm-svn: 125817
* Step #1/N of implementing support for __label__: split labels intoChris Lattner2011-02-171-1/+1
| | | | | | | | | | | | | | | | | | | LabelDecl and LabelStmt. There is a 1-1 correspondence between the two, but this simplifies a bunch of code by itself. This is because labels are the only place where we previously had references to random other statements, causing grief for AST serialization and other stuff. This does cause one regression (attr(unused) doesn't silence unused label warnings) which I'll address next. This does fix some minor bugs: 1. "The only valid attribute " diagnostic was capitalized. 2. Various diagnostics printed as ''labelname'' instead of 'labelname' 3. This reduces duplication of label checking between functions and blocks. Review appreciated, particularly for the cindex and template bits. llvm-svn: 125733
* Ensure that the NRVO flag has some block to insert into. Fixes PR9178!Nick Lewycky2011-02-161-1/+2
| | | | llvm-svn: 125694
* Simplify test to check an aggregate argument that has non trivial ↵Devang Patel2011-02-161-3/+2
| | | | | | | | constructor or destructor. This patch rewrites r125142. llvm-svn: 125632
* Assorted cleanup:John McCall2011-02-151-3/+3
| | | | | | | | | - Have CGM precompute a number of commonly-used types - Have CGF copy that during initialization instead of recomputing them - Use TBAA info when initializing a parameter variable - Refactor the scalar ++/-- code llvm-svn: 125562
* If an aggregate argument is passed indirectly because it has non trivialDevang Patel2011-02-091-2/+3
| | | | | | | | destructor or copy constructor than let debug info know about it. Radar 8945514. llvm-svn: 125142
* Reorganize CodeGen{Function,Module} to eliminate the unfortunateJohn McCall2011-02-081-31/+32
| | | | | | | | Block{Function,Module} base class. Minor other refactorings. Fixed a few address-space bugs while I was there. llvm-svn: 125085
* A few more tweaks to the blocks AST representation: John McCall2011-02-071-4/+3
| | | | | | | | | | | | | | | | | - BlockDeclRefExprs always store VarDecls - BDREs no longer store copy expressions - BlockDecls now store a list of captured variables, information about how they're captured, and a copy expression if necessary With that in hand, change IR generation to use the captures data in blocks instead of walking the block independently. Additionally, optimize block layout by emitting fields in descending alignment order, with a heuristic for filling in words when alignment of the end of the block header is insufficient for the most aligned field. llvm-svn: 125005
* Convert the exception-freeing cleanup over to the conditional cleanups code,John McCall2011-01-281-0/+1
| | | | | | | | | fixing a crash which probably nobody was ever going to see. In doing so, fix a horrendous number of problems with the conditional-cleanups code. Also, make conditional cleanups re-use the cleanup's activation variable, which avoids some unfortunate repetitiveness. llvm-svn: 124481
* Fixes an IRgen bug where __block variable isFariborz Jahanian2011-01-261-3/+27
| | | | | | | referenced in the block-literal initializer of that variable. // rdar://8893785 llvm-svn: 124332
* Replace calls to CharUnits::fromQuantity() with ones to Ken Dyck2011-01-181-2/+2
| | | | | | ASTContext::toCharUnitsFromBits() when converting from bit sizes to char units. llvm-svn: 123720
* Move name mangling support from CodeGen to AST. In thePeter Collingbourne2011-01-131-1/+1
| | | | | | | | | | | | | | process, perform a number of refactorings: - Move MiscNameMangler member functions to MangleContext - Remove GlobalDecl dependency from MangleContext - Make MangleContext abstract and move Itanium/Microsoft functionality to their own classes/files - Implement ASTContext::createMangleContext and have CodeGen use it No (intended) functionality change. llvm-svn: 123386
* Add support for declaring register contraints in variables. They are only usedRafael Espindola2010-12-301-3/+0
| | | | | | | | | | | | | | in asm statements: register int foo asm("rdi"); asm("..." : ... "r" (foo) ... We also only accept these variables if the constraint in the asm statement is "r". This fixes most of PR3933. llvm-svn: 122643
* Correct function name in comment.Nick Lewycky2010-12-301-1/+1
| | | | llvm-svn: 122640
* Simplify mem{cpy, move, set} creation with IRBuilder.Benjamin Kramer2010-12-301-12/+4
| | | | llvm-svn: 122634
* IR Gen. part of API support for __block cxxFariborz Jahanian2010-12-021-2/+5
| | | | | | | | objects imported into blocks. //rdar://8594790. Will have a test case coming (as well as one sent to llvm test suite). llvm-svn: 120713
* Improve codegen for initializer lists to use memset more aggressivelyChris Lattner2010-12-021-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when an initializer is variable (I handled the constant case in a previous patch). This has three pieces: 1. Enhance AggValueSlot to have a 'isZeroed' bit to tell CGExprAgg that the memory being stored into has previously been memset to zero. 2. Teach CGExprAgg to not emit stores of zero to isZeroed memory. 3. Teach CodeGenFunction::EmitAggExpr to scan initializers to determine whether they are profitable to emit a memset + inividual stores vs stores for everything. The heuristic used is that a global has to be more than 16 bytes and has to be 3/4 zero to be candidate for this xform. The two testcases are illustrative of the scenarios this catches. We now codegen test9 into: call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 400, i32 4, i1 false) %.array = getelementptr inbounds [100 x i32]* %Arr, i32 0, i32 0 %tmp = load i32* %X.addr, align 4 store i32 %tmp, i32* %.array and test10 into: call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 392, i32 8, i1 false) %tmp = getelementptr inbounds %struct.b* %S, i32 0, i32 0 %tmp1 = getelementptr inbounds %struct.a* %tmp, i32 0, i32 0 %tmp2 = load i32* %X.addr, align 4 store i32 %tmp2, i32* %tmp1, align 4 %tmp5 = getelementptr inbounds %struct.b* %S, i32 0, i32 3 %tmp10 = getelementptr inbounds %struct.a* %tmp5, i32 0, i32 4 %tmp11 = load i32* %X.addr, align 4 store i32 %tmp11, i32* %tmp10, align 4 Previously we produced 99 stores of zero for test9 and also tons for test10. This xforms should substantially speed up -O0 builds when it kicks in as well as reducing code size and optimizer heartburn on insane cases. This resolves PR279. llvm-svn: 120692
* attempt to fix a buildbot failure, apparently apache fails to build.Chris Lattner2010-12-021-11/+8
| | | | llvm-svn: 120688
* Enhance the init generation logic to emit a memset followed by a few stores whenChris Lattner2010-12-021-6/+41
| | | | | | | | | | | | | | | | | | | | | | | | | a global is larger than 32 bytes and has fewer than 6 non-zero values in the initializer. Previously we'd turn something like this: char test8(int X) { char str[10000] = "abc"; into a 10K global variable which we then memcpy'd from. Now we generate: %str = alloca [10000 x i8], align 16 %tmp = getelementptr inbounds [10000 x i8]* %str, i64 0, i64 0 call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 10000, i32 16, i1 false) store i8 97, i8* %tmp, align 16 %0 = getelementptr [10000 x i8]* %str, i64 0, i64 1 store i8 98, i8* %0, align 1 %1 = getelementptr [10000 x i8]* %str, i64 0, i64 2 store i8 99, i8* %1, align 2 Which is much smaller in space and also likely faster. This is part of PR279 llvm-svn: 120645
* add some infrastructure that will let us codegenChris Lattner2010-12-011-6/+67
| | | | | | | | http://llvm.org/bugs/show_bug.cgi?id=279#c3 better. No functionality change yet. llvm-svn: 120530
* get some i32/i8/i1 constants from Builder, which is much less painful thanChris Lattner2010-12-011-18/+9
| | | | | | using ConstantInt::get. llvm-svn: 120527
* Declaring local static in global blockFariborz Jahanian2010-11-301-3/+13
| | | | | | | literal declaration caused crash in CodeGen. This patch fixes it. pr8707 llvm-svn: 120486
* Fix warning: enumeration value 'IndirectField' not handled in switch.Francois Pichet2010-11-211-0/+1
| | | | llvm-svn: 119924
* Fixes synthesis of type for the object which holds info.Fariborz Jahanian2010-11-171-1/+2
| | | | | | about a __block cxx object. llvm-svn: 119411
* Some cleanup of block API code.Fariborz Jahanian2010-11-151-1/+1
| | | | llvm-svn: 119174
* Simplify the logic for emitting guard variables for template staticJohn McCall2010-11-061-1/+1
| | | | | | | | | data members by delaying the emission of the initializer until after linkage and visibility have been set on the global. Also, don't emit a guard unless the variable actually ends up with vague linkage, and don't use thread-safe statics in any case. llvm-svn: 118336
OpenPOWER on IntegriCloud