Commit Graph

284 Commits

Author SHA1 Message Date
Nick Lewycky f88c84f690 Update example to new syntax.
llvm-svn: 48910
2008-03-28 06:46:51 +00:00
Dan Gohman c60c67fc37 Add explicit keywords.
llvm-svn: 48801
2008-03-25 22:06:05 +00:00
Anton Korobeynikov dd8c695746 Fix merge error
llvm-svn: 48687
2008-03-22 08:50:08 +00:00
Anton Korobeynikov 3f7fab913d Add testcase for prev. commit. Minor fixes
llvm-svn: 48686
2008-03-22 08:37:05 +00:00
Anton Korobeynikov 25b2e8203a Aliasing chains cleanups: update langref, add check into verifier
llvm-svn: 48685
2008-03-22 08:36:14 +00:00
Chris Lattner 8a923e7c28 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.

llvm-svn: 48289
2008-03-12 17:45:29 +00:00
Devang Patel b3ca38c1d5 Check struct return type first.
llvm-svn: 47922
2008-03-05 00:27:05 +00:00
Devang Patel 9d91785987 s/isReturnStruct()/hasStructRetAttr()/g
llvm-svn: 47857
2008-03-03 21:46:28 +00:00
Devang Patel c6b56c79aa If a function uses multive values in ret instruction then it
is returning a struct value.

llvm-svn: 47848
2008-03-03 18:58:16 +00:00
Chris Lattner ffe0da0eb2 Fix PR2113 by verifying allocations.
llvm-svn: 47792
2008-03-01 09:01:57 +00:00
Devang Patel f287e7dcc6 Add assert to check return type.
llvm-svn: 47637
2008-02-26 22:55:21 +00:00
Devang Patel 59643e575f To support multiple return values, now ret instruction supports multiple operands instead of one aggregate operand.
llvm-svn: 47508
2008-02-23 00:35:18 +00:00
Dale Johannesen 09f410b6d7 Split ParameterAttributes.h, putting the complicated
stuff into ParamAttrsList.h.  Per feedback from
ParamAttrs changes.

llvm-svn: 47504
2008-02-22 22:17:59 +00:00
Devang Patel 9fea019759 Use isa<> instead of getTypeID() to check StructType.
llvm-svn: 47460
2008-02-21 22:24:17 +00:00
Devang Patel ad582fc34b Let invoke return aggregate value.
llvm-svn: 47425
2008-02-21 02:14:01 +00:00
Devang Patel 1f00b535e1 Let function call return aggregate.
Now, we have very first multiple return value testcase!

llvm-svn: 47424
2008-02-21 01:54:02 +00:00
Devang Patel 616f0e02be What if functions can return aggregate values ?
One small step towards multiple return value support.

llvm-svn: 47406
2008-02-20 22:36:03 +00:00
Devang Patel 6b30fd310d Verifier should use Assert1 instead of assert.
llvm-svn: 47394
2008-02-20 19:32:20 +00:00
Devang Patel 3ef1b793c1 Use isValidOperands() to verify GetResultInst.
llvm-svn: 47387
2008-02-20 18:36:46 +00:00
Devang Patel 295711f583 Add GetResultInst. First step for multiple return value support.
llvm-svn: 47348
2008-02-19 22:15:16 +00:00
Dale Johannesen 89268bc6e2 Expand ParameterAttributes to 32 bits (in preparation
for adding alignment info, not there yet).  Clean up
interfaces to reference ParameterAttributes consistently.

llvm-svn: 47342
2008-02-19 21:38:47 +00:00
Chris Lattner 7f5c2553c7 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.

llvm-svn: 46900
2008-02-09 01:06:01 +00:00
Duncan Sands 0009c44464 Be more liberal in what parameter attributes are
allowed on the vararg arguments of a call.

llvm-svn: 45909
2008-01-12 16:42:01 +00:00
Duncan Sands b99f44aa5e 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.

llvm-svn: 45887
2008-01-11 22:36:48 +00:00
Evan Cheng 4cc275c3fb Allow parameter attributes on varargs function parameters.
llvm-svn: 45850
2008-01-11 02:13:09 +00:00
Duncan Sands b18c30acec Small cleanup for handling of type/parameter attribute
incompatibility.

llvm-svn: 45704
2008-01-07 17:16:06 +00:00
Duncan Sands 404eb05247 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.

llvm-svn: 45658
2008-01-06 18:27:01 +00:00
Chris Lattner f3ebc3f3d2 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Gordon Henriksen fb56bde933 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.

llvm-svn: 45350
2007-12-25 02:31:26 +00:00
Gordon Henriksen 9157c499fc Adjusting verification of "llvm.gc*" intrinsic prototypes to match
LangRef.

llvm-svn: 45349
2007-12-25 02:02:10 +00:00
Duncan Sands 8c5822802e 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).

llvm-svn: 45286
2007-12-21 19:19:01 +00:00
Duncan Sands b5a79d0eaa 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).

llvm-svn: 45108
2007-12-17 18:08:19 +00:00
Christopher Lamb edf0788758 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.
llvm-svn: 45082
2007-12-17 01:12:55 +00:00
Christopher Lamb 55c6d4f22f 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.
llvm-svn: 45080
2007-12-17 01:00:21 +00:00
Duncan Sands 4e8c071612 Check that there are not more attributes than
function parameters.

llvm-svn: 44452
2007-11-30 15:52:20 +00:00
Duncan Sands ad0ea2d430 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.

llvm-svn: 44359
2007-11-27 13:23:08 +00:00
Duncan Sands 185eeac0f8 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.

llvm-svn: 44315
2007-11-25 14:10:56 +00:00
Duncan Sands a89a113a20 Rename the 'const' parameter attribute to 'readnone',
and the 'pure' parameter attribute to 'readonly'.
Names suggested by DannyB.

llvm-svn: 44273
2007-11-22 20:23:04 +00:00
Nate Begeman d4d45c268c Add support for vectors to int <-> float casts.
llvm-svn: 44204
2007-11-17 03:58:34 +00:00
Duncan Sands f171b35c8b I discover array_lengthof, thanks to gabor on #llvm.
llvm-svn: 44139
2007-11-14 21:58:02 +00:00
Duncan Sands 9e12a3f020 Simplify the attribute verification code.
llvm-svn: 44116
2007-11-14 14:02:11 +00:00
Anton Korobeynikov ea09c697d7 Add pure/const attributes. Documentation will follow.
llvm-svn: 44109
2007-11-14 09:52:30 +00:00
Duncan Sands e0e774b6fd 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.

llvm-svn: 43611
2007-11-01 10:50:26 +00:00
Chris Lattner dff7a3e919 remove verifier command line option: this should be part of the API, not
a command line optn.

llvm-svn: 43603
2007-11-01 04:43:13 +00:00
Owen Anderson fe41d79112 Now with less tabs!
llvm-svn: 43601
2007-11-01 03:54:23 +00:00
Owen Anderson 9396c39501 Add a preverifier pass to check that every basic block ends in a terminator, so that we don't segfault when verifying invalid code.
llvm-svn: 43578
2007-10-31 21:04:18 +00:00
Chris Lattner b6fc40e60f 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.

llvm-svn: 43431
2007-10-29 03:14:55 +00:00
Anton Korobeynikov 9dced3f9ae Add 'pedantic' mode to verifier rejecting syntactically valid, but 'bad' due to other reasons code
llvm-svn: 43424
2007-10-28 22:50:32 +00:00
Duncan Sands f72ff0c379 Check that the second parameter of init_trampoline
can be resolved to a function.  This is required
for codegen and used by instcombine.

llvm-svn: 42469
2007-09-29 16:25:54 +00:00
Chris Lattner d79f3d51b1 reject things like "declare internal @foo"
llvm-svn: 42140
2007-09-19 17:14:45 +00:00