1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
Commit Graph

179 Commits

Author SHA1 Message Date
Chris Lattner
eceb54e9c2 add virtual methods to get the start/end of a MCParsedAsmOperand,
the default implementation returns "unknown".

llvm-svn: 93470
2010-01-14 22:29:57 +00:00
Chris Lattner
882cb240a6 Split the TargetAsmParser "ParseInstruction" interface in half:
the new ParseInstruction method just parses and returns a list of
target operands.  A new MatchInstruction interface is used to
turn the operand list into an MCInst.

This requires new/deleting all the operands, but it also gives 
targets the ability to use polymorphic operands if they want to. 

llvm-svn: 93469
2010-01-14 22:21:20 +00:00
Chris Lattner
ceabb11a5e prune #includes in TargetAsmParser.h
Pass in SMLoc of instr opcode into ParseInstruction.
Make AsmToken be a class, not a struct.

llvm-svn: 93457
2010-01-14 21:32:45 +00:00
Bill Wendling
5dcf84ad18 Mark some debug variables as 'unused' to quiet compiler and analyzer.
llvm-svn: 92183
2009-12-28 01:34:57 +00:00
Chris Lattner
57141e5548 rename HexDisassembler -> Disassembler, it works on any input
integer encoding (0123, 0b10101, 42, etc).

llvm-svn: 91934
2009-12-22 22:50:29 +00:00
Chris Lattner
61d0911b3c just discard the debug output from the disassembler.
llvm-svn: 91933
2009-12-22 22:47:43 +00:00
Chris Lattner
246541d5d8 specify what is invalid about it
llvm-svn: 91901
2009-12-22 07:03:21 +00:00
Chris Lattner
e9288e57d9 reject invalid input with a caret, e.g.:
simple-tests.txt:16:1: error: invalid instruction
0xff 0xff
^

llvm-svn: 91898
2009-12-22 06:58:29 +00:00
Chris Lattner
226e849772 various cleanups, make the disassemble reject lines with too much
data on them, for example:

	addb	%al, (%rax)
simple-tests.txt:11:5: error: excess data detected in input
0 0 0 0 0 
    ^

llvm-svn: 91896
2009-12-22 06:56:51 +00:00
Chris Lattner
4d6e3ef4c0 If you thought that it didn't make sense for the disassembler
to not produce caret diagnostics, you were right!

llvm-svn: 91895
2009-12-22 06:45:48 +00:00
Chris Lattner
3b333ebfb8 rewrite the file parser for the disassembler, implementing support for
comments.  Also, check in a simple testcase for the disassembler,
including a test for r91864

llvm-svn: 91894
2009-12-22 06:37:58 +00:00
Chris Lattner
1bc57b3a5f don't crash on blank lines, rename some variables.
llvm-svn: 91892
2009-12-22 06:24:00 +00:00
Chandler Carruth
e8571122ee Update CMake build to include HexDisassembler.cpp.
llvm-svn: 91589
2009-12-17 06:35:17 +00:00
Sean Callanan
023fdbe1b6 Test harness for the LLVM disassembler. When invoked
with -disassemble, llvm-mc now accepts lines of the
form
0x00 0x00
and passes the resulting bytes to the disassembler for
the chosen (or default) target, printing the result.

llvm-svn: 91579
2009-12-17 01:49:59 +00:00
Nick Lewycky
6623dcf203 Line this up as well.
llvm-svn: 85748
2009-11-01 22:08:51 +00:00
Nick Lewycky
2f3164a81c Fix whitespace.
llvm-svn: 85747
2009-11-01 22:07:54 +00:00
Chandler Carruth
766362c707 Move DataTypes.h to include/llvm/System, update all users. This breaks the last
direct inclusion edge from System to Support.

llvm-svn: 85086
2009-10-26 01:35:46 +00:00
Daniel Dunbar
022b59a0b5 MC: Remove unneeded context argument to MCExpr::Evaluate*.
llvm-svn: 84233
2009-10-16 01:57:52 +00:00
Daniel Dunbar
af3162e523 MC: Tweak variable assignment diagnostics, and make reassignment of non-absolute
variables and symbols invalid.

llvm-svn: 84232
2009-10-16 01:57:39 +00:00
Daniel Dunbar
a4df6e46a4 MC: When parsing a variable reference, substitute absolute variables immediately
since they are allowed to be redefined.

llvm-svn: 84230
2009-10-16 01:34:54 +00:00
Chris Lattner
4ab9414b7c add a new DirectiveMap stringmap, which allows more efficient dispatching
to directive handlers and allows for easier extensibility.

I only switched a few over for now.

llvm-svn: 82926
2009-09-27 21:16:52 +00:00
Chris Lattner
80349d5875 avoid copying MCAsmInfo by value, add an (extremely low prio) fixme.
llvm-svn: 82911
2009-09-27 19:38:39 +00:00
Chris Lattner
f411f53f9c Add an intel syntax MCInstPrinter implementation. You can now
transcode from AT&T to intel syntax with "llvm-mc foo.s -output-asm-variant=1"

llvm-svn: 82385
2009-09-20 07:17:49 +00:00
Kevin Enderby
41b1d4288a Fixed some problems with the logic of parsing line comments by adding
isAtStartOfComment and using that instead in two places where a loop
to check if the char was in MAI.getCommentString().

llvm-svn: 82059
2009-09-16 18:08:00 +00:00
Chris Lattner
fab7b49bb0 use an accessor to simplify code.
llvm-svn: 81997
2009-09-16 04:12:47 +00:00
Chris Lattner
4a33f01892 Change MCAsmStreamer to take an MCInstPrinter instead of a
full AsmPrinter, and change TargetRegistry to keep track
of registered MCInstPrinters.

llvm-mc is still linking in the entire
target foo to get the code emitter stuff, but this is an
important step in the right direction.

llvm-svn: 81754
2009-09-14 03:02:37 +00:00
Kevin Enderby
9f0fb453d8 Added the ParseInstruction() hook for target specific assembler directives so
that things like .word can be parsed as target specific.  Moved parsing .word
out of AsmParser.cpp into X86AsmParser.cpp as it is 2 bytes on X86 and 4 bytes
for other targets that support the .word directive.

llvm-svn: 81461
2009-09-10 20:51:44 +00:00
Daniel Dunbar
bae4e52bd0 MC: Give target specific parsers access to the MCStreamer.
llvm-svn: 81416
2009-09-10 00:59:15 +00:00
Benjamin Kramer
38666b8c1c Fix an integer truncation noticed by MSVC.
llvm-svn: 81109
2009-09-06 09:35:10 +00:00
Kevin Enderby
8aeb8c1f8c Added AsmToken enum constants to MCAsmLexer.h for '[', ']', '{', and '}' in
preparation of supporting other targets. Then changed the lexer to parse these
as tokens.

llvm-svn: 81050
2009-09-04 22:40:31 +00:00
Kevin Enderby
f697ad5e30 Added the AsmToken::Hash enum constant to MCAsmLexer.h in preparation of
supporting other targets.  Changed the code to pass MCAsmInfo to the parser
and the lexer.  Then changed the lexer to use CommentString from MCAsmInfo
instead of a literal '#' character.

llvm-svn: 81046
2009-09-04 21:45:34 +00:00
Kevin Enderby
5f29771ea2 Removed the non-target independent AsmToken::Register enum constant
from MCAsmLexer.h in preparation of supporting other targets.  Changed the
X86AsmParser code to reflect this by removing AsmLexer::LexPercent and looking
for AsmToken::Percent when parsing in places that used AsmToken::Register.
Then changed X86ATTAsmParser::ParseRegister to parse out registers as an
AsmToken::Percent followed by an AsmToken::Identifier.

llvm-svn: 80929
2009-09-03 17:15:07 +00:00
Chris Lattner
344ada1f5e TAI -> MAI
llvm-svn: 80899
2009-09-03 06:13:54 +00:00
Daniel Dunbar
3a44b6da61 llvm-mc: Pass values to MCStreamer as MCExprs, not MCValues.
llvm-svn: 80578
2009-08-31 08:09:28 +00:00
Daniel Dunbar
b897e807c4 llvm-mc: Simplify EmitAssignment ('.set' is identical to '=').
llvm-svn: 80577
2009-08-31 08:09:09 +00:00
Daniel Dunbar
11035eeb11 llvm-mc: Remove MCAsmParser::Parse[Paren]RelocatableExpression.
llvm-svn: 80576
2009-08-31 08:08:50 +00:00
Daniel Dunbar
5fbaad8079 llvm-mc: Add MCAsmParser::Parse[Paren]Expression forms which return an MCExpr.
llvm-svn: 80574
2009-08-31 08:08:17 +00:00
Daniel Dunbar
22505125c8 llvm-mc: Add MCAsmParser::getContext.
llvm-svn: 80571
2009-08-31 08:07:44 +00:00
Daniel Dunbar
053a5f22a0 llvm-mc: Switch MCExpr construction to using static member functions, and taking the MCContext (which now owns all MCExprs).
llvm-svn: 80569
2009-08-31 08:07:22 +00:00
Daniel Dunbar
b882c70ff2 llvm-mc: Move AsmExpr into MC lib (as MCExpr).
llvm-svn: 80567
2009-08-31 08:06:59 +00:00
Daniel Dunbar
bc61205626 llvm-mc: MCStreamer cleanups. - Remove EmitLocalSymbol, this is unsupported for now.
- Switch Emit{CommonSymbol,Zerofill} to take alignment in bytes (for consistency).

llvm-svn: 80484
2009-08-30 06:17:16 +00:00
Daniel Dunbar
09ed9fabde llvm-mc: Emit .lcomm as .zerofill.
llvm-svn: 80343
2009-08-28 05:48:46 +00:00
Daniel Dunbar
42ad4294d0 llvm-mc: Unique zero fill sections.
llvm-svn: 80342
2009-08-28 05:48:29 +00:00
Daniel Dunbar
f0714ea058 Revert r80305, I forgot a dependent change.
--- Reverse-merging r80305 into '.':
U    tools/llvm-mc/AsmParser.cpp

llvm-svn: 80309
2009-08-27 23:58:10 +00:00
Daniel Dunbar
2c48439750 llvm-mc: Unique sections in .zerofill.
llvm-svn: 80305
2009-08-27 23:45:06 +00:00
Daniel Dunbar
e30a44267c llvm-mc/Mach-O: Add MCCodeEmitter support, for encoding instructions.
- No relocations yet, of course.

llvm-svn: 80235
2009-08-27 08:17:51 +00:00
Daniel Dunbar
7e83346fd9 llvm-mc: Only show instruction encodings with --show-encoding.
llvm-svn: 80230
2009-08-27 07:56:39 +00:00
Daniel Dunbar
4316774ac1 llvm-mc: Tweak MCCodeEmitter skeleton.
llvm-svn: 80193
2009-08-27 01:34:22 +00:00
Daniel Dunbar
fd042a5019 Sketch TargetRegistry support for MCCodeEmitter abstract interface.
- Of course, nothing actually can provide this interface yet.

llvm-svn: 80188
2009-08-27 00:51:57 +00:00
Daniel Dunbar
f2e919b79e llvm-mc/Mach-O: Unique sections properly, so we don't get duplicate text
sections, etc.
 - The quick and dirty way, just clone the TargetLoweringObjectFile
   code. Eventually this should be shared... somehow.

llvm-svn: 80168
2009-08-26 22:49:51 +00:00