Daniel Dunbar
53ce0e12d8
MC/Mach-O/x86_64: Fix PCrel adjustment for x86_64, which was using the fixup
...
offset instead of the fixup address as intended.
llvm-svn: 103527
2010-05-11 23:53:11 +00:00
Daniel Dunbar
7c6f0e3827
MC/Mach-O: As Kevin pointed out, 'Address' is really an offset -- rename to clarify.
...
llvm-svn: 103526
2010-05-11 23:53:07 +00:00
Daniel Dunbar
795baa1972
MC/Mach-O: Fix a crash on invalid.
...
llvm-svn: 103525
2010-05-11 23:53:05 +00:00
Daniel Dunbar
3937e28da0
MC/Mach-O x86_64: Switch to using fragment atom symbol.
...
- This eliminates getAtomForAddress() (which was a linear search) and
simplifies getAtom().
- This also fixes some correctness problems where local labels at the same
address as non-local labels could be assigned to the wrong atom.
llvm-svn: 103480
2010-05-11 17:22:50 +00:00
Daniel Dunbar
75778984f9
MC/Mach-O: Fix another mismatch with .weak_definition, we shouldn't use a
...
scattered relocation entry with a .weak_definition.
llvm-svn: 103443
2010-05-10 23:15:20 +00:00
Daniel Dunbar
7de3106a89
MC/Mach-O: Factor out doesSymbolRequireExternRelocation.
...
llvm-svn: 103442
2010-05-10 23:15:13 +00:00
Daniel Dunbar
aadb2cac49
MC/Mach-O: Explicitly track atoms, as represented by their defining symbol, for each fragment (not yet used).
...
llvm-svn: 103438
2010-05-10 22:45:09 +00:00
Nathan Jeffords
da7d01404d
test commit, added a comment to MCSectionCOFF::PrintSwitchToSection function
...
llvm-svn: 103372
2010-05-09 05:49:00 +00:00
Chris Lattner
72afa956db
break coff symbol definition stuff out into proper MCStreamer callbacks,
...
patch by Nathan Jeffords!
llvm-svn: 103346
2010-05-08 19:54:22 +00:00
Chris Lattner
028449325b
add COFF support for COMDAT sections, patch by Nathan Jeffords!
...
llvm-svn: 103304
2010-05-07 21:49:09 +00:00
Kevin Enderby
51bed9c870
Fix i386 relocations to Weak Definitions. The relocation entries should be
...
external and the item to be relocated should not have the address of the
symbol added in.
llvm-svn: 103302
2010-05-07 21:44:23 +00:00
Ted Kremenek
58a0bd48ad
Update CMake build.
...
llvm-svn: 103269
2010-05-07 17:29:48 +00:00
Chris Lattner
87cffa9498
switch MCSectionCOFF from a syntactic to semantic representation,
...
patch by Peter Housel!
llvm-svn: 103267
2010-05-07 17:17:41 +00:00
Daniel Dunbar
b0ceb764b8
Revert r103137, fix for $ in labels. It looks like we can't actually handle this
...
at the token level. Consider the following horrible test case:
a = 1
.globl $a
movl ($a), %eax
movl $a, %eax
movl $$a, %eax
llvm-svn: 103178
2010-05-06 14:46:38 +00:00
Chris Lattner
482fa218d4
fix rdar://7946934 - in some limited cases, the assembler should
...
allow $ at the start of a symbol name.
llvm-svn: 103137
2010-05-05 23:51:28 +00:00
Daniel Dunbar
f3a53baf00
MC/Mach-O: Mark absolute variable's appropriately, and add Mach-O support for
...
writing them.
- <rdar://problem/7885351> integrated assembler broken for i386 objc code
llvm-svn: 103112
2010-05-05 19:01:05 +00:00
Daniel Dunbar
deb7ba9cc0
MC: Reject attempts to define a variable symbol.
...
llvm-svn: 103111
2010-05-05 19:01:00 +00:00
Daniel Dunbar
8557426958
MC: Make setVariableValue check the redefinition condition a bit more strongly.
...
llvm-svn: 103110
2010-05-05 19:00:56 +00:00
Daniel Dunbar
7a989da0af
MC: Rename MCSymbol::{g,s}etValue -> MCSymbol::{g,s}etVariableValue.
...
llvm-svn: 103095
2010-05-05 17:41:00 +00:00
Daniel Dunbar
027fa5f31c
MC/Mach-O/x86_64: Relocations in debug sections should use local relocations
...
when possible.
- <rdar://problem/7934873>
llvm-svn: 103092
2010-05-05 17:22:39 +00:00
Daniel Dunbar
ce0c1e11ce
llvm-mc: Fix case were we would skip a line in the .s file after an instruction
...
match failure.
Also, fixes a few memory leak FIXMEs.
llvm-svn: 102986
2010-05-04 00:33:07 +00:00
Mon P Wang
b0a0a26df1
Add support for assemblers that don't support periods in a name
...
llvm-svn: 102594
2010-04-29 04:00:56 +00:00
Chris Lattner
926885c090
refactor .if handling code a bit.
...
llvm-svn: 101659
2010-04-17 18:14:27 +00:00
Chris Lattner
6b55cb9cd8
implement mc asmparser support for '.', which gets the
...
current PC. rdar://7834775
We now produce an identical .o file compared to the cctools
assembler for something like this:
_f0:
L0:
jmp L1
.long . - L0
L1:
jmp A
.long . - L1
.zerofill __DATA,_bss,A,0
llvm-svn: 101227
2010-04-14 04:40:28 +00:00
Chris Lattner
5418dd5fda
move elf section uniquing to MCContext. Along the way
...
merge XCore's section into MCSectionELF
llvm-svn: 100812
2010-04-08 21:26:26 +00:00
Chris Lattner
2073112fc0
move macho section uniquing from MCParser and TLOF to MCContext where
...
the compiler and asmparser now unique to the same sections. This fixes
rdar://7835021.
llvm-svn: 100807
2010-04-08 20:30:37 +00:00
Benjamin Kramer
53dd088b58
Various MSVC warning fixes about truncated 64 bit shifts and const pointers passed to free.
...
llvm-svn: 100767
2010-04-08 15:25:57 +00:00
Chris Lattner
2104b8d36e
rename llvm::llvm_report_error -> llvm::report_fatal_error
...
llvm-svn: 100709
2010-04-07 22:58:41 +00:00
Chris Lattner
3b21e4d404
Give AsmParser an option to control whether it finalizes
...
the stream. New demo:
$ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o
$ otool -tv t.o
t.o:
(__TEXT,__text) section
_foo:
0000000000000000 subq $0x08,%rsp
0000000000000004 movl %edi,(%rsp)
0000000000000007 movl %edi,%eax
0000000000000009 incl %eax
000000000000000b movl %eax,(%rsp)
000000000000000e movl %eax,0x04(%rsp)
0000000000000012 addq $0x08,%rsp
0000000000000016 ret
llvm-svn: 100492
2010-04-05 23:15:42 +00:00
Chris Lattner
324c86600d
eliminate the magic AbsoluteDebugSectionOffsets MAI hook,
...
which is really a property of the section being referenced.
Add a predicate to MCSection to replace it.
Yay for reduction in magic.
llvm-svn: 100367
2010-04-04 23:22:29 +00:00
Chris Lattner
e239fa05cd
isAbsoluteEHSectionOffsets always returns false, eliminate it
...
and substitute false at the one call site.
llvm-svn: 100354
2010-04-04 21:29:44 +00:00
Chris Lattner
7012916275
fix an ugly wart in the MCInstPrinter api where the
...
raw_ostream to print an instruction to had to be specified
at MCInstPrinter construction time instead of being able
to pick at each call to printInstruction.
llvm-svn: 100307
2010-04-04 05:04:31 +00:00
Chris Lattner
1716721df1
add a twine form of MCStreamer::EmitRawText, and mc'ize
...
a few more things in AsmPrinter.cpp.
llvm-svn: 100294
2010-04-03 22:12:35 +00:00
Chris Lattner
aca014e24e
allow attaching comments to raw text.
...
llvm-svn: 100292
2010-04-03 22:06:56 +00:00
Chris Lattner
6ec72d2e8f
add <cstdlib> header for abort() on linux builders.
...
llvm-svn: 100290
2010-04-03 21:48:59 +00:00
Chris Lattner
8a87fb7633
add a new EmitInlineAsm function to asmprinter to handle inline asm.
...
If we have an MCAsmStreamer, we continue to emit asm textually,
otherwise we (currently) emit an error to errs and ignore it.
llvm-svn: 100289
2010-04-03 21:35:55 +00:00
Chris Lattner
9897043928
Rip out the 'is temporary' nonsense from the MCContext interface to
...
create symbols. It is extremely error prone and a source of a lot
of the remaining integrated assembler bugs on x86-64.
This fixes rdar://7807601.
llvm-svn: 99902
2010-03-30 18:10:53 +00:00
Daniel Dunbar
c95156262d
MC/Mach-O/x86_64: Support @GOTPCREL on symbols, even for non-PCrel relocations!
...
llvm-svn: 99853
2010-03-29 23:56:40 +00:00
Daniel Dunbar
d821f4ac60
llvm-mc: Add a -mc-relax-all option, which relaxes every fixup. We always need
...
exactly two passes in that case, and don't ever need to recompute any layout,
so this is a nice baseline for relaxation performance.
llvm-svn: 99563
2010-03-25 22:49:09 +00:00
Daniel Dunbar
6432bd744e
MC: Stop restarting layout on every relaxation.
...
- Still O(N^2), just a faster form, and now its the MCAsmLayout's fault.
On the .s I am tuning against (combine.s from 403.gcc):
--
ddunbar@lordcrumb:MC$ diff stats-before.txt stats-after.txt
5,10c5,10
< 1728 assembler - Number of assembler layout and relaxation steps
< 7707 assembler - Number of emitted assembler fragments
< 120588 assembler - Number of emitted object file bytes
< 2233448 assembler - Number of evaluated fixups
< 1727 assembler - Number of relaxed instructions
< 6723845 mcexpr - Number of MCExpr evaluations
---
> 3 assembler - Number of assembler layout and relaxation steps
> 7707 assembler - Number of emitted assembler fragments
> 120588 assembler - Number of emitted object file bytes
> 14796 assembler - Number of evaluated fixups
> 1727 assembler - Number of relaxed instructions
> 67889 mcexpr - Number of MCExpr evaluations
--
Feel free to LOL at the -before numbers, if you like.
I am a little surprised we make more than 2 relaxation passes. It's pretty
trivial for us to do relaxation out-of-order if that would give a speedup.
llvm-svn: 99543
2010-03-25 19:35:56 +00:00
Daniel Dunbar
0ba6a671d4
MC: Simplify main section layout process by moving alignment into LayoutSection.
...
llvm-svn: 99529
2010-03-25 18:16:42 +00:00
Daniel Dunbar
25d114b2b2
MC: Sink Section address assignment into LayoutSection.
...
llvm-svn: 99528
2010-03-25 18:16:38 +00:00
Daniel Dunbar
951459740c
MC/Mach-O: Switch to MCSectionData::getOrdinal.
...
llvm-svn: 99504
2010-03-25 08:08:54 +00:00
Daniel Dunbar
4108802628
MC: Explicity track section and fragment ordinals.
...
llvm-svn: 99500
2010-03-25 07:10:11 +00:00
Daniel Dunbar
eaa792f0d9
Fix -Asserts warning.
...
llvm-svn: 99499
2010-03-25 07:10:05 +00:00
Daniel Dunbar
5b07334c0d
MC: Route access to SectionData offset and file size through MCAsmLayout.
...
llvm-svn: 99474
2010-03-25 02:00:07 +00:00
Daniel Dunbar
2522dd1c49
MC: Route access to Fragment offset and effective size through MCAsmLayout.
...
llvm-svn: 99473
2010-03-25 02:00:02 +00:00
Daniel Dunbar
5d98824615
MC: Eliminate MC{Fragment,{Section,Symbol}Data}::getAddress.
...
llvm-svn: 99467
2010-03-25 01:03:24 +00:00
Daniel Dunbar
5caf2ff561
MC: Fix refacto in MCExpr evaluation, I mistakenly replaced a fragment address with a symbol address.
...
- This fixes the integrated-as nightly test regressions.
llvm-svn: 99466
2010-03-25 01:03:17 +00:00
Daniel Dunbar
7c969558d9
MC: Direct all {fragment,section,symbol} address access through the MCAsmLayout object.
...
llvm-svn: 99380
2010-03-24 03:43:40 +00:00
Daniel Dunbar
5376c2a431
MC: Sprinkle in some more interesting statistics.
...
llvm-svn: 99350
2010-03-23 23:47:14 +00:00
Daniel Dunbar
5cfb58719d
llvm-mc: Fast path EvaluateAbsolute of constants.
...
llvm-svn: 99348
2010-03-23 23:47:07 +00:00
Daniel Dunbar
de04b3f62c
MC: Switch to using MCInst fragments to do relaxation.
...
Also, both MCMachOStreamer and MCAssembler are now target independent!
llvm-svn: 99256
2010-03-23 05:09:03 +00:00
Daniel Dunbar
86face8333
MC: Add TargetAsmBackend::MayNeedRelaxation, for checking whether a particular instruction + fixups might need relaxation.
...
llvm-svn: 99249
2010-03-23 03:13:05 +00:00
Daniel Dunbar
a9ae3ae698
MC: Add TargetAsmBackend::WriteNopData and use to eliminate some target dependencies in MCMachOStreamer and MCAssembler.
...
llvm-svn: 99248
2010-03-23 02:36:58 +00:00
Daniel Dunbar
16cbe95dd6
MC: Tweak MCInstFragment to include the encoded data and fixups, so that we don't need to recompute them during relaxation. I will revisit this once all the other pieces of fast relaxation are in place.
...
llvm-svn: 99244
2010-03-23 01:39:05 +00:00
Jeffrey Yasskin
a99d232803
Put MCSectionCOFF::Name into the MCContext instead of leaking it.
...
llvm-svn: 99231
2010-03-22 23:26:12 +00:00
Daniel Dunbar
b31c49a70d
MC: Add MCInstFragment, not used yet.
...
llvm-svn: 99229
2010-03-22 23:16:48 +00:00
Daniel Dunbar
a75f01a905
Add a FIXME.
...
llvm-svn: 99228
2010-03-22 23:16:43 +00:00
Daniel Dunbar
fdc7ccc4e4
MC: Fix a few more cases we were passing an MCDataFragment when a MCFragment would do, and sprinkle in some const.
...
llvm-svn: 99218
2010-03-22 21:49:41 +00:00
Daniel Dunbar
20ea02fde2
Simplify.
...
llvm-svn: 99217
2010-03-22 21:49:38 +00:00
Daniel Dunbar
04047fbe14
MCInst: Add ::dump_pretty.
...
llvm-svn: 99216
2010-03-22 21:49:34 +00:00
Daniel Dunbar
a0ab4bf989
MC: Change MCObjectWriter::RecordRelocation to take an MCFragment (instead of a MCDataFragment). Object files should only need the generic MCFragment features.
...
llvm-svn: 99205
2010-03-22 20:35:50 +00:00
Daniel Dunbar
f1f1827bfa
MC/Mach-O: Factor out getOrCreateDataFragment().
...
llvm-svn: 99204
2010-03-22 20:35:46 +00:00
Daniel Dunbar
9213355a91
MC: Eliminate MCFragment::getMaxFileSize.
...
llvm-svn: 99203
2010-03-22 20:35:43 +00:00
Daniel Dunbar
32ffc58ca9
MC: Share the MCAsmLayout object, although its still not used for anything important.
...
llvm-svn: 99202
2010-03-22 20:35:35 +00:00
Daniel Dunbar
5ea5fab22b
Better fix for r98994, MachObjectWriterImpl wasn't intended to be virtual.
...
llvm-svn: 99031
2010-03-20 01:58:40 +00:00
Rafael Espindola
07b4f8cd4b
Fix -Wnon-virtual-dtor warning.
...
llvm-svn: 98994
2010-03-19 21:26:46 +00:00
Daniel Dunbar
1a81ad3559
MC/Mach-O/x86_64: Add relocation support.
...
- This is "extraordinarily" Darwin 'as' compatible. See the litany of FIXMEs littered about for more information.
- There are a few cases which seem to clearly be 'as' bugs which I have left unsupported, and there is one cases where we diverge but should fix if it blocks diffing .o files (Darwin 'as' ends up widening a jump unnecessarily).
- 403.gcc build, runs, and diffs equivalently to the 'as' built version now (using llvm-mc). However, it builds so slowly that I wouldn't recommend trying it quite yet. :)
llvm-svn: 98974
2010-03-19 18:07:55 +00:00
Daniel Dunbar
4d7c8645fd
MC: Add TargetAsmBackend::createObjectWriter.
...
- MCAssembler is now object-file independent, although we will surely need more work to fully support ELF/COFF.
llvm-svn: 98955
2010-03-19 10:43:26 +00:00
Daniel Dunbar
eaa367f5ae
MCCodeEmitter: Add target independent fixup flag for is-pc-relative.
...
llvm-svn: 98954
2010-03-19 10:43:23 +00:00
Daniel Dunbar
1bd7171c95
MC: Sink code emitter into MCAssembler.
...
llvm-svn: 98953
2010-03-19 10:43:18 +00:00
Daniel Dunbar
79e0e5a631
MC/Mach-O: Move to MachObjectWriter.{h,cpp}.
...
llvm-svn: 98952
2010-03-19 10:43:15 +00:00
Daniel Dunbar
c5084cccc8
MC: Add TargetAsmBackend::isVirtualSection hook.
...
llvm-svn: 98950
2010-03-19 09:29:03 +00:00
Daniel Dunbar
f027abf7de
MC: Split MCObjectWriter out of MCAssembler.cpp.
...
llvm-svn: 98949
2010-03-19 09:28:59 +00:00
Daniel Dunbar
49e5a8ac2a
MCAssembler: Pull out MCObjectWriter class.
...
llvm-svn: 98948
2010-03-19 09:28:55 +00:00
Daniel Dunbar
f0517efc6c
MCAssembler: Move ApplyFixup to the TargetAsmBackend, this is a target specific not object writer specific task.
...
llvm-svn: 98947
2010-03-19 09:28:12 +00:00
Daniel Dunbar
3cab275783
MC/Mach-O: Lift the fixup evaluation and application up (to the same place), and eliminate MCAsmFixup::FixedValue.
...
llvm-svn: 98944
2010-03-19 07:09:47 +00:00
Daniel Dunbar
d84d196a86
MC/Mach-O: Factor out ExecutePostLayoutBinding, to separate the post-layout changes the object writer may need to make to the assembler from the actual .o writing.
...
llvm-svn: 98943
2010-03-19 07:09:33 +00:00
Daniel Dunbar
563d40eda6
MC/Mach-O: Lift relocation emission logic a bit higher to separate evaluation / relocation handling from the actual .o writing.
...
llvm-svn: 98942
2010-03-19 07:09:18 +00:00
Chris Lattner
90a7859ebc
fix an MCInstPrinter leak that jyasskin pointed out:
...
createAsmStreamer now takes ownership of the instprinter.
llvm-svn: 98939
2010-03-19 05:48:53 +00:00
Daniel Dunbar
0f7fbb3d00
MC/Mach-O: Add isScatteredFixupFullyResolved, which implements the correct algorithm (used on x86_64) for determining whether an evaluated fixup is fully resolved (doesn't need relocation).
...
- Test cases will follow, once we have x86_64 relocation support.
llvm-svn: 98926
2010-03-19 03:18:18 +00:00
Daniel Dunbar
6e13bb07fb
MC/Mach-O/x86_64: Add getAtom[ForAddress].
...
- These find the defining symbol which identifies the containing atom for a symbol or address. They are currently very slow, but will be eliminated eventually.
llvm-svn: 98925
2010-03-19 03:18:15 +00:00
Daniel Dunbar
5ec4bdd1b3
MC/Mach-O: Factor out isScatteredFixupFullyResolvedSimple predicate, and fix some corner cases.
...
llvm-svn: 98924
2010-03-19 03:18:12 +00:00
Daniel Dunbar
c558ec211f
MC/Mach-O: Factor out isSymbolLinkerVisible method; "linker visible" is a made up term to refer to non-temporary labels + temporary labels in sections-which-require symbols. For Darwin, it corresponds to symbols which effectively define an atom.
...
llvm-svn: 98923
2010-03-19 03:18:09 +00:00
Daniel Dunbar
9c64ec0a7e
MCValue: Change to holding MCSymbolRefExprs instead of MCSymbols, we will need this for accessing to symbol modifiers.
...
llvm-svn: 98791
2010-03-18 00:59:10 +00:00
Daniel Dunbar
6544baff6f
MC/Darwin: Add a new target hook for whether the target uses "reliable" symbol differences, basically whether the assembler should attempt to understand atoms when using scattered symbols.
...
Also, avoid some virtual call overhead.
llvm-svn: 98789
2010-03-18 00:58:53 +00:00
Chris Lattner
aed00fa039
fix GetOrCreateTemporarySymbol to require a name, clients
...
should use CreateTempSymbol() if they don't care about the
name.
llvm-svn: 98712
2010-03-17 05:41:18 +00:00
Daniel Dunbar
5599256415
MC: Allow modifiers in MCSymbolRefExpr, and eliminate X86MCTargetExpr.
...
- Although it would be nice to allow this decoupling, the assembler needs to be able to reason about MCSymbolRefExprs in too many places to make this viable. We can use a target specific encoding of the variant if this becomes an issue.
- This patch also extends llvm-mc to support parsing of the modifiers, as opposed to lumping them in with the symbol.
llvm-svn: 98592
2010-03-15 23:51:06 +00:00
Daniel Dunbar
fe8d866fc7
MC/Mach-O/x86_64: Temporary labels in cstring sections require symbols (and external relocations, but we don't have x86_64 relocations yet).
...
llvm-svn: 98583
2010-03-15 21:56:50 +00:00
Daniel Dunbar
232dc953ac
MC/Mach-O: Add MCSectionMachO::getType()
...
llvm-svn: 98582
2010-03-15 21:56:38 +00:00
Chris Lattner
133487696a
fix a memory leak yjasskin pointed out: MCSymbol is bump pointer
...
allocated and thus not freed. This is cool except that it contains
and std::string so the string data didn't get freed. In any case
there is no reason to redundantly store the string data in the
MCSymbol anyway, just make the MCSymbol ref the string data in the
MCContext StringMap.
llvm-svn: 98536
2010-03-15 06:15:35 +00:00
Chris Lattner
073d817958
add a new CreateTempSymbol method, the use case for
...
CreateTempSymbol vs GetOrCreateTemporarySymbol are
completely different.
llvm-svn: 98486
2010-03-14 08:23:30 +00:00
Daniel Dunbar
aa8f95eb56
MC: Fix a crash on invalid, attempting to evaluate undefined symbols.
...
llvm-svn: 98464
2010-03-14 03:10:40 +00:00
Daniel Dunbar
7c1f3d8cad
MC/X86_64: Symbol support.
...
llvm-svn: 98456
2010-03-13 22:49:35 +00:00
Daniel Dunbar
56597588f0
MC/Mach-O: Initial x86_64 support.
...
llvm-svn: 98454
2010-03-13 22:10:17 +00:00
Chris Lattner
341b1d25f1
add a hack to allow parsing negative minint. rdar://7751341
...
llvm-svn: 98442
2010-03-13 19:25:13 +00:00
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