Commit Graph

68 Commits

Author SHA1 Message Date
Owen Anderson 1e5f00e7a7 This started as a small change, I swear. Unfortunately, lots of things call the [I|F]CmpInst constructors. Who knew!?
llvm-svn: 75200
2009-07-09 23:48:35 +00:00
Devang Patel daf15df944 Fix thinko.
llvm-svn: 75061
2009-07-08 22:25:56 +00:00
Devang Patel f04d63a398 Drop "constant" from
!0 = constant metadata !{...}

llvm-svn: 75057
2009-07-08 21:57:07 +00:00
Devang Patel d2541158da Support MDNode forward reference.
llvm-svn: 75031
2009-07-08 19:23:54 +00:00
Owen Anderson b17f32945f Switch GlobalVariable ctors to a sane API, where *either* a context or a module is required.
llvm-svn: 75025
2009-07-08 19:03:57 +00:00
Nick Lewycky a21d3daadc Remove the vicmp and vfcmp instructions. Because we never had a release with
these instructions, no autoupgrade or backwards compatibility support is
provided.

llvm-svn: 74991
2009-07-08 03:04:38 +00:00
Owen Anderson 5948fdf68b Push LLVMContext through GlobalVariables and IRBuilder.
llvm-svn: 74985
2009-07-08 01:26:06 +00:00
Chris Lattner 200e0757c7 switch the .ll parser to use SourceMgr.
llvm-svn: 74735
2009-07-02 23:08:13 +00:00
Owen Anderson ac7334c1cf Use LLVMContext for generating MDStrings too.
llvm-svn: 74710
2009-07-02 17:28:30 +00:00
Owen Anderson 29ec3e0e50 Use LLVMContext to generate metadata constants.
llvm-svn: 74708
2009-07-02 17:20:28 +00:00
Owen Anderson 09063cec4e Use LLVMContext for generating UndefValue constants too!
llvm-svn: 74703
2009-07-02 17:04:01 +00:00
Owen Anderson 02a9da33b3 Try again at converting the LLParser to use LLVMContext, without massive breakage this time.
llvm-svn: 74671
2009-07-01 23:57:11 +00:00
Bill Wendling 4534d2562b --- Reverse-merging (from foreign repository) r74648 into '.':
U    include/llvm/LLVMContext.h
U    lib/VMCore/LLVMContext.cpp
U    lib/AsmParser/LLParser.cpp
U    lib/AsmParser/LLParser.h

Temporarily reverting r74648. It was causing massive failures in release mode.

llvm-svn: 74653
2009-07-01 22:33:26 +00:00
Owen Anderson 7373c6bbd6 Convert LLParser to use LLVMContext for creating constants.
llvm-svn: 74648
2009-07-01 21:57:44 +00:00
Devang Patel 39e64d452a Support stand alone metadata syntax.
!0 = constant metadata !{i32 21, i32 22}
@llvm.blah = constant metadata !{i32 1000, i16 200, metadata !0}

llvm-svn: 74630
2009-07-01 19:21:12 +00:00
Chris Lattner 96122debc1 improve the APIs for creating struct and function types with no arguments/elements
to not have to create a temporary vector (in the API at least).  Patch by Jay Foad!

llvm-svn: 74584
2009-07-01 04:13:31 +00:00
Anton Korobeynikov a8fd40b50a Address review comments: add 3 ARM calling conventions.
Dispatch C calling conv. to one of these conventions based on
target triple and subtarget features.

llvm-svn: 73530
2009-06-16 18:50:49 +00:00
Dan Gohman 0b5d042562 Fix a typo in a diagnostic.
llvm-svn: 73429
2009-06-15 21:52:11 +00:00
Dan Gohman 4fe64deb7b Fix old-style type names in comments.
llvm-svn: 73362
2009-06-14 23:30:43 +00:00
Nick Lewycky 0aa6a74a79 Create FunctionType::isValidArgumentType to go along with isValidReturnType.
Also create isValidElementType for ArrayType, PointerType, StructType and
VectorType.

Make LLParser use them. This closes up some holes like an assertion failure on:

  %x = type {label}

but largely doesn't change any semantics. The only thing we accept now which
we didn't before is vectors of opaque type such as "<4 x opaque>". The opaque
can be resolved to an int or float when linking.

llvm-svn: 73016
2009-06-07 07:26:46 +00:00
Nick Lewycky 8b165afabe Refuse metadata* type for function arguments.
llvm-svn: 73010
2009-06-07 01:45:11 +00:00
Devang Patel d1c7d34924 Add new function attribute - noimplicitfloat
Update code generator to use this attribute and remove NoImplicitFloat target option.
Update llc to set this attribute when -no-implicit-float command line option is used.

llvm-svn: 72959
2009-06-05 21:57:13 +00:00
Dan Gohman a5b9645c4b Split the Add, Sub, and Mul instruction opcodes into separate
integer and floating-point opcodes, introducing
FAdd, FSub, and FMul.

For now, the AsmParser, BitcodeReader, and IRBuilder all preserve
backwards compatability, and the Core LLVM APIs preserve backwards
compatibility for IR producers. Most front-ends won't need to change
immediately.

This implements the first step of the plan outlined here:
http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt

llvm-svn: 72897
2009-06-04 22:49:04 +00:00
Devang Patel 72a4d2fec1 Add new function attribute - noredzone.
Update code generator to use this attribute and remove DisableRedZone target option.
Update llc to set this attribute when -disable-red-zone command line option is used.

llvm-svn: 72894
2009-06-04 22:05:33 +00:00
Jay Foad 7d0479f2c2 Use v.data() instead of &v[0] when SmallVector v might be empty.
llvm-svn: 72210
2009-05-21 09:52:38 +00:00
Nick Lewycky b8f9b7a965 Make MDNode use CallbackVH. Also change MDNode to store Value* instead of
Constant* in preperation of a future change to support holding non-Constants
in an MDNode.

llvm-svn: 71407
2009-05-10 20:57:05 +00:00
Chris Lattner 4c73d7a9b8 testcase and asmparser fix for PR4066
llvm-svn: 70080
2009-04-25 21:26:00 +00:00
Nick Lewycky 8019af6b2c Fix warning in .ll parser, detect and reject available_externally on function
declarations.

llvm-svn: 68944
2009-04-13 07:02:02 +00:00
Chris Lattner 184f1be4a8 Add a new "available_externally" linkage type. This is intended
to support C99 inline, GNU extern inline, etc.  Related bugzilla's
include PR3517, PR3100, & PR2933.  Nothing uses this yet, but it
appears to work.

llvm-svn: 68940
2009-04-13 05:44:34 +00:00
Nick Lewycky 49f891958f Add support for embedded metadata to LLVM. This introduces two new types of
Constant, MDString and MDNode which can only be used by globals with a name
that starts with "llvm." or as arguments to a function with the same naming
restriction.

llvm-svn: 68420
2009-04-04 07:22:01 +00:00
Chris Lattner 56a95f6c16 Fix a bug in our autoupgrade support: in an argument list to a function
call, we should treat "i64 zext" as the start of a constant expr, but
"i64 0 zext" as an argument with an obsolete attribute on it (this form
is already tested by test/Assembler/2007-07-30-AutoUpgradeZextSext.ll).

Make the autoupgrade logic more discerning to avoid treating "i64 zext"
as an old-style attribute, causing us to reject a valid constant expr.
This fixes PR3876.

llvm-svn: 67682
2009-03-25 06:36:36 +00:00
Duncan Sands 4581bebf2a It makes no sense to have a ODR version of common
linkage, so remove it.

llvm-svn: 66690
2009-03-11 20:14:15 +00:00
Duncan Sands e2881053c9 Remove the one-definition-rule version of extern_weak
linkage: this linkage type only applies to declarations,
but ODR is only relevant to globals with definitions.

llvm-svn: 66650
2009-03-11 08:08:06 +00:00
Chris Lattner f880ca2a31 Fix two classes of bugs. First:
validate an invariant so that the asmparser rejects a bad construct
instead of the verifier.  Before:

llvm-as: assembly parsed, but does not verify as correct!
Invalid struct return type!
i64 (%struct.Type*, %struct.Type*)* @foo

after:

llvm-as: t.ll:5:8: functions with 'sret' argument must return void
define i64 @foo(%struct.Type* noalias nocapture sret %agg.result, %struct.Type* nocapture byval %t) nounwind {
       ^


Second, check that void is only used where allowed (in function return types) not in
arbitrary places, fixing PR3747 - Crash in llvm-as with void field in struct.  We
now reject that example with:

$ llvm-as t.ll
llvm-as: t.ll:1:12: struct element can not have void type
%x = type {void}
           ^

llvm-svn: 66394
2009-03-09 04:49:14 +00:00
Duncan Sands 12da8ce3d2 Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr.  These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global.  In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time.   This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function.  If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body.  The
code generators on the other hand map weak and weak_odr linkage
to the same thing.

llvm-svn: 66339
2009-03-07 15:45:40 +00:00
Chris Lattner 89d856e9e0 Fix a pretty awesome bug that only happened in a strange case with anonymous
types.  This was reading the uint for the keyword after the token was advanced.

llvm-svn: 65743
2009-03-01 00:53:13 +00:00
Chris Lattner bb1fe8abdd reject 0 element vectors with:
@a = internal constant void bitcast(<0 x i8> <> to void)
                                     ^

Fixes PR3685

llvm-svn: 65698
2009-02-28 18:12:41 +00:00
Chris Lattner 778c62ccb5 add proper asmwriter and asmparser support for anonymous functions.
llvm-svn: 64953
2009-02-18 21:48:13 +00:00
Duncan Sands d1de45a146 Pacify gcc-4.3 (thinks IsConstant may be used
uninitialized).

llvm-svn: 64220
2009-02-10 16:24:55 +00:00
Dan Gohman 9280a685db Use slightly more correct grammar in error messages.
llvm-svn: 64148
2009-02-09 17:41:21 +00:00
Chris Lattner c9e1b48449 fix typo
llvm-svn: 64091
2009-02-08 20:00:15 +00:00
Chris Lattner 412f626b96 reject void pointers with a nice error:
llvm-as: t.ll:2:15: pointers to void are invalid, use i8* instead
%X = type void*
              ^

instead of asserting and dying.

llvm-svn: 64089
2009-02-08 19:56:22 +00:00
Dale Johannesen b842d529a3 Reapply 63765. Patches for clang and llvm-gcc to follow.
llvm-svn: 63812
2009-02-05 01:49:45 +00:00
Dale Johannesen ae616c2c61 Reverting 63765. This broke the build of both clang
and llvm-gcc.

llvm-svn: 63786
2009-02-04 22:47:25 +00:00
Nate Begeman 6ae3aa83d0 New feature: add support for target intrinsics being defined in the
target directories themselves.  This also means that VMCore no longer
needs to know about every target's list of intrinsics.  Future work
will include converting the PowerPC target to this interface as an
example implementation.

llvm-svn: 63765
2009-02-04 19:47:21 +00:00
Chris Lattner 1f386b8ec8 Fix PR3372
llvm-svn: 63501
2009-02-02 07:24:28 +00:00
Rafael Espindola 6de96a1b5d Add the private linkage.
llvm-svn: 62279
2009-01-15 20:18:42 +00:00
Chris Lattner 8c1cc34d6a one more crash from PR3281, we now diagnose:
llvm-as: t.ll:2:39: function may not return opaque type
  %"bwmoyl" = tail call coldcc opaque @g()
                                      ^
llvm-svn: 61933
2009-01-08 19:05:36 +00:00
Chris Lattner 1c8dd9be79 fix wordo
llvm-svn: 61728
2009-01-05 18:56:52 +00:00
Steve Naroff f6bbfa3424 Remove redundant ValID::ValID:: scoping (doesn't compile on Windows).
llvm-svn: 61727
2009-01-05 18:48:47 +00:00