Commit Graph

1304 Commits

Author SHA1 Message Date
Rafael Espindola 70107f989c Propagate __attribute__((returns_twice)) from C to IL.
llvm-svn: 141002
2011-10-03 14:59:42 +00:00
John McCall 9cb88ec8d1 I had meant to locally revert this test.
llvm-svn: 140243
2011-09-21 08:34:49 +00:00
John McCall cbc038a6c3 ANSI C requires that a call to an unprototyped function type succeed
if the definition has a non-variadic prototype with compatible
parameters.  Therefore, the default rule for such calls must be to
use a non-variadic convention.  Achieve this by casting the callee to
the function type with which it is required to be compatible, unless
the target specifically opts out and insists that unprototyped calls
should use the variadic rules.  The only case of that I'm aware of is
the x86-64 convention, which passes arguments the same way in both
cases but also sets a small amount of extra information;  here we seek
to maintain compatibility with GCC, which does set this when calling
an unprototyped function.

Addresses PR10810 and PR10713.

llvm-svn: 140241
2011-09-21 08:08:30 +00:00
Eli Friedman 6b9c41ea68 Add list initialization for complex numbers in C. Essentially, this allows "_Complex float x = {1.0f, 2.0f};". See changes to docs/LanguageExtensions.html for a longer description.
<rdar://problem/9397672>.

llvm-svn: 140090
2011-09-19 23:17:44 +00:00
Bill Wendling f0724e8e06 Throw the switch to convert clang to the new exception handling model!
This model uses the 'landingpad' instruction, which is pinned to the top of the
landing pad. (A landing pad is defined as the destination of the unwind branch
of an invoke instruction.) All of the information needed to generate the correct
exception handling metadata during code generation is encoded into the
landingpad instruction.

The new 'resume' instruction takes the place of the llvm.eh.resume intrinsic
call. It's lowered in much the same way as the intrinsic is.

llvm-svn: 140049
2011-09-19 20:31:14 +00:00
NAKAMURA Takumi 3f62af76b9 test/CodeGen/sse-builtins.c: Make this host-independent to unbreak posix-unlike hosts.
Without -ffreestanding, clang tries to seek /usr/include/stdlib.h in host filesystem, even on Windows hosts.

llvm-svn: 139899
2011-09-16 03:55:36 +00:00
Eli Friedman 9bb51adcce Tweak *mmintrin.h so that they don't make any bad assumptions about alignment (which probably has little effect in practice, but better to get it right). Make the load in _mm_loadh_pi and _mm_loadl_pi a single LLVM IR instruction to make optimizing easier for CodeGen.
rdar://10054986

llvm-svn: 139874
2011-09-15 23:15:27 +00:00
Eli Friedman 84d2812111 Re-commit r139643.
Make clang use Acquire loads and Release stores where necessary.

llvm-svn: 139650
2011-09-13 22:21:56 +00:00
Eli Friedman acca089617 Revert r139643 while I look into it; it's breaking selfhost.
llvm-svn: 139648
2011-09-13 22:08:16 +00:00
Eli Friedman f92b2e0714 Make clang use Acquire loads and Release stores where necessary.
llvm-svn: 139643
2011-09-13 21:31:32 +00:00
Julien Lerouge d25ed06c63 Make this test portable on Win32.
llvm-svn: 139464
2011-09-10 05:46:15 +00:00
John McCall 5dc5c1ea47 Missed a %local use; hopefully this clears this test up.
llvm-svn: 139462
2011-09-10 05:31:57 +00:00
Eli Friedman 5c917278fd clang part of r139458; un-XFAIL testcase.
llvm-svn: 139460
2011-09-10 02:03:28 +00:00
Richard Trieu c41773ab6a Revision 139454 fixed a broken assert in LLVM, which causes
a test failure in CodeGen/palignr.c, which has been marked
XFAIL for the time being.  A bug has been filed at PR10901
for this issue.

llvm-svn: 139457
2011-09-10 01:56:32 +00:00
John McCall e5e7e6bc84 Make this test not depend on unnecessary details and IR variable names.
llvm-svn: 139455
2011-09-10 01:37:23 +00:00
Julien Lerouge 5a6b6987dc Bring llvm.annotation* intrinsics support back to where it was in llvm-gcc: can
annotate global, local variables, struct fields, or arbitrary statements (using
the __builtin_annotation), rdar://8037476.

llvm-svn: 139423
2011-09-09 22:41:49 +00:00
Eric Christopher 65c5c9132f Carry the debug information from single exit unified return block
along with the new insert point.

Fixes PR10829

llvm-svn: 139416
2011-09-09 21:53:04 +00:00
John McCall 7959fee258 Treat the weak export of block runtime symbols as a deployment-target
feature akin to the ARC runtime checks.  Removes a terrible hack where
IR gen needed to find the declarations of those symbols in the translation
unit.

llvm-svn: 139404
2011-09-09 20:41:01 +00:00
Jakob Stoklund Olesen ed2a360fd1 The frexp, modf, and remquo builtins are not 'const'.
These functions return a second value by writing to a pointer argument,
so they cannot be marked 'readnone' which implies that they don't access
memory.

<rdar://problem/10070234>

llvm-svn: 139319
2011-09-08 21:18:03 +00:00
Eli Friedman ce3e2c85b1 Make sure the FunctionDecl's created by "#pragma weak" have correct ParmVarDecl's. PR10878.
llvm-svn: 139224
2011-09-07 04:05:06 +00:00
Eli Friedman e9f8113ec4 Switch clang over to using fence/atomicrmw/cmpxchg instead of the intrinsics (which will go away). LLVM CodeGen does almost exactly the same thing with these and the old intrinsics, so I'm reasonably confident this will not break anything.
There are still a few issues which need to be resolved with code generation for atomic load and store, so I'm not converting the places which need those for now.

I'm not entirely sure what to do about __builtin_llvm_memory_barrier: the fence instruction doesn't expose all the possibilities which can be expressed by __builtin_llvm_memory_barrier.  I would appreciate hearing from anyone who is using this intrinsic.

llvm-svn: 139216
2011-09-07 01:41:24 +00:00
Fariborz Jahanian 4efb6b35f6 Revise test and see if it passes with a release-built clang.
llvm-svn: 139043
2011-09-02 21:47:51 +00:00
Fariborz Jahanian 2bb8270e6f blocks: Support capturing complex variable in block.
// rdar://10033896

llvm-svn: 139041
2011-09-02 21:33:44 +00:00
Fariborz Jahanian b74711df52 revert patch in r139020
llvm-svn: 139029
2011-09-02 20:03:16 +00:00
Fariborz Jahanian f30bc00103 blocks: Support capturing complex variable in block.
// rdar://10033896

llvm-svn: 139020
2011-09-02 18:39:40 +00:00
John McCall a5efa7386a Track whether an AggValueSlot is potentially aliased, and do not
emit call results into potentially aliased slots.  This allows us
to properly mark indirect return slots as noalias, at the cost
of requiring an extra memcpy when assigning an aggregate call
result into a l-value.  It also brings us into compliance with
the x86-64 ABI.

llvm-svn: 138599
2011-08-25 23:04:34 +00:00
Bruno Cardoso Lopes fbb8b84f5f Add testcase for r138411
llvm-svn: 138422
2011-08-24 01:35:04 +00:00
Eric Christopher b58b3e879d Make constant aggregate constant initializers private linkage.
After talking with John making this the case for all of these is
the right way to go.

Fixes rdar://9804564 and PR10414

llvm-svn: 138418
2011-08-24 00:33:55 +00:00
Fariborz Jahanian b50801f049 block IRgen - Fixes a crash when determining if given block variable
is captured by a given statement expression. // rdar://10001085

llvm-svn: 138314
2011-08-23 00:27:49 +00:00
Eli Friedman c55efe4fb2 Make sure we don't inline functions marked with __attribute__((naked)). <rdar://problem/9973228>
llvm-svn: 138310
2011-08-22 23:55:33 +00:00
Devang Patel 2de80d601a Add new test.
Remove one outdated test.

llvm-svn: 138144
2011-08-19 23:26:54 +00:00
Devang Patel 0e3a9f645b Robustify test, there is no need to check metadata number which can change.
llvm-svn: 137752
2011-08-16 21:01:06 +00:00
Eric Christopher bf005ecd9c 'pure' and 'const' functions should also be marked nounwind. Migrate
test over from llvm/test/FrontendC++ and update others to account for
the change.

llvm-svn: 137669
2011-08-15 22:38:22 +00:00
Eli Friedman 729ed799c7 Update clang tests for r137527.
llvm-svn: 137535
2011-08-12 23:33:52 +00:00
Craig Topper 6d64a738fa Add tests for string literal concatenation.
llvm-svn: 137302
2011-08-11 05:57:09 +00:00
Craig Topper 54edccafc5 Add support for C++0x raw string literals.
llvm-svn: 137298
2011-08-11 04:06:15 +00:00
Chad Rosier e1a6a0e05c Add support for using anonymous bitfields (e.g., int : 0) to enforce alignment.
This fixes cases where the anonymous bitfield is followed by a bitfield member.
E.g.,
struct t4
{
 char foo;
 long : 0;
 char bar : 1;
};

rdar://9859156

llvm-svn: 136991
2011-08-05 22:38:04 +00:00
Matt Beaumont-Gay b0244cf0a4 Output to /dev/null, not "0"
llvm-svn: 136955
2011-08-05 01:05:35 +00:00
Chad Rosier 2c23b27fc7 Formatting.
llvm-svn: 136924
2011-08-04 21:26:30 +00:00
Chad Rosier 18903ee2d3 Add partial support for using anonymous bitfields (e.g., int : 0) to enforce
alignment.  This fixes cases where the anonymous bitfield is followed by a 
non-bitfield member.  E.g.,

struct t4
{
  int foo : 1;
  long : 0;
  char bar;
};

Part of rdar://9859156

llvm-svn: 136858
2011-08-04 01:21:14 +00:00
John McCall 9b24df470d Emit wide string literals with the appropriate alignment.
Patch by Craig Topper and Sundeep!

llvm-svn: 136856
2011-08-04 01:03:22 +00:00
Chad Rosier 6088393248 For APCS the alignment of bitfield types is *not* respected when laying out
structures.  Alignment can be enforced with the use of anonymous bitfields 
(e.g., int :0), but this is not currently supported.  Add this test case to 
document the current state, which will hopefully be fixed shortly. 

llvm-svn: 136848
2011-08-04 00:19:13 +00:00
Chandler Carruth db4c563121 Delete one of the old tests that was ported over to Clang. The test is
designed to be executed, and its output inspected for correct values,
but we aren't executing it. We're just compiling it, and dumping it to
/dev/null. It also isn't freestanding. If there is a desire to have this
test actually stick around, complain and I'll revert this and try to add
the file checks necessary to make this actually test things.

llvm-svn: 136846
2011-08-03 23:53:42 +00:00
Bob Wilson e826a2a56b Handle "homogeneous aggregates" as required by the ARM AAPCS-VFP ABI.
A homogeneous aggregate is an aggregate data structure where after flattening
any nesting there are 1 to 4 elements of the same base type that is either a
float, double, or Neon vector.  All Neon vectors of the same size, either 64
or 128 bits, are treated as equivalent for this purpose.  When using the
AAPCS-VFP ABI, check for homogeneous aggregates and pass them as arguments by
expanding them into a sequence of their base types.  This requires extending
the existing support for expanded arguments to handle not only structs, but
also constant arrays and complex types.

llvm-svn: 136767
2011-08-03 05:58:22 +00:00
John McCall 625ed88f07 When rewriting a call to a K&R function to lead to a well-prototyped
function, be sure to drop parameter attributes when dropping their
associated arguments.  Patch by Aaron Landwehr!

llvm-svn: 136753
2011-08-03 00:43:55 +00:00
Rafael Espindola 11d994b769 Implements alignment for long long and double types in va_arg on ARM AAPCS.
Patch by Jim (Ningjie) Chen.

llvm-svn: 136734
2011-08-02 22:33:37 +00:00
Eric Christopher b081ba651c Add support for the 'Q' arm memory constraint.
Fixes rdar://9866494

llvm-svn: 136524
2011-07-29 21:20:35 +00:00
Douglas Gregor 5e6fcb108f This patch makes the string/character literal tests run in C,
C++98/03, and C++0x mode, from Craig Topper!

llvm-svn: 136443
2011-07-29 01:08:54 +00:00
Peter Collingbourne 05500ba6ec Fix assertion failure in CodeGen where the input operand to an asm
instruction is tied to an output operand which is a pointer, and
the input operand is narrower than the output operand.

llvm-svn: 136438
2011-07-29 00:24:50 +00:00
NAKAMURA Takumi 9b249eecca test/CodeGen/2004-03-16-AsmRegisterCrash.c: XTARGET should accept the part of triplet. ("x86" is not the part of triplet)
llvm-svn: 136346
2011-07-28 11:25:02 +00:00