Commit Graph

736 Commits

Author SHA1 Message Date
Daniel Dunbar 828984ff4e MC/AsmParser: Add .macros_{off,on} support, not that makes sense since we don't
support macros.

llvm-svn: 108649
2010-07-18 18:38:02 +00:00
Daniel Dunbar d8a1845c31 MC/AsmParser: Use Error() instead of calling PrintMessage() directly.
llvm-svn: 108648
2010-07-18 18:31:45 +00:00
Daniel Dunbar ba6e354b61 MC/AsmParser: Fix TokError() to accept a Twine.
llvm-svn: 108647
2010-07-18 18:31:42 +00:00
Daniel Dunbar 2a2c6cf5f9 MC/AsmParser: Hide the AsmParser implementation.
llvm-svn: 108646
2010-07-18 18:31:38 +00:00
Eli Friedman 9de5967244 Start of .sleb128/.uleb128 parsing support.
llvm-svn: 108612
2010-07-17 06:27:28 +00:00
Eli Friedman 9e36dd001a Work-in-progress parsing for ELF .section directive.
llvm-svn: 108609
2010-07-17 04:29:04 +00:00
Eli Friedman 56178a07bf Add support for parsing .size directives for ELF.
llvm-svn: 108606
2010-07-17 03:09:18 +00:00
Daniel Dunbar 01e3607d70 MC/AsmParser: Lift Run() and TargetParser to base class.
Also, add constructor function for creating AsmParser instances.

llvm-svn: 108604
2010-07-17 02:26:10 +00:00
Chris Lattner c2b3675f8b fix indentation and 80 cols
llvm-svn: 108460
2010-07-15 21:19:31 +00:00
Benjamin Kramer 92d8998348 Don't pass StringRef by reference.
llvm-svn: 108366
2010-07-14 22:38:02 +00:00
Daniel Dunbar ab058b83e0 MC/AsmParser: Move ELF specific parser to ELFAsmParser.cpp.
llvm-svn: 108196
2010-07-12 21:23:32 +00:00
Daniel Dunbar 0cb91cfc74 MC/AsmParser: Move Darwin specific parse to DarwinAsmParser.cpp.
llvm-svn: 108193
2010-07-12 20:51:51 +00:00
Daniel Dunbar a5bf6b6001 MC/AsmParser: Move .section parsing to Darwin specific parser.
llvm-svn: 108190
2010-07-12 20:42:34 +00:00
Daniel Dunbar aa59cf2686 MC/AsmParser: Move special section directive parsing to Darwin specific parser.
llvm-svn: 108187
2010-07-12 20:23:36 +00:00
Daniel Dunbar 80be44a2ac MC/AsmParser: Add a basic ELFAsmParser extension.
llvm-svn: 108185
2010-07-12 20:08:04 +00:00
Daniel Dunbar 101c14c940 MC/AsmParser: Inline AsmParser::CreateSymbol into callers.
llvm-svn: 108183
2010-07-12 19:52:10 +00:00
Daniel Dunbar d388c93f87 MC/AsmParser: Move .tbss and .zerofill parsing to Darwin specific parser.
llvm-svn: 108180
2010-07-12 19:37:35 +00:00
Daniel Dunbar 63a379dd5c MC/AsmParser: Move .desc parsing to Darwin specific parser.
llvm-svn: 108179
2010-07-12 19:22:53 +00:00
Daniel Dunbar b992f1a95b MC/AsmParser: Move .lsym parsing to Darwin specific parser.
llvm-svn: 108176
2010-07-12 19:08:25 +00:00
Daniel Dunbar ae9da1481a MC/AsmParser: Move some misc. Darwin directive handling to DarwinAsmParser.
llvm-svn: 108174
2010-07-12 18:49:22 +00:00
Daniel Dunbar c5011088cd MC/AsmParser: Add a DarwinAsmParser extension.
- Currently initialization is a bit of a hack, but harmless. We need to rework
   various parts of target initialization to clean this up.

llvm-svn: 108165
2010-07-12 18:12:02 +00:00
Daniel Dunbar dd41dcf270 MC/AsmParser: Switch a bunch of directive parsing to use accessors.
llvm-svn: 108163
2010-07-12 18:03:11 +00:00
Daniel Dunbar 86033407c9 MCAsmParser: Pull some directive handling out into a helper class, and change
DirectiveMap to be based on MCAsmParserExtension.

llvm-svn: 108161
2010-07-12 17:54:38 +00:00
Daniel Dunbar cc21af1dfb MC/AsmParser: Switch some directive parsing to use accessor methods.
llvm-svn: 108160
2010-07-12 17:45:27 +00:00
Daniel Dunbar af3d1de891 MC: Add MCAsmParserExtension, a base class for all the target/object specific
classes which want to extend the basic asm parser.

llvm-svn: 108158
2010-07-12 17:27:45 +00:00
Daniel Dunbar 4be8f2ffad MC: Move AsmParser::TokError to MCAsmParser().
llvm-svn: 108155
2010-07-12 17:18:45 +00:00
Daniel Dunbar 4042c33cd8 MC: Move getLoc() to MCAsmLexer().
llvm-svn: 108154
2010-07-12 17:10:00 +00:00
Duncan Sands 41b4a6b36a Convert some tab stops into spaces.
llvm-svn: 108130
2010-07-12 08:16:59 +00:00
Chris Lattner 2c52b7997c introduce WinCOFFObjectWriter, patch by Michael Spencer!
llvm-svn: 108103
2010-07-11 22:07:02 +00:00
Chris Lattner 56725be9ef introduce WinCOFFStreamer.cpp, patch by Michael Spencer!
llvm-svn: 108102
2010-07-11 22:05:00 +00:00
Kevin Enderby ea9207cd7a Revert some unneeded parts of the change in r107886 for the
.weak_def_can_be_hidden directive.  Chris pointed out that the MCAsmInfo.h/.cpp
chunks aren't needed for this until the compiler starts generating these.  And
when that happens it will be more convenient for it to be a bool than a const
char*.

llvm-svn: 107906
2010-07-08 20:30:44 +00:00
Kevin Enderby 082d0fd7ad Added the darwin .weak_def_can_be_hidden directive.
llvm-svn: 107886
2010-07-08 17:22:42 +00:00
Chris Lattner 05ea2a4791 finish up support for callw: PR7195
llvm-svn: 107826
2010-07-07 22:35:13 +00:00
Daniel Dunbar 0e980755d3 MC: Fix some stray hunks I didn't intend to commit.
llvm-svn: 107428
2010-07-01 20:48:51 +00:00
Daniel Dunbar 02877d6e85 MC: Pass the target instance to the AsmParser constructor.
llvm-svn: 107426
2010-07-01 20:41:56 +00:00
Daniel Dunbar 0aa4365e47 MC: Fix an error message.
llvm-svn: 107424
2010-07-01 20:20:01 +00:00
Daniel Dunbar 329d202362 MC: Move COFF enumeration constants to llvm/Support/COFF.h, patch by Michael
Spencer!

llvm-svn: 107418
2010-07-01 20:07:24 +00:00
Bill Wendling 3632171750 Revert r107205 and r107207.
llvm-svn: 107215
2010-06-29 22:34:52 +00:00
Bill Wendling 1767723dbe Introducing the "linker_weak" linkage type. This will be used for Objective-C
metadata types which should be marked as "weak", but which the linker will
remove upon final linkage. For example, the "objc_msgSend_fixup_alloc" symbol is
defined like this:

       .globl l_objc_msgSend_fixup_alloc
       .weak_definition l_objc_msgSend_fixup_alloc
       .section __DATA, __objc_msgrefs, coalesced
       .align 3
l_objc_msgSend_fixup_alloc:
        .quad   _objc_msgSend_fixup
        .quad   L_OBJC_METH_VAR_NAME_1

This is different from the "linker_private" linkage type, because it can't have
the metadata defined with ".weak_definition".

llvm-svn: 107205
2010-06-29 21:24:00 +00:00
Duncan Sands a85a90773c The variable ValueSize is set to 1 on both code paths, and then
ignored!  Remove it.

llvm-svn: 107138
2010-06-29 13:30:08 +00:00
Duncan Sands 1245e4c07d The variable "Value" is carefully set to Layout.getSymbolAddress,
but then not actually used - maybe a bug?  Remove the variable.

llvm-svn: 107137
2010-06-29 13:26:33 +00:00
Duncan Sands 5667a08468 Remove unused calls to Lexer.getLoc and the pointless variable HasFillExpr.
llvm-svn: 107136
2010-06-29 13:24:40 +00:00
Kevin Enderby e233dda2e2 Added the darwin .secure_log_unique and .secure_log_reset directives.
llvm-svn: 107077
2010-06-28 21:45:58 +00:00
Eric Christopher 7f85520644 Get the addend correct for i386 pic.
Thanks Daniel!

llvm-svn: 106608
2010-06-22 23:51:47 +00:00
Chris Lattner 79d2075e4a "This is just a cosmetic change in MCAsmStreamer.cpp/EmitSymbolAttribute: all attributes have now a \t before and after, as done for '.type'.
This makes the output look consistent, as well as help some third party assemblers expecting the attributes to be in the second column."

Patch by Arnaud de Grandmaison!

llvm-svn: 106469
2010-06-21 20:35:01 +00:00
Eric Christopher 93f16372f9 Update comment.
llvm-svn: 106191
2010-06-17 00:49:46 +00:00
Eric Christopher 74892d4f1f In progress on 32-bit addends.
llvm-svn: 106154
2010-06-16 21:32:38 +00:00
Daniel Dunbar ede8e6d2f0 MC/Mach-O: Rewrite atom association to be a final pass we do in Finish(), instead of tracking as part of emission.
- This allows sharing more code with the MCObjectStreamer.

llvm-svn: 106143
2010-06-16 20:04:32 +00:00
Daniel Dunbar aa627c39e4 MC: Simplify MCAssembler::isSymbolLinkerVisible to only take an MCSymbol.
llvm-svn: 106142
2010-06-16 20:04:29 +00:00
Daniel Dunbar b2347fe504 MC: Lift SwitchSection() and Finish() into MCObjectStreamer.
llvm-svn: 106141
2010-06-16 20:04:25 +00:00
Daniel Dunbar 8a3c9d9bc4 MC: Factor out an MCObjectStreamer class, which will be shared by the concrete
object file format writers.

llvm-svn: 106140
2010-06-16 20:04:22 +00:00
Eric Christopher 2092dc2acd Fix indentation.
llvm-svn: 106072
2010-06-16 00:26:36 +00:00
Eric Christopher a86c2bdd2c Some more work on mach-o TLV relocations.
llvm-svn: 106062
2010-06-15 22:59:05 +00:00
Dan Gohman a76715fc88 Don't call flush() at a library level which isn't checking for errors
and doesn't know where the output is going.

llvm-svn: 105274
2010-06-01 16:31:34 +00:00
Eric Christopher eaddfac539 Rearrange conditionals so we don't get caught with the correct type as wrong.
llvm-svn: 104793
2010-05-27 00:52:31 +00:00
Daniel Dunbar b889fc987e MC: When running with -mc-relax-all, we can eagerly relax instructions and avoid creating unnecessary MCInstFragments.
llvm-svn: 104736
2010-05-26 20:37:03 +00:00
Daniel Dunbar 9d40ef162b MC/Mach-O: Factor out EmitInstTo{Fragment,Data} for emitting MCInst's as MCInstFragments or appending onto an MCDataFragment.
llvm-svn: 104735
2010-05-26 20:37:00 +00:00
Daniel Dunbar 7c8bd0fc98 MC: Change RelaxInstruction to only take the input and output instructions.
llvm-svn: 104713
2010-05-26 18:15:06 +00:00
Daniel Dunbar 388ff9b1a2 MC: Eliminate an unnecessary copy.
llvm-svn: 104709
2010-05-26 17:50:16 +00:00
Daniel Dunbar a19838e107 MC: Simplify MayNeedRelaxation to not provide the fixups, so we can query it
before encoding.

llvm-svn: 104707
2010-05-26 17:45:29 +00:00
Daniel Dunbar b34440a6a8 MC: Eliminate MCAsmFixup, replace with MCFixup.
llvm-svn: 104699
2010-05-26 15:18:56 +00:00
Daniel Dunbar 353a91ff76 MC: Use accessors for access to MCAsmFixup.
llvm-svn: 104697
2010-05-26 15:18:31 +00:00
Daniel Dunbar 3627af5da4 MC: Change MCInst::dump_pretty to not include a trailing newline.
llvm-svn: 104696
2010-05-26 15:18:13 +00:00
Daniel Dunbar 870e5759e7 MC: Eliminate MCFragment vtable, which was unnecessary.
llvm-svn: 104689
2010-05-26 06:50:57 +00:00
Eric Christopher e7b64dcc1e Start adding mach-o tls reloc support.
llvm-svn: 104651
2010-05-26 00:02:12 +00:00
Daniel Dunbar 6738a2e39e llvm-mc: Use EmitIntValue where possible, which makes the API calls from the AsmParser and CodeGen line up better.
llvm-svn: 104467
2010-05-23 18:36:38 +00:00
Daniel Dunbar 8271d1bb4a llvm-mc: Use AddBlankLine in asm parser. This makes transliteration match the input much more closely, and also makes the API calls from the AsmParser and CodeGen line up better.
llvm-svn: 104466
2010-05-23 18:36:34 +00:00
Daniel Dunbar 3ff1a06de6 MC: Add an MCLoggingStreamer, for use in debugging integrated-as mismatches.
llvm-svn: 104463
2010-05-23 17:44:06 +00:00
Eric Christopher 09d47031b1 Expand on comment.
llvm-svn: 104396
2010-05-21 23:03:53 +00:00
Eric Christopher 3dca28d0e2 Fix section attribute name.
llvm-svn: 104381
2010-05-21 21:08:52 +00:00
Matt Fleming ec9d6faef0 Add support for parsing the ELF .type assembler directive.
llvm-svn: 104316
2010-05-21 11:36:59 +00:00
Matt Fleming 141791c6d1 Grammar fix. This is a test commit.
llvm-svn: 104264
2010-05-20 19:45:09 +00:00
Benjamin Kramer 7c3e230cd1 Reduce string trashing.
llvm-svn: 104223
2010-05-20 14:14:22 +00:00
Eric Christopher 27e7ffc7d4 Partial code for emitting thread local bss data.
llvm-svn: 104197
2010-05-20 00:49:07 +00:00
Chris Lattner 7cbfa4462f fix rdar://7986634 - match instruction opcodes case insensitively.
llvm-svn: 104183
2010-05-19 23:34:33 +00:00
Eric Christopher feedc90c57 Implement EmitTBSSSymbol for MachOStreamer.
Fixes build failure as well.

llvm-svn: 104059
2010-05-18 21:26:41 +00:00
Eric Christopher 5c87be766d Make EmitTBSSSymbol take a section argument so that we can find it later.
Fix up callers and users.

llvm-svn: 104057
2010-05-18 21:16:04 +00:00
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
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