Chris Lattner
0b78cc2af5
don't emit \n's at the start of X86AsmPrinter::runOnMachineFunction,
...
.o files don't like that.
llvm-svn: 95187
2010-02-03 01:49:49 +00:00
Chris Lattner
f1866ab682
privatize a bunch of methods and move \n printing into them.
...
llvm-svn: 95186
2010-02-03 01:46:05 +00:00
Chris Lattner
996ec840d0
rejigger the world so that EmitInstruction prints the \n at
...
the end of the instruction instead of expecting the caller to
do it. This currently causes the asm-verbose instruction
comments to be on the next line.
llvm-svn: 95178
2010-02-03 01:09:55 +00:00
Chris Lattner
41ad1905c9
sink handling of target-independent machine instrs (other
...
than DEBUG_VALUE :( ) into the target indep AsmPrinter.cpp
file. This allows elimination of the
NO_ASM_WRITER_BOILERPLATE hack among other things.
llvm-svn: 95177
2010-02-03 01:00:52 +00:00
Chris Lattner
b0d44c3807
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.
llvm-svn: 95155
2010-02-02 23:37:42 +00:00
Chris Lattner
32445d300f
move handling of asm-verbose out of AsmPrinter.cpp into LLVMTargetMachine.cpp with the rest of the command line options.
...
llvm-svn: 95152
2010-02-02 22:54:51 +00:00
Chris Lattner
c968f4475e
add target hooks for emitting random gunk before and after the function body.
...
llvm-svn: 94732
2010-01-28 01:58:58 +00:00
Chris Lattner
73de5fbfc3
Give AsmPrinter the most common expected implementation of
...
runOnMachineFunction, and switch PPC to use EmitFunctionBody.
The two ppc asmprinters now don't heave to define
runOnMachineFunction.
llvm-svn: 94722
2010-01-28 01:28:58 +00:00
Chris Lattner
565896b9eb
emit a 0 byte instead of a noop if a function is empty on darwin.
...
"0" is nice and target independent.
llvm-svn: 94718
2010-01-28 01:06:32 +00:00
Chris Lattner
94a946cac4
Remove the argument from EmitJumpTableInfo, because it doesn't need it.
...
Move the X86 implementation of function body emission up to
AsmPrinter::EmitFunctionBody, which works by calling the virtual
EmitInstruction method.
llvm-svn: 94716
2010-01-28 01:02:27 +00:00
Chris Lattner
2b796241a7
Drop the argument to AsmPrinter::EmitConstantPool and make it virtual.
...
Overload it in the ARM backend to do nothing, since is does insane
constant pool emission.
llvm-svn: 94708
2010-01-28 00:19:24 +00:00
Chris Lattner
cd99546b03
rename printVisibility to EmitVisibility and make it private,
...
constify EmitLinkage.
llvm-svn: 94705
2010-01-28 00:05:10 +00:00
Chris Lattner
bc1e6f0873
add a new AsmPrinter::EmitFunctionEntryLabel virtual function,
...
which allows targets to override function entry label emission.
Use it to convert linux/ppc to use EmitFunctionHeader().
llvm-svn: 94667
2010-01-27 07:21:55 +00:00
Chris Lattner
bac7498f8e
mcize label emission for functions.
...
llvm-svn: 94624
2010-01-26 23:53:39 +00:00
Chris Lattner
fc2e376a15
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.
llvm-svn: 94623
2010-01-26 23:51:52 +00:00
Chris Lattner
dbf5a7617d
pull linkage emission code out to a new EmitLinkage function.
...
llvm-svn: 94621
2010-01-26 23:47:12 +00:00
Chris Lattner
22fc38dd4f
rearrange some directives, no functionality change.
...
llvm-svn: 94620
2010-01-26 23:41:48 +00:00
Chris Lattner
c7b91156e4
now that enough stuff is constified, move function header printing
...
logic up from X86 into the common code. The other targets will
hopefully start using this soon.
llvm-svn: 94614
2010-01-26 23:18:44 +00:00
Chris Lattner
b657c4cdc3
emit jump table an alias ".set" directives through MCStreamer as
...
assignments.
.set x, a-b
is the same as:
x = a-b
llvm-svn: 94596
2010-01-26 21:53:08 +00:00
Chris Lattner
ff234e09b9
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.
llvm-svn: 94585
2010-01-26 20:40:54 +00:00
Chris Lattner
547c761dd6
eliminate the TargetLowering::UsesGlobalOffsetTable bool, which is
...
subsumed by TargetLowering::getJumpTableEncoding(). Change uses of
it to be more specific.
llvm-svn: 94529
2010-01-26 06:53:37 +00:00
Chris Lattner
4db603f93b
Now that printPICJumpTableSetLabel is not overloaded,
...
inline it into its only caller, allowing us to simplify it
and hoist bits out of the loop.
llvm-svn: 94528
2010-01-26 06:42:44 +00:00
Chris Lattner
8a785d7a67
Move getJTISymbol from MachineJumpTableInfo to MachineFunction,
...
which is more convenient, and change getPICJumpTableRelocBaseExpr
to take a MachineFunction to match.
Next, move the X86 code that create a PICBase symbol to
X86TargetLowering::getPICBaseSymbol from
X86MCInstLower::GetPICBaseSymbol, which was an asmprinter specific
library. This eliminates a 'gross hack', and allows us to
implement X86ISelLowering::getPICJumpTableRelocBaseExpr which now
calls it.
This in turn allows us to eliminate the
X86AsmPrinter::printPICJumpTableSetLabel method, which was the
only overload of printPICJumpTableSetLabel.
llvm-svn: 94526
2010-01-26 06:28:43 +00:00
Chris Lattner
273735bc5a
add a new MachineJumpTableInfo::getJTISymbol method,
...
use it to implement the default TargetLowering::getPICJumpTableRelocBaseExpr
llvm-svn: 94523
2010-01-26 05:58:28 +00:00
Chris Lattner
cc0f734cd0
simplify asmprinter: only emit .set directives when entries have
...
EK_LabelDifference32 kind and the target has .set support. Simplify
X86AsmPrinter::printPICJumpTableSetLabel to make use of recent helpers.
llvm-svn: 94518
2010-01-26 05:15:20 +00:00
Chris Lattner
279de3ef64
rename printPICJumpTableEntry -> EmitJumpTableEntry,
...
make it private and non-virtual. It handles the non-pic
case too, so just use it, simplifying EmitJumpTableInfo.
llvm-svn: 94517
2010-01-26 05:10:10 +00:00
Chris Lattner
d051af7551
add a new MachineBasicBlock::getSymbol method, replacing
...
the AsmPrinter::GetMBBSymbol.
llvm-svn: 94515
2010-01-26 04:55:51 +00:00
Chris Lattner
6715952c25
make MachineFunction keep track of its ID and make
...
MachineFunctionAnalysis dole them out, instead of having
AsmPrinter do both. Have the AsmPrinter::SetupMachineFunction
method set the 'AsmPrinter::MF' variable.
llvm-svn: 94509
2010-01-26 04:35:26 +00:00
Chris Lattner
5fc4160ea3
Add support for target-specific 32-bit custom-lowered
...
jump table entries.
llvm-svn: 94505
2010-01-26 04:05:28 +00:00
Chris Lattner
a7c116016e
switch jump table entry emission to be based on EntryKind
...
instead of magic variables.
llvm-svn: 94500
2010-01-26 03:43:22 +00:00
Chris Lattner
b6db2c6b31
Rearrange handling of jump tables. Highlights:
...
1. MachineJumpTableInfo is now created lazily for a function the first time
it actually makes a jump table instead of for every function.
2. The encoding of jump table entries is now described by the
MachineJumpTableInfo::JTEntryKind enum. This enum is determined by the
TLI::getJumpTableEncoding() hook, instead of by lots of code scattered
throughout the compiler that "knows" that jump table entries are always
32-bits in pic mode (for example).
3. The size and alignment of jump table entries is now calculated based on
their kind, instead of at machinefunction creation time.
Future work includes using the EntryKind in more places in the compiler,
eliminating other logic that "knows" the layout of jump tables in various
situations.
llvm-svn: 94470
2010-01-25 23:26:13 +00:00
Chris Lattner
a4074257ab
eliminate redundant argument to EmitJumpTableInfo
...
llvm-svn: 94464
2010-01-25 22:41:33 +00:00
Chris Lattner
3cde760023
mcstreamerize gprel32 emission.
...
llvm-svn: 94452
2010-01-25 21:28:50 +00:00
Chris Lattner
822742fef9
mcize the non-gprel cases of AsmPrinter::printPICJumpTableEntry
...
llvm-svn: 94450
2010-01-25 21:22:22 +00:00
Chris Lattner
00d188f379
handle the _set_ symbol with an MCSymbol.
...
llvm-svn: 94449
2010-01-25 21:17:10 +00:00
Chris Lattner
19bd039896
rename MAI::PICJumpTableDirective to MAI::GPRel32Directive to
...
make it clear what it is, instead of how it is used.
llvm-svn: 94448
2010-01-25 21:10:10 +00:00
Chris Lattner
360aeb76a2
pull the non-pic jump table case out of printPICJumpTableEntry
...
and MCize the non-pic case. Now printPICJumpTableEntry really
is just about printing PIC entries.
llvm-svn: 94446
2010-01-25 21:01:58 +00:00
Chris Lattner
ccabcd7f85
remove JumpTableDirective, it is always null.
...
llvm-svn: 94445
2010-01-25 20:52:54 +00:00
Chris Lattner
6330d5330e
sink an arm specific method out of asmprinter into the ARMAsmPrinter and
...
rename it to avoid shadowing.
llvm-svn: 94440
2010-01-25 19:39:52 +00:00
Chris Lattner
601ef33c77
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.
llvm-svn: 94437
2010-01-25 18:58:59 +00:00
Chris Lattner
bc696445e1
emit ELF .type directives through MCStreamer instead of doing it textually.
...
llvm-svn: 94436
2010-01-25 18:33:40 +00:00
Chris Lattner
866a539f5f
add a comment
...
llvm-svn: 94417
2010-01-25 07:53:05 +00:00
Chris Lattner
91dac6d570
emit the .size directive for global variables on ELF through
...
mcstreamer.
llvm-svn: 94416
2010-01-25 07:52:13 +00:00
Chris Lattner
b1301f7bce
mcize lcomm, simplify .comm, extend both to support 64-bit sizes.
...
llvm-svn: 94299
2010-01-23 07:47:02 +00:00
Chris Lattner
76bdea3290
resolve a fixme: the "nonexecutable stack directive" is actually
...
a .section. Switch to it with SwitchSection.
However, I think that this directive should be safe on any ELF target.
If so, we should hoist it up out of the X86 and SystemZ targets.
llvm-svn: 94298
2010-01-23 07:21:06 +00:00
Chris Lattner
0bfd279b37
mcize visibility directives.
...
llvm-svn: 94295
2010-01-23 06:53:23 +00:00
Chris Lattner
685508cf49
move the various directive enums out of the MCStreamer class
...
into a new MCDirectives.h file.
llvm-svn: 94294
2010-01-23 06:39:22 +00:00
Chris Lattner
d1acffc845
Change constantexpr global variable initializers to convert the constants
...
to MCExpr then emit them through MCStreamer with EmitValue. I think all
global variable initializers are now going through mcstreamer.
llvm-svn: 94293
2010-01-23 06:17:14 +00:00
Chris Lattner
1deb09c28d
mcstreamerize .no_dead_strip and .reference for static ctors/dtors.
...
llvm-svn: 94290
2010-01-23 05:51:36 +00:00
Chris Lattner
4225a7b987
mcize jump table and constant pool entry labels, .local on elf,
...
and some .weak directives.
llvm-svn: 94284
2010-01-23 05:19:23 +00:00
Chris Lattner
68eeb5ec9c
emit .ascii and .asciz through MCStreamer.
...
llvm-svn: 94282
2010-01-23 04:54:10 +00:00
Chris Lattner
c3f23b84ea
remove one form of EmitString, just use EmitBytes instead. We must
...
be careful to add a \0 at the end though, because EmitString didn't
do this.
llvm-svn: 94277
2010-01-23 03:11:46 +00:00
Chris Lattner
6f2d99df03
move "EOL" from asmprinter to dwarfprinter. It should eventually
...
be completely eliminated, but today is not that day.
llvm-svn: 94253
2010-01-22 23:47:11 +00:00
Chris Lattner
fa82355f33
move uleb printing from asmprinter to dwarfprinter, mcize,
...
cleanup and eliminate a bunch more uses of "EOL".
llvm-svn: 94250
2010-01-22 23:18:42 +00:00
Chris Lattner
2303145081
move sleb printing out of asmprinter into dwarf printer, make clients
...
handle the comment better, MCize the non-.sleb case.
llvm-svn: 94244
2010-01-22 22:56:55 +00:00
Chris Lattner
edf96a4cc3
add a new DwarfPrinter::EmitEncodingByte method which handles
...
pretty printing encoding comments and eliminates redundancy on
the client side. We now get pretty dwarf like this again:
.byte 255 ## @LPStart Encoding = omit
.byte 0 ## @TType Encoding = absptr
.byte 0x28 ## @TType base offset
.byte 3 ## Call site Encoding = udata4
.byte 0x1a ## Call site table size
...
llvm-svn: 94239
2010-01-22 22:38:16 +00:00
Chris Lattner
f5c834fce1
inline away the trivial AsmPrinter::EOL() method.
...
llvm-svn: 94230
2010-01-22 22:09:00 +00:00
Chris Lattner
13037516aa
inline AsmPrinter::PrintHex into its two trivial callers.
...
llvm-svn: 94228
2010-01-22 21:57:56 +00:00
Chris Lattner
978e2f02a8
change this to be a static function instead of a method on asmprinter.
...
llvm-svn: 94227
2010-01-22 21:50:41 +00:00
Chris Lattner
00562558ab
make the loop comment printer print out a much better structured
...
output. An example:
.align 4, 0x90
LBB1_5: ## %while.cond3
## Parent Loop BB1_1 Depth=1
## => This Loop Header: Depth=2
## Child Loop BB1_8 Depth 3
## Child Loop BB1_6 Depth 3
llvm-svn: 94225
2010-01-22 21:43:28 +00:00
Chris Lattner
e567c8e67f
For blocks that are not loop headers, just print their loop depth and header BB.
...
For loop headers, print Inner loop along with the other stuff so it doesn't take
an extra line. We now get stuff like this:
LBB1_4: ## %land.end
## in Loop: Header=BB1_1 Depth=1
notb %al
testb $1, %al
jne LBB1_8
and:
LBB1_6: ## %while.cond7
## Inner Loop Header: Depth=3
## Inside Loop BB1_5 Depth 2
## Inside Loop BB1_1 Depth 1
which still isn't great for loop headers, but is much less verbose.
llvm-svn: 94221
2010-01-22 21:11:06 +00:00
Chris Lattner
23e43dbba1
reenable the label loop comments and switch them to use the formatted
...
comment emission stuff. I'm going to rewrite this though because the
current output doesn't make sense.
llvm-svn: 94215
2010-01-22 21:00:45 +00:00
Chris Lattner
a3eee3cb69
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.
llvm-svn: 94202
2010-01-22 19:52:01 +00:00
Chris Lattner
8fa0e35f97
add a new MCAsmStreamer::GetCommentOS method to simplify stuff
...
that doesn't want to use twines.
llvm-svn: 94199
2010-01-22 19:17:48 +00:00
Chris Lattner
e1d8a319a1
rename addComment -> AddComment for consistency.
...
llvm-svn: 94190
2010-01-22 18:21:35 +00:00
Chris Lattner
38e9219f71
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.
llvm-svn: 94166
2010-01-22 07:29:22 +00:00
Chris Lattner
0522eb2160
pass "-fasm-verbose" into createAsmStreamer.
...
llvm-svn: 94165
2010-01-22 07:06:15 +00:00
Chris Lattner
c47ece59a8
don't send null pointers through the constantexpr codepath unneededly.
...
llvm-svn: 94010
2010-01-20 17:57:50 +00:00
Chris Lattner
71601e8b3b
eliminate some uses of AsmPrinter::EmitIntXXX
...
llvm-svn: 93996
2010-01-20 07:41:15 +00:00
Chris Lattner
db42c8d23d
inline and radically simplify printDataDirective. It will eventually
...
go completely away.
llvm-svn: 93994
2010-01-20 07:33:29 +00:00
Chris Lattner
f8dcf784a7
emit basic block labels with mcstreamer.
...
llvm-svn: 93993
2010-01-20 07:24:05 +00:00
Chris Lattner
4c8b1824f0
emit integer and fp zeros as (e.g.) .byte 0 instead of .space 1,
...
for tidiness.
llvm-svn: 93992
2010-01-20 07:19:19 +00:00
Chris Lattner
03cb2a3035
signficant cleanups to EmitGlobalConstant (including streamerization
...
of int initializers), change some methods to be static functions,
use raw_ostream::write_hex instead of a smallstring dance with
APValue::toStringUnsigned(S, 16).
llvm-svn: 93991
2010-01-20 07:11:32 +00:00
Chris Lattner
37020ccf48
switch ConstantFP emission to use MCStreamer, significantly
...
simplifying the code.
llvm-svn: 93988
2010-01-20 06:53:37 +00:00
Chris Lattner
45eeffcc2a
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.
llvm-svn: 93987
2010-01-20 06:45:39 +00:00
Chris Lattner
38caaf14c1
give createAsmStreamer an 'isLittleEndian' argument.
...
llvm-svn: 93986
2010-01-20 06:39:07 +00:00
Chris Lattner
eaef5e111d
simplify the rest of fp constant printing.
...
llvm-svn: 93929
2010-01-19 22:16:33 +00:00
Chris Lattner
c70daf316e
simplify the code for printing x86 long double, don't do work
...
for -fverbose-asm unless it's on.
llvm-svn: 93926
2010-01-19 22:11:05 +00:00
Chris Lattner
ecaf0dcbc6
eliminate AsmPrinter::EmitZeros: just use MCStreamer directly.
...
llvm-svn: 93918
2010-01-19 21:51:22 +00:00
Chris Lattner
c35681b298
Generalize mcasmstreamer data emission APIs to take an address space
...
identifier. There is no way to work around it.
llvm-svn: 93896
2010-01-19 19:46:13 +00:00
Chris Lattner
fefcb1531c
refactor code to be static functions instead of methods on AsmPrinter.
...
This fixes some bugs handling address spaces.
llvm-svn: 93891
2010-01-19 19:10:44 +00:00
Chris Lattner
ed89f60f5e
mcstreamerize AsmPrinter::EmitZeros, at least when emitting to the
...
default address space.
llvm-svn: 93890
2010-01-19 18:58:52 +00:00
Chris Lattner
9c31b0c695
remove MAI::ZeroDirectiveSuffix, which is only used by MASM,
...
which we don't support anymore.
llvm-svn: 93886
2010-01-19 18:37:01 +00:00
Chris Lattner
3024e9813e
mcstreamer'ize the rest of EmitGlobalVariable that is used on
...
darwin. The next big piece to get global variables streamerized
is EmitGlobalConstant.
llvm-svn: 93870
2010-01-19 06:41:24 +00:00
Chris Lattner
cd2915e467
stop using the .lcomm pseudoop on darwin, instead, directly use the
...
.zerofill directive. Streamerize its generation.
llvm-svn: 93868
2010-01-19 06:25:51 +00:00
Devang Patel
1083b5fc3f
Avoid including DebugInfo.h in AsmPrinter.h
...
llvm-svn: 93864
2010-01-19 06:09:04 +00:00
Chris Lattner
95b98959b0
mc'ize some stuff, don't comment out .lcomm directive in -fverbose-asm mode.
...
llvm-svn: 93860
2010-01-19 06:01:04 +00:00
Chris Lattner
282466abf7
factor this code better.
...
llvm-svn: 93859
2010-01-19 05:51:42 +00:00
Chris Lattner
c7a062d187
Now that we have everything nicely factored (e.g. asmprinter is not
...
doing global variable classification anymore) and hookized, sink almost
all target targets global variable emission code into AsmPrinter and out
of each target.
Some notes:
1. PIC16 does completely custom and crazy stuff, so it is not changed.
2. XCore has some custom handling for extra directives. I'll look at it next.
3. This switches linux/ppc to use .globl instead of .global. If .globl is
actually wrong, let me know and I'll fix it.
4. This makes linux/ppc get a lot of random cases right which were obviously
wrong before, it is probably now a bit healthier.
5. Blackfin will probably start getting .comm and other things that it didn't
before. If this is undesirable, it should explicitly opt out of these
things by clearing the relevant fields of MCAsmInfo.
This leads to a nice diffstat:
14 files changed, 127 insertions(+), 830 deletions(-)
llvm-svn: 93858
2010-01-19 05:38:33 +00:00
Chris Lattner
6a160517a0
hoist handling of external globals and special globals up to common code.
...
This makes a similar code dead in all the other targets, I'll clean it up
in a bit.
This also moves handling of lcomm up before acquisition of a section,
since lcomm never needs a section.
llvm-svn: 93851
2010-01-19 04:39:15 +00:00
Chris Lattner
e9d28b19cf
move production of .reference directives for static ctor/dtor list on
...
darwin into common code.
llvm-svn: 93849
2010-01-19 04:34:02 +00:00
Chris Lattner
8b5d55ed06
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.
llvm-svn: 93695
2010-01-17 21:43:43 +00:00
Chris Lattner
b4ffc894e6
now that mangler is in libtarget, it can use MCAsmInfo instead of clients
...
having to pass various fields from it in. Simplify.
llvm-svn: 93686
2010-01-17 18:22:35 +00:00
Benjamin Kramer
4d128a2387
Switch some functions to take Twines, eliminate uses of StringExtras.h.
...
llvm-svn: 93680
2010-01-17 07:46:39 +00:00
Chris Lattner
f62e3ee8c5
move the mangler into libtarget from vmcore.
...
llvm-svn: 93664
2010-01-16 21:57:06 +00:00
Chris Lattner
d3b1808876
unbreak the build.
...
llvm-svn: 93654
2010-01-16 20:53:11 +00:00
Chris Lattner
555ceabe64
rename GetPrivateGlobalValueSymbolStub -> GetSymbolWithGlobalValueBase,
...
and add an explicit ForcePrivate argument.
Switch FunctionEHFrameInfo to be MCSymbol based instead of string based.
llvm-svn: 93646
2010-01-16 18:37:32 +00:00
Chris Lattner
8a1f23af11
eliminate uses of getMangledName from AsmPrinter.cpp, last up is
...
dwarf emission which is going to be more invasive.
llvm-svn: 93645
2010-01-16 18:17:26 +00:00
Devang Patel
c0e17df3ce
Replace DebugLocTuple with DILocation.
...
llvm-svn: 93630
2010-01-16 06:09:35 +00:00
Chris Lattner
a689edd067
fix inverted conditional
...
llvm-svn: 93614
2010-01-16 01:37:14 +00:00