Kevin Enderby
a71ab07e14
Change the parsing of .loc back to allow the LineNumber field to be optional as
...
it is with other assemblers.
llvm-svn: 111967
2010-08-24 21:14:47 +00:00
Kevin Enderby
1264b7cab8
First bit of support for the dwarf .loc directive. This patch updates the
...
needed parsing for the .loc directive and saves the current info from that
into the context. The next patch will take the current loc info after an
instruction is assembled and save that info into a vector for each section for
use to build the line number tables. The patch after that will encode the info
from those vectors into the output file as the dwarf line tables.
llvm-svn: 111956
2010-08-24 20:32:42 +00:00
Daniel Dunbar
2476432639
MC/AsmParser: Change ParseExpression to use ParseIdentifier(), to support
...
dollars in identifiers.
llvm-svn: 111946
2010-08-24 19:13:42 +00:00
Daniel Dunbar
3b96ffdac1
MC/Parser: Accept leading dollar signs in identifiers.
...
- Implemented by manually splicing the tokens. If this turns out to be
problematically platform specific, a more elegant solution would be to
implement some context dependent lexing support.
llvm-svn: 111934
2010-08-24 18:12:12 +00:00
Daniel Dunbar
2ecc3bb4f7
MC/AsmParser: Push the burdon of emitting diagnostics about unmatched
...
instructions onto the target specific parser, which can do a better job.
llvm-svn: 110889
2010-08-12 00:55:38 +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
Daniel Dunbar
d215976208
MC/AsmParser: Fix a bug in macro argument parsing, which was dropping
...
parentheses from argument lists.
llvm-svn: 110692
2010-08-10 17:38:52 +00:00
Daniel Dunbar
b759a13da8
MC: Destroy Macro instances.
...
llvm-svn: 109720
2010-07-29 01:51:55 +00:00
Kevin Enderby
e5930f142a
Added first bit of support for the dwarf .file directive. This patch collects
...
the info from the .file directive and makes file and directory tables that
will eventually be put out as part of the dwarf info in the output file.
llvm-svn: 109651
2010-07-28 20:55:35 +00:00
Eli Friedman
20b026464e
Make .align parse correctly on platforms where .align is measured in bytes.
...
llvm-svn: 108674
2010-07-19 04:17:25 +00:00
Daniel Dunbar
8897d479b5
MC/AsmParser: Stop playing unsafe member function pointer calls, this isn't
...
portable enough.
- Downside is we now double dispatch through a stub function, but this isn't
performance critical.
llvm-svn: 108661
2010-07-18 22:22:07 +00:00
Daniel Dunbar
40a564f09f
MC/AsmParser: Fix .abort and .secure_log_unique to accept arbitrary token
...
sequences, not just strings.
llvm-svn: 108655
2010-07-18 20:15:59 +00:00
Daniel Dunbar
6fb1c3ad8a
MC/AsmParser: Add macro argument substitution support.
...
llvm-svn: 108654
2010-07-18 19:00:10 +00:00
Daniel Dunbar
4323571efb
MC/AsmParser: Add basic support for macro instantiation.
...
llvm-svn: 108653
2010-07-18 18:54:11 +00:00
Daniel Dunbar
c1f58ec83c
MC/AsmParser: Add basic parsing support for .macro definitions.
...
llvm-svn: 108652
2010-07-18 18:47:21 +00:00
Daniel Dunbar
828984ff4e
MC/AsmParser: Add .macros_{off,on} support, not that makes sense since we don't
...
support macros.
llvm-svn: 108649
2010-07-18 18:38:02 +00:00
Daniel Dunbar
d8a1845c31
MC/AsmParser: Use Error() instead of calling PrintMessage() directly.
...
llvm-svn: 108648
2010-07-18 18:31:45 +00:00
Daniel Dunbar
2a2c6cf5f9
MC/AsmParser: Hide the AsmParser implementation.
...
llvm-svn: 108646
2010-07-18 18:31:38 +00:00
Daniel Dunbar
01e3607d70
MC/AsmParser: Lift Run() and TargetParser to base class.
...
Also, add constructor function for creating AsmParser instances.
llvm-svn: 108604
2010-07-17 02:26:10 +00:00
Chris Lattner
c2b3675f8b
fix indentation and 80 cols
...
llvm-svn: 108460
2010-07-15 21:19:31 +00:00
Benjamin Kramer
92d8998348
Don't pass StringRef by reference.
...
llvm-svn: 108366
2010-07-14 22:38:02 +00:00
Daniel Dunbar
ab058b83e0
MC/AsmParser: Move ELF specific parser to ELFAsmParser.cpp.
...
llvm-svn: 108196
2010-07-12 21:23:32 +00:00
Daniel Dunbar
0cb91cfc74
MC/AsmParser: Move Darwin specific parse to DarwinAsmParser.cpp.
...
llvm-svn: 108193
2010-07-12 20:51:51 +00:00
Daniel Dunbar
a5bf6b6001
MC/AsmParser: Move .section parsing to Darwin specific parser.
...
llvm-svn: 108190
2010-07-12 20:42:34 +00:00
Daniel Dunbar
aa59cf2686
MC/AsmParser: Move special section directive parsing to Darwin specific parser.
...
llvm-svn: 108187
2010-07-12 20:23:36 +00:00
Daniel Dunbar
80be44a2ac
MC/AsmParser: Add a basic ELFAsmParser extension.
...
llvm-svn: 108185
2010-07-12 20:08:04 +00:00
Daniel Dunbar
101c14c940
MC/AsmParser: Inline AsmParser::CreateSymbol into callers.
...
llvm-svn: 108183
2010-07-12 19:52:10 +00:00
Daniel Dunbar
d388c93f87
MC/AsmParser: Move .tbss and .zerofill parsing to Darwin specific parser.
...
llvm-svn: 108180
2010-07-12 19:37:35 +00:00
Daniel Dunbar
63a379dd5c
MC/AsmParser: Move .desc parsing to Darwin specific parser.
...
llvm-svn: 108179
2010-07-12 19:22:53 +00:00
Daniel Dunbar
b992f1a95b
MC/AsmParser: Move .lsym parsing to Darwin specific parser.
...
llvm-svn: 108176
2010-07-12 19:08:25 +00:00
Daniel Dunbar
ae9da1481a
MC/AsmParser: Move some misc. Darwin directive handling to DarwinAsmParser.
...
llvm-svn: 108174
2010-07-12 18:49:22 +00:00
Daniel Dunbar
c5011088cd
MC/AsmParser: Add a DarwinAsmParser extension.
...
- Currently initialization is a bit of a hack, but harmless. We need to rework
various parts of target initialization to clean this up.
llvm-svn: 108165
2010-07-12 18:12:02 +00:00
Daniel Dunbar
dd41dcf270
MC/AsmParser: Switch a bunch of directive parsing to use accessors.
...
llvm-svn: 108163
2010-07-12 18:03:11 +00:00
Daniel Dunbar
86033407c9
MCAsmParser: Pull some directive handling out into a helper class, and change
...
DirectiveMap to be based on MCAsmParserExtension.
llvm-svn: 108161
2010-07-12 17:54:38 +00:00
Daniel Dunbar
cc21af1dfb
MC/AsmParser: Switch some directive parsing to use accessor methods.
...
llvm-svn: 108160
2010-07-12 17:45:27 +00:00
Daniel Dunbar
af3d1de891
MC: Add MCAsmParserExtension, a base class for all the target/object specific
...
classes which want to extend the basic asm parser.
llvm-svn: 108158
2010-07-12 17:27:45 +00:00
Daniel Dunbar
4be8f2ffad
MC: Move AsmParser::TokError to MCAsmParser().
...
llvm-svn: 108155
2010-07-12 17:18:45 +00:00
Duncan Sands
41b4a6b36a
Convert some tab stops into spaces.
...
llvm-svn: 108130
2010-07-12 08:16:59 +00:00
Kevin Enderby
082d0fd7ad
Added the darwin .weak_def_can_be_hidden directive.
...
llvm-svn: 107886
2010-07-08 17:22:42 +00:00
Daniel Dunbar
0e980755d3
MC: Fix some stray hunks I didn't intend to commit.
...
llvm-svn: 107428
2010-07-01 20:48:51 +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
0aa4365e47
MC: Fix an error message.
...
llvm-svn: 107424
2010-07-01 20:20:01 +00:00
Duncan Sands
5667a08468
Remove unused calls to Lexer.getLoc and the pointless variable HasFillExpr.
...
llvm-svn: 107136
2010-06-29 13:24:40 +00:00
Kevin Enderby
e233dda2e2
Added the darwin .secure_log_unique and .secure_log_reset directives.
...
llvm-svn: 107077
2010-06-28 21:45:58 +00:00
Daniel Dunbar
6738a2e39e
llvm-mc: Use EmitIntValue where possible, which makes the API calls from the AsmParser and CodeGen line up better.
...
llvm-svn: 104467
2010-05-23 18:36:38 +00:00
Daniel Dunbar
8271d1bb4a
llvm-mc: Use AddBlankLine in asm parser. This makes transliteration match the input much more closely, and also makes the API calls from the AsmParser and CodeGen line up better.
...
llvm-svn: 104466
2010-05-23 18:36:34 +00:00
Matt Fleming
ec9d6faef0
Add support for parsing the ELF .type assembler directive.
...
llvm-svn: 104316
2010-05-21 11:36:59 +00:00
Chris Lattner
7cbfa4462f
fix rdar://7986634 - match instruction opcodes case insensitively.
...
llvm-svn: 104183
2010-05-19 23:34:33 +00:00
Eric Christopher
5c87be766d
Make EmitTBSSSymbol take a section argument so that we can find it later.
...
Fix up callers and users.
llvm-svn: 104057
2010-05-18 21:16:04 +00:00
Kevin Enderby
0510b48fd9
Added support in MC for Directional Local Labels.
...
llvm-svn: 103989
2010-05-17 23:08:19 +00:00
Eric Christopher
9635b3da6b
More data/parsing support for tls directives. Add a few more testcases
...
and cleanup comments as well.
llvm-svn: 103985
2010-05-17 22:53:55 +00:00
Daniel Dunbar
bb166bed40
MC/Mach-O/x86: Optimal nop sequences should only be used for the .text sections, not all sections in the text segment.
...
llvm-svn: 103981
2010-05-17 21:54:30 +00:00
Daniel Dunbar
9b4a824217
llvm-mc: Support reassignment of variables in one special case, when the
...
variable has not yet been used in an expression. This allows us to support a few
cases that show up in real code (mostly because gcc generates it for Objective-C
on Darwin), without giving up a reasonable semantic model for assignment.
llvm-svn: 103950
2010-05-17 17:46:23 +00:00
Eric Christopher
68b1bbe66a
Assume that we'll handle mangling the symbols earlier and just put the
...
symbol to the file as we have it. Simplifies out tbss handling.
llvm-svn: 103928
2010-05-17 02:13:02 +00:00
Eric Christopher
9fb6bb07ca
Add AsmParser support for darwin tbss directive.
...
Nothing uses this yet.
llvm-svn: 103757
2010-05-14 01:50:28 +00:00
Eric Christopher
bc81885ff7
Fix a couple of typos.
...
llvm-svn: 103756
2010-05-14 01:38:54 +00:00
Chris Lattner
8cb4728a15
fix rdar://7965971 and a fixme: use ParseIdentifier in
...
ParseDirectiveDarwinZerofill instead of hard coding the
check for identifier. This allows quoted symbol names to
be used.
llvm-svn: 103682
2010-05-13 00:10:34 +00:00
Daniel Dunbar
deb7ba9cc0
MC: Reject attempts to define a variable symbol.
...
llvm-svn: 103111
2010-05-05 19:01:00 +00:00
Daniel Dunbar
7a989da0af
MC: Rename MCSymbol::{g,s}etValue -> MCSymbol::{g,s}etVariableValue.
...
llvm-svn: 103095
2010-05-05 17:41:00 +00:00
Daniel Dunbar
ce0c1e11ce
llvm-mc: Fix case were we would skip a line in the .s file after an instruction
...
match failure.
Also, fixes a few memory leak FIXMEs.
llvm-svn: 102986
2010-05-04 00:33:07 +00:00
Chris Lattner
926885c090
refactor .if handling code a bit.
...
llvm-svn: 101659
2010-04-17 18:14:27 +00:00
Chris Lattner
6b55cb9cd8
implement mc asmparser support for '.', which gets the
...
current PC. rdar://7834775
We now produce an identical .o file compared to the cctools
assembler for something like this:
_f0:
L0:
jmp L1
.long . - L0
L1:
jmp A
.long . - L1
.zerofill __DATA,_bss,A,0
llvm-svn: 101227
2010-04-14 04:40:28 +00:00
Chris Lattner
2073112fc0
move macho section uniquing from MCParser and TLOF to MCContext where
...
the compiler and asmparser now unique to the same sections. This fixes
rdar://7835021.
llvm-svn: 100807
2010-04-08 20:30:37 +00:00
Chris Lattner
3b21e4d404
Give AsmParser an option to control whether it finalizes
...
the stream. New demo:
$ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o
$ otool -tv t.o
t.o:
(__TEXT,__text) section
_foo:
0000000000000000 subq $0x08,%rsp
0000000000000004 movl %edi,(%rsp)
0000000000000007 movl %edi,%eax
0000000000000009 incl %eax
000000000000000b movl %eax,(%rsp)
000000000000000e movl %eax,0x04(%rsp)
0000000000000012 addq $0x08,%rsp
0000000000000016 ret
llvm-svn: 100492
2010-04-05 23:15:42 +00:00
Chris Lattner
9897043928
Rip out the 'is temporary' nonsense from the MCContext interface to
...
create symbols. It is extremely error prone and a source of a lot
of the remaining integrated assembler bugs on x86-64.
This fixes rdar://7807601.
llvm-svn: 99902
2010-03-30 18:10:53 +00:00
Daniel Dunbar
5599256415
MC: Allow modifiers in MCSymbolRefExpr, and eliminate X86MCTargetExpr.
...
- Although it would be nice to allow this decoupling, the assembler needs to be able to reason about MCSymbolRefExprs in too many places to make this viable. We can use a target specific encoding of the variant if this becomes an issue.
- This patch also extends llvm-mc to support parsing of the modifiers, as opposed to lumping them in with the symbol.
llvm-svn: 98592
2010-03-15 23:51:06 +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
7e3283c055
Remove unneeded includes.
...
llvm-svn: 98167
2010-03-10 17:56:05 +00:00
Chris Lattner
b973ea88b5
eliminate MCContext::CreateSymbol and CreateTemporarySymbol.
...
Add a new GetOrCreateTemporarySymbol method and a version that
takes a twine.
llvm-svn: 98118
2010-03-10 01:29:27 +00:00
Chris Lattner
bb592eb9d0
pass in more section kinds, enough to get the .align 0x90
...
stuff to emit optimal nops in the right places.
llvm-svn: 97233
2010-02-26 18:32:26 +00:00
Kevin Enderby
7f99302dc9
This is a patch to the assembler frontend to detect when aligning a text
...
section with TextAlignFillValue and calls EmitCodeAlignment() instead of
calling EmitValueToAlignment(). This allows x86 assembly code to be aligned
with optimal nops.
llvm-svn: 97158
2010-02-25 18:46:04 +00:00
Daniel Dunbar
d0c6d361fe
MC/AsmParser: Attempt to constant fold expressions up-front. This ensures we avoid fixups for obvious cases like '-(16)'.
...
llvm-svn: 96064
2010-02-13 01:28:07 +00:00
Chris Lattner
d45adf28de
wirte up .file and .file to the mc asmparser.
...
llvm-svn: 94438
2010-01-25 19:02:58 +00:00
Chris Lattner
807a3bcbbb
fix a parsing problem on instructions like:
...
movw $8, (_cost_table_-L97$pb)+66(%eax)
After the parens, we could still have a binop.
llvm-svn: 94345
2010-01-24 01:07:33 +00:00
Chris Lattner
685508cf49
move the various directive enums out of the MCStreamer class
...
into a new MCDirectives.h file.
llvm-svn: 94294
2010-01-23 06:39:22 +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