Commit Graph

248 Commits

Author SHA1 Message Date
Dan Gohman
872814ae04 Disallow null as a named metadata operand.
Make MDNode::destroy private.
Fix the one thing that used MDNode::destroy, outside of MDNode itself.

One should never delete or destroy an MDNode explicitly. MDNodes
implicitly go away when there are no references to them (implementation
details aside).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109028 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21 18:54:18 +00:00
Dan Gohman
9dc8ae110f Add support for empty named metadata too. This isn't particularly
useful, but it is nice for consistency.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108262 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 19:42:44 +00:00
Dan Gohman
ac80975ea4 Add support for empty metadata nodes: !{}.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108259 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 19:33:27 +00:00
Bill Wendling
5e721d7682 Implement the "linker_private_weak" linkage type. This will be used for
Objective-C metadata types which should be marked as "weak", but which the
linker will remove upon final linkage. However, this linkage isn't specific to
Objective-C.

For example, the "objc_msgSend_fixup_alloc" symbol is defined like this:

      .globl l_objc_msgSend_fixup_alloc
      .weak_definition l_objc_msgSend_fixup_alloc
      .section __DATA, __objc_msgrefs, coalesced
      .align 3
l_objc_msgSend_fixup_alloc:
       .quad   _objc_msgSend_fixup
       .quad   L_OBJC_METH_VAR_NAME_1

This is different from the "linker_private" linkage type, because it can't have
the metadata defined with ".weak_definition".

Currently only supported on Darwin platforms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107433 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01 21:55:59 +00:00
Chris Lattner
fd450c026a fix PR7105 by enumerating MDNodes on all @llvm.foo
function calls, not just recognized intrinsics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103428 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-10 20:53:17 +00:00
Chris Lattner
d7ba0f2ade add support for zero initialized unions, patch by Tim Northover!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99818 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-29 17:36:02 +00:00
Daniel Dunbar
ab7f10705a Revert r98666 too; it's checkin-without-testing day!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98673 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16 20:52:59 +00:00
Chris Lattner
7df6ecf767 temporarily xfail
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98666 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16 20:08:07 +00:00
Chris Lattner
fdfeb6976f Add support for a union type in LLVM IR. Patch by Talin!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96011 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 20:49:41 +00:00
Charles Davis
1e063d14df Add a new function attribute, 'alignstack'. It will indicate (when the backends
implement support for it) that the stack should be forcibly realigned in the
prologue (and the process reversed in the epilogue).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95945 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 00:31:15 +00:00
Chris Lattner
afab1df368 fix bogus test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93068 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-09 19:24:18 +00:00
Devang Patel
0386f01e06 Use separate namespace for named metadata.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92931 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 19:39:36 +00:00
Devang Patel
69d02e0a17 Allow null to be an element of NamedMDNode. e.g. !llvm.stuff = !{!0, !1, null}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92783 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 21:47:32 +00:00
Chris Lattner
50b136dae9 add bitcode reader support for blockaddress. We can now fully
round trip blockaddress through .ll and .bc files, so add a testcase.

There are still a bunch of places in the optimizer and other places
that need to be updated to work with these constructs, but at least
the basics are in now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85377 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 05:53:48 +00:00
Chris Lattner
ab21db79ef rename indbr -> indirectbr to appease the residents of #llvm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85351 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 00:19:10 +00:00
Chris Lattner
f9be95f867 add enough support for indirect branch for the feature test to pass
(assembler,asmprinter, bc reader+writer) and document it.  Codegen
currently aborts on it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85274 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 19:13:16 +00:00
Chris Lattner
7a034b1127 change of mind :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85258 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 17:40:49 +00:00
Chris Lattner
9357754d09 rename test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85256 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 17:40:19 +00:00
Chris Lattner
13435d9383 eliminate md_on_instruction.ll, md_on_instruction2.ll is a superset of it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84464 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-19 05:34:14 +00:00
Nick Lewycky
cc271861da Add new "memory use marker" intrinsics. These indicate lifetimes and invariant
sections of memory objects.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 07:03:23 +00:00
Devang Patel
0475c9170e Parse custom metadata attached with an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83033 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 00:01:14 +00:00
Devang Patel
e8e0213cc3 Write and read metadata attachments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 19:26:43 +00:00
Devang Patel
da795f82a8 A testcase!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82176 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-17 23:05:07 +00:00
Dan Gohman
f2f6ce65b7 Change tests from "opt %s" to "opt < %s" so that opt doesn't see the
input filename so that opt doesn't print the input filename in the
output so that grep lines in the tests don't unintentionally match
strings in the input filename.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81537 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 18:01:28 +00:00
Chris Lattner
4262b9b6e3 this test is using invalid "intrinsics".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81527 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 16:49:18 +00:00
Dan Gohman
9c7a988e3b Use "opt < %s" instead of "opt %s" so that opt doesn't print the test
filename in the output, which interferes with the tests' grep lines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81263 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 22:57:49 +00:00
Dan Gohman
3e054fe9ef Use opt -S instead of piping bitcode output through llvm-dis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81257 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 22:34:10 +00:00
Dan Gohman
b1e1e82c54 Change these tests to feed the assembly files to opt directly, instead
of using llvm-as, now that opt supports this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81226 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 16:50:01 +00:00
Daniel Dunbar
1f33167b31 Temporary test files should use %t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81086 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-05 12:38:26 +00:00
Dan Gohman
fea1dd0804 Remove obsolete -f flags.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79992 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 15:38:29 +00:00
Devang Patel
b3f7c61d9c Do not use abbrev while writing NamedMDNode name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77637 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-30 23:06:35 +00:00
Devang Patel
aa99314251 Read and write NamedMDNode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77517 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 22:34:41 +00:00
Devang Patel
104cf9e02b Derive MDNode from MetadataBase instead of Constant. Emit MDNodes into METADATA_BLOCK in bitcode file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76834 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 01:07:34 +00:00
Devang Patel
6dba7669e0 Remove empty test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76763 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-22 18:09:11 +00:00
Devang Patel
e54abc90fe Introduce MetadataBase, a base class for MDString and MDNode.
Derive MDString directly from MetadataBase. 
Introduce new bitcode block to hold metadata.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76759 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-22 17:43:22 +00:00
Devang Patel
2214c94bb7 Drop "constant" from
!0 = constant metadata !{...}


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75057 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 21:57:07 +00:00
Devang Patel
320671d265 Update SLotTracker to handle MDNode slots.
Simplify MDNode printing.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75053 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 21:44:25 +00:00
Devang Patel
1c7eea60d3 Support MDNode forward reference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75031 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 19:23:54 +00:00
Devang Patel
8a15602119 new test case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74633 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 19:40:59 +00:00
Devang Patel
923078c65d Support stand alone metadata syntax.
!0 = constant metadata !{i32 21, i32 22}
@llvm.blah = constant metadata !{i32 1000, i16 200, metadata !0}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74630 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 19:21:12 +00:00
Devang Patel
0f05d22a31 Let's ignore MDStrings also!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74255 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 02:26:12 +00:00
Devang Patel
e4c0c0fab8 No need to code gen MDNodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74150 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 00:47:42 +00:00
Dan Gohman
6de29f8d96 Support vector casts in more places, fixing a variety of assertion
failures.

To support this, add some utility functions to Type to help support
vector/scalar-independent code. Change ConstantInt::get and
ConstantFP::get to support vector types, and add an overload to
ConstantInt::get that uses a static IntegerType type, for
convenience.

Introduce a new getConstant method for ScalarEvolution, to simplify
common use cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73431 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 22:12:54 +00:00
Dan Gohman
ae3a0be92e 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72897 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 22:49:04 +00:00
Nick Lewycky
7a0370f66a Give embedded metadata its own type instead of relying on EmptyStructTy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72610 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 05:06:04 +00:00
Nick Lewycky
cb33799b9f 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-10 20:57:05 +00:00
Nick Lewycky
21cc4460ef 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68420 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-04 07:22:01 +00:00
Duncan Sands
ab6b226978 Don't load values out of global constants with weak
linkage: the value may be replaced with something
different at link time.  (Frontends that want to
allow values to be loaded out of weak constants can
give their constants weak_odr linkage).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 21:53:29 +00:00
Chris Lattner
df98617b23 Reimplement the old and horrible bison parser for .ll files with a nice
and clean recursive descent parser.

This change has a couple of ramifications:
1. The parser code is about 400 lines shorter (in what we maintain, not
   including what is autogenerated).
2. The code should be significantly faster than the old code because we 
   don't have to work around bison's poor handling of datatypes with 
   ctors/dtors.  This also makes the code much more resistant to memory 
   leaks.
3. We now get caret diagnostics from the .ll parser, woo.
4. The actual diagnostics emited from the parser are completely different
   so a bunch of testcases had to be updated.
5. I now disallow "%ty = type opaque %ty = type i32".  There was no good
   reason to support this, it was just an accident of the old 
   implementation.  I have no reason to think that anyone is actually using
   this.
6. The syntax for sticking a global variable has changed to make it 
   unambiguous.  I don't think anyone is depending on this since only clang
   supports this and it is not solid yet, so I'm not worried about anything
   breaking.
7. This gets rid of the last use of bison, and along with it the .cvs files.
   I'll prune this from the makefiles as a subsequent commit.

There are a few minor cleanups that can be done after this commit (suggestions
welcome!) but this passes dejagnu testing and is ready for its time in the
limelight.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61558 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 07:01:27 +00:00
Chris Lattner
7c3f161569 add testcase for type parsing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61449 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-27 08:10:46 +00:00