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

480 Commits

Author SHA1 Message Date
Evan Cheng
bfc0cac54d 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
561d71ce7b 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
9e8f90a020 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
2b69573e57 Revert accidental commit.
llvm-svn: 135059
2011-07-13 19:09:08 +00:00
Evan Cheng
ba4a50f10c 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
053ffe8109 Disassembler doesn't need TargetMachine anymore.
llvm-svn: 134920
2011-07-11 20:40:56 +00:00
Evan Cheng
1346a63a0f - 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
c9e252df68 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
50f2d8d304 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
dcd3ea7062 createMCInstPrinter doesn't need TargetMachine anymore.
llvm-svn: 134525
2011-07-06 19:45:42 +00:00
Evan Cheng
034261674b 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
b4dc8bdd22 Sink SubtargetFeature and TargetInstrItineraries (renamed MCInstrItineraries) into MC.
llvm-svn: 134049
2011-06-29 01:14:12 +00:00
Bill Wendling
1d4e48661b 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
88bb5d74ab 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
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
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
Daniel Dunbar
1f70368155 llvm-mc/Mach-O: Don't put assembler temporary labels in the symbol table.
- I moved section creation back into AsmParser. I think policy decisions like
   this should be pushed higher, not lower, when possible (in addition the
   assembler has flags which change this behavior, for example).

llvm-svn: 80162
2009-08-26 22:13:22 +00:00
Daniel Dunbar
e1f51a4fed llvm-mc: Make MCValue take const MCSymbol*s.
llvm-svn: 80078
2009-08-26 09:16:46 +00:00
Daniel Dunbar
a56aa7f5d6 llvm-mc: Make non-sensical max bytes to .align an error.
Also, warn about overflow in alignment values.

llvm-svn: 80077
2009-08-26 09:16:34 +00:00
Dan Gohman
53f0d68f87 Make LLVM command-line tools overwrite their output files without -f.
This is conventional command-line tool behavior. -f now just means
"enable binary output on terminals".

Add a -f option to llvm-extract and llvm-link, for consistency.

Remove F_Force from raw_fd_ostream and enable overwriting and
truncating by default. Introduce an F_Excl flag to permit users to
enable a failure when the file already exists. This flag is
currently unused.

Update Makefiles and documentation accordingly.

llvm-svn: 79990
2009-08-25 15:34:52 +00:00
Chris Lattner
f16d8ade4f Change raw_fd_ostream to take flags as an optional bitmask
instead of as two bools.  Use this to add a F_Append flag
which has the obvious behavior.

Other unrelated changes conflated into this patch:

1. REmove EH stuff from llvm-dis and llvm-as, the try blocks
   are dead.
2. Simplify the filename inference code in llvm-as/llvm-dis,
   because raw_fd_ostream does the right thing with '-'.
3. Switch machine verifier to use raw_ostream instead of ostream
   (Which is the thing that needed append in the first place).

llvm-svn: 79807
2009-08-23 02:51:22 +00:00
Chris Lattner
5d8af49626 Rename TargetAsmInfo (and its subclasses) to MCAsmInfo.
llvm-svn: 79763
2009-08-22 20:48:53 +00:00
Daniel Dunbar
2bb8df3b5d llvm-mc: Clean up some handling of symbol/section association to be more correct
(external was really undefined and there wasn't an explicit representation for
absolute symbols).
 - This still needs some cleanup to how the absolute "pseudo" section is dealt
   with, but I haven't figured out the nicest approach yet.

llvm-svn: 79733
2009-08-22 07:22:36 +00:00
Daniel Dunbar
15dbbf3644 llvm-mc: Improve handling of implicit alignment for magic section directives
(e.g., .objc_message_refs).
 - Just emit a .align when we see the directive; this isn't exactly what 'as'
   does but in practice it should be ok, at least for now. See FIXME.

llvm-svn: 79697
2009-08-21 23:30:15 +00:00
Daniel Dunbar
a64aa8d442 llvm-mc: In a .fill directive, still honor .align even if invalid maximum bytes
count is given (this matches 'as').

llvm-svn: 79683
2009-08-21 23:01:53 +00:00
Daniel Dunbar
fe93385495 llvm-mc: Accept .fill size of 8.
llvm-svn: 79635
2009-08-21 15:43:35 +00:00
Daniel Dunbar
7e81ff0f87 llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.

 - MCAssembler is the actual assembler backend, which is designed to have a
   reasonable API. This will eventually grow to support multiple object file
   implementations, but for now its Mach-O/i386 only.

 - MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
   e.g. converting the various directives into fragments, managing state like
   the current section, and so on.

 - llvm-mc will use the new backend via '-filetype=obj', which may eventually
   be, but is not yet, since I hear that people like assemblers which actually
   assemble.

 - The only thing that works at the moment is changing sections. For the time
   being I have a Python Mach-O dumping tool in test/scripts so this stuff can
   be easily tested, eventually I expect to replace this with a real LLVM tool.

 - More doxyments to come.

I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.

llvm-svn: 79612
2009-08-21 09:11:24 +00:00
Daniel Dunbar
d59019f7c8 llvm-mc: Various section parsing fixes.
- Add missing flags for various Objective-C sections.

 - Fix names for [non_]lazy_symbol_pointer (these are misspelled in the manual).

 - .symbol_stub does not have the self modifying code flag set (this appears to
   be wrong in the manual?).

 - Add implicit alignment values; not yet used.

Also, call MCStreamer::Finish at the end of a successful parse.

llvm-svn: 79611
2009-08-21 08:34:18 +00:00
Daniel Dunbar
090d824f0e Don't install llvm-mc by default.
llvm-svn: 79604
2009-08-21 07:28:33 +00:00
Daniel Dunbar
1ea5a59505 Fix a commento.
llvm-svn: 79427
2009-08-19 16:25:53 +00:00
Chris Lattner
69a19050c0 give MCAsmStreamer a TargetAsmInfo.
llvm-svn: 79222
2009-08-17 04:23:44 +00:00
Daniel Dunbar
4990c2b03d llvm-mc: Support escaped characters in string literals (for .ascii and .asciz)
llvm-svn: 79010
2009-08-14 18:19:52 +00:00
Daniel Dunbar
dc5840c57c Update llvm-mc / MCAsmStreamer to print the instruction using the actual target
specific printer (this only works on x86, for now).
 - This makes it possible to do some correctness checking of the parsing and
   matching, since we can compare the results of 'as' on the original input, to
   those of 'as' on the output from llvm-mc.

 - In theory, we could now have an easy ATT -> Intel syntax converter. :)

llvm-svn: 78986
2009-08-14 03:48:55 +00:00
Daniel Dunbar
da9a46b9de llvm-mc: Move MCAsmToken::getLoc() into MC library where it belongs.
llvm-svn: 78980
2009-08-14 02:18:40 +00:00
Daniel Dunbar
d4f20f9186 llvm-mc: Fix a crash on invalid due to a typo in relocatable expression
evaluation.

llvm-svn: 78692
2009-08-11 17:47:52 +00:00
Daniel Dunbar
8b8ee45c05 llvm-mc: Accept .word as a synonym for .short
llvm-svn: 78641
2009-08-11 04:44:00 +00:00
Daniel Dunbar
712f6f40ed llvm-mc: Honor -o option (and add -f).
llvm-svn: 78640
2009-08-11 04:34:48 +00:00
Daniel Dunbar
9c03cc13de llvm-mc: Sketch parsing for .file, .line, and .loc. No streamer hooks for these
yet (I'm not even sure what they do).

llvm-svn: 78639
2009-08-11 04:24:50 +00:00
Daniel Dunbar
677e05c42d llvm-mc: Fix darwin .section parsing. It was skipping the section name and a ','
(and outputting a diagnostic pointing at the wrong place), all of which lead to
much confusion.

llvm-svn: 78637
2009-08-11 03:42:33 +00:00
Chris Lattner
3e6da637f6 split MachO section handling stuff out to its out .h/.cpp file.
llvm-svn: 78576
2009-08-10 18:15:01 +00:00
Chris Lattner
f14da636ad add a fixme
llvm-svn: 78575
2009-08-10 18:05:55 +00:00
Chris Lattner
cc70d578be Make the big switch: Change MCSectionMachO to represent a section *semantically*
instead of syntactically as a string.  This means that it keeps track of the 
segment, section, flags, etc directly and asmprints them in the right format.
This also includes parsing and validation support for llvm-mc and 
"attribute(section)", so we should now start getting errors about invalid 
section attributes from the compiler instead of the assembler on darwin.

Still todo: 
1) Uniquing of darwin mcsections
2) Move all the Darwin stuff out to MCSectionMachO.[cpp|h]
3) there are a few FIXMEs, for example what is the syntax to get the
   S_GB_ZEROFILL segment type?

llvm-svn: 78547
2009-08-10 01:39:42 +00:00
Chris Lattner
9e2c3aa666 sink the 'name' and 'isdirective' state out of MCSection into its derived classes.
This totally optimizes PIC16 sections by not having an 'isdirective' bit anymore!! ;-)

llvm-svn: 78517
2009-08-08 23:39:42 +00:00
Chris Lattner
f8ab7ad73a switch this to create coff sections for now, it doesn't really matter for
llvm-mc's purpose yet and we'll want to switch to creating semantic sections
at some point.

llvm-svn: 78509
2009-08-08 22:38:48 +00:00
Benjamin Kramer
1b44e6e359 Always initialize AsmConds.
llvm-svn: 78463
2009-08-08 11:26:50 +00:00
Kevin Enderby
dd20299f97 Added Mac OS X assembler style conditional assembly. I may come back and see if
I can clean this up a bit more and do way with the TheCondState and just use
the top element on the TheCondStack if not empty.  Also may tweak the code
around ParseConditionalAssemblyDirectives() to simplify the AsmParser code.

llvm-svn: 78423
2009-08-07 22:46:00 +00:00
Daniel Dunbar
2781e4bd89 Remove now unused arguments from TargetRegistry::lookupTarget.
llvm-svn: 77950
2009-08-03 04:20:57 +00:00
Chris Lattner
506b49ffa0 Make SectionKind::get() private.
llvm-svn: 77835
2009-08-02 00:02:44 +00:00
Chris Lattner
944a154399 update for API change.
llvm-svn: 77804
2009-08-01 21:14:30 +00:00
Chris Lattner
04ae6629fe All MCSections are now required to have a SectionKind.
llvm-svn: 77787
2009-08-01 18:25:49 +00:00
Daniel Dunbar
7fd7e31119 llvm-mc: More quoted identifier support.
llvm-svn: 77761
2009-08-01 00:48:30 +00:00
Daniel Dunbar
e150b07b71 llvm-mc: Support quoted identifiers.
- Uses MCAsmToken::getIdentifier which returns the (sub)string representing the
   meaningfull contents a string or identifier token.

 - Directives aren't done yet.

llvm-svn: 77739
2009-07-31 21:55:09 +00:00
Chris Lattner
4d1b33e52e fix some more issues where we expected GetSection to do "get or create"
llvm-svn: 77700
2009-07-31 18:27:48 +00:00
Chris Lattner
dd53131aee fix a bunch of failing tests now that MCContext::GetSection doesn't create sections.
llvm-svn: 77689
2009-07-31 17:47:16 +00:00
Daniel Dunbar
48d0ed9534 Update CMakeLists
llvm-svn: 77385
2009-07-28 22:46:39 +00:00
Daniel Dunbar
4ed0e9b76c Move X86 instruction parsing into X86/AsmParser.
llvm-svn: 77384
2009-07-28 22:40:46 +00:00
Daniel Dunbar
ec1ea2e240 Make expression parsing and error/warning reporting available through the
generic MCAsmParser interface.

llvm-svn: 77381
2009-07-28 22:22:31 +00:00
Daniel Dunbar
d0d6b26e87 Provide generic MCAsmParser when constructing target specific parsers.
llvm-svn: 77362
2009-07-28 20:47:52 +00:00
Daniel Dunbar
20903ee1b9 Switch X86 assembly parser to using the generic lexer interface.
llvm-svn: 77341
2009-07-28 18:17:26 +00:00
Daniel Dunbar
6e2f7db6b6 Expose Tokens to target specific assembly parsers.
llvm-svn: 77337
2009-07-28 17:58:44 +00:00
Daniel Dunbar
45429b2b1e Switch AsmLexer::Lex to returning a reference to the current token.
llvm-svn: 77328
2009-07-28 16:56:42 +00:00
Daniel Dunbar
61ef1ddfb4 Drop some AsmLexer methods in favor of their AsmToken equivalents.
llvm-svn: 77323
2009-07-28 16:38:40 +00:00
Daniel Dunbar
1c373fc85a llvm-mc: Sink token enum into AsmToken.
llvm-svn: 77322
2009-07-28 16:08:33 +00:00
Daniel Dunbar
f7ad1ea8dd llvm-mc: Factor AsmToken class out of AsmLexer.
llvm-svn: 77292
2009-07-28 03:00:54 +00:00
Daniel Dunbar
9e627e8dc8 llvm-mc: Stop uniqueing string tokens, nothing actually uses this.
llvm-svn: 77287
2009-07-28 00:58:50 +00:00
Daniel Dunbar
3edfc4bb16 llvm-mc: Implement .abort fully in the front end
llvm-svn: 77272
2009-07-27 23:20:52 +00:00
Daniel Dunbar
5f73e9d3f8 llvm-mc: Move AsmLexer::getCurStrVal to StringRef based API.
- My DFS traversal of LLVM is, at least for now, nearly complete! :)

llvm-svn: 77258
2009-07-27 21:49:56 +00:00
Daniel Dunbar
a7a01acc7c Factor commonality in triple match routines into helper template for registering
classes, and migrate existing targets over.

llvm-svn: 77126
2009-07-26 05:03:33 +00:00
Daniel Dunbar
62e74f03c7 Add TargetRegistry::lookupTarget.
- This is a simplified mechanism which just looks up a target based on the
   target triple, with a few additional flags.

 - Remove getClosestStaticTargetForModule, the moral equivalent is now:
     lookupTarget(Mod->getTargetTriple, true, false, ...);

 - This no longer does the fuzzy matching with target data (based on endianness
   and pointer width) that getClosestStaticTargetForModule was doing, but this
   was deemed unnecessary.

llvm-svn: 77111
2009-07-26 02:12:58 +00:00
Daniel Dunbar
b5adc13728 Convert StringMap to using StringRef for its APIs.
- Yay for '-'s and simplifications!

 - I kept StringMap::GetOrCreateValue for compatibility purposes, this can
   eventually go away. Likewise the StringMapEntry Create functions still follow
   the old style.

 - NIFC.

llvm-svn: 76888
2009-07-23 18:17:34 +00:00
Kevin Enderby
f1c0daa6a7 Removed the DumpSymbolsandMacros and LoadSymbolsandMacros MCStreamer API as
the parsing of the .dump and .load should be done in the assembly parser and
not have any need for an MCStreamer API.  Changed the code for now so these
just produce an error saying these specific directives are not yet implemented
since they are likely no longer used and may never need to be implemented.

llvm-svn: 76462
2009-07-20 20:25:37 +00:00
Daniel Dunbar
2e4aeceacd Add MCAsmLexer interface.
- This provides the AsmLexer interface to the target specific assembly parsers.

llvm-svn: 76460
2009-07-20 20:01:54 +00:00
Daniel Dunbar
fca75cd98e Add MCAsmParser interface.
- This provides the AsmParser interface to the target specific assembly
   parsers.

llvm-svn: 76453
2009-07-20 18:55:04 +00:00
Daniel Dunbar
961c43b2b0 llvm-mc: Default -triple to LLVM_HOSTTRIPLE.
llvm-svn: 76260
2009-07-17 22:51:20 +00:00
Daniel Dunbar
ab1316fbaf llvm-mc: Add -triple, and start fetching the target asm printer.
llvm-svn: 76257
2009-07-17 22:38:58 +00:00
Kevin Enderby
f641ecc6e8 Removed the SubsectionsViaSymbols MCStreamer API and replaced it with a generic
EmitAssemblerFlag API which takes a value from the added AssemblerFlag
enumerated constants.

llvm-svn: 76087
2009-07-16 17:56:39 +00:00
Kevin Enderby
b5346feb10 Clean up the definition of Str in AsmParser::ParseDirectiveDarwinDumpOrLoad
so it is defined with a lifetime that is as short as possible.

llvm-svn: 76082
2009-07-16 17:17:46 +00:00
Chris Lattner
4939bd13ad implement .include in the lexer/parser instead of passing it into the streamer.
llvm-svn: 75896
2009-07-16 06:14:39 +00:00
Kevin Enderby
312f8559cb Added llvm-mc support for parsing the .dump and .load directives.
llvm-svn: 75786
2009-07-15 15:30:11 +00:00
Kevin Enderby
3e47cf1dda Added llvm-mc support for parsing the .include directive.
llvm-svn: 75711
2009-07-14 23:21:55 +00:00
Kevin Enderby
5821cee99b Added llvm-mc support for parsing the .lsym directive.
llvm-svn: 75685
2009-07-14 21:35:03 +00:00
Kevin Enderby
0b1331c43b Added llvm-mc support for parsing the .desc directive.
llvm-svn: 75645
2009-07-14 18:17:10 +00:00
Kevin Enderby
af095fcfb8 Added llvm-mc support for parsing the .abort directive.
llvm-svn: 75545
2009-07-13 23:15:14 +00:00
Kevin Enderby
a461788d6a add llvm-mc support for parsing the .subsections_via_symbols directive.
llvm-svn: 75500
2009-07-13 21:03:15 +00:00
Chris Lattner
1e7e5e5de0 silence vc++ warning.
llvm-svn: 75394
2009-07-11 22:32:37 +00:00
Chris Lattner
84bf9fed2b add support for .zerofill, patch by Kevin Enderby!
llvm-svn: 75301
2009-07-10 22:20:30 +00:00
Chris Lattner
56638bb644 add llvm-mc support for parsing the .lcomm directive, patch by Kevin Enderby!
llvm-svn: 75148
2009-07-09 17:25:12 +00:00
Chris Lattner
2bea79b45b Implement parsing support for the .comm directive. Patch by
Kevin Enderby!

llvm-svn: 74944
2009-07-07 20:30:46 +00:00
Chris Lattner
448c0a2708 implement error recovery in the llvm-mc parser. Feel the power!
llvm-svn: 74728
2009-07-02 21:53:43 +00:00
Daniel Dunbar
0afb18f239 llvm-mc/x86: Fix various nit-picky bugs in displacement parsing.
- Test case to follow.

llvm-svn: 74687
2009-07-02 02:26:39 +00:00
Daniel Dunbar
b87d6f328e llvm-mc/x86: Fix bug in disambiguation of displacement operand, introduced by me
(I think).
 - We weren't properly parsing the leading parenthesized expression in something
   like 'push (4)(%eax)'.
 
 - Added ParseParenRelocatableExpression to support this. I suspect we should
   just use lookahead, though.

 - Test case to follow.

llvm-svn: 74685
2009-07-02 02:09:07 +00:00
Daniel Dunbar
ffbf6228a2 llvm-mc/x86: Factor out ParseX86Register.
llvm-svn: 74684
2009-07-02 01:58:24 +00:00
Daniel Dunbar
7c83d0ed14 llvm-mc/x86: Rename X86Operand::ScaleReg to IndexReg and make order consistent
with syntax.

llvm-svn: 74679
2009-07-02 00:51:52 +00:00
Daniel Dunbar
351a228c46 llvm-mc: Add some more doxyments.
llvm-svn: 74607
2009-07-01 15:14:50 +00:00
Daniel Dunbar
f234f1f312 llvm-mc: Fill in the rest of tokens for 'as-lex' mode.
llvm-svn: 74598
2009-07-01 06:56:54 +00:00
Daniel Dunbar
7f47cc9423 Rename MCValue::isConstant to isAbsolute.
llvm-svn: 74596
2009-07-01 06:48:00 +00:00
Chris Lattner
db3d640a42 add some of the new tokens, others are still missing.
llvm-svn: 74595
2009-07-01 06:36:49 +00:00
Daniel Dunbar
1960440e70 llvm-mc: Emit parsed instructions to the MCStreamer.
llvm-svn: 74594
2009-07-01 06:35:48 +00:00
Daniel Dunbar
cae97fa7a9 llvm-mc: Introduce method to match a parsed x86 instruction into an MCInst.
llvm-svn: 74573
2009-06-30 23:38:38 +00:00
Daniel Dunbar
3f34774b4a llvm-mc: Accept relocatable expressions when parsing displacements and
immediates.

llvm-svn: 74568
2009-06-30 23:02:44 +00:00
Daniel Dunbar
d0589c59b3 llvm-mc: Symbols in a relocatable expression of the (a - b + cst) form are
allowed to be undefined when the expression is seen, we cannot enforce the
same-section requirement until the entire assembly file has been seen.

llvm-svn: 74565
2009-06-30 22:49:27 +00:00
Daniel Dunbar
f3f3e60b4f Suppress may-be-used-uninitialized warning.
llvm-svn: 74529
2009-06-30 16:02:47 +00:00
Douglas Gregor
2373782453 Fix CMake build
llvm-svn: 74527
2009-06-30 14:37:26 +00:00
Daniel Dunbar
2d92d62fb2 llvm-mc: Accept relocatable expressions for .org, assignments, .byte, etc.
llvm-svn: 74498
2009-06-30 02:10:03 +00:00
Daniel Dunbar
a702c280bb llvm-mc: Rewrite binary subtraction for relocatable expressions, we can't always
legally negate an MCValue.

llvm-svn: 74497
2009-06-30 02:08:27 +00:00
Daniel Dunbar
c3cac19cfe llvm-mc: Evaluation for relocatable expressions.
llvm-svn: 74496
2009-06-30 01:49:52 +00:00
Daniel Dunbar
5bec168037 Normalize SourceMgr messages.
- Don't print "Parsing" in front of every message.

 - Take additional "type" argument which is prepended to the message (with ": ")
   if given.

 - Update clients to print errors (warnings) as:
<filename>:<line number>: error(warning): ...

llvm-svn: 74489
2009-06-30 00:49:23 +00:00
Daniel Dunbar
e4fd18eda8 llvm-mc: Parse symbol attribute directives.
llvm-svn: 74487
2009-06-30 00:33:19 +00:00
Daniel Dunbar
72c0434597 llvm-mc: Parse .{,b,p2}align{,w,l} directives.
llvm-svn: 74478
2009-06-29 23:46:59 +00:00
Daniel Dunbar
37b8fe7db3 llvm-mc: Diagnose misuse (mix) of defined symbols and labels.
- For example, we diagnose errors on:
--
a:
a = 10
--

 - For now we reject code like:
--
.long a
a = 10
--
   which "as" accepts (on Darwin).

llvm-svn: 74476
2009-06-29 23:43:14 +00:00
Daniel Dunbar
fca88cf26b llvm-mc: Recognize C++ style comments.
llvm-svn: 74463
2009-06-29 22:00:57 +00:00
Daniel Dunbar
67828e6e0a llvm-mc: Recognize C++ style comments.
llvm-svn: 74462
2009-06-29 21:58:22 +00:00
Daniel Dunbar
8be858eeb4 Fix uninitialized variable warning.
llvm-svn: 74457
2009-06-29 21:14:21 +00:00
Daniel Dunbar
41782dbbcd MC: Improve expression parsing and implement evaluation of absolute expressions
(missed files).

llvm-svn: 74450
2009-06-29 20:40:36 +00:00
Daniel Dunbar
ade4f03bd0 MC: Improve expression parsing and implement evaluation of absolute expressions.
llvm-svn: 74448
2009-06-29 20:37:27 +00:00