Commit Graph

108 Commits

Author SHA1 Message Date
Chris Lattner ac161bff07 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
Chris Lattner 25f74dc574 Fix the .ll grammar rules to allow any type before an 'i32', not just an
integer type.  Invalid things like 'float 42' are now rejected by the
semantic analysis in the productions not the parser.  This fixes PR2733.

llvm-svn: 57560
2008-10-15 06:16:45 +00:00
Daniel Dunbar 0f8155ae4e Prevent assert when using '"' in names (via hexadecimal).
Update LangRef to mention \xx quoting in names.

llvm-svn: 57538
2008-10-14 23:51:43 +00:00
Devang Patel 9cc9812653 Attributes noinline alwaysinline are incompatible
llvm-svn: 56939
2008-10-01 23:41:25 +00:00
Dan Gohman 3113fa8f32 Don't leave an output file in the test directory.
llvm-svn: 56910
2008-10-01 04:13:23 +00:00
Devang Patel 221fe42006 Support inreg, zext and sext as return value attributes.
llvm-svn: 56801
2008-09-29 20:49:50 +00:00
Devang Patel db937ec8fa Update tests.
llvm-svn: 56730
2008-09-27 00:25:28 +00:00
Dan Gohman c5d2892e62 Re-enables the new vector select in the bitcode reader, by modifying the
bitcode reader/writer as follows:

- add and use new bitcode FUNC_CODE_INST_VSELECT to handle the llvm
select opcode using either i1 or [N x i1] as the selector.
- retain old BITCODE FUNC_CODE_INST_SELECT in the bitcode reader to
handle select on i1 for backwards compatibility with existing bitcode
files.
- re-enable the vector-select.ll test program.

Also, rename the recently added bitcode opcode FUNC_CODE_INST_VCMP to
FUNC_CODE_INST_CMP2 and make the bitcode writer use it to handle
fcmp/icmp on scalars or vectors. In the bitcode writer, use
FUNC_CODE_INST_CMP for vfcmp/vicmp only. In the bitcode reader, have
FUNC_CODE_INST_CMP handle icmp/fcmp returning bool, for backwards
compatibility with existing bitcode files.

Patch by Preston Gurd!

llvm-svn: 56233
2008-09-16 01:01:33 +00:00
Dan Gohman 7164e9a702 Temporarily disable vector select in the bitcode reader. The
way it handles the type of the condition is breaking plain
scalar select in the case that the value is a
forward-reference.

llvm-svn: 55976
2008-09-09 02:08:49 +00:00
Dan Gohman c579d978a3 Extend the vcmp/fcmp LLVM IR instructions to take vectors as arguments
and, if so, to return a vector of boolean as a result;

Extend the select LLVM IR instruction to allow you to specify a result
type which is a vector of boolean, in which case the result will be an
element-wise selection instead of choosing one vector or the other; and

Update LangRef.html to describe these changes.

This patch was contributed by Preston Gurd!

llvm-svn: 55969
2008-09-09 01:02:47 +00:00
Devang Patel ca9d93e627 Read and write function notes.
llvm-svn: 55657
2008-09-02 21:47:13 +00:00
Devang Patel cc4d6ce532 Function notes tests.
llvm-svn: 55648
2008-09-02 20:58:16 +00:00
Chris Lattner a51c7030e2 Add support for parsing .ll files that have numbers in front of
nameless values, such as:

%3 = add i32 4, 2

This fixes the first half of PR2480

llvm-svn: 55539
2008-08-29 17:12:13 +00:00
Dan Gohman 1a70bcc388 Fix the AsmWriter to not print extra spaces after parameter attributes.
llvm-svn: 54351
2008-08-05 15:51:44 +00:00
Nate Begeman fecbc8cff1 Add vector shifts to the IR, patch by Eli Friedman.
CodeGen & Clang work coming next.

llvm-svn: 54161
2008-07-29 15:49:41 +00:00
Chris Lattner eab49263b5 Fix a bunch of bugs handling vector compare constant expressions, fixing
PR2317.

llvm-svn: 53544
2008-07-14 05:17:31 +00:00
Chris Lattner 61622615ae Implement PR2538
llvm-svn: 53438
2008-07-11 00:30:06 +00:00
Matthijs Kooijman a2f743eaff Fix some escaping and quoting in RUN lines, mainly involving { and <. In two
cases quoting of <{ didn't work out, so I changed the grep to check for }>
instead.

This fixes 7 testcases that were not properly running before.

llvm-svn: 52182
2008-06-10 16:04:47 +00:00
Matthijs Kooijman 30a07a5504 For all RUN lines starting with "not", redirect stderr to /dev/null so tests
don't fail when (expected) error output is produced. This fixes 17 tests.

While I was there, I also made all RUN lines of the form "not llvm-as..." a bit
more consistent, they now all redirect stderr and stdout to /dev/null and use
input redirect to read their input.

llvm-svn: 52174
2008-06-10 12:57:32 +00:00
Dan Gohman 27ae953278 Re-apply 52002, allowing the verifier to accept non-MRV struct return
types on functions, with adjustments so that it accepts both
new-style aggregate returns and old-style MRV returns, including those
with only a single member.

llvm-svn: 52157
2008-06-09 21:26:13 +00:00
Dan Gohman 1d304a99d7 Revert 52002.
llvm-svn: 52030
2008-06-05 23:57:06 +00:00
Matthijs Kooijman 5eef32ba94 Change the Verifier to support returning first class aggregrates.
Add a testcase for functions returning first class aggregrates.

llvm-svn: 52002
2008-06-05 14:00:36 +00:00
Dan Gohman 25b3b49dbc nounwindify.
llvm-svn: 51893
2008-06-03 01:21:11 +00:00
Dan Gohman 3db11c2bd9 Constant folding for insertvalue and extractvalue.
llvm-svn: 51889
2008-06-03 00:15:20 +00:00
Dan Gohman 1ecaf45cf1 IR, bitcode reader, bitcode writer, and asmparser changes to
insertvalue and extractvalue to use constant indices instead of
Value* indices. And begin updating LangRef.html.

There's definately more to come here, but I'm checking this 
basic support in now to make it available to people who are
interested.

llvm-svn: 51806
2008-05-31 00:58:22 +00:00
Dan Gohman fa9dac2859 Don't silently truncate array extents to 32 bits.
llvm-svn: 51505
2008-05-23 21:40:55 +00:00
Dan Gohman 30499844ea Make structs and arrays first-class types, and add assembly
and bitcode support for the extractvalue and insertvalue
instructions and constant expressions.

Note that this does not yet include CodeGen support.

llvm-svn: 51468
2008-05-23 01:55:30 +00:00
Gabor Greif d01c562e48 Eliminate questionable syntax for stdin redirection. This probably also speeds things up a bit.
llvm-svn: 51357
2008-05-20 22:07:21 +00:00
Gabor Greif 1e427c3264 sabre brings to my attention that the 'tr' suffix is also obsolete
llvm-svn: 51349
2008-05-20 21:00:03 +00:00
Gabor Greif f45ff35bfe Rename the last test with .llx extension to .ll, resolve duplicate test by renaming to isnan2. Now that no test has llx ending there is no need to search for them from dg.exp too.
llvm-svn: 51328
2008-05-20 19:52:04 +00:00
Chris Lattner f9a4e4d723 returning an empty multiple return list is not valid.
llvm-svn: 50135
2008-04-23 05:29:14 +00:00
Chris Lattner fe48fbc1f1 rename *.llx -> *.ll
llvm-svn: 49969
2008-04-19 22:26:29 +00:00
Chris Lattner bc26e1bb8a Implement PR2206.
llvm-svn: 49967
2008-04-19 22:17:26 +00:00
Dan Gohman 41eb949aaf Teach llvm-as to accept function types with multiple return types.
llvm-svn: 49945
2008-04-19 00:24:39 +00:00
Devang Patel bbfd874cb4 Update bitcode reader and writer to handle multiple return values.
Take 2.

llvm-svn: 47583
2008-02-26 01:29:32 +00:00
Evan Cheng 2f18c39720 Backing out r47521 for now. This has broken a number of tests.
llvm-svn: 47533
2008-02-23 19:32:32 +00:00
Devang Patel 6a49782d33 Properly read and write bitcodes for multiple return values.
llvm-svn: 47521
2008-02-23 01:44:55 +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 fe988eba4b XFAIL for now.
llvm-svn: 47411
2008-02-20 23:10:42 +00:00
Devang Patel b2aa6fe905 Now functions can return aggregate values.
llvm-svn: 47409
2008-02-20 22:51:28 +00:00
Chris Lattner 95816b9dee Fix PR2060 by rejecting invalid types for integer constants.
llvm-svn: 47311
2008-02-19 04:36:07 +00:00
Chris Lattner 8a67d349fe this test isn't useful since we added @ notation for globals.
llvm-svn: 47229
2008-02-17 00:12:03 +00:00
Chris Lattner 0d43732cd0 this line was commented out.
llvm-svn: 47228
2008-02-17 00:09:08 +00:00
Tanya Lattner 47f0a20f8f Remove llvm-upgrade and update tests.
llvm-svn: 47227
2008-02-16 23:55:46 +00:00
Tanya Lattner 231fe4746b Removing llvm upgrade, so remove tests specific to llvm-upgrade and update the tests that used it.
llvm-svn: 47225
2008-02-16 23:27:24 +00:00
Chris Lattner 8f51fa82c0 upgrade this test, which wasn't testing the right thing since llvm-upgrade came around.
llvm-svn: 47194
2008-02-15 23:58:25 +00:00
Chris Lattner e1f41fc68e rename llx -> ll
llvm-svn: 47192
2008-02-15 23:51:48 +00:00
Tanya Lattner 5429dbf6c7 Remove llvm-upgrade
llvm-svn: 47119
2008-02-14 07:57:12 +00:00
Duncan Sands 0ebaf91f48 Two occurrences on one line count as one...
llvm-svn: 45885
2008-01-11 21:46:24 +00:00