Kevin Enderby
7bcc9e9450
Incorporate Daniel's suggestion and use !isdigit(CurPtr[0]) and not
...
CurPtr[0] == '\n' when testing the character after a "0b" when looking
to see if it part of a something like "jmp 0b".
llvm-svn: 104039
2010-05-18 18:09:20 +00:00
Kevin Enderby
53e0631516
Fixed the problem with a branch to "0b" that was not parsed by llvm-mc
...
correctly. The Lexer was incorrectly eating the newline casusing it to branch
to address 0. Updated the test case to use a "0:" label and a branch to "0b".
llvm-svn: 104038
2010-05-18 17:51:35 +00:00
Daniel Dunbar
d5563f420a
MC/Mach-O: Implement support for setting indirect symbol table offset in section header.
...
Also, create symbol data for LHS of assignment, to match 'as' symbol ordering better.
llvm-svn: 104033
2010-05-18 17:28:24 +00:00
Daniel Dunbar
f16c12d7a1
MC/Mach-O: Remove some FIXMEs.
...
llvm-svn: 104032
2010-05-18 17:28:20 +00:00
Daniel Dunbar
39617bb08a
MC/Mach-O: Fail faster/harder when we see .file, which isn't yet supported.
...
llvm-svn: 104031
2010-05-18 17:28:17 +00:00
Benjamin Kramer
ab7be75e3f
Simplify MCContext::(Next|Get)Instance
...
- Allocate MCLabels in the context so they don't leak.
- Avoid duplicated densemap lookup.
llvm-svn: 104020
2010-05-18 12:15:34 +00:00
Kevin Enderby
0510b48fd9
Added support in MC for Directional Local Labels.
...
llvm-svn: 103989
2010-05-17 23:08:19 +00:00
Eric Christopher
9635b3da6b
More data/parsing support for tls directives. Add a few more testcases
...
and cleanup comments as well.
llvm-svn: 103985
2010-05-17 22:53:55 +00:00
Daniel Dunbar
bb166bed40
MC/Mach-O/x86: Optimal nop sequences should only be used for the .text sections, not all sections in the text segment.
...
llvm-svn: 103981
2010-05-17 21:54:30 +00:00
Daniel Dunbar
ce5e1bb326
MC: Add dyn_cast support to MCSection.
...
- Of questionable utility, since in general anything which wants to do this should probably be within a target specific hook, which can rely on the sections being of the appropriate type. However, it can be useful for short term hacks.
llvm-svn: 103980
2010-05-17 21:54:26 +00:00
Daniel Dunbar
b7b796cc11
MC/Mach-O: Reverse order of SymbolData scanning when emitting instructions.
...
- This fixes a string table mismatch with 'as' when two new symbols are defined
in a single instruction.
llvm-svn: 103979
2010-05-17 21:19:59 +00:00
Eric Christopher
bf79238599
Add some section and constant support for darwin TLS.
...
llvm-svn: 103974
2010-05-17 21:02:07 +00:00
Daniel Dunbar
0211a96989
MC/Mach-O: Fix some differences in symbol flag handling.
...
- Don't clear weak reference flag, 'as' was only "trying" to do this, it wasn't
actually succeeding.
- Clear the "lazy bound" bit when we mark something external. This corresponds
roughly to the lazy clearing of the bit that 'as' implements in
symbol_table_lookup.
- The exact meaning of these flags appears pretty loose, since 'as' isn't very
consistent. For now we just try to match 'as', we will clean this up one day
hopefully.
llvm-svn: 103964
2010-05-17 20:12:31 +00:00
Daniel Dunbar
9b4a824217
llvm-mc: Support reassignment of variables in one special case, when the
...
variable has not yet been used in an expression. This allows us to support a few
cases that show up in real code (mostly because gcc generates it for Objective-C
on Darwin), without giving up a reasonable semantic model for assignment.
llvm-svn: 103950
2010-05-17 17:46:23 +00:00
Eric Christopher
68b1bbe66a
Assume that we'll handle mangling the symbols earlier and just put the
...
symbol to the file as we have it. Simplifies out tbss handling.
llvm-svn: 103928
2010-05-17 02:13:02 +00:00
Daniel Dunbar
2493ddfe42
MC/Mach-O/x86_64: Darwin's special "signed_N" relocation types should only be
...
used to replace a normal relocation, not a reference to a GOT entry.
llvm-svn: 103789
2010-05-14 18:53:40 +00:00
Eric Christopher
9fb6bb07ca
Add AsmParser support for darwin tbss directive.
...
Nothing uses this yet.
llvm-svn: 103757
2010-05-14 01:50:28 +00:00
Eric Christopher
bc81885ff7
Fix a couple of typos.
...
llvm-svn: 103756
2010-05-14 01:38:54 +00:00
Daniel Dunbar
4bce748aa2
MC: Switch to completely lazy layout.
...
- The eliminates the last major algorithmic problem with MC.
llvm-svn: 103754
2010-05-14 00:51:14 +00:00
Daniel Dunbar
9abade1017
MC: Extend MCAsmLayout to explicitly track which fragments have been layed out, and enforce several invariants to LayoutFragment to ensure we only do layout in a sensible order.
...
llvm-svn: 103753
2010-05-14 00:37:21 +00:00
Daniel Dunbar
3eedc26e18
MC: Implicitly assign section addresses when the previous fragment is layed out.
...
llvm-svn: 103752
2010-05-14 00:37:17 +00:00
Daniel Dunbar
8f9d2266e6
MC: Switch MCFragment to storing the layout order index, not its index in the file.
...
llvm-svn: 103751
2010-05-14 00:37:14 +00:00
Daniel Dunbar
a99a23b061
MC: Change LayoutSection() to only do the section initializiation.
...
Also, elimminate MCAsmLayout::set*, which are no longer needed.
llvm-svn: 103750
2010-05-14 00:37:11 +00:00
Daniel Dunbar
b9f6ac094a
MC: Move Layout{Fragment,Section} into MCAsmLayout, and add LayoutFile().
...
llvm-svn: 103738
2010-05-13 20:40:12 +00:00
Daniel Dunbar
454ea716a3
MC: Factor out MCAssembler::ComputeFragmentSize.
...
llvm-svn: 103724
2010-05-13 18:35:06 +00:00
Daniel Dunbar
484c6fc825
MC: Add section layout order indices to MCSectionData.
...
llvm-svn: 103715
2010-05-13 15:17:26 +00:00
Daniel Dunbar
aa8bd69886
MC: Move ordinal calculation, to make sure fragments synthesized for layout get assigned ordinals properly.
...
llvm-svn: 103711
2010-05-13 08:43:37 +00:00
Daniel Dunbar
e73353c720
MC: Create dummy fragments to avoid ever having empty sections, which simplifies layout.
...
llvm-svn: 103710
2010-05-13 08:43:34 +00:00
Daniel Dunbar
e8845ef4db
MC: Add MCAsmLayout::FragmentReplaced() helper function.
...
llvm-svn: 103709
2010-05-13 08:43:31 +00:00
Daniel Dunbar
5a93253fc8
Fix -Asserts warning.
...
llvm-svn: 103697
2010-05-13 03:50:50 +00:00
Daniel Dunbar
d83889bd87
MC: Eliminate MCSectionData::{,Address,File}Size, which can now be computed by
...
utility functions.
llvm-svn: 103695
2010-05-13 03:19:50 +00:00
Daniel Dunbar
c7c53ea715
MC: Switch to using explicit MCAlignFragments with OnlyAlignAddress bit instead
...
of manually doing padding/editing layout in LayoutSection().
- This probably seems like six-of-one and half-dozen of another, but there
is a method to my madness.
llvm-svn: 103693
2010-05-13 02:34:14 +00:00
Daniel Dunbar
a6780da661
MC: Add MCAlignFragment::OnlyAlignAddress bit. This is a bit of magic that says the align fragment shouldn't contribute to the logical section size, it is will be used for cleaning up the code to handle section alignment.
...
llvm-svn: 103690
2010-05-13 01:10:26 +00:00
Daniel Dunbar
4dac59dcb7
MC: Add MCSectionData::AddressSize, which is the size of the address space consumed by the section. This can differ from both the section logical size, and the section size on disk (although the current code handles this without making an explicit distinction).
...
llvm-svn: 103689
2010-05-13 01:10:22 +00:00
Chris Lattner
8cb4728a15
fix rdar://7965971 and a fixme: use ParseIdentifier in
...
ParseDirectiveDarwinZerofill instead of hard coding the
check for identifier. This allows quoted symbol names to
be used.
llvm-svn: 103682
2010-05-13 00:10:34 +00:00
Daniel Dunbar
b76df22a2e
MC: Move MCAlignFragment::EmitNops value out of the constructor.
...
llvm-svn: 103665
2010-05-12 22:56:23 +00:00
Daniel Dunbar
4405ffc688
MC: Eliminate MCZeroFillFragment, it is no longer needed.
...
llvm-svn: 103664
2010-05-12 22:51:38 +00:00
Daniel Dunbar
7cd309f7dc
MC: Explicitly check that only virtual fragments appear in virtual sections.
...
llvm-svn: 103663
2010-05-12 22:51:35 +00:00
Daniel Dunbar
597eb48168
MC: Switch MCFillFragment to storing total fill size instead of a count. This allows using ValueSize==0 to represent a virtual fill.
...
llvm-svn: 103662
2010-05-12 22:51:32 +00:00
Daniel Dunbar
51402b79e4
MC: Drop support for alignment in ZeroFill fragment, we can just use
...
MCAlignFragments for this.
llvm-svn: 103661
2010-05-12 22:51:27 +00:00
Daniel Dunbar
7d73564b82
Simplify.
...
llvm-svn: 103651
2010-05-12 21:47:55 +00:00
Daniel Dunbar
a7cc32a7b6
MC: Factor out MCAssembler::LayoutFragment
...
llvm-svn: 103649
2010-05-12 21:35:25 +00:00
Daniel Dunbar
2abec791f1
MC: Tweak section layout to not relying on accumulating address value.
...
llvm-svn: 103648
2010-05-12 21:35:22 +00:00
Daniel Dunbar
a11479eb49
MC: Simplify LayoutSection to just take the index of the section to layout.
...
llvm-svn: 103627
2010-05-12 17:56:47 +00:00
Daniel Dunbar
e02c1f6834
MC: Track section layout order explicitly, and use to simplify.
...
llvm-svn: 103616
2010-05-12 15:42:59 +00:00
Nathan Jeffords
d2de49ddda
stylistic change to MCSectionCOFF::PrintSwitchToSection COMDAT handling
...
Made a stylistic changed to the code/comments related to the unsupported COMDAT selection type IMAGE_COMDAT_SELECT_LARGEST based on from Anton Korobeynikov.
llvm-svn: 103590
2010-05-12 07:36:03 +00:00
Rafael Espindola
b69c7b76f1
Add support for movi32 of global values to the new (MC) asm printer.
...
llvm-svn: 103576
2010-05-12 05:16:34 +00:00
Nathan Jeffords
76a07580ad
updated support for the COFF .linkonce
...
Now, the .linkonce directive is emitted as part of MCSectionCOFF::PrintSwitchToSection instead of AsmPrinter::EmitLinkage since it is an attribute of the section the symbol was placed into not the symbol itself.
llvm-svn: 103568
2010-05-12 04:26:09 +00:00
Daniel Dunbar
ba2f4c3884
MC/Mach-O/x86_64: Add a new hook for checking whether a particular section can
...
be diced into atoms, and adjust getAtom() to take this into account.
- This fixes relocations to symbols in fixed size literal sections, for
example.
llvm-svn: 103532
2010-05-12 00:38:17 +00:00
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