Chris Lattner
e46549ed67
teach MCAsmStreamer::EmitBytes to use .ascii and .asciz
...
llvm-svn: 94259
2010-01-23 00:15:00 +00:00
Chris Lattner
639c136993
Changes to fix buffering that I forgot to commit with previous patch.
...
llvm-svn: 94222
2010-01-22 21:16:10 +00:00
Chris Lattner
bc01d5b148
Convert some more random-comment-printing stuff to use
...
AddComment and GetCommentOS. Add a blank line between globals
(even in non-verbose mode) to make the assembly more readable.
llvm-svn: 94202
2010-01-22 19:52:01 +00:00
Chris Lattner
20390f5205
add a new MCAsmStreamer::GetCommentOS method to simplify stuff
...
that doesn't want to use twines.
llvm-svn: 94199
2010-01-22 19:17:48 +00:00
Chris Lattner
784036d536
rename addComment -> AddComment for consistency.
...
llvm-svn: 94190
2010-01-22 18:21:35 +00:00
Benjamin Kramer
13b3fa1f36
Simplify some uses of str(n)cmp with StringRef.
...
llvm-svn: 94189
2010-01-22 18:21:23 +00:00
Chris Lattner
af1c74d7e1
add comment support to the rest of the directives.
...
llvm-svn: 94168
2010-01-22 07:36:39 +00:00
Chris Lattner
e773b145a2
stop using strtoll, it gives windows heartburn.
...
llvm-svn: 94167
2010-01-22 07:34:12 +00:00
Chris Lattner
df1b7b6164
Add the ability for MCStreamer to emit comments on the same line as directives.
...
Switch over the asm-verbose comment for double values to use it. We now get:
_x:
.long 343597384 ## double 1.231200e+02
.long 1079953326
For example, note that the comment is on the same line as the .long. Woo.
llvm-svn: 94166
2010-01-22 07:29:22 +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
84c0345065
forgot to svn add these, doh.
...
llvm-svn: 94130
2010-01-22 01:55:10 +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
c7a4cc225b
don't forget to initialize an instance variable!
...
llvm-svn: 94021
2010-01-20 20:48:59 +00:00
Chris Lattner
ffc364d7e2
use getGlobalDirective(), don't hardcode .globl. PR6093
...
llvm-svn: 94006
2010-01-20 17:50:30 +00:00
Chris Lattner
1d3b05933f
make mcasmstreamer handle expanding 8 byte integer constants to
...
4-byte constants if .quad isn't supported. Switch a bunch of
methods used by the dwarf writer to use OutStreamer.EmitIntValue.
llvm-svn: 93987
2010-01-20 06:45:39 +00:00
Chris Lattner
6ea74a85bb
give createAsmStreamer an 'isLittleEndian' argument.
...
llvm-svn: 93986
2010-01-20 06:39:07 +00:00
Chris Lattner
f25a9e1265
revert 93934, removing the MCAsmInfo endianness bit. I can't
...
stomache MCAsmInfo having this, and I found a better solution to
this layering issue.
llvm-svn: 93985
2010-01-20 06:34:14 +00:00
Chris Lattner
8e3badb9a7
give MCAsmInfo a 'has little endian' bit. This is unfortunate, but
...
I really want clients of the streamer to be able to say "emit this
64-bit integer" and have it get broken down right by the streamer.
I may change this in the future, we'll see how it works out.
llvm-svn: 93934
2010-01-19 22:42:28 +00:00
Chris Lattner
20c1857075
add a new EmitIntValue method that MCStreamer impls can optionally define
...
and that clients can use.
llvm-svn: 93923
2010-01-19 22:03:38 +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
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
b98efb6e76
mcstreamerize AsmPrinter::EmitZeros, at least when emitting to the
...
default address space.
llvm-svn: 93890
2010-01-19 18:58:52 +00:00
Chris Lattner
7c3ff46d45
add an MCAsmStreamer::EmitFill specialization of EmitFill that
...
emits one directive instead of N. Not doing this would be a
significant regression on the # bytes generated by .fill.
llvm-svn: 93889
2010-01-19 18:52:28 +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
50636e0db8
remove MAI::ZeroDirectiveSuffix, which is only used by MASM,
...
which we don't support anymore.
llvm-svn: 93886
2010-01-19 18:37:01 +00:00
Chris Lattner
15e2a64ec2
stop using the .lcomm pseudoop on darwin, instead, directly use the
...
.zerofill directive. Streamerize its generation.
llvm-svn: 93868
2010-01-19 06:25:51 +00:00
Chris Lattner
e339d60351
mc'ize some stuff, don't comment out .lcomm directive in -fverbose-asm mode.
...
llvm-svn: 93860
2010-01-19 06:01:04 +00:00
Chris Lattner
f0edf967c7
hookize the cygwin ".linkonce" directive.
...
llvm-svn: 93855
2010-01-19 05:08:13 +00:00
Chris Lattner
7351e3a364
add a bool for whether .lcomm takes an alignment instead of basing this on "isdarwin".
...
llvm-svn: 93852
2010-01-19 04:48:20 +00:00
Chris Lattner
3821a5f168
move production of .reference directives for static ctor/dtor list on
...
darwin into common code.
llvm-svn: 93849
2010-01-19 04:34:02 +00:00
Chris Lattner
816fcd1287
Cleanup handling of .zerofill on darwin:
...
1. TargetLoweringObjectFileMachO should decide if something
goes in zerofill instead of having every target do it.
2. TargetLoweringObjectFileMachO should assign said symbols to
the right MCSection, the asmprinters should just emit to the
right section.
3. Since all zerofill stuff goes through mcstreamer anymore,
MAI can have a bool "haszerofill" instead of having the textual
directive to emit.
llvm-svn: 93838
2010-01-19 02:09:44 +00:00
Nate Begeman
3c96073ce7
Remove this fixme, looking at the linker source, all targets pad to 4 bytes.
...
llvm-svn: 93835
2010-01-19 01:32:44 +00:00
Chris Lattner
86287085ba
remove the MAI argument to MCExpr::print and switch overthing to use << when printing them.
...
llvm-svn: 93699
2010-01-18 00:37:40 +00:00
Chris Lattner
6f360c3c91
now that MCSymbol::print doesn't use it's MAI argument, we can
...
remove it and change all the code that prints MCSymbols to use
<< instead, which is much simpler and cleaner.
llvm-svn: 93695
2010-01-17 21:43:43 +00:00
Chris Lattner
bd2eeabe74
rename NameNeedsEscaping -> NameNeedsQuoting, eliminate the check
...
for first character which is a digit, mangler would have taken care
of this already.
llvm-svn: 93694
2010-01-17 20:11:03 +00:00
Chris Lattner
f7c6508544
Get MCSymbol out of the mangling business, and move all the logic
...
to Mangler. Now MCSymbol just decides whether to slap quotes around
a symbol when printing it.
This also fixes some weirdness where two MCSymbols could be created
for the same symbol, if one needed to be mangled and got mangled to
the other one.
llvm-svn: 93690
2010-01-17 19:23:46 +00:00
Nate Begeman
04da97bd5e
Add a note for the macho streamer and remove a used of the mangler from the soon to be defunct machowriter pass.
...
llvm-svn: 93670
2010-01-17 03:49:01 +00:00
Chris Lattner
493580bb5c
unbreak the build, grr symlinks.
...
llvm-svn: 93539
2010-01-15 19:51:05 +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
c073f1009a
tidy
...
llvm-svn: 93352
2010-01-13 21:21:29 +00:00
Chris Lattner
9498bee8a3
expose a static function as a static method on the MCSymbol class.
...
llvm-svn: 93350
2010-01-13 21:09:59 +00:00
David Greene
ed1e2c4453
Change errs() to dbgs().
...
llvm-svn: 92635
2010-01-05 01:28:22 +00:00
David Greene
d4ba9148d2
Change errs() to dbgs().
...
llvm-svn: 92634
2010-01-05 01:28:17 +00:00
David Greene
b0b06156ab
Change errs() to dbgs().
...
llvm-svn: 92632
2010-01-05 01:28:10 +00:00
David Greene
718ca3f5b6
Change errs() to dbgs().
...
llvm-svn: 92630
2010-01-05 01:28:07 +00:00
Daniel Dunbar
4daaf9d3f4
Pass StringRef by value.
...
llvm-svn: 86251
2009-11-06 10:58:06 +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
Chris Lattner
df848440d1
add a twine version of MCContext::GetOrCreateSymbol.
...
llvm-svn: 84561
2009-10-19 22:49:00 +00:00
Daniel Dunbar
2be596c127
MC: Set symbol values in MachO MCStreamer.
...
llvm-svn: 84236
2009-10-16 01:58:23 +00:00
Daniel Dunbar
4943610506
Minor formatting tweaks.
...
llvm-svn: 84235
2009-10-16 01:58:15 +00:00
Daniel Dunbar
0df659c00b
MC: Switch assembler API to using MCExpr instead of MCValue.
...
llvm-svn: 84234
2009-10-16 01:58:03 +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
Daniel Dunbar
6b7edc035b
MC: Move assembler variable values from MCContext to MCSymbol.
...
llvm-svn: 84229
2009-10-16 01:33:57 +00:00
Daniel Dunbar
c5165c4258
MC: Switch MCContext value table to storing MCExprs.
...
llvm-svn: 84228
2009-10-16 01:33:11 +00:00
Kevin Enderby
ef201aaa04
Fixed MCSectionMachO::ParseSectionSpecifier to allow an attribute of "none" so
...
that a symbol stub section with no attributes can be parsed as in:
.section __TEXT,__picsymbolstub4,symbol_stubs,none,16
llvm-svn: 83488
2009-10-07 20:57:20 +00:00
Edward O'Callaghan
8b7189e234
No newline at end of files.
...
llvm-svn: 83318
2009-10-05 18:43:19 +00:00
Chris Lattner
fd910fd2f7
eliminate a use of strtoul.
...
llvm-svn: 82382
2009-09-20 06:58:54 +00:00
Anton Korobeynikov
fb7ac49d96
Allow symbols to start from the digit if target requests it. This allows, e.g. pinning
...
variables to specified absolute address. Make use of this feature for MSP430.
This unbreaks PR4776.
llvm-svn: 82227
2009-09-18 16:57:42 +00:00
Chris Lattner
7b52d90c9e
Big change #1 for personality function references:
...
Eliminate the PersonalityPrefix/Suffix & NeedsIndirectEncoding
fields from MAI: they aren't part of the asm syntax, they are
related to the structure of the object file.
To replace their functionality, add a new
TLOF::getSymbolForDwarfGlobalReference method which asks targets
to decide how to reference a global from EH in a pc-relative way.
The default implementation just returns the symbol. The default
darwin implementation references the symbol through an indirect
$non_lazy_ptr stub. The bizarro x86-64 darwin specialization
handles the weird "foo@GOTPCREL+4" hack.
DwarfException.cpp now uses this to emit the reference to the
symbol in the right way, and this also eliminates another
horrible hack from DwarfException.cpp:
- if (strcmp(MAI->getPersonalitySuffix(), "+4@GOTPCREL"))
- O << "-" << MAI->getPCSymbol();
llvm-svn: 81991
2009-09-16 01:46:41 +00:00
Chris Lattner
006af669b4
add a helper method for creating MCSymbol and MCSymbolRefExpr at
...
the same time.
llvm-svn: 81984
2009-09-16 01:26:31 +00:00
Chris Lattner
249d5fe8b9
remove some horrible MAI hooks which fortunately turn out to be always empty.
...
llvm-svn: 81946
2009-09-15 23:11:32 +00:00
Daniel Dunbar
d729752a24
Update CMake.
...
llvm-svn: 81757
2009-09-14 05:22: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
Chris Lattner
27a850eb70
add a new MCInstPrinter class, move the (trivial) MCDisassmbler ctor inline.
...
llvm-svn: 81745
2009-09-14 01:43:38 +00:00
Chris Lattner
8724d994d0
'printMCInst' doesn't print newlines after instructions anymore.
...
llvm-svn: 81723
2009-09-13 22:24:34 +00:00
Chris Lattner
cb05a87447
remove MAI::JumpTableSpecialLabelPrefix now that MAI
...
has real information about linker private linkage.
llvm-svn: 81695
2009-09-13 19:02:16 +00:00
Chris Lattner
89e5731659
fix MCSymbol printing on darwin to exactly match the mangler (handling of \n and " in a symbol name).
...
llvm-svn: 81683
2009-09-13 18:11:09 +00:00
Chris Lattner
e26af94cd4
Make the MC symbol printer and llvm::Mangler exactly agree on mangling
...
for systems that don't support quoting (PR4966).
llvm-svn: 81682
2009-09-13 18:04:46 +00:00
Chris Lattner
53cca8590c
eliminate the "MBBLabel" MCOperand type, and just use a MCSymbol for
...
MBB labels like everything else.
llvm-svn: 81628
2009-09-12 20:45:03 +00:00
Ted Kremenek
e98d47cdfe
Update CMake files.
...
llvm-svn: 81577
2009-09-11 21:49:45 +00:00
Chris Lattner
9975e8e31a
canonicalize namespace gymnastics
...
llvm-svn: 81402
2009-09-09 23:46:42 +00:00
Sean Callanan
7b789f8cba
Added an abstract superclass, MCDisassembler, for
...
all disassemblers.
Modified the MemoryObject to support 64-bit address
spaces, regardless of the LLVM process's address
width.
Modified the Target class to allow extraction of a
MCDisassembler.
llvm-svn: 81392
2009-09-09 22:49:13 +00:00
Chris Lattner
3b44c382d3
allow @ in symbol names without quoting the identifier. This
...
allows things like @PLT without quotes.
llvm-svn: 81296
2009-09-09 00:14:09 +00:00
Chris Lattner
77fdd07c93
parenthesize symbol names that start with $, fixing X86/dollar-name.ll with
...
the new asmprinter.
llvm-svn: 81269
2009-09-08 23:20:50 +00:00
Chris Lattner
bcf8dbfbcb
Print "X-42" instead of "X+-42".
...
llvm-svn: 81203
2009-09-08 06:37:35 +00:00
Chris Lattner
a07820641d
make formatting of expressions more closely match the existing asmprinter.
...
llvm-svn: 81202
2009-09-08 06:34:07 +00:00
Chris Lattner
141b519df0
tidy whitespace.
...
llvm-svn: 81201
2009-09-08 06:27:48 +00:00
Chris Lattner
6fce76a106
fix MCSymbol printing to exactly match the normal mangler rules so
...
we can diff .s files.
llvm-svn: 80894
2009-09-03 05:57:47 +00:00
Chris Lattner
d4f19950e3
Thread an MCAsmInfo pointer through the various MC printing APIs,
...
and fix a few things using << on MCSymbols to use ->print(). No
functionality change other than unbreaking my previous patch.
llvm-svn: 80890
2009-09-03 05:46:51 +00:00
Chris Lattner
2f6f020b42
inline insertion operators.
...
llvm-svn: 80888
2009-09-03 05:33:01 +00:00
Chris Lattner
25817ab343
output alignment value in hex so that we get:
...
.align 3, 0x90
instead of,
.align 3, 144
suggested by eric.
llvm-svn: 80875
2009-09-03 04:01:10 +00:00
Daniel Dunbar
fbe8d5891a
llvm-mc: Store MCSymbolData value as a pointer (to make MSVC happy).
...
llvm-svn: 80652
2009-09-01 04:09:03 +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
fcb32716eb
llvm-mc: Switch MCInst to storing an MCExpr* instead of an MCValue.
...
Also, use MCInst::print instead of custom code in MCAsmPrinter.
llvm-svn: 80575
2009-08-31 08:08:38 +00:00
Daniel Dunbar
be245a258c
llvm-mc: Make MCSymbolData symbol member const.
...
llvm-svn: 80573
2009-08-31 08:08:06 +00:00
Daniel Dunbar
1689464a71
llvm-mc: Add MCContext to MCAssembler.
...
llvm-svn: 80572
2009-08-31 08:07:55 +00:00
Daniel Dunbar
4e5556dbd1
llvm-mc: Add MCExpr::{dump,print}.
...
llvm-svn: 80570
2009-08-31 08:07:33 +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
e3cf39c644
llvm-mc: .lsym is more unsupported than unimplemented, pending a use case appearing.
...
Also, all one of the file level flags are implemented.
llvm-svn: 80352
2009-08-28 07:08:47 +00:00
Daniel Dunbar
eec2764d55
llvm-mc: Support .comm emission.
...
llvm-svn: 80351
2009-08-28 07:08:35 +00:00
Daniel Dunbar
5749caa698
llvm-mc: Support .zerofill emission.
...
- I'm still trying to figure out the cleanest way to implement this and match the assembler, currently there are some substantial differences.
llvm-svn: 80347
2009-08-28 05:49:21 +00:00
Daniel Dunbar
1935aed414
llvm-mc: Tweak section alignment and size computation to match 'as' closer.
...
llvm-svn: 80345
2009-08-28 05:49:04 +00:00
Daniel Dunbar
8aa87b9f63
llvm-mc: Factor getSectionData out of SwitchSection.
...
llvm-svn: 80344
2009-08-28 05:48:54 +00:00
Daniel Dunbar
09ed9fabde
llvm-mc: Emit .lcomm as .zerofill.
...
llvm-svn: 80343
2009-08-28 05:48:46 +00:00
Daniel Dunbar
aace3b9577
llvm-mc: Add const to EmitZeroFill section argument.
...
llvm-svn: 80341
2009-08-28 05:48:22 +00:00
Daniel Dunbar
7cf576d72f
llvm-mc: Fix thinko in emitting values.
...
llvm-svn: 80340
2009-08-28 05:48:10 +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
b11e3eb82f
llvm-mc: Print encodings after the instruction, and only when we have an asm
...
printer.
llvm-svn: 80233
2009-08-27 07:58:57 +00:00
Daniel Dunbar
ed9714d9eb
Add {MCInst,MCOperand}::{print,dump}
...
llvm-svn: 80231
2009-08-27 07:57:12 +00:00
Daniel Dunbar
abcf0c83cc
Update CMake
...
llvm-svn: 80195
2009-08-27 02:08:37 +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
efbcc2daf9
Try to make MSVC just a little happier.
...
llvm-svn: 80187
2009-08-27 00:38:04 +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
5e9b7483b7
llvm-mc/Mach-O: Set .subsections_via_symbols flag properly.
...
llvm-svn: 80144
2009-08-26 21:22:22 +00:00
Daniel Dunbar
8c38017009
llvm-mc/Mach-O: Add support for relocations.
...
- I haven't really tried to find the "right" way to store the fixups or apply
them, yet. This works, but isn't particularly elegant or fast.
- Still no evaluation support, so we don't actually ever not turn a fixup into
a relocation entry.
llvm-svn: 80089
2009-08-26 13:58:10 +00:00
Daniel Dunbar
45d03f2bbb
llvm-mc/Mach-O: Move symbol indices into the MCSymbolData structure.
...
llvm-svn: 80088
2009-08-26 13:57:54 +00:00
Daniel Dunbar
f7a22e19cf
llvm-mc: Add symbol entries for undefined symbols used in .fill and .org.
...
llvm-svn: 80086
2009-08-26 13:57:37 +00:00
Daniel Dunbar
168f849552
llvm-mc: Change MCContext value table to take const MCSymbol*s.
...
llvm-svn: 80079
2009-08-26 09:16:57 +00:00
Daniel Dunbar
982f304aac
llvm-mc/Mach-O: Add section padding where needed (to align the next section).
...
Also, simplify some of Mach-O writer code which can now use section addresses.
llvm-svn: 80067
2009-08-26 04:13:32 +00:00
Daniel Dunbar
a36793b5b5
llvm-mc/Mach-O: Set addresses for symbols.
...
llvm-svn: 80065
2009-08-26 02:48:04 +00:00
Daniel Dunbar
6bb1f76970
llvm-mc: Improve indirect symbol support (add the indirect index table).
...
llvm-svn: 80059
2009-08-26 00:18:21 +00:00
Bill Wendling
a6284af6bb
Revert last patch. We need to put this into TargetLowering. There will be a lot
...
of EH stuff going into there, so we can wait to add them all then.
llvm-svn: 80036
2009-08-25 21:31:39 +00:00
Daniel Dunbar
d9b0efd553
llvm-mc: Add statistic for number of fragments emitted by the assembler.
...
llvm-svn: 80033
2009-08-25 21:10:45 +00:00
Bill Wendling
4a8c3d686f
Add the #include here.
...
llvm-svn: 80032
2009-08-25 21:09:50 +00:00
Bill Wendling
4dd702ce66
Add a target asm info hook to specify that particular bits of data in the FDE
...
should be forced to 32-bits (.long) even on 64-bit architectures. Darwin wants
these bits to be 64-bits (.quad). However, other platforms may disagree.
This is just the info right now and is part of a work-in-progress which needs
this. We'll add the actual *use* of this soon.
llvm-svn: 80024
2009-08-25 20:21:17 +00:00
Daniel Dunbar
344ea15334
llvm-mc/Mach-O: Preliminary support for indirect symbols.
...
- The indirect table itself isn't being filled in yet.
- This isn't factored properly and is rather FIXMEd, but at the moment I'm more
focused on figuring out what it needs to do.
llvm-svn: 79910
2009-08-24 11:56:58 +00:00
Daniel Dunbar
937b745b68
llvm-mc/Mach-O: Support symbol attributes.
...
- This is mostly complete, the main thing missing is .indirect_symbol support
(which would be straight-forward, except that the way it is implemented in
'as' makes getting an exact .o match interesting).
llvm-svn: 79899
2009-08-24 08:40:12 +00:00
Daniel Dunbar
82bf59da54
llvm-mc: Tweak undefined symbol handling.
...
llvm-svn: 79898
2009-08-24 08:39:57 +00:00
Chris Lattner
39262eb119
prune the #includes in raw_ostream.h by moving a
...
member out of line. ftostr is not particularly speedy,
so that method is presumably not perf sensitive.
llvm-svn: 79885
2009-08-24 03:52:50 +00:00
Benjamin Kramer
4a7695a622
Update CMake build, unbreak linux build.
...
llvm-svn: 79779
2009-08-22 22:07:08 +00:00
Chris Lattner
8d06945fff
rename TAI -> MAI, being careful not to make MAILJMP instructions :)
...
llvm-svn: 79777
2009-08-22 21:43:10 +00:00
Chris Lattner
384b7d24a9
rename COFFMCAsmInfo -> MCAsmInfoCOFF, likewise for darwin.
...
llvm-svn: 79773
2009-08-22 21:03:30 +00:00
Chris Lattner
9f2ba3294f
move the MCAsmInfo .cpp/.h files into the right
...
directories and rename them.
llvm-svn: 79768
2009-08-22 20:58:17 +00:00
Chris Lattner
5d8af49626
Rename TargetAsmInfo (and its subclasses) to MCAsmInfo.
...
llvm-svn: 79763
2009-08-22 20:48:53 +00:00
Chris Lattner
29213a76e4
prune some redundant #includes.
...
llvm-svn: 79746
2009-08-22 19:35:08 +00:00
Chris Lattner
d786e8929e
tweak #includes
...
llvm-svn: 79744
2009-08-22 19:19:12 +00:00
Daniel Dunbar
4c3cf93d1d
llvm-mc/Mach-O: Improve symbol table support:
...
- Honor .globl.
- Set symbol type and section correctly ('nm' now works), and order symbols
appropriately.
- Take care to the string table so that the .o matches 'as' exactly (for ease
of testing).
llvm-svn: 79740
2009-08-22 11:41:10 +00:00
Daniel Dunbar
d22c0d4d49
llvm-mc/Mach-O: Sketch symbol table support.
...
- The only .s syntax this honors right now is emitting labels, and some parts
of the symbol table generation are wrong or faked.
- This is enough to get nm to report such symbols... incorrectly, but still.
Also, fixed byte emission to extend the previous fragment if possible.
llvm-svn: 79739
2009-08-22 10:13:24 +00:00
Daniel Dunbar
2b6db55380
llvm-mc/Mach-O: Move more logic for writing the Mach-O file into the writer
...
class, and kill off MCSectionData::FileOffset.
llvm-svn: 79735
2009-08-22 08:28:27 +00:00
Daniel Dunbar
b367c1724d
llvm-mc: Rename / redefine MCFragment::FileOffset to MCFragment::Offset (the
...
section offset).
llvm-svn: 79734
2009-08-22 08:27:54 +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
aa60fad397
llvm-mc/Mach-O: Support .o emission for .org and .align.
...
llvm-svn: 79684
2009-08-21 23:07:38 +00:00
Daniel Dunbar
ca9ad524dc
llvm-mc/Mach-O: Support byte and fill value emission.
...
llvm-svn: 79652
2009-08-21 18:29:01 +00:00
Benjamin Kramer
a9afa949a7
Update CMakeLists.
...
llvm-svn: 79617
2009-08-21 11:28:56 +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
Chris Lattner
aeed3004c1
fix asmstreaming of 2/4 byte elements with pow-2 alignments.
...
llvm-svn: 79408
2009-08-19 06:35:36 +00:00
Chris Lattner
57b873fda0
switch asmprinter to emit alignments through OutStreamer.
...
llvm-svn: 79406
2009-08-19 06:12:02 +00:00
Chris Lattner
9cbc9c2d13
eliminate AsmPrinter::SwitchToSection and just have clients
...
talk to the MCStreamer directly instead.
llvm-svn: 79405
2009-08-19 05:49:37 +00:00
Chris Lattner
bc4e7e0815
null streamer needs to maintain the current section as well.
...
llvm-svn: 79343
2009-08-18 16:46:29 +00:00
Chris Lattner
b82fc63e02
Make AsmStreamer maintain a notion of the current section, pushing it up from the
...
MCAsmStreamer. Based on this, eliminate the current section from AsmPrinter.
While I'm at it, clean up the last of the horrible "switch to null section" stuff
and add an assert. This change is in preparation for completely eliminating
asmprinter::switchtosection.
llvm-svn: 79324
2009-08-18 06:15:16 +00:00
Chris Lattner
fc68e5368b
change AsmPrinter to switch sections using AsmStreamer instead of
...
doing it directly. This requires const'izing a bunch of stuff that
took sections, but this seems like the right semantic thing to do:
emitting a label to a section shouldn't mutate the MCSection object
itself, for example.
llvm-svn: 79227
2009-08-17 05:49:08 +00:00
Chris Lattner
69a19050c0
give MCAsmStreamer a TargetAsmInfo.
...
llvm-svn: 79222
2009-08-17 04:23:44 +00:00
Chris Lattner
a1acc7cab5
formatting cleanups, no functionality change.
...
llvm-svn: 79221
2009-08-17 04:17:34 +00:00
Chris Lattner
3665e2058e
add support for target-specific ELF section flags, add a new MCSectionXCore
...
class which represents the XCore cp/dp section flags. No functionality
change yet.
llvm-svn: 79077
2009-08-15 05:56:11 +00:00
Daniel Dunbar
3c9ab92a24
llvm-mc: Fix bugs where bytes were unintentionally being printed as signed.
...
- We now print all of 403.gcc cleanly (llvm-mc -> 'as' as diffed to 'as'), minus two
'rep;movsl' instructions (which I missed before).
llvm-svn: 79031
2009-08-14 19:59:24 +00:00
Bruno Cardoso Lopes
e298b64a93
*try* to use a better name to describe how common symbols are marked on the elf object file.
...
llvm-svn: 79029
2009-08-14 19:45:38 +00:00
Daniel Dunbar
b9d9ce9513
llvm-mc: When handling a .set, make sure to print subsequent references to the
...
symbol as the symbol name itself, not the expression it was defined to. These
have different semantics due to the quirky .set behavior (which absolutizes an
expression that would otherwise be treated as a relocation).
llvm-svn: 79025
2009-08-14 19:10:46 +00:00
Daniel Dunbar
b00271e266
llvm-mc: zerofill shouldn't print quotes around the section,segment.
...
llvm-svn: 79017
2009-08-14 18:51:45 +00:00
Oscar Fuentes
ed9c7f2749
CMake: updated list of source files for library MC.
...
llvm-svn: 78988
2009-08-14 04:14:45 +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
259bc4b0e7
Add MCSymbol::{print, dump}
...
llvm-svn: 78983
2009-08-14 03:41:23 +00:00
Daniel Dunbar
127e3bc13f
Add MCValue::{print, dump}
...
llvm-svn: 78982
2009-08-14 03:11:09 +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
Dan Gohman
3497fde219
Fix MCSectionELF::ShouldOmitSectionDirective's matching of .data and
...
friends so that it doesn't match sections like .data.rel.local, which
should not be emitted as section directives.
llvm-svn: 78963
2009-08-13 23:56:34 +00:00
Daniel Dunbar
d4c5293717
llvm-mc: Add dummy MCStreamer implementation, (eventually) for use in profiling.
...
- Currently unused.
- A few other random comment fixes lumped in.
llvm-svn: 78960
2009-08-13 23:36:34 +00:00
Bruno Cardoso Lopes
98ffbd5041
Remove HasCrazyBSS and add a flag in TAI to indicate that '.section'
...
must be emitted for PowerPC-Linux '.bss' section
llvm-svn: 78958
2009-08-13 23:30:21 +00:00
Bruno Cardoso Lopes
15f3e9a5fa
Add a method to return if the ELF section contains only common symbols!
...
llvm-svn: 78937
2009-08-13 21:08:56 +00:00
Bruno Cardoso Lopes
f2855aabec
Change MCSectionELF to represent a section semantically instead of
...
syntactically as a string, very similiar to what Chris did with MachO.
The parsing support and validation is not introduced yet.
llvm-svn: 78890
2009-08-13 05:07:35 +00:00
Chris Lattner
04f74d3510
sink uniquing of sections out of MCContext into the ELF and PECOFF TLOF implementations.
...
MCContext no longer maintains a string -> section map.
llvm-svn: 78874
2009-08-13 00:37:15 +00:00
Chris Lattner
7ead5b498b
add some comments: MCContext owns the MCSections, but it bump pointer allocates
...
them, so it doesn't have to explicitly free them.
llvm-svn: 78870
2009-08-13 00:21:53 +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
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
4415a43b2f
always end a section with \n on elf.
...
llvm-svn: 78534
2009-08-09 15:31:10 +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
2849883bd5
1. Make MCSection an abstract class.
...
2. Move section switch printing to MCSection virtual method which takes a
TAI. This eliminates textual formatting stuff from TLOF.
3. Eliminate SwitchToSectionDirective, getSectionFlagsAsString, and
TLOFELF::AtIsCommentChar.
llvm-svn: 78510
2009-08-08 22:41:53 +00:00
Chris Lattner
53cc0d6439
make target-specific TLOF impls (except PIC16) create target-specific
...
MCSection instances.
llvm-svn: 78500
2009-08-08 20:52:13 +00:00
Chris Lattner
95ca008a43
stub out PECOFF/MachO/ELF MCSection classes
...
llvm-svn: 78499
2009-08-08 20:50:49 +00:00
Chris Lattner
79e9585304
Change SectionKind to be a property that is true of a *section*, it
...
should have no state that is specific to particular globals in the
section. In this case, it means the removal of the "isWeak" and
"ExplicitSection" bits. MCSection uses the new form of SectionKind.
To handle isWeak, I introduced a new SectionInfo class, which is
SectionKind + isWeak, and it is used by the part of the code generator
that does classification of a specific global.
The ExplicitSection disappears. It is moved onto MCSection as a new
"IsDirective" bit. Since the Name of a section is either a section
or directive, it makes sense to keep this bit in MCSection. Ultimately
the creator of MCSection should canonicalize (e.g.) .text to whatever
the actual section is.
llvm-svn: 77803
2009-08-01 21:11:14 +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
a848745eb4
llvm-mc: Fix .s output to quote section & symbol names when necessary.
...
llvm-svn: 77749
2009-07-31 23:04:32 +00:00
Chris Lattner
a682cb61e7
split MCSection stuff out to its own .cpp file, add a new
...
MCSectionWithKind subclass of MCSection.
llvm-svn: 77684
2009-07-31 17:02:00 +00:00
Chris Lattner
610dfdece7
create sections with MCSection::Create instead of Context->getOrCreateSection.
...
This is needed to allow polymorphic sections.
llvm-svn: 77680
2009-07-31 16:43:49 +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
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
6de68a2544
Move MCContext and friends to StringRef based APIs.
...
llvm-svn: 77251
2009-07-27 21:22:30 +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
Ted Kremenek
ce3842ae4f
Update CMake file.
...
llvm-svn: 76264
2009-07-17 23:50:26 +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
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
Torok Edwin
f955a6ef49
llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
...
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").
llvm-svn: 75640
2009-07-14 16:55:14 +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
Torok Edwin
ae8a3ff177
assert(0) -> LLVM_UNREACHABLE.
...
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.
llvm-svn: 75379
2009-07-11 20:10:48 +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
Daniel Dunbar
efcb5ad32e
Dump MCInsts in the MC .s printer, for now.
...
llvm-svn: 74593
2009-07-01 06:35:03 +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
Torok Edwin
28c47d108c
Initialize CurSection in constructor.
...
Not doing so causes some unittests to fail, because CurSection is uninitialized.
llvm-svn: 74442
2009-06-29 19:59:10 +00:00
Daniel Dunbar
134907cafc
Rename MCValue::getCst to getConstant and add MCValue::isConstant.
...
llvm-svn: 74440
2009-06-29 19:51:00 +00:00
Daniel Dunbar
3d3f776dc9
MC: Truncate values when printing, to keep 'as' happy.
...
llvm-svn: 74201
2009-06-25 21:03:18 +00:00
Daniel Dunbar
5f2b8ca5e4
Sketch streamer support for .align, .org functionality.
...
llvm-svn: 74109
2009-06-24 19:25:34 +00:00
Daniel Dunbar
082dc70875
We decided to not worry about Atoms for now, it should be straightforward to
...
reintroduce them later.
Also, don't require MCSection* when creating a symbol.
llvm-svn: 74081
2009-06-24 17:00:42 +00:00
Daniel Dunbar
4f0c4c766c
MCStreamer: Add a few more "symbol attributes".
...
llvm-svn: 74077
2009-06-24 16:36:52 +00:00
Daniel Dunbar
691e6009bd
MCStreamer: Test printing values.
...
llvm-svn: 74076
2009-06-24 16:05:35 +00:00
Duncan Sands
070da26191
Add new files to cmake list.
...
llvm-svn: 74071
2009-06-24 10:03:44 +00:00
Chris Lattner
61a6509f6a
add trivial support for passing label definitions through the MCStreamer.
...
This is suboptimal in several aspects, see the commented out assertion.
I need to talk to Daniel about this.
llvm-svn: 74057
2009-06-24 04:31:49 +00:00
Daniel Dunbar
0e5051b251
Start MCAsmStreamer implementation.
...
llvm-svn: 74044
2009-06-24 01:03:06 +00:00
Daniel Dunbar
813ea8a8a7
Update for MCImm -> MCValue rename.
...
llvm-svn: 74024
2009-06-23 23:39:15 +00:00
Daniel Dunbar
323218db15
Start flushing out MCContext.
...
- Lives inside new library lib/MC (LLVMMC.a)
llvm-svn: 74013
2009-06-23 22:01:43 +00:00