summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGExprConstant.cpp
AgeCommit message (Collapse)Author
2010-06-26use more efficient type comparison predicates.Chris Lattner
llvm-svn: 106958
2010-06-03Don't try to explicitly zero out bit-fields.Anders Carlsson
llvm-svn: 105391
2010-05-30Fix for PR7040: Don't try to compute the LLVM type for a function where itEli Friedman
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
2010-05-27When null-initializing bases with data member pointers, don't assert on ↵Anders Carlsson
virtual bases. Just initialize them to null. llvm-svn: 104868
2010-05-18Correctly initialize bases with member pointers. This should fix PR6441 but ↵Anders Carlsson
that test case is a bit weird and I'd like to investigate further before closing that bug. llvm-svn: 104025
2010-05-14Move ContainsPointerToDataMember to CodeGenTypes. No functionality change.Anders Carlsson
llvm-svn: 103792
2010-05-03When computing the address of a virtual member function pointer, use the ↵Anders Carlsson
pointer width instead of hardcoding for 64-bit. llvm-svn: 102921
2010-04-24Get rid of the old GetNonVirtualBaseClassOffset and change all call sites to ↵Anders Carlsson
use the new version. llvm-svn: 102274
2010-04-18recommit r101568 to fix PR6766Nuno Lopes
as a side-effect, remove two FIXMEs now fixed llvm-svn: 101726
2010-04-17Vtable -> VTable renames across the board.Anders Carlsson
llvm-svn: 101666
2010-04-17revert r101568, which miscompiles this testcase, distilled from ldecod:Chris Lattner
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
2010-04-16fix PR6766: codegen of var initialized with wide charNuno Lopes
llvm-svn: 101568
2010-04-16fix a bogus assertion exposed by a recent change: packing theChris Lattner
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
2010-04-16emit padding as undef values, take 2Nuno Lopes
merge also a few tests I had here for this feature, and FileCheck'ize one file llvm-svn: 101535
2010-04-13Rework the ConstStructBuilder code to emit missing initializerChris Lattner
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
2010-04-13move a bunch of ConstStructBuilder methods out of line.Chris Lattner
llvm-svn: 101152
2010-04-12fix PR6660/6168: emit padding as zeros instead of undef. Because Chris Lattner
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
2010-03-31IRGen: Move the auxiliary data structures tracking AST -> LLVM mappings out ↵Daniel Dunbar
of CodeGenTypes, to per-record CGRecordLayout structures. - I did a cursory check that this was perf neutral, FWIW. llvm-svn: 99978
2010-03-30IRgen: Move CGRecordLayout to its own happy little file.Daniel Dunbar
llvm-svn: 99945
2010-03-23Rename CGVtableInfo to CodeGenVTables in preparation of adding another ↵Anders Carlsson
VTableInfo class. llvm-svn: 99250
2010-03-04really fix 6473 by handling weakref in constant expressions.Rafael Espindola
llvm-svn: 97750
2010-02-10hopefully silence a warning on the clang-i386-darwin9 tester.Chris Lattner
llvm-svn: 95812
2010-02-07Use the right type when taking the address of a non-virtual member function ↵Anders Carlsson
pointer. Fixes PR6258. llvm-svn: 95524
2010-02-05Fix the bug that was breaking self-host, and re-land the static ctor fixes.Anders Carlsson
llvm-svn: 95400
2010-02-05Revert r95363 and r95375, which broke self-host.Douglas Gregor
llvm-svn: 95389
2010-02-05Fix array initialization test.Anders Carlsson
llvm-svn: 95375
2010-02-05If a global initializer has a non-trivial destructor it can't be emitted as ↵Anders Carlsson
a constant (even if it has a trivial constructor). llvm-svn: 95363
2010-02-04Calculate offset correctly when taking the address of a virtual member function.Anders Carlsson
llvm-svn: 95305
2010-02-03Revert "Numerous changes to selector handling:", this breaks a whole bunch ofDaniel Dunbar
working code, for no apparent reason. llvm-svn: 95244
2010-02-03Numerous changes to selector handling:David Chisnall
- 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
2010-02-02Use the Arg variable rather than re-computing it. This also silences GCC'sChandler Carruth
unused variable warning. llvm-svn: 95085
2010-02-02Codegen CXXConstructExprs with trivial constructors as constants.John McCall
Eliminates a lot of spurious global initializers, fixing PR6205. llvm-svn: 95077
2010-02-02Improve handling of emitting 'null' pointers to data members.Anders Carlsson
llvm-svn: 95066
2010-02-02Move pointer to data member emission to CodeGenModule and use it in ↵Anders Carlsson
CGExprConstant. Fixes PR5674. llvm-svn: 95063
2010-01-31Some class related cleanup.Anders Carlsson
llvm-svn: 94938
2010-01-23Created __builtin___NSStringMakeConstantString() builtin, which generates ↵David Chisnall
constant Objective-C strings. llvm-svn: 94274
2010-01-15Convert the type of the LValue offset variable in APValue to CharUnits, movingKen Dyck
the LValue-related methods of APValue out of line to avoid header file leaching. llvm-svn: 93512
2010-01-05When emitting member function pointers, use the canonical decl if the member ↵Anders Carlsson
function is virtual. Fixes PR5940. llvm-svn: 92680
2010-01-02Get rid of some unnecessary code.Eli Friedman
llvm-svn: 92432
2009-12-08Update CGExprConstant for change to emit padding values as undef.Daniel Dunbar
- This fixes 2003-05-21-BitfieldHandling. llvm-svn: 90876
2009-11-28Remove remaining VISIBILITY_HIDDEN from anonymous namespaces.Benjamin Kramer
llvm-svn: 90044
2009-11-27Don't build the entire vtable when all we want is the index of a virtual method.Anders Carlsson
llvm-svn: 90017
2009-11-21Support emitting aggregate class initializers. Fixes PR5581.Anders Carlsson
llvm-svn: 89569
2009-11-14Avoid assert-crash in a case where the expression passed to EmitConstantExprEli Friedman
legitimately has side-effects (and needs to be generated as a non-constant). llvm-svn: 88767
2009-11-14Make __func__ and friends work correctly within the initializer for a staticEli Friedman
local variable. llvm-svn: 88766
2009-11-13Obvious fix for PR5474.Eli Friedman
llvm-svn: 88696
2009-11-06indirectbr seems to work! Rip out the old code.Chris Lattner
llvm-svn: 86256
2009-10-29make clang emit undefs for padding of structs and unions instead of zeros. ↵Nuno Lopes
this enables constant compaction optimizations. llvm-svn: 85504
2009-10-28Implement clang support for indirect branch and address of labelChris Lattner
using the new LLVM support for this. This is temporarily hiding behind horrible and ugly #ifdefs until the time when the optimizer is stable (hopefully a week or so). Until then, lets make it "opt in" :) llvm-svn: 85446
2009-10-23Eliminate QualifiedDeclRefExpr, which captured the notion of aDouglas Gregor
qualified reference to a declaration that is not a non-static data member or non-static member function, e.g., namespace N { int i; } int j = N::i; Instead, extend DeclRefExpr to optionally store the qualifier. Most clients won't see or care about the difference (since QualifierDeclRefExpr inherited DeclRefExpr). However, this reduces the number of top-level expression types that clients need to cope with, brings the implementation of DeclRefExpr into line with MemberExpr, and simplifies and unifies our handling of declaration references. Extended DeclRefExpr to (optionally) store explicitly-specified template arguments. This occurs when naming a declaration via a template-id (which will be stored in a TemplateIdRefExpr) that, following template argument deduction and (possibly) overload resolution, is replaced with a DeclRefExpr that refers to a template specialization but maintains the template arguments as written. llvm-svn: 84962