Daniel Dunbar
34b8e553ea
MC/Mach-O: PCrel relocations weren't using the right base address, they are
...
relative to the fragment address, not its offset. This was masked by the text
section normally being at address 0.
llvm-svn: 98420
2010-03-13 02:38:00 +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
12f1e32d59
MC/Mach-O: Implement initial support for relaxation.
...
- The implementation is currently very brain dead and inefficient, but I have a
clear plan on how to fix it.
- The good news is, it works and correctly assembles 403.gcc (when built with
Clang, at '-Os', '-Os -g', and '-O3'). Even better, at '-Os' and '-Os -g',
the resulting binary is exactly equivalent to that when built with the system
assembler. So it probably works! :)
llvm-svn: 98396
2010-03-12 22:07:14 +00:00
Chris Lattner
8d99c764d3
move fastcall/stdcall mangling up into Mangler.
...
llvm-svn: 98384
2010-03-12 21:03:47 +00:00
Daniel Dunbar
ea9e2f8a15
MC: Factor out MCAssembler::EvaluateFixup, and simplify.
...
llvm-svn: 98381
2010-03-12 21:00:49 +00:00
Daniel Dunbar
968b36a0bd
MC: Constify MCAsmLayout argument to MCExpr::EvaluteAs...
...
llvm-svn: 98380
2010-03-12 21:00:45 +00:00
Daniel Dunbar
921e79f5eb
MC: Add MCAssembler::addFixup, which enforces that fixups are added in order.
...
llvm-svn: 98379
2010-03-12 21:00:38 +00:00
Chris Lattner
ac77bf5d1e
remove MAI argument from createAsmStreamer since it
...
can get it from the context now.
llvm-svn: 98361
2010-03-12 18:28:53 +00:00
Chris Lattner
d3691dd04b
enhance MCContext::GetOrCreateTemporarySymbol() to create a new symbol
...
with an arbitrary unique name.
llvm-svn: 98294
2010-03-11 22:56:10 +00:00
Chris Lattner
768ea2add2
change MCContext to always have an MCAsmInfo.
...
llvm-svn: 98293
2010-03-11 22:53:35 +00:00
Chris Lattner
216e7299d7
empty symbols aren't possible, the mcsymbol ctor aborts on them.
...
llvm-svn: 98288
2010-03-11 21:38:58 +00:00
Daniel Dunbar
64b408b124
MC/Mach-O: Add MCSymbolData::getAddress() utility.
...
llvm-svn: 98266
2010-03-11 18:22:51 +00:00
Daniel Dunbar
5c5228a8f6
MC/Mach-O: Implement "absolutizing" semantics of .set, by evaluating the assembly time value of variables.
...
llvm-svn: 98241
2010-03-11 05:53:37 +00:00
Daniel Dunbar
cf55f96214
MC/Mach-O: Start passing in the basic MCAsmLayout object.
...
- Also, drop the current location part of AsmLayout, I think I prefer to implement this via explicit symbols.
llvm-svn: 98240
2010-03-11 05:53:33 +00:00
Daniel Dunbar
ac8a95498a
MC: Sketch initial MCAsmLayout class, which encapsulates the current layout of an assembly file. The MCAsmLayout is also available for use by MCExpr::EvaluateAs{Absolute,Relocatable}, to allow target specific hooks and "absolutizing" of symbols.
...
llvm-svn: 98227
2010-03-11 02:28:59 +00:00
Daniel Dunbar
c5ddbad237
MC: Provide MCAssembler with a TargetAsmBackend.
...
llvm-svn: 98222
2010-03-11 01:34:27 +00:00
Daniel Dunbar
dc765e9f03
MC/Mach-O: Use the MCAssembler symbol map instead of reconstructing.
...
llvm-svn: 98187
2010-03-10 20:58:31 +00:00
Daniel Dunbar
6eab721011
MC: Move the backend section and symbol data maps to MCAssembler.
...
llvm-svn: 98186
2010-03-10 20:58:29 +00:00
Daniel Dunbar
7e3283c055
Remove unneeded includes.
...
llvm-svn: 98167
2010-03-10 17:56:05 +00:00
Chris Lattner
71c30c164f
move three lowering hooks from MAI to TLOF and make one of them
...
semantic instead of syntactic. This completes MCization of
darwin/x86[-64]!
llvm-svn: 98145
2010-03-10 07:20:42 +00:00
Chris Lattner
ac2361a9b0
set the temporary bit on MCSymbols correctly.
...
llvm-svn: 98124
2010-03-10 02:25:11 +00:00
Daniel Dunbar
46ed804180
MC/Mach-O: Resolve a FIXME; these relocation types are no longer semanticaly different.
...
llvm-svn: 98120
2010-03-10 02:10:29 +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
Daniel Dunbar
27b984ac85
MC/Mach-O: Use the SECTDIFF relocation type for (A - B + constant) where A is external.
...
- I'm not sure why, but this is what 'as' does.
llvm-svn: 98115
2010-03-10 00:58:25 +00:00
Chris Lattner
aab52840af
make the NullStreamer set the section on a label when emitted so that isDefined() works.
...
llvm-svn: 98100
2010-03-09 23:12:18 +00:00
Daniel Dunbar
3dde457b94
MC/Mach-O: For PCrel relocations, we need to compensate for the PCrel adjustment when determining if we need a scattered relocation.
...
llvm-svn: 98082
2010-03-09 21:27:58 +00:00
Daniel Dunbar
d49794e703
MC/Mach-O: Also set the PCrel bit in the second half of paired relocation entries.
...
llvm-svn: 98081
2010-03-09 21:27:47 +00:00
Daniel Dunbar
4680000b27
MC/Mach-O: Don't generate relocations for PCrel fixups to local labels.
...
llvm-svn: 98080
2010-03-09 21:27:30 +00:00
Daniel Dunbar
cb01210eca
MC/Mach-O: Tweak .dump() formatting.
...
llvm-svn: 98028
2010-03-09 01:12:23 +00:00
Daniel Dunbar
97d64717c4
MC/Mach-O: Don't adjust section sizes when aligning zero fill sections, just pad the address.
...
llvm-svn: 98027
2010-03-09 01:12:20 +00:00
Chris Lattner
b14490d912
add a EmitSymbolValue convenience method to MCStreamer.
...
llvm-svn: 98017
2010-03-09 00:39:24 +00:00
Daniel Dunbar
3a3f472cb4
MC/Macho-O: Align the zerofill section itself to the maximum alignment.
...
llvm-svn: 97991
2010-03-08 22:03:42 +00:00
Daniel Dunbar
6622fe7873
MC/Mach-O: Fix address compution for zero fill sections.
...
llvm-svn: 97984
2010-03-08 21:10:42 +00:00
Daniel Dunbar
c6ac7940d9
MC/Mach-O: Error out instead of crashing on invalid scattered relocation expressions.
...
llvm-svn: 97983
2010-03-08 21:10:39 +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
Kevin Enderby
c26ddccf38
This is the second patch to allow x86 code to be aligned with optimal nops.
...
With the compiler changed to use EmitCodeAlignment() it does change the
functionality. But X86 assembly code assembled with llvm-mc does not change
its output. For that we will eventually change the assembler frontend to
detect a '.align x, 0x90' when used in a section that 'hasInstructions' and use
EmitCodeAlignment, but will wait until we have better target hooks.
llvm-svn: 96988
2010-02-23 21:41:24 +00:00
Chris Lattner
eebaf6a76f
genericize MCAsmStreamer::EmitCodeAlignment to support other targets
...
so that it doesn't break them when the code generator starts using it.
llvm-svn: 96966
2010-02-23 18:44:31 +00:00
Kevin Enderby
e83d74f626
This is the first patch to put the needed bits in place to eventually allow code
...
to be aligned with optimal nops. This patch does not change any functionality
and when the compiler is changed to use EmitCodeAlignment() it should also not
change the resulting output. Once the compiler change is made and everything
looks good the next patch with the table of optimal X86 nops will be added to
WriteNopData() changing the output. There are many FIXMEs in this patch which
will be removed when we have better target hooks (coming soon I hear).
llvm-svn: 96963
2010-02-23 18:26:34 +00:00
Daniel Dunbar
5fe3129a5d
MC/Mach-O: Remove non-sensical comment, and add a missing AddValueSymbols call.
...
llvm-svn: 96809
2010-02-22 22:08:57 +00:00
Daniel Dunbar
40eb7f0991
MC/X86: Add stub AsmBackend.
...
llvm-svn: 96763
2010-02-21 21:54:14 +00:00
Daniel Dunbar
3bea9bfa04
MC: Sketch registry support for target specific assembler backends.
...
llvm-svn: 96762
2010-02-21 21:53:53 +00:00
Daniel Dunbar
1d7179ad63
MC/Mach-O: Update fixup values for change to X86 offsets.
...
llvm-svn: 96532
2010-02-17 23:45:16 +00:00
Duncan Sands
fe562b6598
Pacify gcc-4.5, which warns (correctly) that these switches have
...
cases that are not part of the enum.
llvm-svn: 96477
2010-02-17 14:52:22 +00:00
Daniel Dunbar
8408c126c1
MCAssembler: Fix pcrel relocations. Oh and,
...
--
ddunbar@ozzy:tmp$ clang -m32 -integrated-as hello.c && ./a.out
hello world!
--
llvm-svn: 96096
2010-02-13 09:45:59 +00:00
Daniel Dunbar
1e2fad3de8
MC/Mach-O: Start emitting fixups/relocations for instructions.
...
llvm-svn: 96095
2010-02-13 09:29:02 +00:00
Daniel Dunbar
3374835b46
MCAssembler: Switch MCAsmFixup to storing MCFixupKind instead of just a size.
...
llvm-svn: 96094
2010-02-13 09:28:54 +00:00
Daniel Dunbar
97867a9cfc
MCAssembler: Sink fixup list into MCDataFragment.
...
llvm-svn: 96093
2010-02-13 09:28:43 +00:00
Daniel Dunbar
056bc60336
MCAssembler: Switch MCFillFragment to only taking constant values. Symbolic expressions can always be emitted as data + fixups.
...
llvm-svn: 96092
2010-02-13 09:28:32 +00:00
Daniel Dunbar
1a1fbb50fc
MC/Mach-O: Implement EmitValue using data fragments + fixups instead of fill fragment.
...
llvm-svn: 96091
2010-02-13 09:28:22 +00:00
Daniel Dunbar
8e53203154
MCAssembler: Start applying fixups in the data section.
...
llvm-svn: 96090
2010-02-13 09:28:15 +00:00
Daniel Dunbar
bedf1d4a41
MCAssembler: Add assorted dump() methods.
...
llvm-svn: 96089
2010-02-13 09:28:03 +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
524138176d
add a new MCInstPrinter::getOpcodeName interface, when it is
...
implemented, llvm-mc --show-inst now uses it to print the
instruction opcode as well as the number.
llvm-svn: 95929
2010-02-11 22:39:10 +00:00
Daniel Dunbar
1d34759721
MC: Move assembler-backend's fixup list into the fragment.
...
llvm-svn: 95926
2010-02-11 21:29:46 +00:00
Daniel Dunbar
ee82e763e6
MC: Move MCSectionData::Fixup out to MCAsmFixup.
...
llvm-svn: 95925
2010-02-11 21:29:29 +00:00
Chris Lattner
ddeceae839
make getFixupKindInfo return a const reference, allowing
...
the tables to be const. Teach MCCodeEmitter to handle
the target-indep kinds so that we don't crash on them.
llvm-svn: 95924
2010-02-11 21:27:18 +00:00
Daniel Dunbar
605474463f
MC: Switch MCFixup to just hold an MCExpr pointer instead of index into the
...
MCInst it came from.
llvm-svn: 95767
2010-02-10 04:47:08 +00:00
Daniel Dunbar
75c9a4eeae
llvm-mc: Remove --show-fixups and always show as part of --show-encoding.
...
Also, fix a silly memory leak.
llvm-svn: 95752
2010-02-10 01:41:14 +00:00
Chris Lattner
69920c5c8a
daniel *really* likes fixups!
...
llvm-svn: 95742
2010-02-10 01:05:28 +00:00
Chris Lattner
482bf69bfe
Add ability for MCInstPrinters to add comments for instructions.
...
Enhance the x86 backend to show the hex values of immediates in
comments when they are large. For example:
movl $1072693248, 4(%esp) ## imm = 0x3FF00000
llvm-svn: 95728
2010-02-10 00:10:18 +00:00
Daniel Dunbar
9a0a46163d
llvm-mc: Add --show-fixups option, for displaying the instruction fixup information in the asm comments.
...
llvm-svn: 95710
2010-02-09 23:00:14 +00:00
Daniel Dunbar
b311a6b3ae
MC: First cut at MCFixup, for getting fixup/relocation information out of an MCCodeEmitter.
...
llvm-svn: 95708
2010-02-09 22:59:55 +00:00
Chris Lattner
89261502cb
make -show-inst be formatted a bit nicer. Before:
...
movl $3735928559, a ## inst: <MCInst 1273 <MCOperand Reg:0> <MCOperand Imm:1> <MCOperand Reg:0> <MCOperand Expr:(a)> <MCOperand Reg:0> <MCOperand Expr:(3735928559)>>
after:
movl $3735928559, a ## <MCInst #1273
## <MCOperand Reg:0>
## <MCOperand Imm:1>
## <MCOperand Reg:0>
## <MCOperand Expr:(a)>
## <MCOperand Reg:0>
## <MCOperand Expr:(3735928559)>>
llvm-svn: 95637
2010-02-09 00:54:51 +00:00
Dan Gohman
9a9d9ea7bc
Document that MCExpr::Mod is actually remainder.
...
Document that MCExpr::Div, Mod, and the comparison operators are all
signed operators.
Document that the comparison operators' results are target-dependent.
Document that the behavior of shr is target-dependent.
llvm-svn: 95619
2010-02-08 23:58:47 +00:00
Chris Lattner
54d88f1759
don't make hte dtor private or we can't construct the class.
...
llvm-svn: 95587
2010-02-08 22:07:36 +00:00
Chris Lattner
38d022efe9
add scaffolding for target-specific MCExprs.
...
llvm-svn: 95559
2010-02-08 19:41:07 +00:00
Chris Lattner
175629608e
print encodings like this:
...
pslld 69, %mm3 ## encoding: [0x0f,0xf2,0x1c,0x25,0x45,0x00,0x00,0x00]
instead of like this:
pslld 69, %mm3 ## encoding: [0x0f,0xf2,0x1c,0x25,0x45,0000,0000,0000]
this only affects 0.
llvm-svn: 95441
2010-02-05 22:20:08 +00:00
Daniel Dunbar
675ae27e37
MC: Change default comment column to 40 characters.
...
llvm-svn: 95378
2010-02-05 07:32:18 +00:00
Dan Gohman
77fe07a93a
Use a tab instead of space after .type, for consistency.
...
llvm-svn: 95272
2010-02-04 01:42:13 +00:00
Daniel Dunbar
e3ee332fe0
llvm-mc: Add --show-inst option, for showing the MCInst inline with the assembly
...
output.
llvm-svn: 95227
2010-02-03 18:18:30 +00:00
Chris Lattner
44f7325de5
print instruction encodings with the existing comment facilities,
...
so that llvm-mc -show-encoding prints like this:
hlt ## encoding: [0xf4]
instead of like this:
hlt
# encoding: [0xf4]
llvm-svn: 95207
2010-02-03 06:28:13 +00:00
Chris Lattner
b0d44c3807
refactor code so that LLVMTargetMachine creates the asmstreamer and
...
mccontext instead of having AsmPrinter do it. This allows other
types of MCStreamer's to be passed in.
llvm-svn: 95155
2010-02-02 23:37:42 +00:00
Daniel Dunbar
255a8c8b13
MC/Mach-O: Set SOME_INSTRUCTIONS bit for sections.
...
llvm-svn: 95135
2010-02-02 21:44:01 +00:00
Chris Lattner
809ae81ff9
Add a new top-level MachO.h file for manifest constants, fixing
...
a layering violation from MC -> Target.
llvm-svn: 95113
2010-02-02 19:38:14 +00:00
Chris Lattner
fc2e376a15
use EmitLinkage for functions as well as globals. One output
...
change is that we now use ".linkonce discard" for global variables
instead of ".linkonce samesize". These should be the same, just less
strict. If anyone is interested in mcizing MCSection for COFF targets,
this should be easy to fix.
llvm-svn: 94623
2010-01-26 23:51:52 +00:00
Chris Lattner
ff234e09b9
Eliminate SetDirective, and replace it with HasSetDirective.
...
Default HasSetDirective to true, since most targets have it.
The targets that claim to not have it probably do, or it is
spelled differently. These include Blackfin, Mips, Alpha, and
PIC16. All of these except pic16 are normal ELF targets, so
they almost certainly have it.
llvm-svn: 94585
2010-01-26 20:40:54 +00:00
Rafael Espindola
dcb03f0f6b
Emit .comm alignment in bytes but .align in powers of 2 for ARM ELF.
...
Original patch by Sandeep Patel and updated by me.
llvm-svn: 94582
2010-01-26 20:21:43 +00:00
Chris Lattner
3dd38a8112
eliminate MCAsmInfo::NeedsSet: we now just use .set on any platform
...
that has it.
llvm-svn: 94581
2010-01-26 20:20:43 +00:00
Chris Lattner
3cde760023
mcstreamerize gprel32 emission.
...
llvm-svn: 94452
2010-01-25 21:28:50 +00:00
Chris Lattner
19bd039896
rename MAI::PICJumpTableDirective to MAI::GPRel32Directive to
...
make it clear what it is, instead of how it is used.
llvm-svn: 94448
2010-01-25 21:10:10 +00:00
Chris Lattner
ccabcd7f85
remove JumpTableDirective, it is always null.
...
llvm-svn: 94445
2010-01-25 20:52:54 +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
601ef33c77
mcstreamerize .file and .file. This also fixes an issue where the
...
normal form of .file would fail if the filename had a weird character
in it.
llvm-svn: 94437
2010-01-25 18:58:59 +00:00
Chris Lattner
bc696445e1
emit ELF .type directives through MCStreamer instead of doing it textually.
...
llvm-svn: 94436
2010-01-25 18:33:40 +00:00
Chris Lattner
bc8f638531
add symbol attribute support for the ELF .type directive.
...
llvm-svn: 94435
2010-01-25 18:30:45 +00:00
Chris Lattner
91dac6d570
emit the .size directive for global variables on ELF through
...
mcstreamer.
llvm-svn: 94416
2010-01-25 07:52:13 +00:00
Chris Lattner
0375d2fbe7
all supported target now have aligned common support.
...
llvm-svn: 94413
2010-01-25 07:29:13 +00:00
Chris Lattner
9f7667e4ad
coff targets support alignment on .comm
...
llvm-svn: 94410
2010-01-25 07:20:44 +00:00
Chris Lattner
823aed16f9
make -fno-rtti the default unless a directory builds with REQUIRES_RTTI.
...
llvm-svn: 94378
2010-01-24 20:43:08 +00:00
Chris Lattner
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
b1301f7bce
mcize lcomm, simplify .comm, extend both to support 64-bit sizes.
...
llvm-svn: 94299
2010-01-23 07:47:02 +00:00
Chris Lattner
76bdea3290
resolve a fixme: the "nonexecutable stack directive" is actually
...
a .section. Switch to it with SwitchSection.
However, I think that this directive should be safe on any ELF target.
If so, we should hoist it up out of the X86 and SystemZ targets.
llvm-svn: 94298
2010-01-23 07:21:06 +00:00
Chris Lattner
0bfd279b37
mcize visibility directives.
...
llvm-svn: 94295
2010-01-23 06:53:23 +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
1deb09c28d
mcstreamerize .no_dead_strip and .reference for static ctors/dtors.
...
llvm-svn: 94290
2010-01-23 05:51:36 +00:00
Chris Lattner
4225a7b987
mcize jump table and constant pool entry labels, .local on elf,
...
and some .weak directives.
llvm-svn: 94284
2010-01-23 05:19:23 +00:00
Chris Lattner
ded9af63bb
teach MCAsmStreamer::EmitBytes to use .ascii and .asciz
...
llvm-svn: 94259
2010-01-23 00:15:00 +00:00
Chris Lattner
1386a88c95
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
a3eee3cb69
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
8fa0e35f97
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
e1d8a319a1
rename addComment -> AddComment for consistency.
...
llvm-svn: 94190
2010-01-22 18:21:35 +00:00
Benjamin Kramer
94b993ed8a
Simplify some uses of str(n)cmp with StringRef.
...
llvm-svn: 94189
2010-01-22 18:21:23 +00:00
Chris Lattner
cfa5ebc336
add comment support to the rest of the directives.
...
llvm-svn: 94168
2010-01-22 07:36:39 +00:00
Chris Lattner
e649401824
stop using strtoll, it gives windows heartburn.
...
llvm-svn: 94167
2010-01-22 07:34:12 +00:00
Chris Lattner
38e9219f71
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
0522eb2160
pass "-fasm-verbose" into createAsmStreamer.
...
llvm-svn: 94165
2010-01-22 07:06:15 +00:00
Chris Lattner
7ba0661f27
Stop building RTTI information for *most* llvm libraries. Notable
...
missing ones are libsupport, libsystem and libvmcore. libvmcore is
currently blocked on bugpoint, which uses EH. Once it stops using
EH, we can switch it off.
This #if 0's out 3 unit tests, because gtest requires RTTI information.
Suggestions welcome on how to fix this.
llvm-svn: 94164
2010-01-22 06:49:46 +00:00
Chris Lattner
5b0e01c54e
move some files out of the llvm-mc tool into the MCParser library so
...
other tools can link it.
llvm-svn: 94131
2010-01-22 01:58:08 +00:00
Chris Lattner
9a184b368b
forgot to svn add these, doh.
...
llvm-svn: 94130
2010-01-22 01:55:10 +00:00
Chris Lattner
00646cfbd4
create a new MCParser library and move some stuff into it.
...
llvm-svn: 94129
2010-01-22 01:44:57 +00:00
Chris Lattner
1edfeb2c46
don't forget to initialize an instance variable!
...
llvm-svn: 94021
2010-01-20 20:48:59 +00:00
Chris Lattner
9fc980403e
use getGlobalDirective(), don't hardcode .globl. PR6093
...
llvm-svn: 94006
2010-01-20 17:50:30 +00:00
Chris Lattner
45eeffcc2a
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
38caaf14c1
give createAsmStreamer an 'isLittleEndian' argument.
...
llvm-svn: 93986
2010-01-20 06:39:07 +00:00
Chris Lattner
2b4364fe03
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
003b5c8472
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
dc50e5d128
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
936b0d3144
Promoted the getTok() method to MCAsmParser so that
...
the two token accessor functions are declared consistently.
Modified the clients of MCAsmParser to reflect this change.
llvm-svn: 93916
2010-01-19 21:44:56 +00:00
Chris Lattner
c35681b298
Generalize mcasmstreamer data emission APIs to take an address space
...
identifier. There is no way to work around it.
llvm-svn: 93896
2010-01-19 19:46:13 +00:00
Chris Lattner
ed89f60f5e
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
4340cb3246
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
0c65fd4902
add a "MCStreamer::EmitFill" method, and move the default implementation
...
(which just iteratively emits bytes) to MCStreamer.
llvm-svn: 93888
2010-01-19 18:45:47 +00:00
Chris Lattner
9c31b0c695
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
cd2915e467
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
95b98959b0
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
b1f2934fc7
hookize the cygwin ".linkonce" directive.
...
llvm-svn: 93855
2010-01-19 05:08:13 +00:00
Chris Lattner
dccbb28bca
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
e9d28b19cf
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
1d371882b6
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
e945172ba4
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
c8f7717808
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
8b5d55ed06
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
043e656797
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
83e872e1c4
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
660d979ad9
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
18bcf30497
unbreak the build, grr symlinks.
...
llvm-svn: 93539
2010-01-15 19:51:05 +00:00
Chris Lattner
528d00b913
extend MCAsmParser::ParseExpression and ParseParenExpression
...
to return range information for subexpressions. Use this to
provide range info for several new X86Operands.
llvm-svn: 93534
2010-01-15 19:28:38 +00:00
Chris Lattner
b9d1f5a006
tidy
...
llvm-svn: 93352
2010-01-13 21:21:29 +00:00
Chris Lattner
8361006264
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
7b42d7067e
Change errs() to dbgs().
...
llvm-svn: 92635
2010-01-05 01:28:22 +00:00
David Greene
ac7f537d57
Change errs() to dbgs().
...
llvm-svn: 92634
2010-01-05 01:28:17 +00:00
David Greene
cdf0452ed2
Change errs() to dbgs().
...
llvm-svn: 92632
2010-01-05 01:28:10 +00:00
David Greene
a8cbfb8acc
Change errs() to dbgs().
...
llvm-svn: 92630
2010-01-05 01:28:07 +00:00
Daniel Dunbar
ad36e8aceb
Pass StringRef by value.
...
llvm-svn: 86251
2009-11-06 10:58:06 +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
Chris Lattner
86dfd73c38
add a twine version of MCContext::GetOrCreateSymbol.
...
llvm-svn: 84561
2009-10-19 22:49:00 +00:00
Daniel Dunbar
5d9134747b
MC: Set symbol values in MachO MCStreamer.
...
llvm-svn: 84236
2009-10-16 01:58:23 +00:00
Daniel Dunbar
e024def785
Minor formatting tweaks.
...
llvm-svn: 84235
2009-10-16 01:58:15 +00:00
Daniel Dunbar
8e6d889d4c
MC: Switch assembler API to using MCExpr instead of MCValue.
...
llvm-svn: 84234
2009-10-16 01:58:03 +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
Daniel Dunbar
17b9027b5c
MC: Move assembler variable values from MCContext to MCSymbol.
...
llvm-svn: 84229
2009-10-16 01:33:57 +00:00
Daniel Dunbar
584a1b25ef
MC: Switch MCContext value table to storing MCExprs.
...
llvm-svn: 84228
2009-10-16 01:33:11 +00:00
Kevin Enderby
818b6b96cb
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
50d75a6099
No newline at end of files.
...
llvm-svn: 83318
2009-10-05 18:43:19 +00:00
Chris Lattner
a15f0044a0
eliminate a use of strtoul.
...
llvm-svn: 82382
2009-09-20 06:58:54 +00:00
Anton Korobeynikov
592638ae05
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
b866602f06
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
6a833f6806
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
2251293788
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
813efa2551
Update CMake.
...
llvm-svn: 81757
2009-09-14 05:22: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
Chris Lattner
de57d8e72b
add a new MCInstPrinter class, move the (trivial) MCDisassmbler ctor inline.
...
llvm-svn: 81745
2009-09-14 01:43:38 +00:00
Chris Lattner
a4760f3642
'printMCInst' doesn't print newlines after instructions anymore.
...
llvm-svn: 81723
2009-09-13 22:24:34 +00:00
Chris Lattner
d940dd5801
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
de79e4fc2e
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
3d6c8ebb58
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
5090e6c4a7
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
c74e09f654
Update CMake files.
...
llvm-svn: 81577
2009-09-11 21:49:45 +00:00
Chris Lattner
d747a9f21f
canonicalize namespace gymnastics
...
llvm-svn: 81402
2009-09-09 23:46:42 +00:00
Sean Callanan
1358fb7feb
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
cada1c1012
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
22833a3cd6
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
7975b8fc32
Print "X-42" instead of "X+-42".
...
llvm-svn: 81203
2009-09-08 06:37:35 +00:00
Chris Lattner
3cfc551f6e
make formatting of expressions more closely match the existing asmprinter.
...
llvm-svn: 81202
2009-09-08 06:34:07 +00:00
Chris Lattner
a0020be758
tidy whitespace.
...
llvm-svn: 81201
2009-09-08 06:27:48 +00:00
Chris Lattner
1945453843
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
f4366a3998
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
1800dff44e
inline insertion operators.
...
llvm-svn: 80888
2009-09-03 05:33:01 +00:00
Chris Lattner
f16a122213
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
4fa0595b94
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
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
73da11ebda
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
945e257e99
llvm-mc: Make MCSymbolData symbol member const.
...
llvm-svn: 80573
2009-08-31 08:08:06 +00:00
Daniel Dunbar
02c7254f6d
llvm-mc: Add MCContext to MCAssembler.
...
llvm-svn: 80572
2009-08-31 08:07:55 +00:00
Daniel Dunbar
b34a2b9da1
llvm-mc: Add MCExpr::{dump,print}.
...
llvm-svn: 80570
2009-08-31 08:07:33 +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
2a2459a291
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
2701eee0ad
llvm-mc: Support .comm emission.
...
llvm-svn: 80351
2009-08-28 07:08:35 +00:00
Daniel Dunbar
42a39d038a
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
a468a12dfa
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
d82ef0e923
llvm-mc: Factor getSectionData out of SwitchSection.
...
llvm-svn: 80344
2009-08-28 05:48:54 +00:00
Daniel Dunbar
96abad185d
llvm-mc: Emit .lcomm as .zerofill.
...
llvm-svn: 80343
2009-08-28 05:48:46 +00:00
Daniel Dunbar
cf72e1c03e
llvm-mc: Add const to EmitZeroFill section argument.
...
llvm-svn: 80341
2009-08-28 05:48:22 +00:00
Daniel Dunbar
93665faad0
llvm-mc: Fix thinko in emitting values.
...
llvm-svn: 80340
2009-08-28 05:48:10 +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
c4f0e7e28d
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
212b6d8a57
Add {MCInst,MCOperand}::{print,dump}
...
llvm-svn: 80231
2009-08-27 07:57:12 +00:00
Daniel Dunbar
9cefb135a5
Update CMake
...
llvm-svn: 80195
2009-08-27 02:08:37 +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
47f11ac5b5
Try to make MSVC just a little happier.
...
llvm-svn: 80187
2009-08-27 00:38:04 +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
e2697738a4
llvm-mc/Mach-O: Set .subsections_via_symbols flag properly.
...
llvm-svn: 80144
2009-08-26 21:22:22 +00:00
Daniel Dunbar
c4581eaca8
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
a9eeb78ed5
llvm-mc/Mach-O: Move symbol indices into the MCSymbolData structure.
...
llvm-svn: 80088
2009-08-26 13:57:54 +00:00
Daniel Dunbar
c1710a04ba
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
ffda9eb31a
llvm-mc: Change MCContext value table to take const MCSymbol*s.
...
llvm-svn: 80079
2009-08-26 09:16:57 +00:00
Daniel Dunbar
066d0f93bf
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
aef5317edd
llvm-mc/Mach-O: Set addresses for symbols.
...
llvm-svn: 80065
2009-08-26 02:48:04 +00:00
Daniel Dunbar
c2c0bf961f
llvm-mc: Improve indirect symbol support (add the indirect index table).
...
llvm-svn: 80059
2009-08-26 00:18:21 +00:00
Bill Wendling
a9f56a686c
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
5a07d6a9c6
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
dd14b4a77a
Add the #include here.
...
llvm-svn: 80032
2009-08-25 21:09:50 +00:00
Bill Wendling
485591273c
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
582d61026d
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
04a1158d13
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
d341e781da
llvm-mc: Tweak undefined symbol handling.
...
llvm-svn: 79898
2009-08-24 08:39:57 +00:00
Chris Lattner
06fa176862
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
4db6267a2c
Update CMake build, unbreak linux build.
...
llvm-svn: 79779
2009-08-22 22:07:08 +00:00
Chris Lattner
e9a75a6654
rename TAI -> MAI, being careful not to make MAILJMP instructions :)
...
llvm-svn: 79777
2009-08-22 21:43:10 +00:00
Chris Lattner
054574666a
rename COFFMCAsmInfo -> MCAsmInfoCOFF, likewise for darwin.
...
llvm-svn: 79773
2009-08-22 21:03:30 +00:00
Chris Lattner
2b9f0d100b
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
7b26fce23e
Rename TargetAsmInfo (and its subclasses) to MCAsmInfo.
...
llvm-svn: 79763
2009-08-22 20:48:53 +00:00
Chris Lattner
ca098517a3
prune some redundant #includes.
...
llvm-svn: 79746
2009-08-22 19:35:08 +00:00
Chris Lattner
8f816e7d68
tweak #includes
...
llvm-svn: 79744
2009-08-22 19:19:12 +00:00
Daniel Dunbar
d1859474a7
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
ff3eafd39d
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
38728fe481
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
fef19ffe3a
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
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
b1068e4fe3
llvm-mc/Mach-O: Support .o emission for .org and .align.
...
llvm-svn: 79684
2009-08-21 23:07:38 +00:00
Daniel Dunbar
4ef7fb9530
llvm-mc/Mach-O: Support byte and fill value emission.
...
llvm-svn: 79652
2009-08-21 18:29:01 +00:00
Benjamin Kramer
c20529945a
Update CMakeLists.
...
llvm-svn: 79617
2009-08-21 11:28:56 +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
Chris Lattner
78b23b0e3f
fix asmstreaming of 2/4 byte elements with pow-2 alignments.
...
llvm-svn: 79408
2009-08-19 06:35:36 +00:00
Chris Lattner
37b7234a75
switch asmprinter to emit alignments through OutStreamer.
...
llvm-svn: 79406
2009-08-19 06:12:02 +00:00
Chris Lattner
4b7dadb76e
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
f446070b62
null streamer needs to maintain the current section as well.
...
llvm-svn: 79343
2009-08-18 16:46:29 +00:00
Chris Lattner
0adae25ec1
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
aa1526419c
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
a61e93d4b5
give MCAsmStreamer a TargetAsmInfo.
...
llvm-svn: 79222
2009-08-17 04:23:44 +00:00
Chris Lattner
962c5bd803
formatting cleanups, no functionality change.
...
llvm-svn: 79221
2009-08-17 04:17:34 +00:00
Chris Lattner
0fbe0f51a4
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
6cb1eb5a6d
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
c773141e66
*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
c2346a3037
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
563a7e87e3
llvm-mc: zerofill shouldn't print quotes around the section,segment.
...
llvm-svn: 79017
2009-08-14 18:51:45 +00:00
Oscar Fuentes
67f7fbdf9e
CMake: updated list of source files for library MC.
...
llvm-svn: 78988
2009-08-14 04:14:45 +00:00
Daniel Dunbar
80d484e7cc
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
1a019d8554
Add MCSymbol::{print, dump}
...
llvm-svn: 78983
2009-08-14 03:41:23 +00:00
Daniel Dunbar
afe6603590
Add MCValue::{print, dump}
...
llvm-svn: 78982
2009-08-14 03:11:09 +00:00
Daniel Dunbar
cbf4faf48d
llvm-mc: Move MCAsmToken::getLoc() into MC library where it belongs.
...
llvm-svn: 78980
2009-08-14 02:18:40 +00:00
Dan Gohman
3e0bd7852f
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
aba5fb8c9a
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
62e6a8bbe6
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
df743ae603
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
607cd3b63a
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
04b4700ebc
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
b691316838
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
6c20391d38
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
cb307a27bf
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
f4c2eee251
always end a section with \n on elf.
...
llvm-svn: 78534
2009-08-09 15:31:10 +00:00
Chris Lattner
591105c540
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
1cb9396f4f
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
245fdfb9c3
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
5a9bc50fa8
stub out PECOFF/MachO/ELF MCSection classes
...
llvm-svn: 78499
2009-08-08 20:50:49 +00:00
Chris Lattner
c9c277ba0f
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
95bad379a9
All MCSections are now required to have a SectionKind.
...
llvm-svn: 77787
2009-08-01 18:25:49 +00:00
Daniel Dunbar
e0cbd9b986
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
c10132aa79
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
b37f29b6f3
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
6d1e79dded
Expose Tokens to target specific assembly parsers.
...
llvm-svn: 77337
2009-07-28 17:58:44 +00:00
Daniel Dunbar
eb6bb32bef
llvm-mc: Implement .abort fully in the front end
...
llvm-svn: 77272
2009-07-27 23:20:52 +00:00
Daniel Dunbar
52d03b252e
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
a87555aaa8
Move MCContext and friends to StringRef based APIs.
...
llvm-svn: 77251
2009-07-27 21:22:30 +00:00
Kevin Enderby
ee5513582d
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
2b11c7de4a
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
3c2a893ac7
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
915b1229d4
Update CMake file.
...
llvm-svn: 76264
2009-07-17 23:50:26 +00:00
Daniel Dunbar
8c6bad2f66
llvm-mc: Add -triple, and start fetching the target asm printer.
...
llvm-svn: 76257
2009-07-17 22:38:58 +00:00
Kevin Enderby
dd27e5e10a
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
693fbb8fee
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
09ea5709a2
Added llvm-mc support for parsing the .dump and .load directives.
...
llvm-svn: 75786
2009-07-15 15:30:11 +00:00
Kevin Enderby
d1ea5393c9
Added llvm-mc support for parsing the .include directive.
...
llvm-svn: 75711
2009-07-14 23:21:55 +00:00
Kevin Enderby
cbe475dfe8
Added llvm-mc support for parsing the .lsym directive.
...
llvm-svn: 75685
2009-07-14 21:35:03 +00:00
Kevin Enderby
4c21caa656
Added llvm-mc support for parsing the .desc directive.
...
llvm-svn: 75645
2009-07-14 18:17:10 +00:00
Torok Edwin
fbcc663cbf
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
56523ceba1
Added llvm-mc support for parsing the .abort directive.
...
llvm-svn: 75545
2009-07-13 23:15:14 +00:00
Kevin Enderby
c9d93ef2c6
add llvm-mc support for parsing the .subsections_via_symbols directive.
...
llvm-svn: 75500
2009-07-13 21:03:15 +00:00
Torok Edwin
56d0659726
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
07cadaf113
add support for .zerofill, patch by Kevin Enderby!
...
llvm-svn: 75301
2009-07-10 22:20:30 +00:00
Chris Lattner
28ad7547d2
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
a1e11f530e
Implement parsing support for the .comm directive. Patch by
...
Kevin Enderby!
llvm-svn: 74944
2009-07-07 20:30:46 +00:00
Daniel Dunbar
23a72aa476
Dump MCInsts in the MC .s printer, for now.
...
llvm-svn: 74593
2009-07-01 06:35:03 +00:00
Daniel Dunbar
cc566a714b
llvm-mc: Parse .{,b,p2}align{,w,l} directives.
...
llvm-svn: 74478
2009-06-29 23:46:59 +00:00
Torok Edwin
6fb3e98eed
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
a97615adf8
Rename MCValue::getCst to getConstant and add MCValue::isConstant.
...
llvm-svn: 74440
2009-06-29 19:51:00 +00:00
Daniel Dunbar
188e87fa21
MC: Truncate values when printing, to keep 'as' happy.
...
llvm-svn: 74201
2009-06-25 21:03:18 +00:00
Daniel Dunbar
71ea89dd86
Sketch streamer support for .align, .org functionality.
...
llvm-svn: 74109
2009-06-24 19:25:34 +00:00
Daniel Dunbar
f782ebc0cb
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
59ff06e83c
MCStreamer: Add a few more "symbol attributes".
...
llvm-svn: 74077
2009-06-24 16:36:52 +00:00
Daniel Dunbar
de5777022c
MCStreamer: Test printing values.
...
llvm-svn: 74076
2009-06-24 16:05:35 +00:00
Duncan Sands
cfe7626413
Add new files to cmake list.
...
llvm-svn: 74071
2009-06-24 10:03:44 +00:00
Chris Lattner
3f5738d599
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
9faf273fc4
Start MCAsmStreamer implementation.
...
llvm-svn: 74044
2009-06-24 01:03:06 +00:00
Daniel Dunbar
badeace84a
Update for MCImm -> MCValue rename.
...
llvm-svn: 74024
2009-06-23 23:39:15 +00:00
Daniel Dunbar
ca29e4d7f4
Start flushing out MCContext.
...
- Lives inside new library lib/MC (LLVMMC.a)
llvm-svn: 74013
2009-06-23 22:01:43 +00:00