Jim Grosbach
1643ba6894
Tidy up. 80-column and whitespace.
...
llvm-svn: 131094
2011-05-09 20:05:25 +00:00
Rafael Espindola
7901d3790e
Add all the plumbing needed for MC to expand cfi to the old tables in
...
the final assembly. It is the same technique used when targeting
assemblers that don't support .loc.
llvm-svn: 130587
2011-04-30 03:44:37 +00:00
Sean Callanan
b64c921079
Moved an access to an object past a NULL check,
...
making the MC disassembler tester more robust.
llvm-svn: 129175
2011-04-09 00:21:04 +00:00
Daniel Dunbar
5d8c7d0d36
MC: Add support for disabling "temporary label" behavior. Useful for debugging
...
on Darwin.
llvm-svn: 128430
2011-03-28 22:49:15 +00:00
Bill Wendling
a2eec46242
We need to pass the TargetMachine object to the InstPrinter if we are printing
...
the alias of an InstAlias instead of the thing being aliased. Because we need to
know the features that are valid for an InstAlias.
This is part of a work-in-progress.
llvm-svn: 127986
2011-03-21 04:13:46 +00:00
Benjamin Kramer
feccb33180
Plug some leaks in edis.
...
- Don't leak parsed operands during tokenization.
- Don't leak printed insts in llvm-mc.
llvm-svn: 126381
2011-02-24 11:03:19 +00:00
Sean Callanan
d7e66a8942
Fixed a bug in the enhanced disassembly tester that
...
caused it to only parse one line of input.
llvm-svn: 126301
2011-02-23 03:29:41 +00:00
Sean Callanan
2fd268300e
Fixed llvm-mc in edis mode to use the result of
...
operand.evaluate as an error code, not as the
contents of the operand.
llvm-svn: 126181
2011-02-22 02:09:15 +00:00
Rafael Espindola
547873da60
Add support for the --noexecstack option.
...
llvm-svn: 124077
2011-01-23 17:55:27 +00:00
Rafael Espindola
64814fff0b
Correctly disassemble truncated asm.
...
Patch by Richard Simth.
llvm-svn: 122962
2011-01-06 16:48:42 +00:00
Michael J. Spencer
86f6a9ac6e
MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> via an out parm.
...
llvm-svn: 121958
2010-12-16 03:29:14 +00:00
Daniel Dunbar
8ab9be2005
MC: Make TargetAsmBackend available to the AsmStreamer.
...
- Treaty talks on the non-proliferation of MC objects broke down.
llvm-svn: 121949
2010-12-16 03:05:59 +00:00
Rafael Espindola
0e665e502d
Fixed version of 121434 with no new memory leaks.
...
llvm-svn: 121471
2010-12-10 07:39:47 +00:00
Rafael Espindola
011e168728
Revert my previous patch to make the valgrind bots happy.
...
llvm-svn: 121461
2010-12-10 04:01:09 +00:00
Rafael Espindola
03ad1e8f1f
Initial support for the cfi directives. This is just enough to get
...
f:
.cfi_startproc
nop
.cfi_endproc
assembled (on ELF).
llvm-svn: 121434
2010-12-09 23:48:29 +00:00
Michael J. Spencer
15483143ec
Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec. And fix clients.
...
llvm-svn: 121379
2010-12-09 17:36:48 +00:00
Michael J. Spencer
d5ec932c3a
Merge System into Support.
...
llvm-svn: 120298
2010-11-29 18:16:10 +00:00
Che-Liang Chiou
4cc802839c
Add registry hook for assembly text output
...
llvm-svn: 118394
2010-11-08 02:21:17 +00:00
Jim Grosbach
c160d7a3ae
Allow specifying a CPU to llvm-mc, so that we can properly set up subtarget
...
feature lists for instruction pattern predicates.
llvm-svn: 117788
2010-10-30 15:57:50 +00:00
Daniel Dunbar
467507fe11
llvm-mc: Teach -as-lex to print the raw token string as well.
...
llvm-svn: 117296
2010-10-25 20:18:46 +00:00
Dan Gohman
6645ce3f75
Move tool_output_file into its own file.
...
llvm-svn: 115973
2010-10-07 20:32:40 +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
Daniel Dunbar
eacb42cfee
MC/Lexer: Add 'Real' token type for floating point literals.
...
llvm-svn: 114718
2010-09-24 01:59:31 +00:00
Daniel Dunbar
1eb4c166bf
llvm-mc: Teach -as-lex to print more token kinds.
...
llvm-svn: 114051
2010-09-16 00:42:35 +00:00
Michael J. Spencer
90f807fda5
Revert "CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally."
...
This reverts commit r113632
Conflicts:
cmake/modules/AddLLVM.cmake
llvm-svn: 113819
2010-09-13 23:59:48 +00:00
Michael J. Spencer
98ad3f2ea7
CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally.
...
llvm-svn: 113632
2010-09-10 21:14:25 +00:00
Dan Gohman
f9e09104f1
Make tool_output_file's raw_ostream instance a member variable instead
...
of a base class.
This makes it possible to unregister the file from FilesToRemove when
the file is done. Also, this eliminates the need for
formatted_tool_output_file.
llvm-svn: 112706
2010-09-01 14:20:41 +00:00
Chris Lattner
0643b5f1f1
tidy up
...
llvm-svn: 112385
2010-08-28 20:34:35 +00:00
Duncan Sands
604b706b87
Straighten out any triple strings passed on the command line before
...
they hit the rest of the system.
llvm-svn: 112344
2010-08-28 01:30:02 +00:00
Dan Gohman
bef725be86
Use the new tool_output_file in several tools. This fixes a variety
...
of problems with output files being left behind or output streams
being left unclosed. Fix llvm-mc to respect the -o option in all
modes, rather than hardcoding outs() in some cases.
llvm-svn: 111603
2010-08-20 01:07:01 +00:00
Daniel Dunbar
4882ffc373
llvm-mc: Add -show-inst-operands, for dumping the parsed instruction representation before matching.
...
llvm-svn: 110791
2010-08-11 06:37:09 +00:00
Benjamin Kramer
d1340209a1
Plug the remaining MC leaks by giving MCObjectStreamer/MCAsmStreamer ownership of the TargetAsmBackend and the MCCodeEmitter.
...
llvm-svn: 109767
2010-07-29 17:48:06 +00:00
Chris Lattner
1ac58ea0f3
start straightening out libedis's dependencies and make it fit
...
better in the llvm world. Among other things, this changes:
1. The guts of libedis are now moved into lib/MC/MCDisassembler
2. llvm-mc now depends on lib/MC/MCDisassembler, not tools/edis,
so edis and mc don't have to be built in series.
3. lib/MC/MCDisassembler no longer depends on the C api, the C
API depends on it.
4. Various code cleanup changes.
There is still a lot to be done to make edis fit with the llvm
design, but this is an incremental step in the right direction.
llvm-svn: 108869
2010-07-20 18:25:19 +00:00
Daniel Dunbar
150021561c
Target: Give the TargetAsmParser access to the TargetMachine.
...
- Unfortunate, but necessary for now to handle subtarget instruction matching. Eventually we should factor out the lower level target machine information so we don't need to do this.
llvm-svn: 108664
2010-07-19 00:33:49 +00:00
Daniel Dunbar
4dc7255379
MC: Move several clients to using AsmParser constructor function.
...
llvm-svn: 108645
2010-07-18 18:31:33 +00:00
Daniel Dunbar
5accac5484
llvm-mc: Fix llvm-mc -as-lex.
...
llvm-svn: 108644
2010-07-18 18:31:28 +00:00
Daniel Dunbar
37b4089fbf
MC: Pass the target instance to the AsmParser constructor.
...
llvm-svn: 107426
2010-07-01 20:41:56 +00:00
Daniel Dunbar
9800936127
llvm-mc: Don't set NO_INSTALL on llvm-mc.
...
llvm-svn: 105837
2010-06-11 22:00:08 +00:00
Dan Gohman
bf0dac1735
Avoid calling outs() and fouts() when the stream isn't really needed.
...
llvm-svn: 104873
2010-05-27 19:47:36 +00:00
Daniel Dunbar
eb23d9ac22
MC: Add an MCLoggingStreamer, for use in debugging integrated-as mismatches.
...
llvm-svn: 104463
2010-05-23 17:44:06 +00:00
Matt Fleming
5d40d53cab
Currently, createMachOStreamer() is invoked directly in llvm-mc which
...
isn't ideal if we want to be able to use another object file format.
Add a createObjectStreamer() factory method so that the correct object
file streamer can be instantiated for a given target triple.
llvm-svn: 104318
2010-05-21 12:54:43 +00:00
Daniel Dunbar
8824824171
Remove dead option.
...
llvm-svn: 104303
2010-05-21 00:27:55 +00:00
Sean Callanan
e79322802a
Extended the edis "IsBranch" property to call
...
instructions as well. Added support for checking
this to the llvm-mc tester as well.
llvm-svn: 103454
2010-05-11 01:27:08 +00:00
Sean Callanan
7edf493591
Fixed a sign-extension bug in the X86 disassembler
...
that was causing PC-relative branch targets to be
evaluated incorrectly. Also added support for
checking operand values to the llvm-mc tester.
llvm-svn: 103128
2010-05-05 22:47:27 +00:00
Ted Kremenek
02e55f4a52
Add CMake support for 'edis'.
...
llvm-svn: 101177
2010-04-13 20:52:50 +00:00
Chris Lattner
f3ed0658ed
Make the disassembler respect the assembler dialect when printing instructions,
...
patch by Marius Wachtler!
llvm-svn: 101160
2010-04-13 18:41:17 +00:00
Sean Callanan
033fde84b5
Second try at integrating the edis tester. This
...
time I use the LIBS variable, which is not subject
to a %.a -> -l% transformation, to link llvm-mc
against libEnhancedDisassembly.
llvm-mc -edis works the same as llvm-mc
-disassemble, but outputs tokens and operands.
llvm-svn: 101058
2010-04-12 19:43:00 +00:00
Chris Lattner
bc47db9f8e
revert r100842 which broke several of the build bots.
...
llvm-svn: 100848
2010-04-09 04:24:20 +00:00
Sean Callanan
6a94ce3daf
Added a tester for the enhanced disassembler,
...
integrated into the llvm-mc testing tool.
llvm-svn: 100842
2010-04-09 01:43:16 +00:00
Chris Lattner
8b9eaae8d5
tidy #includes.
...
llvm-svn: 100489
2010-04-05 23:07:18 +00:00
Chris Lattner
8fb6be1886
fix an ugly wart in the MCInstPrinter api where the
...
raw_ostream to print an instruction to had to be specified
at MCInstPrinter construction time instead of being able
to pick at each call to printInstruction.
llvm-svn: 100307
2010-04-04 05:04:31 +00:00
Chris Lattner
fb18894982
remove some extraneous casts
...
llvm-svn: 100287
2010-04-03 21:03:50 +00:00
Daniel Dunbar
d04906b49e
llvm-mc: Add a -mc-relax-all option, which relaxes every fixup. We always need
...
exactly two passes in that case, and don't ever need to recompute any layout,
so this is a nice baseline for relaxation performance.
llvm-svn: 99563
2010-03-25 22:49:09 +00:00
Daniel Dunbar
b07aeb1c00
llvm-mc: Support -filetype=null, for timing purposes.
...
llvm-svn: 99349
2010-03-23 23:47:12 +00:00
Daniel Dunbar
78c65dad40
llvm-mc: Fix MCInstPrinter memory leaks.
...
llvm-svn: 99101
2010-03-20 22:36:35 +00:00
Daniel Dunbar
760b4c67b1
llvm-mc: Fix memory leak of MCAsmInfo.
...
llvm-svn: 99098
2010-03-20 22:36:25 +00:00
Daniel Dunbar
b478edff7c
llvm-mc: Fix target selection for --disassemble to use GetTarget.
...
llvm-svn: 98973
2010-03-19 18:07:50 +00:00
Chris Lattner
32452cf12f
fix an MCInstPrinter leak that jyasskin pointed out:
...
createAsmStreamer now takes ownership of the instprinter.
llvm-svn: 98939
2010-03-19 05:48:53 +00:00
Daniel Dunbar
661d89861c
llvm-mc: Delete output files on error.
...
llvm-svn: 98445
2010-03-13 19:31:47 +00:00
Daniel Dunbar
33c92a1a88
llvm-mc: Support -n, useful for comparing -integrated-as output since the
...
compiler may not lead with the text section.
llvm-svn: 98418
2010-03-13 02:20:57 +00:00
Daniel Dunbar
92c67d1d56
llvm-mc: Support -arch as a simplified form of -triple.
...
llvm-svn: 98417
2010-03-13 02:20:38 +00:00
Chris Lattner
f4dce6a6d8
remove MAI argument from createAsmStreamer since it
...
can get it from the context now.
llvm-svn: 98361
2010-03-12 18:28:53 +00:00
Chris Lattner
debc026df2
change MCContext to always have an MCAsmInfo.
...
llvm-svn: 98293
2010-03-11 22:53:35 +00:00
Daniel Dunbar
687d99cfa8
MC: Provide MCAssembler with a TargetAsmBackend.
...
llvm-svn: 98222
2010-03-11 01:34:27 +00:00
Chris Lattner
946403d05f
give MCCodeEmitters access to the current MCContext.
...
llvm-svn: 96038
2010-02-12 23:12:47 +00:00
Daniel Dunbar
75df429af0
llvm-mc: Remove --show-fixups and always show as part of --show-encoding.
...
Also, fix a silly memory leak.
llvm-svn: 95752
2010-02-10 01:41:14 +00:00
Daniel Dunbar
1b050afd4e
llvm-mc: Add --show-fixups option, for displaying the instruction fixup information in the asm comments.
...
llvm-svn: 95710
2010-02-09 23:00:14 +00:00
Daniel Dunbar
d997cd69cd
llvm-mc: Add --show-inst option, for showing the MCInst inline with the assembly
...
output.
llvm-svn: 95227
2010-02-03 18:18:30 +00:00
Sean Callanan
0139e2193d
Fixed the disassembler so it accepts multiple
...
instructions on a single line. Also made it a
bit more forgiving when it reports errors.
llvm-svn: 95197
2010-02-03 03:46:41 +00:00
Chris Lattner
5a57121631
make -fno-rtti the default unless a directory builds with REQUIRES_RTTI.
...
llvm-svn: 94378
2010-01-24 20:43:08 +00:00
Chris Lattner
5eb0c8a2bd
pass "-fasm-verbose" into createAsmStreamer.
...
llvm-svn: 94165
2010-01-22 07:06:15 +00:00
Chris Lattner
276811b58a
Stop building RTTI information for *most* llvm libraries. Notable
...
missing ones are libsupport, libsystem and libvmcore. libvmcore is
currently blocked on bugpoint, which uses EH. Once it stops using
EH, we can switch it off.
This #if 0's out 3 unit tests, because gtest requires RTTI information.
Suggestions welcome on how to fix this.
llvm-svn: 94164
2010-01-22 06:49:46 +00:00
Chris Lattner
c0e2ef62fa
move some files out of the llvm-mc tool into the MCParser library so
...
other tools can link it.
llvm-svn: 94131
2010-01-22 01:58:08 +00:00
Chris Lattner
9a84d96edf
create a new MCParser library and move some stuff into it.
...
llvm-svn: 94129
2010-01-22 01:44:57 +00:00
Chris Lattner
f1ac97964f
remove some confused code that used strtoull
...
llvm-svn: 94128
2010-01-22 01:17:12 +00:00
Sean Callanan
e9111e7172
Moved handling of inclusion from the AsmLexer to
...
the AsmParser, breaking AsmLexer's dependence on
SourceMgr.
llvm-svn: 94054
2010-01-21 00:19:58 +00:00
Sean Callanan
52633cb655
Changed the AsmParser to handle error messages itself
...
rather than passing them off to the AsmLexer to handle.
This means the AsmLexer no longer requires a SourceMgr
to do error handling.
llvm-svn: 94047
2010-01-20 23:19:55 +00:00
Sean Callanan
3c0fb5c7bb
Promoted the reference to the SourceMgr from AsmLexer
...
into AsmParser, in preparation for making AsmLexer
independent of the SourceMgr
llvm-svn: 94043
2010-01-20 22:45:23 +00:00
Sean Callanan
cddf628d31
Modified MCAsmLexer to return error information upward
...
rather than printing it locally, reducing its dependence
on SourceMgr.
llvm-svn: 94041
2010-01-20 22:18:24 +00:00
Chris Lattner
6ea74a85bb
give createAsmStreamer an 'isLittleEndian' argument.
...
llvm-svn: 93986
2010-01-20 06:39:07 +00:00
Sean Callanan
4bb95fd7d6
Promoted the getTok() method to MCAsmParser so that
...
the two token accessor functions are declared consistently.
Modified the clients of MCAsmParser to reflect this change.
llvm-svn: 93916
2010-01-19 21:44:56 +00:00
Sean Callanan
985ff03e7d
Added a Lex function to the AsmParser, to allow handling
...
of include directives to occur within the parser itself.
This will break the lexer's dependency on a SourceMgr as
input.
llvm-svn: 93899
2010-01-19 20:22:31 +00:00
Chris Lattner
336c2b0d47
Generalize mcasmstreamer data emission APIs to take an address space
...
identifier. There is no way to work around it.
llvm-svn: 93896
2010-01-19 19:46:13 +00:00
Chris Lattner
f26d29e436
add a "MCStreamer::EmitFill" method, and move the default implementation
...
(which just iteratively emits bytes) to MCStreamer.
llvm-svn: 93888
2010-01-19 18:45:47 +00:00
Chris Lattner
dcd325e360
fix parsing .comm directives on systems which do not represent alignments
...
as a power of 2. This fixes MC/AsmParser/directive_comm.s
llvm-svn: 93867
2010-01-19 06:22:22 +00:00
Chris Lattner
d6b351119b
fix a bug in range information for $42, eliminate an
...
unneeded argument from ParseExpression.
llvm-svn: 93536
2010-01-15 19:39:23 +00:00
Chris Lattner
836cf5d129
extend MCAsmParser::ParseExpression and ParseParenExpression
...
to return range information for subexpressions. Use this to
provide range info for several new X86Operands.
llvm-svn: 93534
2010-01-15 19:28:38 +00:00
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