Commit Graph

299 Commits

Author SHA1 Message Date
Dan Gohman
7dc1def162 Re-apply 52002, allowing the verifier to accept non-MRV struct return
types on functions, with adjustments so that it accepts both
new-style aggregate returns and old-style MRV returns, including those
with only a single member.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52157 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 21:26:13 +00:00
Duncan Sands
83ec4b6711 Wrap MVT::ValueType in a struct to get type safety
and better control the abstraction.  Rename the type
to MVT.  To update out-of-tree patches, the main
thing to do is to rename MVT::ValueType to MVT, and
rewrite expressions like MVT::getSizeInBits(VT) in
the form VT.getSizeInBits().  Use VT.getSimpleVT()
to extract a MVT::SimpleValueType for use in switch
statements (you will get an assert failure if VT is
an extended value type - these shouldn't exist after
type legalization).
This results in a small speedup of codegen and no
new testsuite failures (x86-64 linux).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52044 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 12:08:01 +00:00
Dan Gohman
836bfcd689 Revert 52002.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52030 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 23:57:06 +00:00
Matthijs Kooijman
411e6a5efb Change the Verifier to support returning first class aggregrates.
Add a testcase for functions returning first class aggregrates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52002 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 14:00:36 +00:00
Dan Gohman
041e2eb517 IR support for extractvalue and insertvalue instructions. Also, begin
moving toward making structs and arrays first-class types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51157 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-15 19:50:34 +00:00
Dan Gohman
4d9dd6beae Make PreVerifyID, IntSigsEnd, and KillSigsEnd const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51088 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-14 00:42:30 +00:00
Dan Gohman
6ddba2b933 Change class' public PassInfo variables to by initialized with the
address of the PassInfo directly instead of calling getPassInfo.
This eliminates a bunch of dynamic initializations of static data.

Also, fold RegisterPassBase into PassInfo, make a bunch of its
data members const, and rearrange some code to initialize data
members in constructors instead of using setter member functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51022 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 02:05:11 +00:00
Dan Gohman
844731a7f1 Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 00:00:25 +00:00
Anton Korobeynikov
018f771398 Check for validity of aliasee pointer before dereference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50878 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-08 23:11:06 +00:00
Anton Korobeynikov
0b12ecf6ff Turn StripPointerCast() into a method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50836 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 22:54:15 +00:00
Anton Korobeynikov
b04adddd50 Make StripPointerCast a common function (should we mak it method of Value instead?)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50775 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 22:52:30 +00:00
Nick Lewycky
280a6e607d Remove 'unwinds to' support from mainline. This patch undoes r47802 r47989
r48047 r48084 r48085 r48086 r48088 r48096 r48099 r48109 and r48123.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50265 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 16:53:59 +00:00
Chris Lattner
80b8f5dd6b tighten up verifier checks which missed cases where
return instrs operands didn't match up with function results.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50182 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 20:33:41 +00:00
Chris Lattner
42369b7e4b Verify that the operand of a getresult instruction is a
call/invoke or undef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50129 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 04:06:15 +00:00
Duncan Sands
79ab3e8014 Make sure that intrinsics automagically get the
right parameter attributes no matter how they
are obtained.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49335 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 13:39:11 +00:00
Nick Lewycky
0c78ac11dd Update example to new syntax.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48910 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-28 06:46:51 +00:00
Dan Gohman
950a4c40b8 Add explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48801 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 22:06:05 +00:00
Anton Korobeynikov
4a0a001e15 Fix merge error
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48687 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 08:50:08 +00:00
Anton Korobeynikov
ef30c1d006 Add testcase for prev. commit. Minor fixes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48686 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 08:37:05 +00:00
Anton Korobeynikov
726d45c548 Aliasing chains cleanups: update langref, add check into verifier
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48685 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 08:36:14 +00:00
Chris Lattner
58d74910c6 Reimplement the parameter attributes support, phase #1. hilights:
1. There is now a "PAListPtr" class, which is a smart pointer around
   the underlying uniqued parameter attribute list object, and manages
   its refcount.  It is now impossible to mess up the refcount.
2. PAListPtr is now the main interface to the underlying object, and
   the underlying object is now completely opaque.
3. Implementation details like SmallVector and FoldingSet are now no
   longer part of the interface.
4. You can create a PAListPtr with an arbitrary sequence of
   ParamAttrsWithIndex's, no need to make a SmallVector of a specific 
   size (you can just use an array or scalar or vector if you wish).
5. All the client code that had to check for a null pointer before
   dereferencing the pointer is simplified to just access the 
   PAListPtr directly.
6. The interfaces for adding attrs to a list and removing them is a
   bit simpler.

Phase #2 will rename some stuff (e.g. PAListPtr) and do other less 
invasive changes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48289 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 17:45:29 +00:00
Devang Patel
45e99e4f29 Check struct return type first.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47922 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 00:27:05 +00:00
Devang Patel
41e2397b72 s/isReturnStruct()/hasStructRetAttr()/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47857 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-03 21:46:28 +00:00
Devang Patel
d15d5e3bbe If a function uses multive values in ret instruction then it
is returning a struct value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47848 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-03 18:58:16 +00:00
Chris Lattner
ab3b77834c Fix PR2113 by verifying allocations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47792 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-01 09:01:57 +00:00
Devang Patel
8e50760dfe Add assert to check return type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47637 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 22:55:21 +00:00
Devang Patel
57ef4f46c1 To support multiple return values, now ret instruction supports multiple operands instead of one aggregate operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47508 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-23 00:35:18 +00:00
Dale Johannesen
22c3979fca Split ParameterAttributes.h, putting the complicated
stuff into ParamAttrsList.h.  Per feedback from
ParamAttrs changes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47504 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-22 22:17:59 +00:00
Devang Patel
6c94b70d6e Use isa<> instead of getTypeID() to check StructType.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47460 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 22:24:17 +00:00
Devang Patel
db71d63467 Let invoke return aggregate value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47425 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 02:14:01 +00:00
Devang Patel
bb4f8d4045 Let function call return aggregate.
Now, we have very first multiple return value testcase!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47424 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-21 01:54:02 +00:00
Devang Patel
93f9d57bcd What if functions can return aggregate values ?
One small step towards multiple return value support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47406 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 22:36:03 +00:00
Devang Patel
9fcde0fa13 Verifier should use Assert1 instead of assert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47394 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 19:32:20 +00:00
Devang Patel
85eab709ca Use isValidOperands() to verify GetResultInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47387 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 18:36:46 +00:00
Devang Patel
40a04216da Add GetResultInst. First step for multiple return value support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47348 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 22:15:16 +00:00
Dale Johannesen
0d51e7ec0d Expand ParameterAttributes to 32 bits (in preparation
for adding alignment info, not there yet).  Clean up
interfaces to reference ParameterAttributes consistently.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47342 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 21:38:47 +00:00
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
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
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
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
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
Christopher Lamb
43ad6b3e0d Change the PointerType api for creating pointer types. The old functionality of PointerType::get() has become PointerType::getUnqual(), which returns a pointer in the generic address space. The new prototype of PointerType::get() requires both a type and an address space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45082 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 01:12:55 +00:00
Christopher Lamb
303dae993a Make it clear in the LangRef that allocation instructions only operated on the generic address space. Implement support in the verifier for ensuring this is true.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45080 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 01:00:21 +00:00
Duncan Sands
a8b974648f Check that there are not more attributes than
function parameters.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44452 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 15:52:20 +00:00