Commit Graph

99 Commits

Author SHA1 Message Date
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
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
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
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
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
a6594fc715 mcstreamerize .file and .file. This also fixes an issue where the
normal form of .file would fail if the filename had a weird character
in it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94437 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 18:58:59 +00:00
Chris Lattner
a800f7c464 emit ELF .type directives through MCStreamer instead of doing it textually.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94436 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 18:33:40 +00:00
Chris Lattner
ed0ab15170 add symbol attribute support for the ELF .type directive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94435 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 18:30:45 +00:00
Chris Lattner
99328add83 emit the .size directive for global variables on ELF through
mcstreamer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94416 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 07:52:13 +00:00
Chris Lattner
6559d7688e all supported target now have aligned common support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94413 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 07:29:13 +00:00
Chris Lattner
9eb158d5b4 mcize lcomm, simplify .comm, extend both to support 64-bit sizes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94299 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 07:47:02 +00:00
Chris Lattner
a5ad93a10a move the various directive enums out of the MCStreamer class
into a new MCDirectives.h file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94294 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 06:39:22 +00:00
Chris Lattner
3924868a95 mcize jump table and constant pool entry labels, .local on elf,
and some .weak directives.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94284 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 05:19:23 +00:00
Chris Lattner
12e555c36c teach MCAsmStreamer::EmitBytes to use .ascii and .asciz
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94259 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 00:15:00 +00:00
Chris Lattner
14ca177beb Changes to fix buffering that I forgot to commit with previous patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94222 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 21:16:10 +00:00
Chris Lattner
0fd90fd8d1 Convert some more random-comment-printing stuff to use
AddComment and GetCommentOS.  Add a blank line between globals
(even in non-verbose mode) to make the assembly more readable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94202 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 19:52:01 +00:00
Chris Lattner
d79d9dce47 add a new MCAsmStreamer::GetCommentOS method to simplify stuff
that doesn't want to use twines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94199 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 19:17:48 +00:00
Chris Lattner
d32c7cfa24 rename addComment -> AddComment for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94190 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 18:21:35 +00:00
Chris Lattner
7d1e49c983 add comment support to the rest of the directives.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94168 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 07:36:39 +00:00
Chris Lattner
86e2211d0a Add the ability for MCStreamer to emit comments on the same line as directives.
Switch over the asm-verbose comment for double values to use it.  We now get:

_x:
	.long	343597384                                   ## double 1.231200e+02
	.long	1079953326

For example, note that the comment is on the same line as the .long.  Woo.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94166 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 07:29:22 +00:00
Chris Lattner
07404415ab pass "-fasm-verbose" into createAsmStreamer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94165 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-22 07:06:15 +00:00
Chris Lattner
0e94facb5f don't forget to initialize an instance variable!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94021 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 20:48:59 +00:00
Chris Lattner
32f6a8d923 use getGlobalDirective(), don't hardcode .globl. PR6093
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94006 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 17:50:30 +00:00
Chris Lattner
5eaa54e210 make mcasmstreamer handle expanding 8 byte integer constants to
4-byte constants if .quad isn't supported.  Switch a bunch of
methods used by the dwarf writer to use OutStreamer.EmitIntValue.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93987 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 06:45:39 +00:00
Chris Lattner
1658202529 give createAsmStreamer an 'isLittleEndian' argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93986 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-20 06:39:07 +00:00
Chris Lattner
32ae3fe0ba add a new EmitIntValue method that MCStreamer impls can optionally define
and that clients can use.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93923 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 22:03:38 +00:00
Chris Lattner
aaec205b87 Generalize mcasmstreamer data emission APIs to take an address space
identifier.  There is no way to work around it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93896 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 19:46:13 +00:00
Chris Lattner
8a6d7ac88f mcstreamerize AsmPrinter::EmitZeros, at least when emitting to the
default address space.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93890 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 18:58:52 +00:00
Chris Lattner
6113b3d323 add an MCAsmStreamer::EmitFill specialization of EmitFill that
emits one directive instead of N.  Not doing this would be a
significant regression on the # bytes generated by .fill.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93889 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 18:52:28 +00:00
Chris Lattner
4ed5438f48 mc'ize some stuff, don't comment out .lcomm directive in -fverbose-asm mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 06:01:04 +00:00
Chris Lattner
8cb9a3b13f remove the MAI argument to MCExpr::print and switch overthing to use << when printing them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93699 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-18 00:37:40 +00:00
Chris Lattner
10b318bcb3 now that MCSymbol::print doesn't use it's MAI argument, we can
remove it and change all the code that prints MCSymbols to use 
<< instead, which is much simpler and cleaner.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93695 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-17 21:43:43 +00:00
Daniel Dunbar
2928c83b01 Pass StringRef by value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86251 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 10:58:06 +00:00
Daniel Dunbar
7eb85194f2 Minor formatting tweaks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 01:58:15 +00:00
Daniel Dunbar
75773ff00d MC: Tweak variable assignment diagnostics, and make reassignment of non-absolute
variables and symbols invalid.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84232 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 01:57:39 +00:00
Daniel Dunbar
fffff915d5 MC: When parsing a variable reference, substitute absolute variables immediately
since they are allowed to be redefined.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84230 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-16 01:34:54 +00:00
Chris Lattner
90edac0e8b Change MCAsmStreamer to take an MCInstPrinter instead of a
full AsmPrinter, and change TargetRegistry to keep track
of registered MCInstPrinters.

llvm-mc is still linking in the entire
target foo to get the code emitter stuff, but this is an
important step in the right direction.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81754 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-14 03:02:37 +00:00
Chris Lattner
1b6570e527 'printMCInst' doesn't print newlines after instructions anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81723 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-13 22:24:34 +00:00
Chris Lattner
684c593d05 Thread an MCAsmInfo pointer through the various MC printing APIs,
and fix a few things using << on MCSymbols to use ->print(). No
functionality change other than unbreaking my previous patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80890 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 05:46:51 +00:00
Chris Lattner
d87eb6454d inline insertion operators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80888 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 05:33:01 +00:00
Chris Lattner
579531c61b output alignment value in hex so that we get:
.align 3, 0x90
instead of,
  .align 3, 144

suggested by eric.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80875 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 04:01:10 +00:00
Daniel Dunbar
821e3334ed llvm-mc: Pass values to MCStreamer as MCExprs, not MCValues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80578 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 08:09:28 +00:00
Daniel Dunbar
e2ace509fc llvm-mc: Simplify EmitAssignment ('.set' is identical to '=').
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80577 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 08:09:09 +00:00
Daniel Dunbar
8c2eebe407 llvm-mc: Switch MCInst to storing an MCExpr* instead of an MCValue.
Also, use MCInst::print instead of custom code in MCAsmPrinter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80575 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-31 08:08:38 +00:00
Daniel Dunbar
7092c7e1dc llvm-mc: MCStreamer cleanups. - Remove EmitLocalSymbol, this is unsupported for now.
- Switch Emit{CommonSymbol,Zerofill} to take alignment in bytes (for consistency).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80484 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-30 06:17:16 +00:00
Daniel Dunbar
e6cdbf2f92 llvm-mc: Emit .lcomm as .zerofill.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80343 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 05:48:46 +00:00