Commit Graph

233 Commits

Author SHA1 Message Date
Gordon Henriksen a2f3e13cf4 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.

llvm-svn: 42051
2007-09-17 20:30:04 +00:00
David Greene c656cbb8c2 Update GEP constructors to use an iterator interface to fix
GLIBCXX_DEBUG issues.

llvm-svn: 41697
2007-09-04 15:46:09 +00:00
Chris Lattner 45ffa21cb3 use a nicer accessor.
llvm-svn: 41165
2007-08-18 06:13:19 +00:00
Dan Gohman 88ac781644 Fix the verification for overloaded intrinsic types. Check that they are
what they're supposed to be before using them.

llvm-svn: 41130
2007-08-16 22:06:45 +00:00
Dan Gohman febf946ea7 Add MVT::fAny for overloading intrinsics on floating-point types.
llvm-svn: 41128
2007-08-16 21:57:19 +00:00
Reid Spencer 446282ae3d Fix minor doxygen nits.
llvm-svn: 40854
2007-08-05 20:06:04 +00:00
Chandler Carruth 7132e00de7 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.

llvm-svn: 40807
2007-08-04 01:51:18 +00:00
Reid Spencer b6508349a7 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.

llvm-svn: 40632
2007-07-31 14:39:10 +00:00
Reid Spencer 160e4faedc 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

llvm-svn: 40618
2007-07-31 06:33:37 +00:00
Duncan Sands 5d49bcdce0 It seems logical that InReg should be incompatible
with StructReturn and ByVal, so make it so.

llvm-svn: 40554
2007-07-27 16:45:18 +00:00
Duncan Sands 07c9066238 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).

llvm-svn: 40553
2007-07-27 15:09:54 +00:00
Duncan Sands 644f917358 Support for trampolines, except for X86 codegen which is
still under discussion.

llvm-svn: 40549
2007-07-27 12:58:54 +00:00
Reid Spencer a2e618712d Make output match actual condition tested. Thanks, Duncan.
llvm-svn: 40464
2007-07-24 14:35:44 +00:00
Reid Spencer 0f8fd66a62 1. Make sure we print the Function Value for parameter attribute errors
2. Fold an if statement into the Assert1 macro call.

llvm-svn: 40455
2007-07-23 23:46:43 +00:00
Reid Spencer 6c2b393f0c 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.

llvm-svn: 40453
2007-07-23 23:09:55 +00:00
Rafael Espindola 6389ef9854 detect invalid combination of sret and byval
llvm-svn: 39971
2007-07-17 13:34:23 +00:00
Dan Gohman 06c60b6032 Fix comments about vectors to use the current wording.
llvm-svn: 39921
2007-07-16 14:29:03 +00:00
Rafael Espindola 9521a564fb check for correct usage of the byval attribute
llvm-svn: 38506
2007-07-10 19:28:12 +00:00
Rafael Espindola b567e3ffb0 Add the byval attribute
llvm-svn: 37940
2007-07-06 10:57:03 +00:00
Devang Patel c43f32b935 Use DominatorTree instead of ETForest.
llvm-svn: 37538
2007-06-11 15:40:48 +00:00
Zhou Sheng 0ae22e99c8 Add assert to check if the attributes ZExt/SExt, NoAlias are apply to the
correct type of parameters.

llvm-svn: 37486
2007-06-07 06:12:03 +00:00
Devang Patel 8c78a0bff0 Drop 'const'
llvm-svn: 36662
2007-05-03 01:11:54 +00:00
Devang Patel e95c6ad802 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.

llvm-svn: 36652
2007-05-02 21:39:20 +00:00
Devang Patel 09f162ca6a Do not use typeinfo to identify pass in pass manager.
llvm-svn: 36632
2007-05-01 21:15:47 +00:00
Anton Korobeynikov 546ea7ea88 Implement review feedback
llvm-svn: 36564
2007-04-29 18:02:48 +00:00
Anton Korobeynikov 7b2a2f9075 Let Verifier check aliasees
llvm-svn: 36540
2007-04-28 14:35:41 +00:00
Anton Korobeynikov b18f8f85e9 Implement review feedback. Aliasees can be either GlobalValue's or
bitcasts of them.

llvm-svn: 36537
2007-04-28 13:45:00 +00:00
Anton Korobeynikov a97b694c82 Implement aliases. This fixes PR1017 and it's dependent bugs. CFE part
will follow.

llvm-svn: 36435
2007-04-25 14:27:10 +00:00
Chris Lattner af332ee449 Fix regressions introduced by my previous patch: opt calls verifier in a
way that the "Mod" ivar was not getting set.

llvm-svn: 36291
2007-04-20 23:59:29 +00:00
Chris Lattner 4ff0452265 catch a case that was biting jeffc
llvm-svn: 36284
2007-04-20 21:48:08 +00:00
Chris Lattner da1ed8de79 eliminate a use of Instruction::getPrev(), patch by Gabor Greif in 2005.
llvm-svn: 36197
2007-04-17 17:36:12 +00:00
Reid Spencer c6251a7dfd For PR1284:
Implement the "part_set" intrinsic.

llvm-svn: 35938
2007-04-12 02:48:46 +00:00
Chris Lattner 0e772b7726 unbreak the build :(
llvm-svn: 35857
2007-04-10 03:18:19 +00:00
Jeff Cohen a8644a6534 Fix build problem.
llvm-svn: 35856
2007-04-10 03:10:46 +00:00
Reid Spencer cce90f55ed Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic.
llvm-svn: 35678
2007-04-04 23:48:25 +00:00
Reid Spencer 7c57b88b27 For PR1297:
1. Clear up confusion between "GotBits" and "ExpectBits". GotBits is the
   type actually provided. ExpectedBits is the type expected for the
   intrinsics. Before this patch, it was reversed!
2. Implement checks for overloaded intrinsics. This involves computing the
   suffix expected and making sure the suffix matches the function name. It
   also includes some intrinsic-specific checks such as ensuring that the
   bswap parameter and result are the same width and an even number of bytes.

llvm-svn: 35540
2007-04-01 07:22:57 +00:00
Reid Spencer 09575bac2e For PR1195:
Change use of "packed" term to "vector" in comments, strings, variable
names, etc.

llvm-svn: 34300
2007-02-15 03:39:18 +00:00
Reid Spencer d84d35ba70 For PR1195:
Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.

llvm-svn: 34293
2007-02-15 02:26:10 +00:00
Chris Lattner 32ab643df7 Switch ValueSymbolTable to use StringMap<Value*> instead of std::map<std::string, Value*>
as its main datastructure.  There are many improvements yet to be made, but
this speeds up opt --std-compile-opts on 447.dealII by 7.3%.

llvm-svn: 34193
2007-02-12 05:18:08 +00:00
Chris Lattner 59a8d2c30f convert some vectors to smallvector.
llvm-svn: 34145
2007-02-10 08:33:11 +00:00
Chris Lattner 84d82c7e98 speed up the verifier 8.5% by using a smallvector instead of vector.
llvm-svn: 34144
2007-02-10 08:30:29 +00:00
Chris Lattner bc97cc29e7 Change an std::set to a SmallPtrSet. This speeds up the verifier on
447.dealII from 1.27s to 0.86s.

llvm-svn: 34143
2007-02-10 08:19:44 +00:00
Jim Laskey 5aed30d5cf Support var arg intrinsics.
llvm-svn: 33962
2007-02-06 18:02:54 +00:00
Reid Spencer 3aaaa0b2bd For PR411:
This patch replaces the SymbolTable class with ValueSymbolTable which does
not support types planes. This means that all symbol names in LLVM must now
be unique. The patch addresses the necessary changes to deal with this and
removes code no longer needed as a result. This completes the bulk of the
changes for this PR. Some cleanup patches will follow.

llvm-svn: 33918
2007-02-05 20:47:22 +00:00
Reid Spencer 2341c22ec7 Changes to support making the shift instructions be true BinaryOperators.
This feature is needed in order to support shifts of more than 255 bits
on large integer types.  This changes the syntax for llvm assembly to
make shl, ashr and lshr instructions look like a binary operator:
   shl i32 %X, 1
instead of
   shl i32 %X, i8 1
Additionally, this should help a few passes perform additional optimizations.

llvm-svn: 33776
2007-02-02 02:16:23 +00:00
Reid Spencer 5301e7c605 For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types.

llvm-svn: 33663
2007-01-30 20:08:39 +00:00
Anton Korobeynikov 037c867b54 Propagate changes from my local tree. This patch includes:
1. New parameter attribute called 'inreg'. It has meaning "place this
parameter in registers, if possible". This is some generalization of
gcc's regparm(n) attribute. It's currently used only in X86-32 backend.
2. Completely rewritten CC handling/lowering code inside X86 backend.
Merged stdcall + c CCs and fastcall + fast CC.
3. Dropped CSRET CC. We cannot add struct return variant for each
target-specific CC (e.g. stdcall + csretcc and so on).
4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in
on first attribute has meaning 'This is hidden pointer to structure
return. Handle it gently'.
5. Fixed small bug in llvm-extract + add new feature to
FunctionExtraction pass, which relinks all internal-linkaged callees
from deleted function to external linkage. This will allow further
linking everything together.

NOTEs: 1. Documentation will be updated soon.
       2. llvm-upgrade should be improved to translate csret => sret.
          Before this, there will be some unexpected test fails.
llvm-svn: 33597
2007-01-28 13:31:35 +00:00
Chris Lattner 03c4953cdd rename Type::isIntegral to Type::isInteger, eliminating the old Type::isInteger.
rename Type::getIntegralTypeMask to Type::getIntegerTypeMask.

This makes naming much more consistent.  For example, there are now no longer any
instances of IntegerType that are not considered isInteger! :)

llvm-svn: 33225
2007-01-15 02:27:26 +00:00
Chris Lattner 57eedaca52 teach VMCore to accept i1 add's and shifts
llvm-svn: 33223
2007-01-15 02:05:34 +00:00
Reid Spencer 7a9c62baa6 For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.

This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
   bits in an integer. The Type classes SubclassData field is used to
   store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
   64-bit integers. These are replaced with just IntegerType which is not
   a primitive any more.
3. Adjust the rest of LLVM to account for this change.

Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types.  Future increments
will rectify this situation.

llvm-svn: 33113
2007-01-12 07:05:14 +00:00