Chris Lattner
5c740f1523
Reapply:
...
r107173, "fix PR7519: after thrashing around and remembering how all this stuff"
r107216, "fix PR7523, which was caused by the ABI code calling ConvertType instead"
This includes a fix to make ConvertTypeForMem handle the "recursive" case, and call
it as such when lowering function types which have an indirect result.
llvm-svn: 107310
2010-06-30 19:14:05 +00:00
Fariborz Jahanian
02995320e9
Use isFunctionOrMethod for vars declared locallly
...
in method/blocks to decide not to mangle them.
llvm-svn: 107309
2010-06-30 18:57:21 +00:00
Fariborz Jahanian
0f19afb9d4
extern variable declared locally to objective-c++ method
...
should not be mangled either. Fixes radar 8016412.
llvm-svn: 107303
2010-06-30 18:27:47 +00:00
Chris Lattner
749b8ed5af
reduce nesting.
...
llvm-svn: 107292
2010-06-30 16:58:07 +00:00
Charles Davis
2a47730767
Mangle arrays in the Microsoft C++ Mangler. It's not quite finished (it
...
doesn't mangle array parameters right), but I think that should be fixed
in Sema (Doug, John, what do you think?).
Also, stub out the remaining mangleType() routines.
llvm-svn: 107264
2010-06-30 08:09:57 +00:00
Daniel Dunbar
e422266926
Revert r107173, "fix PR7519: after thrashing around and remembering how all this stuff", it broke bootstrap.
...
llvm-svn: 107232
2010-06-30 00:22:35 +00:00
Daniel Dunbar
8386469d7d
Revert r107216, "fix PR7523, which was caused by the ABI code calling ConvertType instead", it is part of a boostrap breaking sequence.
...
llvm-svn: 107231
2010-06-30 00:22:30 +00:00
Daniel Dunbar
8c94ffe776
IRgen: Assignment to Objective-C properties shouldn't reload the value, for
...
complex values either. Previously we did this properly for regular assignment,
but not for compound assignment.
- Also, tidy up assignment code a bit to look more like the scalar path.
llvm-svn: 107217
2010-06-29 22:44:21 +00:00
Chris Lattner
466b1419c6
fix PR7523, which was caused by the ABI code calling ConvertType instead
...
of ConvertTypeRecursive when it needed to in a few cases, causing pointer
types to get resolved at the wrong time.
llvm-svn: 107216
2010-06-29 22:39:04 +00:00
Daniel Dunbar
c85ea8e175
IRgen: Assignment to Objective-C properties shouldn't reload the value (which
...
would trigger an extra method call).
- While in the area, I also changed Clang to not emit an unnecessary load from
'x' in cases like 'y = (x = 1)'.
llvm-svn: 107210
2010-06-29 22:00:45 +00:00
Chris Lattner
cccaad9584
change ABIArgInfo to hold its llvm type with PATypeHolder so that
...
it doesn't dangle as types get refined. This fixes Shootout-C++/lists1
and probably also PR7522.
llvm-svn: 107196
2010-06-29 19:21:36 +00:00
Chris Lattner
34d6281ae5
relax the CGFunctionInfo::CGFunctionInfo ctor to allow any sequence
...
of CanQualTypes to be passed in.
llvm-svn: 107176
2010-06-29 18:13:52 +00:00
Chris Lattner
ab1e65e2ea
fix PR7519: after thrashing around and remembering how all this stuff
...
works, the fix is quite simple: just make sure to call ConvertTypeRecursive
when the function type being lowered is in the midst of ConvertType.
llvm-svn: 107173
2010-06-29 17:56:33 +00:00
Chris Lattner
e70a007b36
minor cleanups.
...
llvm-svn: 107150
2010-06-29 16:40:28 +00:00
Chris Lattner
22a931e3bb
Change X86_64ABIInfo to have ASTContext and TargetData ivars to
...
avoid passing ASTContext down through all the methods it has.
When classifying an argument, or argument piece, as INTEGER, check
to see if we have a pointer at exactly the same offset in the
preferred type. If so, use that pointer type instead of i64. This
allows us to compile A function taking a stringref into something
like this:
define i8* @foo(i64 %D.coerce0, i8* %D.coerce1) nounwind ssp {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=4]
%0 = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
store i64 %D.coerce0, i64* %0
%1 = getelementptr %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
store i8* %D.coerce1, i8** %1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
%tmp3 = load i8** %tmp2 ; <i8*> [#uses=1]
%add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
ret i8* %add.ptr
}
instead of this:
define i8* @foo(i64 %D.coerce0, i64 %D.coerce1) nounwind ssp {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
%0 = insertvalue %0 undef, i64 %D.coerce0, 0 ; <%0> [#uses=1]
%1 = insertvalue %0 %0, i64 %D.coerce1, 1 ; <%0> [#uses=1]
%2 = bitcast %struct.DeclGroup* %D to %0* ; <%0*> [#uses=1]
store %0 %1, %0* %2, align 1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
%tmp3 = load i8** %tmp2 ; <i8*> [#uses=1]
%add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
ret i8* %add.ptr
}
This implements rdar://7375902 - [codegen quality] clang x86-64 ABI lowering code punishing StringRef
llvm-svn: 107123
2010-06-29 06:01:59 +00:00
Chris Lattner
399d22ac1b
plumb preferred types down into X86_64ABIInfo::classifyArgumentType,
...
no functionality change.
llvm-svn: 107115
2010-06-29 01:14:09 +00:00
Chris Lattner
1d7c9f7f4b
Pass the LLVM IR version of argument types down into computeInfo.
...
This is somewhat annoying to do this at this level, but it avoids
having ABIInfo know depend on CodeGenTypes for a hint.
Nothing is using this yet, so no functionality change.
llvm-svn: 107111
2010-06-29 01:08:48 +00:00
Chris Lattner
9e748e9d6e
add IR names to coerced arguments.
...
llvm-svn: 107105
2010-06-29 00:14:52 +00:00
Chris Lattner
15ec361bd6
make the argument passing stuff in the FCA case smarter still, by
...
avoiding making the FCA at all when the types exactly line up. For
example, before we made:
%struct.DeclGroup = type { i64, i64 }
define i64 @_Z3foo9DeclGroup(i64, i64) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
%2 = insertvalue %struct.DeclGroup undef, i64 %0, 0 ; <%struct.DeclGroup> [#uses=1]
%3 = insertvalue %struct.DeclGroup %2, i64 %1, 1 ; <%struct.DeclGroup> [#uses=1]
store %struct.DeclGroup %3, %struct.DeclGroup* %D
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
%tmp3 = load i64* %tmp2 ; <i64> [#uses=1]
%add = add nsw i64 %tmp1, %tmp3 ; <i64> [#uses=1]
ret i64 %add
}
... which has the pointless insertvalue, which fastisel hates, now we
make:
%struct.DeclGroup = type { i64, i64 }
define i64 @_Z3foo9DeclGroup(i64, i64) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=4]
%2 = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
store i64 %0, i64* %2
%3 = getelementptr %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
store i64 %1, i64* %3
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
%tmp3 = load i64* %tmp2 ; <i64> [#uses=1]
%add = add nsw i64 %tmp1, %tmp3 ; <i64> [#uses=1]
ret i64 %add
}
This only kicks in when x86-64 abi lowering decides it likes us.
llvm-svn: 107104
2010-06-29 00:06:42 +00:00
Chris Lattner
3dd716c3c3
Change CGCall to handle the "coerce" case where the coerce-to type
...
is a FCA to pass each of the elements as individual scalars. This
produces code fast isel is less likely to reject and is easier on
the optimizers.
For example, before we would compile:
struct DeclGroup { long NumDecls; char * Y; };
char * foo(DeclGroup D) {
return D.NumDecls+D.Y;
}
to:
%struct.DeclGroup = type { i64, i64 }
define i64 @_Z3foo9DeclGroup(%struct.DeclGroup) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
store %struct.DeclGroup %0, %struct.DeclGroup* %D, align 1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
%tmp3 = load i64* %tmp2 ; <i64> [#uses=1]
%add = add nsw i64 %tmp1, %tmp3 ; <i64> [#uses=1]
ret i64 %add
}
Now we get:
%0 = type { i64, i64 }
%struct.DeclGroup = type { i64, i8* }
define i8* @_Z3foo9DeclGroup(i64, i64) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
%2 = insertvalue %0 undef, i64 %0, 0 ; <%0> [#uses=1]
%3 = insertvalue %0 %2, i64 %1, 1 ; <%0> [#uses=1]
%4 = bitcast %struct.DeclGroup* %D to %0* ; <%0*> [#uses=1]
store %0 %3, %0* %4, align 1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
%tmp3 = load i8** %tmp2 ; <i8*> [#uses=1]
%add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
ret i8* %add.ptr
}
Elimination of the FCA inside the function is still-to-come.
llvm-svn: 107099
2010-06-28 23:44:11 +00:00
Chris Lattner
d200eda487
make the trivial forms of CreateCoerced{Load|Store} trivial.
...
llvm-svn: 107091
2010-06-28 22:51:39 +00:00
Chris Lattner
93af332819
pass/return structs of char and short as i8/i16 to avoid
...
aweful through-memory coersion, just like we do for i32 now.
llvm-svn: 107078
2010-06-28 21:59:07 +00:00
Chris Lattner
d776fb150e
more tidying up.
...
llvm-svn: 107076
2010-06-28 21:43:59 +00:00
Chris Lattner
0cf2419cd7
random acts of tidying.
...
llvm-svn: 107050
2010-06-28 20:05:43 +00:00
Chris Lattner
a7d81ab7f3
X86-64:
...
pass/return structs of float/int as float/i32 instead of double/i64
to make the code generated for ABI cleaner. Passing in the low part
of a double is the same as passing in a float.
For example, we now compile:
struct DeclGroup { float NumDecls; };
float foo(DeclGroup D);
void bar(DeclGroup *D) {
foo(*D);
}
into:
%struct.DeclGroup = type { float }
define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) nounwind {
entry:
%D.addr = alloca %struct.DeclGroup*, align 8 ; <%struct.DeclGroup**> [#uses=2]
%agg.tmp = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
%tmp = load %struct.DeclGroup** %D.addr ; <%struct.DeclGroup*> [#uses=1]
%tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
%tmp2 = bitcast %struct.DeclGroup* %tmp to i8* ; <i8*> [#uses=1]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
%coerce.dive = getelementptr %struct.DeclGroup* %agg.tmp, i32 0, i32 0 ; <float*> [#uses=1]
%0 = load float* %coerce.dive, align 1 ; <float> [#uses=1]
%call = call float @_Z3foo9DeclGroup(float %0) ; <float> [#uses=0]
ret void
}
instead of:
%struct.DeclGroup = type { float }
define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) nounwind {
entry:
%D.addr = alloca %struct.DeclGroup*, align 8 ; <%struct.DeclGroup**> [#uses=2]
%agg.tmp = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp3 = alloca double ; <double*> [#uses=2]
store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
%tmp = load %struct.DeclGroup** %D.addr ; <%struct.DeclGroup*> [#uses=1]
%tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
%tmp2 = bitcast %struct.DeclGroup* %tmp to i8* ; <i8*> [#uses=1]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
%coerce.dive = getelementptr %struct.DeclGroup* %agg.tmp, i32 0, i32 0 ; <float*> [#uses=1]
%0 = bitcast double* %tmp3 to float* ; <float*> [#uses=1]
%1 = load float* %coerce.dive ; <float> [#uses=1]
store float %1, float* %0, align 1
%2 = load double* %tmp3 ; <double> [#uses=1]
%call = call float @_Z3foo9DeclGroup(double %2) ; <float> [#uses=0]
ret void
}
which is this machine code (at -O0):
__Z3barP9DeclGroup:
subq $24, %rsp
movq %rdi, 16(%rsp)
movq 16(%rsp), %rdi
leaq 8(%rsp), %rax
movl (%rdi), %ecx
movl %ecx, (%rax)
movss 8(%rsp), %xmm0
callq __Z3foo9DeclGroup
addq $24, %rsp
ret
vs this:
__Z3barP9DeclGroup:
subq $24, %rsp
movq %rdi, 16(%rsp)
movq 16(%rsp), %rdi
leaq 8(%rsp), %rax
movl (%rdi), %ecx
movl %ecx, (%rax)
movss 8(%rsp), %xmm0
movss %xmm0, (%rsp)
movsd (%rsp), %xmm0
callq __Z3foo9DeclGroup
addq $24, %rsp
ret
At -O3, it is the difference between this now:
__Z3barP9DeclGroup:
movss (%rdi), %xmm0
jmp __Z3foo9DeclGroup # TAILCALL
vs this before:
__Z3barP9DeclGroup:
movl (%rdi), %eax
movd %rax, %xmm0
jmp __Z3foo9DeclGroup # TAILCALL
llvm-svn: 107048
2010-06-28 19:56:59 +00:00
Fariborz Jahanian
c42461e145
Minor refactorin of my last patch (radar 7860965 related).
...
llvm-svn: 107047
2010-06-28 19:42:10 +00:00
Fariborz Jahanian
36ad0e99d5
Have __func__ and siblings point to block's implementation function
...
name. Fixes radar 7860965.
llvm-svn: 107044
2010-06-28 18:58:34 +00:00
Chris Lattner
c1028f689e
Fix UnitTests/2004-02-02-NegativeZero.c, which regressed when
...
I broke negate of FP values.
llvm-svn: 107019
2010-06-28 17:12:37 +00:00
Anders Carlsson
3f48c603fb
Correctly destroy reference temporaries with global storage. Remove ErrorUnsupported call when binding a global reference to a non-lvalue. Fixes PR7326.
...
llvm-svn: 106983
2010-06-27 17:52:15 +00:00
Anders Carlsson
18c205ecdf
Add a CreateReferenceTemporary that will do the right thing for variables with global storage.
...
llvm-svn: 106982
2010-06-27 17:23:46 +00:00
Anders Carlsson
2969c8c69d
Simplify CodeGenFunction::EmitReferenceBindingToExpr as a first step towards fixing PR7326.
...
llvm-svn: 106981
2010-06-27 16:56:04 +00:00
Anders Carlsson
ca68d357d4
Reduce indentation.
...
llvm-svn: 106980
2010-06-27 15:24:55 +00:00
Chris Lattner
818efb64a3
misc tidying
...
llvm-svn: 106978
2010-06-27 07:40:06 +00:00
Chris Lattner
5e016ae983
finally get around to doing a significant cleanup to irgen:
...
have CGF create and make accessible standard int32,int64 and
intptr types. This fixes a ton of 80 column violations
introduced by LLVMContextification and cleans up stuff a lot.
llvm-svn: 106977
2010-06-27 07:15:29 +00:00
Chris Lattner
e000907e13
tidy up OrderGlobalInits
...
llvm-svn: 106976
2010-06-27 06:32:58 +00:00
Chris Lattner
055097f024
If coercing something from int or pointer type to int or pointer type
...
(potentially after unwrapping it from a struct) do it without going through
memory. We now compile:
struct DeclGroup {
unsigned NumDecls;
};
int foo(DeclGroup D) {
return D.NumDecls;
}
into:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
%D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%coerce.val.ii = trunc i64 %0 to i32 ; <i32> [#uses=1]
store i32 %coerce.val.ii, i32* %coerce.dive
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp1 = load i32* %tmp ; <i32> [#uses=1]
ret i32 %tmp1
}
instead of:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
%D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp = alloca i64 ; <i64*> [#uses=2]
%coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
store i64 %0, i64* %tmp
%1 = bitcast i64* %tmp to i32* ; <i32*> [#uses=1]
%2 = load i32* %1, align 1 ; <i32> [#uses=1]
store i32 %2, i32* %coerce.dive
%tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp2 = load i32* %tmp1 ; <i32> [#uses=1]
ret i32 %tmp2
}
... which is quite a bit less terrifying.
llvm-svn: 106975
2010-06-27 06:26:04 +00:00
Chris Lattner
895c52ba8b
Same patch as the previous on the store side. Before we compiled this:
...
struct DeclGroup {
unsigned NumDecls;
};
int foo(DeclGroup D) {
return D.NumDecls;
}
to:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
%D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp = alloca i64 ; <i64*> [#uses=2]
store i64 %0, i64* %tmp
%1 = bitcast i64* %tmp to %struct.DeclGroup* ; <%struct.DeclGroup*> [#uses=1]
%2 = load %struct.DeclGroup* %1, align 1 ; <%struct.DeclGroup> [#uses=1]
store %struct.DeclGroup %2, %struct.DeclGroup* %D
%tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp2 = load i32* %tmp1 ; <i32> [#uses=1]
ret i32 %tmp2
}
which caused fast isel bailouts due to the FCA load/store of %2. Now
we generate this just blissful code:
%struct.DeclGroup = type { i32 }
define i32 @_Z3foo9DeclGroup(i64) nounwind ssp noredzone {
entry:
%D = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp = alloca i64 ; <i64*> [#uses=2]
%coerce.dive = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
store i64 %0, i64* %tmp
%1 = bitcast i64* %tmp to i32* ; <i32*> [#uses=1]
%2 = load i32* %1, align 1 ; <i32> [#uses=1]
store i32 %2, i32* %coerce.dive
%tmp1 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp2 = load i32* %tmp1 ; <i32> [#uses=1]
ret i32 %tmp2
}
This avoids fastisel bailing out and is groundwork for future patch.
This reduces bailouts on CGStmt.ll to 911 from 935.
llvm-svn: 106974
2010-06-27 06:04:18 +00:00
Chris Lattner
1cd6698a7c
improve CreateCoercedLoad a bit to generate slightly less awful
...
IR when handling X86-64 by-value struct stuff. For example, we
use to compile this:
struct DeclGroup {
unsigned NumDecls;
};
int foo(DeclGroup D);
void bar(DeclGroup *D) {
foo(*D);
}
into:
define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) ssp nounwind {
entry:
%D.addr = alloca %struct.DeclGroup*, align 8 ; <%struct.DeclGroup**> [#uses=2]
%agg.tmp = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp3 = alloca i64 ; <i64*> [#uses=2]
store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
%tmp = load %struct.DeclGroup** %D.addr ; <%struct.DeclGroup*> [#uses=1]
%tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
%tmp2 = bitcast %struct.DeclGroup* %tmp to i8* ; <i8*> [#uses=1]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
%0 = bitcast i64* %tmp3 to %struct.DeclGroup* ; <%struct.DeclGroup*> [#uses=1]
%1 = load %struct.DeclGroup* %agg.tmp ; <%struct.DeclGroup> [#uses=1]
store %struct.DeclGroup %1, %struct.DeclGroup* %0, align 1
%2 = load i64* %tmp3 ; <i64> [#uses=1]
call void @_Z3foo9DeclGroup(i64 %2)
ret void
}
which would cause fastisel to bail out due to the first class aggregate load %1. With
this patch we now compile it into the (still awful):
define void @_Z3barP9DeclGroup(%struct.DeclGroup* %D) nounwind ssp noredzone {
entry:
%D.addr = alloca %struct.DeclGroup*, align 8 ; <%struct.DeclGroup**> [#uses=2]
%agg.tmp = alloca %struct.DeclGroup, align 4 ; <%struct.DeclGroup*> [#uses=2]
%tmp3 = alloca i64 ; <i64*> [#uses=2]
store %struct.DeclGroup* %D, %struct.DeclGroup** %D.addr
%tmp = load %struct.DeclGroup** %D.addr ; <%struct.DeclGroup*> [#uses=1]
%tmp1 = bitcast %struct.DeclGroup* %agg.tmp to i8* ; <i8*> [#uses=1]
%tmp2 = bitcast %struct.DeclGroup* %tmp to i8* ; <i8*> [#uses=1]
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp2, i64 4, i32 4, i1 false)
%coerce.dive = getelementptr %struct.DeclGroup* %agg.tmp, i32 0, i32 0 ; <i32*> [#uses=1]
%0 = bitcast i64* %tmp3 to i32* ; <i32*> [#uses=1]
%1 = load i32* %coerce.dive ; <i32> [#uses=1]
store i32 %1, i32* %0, align 1
%2 = load i64* %tmp3 ; <i64> [#uses=1]
%call = call i32 @_Z3foo9DeclGroup(i64 %2) noredzone ; <i32> [#uses=0]
ret void
}
which doesn't bail out. On CGStmt.ll, this reduces fastisel bail outs from 958 to 935,
and is the precursor of better things to come.
llvm-svn: 106973
2010-06-27 05:56:15 +00:00
Chris Lattner
3fcc790cd8
Change IR generation for return (in the simple case) to avoid doing silly
...
load/store nonsense in the epilog. For example, for:
int foo(int X) {
int A[100];
return A[X];
}
we used to generate:
%arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i64 %idxprom ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]
store i32 %tmp1, i32* %retval
%0 = load i32* %retval ; <i32> [#uses=1]
ret i32 %0
}
which codegen'd to this code:
_foo: ## @foo
## BB#0: ## %entry
subq $408, %rsp ## imm = 0x198
movl %edi, 400(%rsp)
movl 400(%rsp), %edi
movslq %edi, %rax
movl (%rsp,%rax,4), %edi
movl %edi, 404(%rsp)
movl 404(%rsp), %eax
addq $408, %rsp ## imm = 0x198
ret
Now we generate:
%arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i64 %idxprom ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]
ret i32 %tmp1
}
and:
_foo: ## @foo
## BB#0: ## %entry
subq $408, %rsp ## imm = 0x198
movl %edi, 404(%rsp)
movl 404(%rsp), %edi
movslq %edi, %rax
movl (%rsp,%rax,4), %eax
addq $408, %rsp ## imm = 0x198
ret
This actually does matter, cutting out 2000 lines of IR from CGStmt.ll
for example.
Another interesting effect is that altivec.h functions which are dead
now get dce'd by the inliner. Hence all the changes to
builtins-ppc-altivec.c to ensure the calls aren't dead.
llvm-svn: 106970
2010-06-27 01:06:27 +00:00
Chris Lattner
726b3d09cd
reduce indentation
...
llvm-svn: 106967
2010-06-26 23:13:19 +00:00
Chris Lattner
6c5abe88bf
Implement rdar://7530813 - collapse multiple GEP instructions in IRgen
...
This avoids generating two gep's for common array operations. Before
we would generate something like:
%tmp = load i32* %X.addr ; <i32> [#uses=1]
%arraydecay = getelementptr inbounds [100 x i32]* %A, i32 0, i32 0 ; <i32*> [#uses=1]
%arrayidx = getelementptr inbounds i32* %arraydecay, i32 %tmp ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]
Now we generate:
%tmp = load i32* %X.addr ; <i32> [#uses=1]
%arrayidx = getelementptr inbounds [100 x i32]* %A, i32 0, i32 %tmp ; <i32*> [#uses=1]
%tmp1 = load i32* %arrayidx ; <i32> [#uses=1]
Less IR is better at -O0.
llvm-svn: 106966
2010-06-26 23:03:20 +00:00
Chris Lattner
57ce97151f
minor cleanup: don't emit the base of an array subscript until after
...
we're done diddling around with the index stuff. Use a cheaper type
comparison.
llvm-svn: 106963
2010-06-26 22:40:46 +00:00
Chris Lattner
431bef4409
fix inc/dec to honor -fwrapv and -ftrapv, implementing PR7426.
...
llvm-svn: 106962
2010-06-26 22:18:28 +00:00
Chris Lattner
05dc78c096
move scalar inc/dec codegen into ScalarExprEmitter instead
...
of being in CGF. No functionality change.
llvm-svn: 106961
2010-06-26 22:09:34 +00:00
Chris Lattner
fa20e95043
use more efficient type comparison predicates.
...
llvm-svn: 106958
2010-06-26 21:52:32 +00:00
Chris Lattner
0bf27620f0
Fix unary minus to trap on overflow with -ftrapv, refactoring binop
...
code so we can use it from VisitUnaryMinus.
llvm-svn: 106957
2010-06-26 21:48:21 +00:00
Chris Lattner
51924e517b
Implement support for -fwrapv, rdar://7221421
...
As part of this, pull together trapv handling into the same enum.
This also add support for NSW multiplies.
This also makes PCH disagreement on overflow behavior silent, since it
really doesn't matter except for warnings and codegen (no macros get
defined etc).
llvm-svn: 106956
2010-06-26 21:25:03 +00:00
Chris Lattner
217e056e40
implement rdar://7432000 - signed negate should codegen as NSW.
...
While I'm in there, adjust pointer to member adjustments as well.
llvm-svn: 106955
2010-06-26 20:27:24 +00:00
Anders Carlsson
04775f8413
Change EmitReferenceBindingToExpr to take a decl instead of a boolean.
...
llvm-svn: 106949
2010-06-26 16:35:32 +00:00
Anders Carlsson
709ef8e46c
Add function for mangling reference temporaries.
...
llvm-svn: 106948
2010-06-26 16:09:40 +00:00
Charles Davis
f4db33cbdf
Mangle pointer and (lvalue) reference types in the Microsoft C++ Mangler.
...
Also, fix mangling of throw specs. Turns out MSVC totally ignores throw
specs when mangling names.
llvm-svn: 106937
2010-06-26 03:50:05 +00:00
Fariborz Jahanian
b66b08ef01
Minor change to my last patch to fix PR7490.
...
llvm-svn: 106875
2010-06-25 20:01:13 +00:00
Fariborz Jahanian
d5202e0926
IRGen for trivial initialization of dynamiccaly allocated
...
array of other done c++ objects. Fixes PR7490.
llvm-svn: 106869
2010-06-25 18:26:07 +00:00
Fariborz Jahanian
9b5528d278
Patch to correctly mangle block helper functions
...
when block literal is declared inside a ctor/dtor.
Fixes radr 8096995.
llvm-svn: 106700
2010-06-24 00:08:06 +00:00
Chris Lattner
37141f4fb4
improve altivec vector bool/pixel support, patch by Anton Yartsev
...
with several tweaks by me.
llvm-svn: 106619
2010-06-23 06:00:24 +00:00
Chris Lattner
b48a2d5d2f
polish the -finstrument-functions implementation, patch by Nelson Elhage!
...
llvm-svn: 106618
2010-06-23 05:21:28 +00:00
Douglas Gregor
49b4d73451
Type Type::isRealFloatingType() that vectors are not floating-point
...
types, updating callers of both isFloatingType() and
isRealFloatingType() accordingly. Caught at least one issue where we
allowed one to declare a vector of vectors (!), along with cleaning up
the standard-conversion logic for C++.
llvm-svn: 106595
2010-06-22 23:07:26 +00:00
Fariborz Jahanian
7966aff294
Fixes a problem in generation of meta-data for
...
category implementation whereby property list was missing.
NeXt ObjC runtime (radar 8093297).
llvm-svn: 106550
2010-06-22 16:33:55 +00:00
Anders Carlsson
ea836bc41c
Switch over to the new caching version of getMangledName.
...
llvm-svn: 106549
2010-06-22 16:16:50 +00:00
Anders Carlsson
2e2f4d2e6d
Add a new variant of getMangledName that caches the mangling for decls.
...
llvm-svn: 106547
2010-06-22 16:05:32 +00:00
Anders Carlsson
16d9f1788e
Add GlobalDecl::getCanonicalDecl.
...
llvm-svn: 106546
2010-06-22 16:00:14 +00:00
Fariborz Jahanian
469b200321
Per Chris's comment, remove another static (this one
...
is a static comparator operator).
llvm-svn: 106511
2010-06-22 00:23:08 +00:00
Chris Lattner
3c77a355e0
implement support for -finstrument-functions, patch by Nelson
...
Elhage!
llvm-svn: 106507
2010-06-22 00:03:40 +00:00
Fariborz Jahanian
c9fec975e6
Avoid using a local static for providing lexical
...
order of priorotized global object initializations.
llvm-svn: 106503
2010-06-21 23:31:29 +00:00
Fariborz Jahanian
9adb2e646c
In fragile-abi (32bit mode abi) generate global symbol
...
objc_category_name_xxx for each category implementation.
(fixes PR7431) patch by Nico Weber.
llvm-svn: 106492
2010-06-21 22:05:18 +00:00
Fariborz Jahanian
89bdd14f2f
In supporting init-priority, globals with the same init_priority must be
...
emitted in the order in which they are seen (still radar 8076356).
llvm-svn: 106485
2010-06-21 21:27:42 +00:00
Anders Carlsson
280e61f148
Fix an Obj-C++ miscompile when calling an Obj-C method that returns a C++ reference.
...
llvm-svn: 106477
2010-06-21 20:59:55 +00:00
Fariborz Jahanian
090e4e5773
Use more efficient API of SmallVector/array_pod_sort
...
for sorting (radar 8076356).
llvm-svn: 106453
2010-06-21 19:49:38 +00:00
Fariborz Jahanian
9f2a4eed0d
IRGen for implementation of init-priority attribute.
...
Test case will be checked in llvm test suite.
(finishes off radar 8076356).
llvm-svn: 106441
2010-06-21 18:45:05 +00:00
Douglas Gregor
5dd34744c5
Instantiations subject to an explicit template instantiation
...
declaration have default visibility even under
-fvisibility=hidden. Fixes <rdar://problem/8109763>.
llvm-svn: 106440
2010-06-21 18:41:26 +00:00
Nate Begeman
ed48c857dc
Implement remaining codegen for NEON, all operations should now work.
...
llvm-svn: 106407
2010-06-20 23:05:28 +00:00
Anton Korobeynikov
cc50b7d7d5
More AltiVec support.
...
Patch by Anton Yartsev!
llvm-svn: 106387
2010-06-19 09:47:18 +00:00
Eli Friedman
c96b2496fc
Fix for PR7415: refactor CodeGenModule::MayDeferGeneration and make it less
...
conservative for static variables in templated classes.
llvm-svn: 106385
2010-06-19 06:24:06 +00:00
Chris Lattner
87233f785b
Fix PR7097, a bad interaction between -fno-use-cxa-atexit and
...
-mconstructor-aliases by using a WeakVH instead of a raw pointer.
llvm-svn: 106384
2010-06-19 05:52:45 +00:00
Charles Davis
108f5a2748
Mangle tag types (unions, structs, classes, enums) in the Microsoft C++ Mangler.
...
Also, test that static members with default visibility in a struct have the
right mangling.
llvm-svn: 106276
2010-06-18 07:51:00 +00:00
Fariborz Jahanian
64cda8b5f3
objective-C++ IRGen: property reference as an
...
lvalue when performing a derived-to-base conversion.
Fixes radar 7501812. Added an executable test to
llvm-test suite.
llvm-svn: 106247
2010-06-17 23:00:29 +00:00
Fariborz Jahanian
9240f3dac7
Objective-c++ IRGen. Support for @selector expression as
...
an lvalue. Fixes PR7390.
llvm-svn: 106235
2010-06-17 19:56:20 +00:00
Charles Davis
8c02c13e19
Mangle operator names in the Microsoft C++ Mangler.
...
llvm-svn: 106211
2010-06-17 06:47:31 +00:00
Nate Begeman
dbafec1f3e
Remove last of the bool shifts for MS VC++, patch by dimitry andric
...
llvm-svn: 106206
2010-06-17 02:26:59 +00:00
Alexis Hunt
c675ec09f0
Update CMake build for new attribute changes.
...
llvm-svn: 106188
2010-06-17 00:37:02 +00:00
Rafael Espindola
23a8a06554
Change the test for which ABI/CC to use on ARM to be base on the environment
...
(the last argument of the triple).
llvm-svn: 106131
2010-06-16 19:01:17 +00:00
Fariborz Jahanian
4a30307840
Fixed conflict between objc_memmove_collectable builtin
...
decl. and one ddefined in darwin header file.
llvm-svn: 106107
2010-06-16 16:22:04 +00:00
Rafael Espindola
a92c442437
Don't set the calling convention for ARM if it is already the default.
...
llvm-svn: 106106
2010-06-16 16:13:39 +00:00
Charles Davis
89338af1ff
Start mangling function types in the Microsoft C++ Mangler.
...
llvm-svn: 106081
2010-06-16 05:33:16 +00:00
Douglas Gregor
6972a62c8f
Give Type::isIntegralType() an ASTContext parameter, so that it
...
provides C "integer type" semantics in C and C++ "integral type"
semantics in C++.
Note that I still need to update isIntegerType (and possibly other
predicates) using the same approach I've taken for
isIntegralType(). The two should have the same meaning, but currently
don't (!).
llvm-svn: 106074
2010-06-16 00:35:25 +00:00
Douglas Gregor
b90df60b3b
Introduce Type::isIntegralOrEnumerationType(), to cover those places
...
in C++ that involve both integral and enumeration types. Convert all
of the callers to Type::isIntegralType() that are meant to work with
both integral and enumeration types over to
Type::isIntegralOrEnumerationType(), to prepare to eliminate
enumeration types as integral types.
llvm-svn: 106071
2010-06-16 00:17:44 +00:00
Chandler Carruth
8509824cdb
Move CodeGenOptions.h *back* into Frontend. This should have been done when the
...
dependency edge was reversed such that CodeGen depends on Frontend.
llvm-svn: 106065
2010-06-15 23:19:56 +00:00
Fariborz Jahanian
021510e96f
Patch adds support for copying of those
...
objective-c++ class objects which have GC'able objc object
pointers and need to use ObjC's objc_memmove_collectable
API (radar 8070772).
llvm-svn: 106061
2010-06-15 22:44:06 +00:00
Daniel Dunbar
c1b1729b66
Break Frontend's dependency on Rewrite, Checker and CodeGen in shared library configuration
...
Currently, all AST consumers are located in the Frontend library,
meaning that in a shared library configuration, Frontend has a
dependency on Rewrite, Checker and CodeGen. This is suboptimal for
clients which only wish to make use of the frontend. CodeGen in
particular introduces a large number of unwanted dependencies.
This patch breaks the dependency by moving all AST consumers with
dependencies on Rewrite, Checker and/or CodeGen to their respective
libraries. The patch therefore introduces dependencies in the other
direction (i.e. from Rewrite, Checker and CodeGen to Frontend).
After applying this patch, Clang builds correctly using CMake and
shared libraries ("cmake -DBUILD_SHARED_LIBS=ON").
N.B. This patch includes file renames which are indicated in the
patch body.
Changes in this revision of the patch:
- Fixed some copy-paste mistakes in the header files
- Modified certain aspects of the coding to comply with the LLVM
Coding Standards
llvm-svn: 106010
2010-06-15 17:48:49 +00:00
Douglas Gregor
0832963acd
Implement -fvisibility-inlines-hidden. <rdar://problem/7819834>
...
llvm-svn: 106003
2010-06-15 17:05:35 +00:00
Douglas Gregor
4f6e8deec4
Make sure to set the visible on a vtable; VTTs and typeinfo already
...
handle visibility properly. Fixes <rdar://problem/8091955>.
llvm-svn: 105977
2010-06-14 23:41:45 +00:00
Douglas Gregor
1726d1517e
Add name mangling for address spaces. We use the vendor-extension
...
mangling for types, where the <source-name> is ASxxx (xxx is the
address-space number).
llvm-svn: 105975
2010-06-14 23:15:08 +00:00
Benjamin Kramer
7039fcbc5d
An implementation of __builtin__fpclassify the way Chris Lattner described by Jörg Blank.
...
llvm-svn: 105936
2010-06-14 10:30:41 +00:00
Charles Davis
2d7b10cc97
Microsoft C++ Mangler:
...
- Mangle qualifiers.
- Start mangling variables' types into the name. A variable declared with a
builtin type should now mangle properly.
llvm-svn: 105931
2010-06-14 05:29:01 +00:00
Nate Begeman
91e1feab7a
Add some missing shifts
...
Fix multiplies by scalar
Add SemaChecking code for all immediates
Add SemaChecking-gen support to arm_neon.td
llvm-svn: 105930
2010-06-14 05:21:25 +00:00
Nate Begeman
d773fe67dd
Most of NEON sema checking & fix to polynomial type detection
...
llvm-svn: 105908
2010-06-13 04:47:52 +00:00
Charles Davis
7dacc95299
Microsoft C++ Mangler:
...
- Don't mangle static variables at global scope.
- Add support for mangling builtin types. This will be used later.
llvm-svn: 105881
2010-06-12 08:11:16 +00:00
Nate Begeman
c6ac0ce89f
Shifts complete. Only vld & sema checking of constants remain.
...
llvm-svn: 105879
2010-06-12 06:06:07 +00:00
Nate Begeman
dd715805ab
vbsl, vrev* is implemented via arm_neon.h
...
llvm-svn: 105875
2010-06-12 03:11:41 +00:00
Nate Begeman
8ed060b95a
Most of remaining builtins, 2 generics, vld, and rounding shfits remain.
...
llvm-svn: 105848
2010-06-11 22:57:12 +00:00
Charles Davis
b6a5a0d9e1
When mangling for the Microsoft C++ ABI, mangle variables in the global
...
namespace, too.
llvm-svn: 105809
2010-06-11 04:25:47 +00:00
Charles Davis
9af2d4a614
Start implementing the Microsoft-style name mangler. Mangle simple names
...
(but not their types; that's later).
NOTE: Right now, variables in the global namespace don't get mangled, even
though they're supposed to be. This is because the default mangler
implements the shouldMangleDeclName() method that tells clang not to mangle
them. This will be fixed in a later patch.
llvm-svn: 105805
2010-06-11 03:07:32 +00:00
Charles Davis
95a546ee4d
Add an option to specify the target C++ ABI to the frontend. Use it to
...
select either the default Itanium ABI or the new, experimental Microsoft ABI.
llvm-svn: 105804
2010-06-11 01:06:47 +00:00
John McCall
c392f37ae8
Split DependentNameType into two types. DependentNameType represents the
...
case of an elaborated-type-specifier like 'typename A<T>::foo', and
DependentTemplateSpecializationType represents the case of an
elaborated-type-specifier like 'typename A<T>::template B<T>'. The TypeLoc
representation of a DependentTST conveniently exactly matches that of an
ElaboratedType wrapping a TST.
Kill off the explicit rebuild methods for RebuildInCurrentInstantiation;
the standard implementations work fine because the nested name specifier
is computable in the newly-entered context.
llvm-svn: 105801
2010-06-11 00:33:02 +00:00
Nate Begeman
e0935ffa50
Multiplies, some shifts, set_lane
...
llvm-svn: 105793
2010-06-10 18:11:55 +00:00
Nate Begeman
4a04b467d9
support _lane ops, and multiplies by scalar.
...
llvm-svn: 105770
2010-06-10 00:17:56 +00:00
Charles Davis
74ce85980b
Add a stub Microsoft Visual C++ ABI class (with stub mangler).
...
llvm-svn: 105767
2010-06-09 23:25:41 +00:00
Nate Begeman
d90aa43bdf
Implement codegen for hadd, hsub, max, min, mlal, movl, movn, padal, mov_n
...
Make note about how to handle the dozen or so multiply by scalar ops.
llvm-svn: 105734
2010-06-09 18:04:15 +00:00
John McCall
a5dd326ca5
Correctly handle > 257 substitutions in a single mangling, and don't introduce
...
a spurious substitution for an unscoped dependent template-id after introducing
a substitution for the scoped template-id.
llvm-svn: 105699
2010-06-09 07:26:17 +00:00
Nate Begeman
4307a25545
More accurate BuiltinsARM.def
...
vget_lane support
llvm-svn: 105684
2010-06-09 05:30:26 +00:00
Rafael Espindola
6bb986d530
Simplify the code a bit and avoid a gcc waring about uninitialized variables.
...
llvm-svn: 105676
2010-06-09 03:48:40 +00:00
Anders Carlsson
635186a8c4
Get rid of getMangledCXXCtorName and getMangledCXXDtorName.
...
llvm-svn: 105673
2010-06-09 02:36:32 +00:00
Anders Carlsson
09b5fe68ab
More mangling cleanup.
...
llvm-svn: 105672
2010-06-09 02:30:12 +00:00
Anders Carlsson
d4ce4e4bc0
Get rid of an unnecessary getMangledName overload.
...
llvm-svn: 105671
2010-06-09 02:20:01 +00:00
Rafael Espindola
9cdbd9dc08
Fix a gcc warning.
...
llvm-svn: 105670
2010-06-09 02:17:08 +00:00
Nate Begeman
5548309fa7
Implement transpose/zip/unzip & table lookup.
...
Test out some basic constant-checking.
llvm-svn: 105667
2010-06-09 01:10:23 +00:00
Anders Carlsson
851318a93a
On Darwin, initialization and destruction functions should go into the __StaticInit section.
...
llvm-svn: 105650
2010-06-08 22:47:50 +00:00
Anders Carlsson
b2839e4aa1
Add a global CreateGlobalInitOrDestructFunction and use it for creating global init or destruction functions.
...
llvm-svn: 105649
2010-06-08 22:40:05 +00:00
Anders Carlsson
9eb101c5d3
Rename __tcf_ to __cxx_global_array_dtor. Remove the UniqueAggreDestructorCount from CodeGenFunction and let LLVM handle uniquing the internal functions instead.
...
llvm-svn: 105648
2010-06-08 22:30:17 +00:00
Anders Carlsson
282bc10eaa
Move GenerateCXXAggrDestructorHelper to CGDeclCXX.cpp where it belongs.
...
llvm-svn: 105647
2010-06-08 22:17:27 +00:00
Anders Carlsson
165ec0a04f
Simplify GenerateCXXAggrDestructorHelper.
...
llvm-svn: 105646
2010-06-08 22:14:59 +00:00
Fariborz Jahanian
3b83618054
Block Code Gen. API. Call destructor on descriptior
...
entry previously constructed via copy constructor.
llvm-svn: 105641
2010-06-08 20:57:22 +00:00
Daniel Dunbar
ee6b692551
Makefiles: Set Clang CPP compiler flags in a single location, instead of scattered throughout the project Makefiles.
...
llvm-svn: 105638
2010-06-08 20:44:43 +00:00
Daniel Dunbar
e6c1daa8fd
Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.
...
- This eliminates most dependencies on how Clang is installed relative to LLVM.
llvm-svn: 105637
2010-06-08 20:34:18 +00:00
Anders Carlsson
248704c517
Correctly mangle static variables of anonymous struct/union type.
...
llvm-svn: 105606
2010-06-08 14:49:03 +00:00
Nate Begeman
ae6b1d8010
Fix NEON intrinsic argument passing, support vext. Most now successfully make it through codegen to the .s file
...
llvm-svn: 105599
2010-06-08 06:03:01 +00:00
Rafael Espindola
895e51de4a
Fix what looks like a merge problem that broke __clear_cache.
...
llvm-svn: 105595
2010-06-08 03:52:53 +00:00
Rafael Espindola
bbd44ef673
Fix passing and returning of objects with non trivial copy constructors on
...
ARM.
Fixes PR7310.
llvm-svn: 105592
2010-06-08 02:42:08 +00:00
Nate Begeman
16372afeab
Implement ARM NEON up through vcvt, alphabetically.
...
llvm-svn: 105590
2010-06-08 00:17:19 +00:00
Nate Begeman
a011002195
Extend __builtin_shufflevector to expose the full power of the llvm shufflevector instruction. This means it can now be used for vector truncation and concatenation. This will be used for the ARM NEON implementation.
...
llvm-svn: 105589
2010-06-08 00:16:34 +00:00
Fariborz Jahanian
be21aa34a0
When using property-dot assignment syntax to call a setter method,
...
type of rhs need be compared to setter's argument and
not the getter type. Fixes radar 8062778
llvm-svn: 105560
2010-06-07 22:02:01 +00:00
Fariborz Jahanian
a2d7c34e93
Fixed a block regression caused by trying to use
...
an existing ir for load of a bock variable. This cannot be
done across basic blocks.
Fixes radar 8064140.
llvm-svn: 105549
2010-06-07 19:39:39 +00:00
Rafael Espindola
a54062ef0c
Implement __clear_cache on ARM.
...
llvm-svn: 105537
2010-06-07 17:26:50 +00:00
Nate Begeman
5968eb270a
weekend checkpoint of arm neon builtins codegen.
...
TODO: add remainder of builtins to CGBuiltin, add code to SemaChecking to validate constants.
llvm-svn: 105532
2010-06-07 16:01:56 +00:00
Abramo Bagnara
d73405829b
Added AccessSpecDecl node.
...
llvm-svn: 105525
2010-06-05 05:09:32 +00:00
Devang Patel
6ccba0fb6e
Preserve type info for local variables in optimized builds.
...
llvm-gcc enabled this couple of weeks ago.
llvm-svn: 105516
2010-06-05 01:14:40 +00:00
Fariborz Jahanian
ea882cd92e
Build AST for copy-construction of copied-in
...
class object in blocks and carry it to IRGen.
llvm-svn: 105487
2010-06-04 21:35:44 +00:00
Fariborz Jahanian
64176c2c97
For C++ copied in objects, use copy constructors in
...
setting up block's descriptor. This is on going work to
support c++ specific issues in setting up blocks
various APIs.
llvm-svn: 105469
2010-06-04 16:10:00 +00:00
Anders Carlsson
fd788405ac
Remove now unused code.
...
llvm-svn: 105448
2010-06-04 00:59:37 +00:00
Anders Carlsson
27860db29e
Use CXXRecordDecl::getFinalOverriders to get final overriders. This speeds up vtable layout by moving away from the old final overrider computation code that had O(N^2) complexity in some cases.
...
llvm-svn: 105447
2010-06-04 00:54:04 +00:00
Eli Friedman
cce5b81ce1
Don't intentionally try to ignore the value of a scalar expression when we
...
actually care about it. Fixes PR7291.
llvm-svn: 105404
2010-06-03 19:58:07 +00:00
Anders Carlsson
bcb2e4cb63
Don't try to explicitly zero out bit-fields.
...
llvm-svn: 105391
2010-06-03 15:36:07 +00:00
Fariborz Jahanian
d1b378e08d
Block C++ code gen. Adds support for block reference argument
...
types. Executable test will be added to LLVM test suite.
(radar 8041962).
llvm-svn: 105347
2010-06-02 21:35:17 +00:00
John McCall
6a7f9f5c8f
Don't try to emit the vtable for a class just because we're emitting a
...
virtual function from it.
Fixes PR7241.
llvm-svn: 105345
2010-06-02 21:22:02 +00:00
Anders Carlsson
b4d2cdbb46
Don't substitute 'St' for 'std' when the namespace is nested inside another namespace.
...
llvm-svn: 105330
2010-06-02 15:58:27 +00:00
Anders Carlsson
a85c1469c7
When building RTTI descriptors for pointer types, we need to get the unqualified array type and the qualifiers from it.
...
llvm-svn: 105326
2010-06-02 15:44:35 +00:00
Anders Carlsson
d951a7ebf8
Correctly mangle unsigned integer literals where the high bit is set.
...
llvm-svn: 105312
2010-06-02 05:07:26 +00:00
Anders Carlsson
728fe444f1
Correctly mangle variadic functions that don't have any other parameters.
...
llvm-svn: 105311
2010-06-02 04:40:13 +00:00
Anders Carlsson
d563923cf1
When mangling member function pointers, fake adding a substitution corresponding to the function type.
...
llvm-svn: 105310
2010-06-02 04:29:50 +00:00
Anders Carlsson
04e51cca94
More cleanup.
...
llvm-svn: 105301
2010-06-01 23:52:26 +00:00
Anders Carlsson
042ce2d8f1
More cleanup.
...
llvm-svn: 105299
2010-06-01 23:47:05 +00:00
Anders Carlsson
79547c3fbd
Cleanup.
...
llvm-svn: 105296
2010-06-01 23:17:37 +00:00
Charles Davis
7de6638173
Make methods non-virtual again for now. I accidentally committed this in
...
preparation for an alternate mangler.
llvm-svn: 105224
2010-05-31 17:07:59 +00:00
Chandler Carruth
9e814c0d80
Silence GCC warning about an accessible non-virtual destructor in a class with
...
virtual methods.
Please review cdavis, should these methods even be virtual?
llvm-svn: 105218
2010-05-31 08:27:42 +00:00
Anders Carlsson
107b4e096c
Remove unused parameter to FinalOverriders::PropagateOverrider.
...
llvm-svn: 105171
2010-05-30 18:23:41 +00:00
Alexis Hunt
ed05325dbe
Convert DeclNodes to use TableGen.
...
The macros required for DeclNodes use have changed to match the use of
StmtNodes. The FooFirst enumerator constants have been named firstFoo
to match usage elsewhere.
llvm-svn: 105165
2010-05-30 07:21:58 +00:00
Eli Friedman
c8731be34d
Fix for PR7040: Don't try to compute the LLVM type for a function where it
...
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-30 06:03:20 +00:00
Daniel Dunbar
51c3387b5e
Fix personality function name when using SjLj exceptions.
...
llvm-svn: 104999
2010-05-28 19:43:36 +00:00
Fariborz Jahanian
3336de141a
zero-cost exception API for NeXt runtime.
...
rethrow inside @catch block must use objc_exception_rethrow
API. Fixes radar 8037512. Test will be added to LLVM
test suite.
llvm-svn: 104964
2010-05-28 17:34:43 +00:00
Dan Gohman
ed0347333e
This cast is no longer needed; the FIXME is fixed.
...
llvm-svn: 104919
2010-05-28 01:45:35 +00:00
Dan Gohman
3743b8cf49
This cast is no longer required.
...
llvm-svn: 104916
2010-05-28 01:39:35 +00:00
Jim Grosbach
4cf59b9e91
Update __builtin_setjmp codegen to match llvmCore changes in r104900.
...
llvm-svn: 104902
2010-05-27 23:54:20 +00:00
Anders Carlsson
da265b8d63
When null-initializing bases with data member pointers, don't assert on virtual bases. Just initialize them to null.
...
llvm-svn: 104868
2010-05-27 18:51:01 +00:00
John McCall
02269a66b3
Enable the implementation of __builtin_setjmp and __builtin_longjmp. Not all
...
LLVM backends support these yet.
llvm-svn: 104867
2010-05-27 18:47:06 +00:00
John McCall
943fae95f5
Implement __builtin_init_dwarf_reg_size_table and __builtin_dwarf_sp_column
...
for 32-bit MIPS processors. Hat-tip to rdivacky for providing gcc dumps
on this.
llvm-svn: 104816
2010-05-27 06:19:26 +00:00
John McCall
c2af939ab4
When deciding whether a deferred declaration has already been emitted,
...
aliases count as definitions regardless of whether their target has been
emitted yet. Fixes PR 7142.
llvm-svn: 104796
2010-05-27 01:45:30 +00:00
Daniel Dunbar
401304462a
AST: Rename PragmaPackAttr to MaxFieldAlignmentAttr, which is more accurate.
...
llvm-svn: 104795
2010-05-27 01:12:46 +00:00
John McCall
23f6626262
Correctly pass aggregates by reference when emitting thunks.
...
llvm-svn: 104778
2010-05-26 22:34:26 +00:00
Fariborz Jahanian
5f81b9f3f6
Patch to fix a irgen crash accessing an initialized local static
...
variable in a local function. Fixes pr7101.
llvm-svn: 104743
2010-05-26 21:45:50 +00:00
Charles Davis
c9e78145b0
Extract the ObjC and blocks manglers into their own class. No functionality
...
change.
llvm-svn: 104715
2010-05-26 18:25:27 +00:00
Douglas Gregor
0094eb26fc
Be sure to use the standard substitutions when mangling the names of
...
vtables, VTTs, and construction vtables. Fixes PR7201.
llvm-svn: 104675
2010-05-26 05:11:13 +00:00
Charles Davis
4e786ddccb
IRgen: Add a stub class for generating ABI-specific C++ code.
...
This class only supports name mangling (which is apparently used during C/ObjC
codegen). For now only the Itanium C++ ABI is supported. Patches to add a
second C++ ABI are forthcoming.
llvm-svn: 104630
2010-05-25 19:52:27 +00:00
Douglas Gregor
02df9da2ac
Fix compilation failure
...
llvm-svn: 104613
2010-05-25 17:12:30 +00:00
Douglas Gregor
7e10f3699a
Improve name mangling for blocks and support mangling of static local
...
variables within blocks. We loosely follow GCC's mangling, but since
these are always internal symbols the names don't really matter. I
intend to revisit block mangling later, because GCC's mangling is
rather verbose. <rdar://problem/8015719>.
llvm-svn: 104610
2010-05-25 17:04:15 +00:00
John McCall
7cb0220e53
If a function definition has any sort of weak linkage, its static local
...
variables should have that linkage. Otherwise, its static local
variables should have internal linkage. To avoid computing this excessively,
set a function's linkage before we emit code for it.
Previously we were assigning weak linkage to the static variables of
static inline functions in C++, with predictably terrible results. This
fixes that and also gives better linkage than 'weak' when merging is required.
llvm-svn: 104581
2010-05-25 04:30:21 +00:00
Benjamin Kramer
dc99965343
Add a comment for r104472.
...
llvm-svn: 104473
2010-05-23 20:57:46 +00:00
Benjamin Kramer
11d4d9ec4e
PR5863: Don't erase unreachable BBs which have an associated cleanup size.
...
This works around a crash where malloc reused the memory of an erased BB for a
new BB leaving old cleanup information pointing at the new block.
llvm-svn: 104472
2010-05-23 20:00:44 +00:00
John McCall
cc04e9f6b9
Re-teach IR gen to perform GC moves on rvalues resulting from various ObjC
...
expressions. Essentially, GC breaks a certain form of the return-value
optimization.
llvm-svn: 104454
2010-05-22 22:13:32 +00:00
Anders Carlsson
5b94443b16
Really fix PR7139. There was one boost test that we still failed, and my first fix broke self-host.
...
llvm-svn: 104447
2010-05-22 17:45:10 +00:00
Anders Carlsson
c0964b60e5
Re-land the fix for PR7139.
...
llvm-svn: 104446
2010-05-22 17:35:42 +00:00
Douglas Gregor
aae38d6610
Improve our handling of reference binding for subobjects of
...
temporaries. There are actually several interrelated fixes here:
- When converting an object to a base class, it's only an lvalue
cast when the original object was an lvalue and we aren't casting
pointer-to-derived to pointer-to-base. Previously, we were
misclassifying derived-to-base casts of class rvalues as lvalues,
causing various oddities (including problems with reference binding
not extending the lifetimes of some temporaries).
- Teach the code for emitting a reference binding how to look
through no-op casts and parentheses directly, since
Expr::IgnoreParenNoOpCasts is just plain wrong for this. Also, make
sure that we properly look through multiple levels of indirection
from the temporary object, but destroy the actual temporary object;
this fixes the reference-binding issue mentioned above.
- Teach Objective-C message sends to bind the result as a temporary
when needed. This is actually John's change, but it triggered the
reference-binding problem above, so it's included here. Now John
can actually test his return-slot improvements.
llvm-svn: 104434
2010-05-22 05:17:18 +00:00
John McCall
78a151138a
Push a return-value slot throughout ObjC message-send codegen. Will be
...
critical for ObjC++ correctness; hard to test independently of various
required Sema changes, though.
llvm-svn: 104422
2010-05-22 01:48:05 +00:00
Anders Carlsson
c866eb5ba9
Unbreak self-host.
...
llvm-svn: 104390
2010-05-21 22:17:48 +00:00
Anders Carlsson
da1641cd12
Rename CodeGenFunction::EmitMemSetToZero to EmitNullInitialization. Handle setting null data member pointers correctly. Fixes PR7139.
...
llvm-svn: 104387
2010-05-21 21:45:41 +00:00
Douglas Gregor
3fe900e410
Don't remove the break/continue scope of a for loop until after we've
...
emitted the increment expression. Fixes PR7189.
If someone knows how to write a useful test for this, I'd be grateful.
llvm-svn: 104335
2010-05-21 18:36:48 +00:00
Douglas Gregor
c5871f07f0
When generating the call arguments in a thunk to call the thunkee, do
...
not make copies non-POD arguments or arguments passed by reference:
just copy the pointers directly. This eliminates another source of the
dreaded memcpy-of-non-PODs. Fixes PR7188.
llvm-svn: 104327
2010-05-21 17:55:12 +00:00
Chandler Carruth
7ea01c3f8a
Add braces to avoid an ambiguous else, fixing a GCC warning.
...
llvm-svn: 104314
2010-05-21 10:29:28 +00:00
John McCall
9d42f0f174
Allocate space in a block record for implicit references to the Objective C
...
'self' variable arising from uses of the 'super' keyword. Also reorganize
some code so that BlockInfo (now CGBlockInfo) can be opaque outside of
CGBlocks.cpp.
Fixes rdar://problem/8010633.
llvm-svn: 104312
2010-05-21 04:11:14 +00:00
John McCall
c4094935c0
When emitting an lvalue for an anonymous struct or union member during
...
class initialization, drill down through an arbitrary number of anonymous
records.
llvm-svn: 104310
2010-05-21 01:18:57 +00:00
Fariborz Jahanian
60d215b6fd
Adds support for generation of objc_memmove_collectable API
...
in Objective-C++ mode.
llvm-svn: 104281
2010-05-20 21:38:57 +00:00
Fariborz Jahanian
6855ba2c95
Copy construction of non-trivial properties must not
...
be turned into a setter call (fixes radar 8008649).
llvm-svn: 104235
2010-05-20 16:46:55 +00:00
Douglas Gregor
265b8b8de0
Picky, picky
...
llvm-svn: 104230
2010-05-20 15:48:29 +00:00
Douglas Gregor
c19108118d
Fix a thinko
...
llvm-svn: 104229
2010-05-20 15:47:46 +00:00
Douglas Gregor
f22101a059
Assert that we do not try to memcpy a non-POD class type in C++. This
...
particular issue was the cause of the Boost.Interprocess failures, and
in general will lead to horrendous, hard-to-diagnose miscompiles. The
assertion itself has survives self-host and a full Boost build, so we
are close to eradicating this problem in C++.
Note that the assertion is *not* turned on for Objective-C++, where we
still have problems with introducing memcpy's of non-POD class
types. That part of the assertion will go away as soon as we fix the
known issues in Objective-C++.
llvm-svn: 104227
2010-05-20 15:39:01 +00:00
David Chisnall
29cefd1cc3
Fix my inability to spell 'continue' and a case where message sends returning non-pointer-sized things were generating invalid IR inside @try blocks.
...
llvm-svn: 104222
2010-05-20 13:45:48 +00:00
Douglas Gregor
7c38f153ac
Rework our handling of binding a reference to a temporary
...
subobject. Previously, we could only properly bind to a base class
subobject while extending the lifetime of the complete object (of a
derived type); for non-static data member subobjects, we could memcpy
(!) the result and bind to that, which is rather broken.
Now, we pull apart the expression that we're binding to, to figure out
which subobject we're accessing, then construct the temporary object
(adding a destruction if needed) and, finally, dig out the subobject
we actually meant to access.
This fixes yet another instance where we were memcpy'ing rather than
doing the right thing. However, note the FIXME in references.cpp:
there's more work to be done for binding to subobjects, since the AST
is incorrectly modeling some member accesses in base classes as
lvalues when they are really rvalues.
llvm-svn: 104219
2010-05-20 08:36:28 +00:00
Douglas Gregor
aa2ac80eaa
When creating a this-adjustment thunk where the return value is of C++
...
class type (that uses a return slot), pass the return slot to the
callee directly rather than allocating new storage and trying to copy
the object. This appears to have been the cause of the remaining two
Boost.Interprocess failures.
llvm-svn: 104215
2010-05-20 05:54:35 +00:00
John McCall
87fe5d5618
Support implicitly closing on 'this' in a block. Fixed PR7165.
...
(the codegen works here, too, but that's annoying to test without execution)
llvm-svn: 104202
2010-05-20 01:18:31 +00:00
Benjamin Kramer
fdb61d78e9
Implement codegen for __builtin_isnormal.
...
llvm-svn: 104118
2010-05-19 11:24:26 +00:00
Douglas Gregor
a941dcae16
Add support for Microsoft's __thiscall, from Steven Watanabe!
...
llvm-svn: 104026
2010-05-18 16:57:00 +00:00
Anders Carlsson
be48c548c5
Correctly initialize bases with member pointers. This should fix PR6441 but that test case is a bit weird and I'd like to investigate further before closing that bug.
...
llvm-svn: 104025
2010-05-18 16:51:41 +00:00
Anders Carlsson
061ca524b7
Keep track of the LLVM field numbers for non-virtual bases.
...
llvm-svn: 104013
2010-05-18 05:22:06 +00:00
Anders Carlsson
af9e5afe54
Start laying out bases as individual fields. We still use ugly i8 arrays but this is a step in the right direction.
...
llvm-svn: 104012
2010-05-18 05:12:20 +00:00
Anders Carlsson
864d1b555e
Add CodeGenTypes::ContainsPointerToDataMember overload that takes a CXXRecordDecl.
...
llvm-svn: 104011
2010-05-18 03:47:15 +00:00
John McCall
96fa4845f7
Clean up some more uses of getAs<ObjCInterfaceType>() that Fariborz pointed
...
out. The remaining ones are okay.
llvm-svn: 103973
2010-05-17 21:00:27 +00:00
Chandler Carruth
0450cc684c
Fix an ambiguous else warning from GCC by adding some much needed curlies.
...
llvm-svn: 103972
2010-05-17 20:58:49 +00:00
John McCall
3e294929b8
Correctly generate IR for ObjC messages sends to protocol-qualified types.
...
Fixes rdar://problem/7992749
llvm-svn: 103965
2010-05-17 20:12:43 +00:00
Daniel Dunbar
f7a8825484
IRgen: Remove dead function.
...
llvm-svn: 103945
2010-05-17 16:46:02 +00:00
Daniel Dunbar
cd20ce1513
C++/Darwin/i386 ABI: Fix some problems with empty record handling.
...
- Check bases as part of isEmptyRecord().
- C++ record fields are never empty in the Itanium ABI.
llvm-svn: 103944
2010-05-17 16:46:00 +00:00
Douglas Gregor
9154b5dffe
Ensure that destructors are called for NRVO'd objects when the
...
function does not return. Thanks to Eli for pointing out this corner
case.
llvm-svn: 103941
2010-05-17 15:52:46 +00:00
David Chisnall
f9c4225af6
Pick the correct personality function based on the language. This prevents link failures when C/ObjC code uses __attribute__((cleanup())) (previously this was inserting references to two libstc++ symbols; the personality function and the __terminate() function).
...
This is still probably wrong for Objective-C++ and adds a couple of lines in CGException that should probably be in the CGObjCRuntime subclass. The personality function is now only looked up in one place in CGException though, so this should be easier to fix in the future.
llvm-svn: 103938
2010-05-17 13:49:20 +00:00
Douglas Gregor
51150ab1f1
When initializing thread-safe statics, put the call to
...
__cxa_guard_abort along the exceptional edge into (in effect) a nested
"try" that rethrows after aborting. Fixes PR7144 and the remaining
Boost.ProgramOptions failures, along with the regressions that r103880
caused.
The crucial difference between this and r103880 is that we now follow
LLVM's little dance with the llvm.eh.exception and llvm.eh.selector
calls, then use _Unwind_Resume_or_Rethrow to rethrow.
llvm-svn: 103892
2010-05-16 01:24:12 +00:00
Douglas Gregor
c278d1b3b9
Revert r103880 (thread-safe static initialization w/ exceptions),
...
because it's causing strange linker errors. Unfixes PR7144.
llvm-svn: 103890
2010-05-16 00:44:00 +00:00
Fariborz Jahanian
1b8b8bf25f
Minor twik to my last patch. (for radar 7986354).
...
llvm-svn: 103889
2010-05-16 00:10:46 +00:00
Fariborz Jahanian
e1b45a5e6b
Fix API gen for objc_msgSend property of aggregate types
...
in Objective-c++ mode. Fixes radar 7986354.
llvm-svn: 103887
2010-05-15 23:05:52 +00:00
Douglas Gregor
58142dd8a1
When initializing thread-safe statics, put the call to
...
__cxa_guard_abort along the exceptional edge into (in effect) a nested
"try" that rethrows after aborting. Fixes PR7144 and the remaining
Boost.ProgramOptions failures.
llvm-svn: 103880
2010-05-15 17:55:51 +00:00
John McCall
b0efad148c
Modify this comment per Doug's suggestion: we don't need to mangle protocols.
...
llvm-svn: 103875
2010-05-15 17:06:29 +00:00
Douglas Gregor
170125648c
When applying the named return value optimization, we still need to
...
destroy the variable along the exceptional edge; it's only during
normal execution that we avoid destroying this variable.
llvm-svn: 103872
2010-05-15 16:39:56 +00:00
John McCall
8b07ec253d
Substantially alter the design of the Objective C type AST by introducing
...
ObjCObjectType, which is basically just a pair of
one of {primitive-id, primitive-Class, user-defined @class}
with
a list of protocols.
An ObjCObjectPointerType is therefore just a pointer which always points to
one of these types (possibly sugared). ObjCInterfaceType is now just a kind
of ObjCObjectType which happens to not carry any protocols.
Alter a rather large number of use sites to use ObjCObjectType instead of
ObjCInterfaceType. Store an ObjCInterfaceType as a pointer on the decl rather
than hashing them in a FoldingSet. Remove some number of methods that are no
longer used, at least after this patch.
By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
pointers to Objective-C types, which is crucial for a certain kind of ObjC++
metaprogramming common in WebKit.
llvm-svn: 103870
2010-05-15 11:32:37 +00:00
Douglas Gregor
290c93ec0d
Implement a simple form of the C++ named return value optimization for
...
return statements. We perform NRVO only when all of the return
statements in the function return the same variable. Fixes some link
failures in Boost.Interprocess (which is relying on NRVO), and
probably improves performance for some C++ applications.
llvm-svn: 103867
2010-05-15 06:46:45 +00:00
Douglas Gregor
6fd1b1802f
Implement semantic analysis and an AST representation for the named
...
return value optimization. Sema marks return statements with their
NRVO candidates (which may or may not end up using the NRVO), then, at
the end of a function body, computes and marks those variables that
can be allocated into the return slot.
I've checked this locally with some debugging statements (not
committed), but there won't be any tests until CodeGen comes along.
llvm-svn: 103865
2010-05-15 06:01:05 +00:00
Douglas Gregor
222cf0efbc
Recognize when the named return value optimization applies in a
...
"return" statement and mark the corresponding CXXConstructExpr as
elidable. Teach CodeGen that eliding a temporary is different from
eliding an object construction.
This is just a baby step toward NRVO.
llvm-svn: 103849
2010-05-15 00:13:29 +00:00
Daniel Dunbar
36d4d1541c
C++/ABI/x86_64: Member pointers should be classified as INTEGER.
...
llvm-svn: 103843
2010-05-15 00:00:37 +00:00
Daniel Dunbar
4bd95c65e7
C++/ABI/i386: Member function pointers should be passed by value.
...
llvm-svn: 103842
2010-05-15 00:00:30 +00:00
Douglas Gregor
1c073f47da
Emit an lvalue dynamic_cast even if the result is not used. Another
...
part (or possibly all) of PR7132.
llvm-svn: 103810
2010-05-14 21:31:02 +00:00
Douglas Gregor
fa8b4955bb
When a failed dynamic_cast<T&> (which is an lvalue) results in a
...
throw, it should use invoke when needed. The fixes the
Boost.Statechrt failures that motivated PR7132, but there are a few
side issues to tackle as well.
llvm-svn: 103803
2010-05-14 21:14:41 +00:00
Anders Carlsson
a1bc38d53e
Remove an unused function.
...
llvm-svn: 103793
2010-05-14 19:48:27 +00:00
Anders Carlsson
1cf9274a5a
Move ContainsPointerToDataMember to CodeGenTypes. No functionality change.
...
llvm-svn: 103792
2010-05-14 19:41:56 +00:00
Devang Patel
ec2a9abd4a
Fix thinko in yesterday's fix.
...
Providing linkage name for function static variable confuses gdb, so don't do that.
llvm-svn: 103779
2010-05-14 16:55:25 +00:00
Anders Carlsson
65c6d541dd
Make sure that value-initialized pointers to data members are initialized correctly.
...
llvm-svn: 103771
2010-05-14 15:05:19 +00:00
Daniel Dunbar
6b45b67b26
C++/Darwin/x86: Teach IRgen it can pass reference types in registers.
...
llvm-svn: 103761
2010-05-14 03:40:53 +00:00
Devang Patel
98f217118f
Fix context in class static variable's debugging information entry.
...
This fixes bunch of failures in gdb testsuite.
llvm-svn: 103745
2010-05-13 23:52:37 +00:00
Douglas Gregor
500d9f8221
Disable the available_externally optimization for inline virtual
...
methods for which the key function is guaranteed to be in another
translation unit. Unfortunately, this guarantee isn't the case when
dealing with shared libraries that fail to export these virtual method
definitions.
I'm reopening PR6747 so we can consider this again at a later point in
time.
llvm-svn: 103741
2010-05-13 21:36:56 +00:00
Douglas Gregor
88d292ccb8
Rework when and how vtables are emitted, by tracking where vtables are
...
"used" (e.g., we will refer to the vtable in the generated code) and
when they are defined (i.e., because we've seen the key function
definition). Previously, we were effectively tracking "potential
definitions" rather than uses, so we were a bit too eager about emitting
vtables for classes without key functions.
The new scheme:
- For every use of a vtable, Sema calls MarkVTableUsed() to indicate
the use. For example, this occurs when calling a virtual member
function of the class, defining a constructor of that class type,
dynamic_cast'ing from that type to a derived class, casting
to/through a virtual base class, etc.
- For every definition of a vtable, Sema calls MarkVTableUsed() to
indicate the definition. This happens at the end of the translation
unit for classes whose key function has been defined (so we can
delay computation of the key function; see PR6564), and will also
occur with explicit template instantiation definitions.
- For every vtable defined/used, we mark all of the virtual member
functions of that vtable as defined/used, unless we know that the key
function is in another translation unit. This instantiates virtual
member functions when needed.
- At the end of the translation unit, Sema tells CodeGen (via the
ASTConsumer) which vtables must be defined (CodeGen will define
them) and which may be used (for which CodeGen will define the
vtables lazily).
From a language perspective, both the old and the new schemes are
permissible: we're allowed to instantiate virtual member functions
whenever we want per the standard. However, all other C++ compilers
were more lazy than we were, and our eagerness was both a performance
issue (we instantiated too much) and a portability problem (we broke
Boost test cases, which now pass).
Notes:
(1) There's a ton of churn in the tests, because the order in which
vtables get emitted to IR has changed. I've tried to isolate some of
the larger tests from these issues.
(2) Some diagnostics related to
implicitly-instantiated/implicitly-defined virtual member functions
have moved to the point of first use/definition. It's better this
way.
(3) I could use a review of the places where we MarkVTableUsed, to
see if I missed any place where the language effectively requires a
vtable.
Fixes PR7114 and PR6564.
llvm-svn: 103718
2010-05-13 16:44:06 +00:00
Devang Patel
c5ffabc94f
If given location is invalid then use current location.
...
This fixes recent regressions reported by gdb testsuite.
Tighter verification of debug info generated by FE found these regressions.
Refactor code to extract line number and column number from SourceLocation.
llvm-svn: 103678
2010-05-12 23:46:38 +00:00
Devang Patel
3c2d51a1b9
Use end location of DeclStmt to mark stop point.
...
This is meaningful for blocks. This patch fixes bunch of test failures in gdb testsuite.
llvm-svn: 103533
2010-05-12 00:39:34 +00:00
Abramo Bagnara
6150c884df
Merged Elaborated and QualifiedName types.
...
llvm-svn: 103517
2010-05-11 21:36:43 +00:00
Daniel Dunbar
12ebb47a07
IRgen/i386/C++: Fix isSingleElementStruct computation for C++ record decls.
...
- Fixes PR7098.
llvm-svn: 103514
2010-05-11 21:15:36 +00:00
Douglas Gregor
6a047c979f
It's bad form to create VarDecl's without DeclContexts
...
llvm-svn: 103484
2010-05-11 18:17:16 +00:00
Fariborz Jahanian
2d2623c710
Minor refactoring of my last patch.
...
llvm-svn: 103475
2010-05-11 16:31:10 +00:00
Devang Patel
82bbfb58e3
Initialize Column.
...
llvm-svn: 103448
2010-05-10 23:48:38 +00:00
Fariborz Jahanian
43a40f9399
Objective-C++ Code gen. Handle code gen. for property
...
reference dot-syntax notation in a varierty of cases.
Fixes radar 7964490.
llvm-svn: 103440
2010-05-10 22:57:35 +00:00
Devang Patel
b319adec49
If variable location is invalid then use current location.
...
This fixes radar 7959934.
llvm-svn: 103408
2010-05-10 17:24:58 +00:00
David Chisnall
e0b5b3a1c5
Tweaked selector mangling again (GNU runtime).
...
llvm-svn: 103368
2010-05-09 01:01:43 +00:00
David Chisnall
2ec6cff9d0
Fixed linkage problem from last commit (GNU runtime).
...
llvm-svn: 103355
2010-05-08 21:55:04 +00:00
David Chisnall
0a24fd3744
Tweaked selector generation (GNU runtime). Removed the use of GlobalAliases in the generated bitcode.
...
llvm-svn: 103353
2010-05-08 20:58:05 +00:00
Devang Patel
67eba80672
If there is not any debug info for type then do not emit debug info for this variable.
...
A recent change to tightly verify debug info prepared by FE caught this.
This fixes unittest build.
llvm-svn: 103320
2010-05-07 23:05:55 +00:00
Fariborz Jahanian
7828ab1ed9
Minor mod. to my last patch.
...
llvm-svn: 103280
2010-05-07 18:59:54 +00:00
Fariborz Jahanian
fdf474b05e
Fixes a Code gen crash trying to use a dot-syntax for
...
a property of a c++ class object (radar 7957369).
llvm-svn: 103279
2010-05-07 18:56:13 +00:00
Devang Patel
ba4ad7f2fd
Avoid use of DIDescriptor::getNode(). Use overloaded operators instead.
...
llvm-svn: 103273
2010-05-07 18:12:35 +00:00
Douglas Gregor
d8bb3aff76
Do not give implicitly-defined virtual members functions
...
available_externally linkage, since they may not have been given a
strong definition in another translation unit. Without this patch, the
following test case fails to link with a GCC-compiled libstdc++:
#include <sstream>
int main() { std::basic_stringbuf<char> bs; }
Fixes the last problem with the Boost.IO library.
llvm-svn: 103208
2010-05-06 23:13:35 +00:00
Douglas Gregor
1411bb8f76
Fix typo in comment; 80 col violation
...
llvm-svn: 103204
2010-05-06 22:33:50 +00:00
Douglas Gregor
ae498b3211
The global variable for the VTT might not have external linkage; allow
...
us to find local variables, too. Fixes the last remaining
Boost.Rational failure.
llvm-svn: 103203
2010-05-06 22:18:21 +00:00
Fariborz Jahanian
b8993384f3
Code Gen support for Getter/Setter synthesis of
...
C++ object properties. (still radar 7468090).
llvm-svn: 103182
2010-05-06 15:45:36 +00:00
Chris Lattner
44456d294c
simplify EmitAggMemberInitializer a bit and make it work in 32-bit mode,
...
fixing PR7063.
llvm-svn: 103171
2010-05-06 06:35:23 +00:00
Chris Lattner
3628326b44
add todos for isinf_sign and isnormal, which I don't intend to implement
...
in the near future.
llvm-svn: 103169
2010-05-06 06:13:53 +00:00
Chris Lattner
dbff4bf5f4
implement codegen support for __builtin_isfinite, part of PR6083
...
llvm-svn: 103168
2010-05-06 06:04:13 +00:00
Chris Lattner
43660c5bc0
implement part of PR6083: codegen support for isinf. Like isnan,
...
this is generating correct but suboptimal (extra extend to double)
code for the float case. Will investigate next.
llvm-svn: 103166
2010-05-06 05:35:16 +00:00
Chandler Carruth
f3983652eb
Clean up the {} and else placement. This fixes an ambiguous else as well as
...
picking a more consistent pattern.
llvm-svn: 103142
2010-05-06 00:20:39 +00:00
Chris Lattner
3baada6fd7
Pass the globaldecl into GetOrCreateLLVMFunction so that llvm
...
function attributes like byval get applied to the function
definition. This fixes PR7058 and makes i386 llvm/clang bootstrap
pass all the same tests as x86-64 bootstrap for me (the llvmc
tests still fail in both).
llvm-svn: 103131
2010-05-05 22:55:13 +00:00
Fariborz Jahanian
25491a22af
This patch deals with Sema Part of Setter/Getter synthesis
...
of properties which are of C++ objects. Code Gen to follow
(Radar 7468090).
llvm-svn: 103123
2010-05-05 21:52:17 +00:00
Douglas Gregor
d450f06ef4
When we emit a non-constant initializer for a global variable of
...
reference type, make sure that the initializer we build is the
of the appropriate type for the *reference*, not for the thing that it
refers to. Fixes PR7050.
llvm-svn: 103115
2010-05-05 20:15:55 +00:00
Douglas Gregor
370eadf38d
For thread-safe static initialization of local statics with
...
destructors, place the __cxa_atexit call after the __cxa_guard_release
call, mimicking GCC/LLVM-GCC behavior. Noticed while debugging
something related.
llvm-svn: 103088
2010-05-05 15:38:32 +00:00
Alexis Hunt
656bb314d9
Reapplying patch to change StmtNodes.def to StmtNodes.td, this time
...
with no whitespace. This will allow statements to be referred to in
attribute TableGen files.
llvm-svn: 103087
2010-05-05 15:24:00 +00:00
Alexis Hunt
a8136cc408
Revert r103072; I accidentally ended up deleting a bunch of trailing
...
whitespace which makes this patch unreadable. Will recommit without the
whitespace.
llvm-svn: 103086
2010-05-05 15:23:54 +00:00
Douglas Gregor
94f9a4820a
Reimplement code generation for copying fields in the
...
implicitly-generated copy constructor. Previously, Sema would perform
some checking and instantiation to determine which copy constructors,
etc., would be called, then CodeGen would attempt to figure out which
copy constructor to call... but would get it wrong, or poke at an
uninstantiated default argument, or fail in other ways.
The new scheme is similar to what we now do for the implicit
copy-assignment operator, where Sema performs all of the semantic
analysis and builds specific ASTs that look similar to the ASTs we'd
get from explicitly writing the copy constructor, so that CodeGen need
only do a direct translation.
However, it's not quite that simple because one cannot explicit write
elementwise copy-construction of an array. So, I've extended
CXXBaseOrMemberInitializer to contain a list of indexing variables
used to copy-construct the elements. For example, if we have:
struct A { A(const A&); };
struct B {
A array[2][3];
};
then we generate an implicit copy assignment operator for B that looks
something like this:
B::B(const B &other) : array[i0][i1](other.array[i0][i1]) { }
CodeGen will loop over the invented variables i0 and i1 to visit all
elements in the array, so that each element in the destination array
will be copy-constructed from the corresponding element in the source
array. Of course, if we're dealing with arrays of scalars or class
types with trivial copy-assignment operators, we just generate a
memcpy rather than a loop.
Fixes PR6928, PR5989, and PR6887. Boost.Regex now compiles and passes
all of its regression tests.
Conspicuously missing from this patch is handling for the exceptional
case, where we need to destruct those objects that we have
constructed. I'll address that case separately.
llvm-svn: 103079
2010-05-05 05:51:00 +00:00
Anders Carlsson
58fe1756fb
Use a more appropriate LLVM type for the vtable pointer.
...
llvm-svn: 103078
2010-05-05 05:47:36 +00:00
Douglas Gregor
ecc60b99f9
Unbreak CMake build.
...
llvm-svn: 103077
2010-05-05 05:41:05 +00:00
Alexis Hunt
b9f408a873
Change StmtNodes.def to StmtNodes.td in anticipation of a rewrite of attributes
...
llvm-svn: 103072
2010-05-05 04:13:52 +00:00
John McCall
4a39ab8078
Emit the globals, metadata, etc. associated with static variables even when
...
they're unreachable. This matters because (if they're POD, or if this is C)
the scope containing the variable might be reachable even if the variable
isn't. Fixes PR7044.
llvm-svn: 103052
2010-05-04 20:45:42 +00:00
Fariborz Jahanian
60c7e16b64
Fixes a code gen. crash when ivar object has trivial constructor.
...
llvm-svn: 103028
2010-05-04 19:29:32 +00:00
Douglas Gregor
c8be95274d
When instantiating a function that was declared via a typedef, e.g.,
...
typedef int functype(int, int);
functype func;
also instantiate the synthesized function parameters for the resulting
function declaration.
With this change, Boost.Wave builds and passes all of its regression
tests.
llvm-svn: 103025
2010-05-04 18:18:31 +00:00
Fariborz Jahanian
eeb233793d
Fixes a code gen crash when block is a reference type, etc.
...
(radar 7495203).
llvm-svn: 103022
2010-05-04 17:59:32 +00:00
John McCall
e61b02bcaf
When inheriting a default argument expression, inherit the full expression,
...
not just the inner expression. This is important if the expression has any
temporaries. Fixes PR 7028.
Basically a symptom of really tragic method names.
llvm-svn: 102998
2010-05-04 01:53:42 +00:00
Fariborz Jahanian
751f7bc03c
Fixes a Code Gen. Crash when calling destructor on a __block
...
variabe. Blocks and their construction/destruction is
wip though.
llvm-svn: 102985
2010-05-04 00:26:07 +00:00
John McCall
5828ee7a27
Just bail out immediately when emitting an unreachable function-local static
...
variable. Surprisingly, this does seem to be the right way to solve this.
llvm-svn: 102961
2010-05-03 21:39:56 +00:00
Douglas Gregor
aee1f51485
If we're generating code to create a pointer-to-member function
...
aggregate and the result of the aggregate is unused, bail out
early. Fixes PR7027.
llvm-svn: 102942
2010-05-03 20:00:27 +00:00
Anders Carlsson
3572d44190
When computing the address of a virtual member function pointer, use the pointer width instead of hardcoding for 64-bit.
...
llvm-svn: 102921
2010-05-03 16:05:06 +00:00
Anders Carlsson
d040e6b25a
Don't build an aggregate constructor loop when the constructor is trivial.
...
llvm-svn: 102912
2010-05-03 15:09:17 +00:00
Anders Carlsson
16e94af67c
Don't copy or initialize empty classes. Fixes PR7012.
...
llvm-svn: 102891
2010-05-03 01:20:20 +00:00
Anders Carlsson
8bdbb5be19
Store the entire base subobject in SubVTTIndices.
...
llvm-svn: 102890
2010-05-03 00:55:11 +00:00
Anders Carlsson
f4da2cf20a
Remove OldGetAddressOfBaseClass - bye bye ambiguities.
...
llvm-svn: 102889
2010-05-03 00:32:27 +00:00
Anders Carlsson
c58fb552f3
Get rid of the last caller of OldGetAddressOfBaseClass.
...
llvm-svn: 102888
2010-05-03 00:29:58 +00:00
Anders Carlsson
c4d0d0fed1
More work towards getting rid of OldGetAddressOfBaseClass.
...
llvm-svn: 102887
2010-05-03 00:07:07 +00:00
Anders Carlsson
e089060fd0
Get rid of a call to GetAddressOfDirectBaseInCompleteClass.
...
llvm-svn: 102886
2010-05-02 23:57:15 +00:00
Anders Carlsson
859b3064cb
Have getSubVTTIndex take a BaseSubobject instead of just a base.
...
llvm-svn: 102885
2010-05-02 23:53:25 +00:00
Anders Carlsson
4d205ba87f
Pass ForVirtualBase all the way to GetVTTParameter.
...
llvm-svn: 102883
2010-05-02 23:33:10 +00:00
Anders Carlsson
f8a71f08d1
Add the same 'ForVirtualBase' parameter to EmitCXXDestructorCall.
...
llvm-svn: 102882
2010-05-02 23:29:11 +00:00
Anders Carlsson
e11f9ce9dc
Revert my last change and add a 'ForVirtualBase' parameter to EmitCXXConstructorCall instead.
...
llvm-svn: 102881
2010-05-02 23:20:53 +00:00
Anders Carlsson
4c638f1217
Pass the construction kind down to EmitCXXConstructorCall.
...
llvm-svn: 102880
2010-05-02 23:01:10 +00:00
Anders Carlsson
245820b9d9
Remove another unused function.
...
llvm-svn: 102871
2010-05-02 18:13:35 +00:00
Anders Carlsson
54eb4843b1
Remove an unused function.
...
llvm-svn: 102870
2010-05-02 18:12:22 +00:00
Benjamin Kramer
2718b4d757
CodeGen: Shrink RValue. 4 words -> 2 words.
...
llvm-svn: 102863
2010-05-02 14:59:10 +00:00
David Chisnall
ff5f88c38e
As per Chris' request, return the Instruction from EmitCall and add the metadata in the caller.
...
llvm-svn: 102862
2010-05-02 13:41:58 +00:00
Douglas Gregor
b139cd5843
Complete reimplementation of the synthesis for implicitly-defined copy
...
assignment operators.
Previously, Sema provided type-checking and template instantiation for
copy assignment operators, then CodeGen would synthesize the actual
body of the copy constructor. Unfortunately, the two were not in sync,
and CodeGen might pick a copy-assignment operator that is different
from what Sema chose, leading to strange failures, e.g., link-time
failures when CodeGen called a copy-assignment operator that was not
instantiation, run-time failures when copy-assignment operators were
overloaded for const/non-const references and the wrong one was
picked, and run-time failures when by-value copy-assignment operators
did not have their arguments properly copy-initialized.
This implementation synthesizes the implicitly-defined copy assignment
operator bodies in Sema, so that the resulting ASTs encode exactly
what CodeGen needs to do; there is no longer any special code in
CodeGen to synthesize copy-assignment operators. The synthesis of the
body is relatively simple, and we generate one of three different
kinds of copy statements for each base or member:
- For a class subobject, call the appropriate copy-assignment
operator, after overload resolution has determined what that is.
- For an array of scalar types or an array of class types that have
trivial copy assignment operators, construct a call to
__builtin_memcpy.
- For an array of class types with non-trivial copy assignment
operators, synthesize a (possibly nested!) for loop whose inner
statement calls the copy constructor.
- For a scalar type, use built-in assignment.
This patch fixes at least a few tests cases in Boost.Spirit that were
failing because CodeGen picked the wrong copy-assignment operator
(leading to link-time failures), and I suspect a number of undiagnosed
problems will also go away with this change.
Some of the diagnostics we had previously have gotten worse with this
change, since we're going through generic code for our
type-checking. I will improve this in a subsequent patch.
llvm-svn: 102853
2010-05-01 20:49:11 +00:00
Anders Carlsson
b136e626ea
Simplify EmitCopyCtorCall.
...
llvm-svn: 102849
2010-05-01 17:07:40 +00:00
Anders Carlsson
aab3b57359
Simplify EmitClassAggrMemberwiseCopy.
...
llvm-svn: 102848
2010-05-01 17:02:18 +00:00
Anders Carlsson
ab826ad169
Clean up EmitClassMemberwiseCopy further.
...
llvm-svn: 102846
2010-05-01 16:54:05 +00:00
Anders Carlsson
820022c55c
Get rid of a parameter from EmitClassMemberwiseCopy.
...
llvm-svn: 102845
2010-05-01 16:49:43 +00:00
Anders Carlsson
7911150a3d
When defining implicit copy constructors, use SetBaseOrMemberInitializers to initialize the bases.
...
llvm-svn: 102842
2010-05-01 16:39:01 +00:00
David Chisnall
c0cf422d56
Attach message send metadata to the lookup as well as to the call (GNU runtime).
...
llvm-svn: 102839
2010-05-01 12:56:56 +00:00
David Chisnall
ea529a43d4
Make super message lookups cacheable (GNUstep Runtime)
...
llvm-svn: 102837
2010-05-01 12:37:16 +00:00
David Chisnall
9eecafa480
Tweaked EmitCall() to permit the caller to provide some metadata to attach to the call site.
...
Used this in CGObjCGNU to attach metadata about message sends to permit speculative inlining.
llvm-svn: 102833
2010-05-01 11:15:56 +00:00
John McCall
4d4dcc8ed7
When synthesizing Objective C records, give the synthetic fields public
...
access. Fixes an assertion.
Fixes rdar://problem/7927811. Too lazy to reduce a test case.
llvm-svn: 102776
2010-04-30 21:35:41 +00:00
Anders Carlsson
d6c5391cd9
Remove an unnecessary parameter from EmitClassCopyAssignment.
...
llvm-svn: 102747
2010-04-30 19:45:28 +00:00
David Chisnall
d6a6af6a53
Fixed incorrect type of alloca (GNU runtime).
...
llvm-svn: 102711
2010-04-30 13:36:12 +00:00
John McCall
b3cec96a7c
Account for the VTT argument when making an implicit copy constructor for
...
a class with virtual bases. Just a patch until Sema starts (correctly) doing
most of this analysis.
Fixes PR 6622.
llvm-svn: 102692
2010-04-30 05:56:45 +00:00
John McCall
48bf349471
Fix -fno-rtti -fexceptions by forcing the emission of (non-"builtin") RTTI
...
when used by the exceptions routines. Fixes PR 6974.
llvm-svn: 102684
2010-04-30 01:15:21 +00:00
John McCall
dac3ea6e8d
Teach EHCleanupBlock to deal appropriately with the possibility that there
...
might not have been an insertion block set at start. Fixes PR6975.
llvm-svn: 102677
2010-04-30 00:06:43 +00:00
Anders Carlsson
786a3d910e
Get the base class addresses before calling EmitClassCopyAssignment.
...
llvm-svn: 102676
2010-04-30 00:04:01 +00:00
Anders Carlsson
2b4ec8d003
Remove an unnecessary argument to EmitClassCopyAssignment.
...
llvm-svn: 102674
2010-04-29 23:51:42 +00:00
Devang Patel
dfcd0661a1
Use clang::VarDecl name instead of llvm::GlobalVariable name.
...
llvm::GLobalVariable name may not match user visibile name for function static variables.
llvm-svn: 102644
2010-04-29 17:48:37 +00:00
Daniel Dunbar
0c00537583
IRgen/NeXT: Put the synthesized _objc_super, _message_ref_t decls in a valid DeclContext, to satisfy the invariants that should hold on a RecordDecl.
...
llvm-svn: 102624
2010-04-29 16:29:11 +00:00
Fariborz Jahanian
499b902510
Support for construct/destruct of ivar array
...
of c++ objects (NeXt runtime).
radar 7900343.
llvm-svn: 102546
2010-04-28 22:30:33 +00:00
Douglas Gregor
882211c1da
Completely reimplement __builtin_offsetof, based on a patch by Roberto
...
Amadini.
This change introduces a new expression node type, OffsetOfExpr, that
describes __builtin_offsetof. Previously, __builtin_offsetof was
implemented using a unary operator whose subexpression involved
various synthesized array-subscript and member-reference expressions,
which was ugly and made it very hard to instantiate as a
template. OffsetOfExpr represents the AST more faithfully, with proper
type source information and a more compact representation.
OffsetOfExpr also has support for dependent __builtin_offsetof
expressions; it can be value-dependent, but will never be
type-dependent (like sizeof or alignof). This commit introduces
template instantiation for __builtin_offsetof as well.
There are two major caveats to this patch:
1) CodeGen cannot handle the case where __builtin_offsetof is not a
constant expression, so it produces an error. So, to avoid
regressing in C, we retain the old UnaryOperator-based
__builtin_offsetof implementation in C while using the shiny new
OffsetOfExpr implementation in C++. The old implementation can go
away once we have proper CodeGen support for this case, which we
expect won't cause much trouble in C++.
2) __builtin_offsetof doesn't work well with non-POD class types,
particularly when the designated field is found within a base
class. I will address this in a subsequent patch.
Fixes PR5880 and a bunch of assertions when building Boost.Python
tests.
llvm-svn: 102542
2010-04-28 22:16:22 +00:00
Fariborz Jahanian
0dec1e0d56
IRGen for initialization/destruction of
...
ivar class objects (NeXt runtime).
(radar 7900343).
llvm-svn: 102533
2010-04-28 21:28:56 +00:00
David Chisnall
01aa46795e
Changed signature of GenerateMessageSend() function to pass the ObjCInterfaceDecl for class messages and removed the boolean IsClassMessage argument, which wasn't used anywhere.
...
Emitted some metadata on message sends to allow a later pass to do some speculative inlining of class methods (GNU runtime). Speculative inlining of instance methods requires type feedback to be useful (work in progress), but for class methods it works quite nicely.
llvm-svn: 102514
2010-04-28 19:33:36 +00:00
Benjamin Kramer
9c05bf46d1
Remove unused function.
...
llvm-svn: 102499
2010-04-28 15:54:45 +00:00
David Chisnall
d472c85285
Emit the correct symbol name for the class (GNU runtime).
...
llvm-svn: 102497
2010-04-28 14:29:56 +00:00
Douglas Gregor
7988def89f
Improve name mangling for dependent template names (e.g., typename
...
T::template apply<U>), handling a few cases where we previously failed
and performing substitutions on such dependent names. Fixes a crash in
Boost.PropertyTree.
llvm-svn: 102490
2010-04-28 05:58:56 +00:00
John McCall
d06fb865eb
Properly pass the address of a lazily-generated function declaration with
...
incomplete type. Fixes PR6911.
llvm-svn: 102473
2010-04-28 00:00:30 +00:00
David Chisnall
e6d0073fa9
Fixed message send to void (broken by my last commit - GNU runtime).
...
llvm-svn: 102459
2010-04-27 20:33:30 +00:00
David Chisnall
75afda6c33
Ensure return from a message to nil is always 0 (GNU runtime).
...
This works around stack corruption / crashes resulting from PR6944, and also
works around people who expect 'what works on my machine' to work everywhere
(GCC crashes in a number of cases on SPARC that should now work correctly with
clang).
llvm-svn: 102430
2010-04-27 15:08:48 +00:00
Daniel Dunbar
19d6355b77
Fix comments.
...
llvm-svn: 102429
2010-04-27 14:51:07 +00:00
John McCall
2408e32096
Make the InjectedClassNameType the canonical type of the current instantiation
...
of a class template or class template partial specialization. That is to
say, in
template <class T> class A { ... };
or
template <class T> class B<const T*> { ... };
make 'A<T>' and 'B<const T*>' sugar for the corresponding InjectedClassNameType
when written inside the appropriate context. This allows us to track the
current instantiation appropriately even inside AST routines. It also allows
us to compute a DeclContext for a type much more efficiently, at some extra
cost every time we write a template specialization (which can be optimized,
but I've left it simple in this patch).
llvm-svn: 102407
2010-04-27 00:57:59 +00:00
Devang Patel
42fb6f8b9a
Enable debug info for local variables at -O1+.
...
llvm-svn: 102398
2010-04-26 23:28:46 +00:00
Chris Lattner
5e8416a77f
emit dtors with the right calling convention in -fno-use-cxa-atexit
...
mode.
llvm-svn: 102377
2010-04-26 20:35:54 +00:00
Douglas Gregor
46a572b871
Make the static type of the exception variable in an Objective-C
...
@catch a VarDecl. The dynamic type is still a ParmVarDecl, but that
will change soon. No effective functionality change.
llvm-svn: 102341
2010-04-26 16:46:50 +00:00
Daniel Dunbar
710cb20cd6
IRgen/NeXT: Fix several alignment issues with Objective-C metadata symbols:
...
- Fix some places that had the alignment hard coded.
- Use ABI type alignment, not preferred type alignment -- neither of this is exactly right, as we really want the C type alignment as required by the runtime, but the ABI alignment is a more correct choice.
This should be equivalent for x86_64, but fixes the alignment for ARM.
llvm-svn: 102314
2010-04-25 20:39:32 +00:00
Daniel Dunbar
5e63927d41
IRgen/NeXT: Reuse EmitImageInfo for both fragile and non-fragile ABI. This fixes Clang to correctly emit the "CorrectedSynthesize" bit when using the non-fragile ABI.
...
llvm-svn: 102312
2010-04-25 20:39:01 +00:00
Anders Carlsson
06eed9bee2
Land another cleanup patch.
...
llvm-svn: 102293
2010-04-25 01:03:12 +00:00
Anders Carlsson
53e1ba948d
Revert enough of my patches to fix self-host again :(
...
llvm-svn: 102289
2010-04-25 00:52:09 +00:00
Anders Carlsson
dde8b46e62
Cleanup SynthesizeCXXCopyConstructor.
...
llvm-svn: 102286
2010-04-24 23:11:18 +00:00
Anders Carlsson
84e3b62ac0
Clean up SynthesizeCXXCopyAssignment a little.
...
llvm-svn: 102285
2010-04-24 23:09:21 +00:00
Anders Carlsson
c4ba0cd2ea
RenameGetAddressOfBaseOfCompleteClass to GetAddressOfDirectBaseInCompleteClass to reflect that it only handles direct bases.
...
llvm-svn: 102284
2010-04-24 23:01:49 +00:00
Anders Carlsson
26b6e23d57
More cleanup.
...
llvm-svn: 102282
2010-04-24 22:43:39 +00:00
Anders Carlsson
9523ad4fd3
Simplify EmitClassMemberwiseCopy now that it's only used for fields.
...
llvm-svn: 102281
2010-04-24 22:36:50 +00:00
Anders Carlsson
90235beb55
DefineImplicitCopyConstructor now uses SetBaseOrMemberInitializers to create implicit base initializers. (Member initializers are still handled by CodeGenFunction::SynthesizeCXXCopyConstructor for now).
...
llvm-svn: 102279
2010-04-24 22:25:18 +00:00
Anders Carlsson
bea9e74e82
Rename GetAddressOfBaseClass to OldGetAddressOfBaseClass.
...
llvm-svn: 102275
2010-04-24 21:51:08 +00:00
Anders Carlsson
795213efde
Get rid of the old GetNonVirtualBaseClassOffset and change all call sites to use the new version.
...
llvm-svn: 102274
2010-04-24 21:27:51 +00:00
Anders Carlsson
8a64c1c94c
Change CodeGenFunction::GetAddressOfDerivedClass to take a BasePath.
...
llvm-svn: 102273
2010-04-24 21:23:59 +00:00
Anders Carlsson
c6eaea70af
Convert more call sites over to the new GetAddressOfBaseClass.
...
llvm-svn: 102272
2010-04-24 21:12:55 +00:00
Anders Carlsson
d829a02514
Add a new GetAddressOfBaseClass overload that takes a base path and. Use it for derived-to-base casts.
...
llvm-svn: 102270
2010-04-24 21:06:20 +00:00
Benjamin Kramer
20f2d4382f
Fix pasto, add a comment.
...
llvm-svn: 102263
2010-04-24 20:26:20 +00:00
Benjamin Kramer
bbb5deace6
Factor code. No functionality change.
...
llvm-svn: 102262
2010-04-24 20:19:58 +00:00
Daniel Dunbar
fca18c1b41
NeXT: Clean up dispatch method policy selection.
...
- Replace -cc1 level -fobjc-legacy-dispatch with -fobjc-dispatch-method={legacy,non-legacy,mixed}.
- Lift "mixed" vs "non-mixed" policy choice up to driver level, instead of being buried in CGObjCMac.cpp.
- No intended functionality change.
llvm-svn: 102255
2010-04-24 17:56:46 +00:00
Anders Carlsson
0c509eeac7
CastExpr should not hold a pointer to the base path. More cleanup.
...
llvm-svn: 102249
2010-04-24 16:57:13 +00:00
Dan Gohman
7905d187e6
Fix a place in inline asm lowering which was creating a TruncInst with a
...
pointer operand. This fixes an abort on
MultiSource/Applications/ClamAV/libclamav_mbox.c.
llvm-svn: 102238
2010-04-24 04:55:02 +00:00
Devang Patel
8471593892
Revert accidental check-in.
...
llvm-svn: 102226
2010-04-24 00:49:16 +00:00
Devang Patel
f8b55d478c
Revert r102215. This causes clang crash while compiling a test case from gdb testsuite.
...
llvm-svn: 102224
2010-04-24 00:40:35 +00:00
Douglas Gregor
96c79498fb
Improve the AST representation of Objective-C @try/@catch/@finally
...
statements. Instead of the @try having a single @catch , where all of
the @catch's were chained (using an O(n^2) algorithm nonetheless),
@try just holds an array of its @catch blocks. The resulting AST is
slightly more compact (not important) and better represents the actual
language semantics (good).
llvm-svn: 102221
2010-04-23 22:50:49 +00:00
Fariborz Jahanian
d3fa70181d
More -fno-constant-cfstrings API work.
...
llvm-svn: 102219
2010-04-23 22:33:39 +00:00
Anders Carlsson
9759793855
Add an InheritancePath parameter to the ImplicitCastExpr constructor.
...
llvm-svn: 102218
2010-04-23 22:18:37 +00:00
Daniel Dunbar
e3883874c5
NeXT/EH: When generating the rethrow code for a finally block, make sure to
...
chain outwards when inside a nested exception scope.
- A real test for this is going into LLVM test-suite.
llvm-svn: 102204
2010-04-23 19:12:32 +00:00
Daniel Dunbar
5a6b3e0865
NeXT/EH: Tidy up EH code a bit, don't emit the catch block EH handler if it is unreachable.
...
llvm-svn: 102203
2010-04-23 19:12:24 +00:00
Fariborz Jahanian
e804c28745
More work toward implementing
...
NeXt's -fno-constant-cfstrings - wip.
llvm-svn: 102189
2010-04-23 17:41:07 +00:00
Chris Lattner
db6d5cb892
Implement PR6845. We allow matching constraints to have different
...
input and output types when the smaller value isn't mentioned in the
asm string. Extend this support from integers to also allowing
fp values to be mismatched (if not mentioned in the asm string).
llvm-svn: 102188
2010-04-23 17:27:29 +00:00
Douglas Gregor
914af2182b
Handle compound assignment expressions (i += j) as lvalues, which is
...
permitted in C++ but not in C. Fixes PR6900. Clang can now handle all
of Boost.Lambda's regression tests.
llvm-svn: 102170
2010-04-23 04:16:32 +00:00
Douglas Gregor
ffe0884bc4
Emit a lame diagnostic when we can't mangle operator names
...
llvm-svn: 102168
2010-04-23 03:19:53 +00:00
Douglas Gregor
173627188d
Mangle dependent template names such as the nested-name-specifier in
...
T::apply <U>::type
Fixes PR6899, although I want to dig a little deeper into the FIXME
for dependent template names that refer to operators.
llvm-svn: 102167
2010-04-23 03:10:43 +00:00
Douglas Gregor
19043f0a6a
I hate default statements. Fixes PR6874.
...
llvm-svn: 102160
2010-04-23 02:02:43 +00:00
Fariborz Jahanian
63408e848b
Support for -fno-constant-cfstrings option - wip.
...
llvm-svn: 102112
2010-04-22 20:26:39 +00:00
Daniel Dunbar
5981377698
IRgen: Fix another case where we generated an invalid access component when we
...
immediately narrowed the access size. Fix this (and previous case) by just
choosing a better access size up-front.
llvm-svn: 102068
2010-04-22 15:22:33 +00:00
Daniel Dunbar
5d6c07e0e9
IRgen: Fix case where we might generate an access component with width == 0, if
...
we have to narrow the access side immediately (can happen with packed,
-fno-bitfield-type-align).
llvm-svn: 102067
2010-04-22 14:56:10 +00:00
Daniel Dunbar
b219780b72
Suppress compiler warning.
...
llvm-svn: 102047
2010-04-22 03:17:06 +00:00
Daniel Dunbar
fc66e0ed87
IRgen: Set alignment correctly on bit-field accesses.
...
llvm-svn: 102046
2010-04-22 03:17:04 +00:00
Daniel Dunbar
488f55c271
IRgen: Rewrite bit-field access policy to not access data beyond the bounds of the structure, which we also now verify as part of the post-layout consistency checks.
...
- This fixes some pedantic bugs with packed structures, as well as major problems with -fno-bitfield-type-align.
- Fixes PR5591, PR5567, and all known -fno-bitfield-type-align issues.
- Review appreciated.
llvm-svn: 102045
2010-04-22 02:35:46 +00:00
Daniel Dunbar
b6f4b05914
IRgen: Fix CGRecordLayout::print to print the bit-field infos in a consistent order.
...
llvm-svn: 102044
2010-04-22 02:35:36 +00:00
John McCall
2e6567ae60
Call PerformCopyInitialization to properly initialize the exception temporary
...
in a throw expression. Use EmitAnyExprToMem to emit the throw expression,
which magically elides the final copy-constructor call (which raises a new
strict-compliance bug, but baby steps). Give __cxa_throw a destructor pointer
if the exception type has a non-trivial destructor.
llvm-svn: 102039
2010-04-22 01:10:34 +00:00
Devang Patel
b9ab309650
Encode field accessibility.
...
llvm-svn: 102033
2010-04-21 23:12:37 +00:00
Daniel Dunbar
53fac692fa
ABI/x86-32 & x86-64: Alignment on 'byval' must be set when when the alignment
...
exceeds the minimum ABI alignment.
llvm-svn: 102019
2010-04-21 19:49:55 +00:00
Daniel Dunbar
557893d2a8
IRgen/x86-32: Factor out getIndirectResult(), to match x86-64 factoring.
...
llvm-svn: 102015
2010-04-21 19:10:51 +00:00
Daniel Dunbar
2ba67440b6
IRgen: Add checking that the LLVM and AST record layout offsets agree (for
...
non-bit-fields).
llvm-svn: 102014
2010-04-21 19:10:49 +00:00
Anders Carlsson
34f54d55e2
Comment out an assert for now.
...
llvm-svn: 102007
2010-04-21 18:03:05 +00:00
John McCall
bf814c79b6
I failed to notice that my last patch wasn't doing as much as it could
...
because EmitBranch actually clears the insert point. This version
actually accomplishes what I initially wanted.
llvm-svn: 101998
2010-04-21 11:18:06 +00:00
John McCall
e683359fc9
Teach EmitBlock to put the target block immediately after the current block
...
(if there's a current block). The chief advantage of doing this is that it
lets us pick blocks (e.g. EH blocks) to push to the end of the function so
that fallthrough happens consistently --- i.e. it gives us the flexibility
of ordering blocks as we please without having to change the order in which
we generate code. There are standard (?) optimization passes which can do some
of that for us, but better to generate reasonable code to begin with.
llvm-svn: 101997
2010-04-21 10:29:06 +00:00
John McCall
2188696d98
Miscellaneous codegen cleanups. Mostly, don't create new basic blocks
...
just to save the current insertion state! This change significantly
simplifies the IR CFG in exceptions code.
llvm-svn: 101996
2010-04-21 10:05:39 +00:00
Douglas Gregor
9a12919421
Overhaul the AST representation of Objective-C message send
...
expressions, to improve source-location information, clarify the
actual receiver of the message, and pave the way for proper C++
support. The ObjCMessageExpr node represents four different kinds of
message sends in a single AST node:
1) Send to a object instance described by an expression (e.g., [x method:5])
2) Send to a class described by the class name (e.g., [NSString method:5])
3) Send to a superclass class (e.g, [super method:5] in class method)
4) Send to a superclass instance (e.g., [super method:5] in instance method)
Previously these four cases where tangled together. Now, they have
more distinct representations. Specific changes:
1) Unchanged; the object instance is represented by an Expr*.
2) Previously stored the ObjCInterfaceDecl* referring to the class
receiving the message. Now stores a TypeSourceInfo* so that we know
how the class was spelled. This both maintains typedef information
and opens the door for more complicated C++ types (e.g., dependent
types). There was an alternative, unused representation of these
sends by naming the class via an IdentifierInfo *. In practice, we
either had an ObjCInterfaceDecl *, from which we would get the
IdentifierInfo *, or we fell into the case below...
3) Previously represented by a class message whose IdentifierInfo *
referred to "super". Sema and CodeGen would use isStr("super") to
determine if they had a send to super. Now represented as a
"class super" send, where we have both the location of the "super"
keyword and the ObjCInterfaceDecl* of the superclass we're
targetting (statically).
4) Previously represented by an instance message whose receiver is a
an ObjCSuperExpr, which Sema and CodeGen would check for via
isa<ObjCSuperExpr>(). Now represented as an "instance super" send,
where we have both the location of the "super" keyword and the
ObjCInterfaceDecl* of the superclass we're targetting
(statically). Note that ObjCSuperExpr only has one remaining use in
the AST, which is for "super.prop" references.
The new representation of ObjCMessageExpr is 2 pointers smaller than
the old one, since it combines more storage. It also eliminates a leak
when we loaded message-send expressions from a precompiled header. The
representation also feels much cleaner to me; comments welcome!
This patch attempts to maintain the same semantics we previously had
with Objective-C message sends. In several places, there are massive
changes that boil down to simply replacing a nested-if structure such
as:
if (message has a receiver expression) {
// instance message
if (isa<ObjCSuperExpr>(...)) {
// send to super
} else {
// send to an object
}
} else {
// class message
if (name->isStr("super")) {
// class send to super
} else {
// send to class
}
}
with a switch
switch (E->getReceiverKind()) {
case ObjCMessageExpr::SuperInstance: ...
case ObjCMessageExpr::Instance: ...
case ObjCMessageExpr::SuperClass: ...
case ObjCMessageExpr::Class:...
}
There are quite a few places (particularly in the checkers) where
send-to-super is effectively ignored. I've placed FIXMEs in most of
them, and attempted to address send-to-super in a reasonable way. This
could use some review.
llvm-svn: 101972
2010-04-21 00:45:42 +00:00
Fariborz Jahanian
acdfa7acfe
Fixes a code gen. bug by removing an assert.
...
It is ok to have c++-ness inside extern "C"
block. Fixes pr6644.
llvm-svn: 101948
2010-04-20 22:02:31 +00:00
Anders Carlsson
91baecfeb3
Back out r101911 and see if it makes the bots happy.
...
llvm-svn: 101921
2010-04-20 18:05:10 +00:00
Daniel Dunbar
20b551a443
IRgen: Always use i8 arrays to access union bit-fields. This is ugly, but
...
matches how we currently handle structs, and this correctly handles
-fno-bitfield-type-align.
llvm-svn: 101918
2010-04-20 17:52:30 +00:00
Anders Carlsson
6a0227df49
Fix a bug which triggered the assertion I added yesterday. Basically, when we initialize the vtable pointer for a virtual base, and there was another path from the most derived class to another base with the same class type, we would use the wrong base.
...
llvm-svn: 101911
2010-04-20 16:22:16 +00:00
Anders Carlsson
53cebd1ea6
Move code to apply a non-virtual and virtual offset out into a separate function.
...
llvm-svn: 101909
2010-04-20 16:03:35 +00:00
Chris Lattner
9cffdf1331
don't slap noalias attribute on stret result arguments.
...
This mirror's Dan's patch for llvm-gcc in r97989, and
fixes the miscompilation in PR6525. There is some contention
over whether this is the right thing to do, but it is the
conservative answer and demonstrably fixes a miscompilation.
llvm-svn: 101877
2010-04-20 05:44:43 +00:00
Anders Carlsson
652758c3ec
Pass the nearest virtual base decl to InitializeVTablePointers. No functionality change right now.
...
llvm-svn: 101872
2010-04-20 05:22:15 +00:00
Anders Carlsson
3d4218570a
Assert that the path from the derived to the base class in CodeGenFunction::GetAddressOfBaseClass is not ambiguous.
...
llvm-svn: 101869
2010-04-20 05:07:22 +00:00
Douglas Gregor
c4df407604
Keep track of the actual storage specifier written on a variable or
...
function declaration, since it may end up being changed (e.g.,
"extern" can become "static" if a prior declaration was static). Patch
by Enea Zaffanella and Paolo Bolzoni.
llvm-svn: 101826
2010-04-19 22:54:31 +00:00
Daniel Dunbar
ccabe48235
AST: Dump ASTRecordLayout objects when they are created with -fdump-record-layouts.
...
llvm-svn: 101815
2010-04-19 20:44:53 +00:00
Daniel Dunbar
2ea5183b59
IRgen: Kill unused function and move the type match assert to after record dumping.
...
llvm-svn: 101814
2010-04-19 20:44:47 +00:00
Fariborz Jahanian
fd34b0ac84
Check for darwin befoer cheking for version.
...
(related to radar 7866951).
llvm-svn: 101799
2010-04-19 18:38:31 +00:00
Fariborz Jahanian
4d55b2d049
Some renaming of methods, fixes typo
...
(related to PR6769).
llvm-svn: 101794
2010-04-19 18:15:02 +00:00
Fariborz Jahanian
dfb3983525
Force clang to produce legacy api for messaging
...
in for pre-snowleoprd (NeXt runtime). Fixes
radar 7866951
llvm-svn: 101791
2010-04-19 17:53:30 +00:00
Rafael Espindola
47cf5b581a
Add comment explaning the use of c99 inline in c++.
...
llvm-svn: 101787
2010-04-19 16:58:20 +00:00
Dan Gohman
145f3f1e83
Fix -Wcast-qual warnings.
...
llvm-svn: 101786
2010-04-19 16:39:44 +00:00
David Chisnall
44ec555a87
Don't just emit ivar metadata - emit CORRECT ivar metadata. (GNU runtime)
...
llvm-svn: 101759
2010-04-19 01:37:25 +00:00
David Chisnall
18cf7378de
Fix emitting ivar metadata for synthesized ivars and some 64-bit fixes. (GNU runtime)
...
llvm-svn: 101758
2010-04-19 00:45:34 +00:00
Rafael Espindola
683fe4fc4c
If a method is virtual and the class key function is in another file, emit the method as available_externally.
...
Fixes PR6747
llvm-svn: 101757
2010-04-19 00:44:22 +00:00
Fariborz Jahanian
3fef72f0ba
Local static variables must be available module-wise
...
as they are accessible in static methods in a class
local to the same function. Fixes PR6769.
llvm-svn: 101756
2010-04-18 21:01:23 +00:00
Nuno Lopes
247a138ec6
recommit r101568 to fix PR6766
...
as a side-effect, remove two FIXMEs now fixed
llvm-svn: 101726
2010-04-18 19:06:43 +00:00
Anders Carlsson
d5f27b0583
Simplify wide bit-field layout in CGRecordLayoutBuilder, and also fix a bug where assigning to a bit-field member would overwrite other parts of the struct.
...
llvm-svn: 101681
2010-04-17 22:54:57 +00:00
Anders Carlsson
8345a70c67
Fix an assert when assigning a boolean value to a bitfield of type _Bool.
...
llvm-svn: 101678
2010-04-17 21:52:22 +00:00
Anders Carlsson
2295f13bb0
Unnamed bit-fields in a union should be laid out with a type that doesn't affect alignment.
...
llvm-svn: 101673
2010-04-17 21:04:52 +00:00
Anders Carlsson
1de2f5710b
Factor union field layout code out into a separate function. No functionality change.
...
llvm-svn: 101671
2010-04-17 20:49:27 +00:00
Anders Carlsson
11e5140db9
Vtable -> VTable renames across the board.
...
llvm-svn: 101666
2010-04-17 20:15:18 +00:00
Chris Lattner
a299f2c872
fix integrated assembler with i386 objc code.
...
llvm-svn: 101660
2010-04-17 18:26:20 +00:00
Anders Carlsson
c6db5ab8b2
Fix a bug where we would sometimes incorrectly mark an vtable function as unused.
...
llvm-svn: 101643
2010-04-17 17:24:33 +00:00
Benjamin Kramer
b11416d061
Add raw_ostream operators to NamedDecl for convenience. Switch over all users of getNameAsString on a stream.
...
The next step is to print the name directly into the stream, avoiding a temporary std::string copy.
llvm-svn: 101632
2010-04-17 09:33:03 +00:00
Chris Lattner
b714a4b4a0
revert r101568, which miscompiles this testcase, distilled from ldecod:
...
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-17 06:53:44 +00:00
Nuno Lopes
74b595256a
fix PR6766: codegen of var initialized with wide char
...
llvm-svn: 101568
2010-04-16 23:19:41 +00:00
Chris Lattner
3cff64ab58
fix a bogus assertion exposed by a recent change: packing the
...
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-16 21:02:32 +00:00
Nuno Lopes
5863c999e7
emit padding as undef values, take 2
...
merge also a few tests I had here for this feature, and FileCheck'ize one file
llvm-svn: 101535
2010-04-16 20:56:35 +00:00
Anders Carlsson
be6f3181dd
Make CGRecordLayoutBuilder deal with wide bit-fields. Will land tests shortly (Daniel, please review).
...
llvm-svn: 101472
2010-04-16 16:23:02 +00:00
Chris Lattner
79bf976518
tidy up
...
llvm-svn: 101447
2010-04-16 06:12:51 +00:00
Daniel Dunbar
9c78d63fbc
IRgen: Change CGBitFieldInfo to take the AccessInfo as constructor arguments, it is now an immutable object.
...
Also, add some checking of various invariants that should hold on the CGBitFieldInfo access.
llvm-svn: 101345
2010-04-15 05:09:32 +00:00
Daniel Dunbar
bb13845c5f
IRgen: Eliminate now unused fields from CGBitFieldInfo.
...
llvm-svn: 101344
2010-04-15 05:09:28 +00:00
Daniel Dunbar
67aba79b74
IRgen: (Reapply 101222, with fixes) Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
...
- Sadly, this doesn't seem to give any .ll size win so far. It is possible to make this routine significantly smarter & avoid various shifting, masking, and zext/sext, but I'm not really convinced it is worth it. It is tricky, and this is really instcombine's job.
- No intended functionality change; the test case is just to increase coverage & serves as a demo file, it worked before this commit.
The new fixes from r101222 are:
1. The shift to the target position needs to occur after the value is extended to the correct size. This broke Clang bootstrap, among other things no doubt.
2. Swap the order of arguments to OR, to get a tad more constant folding.
llvm-svn: 101339
2010-04-15 03:47:33 +00:00
Eric Christopher
1bbc7086ff
Rewrite handling of 64-bit palignr intrinsics to be vector shuffles.
...
Stop multiplying constant by 8 accordingly in the header and change
intrinsic definition for what types we expect.
Add to existing palignr test to check that we're emitting the correct things.
llvm-svn: 101332
2010-04-15 01:43:08 +00:00
Daniel Dunbar
d51c1a6e09
IRgen/NeXT: Simplify to use AST record layout for getting offsets instead of the
...
IRgen record layout, which this code doesn't need to depend on.
llvm-svn: 101257
2010-04-14 17:02:21 +00:00
Daniel Dunbar
91ea6ac3e9
Speculatively revert "IRgen: Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.", I think it might be breaking bootstrap.
...
llvm-svn: 101235
2010-04-14 05:48:35 +00:00
Daniel Dunbar
230e1541b3
IRgen: Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
...
- Sadly, this doesn't seem to give any .ll size win so far. It is possible to make this routine significantly smarter & avoid various shifting, masking, and zext/sext, but I'm not really convinced it is worth it. It is tricky, and this is really instcombine's job.
- No intended functionality change; the test case is just to increase coverage & serves as a demo file, it worked before this commit.
llvm-svn: 101222
2010-04-14 04:08:03 +00:00
Daniel Dunbar
b2b40a479d
IRgen: Tweak CGBitFieldInfo doxyments & add an accessor.
...
llvm-svn: 101221
2010-04-14 04:07:59 +00:00
Chris Lattner
dad4062b4d
implement altivec.h and a bunch of support code, patch by Anton Yartsev!
...
llvm-svn: 101215
2010-04-14 03:54:58 +00:00
Daniel Dunbar
3447a02d5f
IRgen: Move EmitLoadOfBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
...
- This lets the method focus slightly more on emitting clean IR to honor the policy which has been selected. On 403.gcc's combine.c, x86_64, -O0, this reduces the number of lines in the .ll file (~= # of instructions) by 2.5%.
- No intended functionality change -- at -O3 this should produce equivalent if not identical output. On 403.gcc's combine.c, x86_64, -O3, this isn't quite true and some of the changes are regressions, but I'm not going to worry about that until we move to a new access policy.
- There is still some room for improvement in the generated IR, in particular we can usually fold the sign-extension of the bit-field into one of the component access. See the FIXME.
llvm-svn: 101192
2010-04-13 23:34:15 +00:00
Daniel Dunbar
b935b9370d
IRgen: Enhance CGBitFieldInfo with enough information to fully describe the "policy" with which a bit-field should be accessed.
...
- For now, these policies are computed to match the current IRgen strategy, although the new information isn't being used yet (except in -fdump-record-layouts).
- Design comments appreciated.
llvm-svn: 101178
2010-04-13 20:58:55 +00:00
Fariborz Jahanian
5e575c03b8
Removes a FIXME.
...
llvm-svn: 101161
2010-04-13 18:43:37 +00:00
Fariborz Jahanian
7e9d52aaca
Variation of objc_copyStruct API generation when
...
property (atomic/nonatomic) is of aggregate type with
gc'able member objects) (NeXT runtime).
llvm-svn: 101156
2010-04-13 18:32:24 +00:00
Chris Lattner
ff0e2a36e2
Rework the ConstStructBuilder code to emit missing initializer
...
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-13 18:16:19 +00:00
Chris Lattner
d8d760ce66
unbreak tests.
...
llvm-svn: 101153
2010-04-13 17:57:11 +00:00
Chris Lattner
cfa3e7ae6a
move a bunch of ConstStructBuilder methods out of line.
...
llvm-svn: 101152
2010-04-13 17:45:57 +00:00
Chris Lattner
7a4a29f89a
minor cleanups
...
llvm-svn: 101151
2010-04-13 17:39:09 +00:00
Fariborz Jahanian
08b0f66d2e
Add support for objc_copyStruct to enforce
...
atomicity of aggregate properties in setter/getter
methods. wip.
llvm-svn: 101107
2010-04-13 00:38:05 +00:00
Devang Patel
74c10507a6
Fix debug info for cleanup block.
...
llvm-svn: 101100
2010-04-13 00:08:43 +00:00
Chris Lattner
933f67887f
fix PR6660/6168: emit padding as zeros instead of undef. Because
...
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-04-12 21:10:05 +00:00
Daniel Dunbar
f9c24f8403
IRgen: Factor out ComputeBitFieldInfo.
...
llvm-svn: 101066
2010-04-12 21:01:28 +00:00
Fariborz Jahanian
5a8c2034a4
Add some API code for future work.
...
llvm-svn: 101052
2010-04-12 18:18:10 +00:00
Daniel Dunbar
b97bff9aa9
IRgen: Add CGRecordLayout::dump, and dump (irgen) record layouts as part of -fdump-record-layouts.
...
llvm-svn: 101051
2010-04-12 18:14:18 +00:00
Anders Carlsson
1c0f8bb4ce
Have the CXXBaseOrMemberInitializer keep track of whether an initializer initializes a virtual base or not.
...
llvm-svn: 101004
2010-04-12 00:51:03 +00:00
Anders Carlsson
3383e2ad74
Fix another bug where we wouldn't generate secondary vtables for construction vtables in some cases.
...
llvm-svn: 100998
2010-04-11 22:20:36 +00:00
Anders Carlsson
d78b224e91
More renames.
...
llvm-svn: 100991
2010-04-11 22:07:06 +00:00
Anders Carlsson
b41c633a34
Rename a function parameter.
...
llvm-svn: 100990
2010-04-11 22:03:57 +00:00
Anders Carlsson
de0338abac
Clarify an assertion.
...
llvm-svn: 100986
2010-04-11 20:23:06 +00:00
Anders Carlsson
343a26b56d
Fix a bug where we were adding too many vcall offsets in some cases.
...
llvm-svn: 100985
2010-04-11 20:04:11 +00:00
Anders Carlsson
0b5522114e
Enable an assert and remove a now unnecessary assert.
...
llvm-svn: 100953
2010-04-10 21:50:08 +00:00
Anders Carlsson
88cf34f2b4
Fix a bug where we would add the same function twice in a vtable.
...
llvm-svn: 100949
2010-04-10 20:39:29 +00:00
Chris Lattner
bd7b0a8d55
revert 100942, pending discussion.
...
llvm-svn: 100946
2010-04-10 19:33:39 +00:00
Anders Carlsson
be1b9cbc63
Rename VtableComponent and VtableBuilder.
...
llvm-svn: 100945
2010-04-10 19:13:06 +00:00
David Chisnall
916fb83f39
Fix for PR6811.
...
llvm-svn: 100942
2010-04-10 19:06:38 +00:00
Chris Lattner
bc3be65d2e
fix PR6805: llvm.objectsize changed to take an i1 instead of an i32.
...
llvm-svn: 100938
2010-04-10 18:34:14 +00:00
Benjamin Kramer
1554e4a4bb
A bunch of string-related microoptimizations in Mangler.
...
llvm-svn: 100928
2010-04-10 16:03:31 +00:00
Benjamin Kramer
2e8ca0b86d
Fix use after free. Incrementing an use_iterator after its user is erased is unsafe.
...
llvm-svn: 100926
2010-04-10 11:02:40 +00:00
John McCall
e2f3524f83
Doug pointed out that we have a perfectly reasonable expression here to
...
serve as a source of source locations for the can't-yet-mangle diagnostic.
llvm-svn: 100924
2010-04-10 09:39:25 +00:00
Gabor Greif
d394aec87d
rely even less on CallInst internals
...
llvm-svn: 100919
2010-04-10 03:45:50 +00:00
Gabor Greif
d0ef1346f3
do not rely on CallInst interna, use CallSite to access arguments
...
llvm-svn: 100918
2010-04-10 02:56:12 +00:00
John McCall
e8917e0fd2
Mangle some expressions with codegen implications but no mangling "overhead".
...
llvm-svn: 100909
2010-04-09 22:54:09 +00:00
John McCall
6936c863b0
Provide an extremely unsatisfactory diagnostic (instead of crashing) when
...
mangling an unknown expression kind. Also conveniently tells the user what
kind of expression they should add to the mangler!
llvm-svn: 100907
2010-04-09 22:26:14 +00:00
John McCall
09277542f2
Provide manglings for bool and character literal expressions. These are
...
just integer-literal expressions with special case implementations in the AST.
Fixes rdar://problem/7825453.
llvm-svn: 100905
2010-04-09 21:48:08 +00:00
Anders Carlsson
af2a317e05
Rename CGVtable files to CGVTables.
...
llvm-svn: 100778
2010-04-08 16:30:25 +00:00
Anders Carlsson
ae9e9a63bd
Clarify an assert.
...
llvm-svn: 100776
2010-04-08 16:18:36 +00:00
Douglas Gregor
bc6a434773
Unbreak the build
...
llvm-svn: 100775
2010-04-08 16:07:47 +00:00
Douglas Gregor
eadd3cace9
Eliminate excessive PCH deserialization caused by the search for
...
__cxxabiv1::__fundamental_type_info in every translation
unit. Previously, we would perform name lookup for
__cxxabiv1::__fundamental_type_info at the end of IRGen for a each
translation unit, to determine whether it was present. If so, we we
produce type information for all of the fundamental types. However,
this name lookup causes PCH deserialization of a significant part of the
translation unit, which has a woeful impact on performance.
With this change, we now look at each record type after we've
generated its vtable to see if it is
__cxxabiv1::__fundamental_type_info. If so, we generate type info for
all of the fundamental types. This works because
__cxxabiv1::__fundamental_type_info should always have a key function
(typically the virtual destructor), that will be defined once in the
support library. The fundamental type information will end up there.
Fixes <rdar://problem/7840011>.
llvm-svn: 100772
2010-04-08 15:52:03 +00:00
Daniel Dunbar
c75c8bd757
IRgen: Move the bit-field access type into CGBitFieldInfo, and change bit-field LValues to just store the base address of object containing the bit-field.
...
llvm-svn: 100745
2010-04-08 02:59:45 +00:00
John McCall
8586bfd85d
@llvm.sqrt isn't really close enough to C's sqrt to justify emitting calls
...
to the intrinsic, even when math-errno is off.
Fixes rdar://problem/7828230 by falling back on the library function.
llvm-svn: 100613
2010-04-07 08:20:20 +00:00
Chris Lattner
fdb76ccfb4
a ridiculous amount of propagation through the backend later,
...
have the code generate slap a srcloc metadata on inline asm nodes.
This allows us to diagnose invalid inline asms with such nice
diagnostics as:
<inline asm>:1:2: error: unrecognized instruction
abc incl %eax
^
asm.c:2:12: note: generated from here
__asm__ ("abc incl %0" : "+r" (X));
^
2 diagnostics generated.
llvm-svn: 100608
2010-04-07 05:46:54 +00:00
Chris Lattner
c0e8a59ac9
fit in 80 cols
...
llvm-svn: 100534
2010-04-06 17:29:22 +00:00
Daniel Dunbar
196ea449ed
IRgen: Move BitFieldIsSigned bit into CGBitFieldInfo.
...
llvm-svn: 100513
2010-04-06 01:07:44 +00:00
Daniel Dunbar
d45491077a
Simplify.
...
llvm-svn: 100512
2010-04-06 01:07:41 +00:00
Daniel Dunbar
60d81e8611
Simplify.
...
llvm-svn: 100511
2010-04-06 01:07:39 +00:00
Daniel Dunbar
dc406b8e92
IRgen: Move BitField LValues to just hold a reference to the CGBitFieldInfo.
...
- Unfortunately, this requires some horrible code in CGObjCMac which always
allocats a CGBitFieldInfo because we don't currently build a proper layout
for Objective-C classes. It needs to be cleaned up, but I don't want the
bit-field cleanups to be blocked on that.
llvm-svn: 100474
2010-04-05 21:36:35 +00:00
Devang Patel
a2c048eaf8
Emit debug info for objc getters and setters.
...
llvm-svn: 100462
2010-04-05 21:09:15 +00:00
Daniel Dunbar
cd3d5e76ce
IRgen: Lift BitFieldInfo to CGBitFieldInfo at namespace level.
...
llvm-svn: 100433
2010-04-05 16:20:44 +00:00
Daniel Dunbar
b76c4cd5ec
Add a FIXME and reduce nesting.
...
llvm-svn: 100432
2010-04-05 16:20:33 +00:00
Mon P Wang
cc2ab0cdc9
Reapply patch for adding support for address spaces and added a isVolatile field to memcpy, memmove, and memset.
...
llvm-svn: 100305
2010-04-04 03:10:52 +00:00
Rafael Espindola
8e7ca8e0b1
Don't produce a vtable for a class if we have an explicit template instantiation declaration and no key function. We will produce the vtable at the explicit template instantiation.
...
Fixes PR6748
llvm-svn: 100266
2010-04-03 04:26:42 +00:00
Daniel Dunbar
7e5aba433d
IRgen/NeXT: Remove my refactoring-enabling asserts, and add a FIXME.
...
llvm-svn: 100237
2010-04-02 22:29:40 +00:00
Daniel Dunbar
8c7f981833
IRgen/Obj-C: Eliminate FindIvarInterface, now that ivar's are in the right DeclContexts (-2 FIXMEs). We still have an annoying linear scan + hidden dependency on how Obj-C layout is done.
...
- This is also an algorithmic improvement in IRgen for Obj-C, although it probably doesn't matter in practice.
llvm-svn: 100228
2010-04-02 21:14:02 +00:00
Chris Lattner
18a584b56c
NewDebugLoc got renamed to DebugLoc.
...
llvm-svn: 100219
2010-04-02 20:21:43 +00:00
Mon P Wang
f7f3bff646
Revert r100193 since it causes failures in objc in clang
...
llvm-svn: 100200
2010-04-02 18:43:42 +00:00
Douglas Gregor
45cf7e3d2a
Rework our handling of copy construction of temporaries, which was a
...
poor (and wrong) approximation of the actual rules governing when to
build a copy and when it can be elided.
The correct implementation is actually simpler than the
approximation. When we only enumerate constructors as part of
initialization (e.g., for direct initialization or when we're copying
from a class type or one of its derived classes), we don't create a
copy. When we enumerate all conversion functions, we do create a
copy. Before, we created some extra copies and missed some
others. The new test copy-initialization.cpp shows a case where we
missed creating a (required, non-elidable) copy as part of a
user-defined conversion, which resulted in a miscompile. This commit
also fixes PR6757, where the missing copy made us reject well-formed
code in the ternary operator.
This commit also cleans up our handling of copy elision in the case
where we create an extra copy of a temporary object, which became
necessary now that we produce the right copies. The code that seeks to
find the temporary object being copied has moved into
Expr::getTemporaryObject(); it used to have two different
not-quite-the-same implementations, one in Sema and one in CodeGen.
Note that we still do not attempt to perform the named return value
optimization, so we miss copy elisions for return values and throw
expressions.
llvm-svn: 100196
2010-04-02 18:24:57 +00:00
Mon P Wang
4b82a88764
Reapply patch for adding support for address spaces and added a isVolatile field to memcpy, memmove, and memset.
...
llvm-svn: 100193
2010-04-02 18:04:30 +00:00
Daniel Dunbar
031d4d40d0
CG/NeXT: Assert some invariants on an ivar's containing decl context that I am about to refactor based on, following some testing.
...
llvm-svn: 100188
2010-04-02 15:43:29 +00:00
Chris Lattner
e675d0f924
adjust to IRBuilder change and use faster DebugLoc apis.
...
llvm-svn: 100093
2010-04-01 06:31:43 +00:00
Douglas Gregor
0208535fda
Extend DependentNameType with a keyword enum that specifies whether
...
this was parsed as a typename-specifier, elaborated-type-specifier
(including the kind), or just a dependent qualified type name.
llvm-svn: 100039
2010-03-31 20:19:30 +00:00
Douglas Gregor
c1d2d8a014
Rename TypenameType to DependentNameType in anticipation of some
...
refactoring work in this area.
llvm-svn: 100019
2010-03-31 17:34:00 +00:00
Benjamin Kramer
9e2e1c9024
Minor include pruning.
...
llvm-svn: 100007
2010-03-31 15:04:05 +00:00
Chris Lattner
be49c03ff4
use the new optimized debug info metadata accessors. In
...
addition to the inherent win, this eliminates the pointless
cost of going through the name -> mdkind stringmap that we
were paying.
llvm-svn: 99983
2010-03-31 03:36:01 +00:00
Daniel Dunbar
034299ef25
IRGen: Move the auxiliary data structures tracking AST -> LLVM mappings out of CodeGenTypes, to per-record CGRecordLayout structures.
...
- I did a cursory check that this was perf neutral, FWIW.
llvm-svn: 99978
2010-03-31 01:09:11 +00:00
Daniel Dunbar
e75a64f2d3
CGRecordLayoutBuilder: Switch unions to use same mechanism for tracking field and bit-field info as structs.
...
- Anders, please check.
llvm-svn: 99977
2010-03-31 00:55:13 +00:00
Douglas Gregor
d7f18dd750
Drastically simplify the computation of linkage for typeinfo by using
...
the existing (and already well-tested) linkage computation for types,
with minor tweaks for dynamic classes and (pointers to) incomplete
types. Fixes PR6597.
llvm-svn: 99968
2010-03-31 00:15:35 +00:00
Daniel Dunbar
23ee4b7710
IRGen: Hide CGRecordLayoutBuilder class, because I can.
...
llvm-svn: 99967
2010-03-31 00:11:27 +00:00
John McCall
d9c7c6568e
Introduce a new kind of derived-to-base cast which bypasses the need for
...
null checks, and make sure we elide null checks when accessing base class
members.
llvm-svn: 99963
2010-03-30 23:58:03 +00:00
Bob Wilson
adb58e32cc
Revert Mon Ping's 99930 due to broken llvm-gcc buildbots.
...
llvm-svn: 99949
2010-03-30 22:28:46 +00:00
Daniel Dunbar
6915cbe7a2
IRGen: Narrow getCGRecordLayout type.
...
llvm-svn: 99946
2010-03-30 22:26:12 +00:00
Daniel Dunbar
072d0bb247
IRgen: Move CGRecordLayout to its own happy little file.
...
llvm-svn: 99945
2010-03-30 22:26:10 +00:00
Daniel Dunbar
f4ffa0dabf
Minor formatting/FIXME cleanups.
...
llvm-svn: 99944
2010-03-30 22:26:07 +00:00
Rafael Espindola
49b85ab6e6
Remember the regparm attribute in FunctionType::ExtInfo.
...
Fixes PR3782.
llvm-svn: 99940
2010-03-30 22:15:11 +00:00
Mon P Wang
231e99743a
Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset
...
llvm-svn: 99930
2010-03-30 21:02:45 +00:00
Rafael Espindola
c50c27cca8
the big refactoring bits of PR3782.
...
This introduces FunctionType::ExtInfo to hold the calling convention and the
noreturn attribute. The next patch will extend it to include the regparm
attribute and fix the bug.
llvm-svn: 99920
2010-03-30 20:24:48 +00:00
Rafael Espindola
ff6a1fc1f3
Don't produce a vtable if we are just instantiating a method and the
...
class has no key function.
Fix PR6738.
llvm-svn: 99900
2010-03-30 18:07:27 +00:00
Benjamin Kramer
9e649c3cfe
Replace some constant-sized SmallVectors.
...
llvm-svn: 99884
2010-03-30 11:36:44 +00:00
Anders Carlsson
f141dd1b95
Remove the old vtable layout code.
...
llvm-svn: 99869
2010-03-30 03:43:47 +00:00
Anders Carlsson
a086edc0e6
Remove UseNewVTableCode checks.
...
llvm-svn: 99868
2010-03-30 03:35:35 +00:00
Anders Carlsson
9d08fc1cd2
Use the new function in EmitClassAggrMemberwiseCopy, fixing the same assert as seen in PR6628 but for arrays this time.
...
llvm-svn: 99867
2010-03-30 03:30:08 +00:00
Anders Carlsson
093bdff0c5
Factor emitting a call to a copy constructor out into a separate function.
...
llvm-svn: 99866
2010-03-30 03:27:09 +00:00
Anders Carlsson
b9fd57f198
Introduce a CXXTemporariesCleanupScope RAII object and use it to cleanup the temporaries code.
...
llvm-svn: 99865
2010-03-30 03:14:41 +00:00
Anders Carlsson
10834b8d56
Handle default arguments when calling copy constructors for bases or members when synthesizing a copy constructor. Fixes PR6628.
...
llvm-svn: 99864
2010-03-30 02:57:48 +00:00
Anders Carlsson
85e64359df
Flip the switch and use the new vtable layout code for everything. I've verified that this passes a self-host but I'll let the bots self host as well before removing the now dead code.
...
llvm-svn: 99861
2010-03-30 02:21:54 +00:00
Ted Kremenek
dbb8cd1d34
Cache results computed by CGDebugInfo::getOrCreateFile() in a DenseMap.
...
This reduces '-c -g' time on one file in 403.gcc by 12%.
llvm-svn: 99857
2010-03-30 00:27:51 +00:00
Ted Kremenek
ac031880af
Remove FIXME comment.
...
llvm-svn: 99828
2010-03-29 19:10:41 +00:00
Ted Kremenek
23c29f0cbe
Change 'TypeCache' from being an std::map to a llvm::DenseMap. This reduces codegen time
...
on one .i file from 403.gcc by 0.5%.
llvm-svn: 99823
2010-03-29 18:29:57 +00:00
Chris Lattner
5902e7bb22
emit signed integer subtractions as 'sub nsw', patch by
...
Anton Yartsev!
llvm-svn: 99817
2010-03-29 17:28:16 +00:00
Anders Carlsson
eba1a60ef0
Another vtable layout fix, making us match gcc better.
...
llvm-svn: 99812
2010-03-29 15:08:41 +00:00
Anders Carlsson
cb6207f723
Handle pure virtual member functions.
...
llvm-svn: 99807
2010-03-29 05:40:50 +00:00
Anders Carlsson
a627ac7ee6
More vtable work - it's not possible to use the new vtable code for everything by setting a flag inside CGVtable.cpp. My plan is to run some tests and bootstrap and once that's done flip the bit.
...
llvm-svn: 99804
2010-03-29 03:38:52 +00:00
Anders Carlsson
800ded68b5
Only add thunks for the most derived class. This fixes some link errors I was seeing in files generated by the vtable tester utility.
...
llvm-svn: 99801
2010-03-29 02:53:58 +00:00
Anders Carlsson
383f4cc8b9
Flip the switch to always get vtables from the VTT when necessary, I've verified that clang bootstraps with this.
...
llvm-svn: 99800
2010-03-29 02:38:51 +00:00
Anders Carlsson
2d016af623
Use the newly added function in the VTT builder.
...
llvm-svn: 99799
2010-03-29 02:14:35 +00:00
Anders Carlsson
f6f24c609b
Cleanup, no functionality change.
...
llvm-svn: 99798
2010-03-29 02:08:26 +00:00
Anders Carlsson
9a97e2ef95
Add the thunks needed by this vtable.
...
llvm-svn: 99793
2010-03-29 01:38:05 +00:00
Anders Carlsson
848d86e5c4
Make sure to sort the vtable thunks by their vtable index :) With this we now pass the test from http://www.codesourcery.com/public/cxx-abi/abi-examples.html#vtable-ctor successfully.
...
llvm-svn: 99792
2010-03-29 01:28:05 +00:00
Anders Carlsson
948d3f4ec6
Fix another thinko, so that flags don't depend on previous bases.
...
llvm-svn: 99791
2010-03-29 01:16:41 +00:00
Anders Carlsson
74d7dfcf8e
When generating base ctors/dtors, we need to lookup virtual bases using the vtable.
...
llvm-svn: 99790
2010-03-29 01:14:25 +00:00
Anders Carlsson
27d86bddfe
Fix thinko.
...
llvm-svn: 99788
2010-03-29 01:12:13 +00:00
Anders Carlsson
5889027ccc
Use construction vtables when needed. This is currently guarded by -fdump-vtable-layouts since it doesn't work 100% yet :)
...
llvm-svn: 99787
2010-03-29 01:08:49 +00:00
Anders Carlsson
8baeaf0a26
Two bug fixes, we weren't updating the thunk index when creating the vtable initializer and we weren't storing the secondary virtual pointer indices.
...
llvm-svn: 99786
2010-03-29 01:04:16 +00:00
Anders Carlsson
d589593c93
Reapply r99775 with a fix for a silly bug - we were setting the vtable pointer for all bases, even those without a vtable pointer :)
...
llvm-svn: 99777
2010-03-28 21:07:49 +00:00
Anders Carlsson
fcc9f91287
Looks like I broke self-host again :(.
...
llvm-svn: 99776
2010-03-28 20:55:21 +00:00
Anders Carlsson
74eab715ae
More improvements to setting the vtable pointer. We now no longer set the vtable pointer for non-virtual primary bases. We also do a pre-order traversal of the class hierarchy; this is necessary in order to get the right vbase offset offsets in base ctors/dtors.
...
llvm-svn: 99775
2010-03-28 20:34:31 +00:00
Anders Carlsson
e87fae9afa
Factor vtable pointer setting code out into a separate function.
...
llvm-svn: 99773
2010-03-28 19:40:00 +00:00
Anders Carlsson
174376629a
Give thunks the same linkage as their original methods.
...
llvm-svn: 99729
2010-03-27 20:50:27 +00:00
Rafael Espindola
adcc1d18e2
When given the magic class __cxxabiv1::__fundamental_type_info, produce
...
the typeinfo for the fundamental types.
Fixes PR6685.
llvm-svn: 99701
2010-03-27 02:52:14 +00:00
John McCall
39ec71f2e9
When mapping restrict to noalias, look for 'restrict' on the parameter variable
...
instead of the canonical parameter type (which has correctly dropped all such
direct qualifiers). Fixes PR6695.
llvm-svn: 99688
2010-03-27 00:47:27 +00:00
Nick Lewycky
3cfe6af8b5
Implement new mangling for vectors.
...
llvm-svn: 99616
2010-03-26 07:18:04 +00:00
Anders Carlsson
aaf8acfea1
Revert r99612 and see if it fixes self-host.
...
llvm-svn: 99614
2010-03-26 06:35:42 +00:00
Anders Carlsson
6fffc64dd2
Don't initialize virtual pointers for primary bases, they've already been initialized.
...
llvm-svn: 99612
2010-03-26 05:53:12 +00:00
Anders Carlsson
1f9348c1fc
Simplify InitializeVtablePtrs in preparation of making it work with construction vtables.
...
llvm-svn: 99609
2010-03-26 04:39:42 +00:00
Anders Carlsson
f1a994ce33
Add and implement CodeGenVTables::getSecondaryVirtualPointerIndex (not used yet).
...
llvm-svn: 99608
2010-03-26 04:23:58 +00:00
Anders Carlsson
92d95f2f7b
Use the new vtable layout code for construction vtables.
...
llvm-svn: 99606
2010-03-26 04:13:46 +00:00
Anders Carlsson
5670d96524
More cleanup.
...
llvm-svn: 99605
2010-03-26 04:10:39 +00:00
Anders Carlsson
a208b3997d
Way more VTT builder cleanup.
...
llvm-svn: 99604
2010-03-26 03:56:54 +00:00
Anders Carlsson
45bd753b4a
More VTT builder cleanup.
...
llvm-svn: 99588
2010-03-26 00:58:21 +00:00
Anders Carlsson
c1b4747d5a
More VTT cleanup.
...
llvm-svn: 99586
2010-03-26 00:50:17 +00:00
Anders Carlsson
e67698bd73
Start cleaning up the VTT builder to make it work more like the VTable builder.
...
llvm-svn: 99581
2010-03-26 00:35:45 +00:00
Anders Carlsson
382a96550b
Remove some VTT builder arguments that were always zero.
...
llvm-svn: 99576
2010-03-26 00:11:51 +00:00
Fariborz Jahanian
f9c4585c80
Fix a code gen. bug involving generation of getter method
...
from properties of _Complex type. (radar 7351147).
llvm-svn: 99558
2010-03-25 21:56:43 +00:00
Anders Carlsson
151b062fee
Don't add address points for virtual primary bases that aren't primary bases in the complete class.
...
llvm-svn: 99555
2010-03-25 21:45:14 +00:00
Daniel Dunbar
3f540c0d7d
Remove support for nand atomic builtins. They are inconsistently implemented in
...
gcc, and the common expectation seems to be that they are unused. If and when
someone cares we can add them back with well documented demantics.
llvm-svn: 99522
2010-03-25 17:13:09 +00:00
Anders Carlsson
a5736bde2e
Use the new vtable layout code for construction vtables.
...
llvm-svn: 99516
2010-03-25 16:49:53 +00:00
Anders Carlsson
a4147148ff
When -fdump-vtable-layouts is specified, construction vtable initializers will be generated using the new vtable layout code. (The code is still not completely in place but this is a huge step forward).
...
llvm-svn: 99508
2010-03-25 15:26:28 +00:00
Anders Carlsson
d03325c54f
More address point map shuffling.
...
llvm-svn: 99462
2010-03-25 00:51:13 +00:00
Anders Carlsson
0534b0201e
Shuffle some code around; this will make it easier to use the new layout code for address points.
...
llvm-svn: 99461
2010-03-25 00:35:49 +00:00
Douglas Gregor
02dde146e0
When returning from a function that has a reference return type, use
...
EmitReferenceBindingToExpr() rather than assuming we have an
lvalue. This is just the lowest hanging fruit for PR6024, which still
requires a bit of work.
llvm-svn: 99447
2010-03-24 23:14:04 +00:00
Douglas Gregor
2538674a98
Change two class forward declarations to struct forward declarations, silencing a Clang warning
...
llvm-svn: 99405
2010-03-24 16:59:08 +00:00
Fariborz Jahanian
47b4629b3b
Code gen for multi-dimensional dynamic allocations.
...
Fixes PR6641.
llvm-svn: 99404
2010-03-24 16:57:01 +00:00
Anders Carlsson
e90954de64
More vtable improvements. We now compute and keep track of all vtable related information which avoids computing the same vtable layout over and over.
...
llvm-svn: 99403
2010-03-24 16:42:11 +00:00
Anders Carlsson
67fbf9853f
Use getNamedGlobal instead of getGlobalVariable. (Fixes self-host).
...
llvm-svn: 99385
2010-03-24 05:32:05 +00:00
Anders Carlsson
b35ea55e2e
More vtable work; preparations for moving over to the new vtable layout code (finally).
...
llvm-svn: 99381
2010-03-24 03:57:14 +00:00
Anders Carlsson
95e0223baf
Remove old thunks code.
...
llvm-svn: 99374
2010-03-24 00:57:54 +00:00
Anders Carlsson
68fdb871dc
Flip the switch and use the new vtable layout code for thunks by default. Add a thunks.cpp test.
...
llvm-svn: 99367
2010-03-24 00:41:37 +00:00
Anders Carlsson
bad991dbfd
Add CodeGenFunction::GenerateThunk and implement it.
...
llvm-svn: 99365
2010-03-24 00:39:18 +00:00
Anders Carlsson
4a3cdf5ac7
Minor cleanup.
...
llvm-svn: 99364
2010-03-24 00:35:44 +00:00
Rafael Espindola
fa1708fdea
revert 99311. Looks like it broke darwin bootstrap.
...
llvm-svn: 99317
2010-03-23 19:55:22 +00:00
Rafael Espindola
4d3745ade6
Avoid producing implicit methods when we have a explicit template instantiation
...
declaration.
llvm-svn: 99311
2010-03-23 18:56:16 +00:00
Fariborz Jahanian
6c67b90752
Code gen for compound assignment of complex
...
types using property syntax to access setter/getters.
(also radar 7351147).
llvm-svn: 99307
2010-03-23 18:43:00 +00:00
Anders Carlsson
55e89f877c
More work on thunks - don't assert if there's a variable with the same name as the thunk already.
...
llvm-svn: 99303
2010-03-23 18:18:41 +00:00
Fariborz Jahanian
3131496622
Patch to implement code gen. use of compound assignent on
...
properties of complex type. Radar 7351147.
llvm-svn: 99299
2010-03-23 18:08:50 +00:00
Anders Carlsson
cd836f0b5f
More thunks scaffolding.
...
llvm-svn: 99294
2010-03-23 17:17:29 +00:00
Anders Carlsson
5c5abad5d9
More work on thunks.
...
llvm-svn: 99287
2010-03-23 16:36:50 +00:00
Anders Carlsson
274fc82289
Move ThunkInfo as well.
...
llvm-svn: 99280
2010-03-23 15:17:13 +00:00
Anders Carlsson
67fd3a50dc
Move ReturnAdjustment and ThisAdjustment out into CGVtable.h
...
llvm-svn: 99279
2010-03-23 15:13:06 +00:00
Anders Carlsson
995891667f
Use the canonical destructor, which fixes the self-host build. Thanks to Eli for noticing.
...
llvm-svn: 99260
2010-03-23 05:15:24 +00:00
Anders Carlsson
917229cf75
Baby steps towards making thunks be emitted from the new vtable layout code.
...
llvm-svn: 99254
2010-03-23 04:59:02 +00:00
Anders Carlsson
7cea12ff9b
Some renames.
...
llvm-svn: 99253
2010-03-23 04:44:10 +00:00
Anders Carlsson
af82f63b47
Always emit associated thunks when emitting the function itself. Remove getVtableAddressPoint, it's not used.
...
llvm-svn: 99252
2010-03-23 04:31:31 +00:00
Anders Carlsson
8841024a7c
Rename MaybeEmitVtable to EmitVTableRelatedData in preparation for making it emit thunks as well.
...
llvm-svn: 99251
2010-03-23 04:15:00 +00:00
Anders Carlsson
a864caff8c
Rename CGVtableInfo to CodeGenVTables in preparation of adding another VTableInfo class.
...
llvm-svn: 99250
2010-03-23 04:11:45 +00:00
Douglas Gregor
65f7a3f801
Comment the reasons for the strange little dance we do with the main file name for debug information
...
llvm-svn: 99215
2010-03-22 21:28:29 +00:00
Anders Carlsson
290c6ed7c7
More work on thunks; almost there now.
...
llvm-svn: 99199
2010-03-22 20:06:40 +00:00
Anders Carlsson
7eb99a607d
Add less than operators to ThisAdjustment, ReturnAdjustment and ThunkInfo. Sort the thunks before dumping them.
...
llvm-svn: 99184
2010-03-22 16:30:44 +00:00
Anders Carlsson
53a47bf901
Improve dumping of thunks.
...
llvm-svn: 99181
2010-03-22 16:10:59 +00:00
Anders Carlsson
64decd3586
We want to add all thunks, not just 'this' adjustment thunks.
...
llvm-svn: 99177
2010-03-22 15:47:01 +00:00
Anders Carlsson
4b2411e9d2
AddThunk should take a const reference.
...
llvm-svn: 99140
2010-03-21 20:27:14 +00:00
Rafael Espindola
46b7987f85
Fix PR6648 by not creating a temporary with the type of a
...
CXXExprWithTemporaries.
Not emitting the expression as an aggregate might be the right thing to do,
but is orthogonal. Emitting it as an scalar expression will still try to
create a temporary for the incomplete type of the CXXExprWithTemporaries and
fail.
llvm-svn: 99134
2010-03-21 17:11:05 +00:00
David Chisnall
12ae54d42f
Fixed synthesizing properties declared in properties (GNU runtime).
...
llvm-svn: 99077
2010-03-20 19:53:29 +00:00
Daniel Dunbar
4ff562d557
IRgen: Wrap atomic intrinsics with memory barriers, to ensure we honor the semantics.
...
- This should be conservatively correct, we eventually should have target hooks for platforms that are less strict.
llvm-svn: 99050
2010-03-20 07:04:11 +00:00
Daniel Dunbar
fe06df4bf3
C++: Add support for -fno-use-cxa-atexit.
...
- So much typing, so little gain...
Also, rename the __cxx_global_initialization function just to match llvm-gcc.
llvm-svn: 99039
2010-03-20 04:15:41 +00:00
Daniel Dunbar
7572284f4f
IRgen: Inline GenerateCXXGlobal[VarDecl]InitFunc into sole caller.
...
llvm-svn: 99038
2010-03-20 04:15:29 +00:00
John McCall
7ec5043c2c
Change CodeGenModule to rely on the Module's symbol table instead of
...
shadowing it in the GlobalDeclMap. Eliminates the string-uniquing
requirement for mangled names, which should help C++ codegen times a little.
Forces us to do string lookups instead of pointer lookups, which might hurt
codegen times a little across the board. We'll see how it plays out.
Removing the string-uniquing requirement implicitly fixes any bugs like
PR6635 which arose from the fact that we had multiple uniquing tables for
different kinds of identifiers.
llvm-svn: 99012
2010-03-19 23:29:14 +00:00
Douglas Gregor
fc7a4813ab
Try to improve computation of the main file name for debug
...
information, to address recent gdb failures.
llvm-svn: 98959
2010-03-19 14:49:09 +00:00
Douglas Gregor
c6b5a3df1e
For debug information, get the main file name from the source manager
...
rather than from the -main-file-name flag, since the source manager
has proper path information. Fixes <rdar://problem/7769538>.
llvm-svn: 98898
2010-03-18 23:46:43 +00:00
Benjamin Kramer
966e934b34
Replace some SmallVectors with arrays.
...
llvm-svn: 98833
2010-03-18 16:59:57 +00:00
Anders Carlsson
18c582d9c8
When dumping vtables, also dump the thunks.
...
llvm-svn: 98799
2010-03-18 02:44:19 +00:00
Anders Carlsson
56446146fd
More work on thunks.
...
llvm-svn: 98765
2010-03-17 20:06:32 +00:00
Rafael Espindola
cd7eef900f
Correctly mangle dependent TypenameType.
...
Fixes PR6625.
llvm-svn: 98707
2010-03-17 04:28:11 +00:00
David Chisnall
2bfc50bf68
Fixed copy-and-paste error causing categories to contain the protocols declared on the class, not the protocols declared on the category.
...
llvm-svn: 98455
2010-03-13 22:20:45 +00:00
Douglas Gregor
b14d123774
Give explicit template instantiations weak ODR linkage. Former
...
iterations of this patch gave explicit template instantiation
link-once ODR linkage, which permitted the back end to eliminate
unused symbols. Weak ODR linkage still requires the symbols to be
generated.
llvm-svn: 98441
2010-03-13 18:23:07 +00:00
Benjamin Kramer
69b3c43391
Use raw_ostream instead of sprintf.
...
llvm-svn: 98438
2010-03-13 12:06:51 +00:00
Kovarththanan Rajaratnam
ba2c65277a
Use SmallString instead of SmallVector
...
llvm-svn: 98436
2010-03-13 10:17:05 +00:00
Douglas Gregor
17b76185f1
Re-revert the explicit template instantiation linkage patch. I am beginning to look incompetent
...
llvm-svn: 98425
2010-03-13 03:49:57 +00:00
Douglas Gregor
89cae0f224
Reinstate patch to turn explicit template instantiations into weak symbols
...
llvm-svn: 98424
2010-03-13 03:14:19 +00:00
Jeffrey Yasskin
f6442f80cb
Allow users to set CPPFLAGS and CXXFLAGS on the make command line.
...
Tested: make CPPFLAGS=-m64 CXXFLAGS=-m64 -j8 && (cd tools/clang;make test)
llvm-svn: 98399
2010-03-12 22:55:16 +00:00
Fariborz Jahanian
c6140734c5
Fix a rare corner case bug which exposed a serious block API generation
...
when initialized variable is a byref block variable and is referenced recursively
in the initializer (you guessed it, it is block implementation of
fibonacci number). Fix, on the other hand is trvial, by generating the
API for byref variable before API for its initializer. We will have this
test added to our internal test suite as a clang-style test is not possible
due to very convoluted IR sequence. Fixes radar 7745514.
llvm-svn: 98393
2010-03-12 21:40:43 +00:00
Devang Patel
a42d3ea60e
If main file name is empty then use "<unknown>".
...
llvm-svn: 98385
2010-03-12 21:04:27 +00:00
Anders Carlsson
5d3b901e48
More this adjustment simplification.
...
llvm-svn: 98333
2010-03-12 05:28:07 +00:00
Douglas Gregor
539bc40906
Revert the linkage change for explicit template instantiations; something is amiss
...
llvm-svn: 98332
2010-03-12 05:13:59 +00:00
Anders Carlsson
3c289673d6
Remove OldOffset.
...
llvm-svn: 98331
2010-03-12 05:02:01 +00:00
Anders Carlsson
2b2b8f1949
Remove debug output.
...
llvm-svn: 98330
2010-03-12 04:55:20 +00:00
Anders Carlsson
8a2402989d
Begin simplifying handling of thunks.
...
llvm-svn: 98329
2010-03-12 04:54:20 +00:00
Douglas Gregor
ee3f72299c
Give explicit template instantiations weak linkage (but don't defer
...
them). Fixes PR6578.
llvm-svn: 98328
2010-03-12 04:49:06 +00:00
Devang Patel
01bb5ce932
Keep track of Record context to ensure that record elements are properly nested in debug info.
...
llvm-svn: 98283
2010-03-11 20:01:48 +00:00
Chris Lattner
9723d6c699
fix PR6433, crash on va_arg of typedef.
...
llvm-svn: 98264
2010-03-11 18:19:55 +00:00
Anders Carlsson
dd819c981f
Use the new vtable layout code for computing virtual base offset offsets.
...
llvm-svn: 98257
2010-03-11 16:06:20 +00:00
Rafael Espindola
4d5c3d99e5
Correctly mangle address of member in template arguments. Fixes PR6460
...
llvm-svn: 98254
2010-03-11 14:07:00 +00:00
Anders Carlsson
4cbe83cccb
Rename getVirtualBaseOffsetIndex to getVirtualBaseOffsetOffset to reflect what it actually does.
...
llvm-svn: 98248
2010-03-11 07:15:17 +00:00
Anders Carlsson
e4424888e4
When possible, use the vbase offset offsets from the most derived class directly.
...
llvm-svn: 98247
2010-03-11 07:00:45 +00:00
Anders Carlsson
7f6b71e222
Keep track of, and dump, vbase offset offsets.
...
llvm-svn: 98245
2010-03-11 06:43:12 +00:00
Anders Carlsson
9f28dbc53a
Fix tests.
...
llvm-svn: 98242
2010-03-11 06:10:52 +00:00
Anders Carlsson
d5531e2d18
Run the new vtable builder for construction vtables as well now. Note that we still don't use the data it generates.
...
llvm-svn: 98239
2010-03-11 05:48:21 +00:00
John McCall
ea8d8bb718
Support PPC-32 DWARF EH intrinisics. Thanks to rdivacky for his assistance.
...
llvm-svn: 98206
2010-03-11 00:10:12 +00:00
Chris Lattner
4d94109903
set alignment on static locals properly, patch by Arnaud de Grandmaison!
...
llvm-svn: 98204
2010-03-10 23:59:59 +00:00
Anders Carlsson
423406f335
Fix calculation of whether a member function needs a thunk in construction vtables.
...
llvm-svn: 98191
2010-03-10 21:25:37 +00:00
Anders Carlsson
115b4756b5
We were mistakenly marking morally virtual bases as being uninteresting. Fix this.
...
llvm-svn: 98180
2010-03-10 19:39:11 +00:00
Anders Carlsson
703a08605f
Ignore non-interesting bases when emitting construction vtables.
...
llvm-svn: 98177
2010-03-10 19:15:26 +00:00
Anders Carlsson
804cf51dcf
Don't accidentally mark some functions in construction vtables as unused. Also land the test for a previous checkin, now that it's correct.
...
llvm-svn: 98139
2010-03-10 06:51:42 +00:00
John McCall
e78aac41de
Create a new InjectedClassNameType to represent bare-word references to the
...
injected class name of a class template or class template partial specialization.
This is a non-canonical type; the canonical type is still a template
specialization type. This becomes the TypeForDecl of the pattern declaration,
which cleans up some amount of code (and complicates some other parts, but
whatever).
Fixes PR6326 and probably a few others, primarily by re-establishing a few
invariants about TypeLoc sizes.
llvm-svn: 98134
2010-03-10 03:28:59 +00:00
Anders Carlsson
02b99d6b7c
When building construction vtables, we need to check if a primary virtual base is actually a primary virtual base in the layout class.
...
llvm-svn: 98131
2010-03-10 03:02:01 +00:00
Anders Carlsson
ca82a4fdba
Improve vcall offset handling in construction vtables. With this we layout the construction vtables from the ABI examples correctly.
...
llvm-svn: 98127
2010-03-10 02:33:41 +00:00
Rafael Espindola
e7113ca907
Delay codegen of vtables when handling implicit instantiations.
...
This fixes PR6474.
llvm-svn: 98123
2010-03-10 02:19:29 +00:00
Devang Patel
05c37d2800
Use SmallString instead of alloca.
...
llvm-svn: 98112
2010-03-10 00:19:43 +00:00
Devang Patel
93f274c161
Fix file reference for derived and composite types. Now, dwarf writer uses strict verifier that ignores debug info for such types if their file info is unknown.
...
llvm-svn: 98096
2010-03-09 22:49:11 +00:00
Devang Patel
4f26205ba8
More then one anonymous aggregates on one line creates chaos when MDNode uniquness is combined with RAUW operation. Right solution is to avoid using RAUW.
...
This fixes PR 6554.
llvm-svn: 98083
2010-03-09 21:32:27 +00:00
Devang Patel
f2aa707895
Use getLast() instead of getBasename().
...
llvm-svn: 98072
2010-03-09 19:14:07 +00:00
Devang Patel
408dcf60aa
Start using DIFile. Corresponding llvm patch is r98020.
...
llvm-svn: 98021
2010-03-09 00:44:50 +00:00
Chris Lattner
e18aaf2c4b
add a codegen hack to work around an AST bug, allowing us to compile the
...
code in PR6537. This should be reverted when the ast bug is fixed.
llvm-svn: 97981
2010-03-08 21:08:07 +00:00
Devang Patel
d3cbaa1ddf
Avoid using DIDescriptor.isNull().
...
llvm-svn: 97976
2010-03-08 20:53:17 +00:00
Devang Patel
9cf2705a5d
Revert r97949.
...
llvm-svn: 97964
2010-03-08 19:20:58 +00:00
Devang Patel
4ce8ebb087
Avoid DIDescriptor.isNull() checks.
...
llvm-svn: 97949
2010-03-08 18:26:57 +00:00
Douglas Gregor
de4827dd34
Extend ObjCMessageExpr for class method sends with the source location
...
of the class name.
llvm-svn: 97943
2010-03-08 16:40:19 +00:00
Douglas Gregor
c934bc840c
Perform overload resolution when static_cast'ing from a
...
pointer-to-member-to-derived to a pointer-to-member-to-base. Fixes
PR6072.
llvm-svn: 97923
2010-03-07 23:24:59 +00:00
Douglas Gregor
577cf97cf3
Don't turn off mangling in implicitly extern "C" system headers. GCC
...
doesn't do this on any of the major platforms, and we don't really
support any of the platforms that do (nor will we actually handle
those headers well). Fixes PR6217; see PR6530 for details on what we
would need to do to support these platforms.
llvm-svn: 97899
2010-03-07 05:10:40 +00:00
Benjamin Kramer
f0a0f68c79
Add a message to these asserts.
...
llvm-svn: 97873
2010-03-06 09:07:19 +00:00
Rafael Espindola
d51c9b9a9f
Use static method in GlobalValue
...
llvm-svn: 97872
2010-03-06 07:35:18 +00:00
Eli Friedman
99d20f83ba
PR6515: Implement __builtin_signbit and friends.
...
I'm reasonably sure my implementation is correct, but it would be nice if
someone could double-check.
llvm-svn: 97864
2010-03-06 02:17:52 +00:00
John McCall
beec5a080f
Implement __builtin_dwarf_sp_column for i386 (Darwin and not), x86-64 (all),
...
and ARM. Implement __builtin_init_dwarf_reg_size_table for i386 (both) and
x86-64 (all).
llvm-svn: 97859
2010-03-06 00:35:14 +00:00
Blaine Garst
f27ab71d9f
add support for a 1<<29 bit in the block flags field to mark blocks using alternate struct return ABI
...
llvm-svn: 97775
2010-03-05 01:29:59 +00:00
Rafael Espindola
4c489c7030
Don't produce an alias for a destructor if the target is weak.
...
This fixes bootstrap on ELF systems :-)
llvm-svn: 97773
2010-03-05 01:21:10 +00:00
Rafael Espindola
bef98689ad
really fix 6473 by handling weakref in constant expressions.
...
llvm-svn: 97750
2010-03-04 21:26:03 +00:00
Rafael Espindola
2e42fec3a0
Fix PR6473.
...
Clang's support for weakref is now better than llvm-gcc's :-)
We don't introduce a new symbol and we correctly mark undefined references weak only if there is no
definition or regular undefined references in the same file.
llvm-svn: 97733
2010-03-04 18:17:24 +00:00
John McCall
731be6620c
Revert changes r97693, r97700, and r97718.
...
Our testing framework can't deal with disabled targets yet.
llvm-svn: 97719
2010-03-04 04:29:44 +00:00
Fariborz Jahanian
9eba9dfb0c
Refactor local class name mangling and make it
...
ABI conforming.
llvm-svn: 97702
2010-03-04 01:02:03 +00:00
John McCall
81d4d12504
Implement __builtin_dwarf_sp_column().
...
llvm-svn: 97700
2010-03-04 00:44:01 +00:00
John McCall
6abe39c61e
Create a TargetMachine whenever we create a CodeGenAction. The codegen of
...
some builtins will rely on target knowledge.
llvm-svn: 97693
2010-03-04 00:23:29 +00:00
Fariborz Jahanian
281aae6328
Fix code gen bug generating code for
...
((id)cat)->isa. Fixes radar 7709015.
llvm-svn: 97672
2010-03-03 22:09:47 +00:00
Chris Lattner
576def7fbe
fix PR6475, we were doing side-effecting stuff in an assert.
...
llvm-svn: 97669
2010-03-03 21:52:23 +00:00
Fariborz Jahanian
a529c25555
Implements mangling of local class names to
...
fix a code gen crash. This is WIP as not
all ABI cases are covered (there is a FIXME to
this effect). Fixes radar 7696748.
llvm-svn: 97658
2010-03-03 19:41:08 +00:00
Chris Lattner
5cc15e058b
add framework for ARM builtins, Patch by Edmund Grimley Evans!
...
llvm-svn: 97656
2010-03-03 19:03:45 +00:00
John McCall
515c3c548c
Sketch out an implementation for __builtin_dwarf_cfa. I have no idea
...
why the front-end is calculating the argument to llvm.eh.dwarf.cfa().
llvm-svn: 97653
2010-03-03 10:30:05 +00:00
John McCall
66769f8544
Implement __builtin_eh_return.
...
llvm-svn: 97643
2010-03-03 05:38:58 +00:00
Anders Carlsson
5b0057c05b
Fix a bug with base offset merging that Devang noticed.
...
llvm-svn: 97641
2010-03-03 04:58:02 +00:00
John McCall
d4f4b7f5ee
Add proper target hooks for __builtin_extract_return_address and
...
__builtin_frob_return_address. The implementations for both are
still trivial in the default case.
llvm-svn: 97638
2010-03-03 04:15:11 +00:00
John McCall
1950a11939
Don't emit derived-to-base destructor aliases if we don't have a definition
...
for the base destructor, because aliases to declarations aren't legal.
Fixes PR 6471.
llvm-svn: 97637
2010-03-03 03:40:11 +00:00
Rafael Espindola
70e040d552
During codegen assert that any copy assignment, destructor or constructor that
...
we need to synthesize has been marked as used by Sema.
Change Sema to avoid these asserts.
llvm-svn: 97589
2010-03-02 21:28:26 +00:00
Anders Carlsson
93b1b49082
Simplify code.
...
llvm-svn: 97551
2010-03-02 05:40:45 +00:00
John McCall
b6cc2c0439
Inspired by seeing "MIPS" go by in the commits, I've gone ahead and
...
implemented a (codegen) target hook for __builtin_extend_pointer.
I'm also making it return a uint64_t instead of an unsigned word; this
comports with typical usage (i.e. the one use I know of).
I don't know if any of the existing targets requires this hook to be
set (other than x86 and x86_64, which I know do not).
llvm-svn: 97547
2010-03-02 03:50:12 +00:00
Anders Carlsson
6f1f002651
Rename BaseOffset to Offset and make it signed in preparation of more construction vtable work.
...
llvm-svn: 97546
2010-03-02 03:44:06 +00:00
John McCall
4b613fae35
After much consultation aimed at figuring out what this builtin actually
...
does, document the results and then implement __builtin_extend_pointer for
platforms where it's a no-op.
llvm-svn: 97540
2010-03-02 02:31:24 +00:00
John McCall
bd8d9bd39c
Split out types that are non-canonical unless dependent as their own
...
category. Use this in a few places to eliminate unnecessary TST cases and
do some future-proofing. Provide terrible manglings for typeof. Mangle
decltype with some hope of accuracy.
Our manglings for some of the cases covered in the testcase are different
from gcc's, which I've raised as an issue with the ABI list.
llvm-svn: 97523
2010-03-01 23:49:17 +00:00
John McCall
de9607bc6f
The latest draft uses 'dt' to mangle member expressions, and now so do we.
...
llvm-svn: 97479
2010-03-01 19:12:25 +00:00
Douglas Gregor
a51c67424e
Improve name mangling for dependently-scoped declaration references.
...
llvm-svn: 97422
2010-02-28 22:05:49 +00:00
Douglas Gregor
5610db6923
Add name mangling for DeclRefExprs that refer to external names
...
llvm-svn: 97418
2010-02-28 21:40:32 +00:00
Anders Carlsson
5b79c31471
Remove debug output.
...
llvm-svn: 97407
2010-02-28 18:39:30 +00:00
Anders Carlsson
7162ab947b
Handle unused functions in construction vtables correctly.
...
llvm-svn: 97406
2010-02-28 18:37:33 +00:00
Anders Carlsson
8b37bb7c48
When laying out vtables for virtual bases in construction vtables, we need to check if the vtable is a primary base in the layout class.
...
llvm-svn: 97402
2010-02-28 18:08:38 +00:00
Anders Carlsson
e3385f566b
More improvements to construction vtables; we know handle vbase offsets correctly (I hope).
...
llvm-svn: 97361
2010-02-28 01:43:58 +00:00
Anders Carlsson
62c6c72bab
Pass information about whether a base is virtual or not down to getCtorVtable, we need this information in the vtable builder.
...
llvm-svn: 97356
2010-02-28 00:36:23 +00:00
Anders Carlsson
31f595f5ef
Add new function.
...
llvm-svn: 97353
2010-02-28 00:10:58 +00:00
Anders Carlsson
f98b47d3b9
Fix to dumpLayout; we want to be able to dump address points even if the vtable doesn't have any methods.
...
llvm-svn: 97350
2010-02-27 23:58:01 +00:00
Anders Carlsson
c3f92a16f2
Add a simple construction vtable test.
...
llvm-svn: 97344
2010-02-27 21:09:00 +00:00
Anders Carlsson
9391375d95
Start fleshing out construction vtable support.
...
llvm-svn: 97342
2010-02-27 20:39:05 +00:00
Anders Carlsson
603d7d1910
Enable the new vtable layout code for vtables that aren't construction vtables. (This doesn't mean that we emit LLVM IR using it yet, it just means that it's running and hopefully not crashing or asserting).
...
llvm-svn: 97341
2010-02-27 20:02:53 +00:00
Anders Carlsson
9f19aaaa3a
Move ComputeThisAdjustmentBaseOffset to VtableBuilder.
...
llvm-svn: 97340
2010-02-27 19:57:44 +00:00
Anders Carlsson
b26c2abac7
Make sure to insert the primary base in the set :)
...
llvm-svn: 97339
2010-02-27 19:51:04 +00:00
Anders Carlsson
e02a926a1c
Use the real base offset when calculating vbase offsets.
...
llvm-svn: 97338
2010-02-27 19:21:58 +00:00
Anders Carlsson
4d0729a7cc
Figured out why the test was failing, this will hopefully fix it.
...
llvm-svn: 97336
2010-02-27 19:00:53 +00:00
Anders Carlsson
2b381bbb5c
Don't add this adjustments for pure virtual member functions.
...
llvm-svn: 97334
2010-02-27 18:16:50 +00:00
Anders Carlsson
01d3c7da60
We want to store method info for unused functions.
...
llvm-svn: 97333
2010-02-27 18:09:40 +00:00
Anders Carlsson
4068798cbc
Finish up the changes to this adjustments.
...
llvm-svn: 97328
2010-02-27 16:52:49 +00:00
Anders Carlsson
d46ed89d79
Stub out more of the 'this' pointer adjustment fixes I've been planning. Start using a set vector for primary bases so they will be ordered.
...
llvm-svn: 97326
2010-02-27 16:18:19 +00:00
Anders Carlsson
d2025417ef
Fix another vtable layout bug; we weren't looking hard enough for overriden functions when determining if an overrider will ever be used.
...
llvm-svn: 97306
2010-02-27 06:38:03 +00:00
Anders Carlsson
d69b2f93ea
Handle vcall offset sharing between destructors.
...
llvm-svn: 97304
2010-02-27 04:12:52 +00:00
Anders Carlsson
b08aaa3e10
Fix a bug where we were generating an unnecessary vtable for a virtual base that's already a primary virtual base.
...
llvm-svn: 97303
2010-02-27 04:05:52 +00:00
John McCall
43c6ffbeec
Sundry fixes to the new vtable builder.
...
llvm-svn: 97258
2010-02-26 20:22:44 +00:00
David Chisnall
36c6320d78
Don't generate method metadata for @dynamic properties. Fixes PR6354.
...
llvm-svn: 97199
2010-02-26 01:11:38 +00:00
John McCall
2da83a3a38
Use the power of types to track down another canonicalization bug in
...
the ABI-computation interface. Fixes <rdar://problem/7691046>.
llvm-svn: 97197
2010-02-26 00:48:12 +00:00
Anders Carlsson
9e3b3a3bbe
Improve vcall offset handling.
...
llvm-svn: 97174
2010-02-25 22:23:13 +00:00
Anders Carlsson
ed7d0e8be8
Fux a bug where we were trying to add overriders for non-virtual bases of virtual bases more than once.
...
llvm-svn: 97173
2010-02-25 22:18:35 +00:00
Sanjiv Gupta
9ac3092d34
Targets (like pic16) may have mangled the name of global variables,
...
so get the name from Var rather than the original decl.
llvm-svn: 97114
2010-02-25 05:20:44 +00:00
Anders Carlsson
01bbef516e
Remove dead code.
...
llvm-svn: 97109
2010-02-25 03:57:50 +00:00
Anders Carlsson
422f778ba1
Move the vcall and vbase offset layout code out into its own class.
...
llvm-svn: 97107
2010-02-25 03:45:56 +00:00
Anders Carlsson
3c1ec97a28
Get rid of 'this' adjustments from the FinalOverriders class since they can be different for the same overrider in different parts of the vtable.
...
llvm-svn: 97068
2010-02-24 22:32:18 +00:00
Anders Carlsson
d8d698da60
Improve this adjustment pointer calculation.
...
llvm-svn: 97067
2010-02-24 22:27:12 +00:00