Commit Graph

165 Commits

Author SHA1 Message Date
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
Daniel Dunbar 96abad185d llvm-mc: Emit .lcomm as .zerofill.
llvm-svn: 80343
2009-08-28 05:48:46 +00:00
Daniel Dunbar e48a69b2a3 llvm-mc: Unique zero fill sections.
llvm-svn: 80342
2009-08-28 05:48:29 +00:00
Daniel Dunbar 8d38b8d20c 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 ba33ff294e llvm-mc: Unique sections in .zerofill.
llvm-svn: 80305
2009-08-27 23:45:06 +00:00
Daniel Dunbar c7c5f9fa86 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 d18dd1d5f8 llvm-mc: Only show instruction encodings with --show-encoding.
llvm-svn: 80230
2009-08-27 07:56:39 +00:00
Daniel Dunbar 81cb753298 llvm-mc: Tweak MCCodeEmitter skeleton.
llvm-svn: 80193
2009-08-27 01:34:22 +00:00
Daniel Dunbar 65105174a6 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 4d7b2e3307 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 e73b267301 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 90398bd222 llvm-mc: Make MCValue take const MCSymbol*s.
llvm-svn: 80078
2009-08-26 09:16:46 +00:00
Daniel Dunbar 18f3c9b994 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 61a8796ddb 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 9e6f1f160a 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 7b26fce23e Rename TargetAsmInfo (and its subclasses) to MCAsmInfo.
llvm-svn: 79763
2009-08-22 20:48:53 +00:00
Daniel Dunbar 6860ac7375 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 67dfb1de23 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 4abcccb965 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 8e5edd81bb llvm-mc: Accept .fill size of 8.
llvm-svn: 79635
2009-08-21 15:43:35 +00:00
Daniel Dunbar 3016db39dd 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 9df5f33818 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 ad8b653f93 Don't install llvm-mc by default.
llvm-svn: 79604
2009-08-21 07:28:33 +00:00
Daniel Dunbar 5c947db79c Fix a commento.
llvm-svn: 79427
2009-08-19 16:25:53 +00:00