Commit Graph

386 Commits

Author SHA1 Message Date
Daniel Dunbar
53b2338a1d MC: Split MCObjectWriter out of MCAssembler.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98949 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 09:28:59 +00:00
Daniel Dunbar
bdd9281f35 MCAssembler: Pull out MCObjectWriter class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98948 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 09:28:55 +00:00
Daniel Dunbar
87190c473c MCAssembler: Move ApplyFixup to the TargetAsmBackend, this is a target specific not object writer specific task.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98947 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 09:28:12 +00:00
Daniel Dunbar
b1e98945e4 MC/Mach-O: Lift the fixup evaluation and application up (to the same place), and eliminate MCAsmFixup::FixedValue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98944 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 07:09:47 +00:00
Daniel Dunbar
bacba99778 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98943 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 07:09:33 +00:00
Daniel Dunbar
17a0650641 MC/Mach-O: Lift relocation emission logic a bit higher to separate evaluation / relocation handling from the actual .o writing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98942 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 07:09:18 +00:00
Chris Lattner
4c42a6de9f fix an MCInstPrinter leak that jyasskin pointed out:
createAsmStreamer now takes ownership of the instprinter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98939 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 05:48:53 +00:00
Daniel Dunbar
034843ac8b 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98926 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 03:18:18 +00:00
Daniel Dunbar
8ad0dccbf2 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98925 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 03:18:15 +00:00
Daniel Dunbar
939f8d7ca2 MC/Mach-O: Factor out isScatteredFixupFullyResolvedSimple predicate, and fix some corner cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98924 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 03:18:12 +00:00
Daniel Dunbar
2386985663 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98923 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 03:18:09 +00:00
Daniel Dunbar
9a1d20042f MCValue: Change to holding MCSymbolRefExprs instead of MCSymbols, we will need this for accessing to symbol modifiers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98791 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 00:59:10 +00:00
Daniel Dunbar
0682951b4f 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98789 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 00:58:53 +00:00
Chris Lattner
77e7694026 fix GetOrCreateTemporarySymbol to require a name, clients
should use CreateTempSymbol() if they don't care about the
name.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98712 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17 05:41:18 +00:00
Daniel Dunbar
4e815f8a8c 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98592 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-15 23:51:06 +00:00
Daniel Dunbar
d6e59084d0 MC/Mach-O/x86_64: Temporary labels in cstring sections require symbols (and external relocations, but we don't have x86_64 relocations yet).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98583 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-15 21:56:50 +00:00
Daniel Dunbar
99d22adcad MC/Mach-O: Add MCSectionMachO::getType()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98582 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-15 21:56:38 +00:00
Chris Lattner
c28cc093e3 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98536 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-15 06:15:35 +00:00
Chris Lattner
1d72a76616 add a new CreateTempSymbol method, the use case for
CreateTempSymbol vs GetOrCreateTemporarySymbol are
completely different.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98486 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 08:23:30 +00:00
Daniel Dunbar
d3da36286f MC: Fix a crash on invalid, attempting to evaluate undefined symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98464 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-14 03:10:40 +00:00
Daniel Dunbar
5691e74f97 MC/X86_64: Symbol support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98456 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 22:49:35 +00:00
Daniel Dunbar
ee0d89245e MC/Mach-O: Initial x86_64 support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98454 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 22:10:17 +00:00
Chris Lattner
3a151be8d5 add a hack to allow parsing negative minint. rdar://7751341
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98442 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 19:25:13 +00:00
Daniel Dunbar
da3e9f760c 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98420 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 02:38:00 +00:00
Daniel Dunbar
5e6a7a248b llvm-mc: Support -n, useful for comparing -integrated-as output since the
compiler may not lead with the text section.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98418 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 02:20:57 +00:00
Daniel Dunbar
f08fde41f3 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! :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98396 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 22:07:14 +00:00
Chris Lattner
8a29fa6e02 move fastcall/stdcall mangling up into Mangler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98384 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 21:03:47 +00:00
Daniel Dunbar
df3c8f2969 MC: Factor out MCAssembler::EvaluateFixup, and simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98381 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 21:00:49 +00:00
Daniel Dunbar
a0e36d55c4 MC: Constify MCAsmLayout argument to MCExpr::EvaluteAs...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98380 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 21:00:45 +00:00
Daniel Dunbar
8315a357e4 MC: Add MCAssembler::addFixup, which enforces that fixups are added in order.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98379 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 21:00:38 +00:00
Chris Lattner
fdab14b105 remove MAI argument from createAsmStreamer since it
can get it from the context now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98361 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 18:28:53 +00:00
Chris Lattner
1a5c28f471 enhance MCContext::GetOrCreateTemporarySymbol() to create a new symbol
with an arbitrary unique name.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98294 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 22:56:10 +00:00
Chris Lattner
c18409aed8 change MCContext to always have an MCAsmInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98293 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 22:53:35 +00:00
Chris Lattner
19a994766f empty symbols aren't possible, the mcsymbol ctor aborts on them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98288 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 21:38:58 +00:00
Daniel Dunbar
8f0448cabc MC/Mach-O: Add MCSymbolData::getAddress() utility.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98266 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 18:22:51 +00:00
Daniel Dunbar
979ba5b3c7 MC/Mach-O: Implement "absolutizing" semantics of .set, by evaluating the assembly time value of variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98241 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 05:53:37 +00:00
Daniel Dunbar
18ff2cced7 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98240 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 05:53:33 +00:00
Daniel Dunbar
f82f4490b1 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98227 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 02:28:59 +00:00
Daniel Dunbar
1f3e445184 MC: Provide MCAssembler with a TargetAsmBackend.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98222 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-11 01:34:27 +00:00
Daniel Dunbar
2101d9c4af MC/Mach-O: Use the MCAssembler symbol map instead of reconstructing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98187 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 20:58:31 +00:00
Daniel Dunbar
46836a783a MC: Move the backend section and symbol data maps to MCAssembler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98186 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 20:58:29 +00:00
Daniel Dunbar
0965200ac2 Remove unneeded includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98167 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 17:56:05 +00:00
Chris Lattner
09d53fecfc move three lowering hooks from MAI to TLOF and make one of them
semantic instead of syntactic.  This completes MCization of
darwin/x86[-64]!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98145 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 07:20:42 +00:00
Chris Lattner
98cdab53c3 set the temporary bit on MCSymbols correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98124 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 02:25:11 +00:00
Daniel Dunbar
07a9641ebf MC/Mach-O: Resolve a FIXME; these relocation types are no longer semanticaly different.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98120 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 02:10:29 +00:00
Chris Lattner
00685bb5cf eliminate MCContext::CreateSymbol and CreateTemporarySymbol.
Add a new GetOrCreateTemporarySymbol method and a version that
takes a twine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98118 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 01:29:27 +00:00
Daniel Dunbar
a015c1c876 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98115 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 00:58:25 +00:00
Chris Lattner
2e5dd9b741 make the NullStreamer set the section on a label when emitted so that isDefined() works.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98100 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-09 23:12:18 +00:00
Daniel Dunbar
f3a066f7c3 MC/Mach-O: For PCrel relocations, we need to compensate for the PCrel adjustment when determining if we need a scattered relocation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98082 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-09 21:27:58 +00:00
Daniel Dunbar
aef9d7af69 MC/Mach-O: Also set the PCrel bit in the second half of paired relocation entries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98081 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-09 21:27:47 +00:00
Daniel Dunbar
e180fa962c MC/Mach-O: Don't generate relocations for PCrel fixups to local labels.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98080 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-09 21:27:30 +00:00
Daniel Dunbar
45aefff64c MC/Mach-O: Tweak .dump() formatting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98028 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-09 01:12:23 +00:00
Daniel Dunbar
f8b8ad77a8 MC/Mach-O: Don't adjust section sizes when aligning zero fill sections, just pad the address.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98027 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-09 01:12:20 +00:00
Chris Lattner
6cde3e6e99 add a EmitSymbolValue convenience method to MCStreamer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98017 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-09 00:39:24 +00:00
Daniel Dunbar
b2b4acd757 MC/Macho-O: Align the zerofill section itself to the maximum alignment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97991 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-08 22:03:42 +00:00
Daniel Dunbar
37fad5ce4d MC/Mach-O: Fix address compution for zero fill sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97984 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-08 21:10:42 +00:00
Daniel Dunbar
0ce6bd55c3 MC/Mach-O: Error out instead of crashing on invalid scattered relocation expressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97983 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-08 21:10:39 +00:00
Chris Lattner
f60e9bbbad pass in more section kinds, enough to get the .align 0x90
stuff to emit optimal nops in the right places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97233 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-26 18:32:26 +00:00
Kevin Enderby
d74acb0c78 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97158 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25 18:46:04 +00:00
Kevin Enderby
76687083a5 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96988 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23 21:41:24 +00:00
Chris Lattner
ec167fd987 genericize MCAsmStreamer::EmitCodeAlignment to support other targets
so that it doesn't break them when the code generator starts using it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96966 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23 18:44:31 +00:00
Kevin Enderby
6e72048add 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96963 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23 18:26:34 +00:00
Daniel Dunbar
40ebe2473a MC/Mach-O: Remove non-sensical comment, and add a missing AddValueSymbols call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96809 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 22:08:57 +00:00
Daniel Dunbar
12783d1c3a MC/X86: Add stub AsmBackend.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96763 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 21:54:14 +00:00
Daniel Dunbar
e7bd886cb8 MC: Sketch registry support for target specific assembler backends.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96762 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 21:53:53 +00:00
Daniel Dunbar
eb3804e39a MC/Mach-O: Update fixup values for change to X86 offsets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96532 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17 23:45:16 +00:00
Duncan Sands
9a7795cbed Pacify gcc-4.5, which warns (correctly) that these switches have
cases that are not part of the enum.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96477 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17 14:52:22 +00:00
Daniel Dunbar
591047f714 MCAssembler: Fix pcrel relocations. Oh and,
--
ddunbar@ozzy:tmp$ clang -m32 -integrated-as hello.c && ./a.out
hello world!
--

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96096 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 09:45:59 +00:00
Daniel Dunbar
f6346769b3 MC/Mach-O: Start emitting fixups/relocations for instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96095 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 09:29:02 +00:00
Daniel Dunbar
2be2fd0730 MCAssembler: Switch MCAsmFixup to storing MCFixupKind instead of just a size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96094 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 09:28:54 +00:00
Daniel Dunbar
0bcf074867 MCAssembler: Sink fixup list into MCDataFragment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96093 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 09:28:43 +00:00
Daniel Dunbar
a4766d7af9 MCAssembler: Switch MCFillFragment to only taking constant values. Symbolic expressions can always be emitted as data + fixups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96092 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 09:28:32 +00:00
Daniel Dunbar
45f4874611 MC/Mach-O: Implement EmitValue using data fragments + fixups instead of fill fragment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96091 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 09:28:22 +00:00
Daniel Dunbar
3a30b827a5 MCAssembler: Start applying fixups in the data section.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96090 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 09:28:15 +00:00
Daniel Dunbar
b7c3a4b195 MCAssembler: Add assorted dump() methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96089 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 09:28:03 +00:00
Daniel Dunbar
e9a60eb498 MC/AsmParser: Attempt to constant fold expressions up-front. This ensures we avoid fixups for obvious cases like '-(16)'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96064 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 01:28:07 +00:00
Chris Lattner
7e85180d15 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95929 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 22:39:10 +00:00
Daniel Dunbar
cb7d743b42 MC: Move assembler-backend's fixup list into the fragment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95926 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 21:29:46 +00:00
Daniel Dunbar
27ade18431 MC: Move MCSectionData::Fixup out to MCAsmFixup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95925 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 21:29:29 +00:00
Chris Lattner
8d31de6268 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95924 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 21:27:18 +00:00
Daniel Dunbar
5d5a1e13a1 MC: Switch MCFixup to just hold an MCExpr pointer instead of index into the
MCInst it came from.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95767 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 04:47:08 +00:00
Daniel Dunbar
5532cf44a0 llvm-mc: Remove --show-fixups and always show as part of --show-encoding.
Also, fix a silly memory leak.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95752 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 01:41:14 +00:00
Chris Lattner
a2bd92b130 daniel *really* likes fixups!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95742 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 01:05:28 +00:00
Chris Lattner
5d672cfab0 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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95728 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 00:10:18 +00:00
Daniel Dunbar
6b71653c82 llvm-mc: Add --show-fixups option, for displaying the instruction fixup information in the asm comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95710 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-09 23:00:14 +00:00
Daniel Dunbar
73c557458c MC: First cut at MCFixup, for getting fixup/relocation information out of an MCCodeEmitter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95708 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-09 22:59:55 +00:00
Chris Lattner
30d9a644d5 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)>>





git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95637 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-09 00:54:51 +00:00
Dan Gohman
036c130e90 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95619 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 23:58:47 +00:00
Chris Lattner
df9c4380ee don't make hte dtor private or we can't construct the class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95587 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 22:07:36 +00:00
Chris Lattner
5d917a8952 add scaffolding for target-specific MCExprs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95559 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 19:41:07 +00:00
Chris Lattner
342cbdcc5e 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95441 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05 22:20:08 +00:00
Daniel Dunbar
73163f875a MC: Change default comment column to 40 characters.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95378 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05 07:32:18 +00:00
Dan Gohman
523d70ec1f Use a tab instead of space after .type, for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95272 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-04 01:42:13 +00:00
Daniel Dunbar
9dee8e3009 llvm-mc: Add --show-inst option, for showing the MCInst inline with the assembly
output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95227 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-03 18:18:30 +00:00
Chris Lattner
8ef2cef676 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]



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95207 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-03 06:28:13 +00:00
Chris Lattner
56591ab218 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95155 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-02 23:37:42 +00:00
Daniel Dunbar
e1ec617c6a MC/Mach-O: Set SOME_INSTRUCTIONS bit for sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95135 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-02 21:44:01 +00:00
Chris Lattner
45f8c095ad Add a new top-level MachO.h file for manifest constants, fixing
a layering violation from MC -> Target.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95113 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-02 19:38:14 +00:00
Chris Lattner
111a3193b5 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94623 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 23:51:52 +00:00
Chris Lattner
cee63322ea 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94585 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 20:40:54 +00:00