Commit Graph

2172 Commits

Author SHA1 Message Date
Chris Lattner
9071dd3a57 check that terminators only occur at the end of a block. This catches the
common problem of putting two terminators in the same block.  I can't write
a testcase for this because the .ll parser rejects this before the verifier
can, but this can occur when generating IR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46900 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-09 01:06:01 +00:00
Dan Gohman
b3f5cfc670 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46836 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 02:30:40 +00:00
Devang Patel
1cf47cb217 Add comment explaining what is lower level analysis pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46658 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-02 01:43:30 +00:00
Gordon Henriksen
e62a8a353c Fixing a bug creating floating point constants of type other
than double through the C bindings. Thanks to Tomas Lindquist
Olsen for reporting it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46656 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-02 01:07:50 +00:00
Dan Gohman
97cf759b82 Fix 80-col violations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46510 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 12:09:55 +00:00
Dan Gohman
1327f69d98 Add explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46506 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 11:36:12 +00:00
Nick Lewycky
4189a538e4 Handle some more combinations of extend and icmp. Fixes PR1940.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46431 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-28 03:48:02 +00:00
Chris Lattner
de6fa5f25f Add hasByValAttr() and hasNoAliasAttr() methods to the Argument class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46314 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-24 17:47:11 +00:00
Duncan Sands
03531a4816 It turns out that in C++ it is legal to declare functions
that return an opaque type by value, as long as you don't
call it or provide a body (you can take the address of it).
So it is wrong to insist that sret parameters not be an
opaque*.  And I guess it is really up to codegen to complain
if someone tries to call such a function.  I'm also removing
the analogous check from byval parameters, since I don't
see why we shouldn't allow them as long as no-one tries to
call the function or give it a body.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46216 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-21 21:37:41 +00:00
Duncan Sands
333e8be5e8 Check that sret is only used on pointers to types
with a size, like byval.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46207 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-21 11:28:49 +00:00
Duncan Sands
53d4afcee9 Be consistent with other attribute methods, and
check the callee also if it is known.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46206 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-21 11:27:55 +00:00
Chris Lattner
163974de47 improve compatibility with mingw, patch by Alain Frisch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46026 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 22:50:50 +00:00
Bill Wendling
585e64e63e Reformatted. It was confusing the other way. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46009 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 21:16:32 +00:00
Duncan Sands
15ea48c9ce Simplify CallInst::hasByValArgument using a new method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45974 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 19:57:00 +00:00
Duncan Sands
b0c9b93bb4 I noticed that the trampoline straightening transformation could
drop attributes on varargs call arguments.  Also, it could generate
invalid IR if the transformed call already had the 'nest' attribute
somewhere (this can never happen for code coming from llvm-gcc,
but it's a theoretical possibility).  Fix both problems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45973 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 19:52:09 +00:00
Evan Cheng
42725e7251 Simplify code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45950 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 02:38:45 +00:00
Duncan Sands
421d1c93cc Allow the byval attribute for pointers to any type with
a size, not just structs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45938 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-13 21:19:12 +00:00
Evan Cheng
f4a5498ab4 Add hasByValArgument() to test if a call instruction has byval argument(s).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45913 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-12 18:57:32 +00:00
Duncan Sands
cfad1b4f78 Be more liberal in what parameter attributes are
allowed on the vararg arguments of a call.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45909 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-12 16:42:01 +00:00
Duncan Sands
623a389f62 Do not allow attributes beyond a function's last
parameter, even if it is a varargs function.  Do
allow attributes on the varargs part of a call,
but not beyond the last argument.  Only allow
selected attributes to be on the varargs part of
a call (currently only 'byval' is allowed).  The
reasoning here is that most attributes, eg inreg,
simply make no sense here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45887 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-11 22:36:48 +00:00
Evan Cheng
c37ab63df7 Allow parameter attributes on varargs function parameters.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45850 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-11 02:13:09 +00:00
Duncan Sands
6c3470efdc Small cleanup for handling of type/parameter attribute
incompatibility.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45704 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07 17:16:06 +00:00
Duncan Sands
ad9a9e1559 The transform that tries to turn calls to bitcast functions into
direct calls bails out unless caller and callee have essentially
equivalent parameter attributes.  This is illogical - the callee's
attributes should be of no relevance here.  Rework the logic, which
incidentally fixes a crash when removed arguments have attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45658 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-06 18:27:01 +00:00
Duncan Sands
a9d0c9dc58 When transforming a call to a bitcast function into
a direct call with cast parameters and cast return
value (if any), instcombine was prepared to cast any
non-void return value into any other, whether castable
or not.  Add a new predicate for testing whether casting
is valid, and check it both for the return value and
(as a cleanup) for the parameters.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45657 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-06 10:12:28 +00:00
Gordon Henriksen
23d9791ddd Trying that again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45529 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-03 03:32:33 +00:00
Gordon Henriksen
98232f5859 Fix a compile error on Windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45528 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-03 03:21:18 +00:00
Chris Lattner
50cffa0107 Remove the function attr cache for intrinsics. This does not maintain the
refcount on these correctly, and can end up referring to deleted 
attributes.  This fixes PR1881.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45525 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-03 01:20:12 +00:00
Chris Lattner
89e94bd00c Don't create a new ParamAttrsList (which copies the vector) just to
get a profile.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45524 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-03 00:29:27 +00:00
Chris Lattner
fabfde3ff0 move some code out of line, rearrange a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45519 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-03 00:10:22 +00:00
Chris Lattner
50ee9ddc8f Split param attr implementation out from Function.cpp into its
own file.  Don't #include ParameterAttributes.h into any major
public header files: just move methods out of line as appropriate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45517 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-02 23:42:30 +00:00
Chris Lattner
f897b7d305 remove blob of #if'd out code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45512 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-02 23:10:45 +00:00
Chris Lattner
5dfdc1c809 Fix a build issue on cygwin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45506 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-02 22:03:27 +00:00
Gordon Henriksen
ab477ccde9 Adding C bindings for SwitchInst::addCase.
Patch by Bryan O'Sullivan!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45481 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-01 05:50:53 +00:00
Gordon Henriksen
dc2c07a7cf Add some doxygen comments to llvm-c/Core.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45450 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-30 17:46:33 +00:00
Chris Lattner
4ee451de36 Remove attribution from file headers, per discussion on llvmdev.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:36:04 +00:00
Chris Lattner
fc643c5e88 remove attribution from lib Makefiles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45415 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:09:26 +00:00
Gordon Henriksen
a353ffa7e5 Adding bindings for target triple and data layout.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45369 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-27 20:13:47 +00:00
Gordon Henriksen
1d2e49cd84 Switch the bindings to use LLVMFoldingBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45367 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-27 18:25:59 +00:00
Gordon Henriksen
e1433f24cf Noting and enforcing that GC intrinsics are valid only within a
function with GC.

This will catch the error when the inliner inlines a function with
GC into a caller with no GC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45350 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-25 02:31:26 +00:00
Gordon Henriksen
27acd3a999 Adjusting verification of "llvm.gc*" intrinsic prototypes to match
LangRef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45349 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-25 02:02:10 +00:00
Duncan Sands
d9d70395d9 Get the verifier to check attributes on calls as well
as on functions.  Make it verify invokes and not just
ordinary calls.  As a (desired) side-effect, it is no
longer legal to have call attributes on arguments that
are being passed to the varargs part of a varargs
function (llvm-as drops them on the floor anyway).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45286 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-21 19:19:01 +00:00
Gordon Henriksen
da1435f86e Adding bindings for memory buffers and module providers. Switching
to exceptions rather than variants for error handling in Ocaml.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45226 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 22:30:40 +00:00
Duncan Sands
f0c3354d99 When inlining through an 'nounwind' call, mark inlined
calls 'nounwind'.  It is important for correct C++
exception handling that nounwind markings do not get
lost, so this transformation is actually needed for
correctness.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45218 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 21:13:37 +00:00
Chris Lattner
e395598c98 remove a dead annotation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45163 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 19:04:24 +00:00
Duncan Sands
2b0e8990ab Rename isNoReturn to doesNotReturn, and isNoUnwind to
doesNotThrow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45160 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 09:59:50 +00:00
Christopher Lamb
ef989a275c Don't forget to print address space qualifiers when printing out the type table! Thanks to Gordon Henriksen for pointing this out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45147 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 03:49:35 +00:00
Evan Cheng
a5cecd0a13 Remove int_x86_sse2_movl_dq. It's replaced with a string compare.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45140 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 01:04:25 +00:00
Evan Cheng
f9b83fcf95 Bring back int_x86_sse2_movl_dq intrinsic for backward compatibility. Make sure
it's auto-upgraded to a shufflevector instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45131 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 22:33:23 +00:00
Duncan Sands
fd7b326bea Make invokes of inline asm legal. Teach codegen
how to lower them (with no attempt made to be
efficient, since they should only occur for
unoptimized code).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45108 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 18:08:19 +00:00
Gordon Henriksen
57cebeec7b C and Ocaml bindings for address spaces, for that burgeoning market
for Ocaml-based compilers targeting embedded devices. :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45096 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 16:08:32 +00:00