Evan Cheng
61faa55b74
Separate MCInstPrinter registration from AsmPrinter registration.
...
llvm-svn: 135974
2011-07-25 21:20:24 +00:00
Evan Cheng
f60768a14e
Fix last bits of MC layer issues. llvm-mc doesn't need to initialize TargetMachine's anymore.
...
llvm-svn: 135963
2011-07-25 20:53:02 +00:00
Evan Cheng
f2596bc62a
Move TargetAsmParser.h TargetAsmBackend.h and TargetAsmLexer.h to MC where they belong.
...
llvm-svn: 135833
2011-07-23 00:45:41 +00:00
Evan Cheng
8c886a40d2
Combine all MC initialization routines into one. e.g. InitializeX86MCAsmInfo,
...
InitializeX86MCInstrInfo, etc. are combined into InitializeX86TargetMC.
llvm-svn: 135812
2011-07-22 21:58:54 +00:00
Chandler Carruth
2d71c421f9
Move the registered target printing in version strings completely out of
...
the Support library. Now its part of the TargetRegistry, and the three
commands that care about this explicitly register this extra bit of
version information.
The set of commands which care was computed by intersecting those which
use the Support library's version string printing and those that
initialize all the registered targets in a way that produces
a meaningful list. The only odd ball out is that 'clang -cc1as -version'
no longer prints the registered targets. I don't think anyone is really
interested in that (especially as the fact that llvm-mc does so is under
a FIXME), but if someone really does want this back I'll happily apply
the same patch there.
llvm-svn: 135757
2011-07-22 07:50:48 +00:00
Evan Cheng
bbf3b0de8b
Goodbye TargetAsmInfo. This eliminate last bit of CodeGen and Target in llvm-mc.
...
There is still a bit more refactoring left to do in Targets. But we are now very
close to fixing all the layering issues in MC.
llvm-svn: 135611
2011-07-20 19:50:42 +00:00
Evan Cheng
efd9b4240f
- Move CodeModel from a TargetMachine global option to MCCodeGenInfo.
...
- Introduce JITDefault code model. This tells targets to set different default
code model for JIT. This eliminates the ugly hack in TargetMachine where
code model is changed after construction.
llvm-svn: 135580
2011-07-20 07:51:56 +00:00
Evan Cheng
76792992d6
Add MCObjectFileInfo and sink the MCSections initialization code from
...
TargetLoweringObjectFileImpl down to MCObjectFileInfo.
TargetAsmInfo is done to one last method. It's *almost* gone!
llvm-svn: 135569
2011-07-20 05:58:47 +00:00
Evan Cheng
2129f59637
Introduce MCCodeGenInfo, which keeps information that can affect codegen
...
(including compilation, assembly). Move relocation model Reloc::Model from
TargetMachine to MCCodeGenInfo so it's accessible even without TargetMachine.
llvm-svn: 135468
2011-07-19 06:37:02 +00:00
Evan Cheng
d60fa58ba1
Sink getDwarfRegNum, getLLVMRegNum, getSEHRegNum from TargetRegisterInfo down
...
to MCRegisterInfo. Also initialize the mapping at construction time.
This patch eliminate TargetRegisterInfo from TargetAsmInfo. It's another step
towards fixing the layering violation.
llvm-svn: 135424
2011-07-18 20:57:22 +00:00
Evan Cheng
1705ab00ab
Rename createAsmInfo to createMCAsmInfo and move registration code to MCTargetDesc to prepare for next round of changes.
...
llvm-svn: 135219
2011-07-14 23:50:31 +00:00
Evan Cheng
d78e0c22fb
Revert accidental commit.
...
llvm-svn: 135059
2011-07-13 19:09:08 +00:00
Evan Cheng
b94674b325
It's not safe to fold (fptrunc (sqrt (fpext x))) to (sqrtf x) if there is another use of sqrt. rdar://9763193
...
llvm-svn: 135058
2011-07-13 19:08:16 +00:00
Evan Cheng
af645a2356
Disassembler doesn't need TargetMachine anymore.
...
llvm-svn: 134920
2011-07-11 20:40:56 +00:00
Evan Cheng
c5e6d2f519
- Eliminate MCCodeEmitter's dependency on TargetMachine. It now uses MCInstrInfo
...
and MCSubtargetInfo.
- Added methods to update subtarget features (used when targets automatically
detect subtarget features or switch modes).
- Teach X86Subtarget to update MCSubtargetInfo features bits since the
MCSubtargetInfo layer can be shared with other modules.
- These fixes .code 16 / .code 32 support since mode switch is updated in
MCSubtargetInfo so MC code emitter can do the right thing.
llvm-svn: 134884
2011-07-11 03:57:24 +00:00
Evan Cheng
91111d2706
Change createAsmParser to take a MCSubtargetInfo instead of triple,
...
CPU, and feature string. Parsing some asm directives can change
subtarget state (e.g. .code 16) and it must be reflected in other
modules (e.g. MCCodeEmitter). That is, the MCSubtargetInfo instance
must be shared.
llvm-svn: 134795
2011-07-09 05:47:46 +00:00
Evan Cheng
4d1ca96bfc
Eliminate asm parser's dependency on TargetMachine:
...
- Each target asm parser now creates its own MCSubtatgetInfo (if needed).
- Changed AssemblerPredicate to take subtarget features which tablegen uses
to generate asm matcher subtarget feature queries. e.g.
"ModeThumb,FeatureThumb2" is translated to
"(Bits & ModeThumb) != 0 && (Bits & FeatureThumb2) != 0".
llvm-svn: 134678
2011-07-08 01:53:10 +00:00
Evan Cheng
ab37af9af3
createMCInstPrinter doesn't need TargetMachine anymore.
...
llvm-svn: 134525
2011-07-06 19:45:42 +00:00
Evan Cheng
fe6e405e8c
Fix the ridiculous SubtargetFeatures API where it implicitly expects CPU name to
...
be the first encoded as the first feature. It then uses the CPU name to look up
features / scheduling itineray even though clients know full well the CPU name
being used to query these properties.
The fix is to just have the clients explictly pass the CPU name!
llvm-svn: 134127
2011-06-30 01:53:36 +00:00
Evan Cheng
8264e272a9
Sink SubtargetFeature and TargetInstrItineraries (renamed MCInstrItineraries) into MC.
...
llvm-svn: 134049
2011-06-29 01:14:12 +00:00
Bill Wendling
b74b9de151
Use the verbose asm flag instead of a new flag for decoding the LSDA.
...
llvm-svn: 133292
2011-06-17 20:55:01 +00:00
Bill Wendling
e303114b3c
Add an option that allows one to "decode" the LSDA.
...
The LSDA is a bit difficult for the non-initiated to read. Even with comments,
it's not always clear what's going on. This wraps the ASM streamer in a class
that retains the LSDA and then emits a human-readable description of what's
going on in it.
So instead of having to make sense of:
Lexception1:
.byte 255
.byte 155
.byte 168
.space 1
.byte 3
.byte 26
Lset0 = Ltmp7-Leh_func_begin1
.long Lset0
Lset1 = Ltmp812-Ltmp7
.long Lset1
Lset2 = Ltmp913-Leh_func_begin1
.long Lset2
.byte 3
Lset3 = Ltmp812-Leh_func_begin1
.long Lset3
Lset4 = Leh_func_end1-Ltmp812
.long Lset4
.long 0
.byte 0
.byte 1
.byte 0
.byte 2
.byte 125
.long __ZTIi@GOTPCREL+4
.long __ZTIPKc@GOTPCREL+4
you can read this instead:
## Exception Handling Table: Lexception1
## @LPStart Encoding: omit
## @TType Encoding: indirect pcrel sdata4
## @TType Base: 40 bytes
## @CallSite Encoding: udata4
## @Action Table Size: 26 bytes
## Action 1:
## A throw between Ltmp7 and Ltmp812 jumps to Ltmp913 on an exception.
## For type(s): __ZTIi@GOTPCREL+4 __ZTIPKc@GOTPCREL+4
## Action 2:
## A throw between Ltmp812 and Leh_func_end1 does not have a landing pad.
llvm-svn: 133286
2011-06-17 20:35:21 +00:00
Jim Grosbach
112a2de78c
Tidy up. 80-column and whitespace.
...
llvm-svn: 131094
2011-05-09 20:05:25 +00:00
Rafael Espindola
a3181d12c6
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
7ccf375622
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
4ee0d03274
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
00f0cddfd4
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
c053644217
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
be81988c99
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
5b23294799
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
b3eca9bb71
Add support for the --noexecstack option.
...
llvm-svn: 124077
2011-01-23 17:55:27 +00:00
Rafael Espindola
9f9a10691a
Correctly disassemble truncated asm.
...
Patch by Richard Simth.
llvm-svn: 122962
2011-01-06 16:48:42 +00:00
Michael J. Spencer
39a0ffc394
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
ecd0c8a557
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
0a017a6db2
Fixed version of 121434 with no new memory leaks.
...
llvm-svn: 121471
2010-12-10 07:39:47 +00:00
Rafael Espindola
a945a34c73
Revert my previous patch to make the valgrind bots happy.
...
llvm-svn: 121461
2010-12-10 04:01:09 +00:00
Rafael Espindola
56eb741237
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
7b6fef82d4
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
447762da85
Merge System into Support.
...
llvm-svn: 120298
2010-11-29 18:16:10 +00:00
Che-Liang Chiou
345b98eddd
Add registry hook for assembly text output
...
llvm-svn: 118394
2010-11-08 02:21:17 +00:00
Jim Grosbach
685b77332c
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
1601f55615
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
0df7ea4c24
Move tool_output_file into its own file.
...
llvm-svn: 115973
2010-10-07 20:32:40 +00:00
Benjamin Kramer
c758311025
Push twines deeper into SourceMgr's error handling methods.
...
llvm-svn: 114847
2010-09-27 17:42:11 +00:00
Daniel Dunbar
3068a93dc1
MC/Lexer: Add 'Real' token type for floating point literals.
...
llvm-svn: 114718
2010-09-24 01:59:31 +00:00
Daniel Dunbar
25c2c6293d
llvm-mc: Teach -as-lex to print more token kinds.
...
llvm-svn: 114051
2010-09-16 00:42:35 +00:00
Michael J. Spencer
93c9b2ea93
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
dc38d36ccb
CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally.
...
llvm-svn: 113632
2010-09-10 21:14:25 +00:00
Dan Gohman
a2233f2801
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
d39d2aad3f
tidy up
...
llvm-svn: 112385
2010-08-28 20:34:35 +00:00
Duncan Sands
3bd97fec8f
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
268b0f4781
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
2eca0252c3
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
a3e0ddb564
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
979634bbb0
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
419197cc4d
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
7f5bf5ae2a
MC: Move several clients to using AsmParser constructor function.
...
llvm-svn: 108645
2010-07-18 18:31:33 +00:00
Daniel Dunbar
7a85f9cf4d
llvm-mc: Fix llvm-mc -as-lex.
...
llvm-svn: 108644
2010-07-18 18:31:28 +00:00
Daniel Dunbar
02877d6e85
MC: Pass the target instance to the AsmParser constructor.
...
llvm-svn: 107426
2010-07-01 20:41:56 +00:00
Daniel Dunbar
70883c32ec
llvm-mc: Don't set NO_INSTALL on llvm-mc.
...
llvm-svn: 105837
2010-06-11 22:00:08 +00:00
Dan Gohman
174f57668f
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
3ff1a06de6
MC: Add an MCLoggingStreamer, for use in debugging integrated-as mismatches.
...
llvm-svn: 104463
2010-05-23 17:44:06 +00:00
Matt Fleming
638cdb2db1
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
e85262d651
Remove dead option.
...
llvm-svn: 104303
2010-05-21 00:27:55 +00:00
Sean Callanan
d7f09c7851
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
4cd930f417
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
8af6f765f5
Add CMake support for 'edis'.
...
llvm-svn: 101177
2010-04-13 20:52:50 +00:00
Chris Lattner
6b2b064d7a
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
2d03d3a8a7
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
55ddc30f07
revert r100842 which broke several of the build bots.
...
llvm-svn: 100848
2010-04-09 04:24:20 +00:00
Sean Callanan
844a7febd3
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
3d18e71ae8
tidy #includes.
...
llvm-svn: 100489
2010-04-05 23:07:18 +00:00
Chris Lattner
7012916275
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
9f59b3dd9b
remove some extraneous casts
...
llvm-svn: 100287
2010-04-03 21:03:50 +00:00
Daniel Dunbar
d821f4ac60
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
b09b8906cb
llvm-mc: Support -filetype=null, for timing purposes.
...
llvm-svn: 99349
2010-03-23 23:47:12 +00:00
Daniel Dunbar
d9d5b315ab
llvm-mc: Fix MCInstPrinter memory leaks.
...
llvm-svn: 99101
2010-03-20 22:36:35 +00:00
Daniel Dunbar
c5621ed07a
llvm-mc: Fix memory leak of MCAsmInfo.
...
llvm-svn: 99098
2010-03-20 22:36:25 +00:00
Daniel Dunbar
abf6e3657e
llvm-mc: Fix target selection for --disassemble to use GetTarget.
...
llvm-svn: 98973
2010-03-19 18:07:50 +00:00
Chris Lattner
90a7859ebc
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
144873437c
llvm-mc: Delete output files on error.
...
llvm-svn: 98445
2010-03-13 19:31:47 +00:00
Daniel Dunbar
322fec671b
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
4689211583
llvm-mc: Support -arch as a simplified form of -triple.
...
llvm-svn: 98417
2010-03-13 02:20:38 +00:00
Chris Lattner
ac77bf5d1e
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
768ea2add2
change MCContext to always have an MCAsmInfo.
...
llvm-svn: 98293
2010-03-11 22:53:35 +00:00
Daniel Dunbar
c5ddbad237
MC: Provide MCAssembler with a TargetAsmBackend.
...
llvm-svn: 98222
2010-03-11 01:34:27 +00:00
Chris Lattner
741580a5bd
give MCCodeEmitters access to the current MCContext.
...
llvm-svn: 96038
2010-02-12 23:12:47 +00:00
Daniel Dunbar
75c9a4eeae
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
9a0a46163d
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
e3ee332fe0
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
6a6f9cc634
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
823aed16f9
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
0522eb2160
pass "-fasm-verbose" into createAsmStreamer.
...
llvm-svn: 94165
2010-01-22 07:06:15 +00:00
Chris Lattner
7ba0661f27
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
5b0e01c54e
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
00646cfbd4
create a new MCParser library and move some stuff into it.
...
llvm-svn: 94129
2010-01-22 01:44:57 +00:00
Chris Lattner
6401c883c4
remove some confused code that used strtoull
...
llvm-svn: 94128
2010-01-22 01:17:12 +00:00
Sean Callanan
7a77eae2f3
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
177934e021
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
1a0eeb6e06
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
70855e42e6
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
38caaf14c1
give createAsmStreamer an 'isLittleEndian' argument.
...
llvm-svn: 93986
2010-01-20 06:39:07 +00:00
Sean Callanan
936b0d3144
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
686ed8d248
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
c35681b298
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
0c65fd4902
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
ab9cd3e132
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
e17df0b7f0
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
528d00b913
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
14bf521792
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
f29c0b6880
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
77fd677111
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
ae606a1d1d
Mark some debug variables as 'unused' to quiet compiler and analyzer.
...
llvm-svn: 92183
2009-12-28 01:34:57 +00:00
Chris Lattner
b257d24f62
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
e3437b33f5
just discard the debug output from the disassembler.
...
llvm-svn: 91933
2009-12-22 22:47:43 +00:00
Chris Lattner
778f92ab02
specify what is invalid about it
...
llvm-svn: 91901
2009-12-22 07:03:21 +00:00
Chris Lattner
502f0f11e0
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
dd0c01b5de
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
8879918722
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
dc9845b79a
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
72cbaa2ecb
don't crash on blank lines, rename some variables.
...
llvm-svn: 91892
2009-12-22 06:24:00 +00:00
Chandler Carruth
187220e3f5
Update CMake build to include HexDisassembler.cpp.
...
llvm-svn: 91589
2009-12-17 06:35:17 +00:00
Sean Callanan
7e64550747
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
e0856c5f40
Line this up as well.
...
llvm-svn: 85748
2009-11-01 22:08:51 +00:00
Nick Lewycky
b244909ad4
Fix whitespace.
...
llvm-svn: 85747
2009-11-01 22:07:54 +00:00
Chandler Carruth
56869f22c4
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
c3bd60e393
MC: Remove unneeded context argument to MCExpr::Evaluate*.
...
llvm-svn: 84233
2009-10-16 01:57:52 +00:00
Daniel Dunbar
5f339244fb
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
d20cda028a
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
351a7ef01a
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
10a1cfd0f9
avoid copying MCAsmInfo by value, add an (extremely low prio) fixme.
...
llvm-svn: 82911
2009-09-27 19:38:39 +00:00
Chris Lattner
4479034537
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
ecd879a2d5
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
c6a889d0b6
use an accessor to simplify code.
...
llvm-svn: 81997
2009-09-16 04:12:47 +00:00
Chris Lattner
11b2fc9ea4
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
ce4bec8e0c
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
a944234a1e
MC: Give target specific parsers access to the MCStreamer.
...
llvm-svn: 81416
2009-09-10 00:59:15 +00:00
Benjamin Kramer
63951ada31
Fix an integer truncation noticed by MSVC.
...
llvm-svn: 81109
2009-09-06 09:35:10 +00:00
Kevin Enderby
9c0f7fc746
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
f92f9909c4
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
7d91218c75
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
41bf56de79
TAI -> MAI
...
llvm-svn: 80899
2009-09-03 06:13:54 +00:00
Daniel Dunbar
897ffadd2d
llvm-mc: Pass values to MCStreamer as MCExprs, not MCValues.
...
llvm-svn: 80578
2009-08-31 08:09:28 +00:00
Daniel Dunbar
b7b2097aac
llvm-mc: Simplify EmitAssignment ('.set' is identical to '=').
...
llvm-svn: 80577
2009-08-31 08:09:09 +00:00
Daniel Dunbar
b12b33051d
llvm-mc: Remove MCAsmParser::Parse[Paren]RelocatableExpression.
...
llvm-svn: 80576
2009-08-31 08:08:50 +00:00
Daniel Dunbar
7c82d56930
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
940cda2590
llvm-mc: Add MCAsmParser::getContext.
...
llvm-svn: 80571
2009-08-31 08:07:44 +00:00
Daniel Dunbar
f363645da2
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
115e4d6d7b
llvm-mc: Move AsmExpr into MC lib (as MCExpr).
...
llvm-svn: 80567
2009-08-31 08:06:59 +00:00
Daniel Dunbar
6a715dccdf
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