summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprConstant.cpp
Commit message (Collapse)AuthorAgeFilesLines
* PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() andJay Foad2010-12-071-16/+12
| | | | | | | | zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method trunc(), to be const and to return a new value instead of modifying the object in place. llvm-svn: 121121
* Refactor the null-initialization for record types and make it handle bases ↵Anders Carlsson2010-11-221-75/+85
| | | | | | that aren't i8 arrays. llvm-svn: 119980
* Rename getBaseClassOffset to getBaseClassOffsetInBits and introduce a ↵Anders Carlsson2010-10-311-1/+1
| | | | | | getBaseClassOffset which returns the offset in CharUnits. Do the same thing for getVBaseClassOffset. llvm-svn: 117881
* Death to blocks, or at least the word "block" in one particular obnoxiouslyJohn McCall2010-10-151-1/+1
| | | | | | ambiguous context. llvm-svn: 116567
* Teach IR generation to return 'this' from constructors and destructorsJohn McCall2010-08-311-0/+1
| | | | | | under the ARM ABI. llvm-svn: 112588
* GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall2010-08-251-4/+4
| | | | | | to the new constants. llvm-svn: 112047
* Abstract out everything having to do with member pointers into the ABIJohn McCall2010-08-231-47/+6
| | | | | | | | | | | class; they should just be completely opaque throughout IR gen now, although I haven't really audited that. Fix a bug apparently inherited from gcc-4.2 where we failed to null-check member data pointers when performing derived-to-base or base-to-derived conversions on them. llvm-svn: 111789
* Go back to asking CodeGenTypes whether a type is zero-initializable.John McCall2010-08-221-7/+5
| | | | | | | | | Make CGT defer to the ABI on all member pointer types. This requires giving CGT a handle to the ABI. It's way easier to make that work if we avoid lazily creating the ABI. Make it so. llvm-svn: 111786
* Experiment with using first-class aggregates to represent member functionJohn McCall2010-08-221-5/+13
| | | | | | | | | | pointers. I find the resulting code to be substantially cleaner, and it makes it very easy to use the same APIs for data member pointers (which I have conscientiously avoided here), and it avoids a plethora of potential inefficiencies due to excessive memory copying, but we'll have to see if it actually works. llvm-svn: 111776
* Abstract out member-pointer creation. I'm really unhappy about the currentJohn McCall2010-08-221-16/+1
| | | | | | | | duplication between the constant and non-constant paths in all of this. Implement ARM ABI semantics for member pointer constants and conversion. llvm-svn: 111772
* Abstract more member-pointerness out.John McCall2010-08-221-37/+14
| | | | llvm-svn: 111771
* Detabify.Eli Friedman2010-08-221-1/+1
| | | | llvm-svn: 111768
* IRgen: Eliminate EmitPredefinedFunctionName(), it doesn't need to be ↵Daniel Dunbar2010-08-211-1/+1
| | | | | | factored out. llvm-svn: 111715
* Store inheritance paths after CastExprs instead of inside them.John McCall2010-08-071-1/+3
| | | | | | | | | | | | | | | This takes some trickery since CastExpr has subclasses (and indeed, is abstract). Also, smoosh the CastKind into the bitfield from Expr. Drops two words of storage from Expr in the common case of expressions which don't need inheritance paths. Avoids a separate allocation and another word of overhead in cases needing inheritance paths. Also has the advantage of not leaking memory, since destructors for AST nodes are never run. llvm-svn: 110507
* Fix crash initializing a bit-field with a non-constant in a place where weEli Friedman2010-07-171-4/+3
| | | | | | try to evaluate the initializer as a constant. llvm-svn: 108632
* fix PR7564 a cast where the bitfield struct init codeChris Lattner2010-07-051-4/+31
| | | | | | wasn't handling array padding elements right. llvm-svn: 107621
* AppendBitField really can never fail, so return its return value. Chris Lattner2010-07-051-14/+8
| | | | | | Everyone knows that no bugs are ever possible with bitfields. llvm-svn: 107620
* use more efficient type comparison predicates.Chris Lattner2010-06-261-2/+2
| | | | llvm-svn: 106958
* Don't try to explicitly zero out bit-fields.Anders Carlsson2010-06-031-0/+5
| | | | llvm-svn: 105391
* Fix for PR7040: Don't try to compute the LLVM type for a function where itEli Friedman2010-05-301-23/+1
| | | | | | | | | | | isn't possible to compute. This patch is mostly refactoring; the key change is the addition of the code starting with the comment, "Check whether the function has a computable LLVM signature." The solution here is essentially the same as the way the vtable code handles such functions. llvm-svn: 105151
* When null-initializing bases with data member pointers, don't assert on ↵Anders Carlsson2010-05-271-2/+10
| | | | | | virtual bases. Just initialize them to null. llvm-svn: 104868
* Correctly initialize bases with member pointers. This should fix PR6441 but ↵Anders Carlsson2010-05-181-7/+120
| | | | | | that test case is a bit weird and I'd like to investigate further before closing that bug. llvm-svn: 104025
* Move ContainsPointerToDataMember to CodeGenTypes. No functionality change.Anders Carlsson2010-05-141-25/+1
| | | | llvm-svn: 103792
* When computing the address of a virtual member function pointer, use the ↵Anders Carlsson2010-05-031-1/+6
| | | | | | pointer width instead of hardcoding for 64-bit. llvm-svn: 102921
* Get rid of the old GetNonVirtualBaseClassOffset and change all call sites to ↵Anders Carlsson2010-04-241-3/+1
| | | | | | use the new version. llvm-svn: 102274
* recommit r101568 to fix PR6766Nuno Lopes2010-04-181-8/+6
| | | | | | as a side-effect, remove two FIXMEs now fixed llvm-svn: 101726
* Vtable -> VTable renames across the board.Anders Carlsson2010-04-171-1/+1
| | | | llvm-svn: 101666
* revert r101568, which miscompiles this testcase, distilled from ldecod:Chris Lattner2010-04-171-5/+6
| | | | | | | | | | void exit_picture() { char yuv_types[4][6]= {"4:0:0","4:2:0","4:2:2","4:4:4"}; foo(yuv_types); } llvm-svn: 101623
* fix PR6766: codegen of var initialized with wide charNuno Lopes2010-04-161-6/+5
| | | | llvm-svn: 101568
* fix a bogus assertion exposed by a recent change: packing theChris Lattner2010-04-161-1/+1
| | | | | | | | | | | | | | | | | struct may cause it to shrink more than one byte. Before my recent changes we compiled the new test into: %0 = type { [6 x i8] } @x = global %0 { [6 x i8] undef }, align 2 ; <%0*> [#uses=0] which is obviously bogus. Now we compile it into: %0 = type <{ i32, i8, i8 }> @x = global %0 zeroinitializer, align 2 ; <%0*> [#uses=0] Where the last byte only is tail padding. llvm-svn: 101536
* emit padding as undef values, take 2Nuno Lopes2010-04-161-3/+3
| | | | | | merge also a few tests I had here for this feature, and FileCheck'ize one file llvm-svn: 101535
* Rework the ConstStructBuilder code to emit missing initializerChris Lattner2010-04-131-25/+31
| | | | | | | | | | | | | | | | | | | | | | | | elements with explicit zero values instead of with tail padding. On an example like this: struct foo { int a; int b; }; struct foo fooarray[] = { {1, 2}, {4}, }; We now lay this out as: @fooarray = global [2 x %struct.foo] [%struct.foo { i32 1, i32 2 }, %struct.foo { i32 4, i32 0 }] instead of as: @fooarray = global %0 <{ %struct.foo { i32 1, i32 2 }, %1 { i32 4, [4 x i8] zeroinitializer } }> Preserving both the struct type of the second element, but also the array type of the entire thing. llvm-svn: 101155
* move a bunch of ConstStructBuilder methods out of line.Chris Lattner2010-04-131-260/+282
| | | | llvm-svn: 101152
* fix PR6660/6168: emit padding as zeros instead of undef. Because Chris Lattner2010-04-121-3/+3
| | | | | | | | trailing fields may not be represented in initializer lists, they are being handled as padding and those fields *must* be zero initialized. llvm-svn: 101067
* IRGen: Move the auxiliary data structures tracking AST -> LLVM mappings out ↵Daniel Dunbar2010-03-311-2/+6
| | | | | | | | of CodeGenTypes, to per-record CGRecordLayout structures. - I did a cursory check that this was perf neutral, FWIW. llvm-svn: 99978
* IRgen: Move CGRecordLayout to its own happy little file.Daniel Dunbar2010-03-301-0/+1
| | | | llvm-svn: 99945
* Rename CGVtableInfo to CodeGenVTables in preparation of adding another ↵Anders Carlsson2010-03-231-1/+1
| | | | | | VTableInfo class. llvm-svn: 99250
* really fix 6473 by handling weakref in constant expressions.Rafael Espindola2010-03-041-1/+3
| | | | llvm-svn: 97750
* hopefully silence a warning on the clang-i386-darwin9 tester.Chris Lattner2010-02-101-1/+1
| | | | llvm-svn: 95812
* Use the right type when taking the address of a non-virtual member function ↵Anders Carlsson2010-02-071-1/+5
| | | | | | pointer. Fixes PR6258. llvm-svn: 95524
* Fix the bug that was breaking self-host, and re-land the static ctor fixes.Anders Carlsson2010-02-051-1/+12
| | | | llvm-svn: 95400
* Revert r95363 and r95375, which broke self-host.Douglas Gregor2010-02-051-11/+1
| | | | llvm-svn: 95389
* Fix array initialization test.Anders Carlsson2010-02-051-1/+2
| | | | llvm-svn: 95375
* If a global initializer has a non-trivial destructor it can't be emitted as ↵Anders Carlsson2010-02-051-1/+10
| | | | | | a constant (even if it has a trivial constructor). llvm-svn: 95363
* Calculate offset correctly when taking the address of a virtual member function.Anders Carlsson2010-02-041-2/+5
| | | | llvm-svn: 95305
* Revert "Numerous changes to selector handling:", this breaks a whole bunch ofDaniel Dunbar2010-02-031-8/+0
| | | | | | working code, for no apparent reason. llvm-svn: 95244
* Numerous changes to selector handling:David Chisnall2010-02-031-0/+8
| | | | | | | | | | | | | | | | | | | | | | | - Don't use GlobalAliases with non-0 GEPs (GNU runtime) - this was unsupported and LLVM will be generating errors if you do it soon. This also simplifies the code generated by the GNU runtime a bit. - Make GetSelector() return a constant (GNU runtime), not a load of a store of a constant. - Recognise @selector() expressions as valid static initialisers (as GCC does). - Add methods to GCObjCRuntime to emit selectors as constants (needed for using @selector() expressions as constants. These need implementing for the Mac runtimes - I couldn't figure out how to do this, they seem to require a load. - Store an ObjCMethodDecl in an ObjCSelectorExpr so that we can get at the type information for the selector. This is needed for generating typed selectors from @selector() expressions (as GCC does). Ideally, this information should be stored in the Selector, but that would be an invasive change. We should eventually add checks for common uses of @selector() expressions. Possibly adding an attribute that can be applied to method args providing the types of a selector so, for example, you'd do something like this: - (id)performSelector: __attribute__((selector_types(id, SEL, id)))(SEL) withObject: (id)object; Then, any @selector() expressions passed to the method will be check to ensure that it conforms to this signature. We do this at run time on the GNU runtime already, but it would be nice to do it at compile time on all runtimes. - Made @selector() expressions emit type info if available and the runtime supports it. Someone more familiar with the Mac runtime needs to implement the GetConstantSelector() function in CGObjCMac. This currently just assert()s. llvm-svn: 95189
* Use the Arg variable rather than re-computing it. This also silences GCC'sChandler Carruth2010-02-021-1/+1
| | | | | | unused variable warning. llvm-svn: 95085
* Codegen CXXConstructExprs with trivial constructors as constants.John McCall2010-02-021-0/+23
| | | | | | Eliminates a lot of spurious global initializers, fixing PR6205. llvm-svn: 95077
* Improve handling of emitting 'null' pointers to data members.Anders Carlsson2010-02-021-28/+58
| | | | llvm-svn: 95066
OpenPOWER on IntegriCloud