Commit Graph

249 Commits

Author SHA1 Message Date
Duncan Sands
dc024674ff Fix PR1146: parameter attributes are longer part of
the function type, instead they belong to functions
and function calls.  This is an updated and slightly
corrected version of Reid Spencer's original patch.
The only known problem is that auto-upgrading of
bitcode files doesn't seem to work properly (see
test/Bitcode/AutoUpgradeIntrinsics.ll).  Hopefully
a bitcode guru (who might that be? :) ) will fix it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44359 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 13:23:08 +00:00
Duncan Sands
827cde1c83 Fix PR1816. If a bitcast of a function only exists because of a
trivial difference in function attributes, allow calls to it to
be converted to direct calls.  Based on a patch by Török Edwin.
While there, move the various lists of mutually incompatible
parameters etc out of the verifier and into ParameterAttributes.h.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44315 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-25 14:10:56 +00:00
Duncan Sands
ed4a2f1688 Rename the 'const' parameter attribute to 'readnone',
and the 'pure' parameter attribute to 'readonly'.
Names suggested by DannyB.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44273 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 20:23:04 +00:00
Nate Begeman
b348d18caf Add support for vectors to int <-> float casts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44204 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-17 03:58:34 +00:00
Duncan Sands
c455ebeb0c I discover array_lengthof, thanks to gabor on #llvm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44139 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-14 21:58:02 +00:00
Duncan Sands
0a4f91ea18 Simplify the attribute verification code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44116 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-14 14:02:11 +00:00
Anton Korobeynikov
0adb7b41e7 Add pure/const attributes. Documentation will follow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44109 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-14 09:52:30 +00:00
Duncan Sands
d0561900f3 Don't barf on empty basic blocks. Do not rely on assert
doing something - this needs to work for release builds
too.  I chose to just abort rather than following the
fancy logic of abortIfBroken, because (1) it is a pain
to do otherwise, and (2) nothing is going to work if the
module is this broken.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43611 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 10:50:26 +00:00
Chris Lattner
b5c91641b5 remove verifier command line option: this should be part of the API, not
a command line optn.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43603 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 04:43:13 +00:00
Owen Anderson
765d64501c Now with less tabs!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43601 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 03:54:23 +00:00
Owen Anderson
c570e33a61 Add a preverifier pass to check that every basic block ends in a terminator, so that we don't segfault when verifying invalid code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43578 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 21:04:18 +00:00
Chris Lattner
0569187653 I am not sure this is a good idea to be an option, but rename the option for
now.  It conflicts with clang's -pedantic flag.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43431 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-29 03:14:55 +00:00
Anton Korobeynikov
536c64b4d6 Add 'pedantic' mode to verifier rejecting syntactically valid, but 'bad' due to other reasons code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43424 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-28 22:50:32 +00:00
Duncan Sands
f51edadfe8 Check that the second parameter of init_trampoline
can be resolved to a function.  This is required
for codegen and used by instcombine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42469 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-29 16:25:54 +00:00
Chris Lattner
6693da003b reject things like "declare internal @foo"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42140 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-19 17:14:45 +00:00
Gordon Henriksen
b5085212b0 Incorporating review feedback for GC verifier patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42087 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 10:14:30 +00:00
Gordon Henriksen
8c33da5dc4 Fix for PR1633: Verifier doesn't fully verify GC intrinsics
LLVM now enforces the following prototypes for the write barriers:

<ty>* @llvm.gcread(<ty2>*, <ty>**)
void @llvm.gcwrite(<ty>*, <ty2>*, <ty>**)

And for @llvm.gcroot, the first stack slot is verified to be an alloca or a 
bitcast of an alloca.

Fixes test/CodeGen/Generic/GC/lower_gcroot.ll, which violated these.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42051 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 20:30:04 +00:00
David Greene
b8f74793b9 Update GEP constructors to use an iterator interface to fix
GLIBCXX_DEBUG issues.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41697 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-04 15:46:09 +00:00
Chris Lattner
453eed147a use a nicer accessor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41165 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-18 06:13:19 +00:00
Dan Gohman
fe5b4393d4 Fix the verification for overloaded intrinsic types. Check that they are
what they're supposed to be before using them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41130 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-16 22:06:45 +00:00
Dan Gohman
0fee3ff93e Add MVT::fAny for overloading intrinsics on floating-point types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41128 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-16 21:57:19 +00:00
Reid Spencer
181b6c9cb5 Fix minor doxygen nits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40854 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-05 20:06:04 +00:00
Chandler Carruth
6994040a95 This is the patch to provide clean intrinsic function overloading support in LLVM. It cleans up the intrinsic definitions and generally smooths the process for more complicated intrinsic writing. It will be used by the upcoming atomic intrinsics as well as vector and float intrinsics in the future.
This also changes the syntax for llvm.bswap, llvm.part.set, llvm.part.select, and llvm.ct* intrinsics. They are automatically upgraded by both the LLVM ASM reader and the bitcode reader. The test cases have been updated, with special tests added to ensure the automatic upgrading is supported.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40807 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 01:51:18 +00:00
Reid Spencer
e87f23377c After a discussion with Anton, it turns out that the InReg attribute is not
permitted on function results. So, revert the last patch to make it illegal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40632 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-31 14:39:10 +00:00
Reid Spencer
6e800fe6cb The InReg parameter attribute is valid on function results. The llvm-gcc-4.0
front end converts regparm attribute on the gcc function into InReg attribute 
on the llvm function. This fixes test/CFrontend/2002-07-30-SubrefSetAssertion.c


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40618 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-31 06:33:37 +00:00
Duncan Sands
9d3e79107d It seems logical that InReg should be incompatible
with StructReturn and ByVal, so make it so.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40554 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-27 16:45:18 +00:00
Duncan Sands
fdef00f1f7 As the number of parameter attributes increases,
Verifier::visitFunction is suffering a combinatorial
explosion due to the number of mutually incompatible
attributes.  This patch tidies the whole thing up
using attribute masks.  While there I fixed some
small bugs: (1) the ByVal attribute tests cast a
type to a pointer type, which can fail.  Yes, the
fact it is of a pointer type is checked before,
but a failing check does not cause the program
to exit, it continues on outputting further errors;
(2) Nothing was checking that an sret attribute is
on the first parameter; (3) nothing was checking that
a function for which isStructReturn() is true has a
parameter with the sret attribute and vice-versa (I
don't think it is possible for this to go wrong, but
it seems right to check it).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40553 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-27 15:09:54 +00:00
Duncan Sands
36397f5034 Support for trampolines, except for X86 codegen which is
still under discussion.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40549 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-27 12:58:54 +00:00
Reid Spencer
bb862c042f Make output match actual condition tested. Thanks, Duncan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40464 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-24 14:35:44 +00:00
Reid Spencer
d6b42b21eb 1. Make sure we print the Function Value for parameter attribute errors
2. Fold an if statement into the Assert1 macro call.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40455 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-23 23:46:43 +00:00
Reid Spencer
552d6405bf Add better verification of attributes on function types. It is not permitted
to use sret or inreg on the function. It is equally illegal to use noreturn
or nounwind on a parameter; they only go with the function. This patch
enforces these rules.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40453 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-23 23:09:55 +00:00
Rafael Espindola
969c44481b detect invalid combination of sret and byval
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39971 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-17 13:34:23 +00:00
Dan Gohman
07a96765da Fix comments about vectors to use the current wording.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39921 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 14:29:03 +00:00
Rafael Espindola
b91025b619 check for correct usage of the byval attribute
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38506 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-10 19:28:12 +00:00
Rafael Espindola
1aa7efbd2c Add the byval attribute
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37940 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-06 10:57:03 +00:00
Devang Patel
2099ff065d Use DominatorTree instead of ETForest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37538 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-11 15:40:48 +00:00
Zhou Sheng
5cbf316686 Add assert to check if the attributes ZExt/SExt, NoAlias are apply to the
correct type of parameters.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37486 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-07 06:12:03 +00:00
Devang Patel
1997473cf7 Drop 'const'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36662 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-03 01:11:54 +00:00
Devang Patel
3e15bf33e0 Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36652 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-02 21:39:20 +00:00
Devang Patel
794fd75c67 Do not use typeinfo to identify pass in pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-01 21:15:47 +00:00
Anton Korobeynikov
c6c98af9e5 Implement review feedback
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36564 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-29 18:02:48 +00:00
Anton Korobeynikov
0f53f7f240 Let Verifier check aliasees
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36540 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-28 14:35:41 +00:00
Anton Korobeynikov
a80e1181b7 Implement review feedback. Aliasees can be either GlobalValue's or
bitcasts of them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36537 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-28 13:45:00 +00:00
Anton Korobeynikov
8b0a8c84da Implement aliases. This fixes PR1017 and it's dependent bugs. CFE part
will follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36435 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-25 14:27:10 +00:00
Chris Lattner
cd070759c4 Fix regressions introduced by my previous patch: opt calls verifier in a
way that the "Mod" ivar was not getting set.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36291 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-20 23:59:29 +00:00
Chris Lattner
19b6dcdfa9 catch a case that was biting jeffc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36284 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-20 21:48:08 +00:00
Chris Lattner
4d8c16f15a eliminate a use of Instruction::getPrev(), patch by Gabor Greif in 2005.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36197 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-17 17:36:12 +00:00
Reid Spencer
f75b874957 For PR1284:
Implement the "part_set" intrinsic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35938 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-12 02:48:46 +00:00
Chris Lattner
466b9bd757 unbreak the build :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35857 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-10 03:18:19 +00:00
Jeff Cohen
a838321648 Fix build problem.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35856 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-10 03:10:46 +00:00