Chris Lattner
385977c252
remove asmparser support for the old getresult instruction, which has been subsumed by extractvalue.
...
llvm-svn: 133247
2011-06-17 06:57:15 +00:00
Chris Lattner
9e7c036d09
remove parser support for the obsolete "multiple return values" syntax, which
...
was replaced with return of a "first class aggregate".
llvm-svn: 133245
2011-06-17 06:49:41 +00:00
Chris Lattner
0824241aef
Remove old backwards compatibility support from the parser for autoupgrading
...
the old malloc/free instructions, and for 'sext' and 'zext' as function
attributes (they are spelled signext/zeroext now), and support for result
value attributes being specified after a function.
Additionally, diagnose invalid attributes on functions with an error message
instead of an abort in the verifier.
llvm-svn: 133229
2011-06-17 03:16:47 +00:00
Rafael Espindola
f6cae95276
Reject uses of unnamed_addr in declarations.
...
llvm-svn: 123358
2011-01-13 01:30:30 +00:00
Benjamin Kramer
cd6c025b08
Push twines deeper into SourceMgr's error handling methods.
...
llvm-svn: 114847
2010-09-27 17:42:11 +00:00
Chris Lattner
ecf276b787
remove unions from LLVM IR. They are severely buggy and not
...
being actively maintained, improved, or extended.
llvm-svn: 112356
2010-08-28 04:09:24 +00:00
Dan Gohman
979850aeb6
Add a comment explaining why this code is more complex than it
...
initially seems it should require.
llvm-svn: 111913
2010-08-24 14:31:06 +00:00
Dan Gohman
3c2bff91d0
Extend function-local metadata to be usable as attachments.
...
llvm-svn: 111895
2010-08-24 02:24:03 +00:00
Dan Gohman
c68320f6ad
Give ParseInstructionMetadata access to the PerFunctionState object.
...
This is in preparation for generalizing its parsing of function-local
values.
llvm-svn: 111893
2010-08-24 02:05:17 +00:00
Dan Gohman
8c1d1d0b27
Factor out metadata parsing into a separate function.
...
llvm-svn: 108343
2010-07-14 18:26:50 +00:00
Chris Lattner
0f513e1c22
fix a crash on invalid metadata, e.g.: call i32 @foo(), XXXX
...
We would return the error without inserting the new instruction
into the program, so it wouldn't get deallocated, and an abort
would trigger when the module was deleted.
llvm-svn: 100602
2010-04-07 04:08:57 +00:00
Chris Lattner
b77a53bb60
include header.
...
llvm-svn: 100087
2010-04-01 05:20:21 +00:00
Chris Lattner
b0cddaebe0
rewrite handling of forward ref'd instruction metadata
...
to used deferred resolution instead of creating a temporary
node + rauw. There is no reason to create the temporary
mdnode, then do rauw, then destroy it.
llvm-svn: 100086
2010-04-01 05:14:45 +00:00
Chris Lattner
98c3d20ae4
eliminate a temporary smallvector
...
llvm-svn: 100082
2010-04-01 04:51:13 +00:00
Chris Lattner
2265d6280b
Add support for a union type in LLVM IR. Patch by Talin!
...
llvm-svn: 96011
2010-02-12 20:49:41 +00:00
Charles Davis
d69c12ecc6
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).
llvm-svn: 95945
2010-02-12 00:31:15 +00:00
Devang Patel
81f0fa06d7
Remove MetadataBase class because it is not adding significant value.
...
llvm-svn: 94243
2010-01-22 22:52:10 +00:00
Victor Hernandez
1ca202f9ea
Consolidate ConvertGlobalValIDToValue, ConvertGlobalOrMetadataValIDToValue, and ConvertValIDToValue into a more powerful ConvertValIDToValue() that does all three's work
...
llvm-svn: 93197
2010-01-11 22:31:58 +00:00
Victor Hernandez
f4272b50d6
Compute isFunctionLocal in MDNode ctor or via argument in new function getWhenValsUnresolved().
...
Document PFS argument to ParseValID() and ConvertGlobalOrMetadataValIDToValue().
llvm-svn: 93108
2010-01-10 07:14:18 +00:00
Victor Hernandez
6551d8e0be
When parsing function-local metadata, create a function-local MDNode
...
llvm-svn: 92838
2010-01-06 17:00:21 +00:00
Victor Hernandez
0e7561092b
Re-add parsing of function-local metadata; this time with testcase.
...
llvm-svn: 92793
2010-01-05 22:22:14 +00:00
Chris Lattner
c3422a8190
now that instruction metadata is only parsed in one place, eliminate the
...
parser-global MDsOnInst vector and make ParseInstructionMetadata return
its result by-ref through an argument like the entire rest of the parser.
llvm-svn: 92302
2009-12-30 05:48:36 +00:00
Chris Lattner
fb3b372e6d
reimplement ParseOptionalInfo as ParseOptionalCommaAlign, correctly
...
handle the comma case for metadata.
llvm-svn: 92301
2009-12-30 05:44:30 +00:00
Chris Lattner
f7b95d1fbc
rename ParseOptionalCustomMetadata -> ParseInstructionMetadata,
...
and make it non-optional. This fixes the bug where we'd accept
and ignore a spurious comma after some instructions.
llvm-svn: 92300
2009-12-30 05:31:19 +00:00
Chris Lattner
89aae53e72
convert 4 more instructions over.
...
llvm-svn: 92299
2009-12-30 05:27:33 +00:00
Chris Lattner
2aaf4a0490
add facilities to start factoring instruction metadata parsing
...
out of each opcode's handler. Change ret over so far.
llvm-svn: 92298
2009-12-30 05:23:43 +00:00
Chris Lattner
03a91d987f
reimplement insertvalue/extractvalue metadata handling to not blindly
...
accept invalid input. Actually add a testcase.
llvm-svn: 92297
2009-12-30 05:14:00 +00:00
Chris Lattner
6664b8bd4d
rename MetadataCache -> NumberedMetadata to follow the convention
...
used by other things. Convert it to a vector since it is a dense
numbering.
llvm-svn: 92293
2009-12-30 04:51:58 +00:00
Chris Lattner
bc506fa595
rewrite ParseMDNodeVector to follow the normal patter used in the .ll parser.
...
llvm-svn: 92292
2009-12-30 04:42:57 +00:00
Chris Lattner
9583b65fb9
rename ParseMDNode -> ParseMDNodeID, since it parses !42 , not !{... } as you'd expect.
...
llvm-svn: 92291
2009-12-30 04:15:23 +00:00
Chris Lattner
41a3666fc1
remove the code added in r90497. It has several major issues and no tests.
...
llvm-svn: 92288
2009-12-30 02:20:07 +00:00
Chris Lattner
4f406c8c74
split t_Metadata into t_MDNode and t_MDString, eliminating some unsafe casting.
...
llvm-svn: 92287
2009-12-30 02:11:14 +00:00
Chris Lattner
4803e84704
change ParseMDString and ParseMDNode to take arguments of the right type.
...
This exposed a raft of other problems, which I'll deal with in subsequent
patches.
llvm-svn: 92273
2009-12-29 21:53:55 +00:00
Chris Lattner
bfd6a6f096
switch to TrackingVH instead of WeakVH, since these can never
...
be RAUW'd and go to null. This also gets us some sorely lacking
type safety.
llvm-svn: 92272
2009-12-29 21:43:58 +00:00
Chris Lattner
6dd4686b48
Metadata.h doesn't need to include ValueHandle.h anymore.
...
llvm-svn: 92211
2009-12-28 08:20:46 +00:00
Victor Hernandez
e2129e2966
Add ParseInlineMetadata() which can parses metadata that refers to an instruction. Extend ParseParameterList() to use this new function so that calls to llvm.dbg.declare can pass inline metadata
...
llvm-svn: 90497
2009-12-03 23:40:58 +00:00
Devang Patel
02635b0c7a
Use WeakVH while storing metadata in containers.
...
This fixes PR5393.
llvm-svn: 86091
2009-11-05 01:13:02 +00:00
Chris Lattner
e897be280c
full asmparser support for blockaddress. We can now do:
...
$ llvm-as foo.ll -d -disable-output
which reads and prints the .ll file. BC encoding is the
next project. Testcase will go in once that works.
llvm-svn: 85368
2009-10-28 03:39:23 +00:00
Chris Lattner
2bc8002f4c
rename indbr -> indirectbr to appease the residents of #llvm.
...
llvm-svn: 85351
2009-10-28 00:19:10 +00:00
Chris Lattner
fdda543cea
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.
llvm-svn: 85274
2009-10-27 19:13:16 +00:00
Victor Hernandez
e8998896f5
Auto-upgrade free instructions to calls to the builtin free function.
...
Update all analysis passes and transforms to treat free calls just like FreeInst.
Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised.
llvm-svn: 84987
2009-10-24 04:23:03 +00:00
Victor Hernandez
4d7283f82c
Autoupgrade malloc insts to malloc calls.
...
Update testcases that rely on malloc insts being present.
Also prematurely remove MallocInst handling from IndMemRemoval and RaiseAllocations to help pass tests in this incremental step.
llvm-svn: 84292
2009-10-17 00:00:19 +00:00
Devang Patel
629ad89954
Parse custom metadata attached with an instruction.
...
llvm-svn: 83033
2009-09-29 00:01:14 +00:00
Devang Patel
d836a7d651
Do not use global typedef for MDKindID.
...
llvm-svn: 83016
2009-09-28 21:14:55 +00:00
Victor Hernandez
f772c0b8b2
Revert 82694 "Auto-upgrade malloc instructions to malloc calls." because it causes regressions in the nightly tests.
...
llvm-svn: 82784
2009-09-25 18:11:52 +00:00
Victor Hernandez
ff8027ced6
Auto-upgrade malloc instructions to malloc calls.
...
Reviewed by Devang Patel.
llvm-svn: 82694
2009-09-24 17:47:49 +00:00
Devang Patel
d90471a00d
Fix parsing of optional metadata for 'load', 'store' and 'alloc' instructions.
...
llvm-svn: 82175
2009-09-17 23:04:48 +00:00
Sandeep Patel
9c4e094e2a
Retype from unsigned to CallingConv::ID accordingly. Approved by Bob Wilson.
...
llvm-svn: 80773
2009-09-02 08:44:58 +00:00
Dan Gohman
4ee8471442
Extend the AsmWriter to print unnamed numbered types as "%0 = type ..."
...
and unnamed numbered global variables as "@0 = global ...". Extend the
AsmParser to recognize these forms.
llvm-svn: 78859
2009-08-12 23:32:33 +00:00
Devang Patel
127ab37209
Parse named metadata.
...
llvm-svn: 77410
2009-07-29 00:34:02 +00:00
Devang Patel
6b2162686a
Derive MDNode from MetadataBase instead of Constant. Emit MDNodes into METADATA_BLOCK in bitcode file.
...
llvm-svn: 76834
2009-07-23 01:07:34 +00:00
Devang Patel
5794cb80ad
Introduce MetadataBase, a base class for MDString and MDNode.
...
Derive MDString directly from MetadataBase.
Introduce new bitcode block to hold metadata.
llvm-svn: 76759
2009-07-22 17:43:22 +00:00
Devang Patel
25ea06491e
Refactor metadata parsing routines into separate functions.
...
llvm-svn: 76455
2009-07-20 19:00:08 +00:00
Devang Patel
530fc78aec
Support MDNode forward reference.
...
llvm-svn: 75031
2009-07-08 19:23:54 +00:00
Owen Anderson
33df2f9812
Use LLVMContext in the LLLexer.
...
llvm-svn: 74934
2009-07-07 18:44:11 +00:00
Chris Lattner
d49e5380ec
switch the .ll parser to use SourceMgr.
...
llvm-svn: 74735
2009-07-02 23:08:13 +00:00
Chris Lattner
739a32b190
switch the .ll parser into SMDiagnostic.
...
llvm-svn: 74734
2009-07-02 22:46:18 +00:00
Owen Anderson
bd328c24a0
Use LLVMContext for generating UndefValue constants too!
...
llvm-svn: 74703
2009-07-02 17:04:01 +00:00
Owen Anderson
110917b453
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
cbd3f64f54
--- 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
b70b5ab513
Convert LLParser to use LLVMContext for creating constants.
...
llvm-svn: 74648
2009-07-01 21:57:44 +00:00
Devang Patel
905d32435c
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
Nick Lewycky
f417462ddf
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
Nick Lewycky
eea5412e19
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
2db6dc1753
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
Chris Lattner
f543d03f11
Reject PR3281:accepted03.ll with:
...
llvm-as: accepted03.ll:1:35: invalid unresolved type up reference
declare void @r({ \7, opaque, \10 } %su)
^
llvm-svn: 61725
2009-01-05 18:34:07 +00:00
Chris Lattner
f6df8b7ec7
Fix PR3281:crash08.ll with this diagnostic:
...
llvm-as: crash08.ll:3:15: invalid operand type for instruction
"qp" = sdiv fp128 0x1, %30
^
llvm-svn: 61684
2009-01-05 08:24:46 +00:00
Chris Lattner
8de7fa4840
reject PR3281:crash07.ll with:
...
llvm-as: crash07.ll:2:32: va_arg requires operand with first class type
%y = va_arg [52 x <{}>] %43, double (...) sspreq
^
llvm-svn: 61683
2009-01-05 08:18:44 +00:00
Chris Lattner
a76e94a12e
Refactor some parser interfaces to fix PR3278 and a FIXME:
...
ParseAssemblyString with a specified module would not parse
into the module, it would create and return a new one.
llvm-svn: 61635
2009-01-04 20:44:11 +00:00
Misha Brukman
8d90975ba9
Down with trailing whitespace!
...
llvm-svn: 61594
2009-01-02 22:46:48 +00:00
Chris Lattner
1af2113e10
minor cleanups and comment improvements.
...
llvm-svn: 61564
2009-01-02 08:05:26 +00:00
Chris Lattner
f28c74870f
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.
llvm-svn: 61558
2009-01-02 07:01:27 +00:00