Commit Graph

88197 Commits

Author SHA1 Message Date
John McCall 45d494785d Emit global destructors even if the destroyed object has no initializers or has
an initializer requiring temporary object disposal.

Fixes rdar:://problem/8246444.

llvm-svn: 109849
2010-07-30 04:56:58 +00:00
Chris Lattner 8a2f3c778e fix PR5179 and correctly fix PR5831 to not miscompile.
The X86-64 ABI code didn't handle the case when a struct
would get classified and turn up as "NoClass INTEGER" for
example.  This is perfectly possible when the first slot
is all padding (e.g. due to empty base classes).  In this
situation, the first 8-byte doesn't take a register at all,
only the second 8-byte does.

This fixes this by enhancing the x86-64 abi stuff to allow
and handle this case, reverts the broken fix for PR5831,
and enhances the target independent stuff to be able to 
handle an argument value in registers being accessed at an
offset from the memory value.

This is the last x86-64 calling convention related miscompile
that I'm aware of.

llvm-svn: 109848
2010-07-30 04:02:24 +00:00
Daniel Dunbar b8cba97cde There is no reason for this test to invoke 'llc'.
llvm-svn: 109847
2010-07-30 03:30:55 +00:00
Jim Grosbach d343166a0b Many Thumb2 instructions can reference the full ARM register set (i.e.,
have 4 bits per register in the operand encoding), but have undefined
behavior when the operand value is 13 or 15 (SP and PC, respectively).
The trivial coalescer in linear scan sometimes will merge a copy from
SP into a subsequent instruction which uses the copy, and if that
instruction cannot legally reference SP, we get bad code such as:
  mls r0,r9,r0,sp
instead of:
  mov r2, sp
  mls r0, r9, r0, r2

This patch adds a new register class for use by Thumb2 that excludes
the problematic registers (SP and PC) and is used instead of GPR
for those operands which cannot legally reference PC or SP. The
trivial coalescer explicitly requires that the register class
of the destination for the COPY instruction contain the source
register for the COPY to be considered for coalescing. This prevents
errant instructions like that above.

PR7499

llvm-svn: 109842
2010-07-30 02:41:01 +00:00
Ted Kremenek d5cd0f3fac Add test case for crash reported in <rdar://problem/8236270> (which has since been fixed in trunk).
llvm-svn: 109834
2010-07-30 01:10:48 +00:00
Ted Kremenek 28e1c9155e Don't print out ivars twice in Decl::print(). Fixes <rdar://problem/8253668>.
llvm-svn: 109833
2010-07-30 00:47:46 +00:00
Sebastian Redl 07a89a83d4 Make macro weirdness in chained PCH work. This required changing the way PCHReader and PCHWriter are initialized to correctly pick up all initializer. On the upside, this means that there is far less repetition in the dependent PCH now.
llvm-svn: 109823
2010-07-30 00:29:29 +00:00
Ted Kremenek 0c7476ad59 Add clang_isPODType() for querying if the CXType is POD. Implements <rdar://problem/8250669>.
llvm-svn: 109822
2010-07-30 00:14:11 +00:00
Gabor Greif 56c38bda40 remove a layer of cruft
llvm-svn: 109821
2010-07-29 23:35:00 +00:00
Eric Christopher 2e276485cb Fix this up per llvm-gcc r109819.
llvm-svn: 109820
2010-07-29 23:20:29 +00:00
Benjamin Kramer 2e357b62bb Supress valgrind errors from python.
llvm-svn: 109818
2010-07-29 23:15:04 +00:00
Daniel Dunbar cda4307308 Revert "Re-apply fixed version of 108749, correctly conditionalizing the new
sections on", this change uncovered a possible linker bug which resulted in the
wrong messages getting dispatched. Backing this out while we investigate...

llvm-svn: 109817
2010-07-29 22:57:21 +00:00
Daniel Dunbar 328913c17d CMake: Clang test targets depend on the {FileCheck,not,count} tools.
llvm-svn: 109816
2010-07-29 22:57:17 +00:00
Bob Wilson dbc3f3ff28 Remove the temporary hack, now that the llvm-i686-linux buildbot has
completed a successful build.

llvm-svn: 109815
2010-07-29 22:55:29 +00:00
Nate Begeman 1194bd2bd8 Wire up sema checking for __builtin_arm_usat and __builtin_arm_ssat immediates.
llvm-svn: 109814
2010-07-29 22:48:34 +00:00
Nate Begeman c4a96c0e8c Add builtins for ssat/usat, similar to RealView's __ssat and __usat intrinsics.
llvm-svn: 109813
2010-07-29 22:48:09 +00:00
Bob Wilson f2903999b3 Fix the temporary hack.
llvm-svn: 109810
2010-07-29 22:33:35 +00:00
Daniel Dunbar 79bd45ee1f Temporary hack to ensure stale Analysis dir is cleaned up on llvm-i686-linux.
llvm-svn: 109809
2010-07-29 22:18:50 +00:00
Douglas Gregor b607393ac8 Teach isIncompleteType() to look through sugar when it is dealing with
Objective-C object and interface types. This is part of PR7741.

llvm-svn: 109808
2010-07-29 22:17:04 +00:00
Chris Lattner 1f3a063f00 move the last hunk of getCoerceResult into the place
that needs it and remove getCoerceResult.

llvm-svn: 109807
2010-07-29 21:42:50 +00:00
Johnny Chen b9e7c0aef6 Add a test case to test that lldb command "command source" works correctly.
llvm-svn: 109806
2010-07-29 21:42:28 +00:00
Chris Lattner 60fbd7744f now that direct and coerce are merged, getCoerceResult gets simpler.
llvm-svn: 109805
2010-07-29 21:29:53 +00:00
Chris Lattner 09794695ef now that GetSSETypeAtOffset handles passing SSE class values as
float, the special case hack in getCoerceResult can go away.

llvm-svn: 109804
2010-07-29 21:22:50 +00:00
Johnny Chen c0599ea1e7 Removed redundant import statement.
llvm-svn: 109803
2010-07-29 20:49:07 +00:00
Greg Clayton 76a5cce6c0 Removed pending TODOs after resolving them with help of the clang folks and the discussion list.
llvm-svn: 109802
2010-07-29 20:38:50 +00:00
Benjamin Kramer d9624e2d2e Remove XFAIL, test doesn't leak anymore.
llvm-svn: 109801
2010-07-29 20:36:36 +00:00
Bob Wilson 728eb292eb Refactor ARM-specific DAG combining in preparation for adding some more
transformations.

llvm-svn: 109800
2010-07-29 20:34:14 +00:00
Dale Johannesen 2bff50546c Implement vector constants which are splat of
integers with mov + vdup.  8003375.  This is
currently disabled by default because LICM will
not hoist a VDUP, so it pessimizes the code if
the construct occurs inside a loop (8248029).

llvm-svn: 109799
2010-07-29 20:10:08 +00:00
Greg Clayton 2d5cdf0615 Added an objective C test case.
llvm-svn: 109798
2010-07-29 20:08:39 +00:00
Argyrios Kyrtzidis c904933aac Change the name to something less terrible; suggestion by Doug. No functionality change.
llvm-svn: 109797
2010-07-29 20:08:05 +00:00
Argyrios Kyrtzidis 6e03a7476f Weak references and variables that are not definitions are not required for early codegen/deserialization.
llvm-svn: 109796
2010-07-29 20:07:52 +00:00
Greg Clayton 5fb47cd535 Fixed "void *ClangASTContext::CreatePointerType (void *clang_type);" to return objective C pointers for clang::Type::TypeClass types that are "clang::Type::ObjCObject" and "clang::Type::ObjCInterface" .
llvm-svn: 109795
2010-07-29 20:06:32 +00:00
Johnny Chen 1bb9bc72b9 Fixed "warning: unused variable 'log'".
llvm-svn: 109794
2010-07-29 19:51:52 +00:00
Greg Clayton 4b4b5fcebc Fixed expression result printing to have the expression result type be in
parens and to have a space before the value.

Before:
(lldb) expr 3 + 1
int4

(lldb) expr 3 + 1
(int) 4

llvm-svn: 109793
2010-07-29 19:36:30 +00:00
Sean Callanan 4ed7c5b2f8 Fixed the expression code to use the right
code model with the JIT.

llvm-svn: 109792
2010-07-29 19:03:08 +00:00
Howard Hinnant a8e3da215c Make complex.h play nice with C
llvm-svn: 109791
2010-07-29 18:43:15 +00:00
Chris Lattner e556a71859 Implement the clang-side of detection for when to pass as
<2 x float> instead of double.  This works but can't be turned
on until I teach codegen to pass <2 x float> as one XMM register
instead of two.

llvm-svn: 109790
2010-07-29 18:39:32 +00:00
Bob Wilson a9bf1b1493 Don't assert on an unrecognized BrMiscFrm instruction.
PR7745.

llvm-svn: 109788
2010-07-29 18:29:28 +00:00
John McCall 9ad943ef28 Transcribe IRC to svn. Also don't print basic block names twice if they match.
llvm-svn: 109787
2010-07-29 18:20:13 +00:00
Chris Lattner 50a357e962 Look at me, I can count!
llvm-svn: 109786
2010-07-29 18:19:50 +00:00
Argyrios Kyrtzidis d67d4cc82f Implement PCH support for offsetof(base-specifier).
llvm-svn: 109785
2010-07-29 18:16:10 +00:00
Argyrios Kyrtzidis c81af03fb3 Merge PCHWriterDecl.cpp's isRequiredDecl and CodeGenModule::MayDeferGeneration into a new function,
DeclIsRequiredFunctionOrFileScopedVar.

This is essentially a CodeGen predicate that is also needed by the PCH mechanism to determine whether a decl
needs to be deserialized during PCH loading for codegen purposes.
Since this logic is shared by CodeGen and the PCH mechanism, move it to the ASTContext,
thus CodeGenModule's GetLinkageForFunction/GetLinkageForVariable and the GVALinkage enum is moved out of CodeGen.

This fixes current (and avoids future) codegen-from-PCH bugs.

llvm-svn: 109784
2010-07-29 18:15:58 +00:00
Chris Lattner 7f4b81af7a fix rdar://8251384, another case where we could access beyond the
end of a struct.  This improves the case when the struct being passed
contains 3 floats, either due to a struct or array of 3 things.  Before
we'd generate this IR for the testcase:

define float @bar(double %X.coerce0, double %X.coerce1) nounwind {
entry:
  %X = alloca %struct.foof, align 8               ; <%struct.foof*> [#uses=2]
  %0 = bitcast %struct.foof* %X to %1*            ; <%1*> [#uses=2]
  %1 = getelementptr %1* %0, i32 0, i32 0         ; <double*> [#uses=1]
  store double %X.coerce0, double* %1
  %2 = getelementptr %1* %0, i32 0, i32 1         ; <double*> [#uses=1]
  store double %X.coerce1, double* %2
  %tmp = getelementptr inbounds %struct.foof* %X, i32 0, i32 2 ; <float*> [#uses=1]
  %tmp1 = load float* %tmp                        ; <float> [#uses=1]
  ret float %tmp1
}

which compiled (with optimization) to:

_bar:                                   ## @bar
## BB#0:                                ## %entry
	movd	%xmm1, %rax
	movd	%eax, %xmm0
	ret

Now we produce:

define float @bar(double %X.coerce0, float %X.coerce1) nounwind {
entry:
  %X = alloca %struct.foof, align 8               ; <%struct.foof*> [#uses=2]
  %0 = bitcast %struct.foof* %X to %0*            ; <%0*> [#uses=2]
  %1 = getelementptr %0* %0, i32 0, i32 0         ; <double*> [#uses=1]
  store double %X.coerce0, double* %1
  %2 = getelementptr %0* %0, i32 0, i32 1         ; <float*> [#uses=1]
  store float %X.coerce1, float* %2
  %tmp = getelementptr inbounds %struct.foof* %X, i32 0, i32 2 ; <float*> [#uses=1]
  %tmp1 = load float* %tmp                        ; <float> [#uses=1]
  ret float %tmp1
}

and:

_bar:                                   ## @bar
## BB#0:                                ## %entry
	movaps	%xmm1, %xmm0
	ret

llvm-svn: 109776
2010-07-29 18:13:09 +00:00
Eric Christopher be2bb0d337 Grammar.
llvm-svn: 109775
2010-07-29 18:11:28 +00:00
John McCall 61483f0e1f Make the header self-contained and follow #include guidelines.
llvm-svn: 109774
2010-07-29 18:08:23 +00:00
Eli Friedman 0428a61e45 PR7750: !CExpr->isNullValue() only properly computes whether CExpr is nonnull
if CExpr is a ConstantInt.

llvm-svn: 109773
2010-07-29 18:03:33 +00:00
Owen Anderson b2c657c618 Make un-named values legible in certain vim configurations.
llvm-svn: 109772
2010-07-29 17:57:57 +00:00
Nate Begeman faededefd0 Add codegen support for ARM qadd & qsub intrinsics
llvm-svn: 109771
2010-07-29 17:57:17 +00:00
Nate Begeman 7010a71ac4 Add intrinsics __builtin_arm_qadd & __builtin_arm_qsub to allow access to the QADD & QSUB instructions.
Behave identically to __qadd & __qsub RealView instruction intrinsics.

llvm-svn: 109770
2010-07-29 17:56:55 +00:00
John McCall 58c5088d48 Switch to using the LLVM CommandLine library so that our help
message is properly contaminated with nonsense about timing passes
that doesn't apply at all to this utility. :)

llvm-svn: 109769
2010-07-29 17:55:00 +00:00