Commit Graph

282 Commits

Author SHA1 Message Date
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
Rafael Espindola
2e2563bf8e Emit .comm alignment in bytes but .align in powers of 2 for ARM ELF.
Original patch by Sandeep Patel and updated by me.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94582 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 20:21:43 +00:00
Chris Lattner
6a315c358c eliminate MCAsmInfo::NeedsSet: we now just use .set on any platform
that has it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94581 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 20:20:43 +00:00
Chris Lattner
718fb59801 mcstreamerize gprel32 emission.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94452 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 21:28:50 +00:00
Chris Lattner
78f485afb7 rename MAI::PICJumpTableDirective to MAI::GPRel32Directive to
make it clear what it is, instead of how it is used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94448 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 21:10:10 +00:00