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
Chris Lattner
a091179b5f
CurrentFnName is now dead, remove it.
...
llvm-svn: 93612
2010-01-16 01:24:10 +00:00
Chris Lattner
fedff0f67d
remove the string form of printVisibility.
...
llvm-svn: 93609
2010-01-16 01:17:26 +00:00
Chris Lattner
ae9b9eed18
supplement CurrentFnName with CurrentFnSym, which will eventually
...
replace it. Upgrade Alpha, Blackfin, and part of CellSPU to not
use mangler anymore. CellSPU needs more invasive surgery.
llvm-svn: 93589
2010-01-15 23:55:16 +00:00
Chris Lattner
7fec180909
add a version of AsmPrinter::printVisibility that takes an MCSymbol.
...
llvm-svn: 93587
2010-01-15 23:38:51 +00:00
Chris Lattner
0dca0a9650
add another helper
...
llvm-svn: 93577
2010-01-15 23:25:11 +00:00
Chris Lattner
91687f6e28
add a AsmPrinter::GetGlobalValueSymbol and GetExternalSymbolSymbol
...
helper method, use it to simplify some code.
llvm-svn: 93575
2010-01-15 23:18:17 +00:00
Dale Johannesen
b297cdd937
Fix a comment.
...
llvm-svn: 93463
2010-01-14 21:50:17 +00:00
Chris Lattner
25d8ed3773
remove uses of deprecated functions, this generates slightly
...
different BlockAddress labels, but nothing semantically important.
Add a FIXME that BlockAddress codegen is broken if the LLVM BB has
an empty name (e.g. strip was run).
llvm-svn: 93303
2010-01-13 07:30:49 +00:00
Chris Lattner
2b630fe822
use the new form of getNameWithPrefix, not makeNameProper.
...
Among other things, this would do very weird things if the
basic block name had (e.g.) a space in it on darwin:
makeNameProper would add quotes, then the mcsymbol would
escape the quotes.
llvm-svn: 93302
2010-01-13 07:16:53 +00:00
Chris Lattner
209aecad0c
change Mangler::makeNameProper to return its result in a SmallVector
...
instead of returning it in an std::string. Based on this change:
1. Change TargetLoweringObjectFileCOFF::getCOFFSection to take a StringRef
2. Change a bunch of targets to call makeNameProper with a smallstring,
making several of them *much* more efficient.
3. Rewrite Mangler::makeNameProper to not build names and then prepend
prefixes, not use temporary std::strings, and to avoid other crimes.
llvm-svn: 93298
2010-01-13 06:38:18 +00:00
Chris Lattner
8e26d19cb3
fix assert in AsmPrinter::EmitGlobalConstantLargeInt to match reality.
...
llvm-svn: 93293
2010-01-13 04:39:46 +00:00
Chris Lattner
4581a4f03a
reduce nesting and code duplication in AsmPrinter::EmitGlobalConstantLargeInt.
...
llvm-svn: 93292
2010-01-13 04:38:16 +00:00
Chris Lattner
a32ba6d056
reduce indentation and add a fast-path to EmitGlobalConstant for 8-byte
...
integers on 64-bit systems.
llvm-svn: 93291
2010-01-13 04:34:19 +00:00
Chris Lattner
7e0c164b5e
reduce indentation and use early exits in AsmPrinter::EmitConstantValueOnly
...
llvm-svn: 93290
2010-01-13 04:29:19 +00:00
Chris Lattner
1dae8766b1
fix PR5930, allowing the asmprinter to emit difference between
...
two labels as a truncate.
llvm-svn: 92455
2010-01-03 18:33:18 +00:00
Bill Wendling
ba27bef114
Remove dead store.
...
llvm-svn: 92156
2009-12-25 13:37:27 +00:00
Douglas Gregor
740ab38bb7
Fix a bunch of little errors that Clang complains about when its being pedantic
...
llvm-svn: 91764
2009-12-19 07:05:23 +00:00
Dan Gohman
3a6164e8ab
Print newlines after printing labels for debug info, so that the output
...
isn't cluttered with things like "Llabel47:Llabel48: movq (%rsi), %xmm3"
llvm-svn: 90638
2009-12-05 01:42:34 +00:00
Dan Gohman
abc77742c8
Fix this code to use DIScope instead of DICompileUnit, as in r90181.
...
Don't print "SrcLine"; just print the filename and line number, which
is obvious enough and more informative.
llvm-svn: 90631
2009-12-05 00:23:29 +00:00
Dan Gohman
e6d5445dc1
Print a space between the comment character and the text.
...
llvm-svn: 90621
2009-12-04 23:19:55 +00:00
David Greene
15f9df5f4b
Use new interfaces to print spill size.
...
llvm-svn: 90611
2009-12-04 22:46:04 +00:00
Devang Patel
b3e0168428
Use StringRef instead of std::string in DIEString.
...
llvm-svn: 89793
2009-11-24 19:42:17 +00:00
Dan Gohman
7a6611793f
Target-independent support for TargetFlags on BlockAddress operands,
...
and support for blockaddresses in x86-32 PIC mode.
llvm-svn: 89506
2009-11-20 23:18:13 +00:00
David Greene
25905c8336
Support spill comments.
...
Have the asm printer emit a comment if an instruction is a spill or
reload and have the spiller mark copies it introdues so the asm printer
can also annotate those.
llvm-svn: 88911
2009-11-16 15:12:23 +00:00
Sanjiv Gupta
d03742a122
revert 88761 as it fails builds.
...
llvm-svn: 88762
2009-11-14 07:22:25 +00:00
Sanjiv Gupta
8f9c22646b
Fix debug info crashes for PIC16.
...
llvm-svn: 88761
2009-11-14 06:19:49 +00:00
Dan Gohman
7474546e4d
Use .data() instead of .c_str() when nul-termination is not needed.
...
llvm-svn: 88703
2009-11-13 21:55:31 +00:00
David Greene
659c1a9d78
Move DebugInfo checks into EmitComments and remove them from
...
target-specific AsmPrinters. Not all comments need DebugInfo.
Re-enable the line numbers comment test.
llvm-svn: 88697
2009-11-13 21:34:57 +00:00
Devang Patel
f6eeaebd76
Implement support to debug inlined functions.
...
llvm-svn: 86748
2009-11-10 23:06:00 +00:00
Bob Wilson
b29e155c53
Fix comment typos.
...
llvm-svn: 86295
2009-11-06 22:38:38 +00:00
Dan Gohman
ee8afcc59d
Factor out the printing of the leading tab into printInlineAsm.
...
llvm-svn: 86199
2009-11-06 00:04:54 +00:00
Dan Gohman
d53b5cfe3f
Fix the label name generation for address-taken labels to avoid potential
...
problems with name collisions.
llvm-svn: 86189
2009-11-05 23:14:35 +00:00
Jakob Stoklund Olesen
c7cfc94bcc
Print out an informative comment for KILL instructions.
...
The KILL pseudo-instruction may survive to the asm printer pass, just like the IMPLICIT_DEF. Print the KILL as a comment instead of just leaving a blank line in the output.
With -asm-verbose=0, a blank line is printed, like IMPLICIT?DEF.
llvm-svn: 86041
2009-11-04 19:24:37 +00:00
Dan Gohman
ae6bb61594
Fix a missing newline in the dwarf output code.
...
llvm-svn: 85684
2009-10-31 20:59:09 +00:00
Dan Gohman
4246f00e0c
Add support for BlockAddress static initializers.
...
llvm-svn: 85562
2009-10-30 01:45:18 +00:00
Dan Gohman
2f8ccf2bf4
Add a FIXME comment.
...
llvm-svn: 85559
2009-10-30 01:38:20 +00:00
Dan Gohman
c83dc4b506
Add some comments.
...
llvm-svn: 85558
2009-10-30 01:34:35 +00:00
Dan Gohman
6c9388011b
Initial target-independent CodeGen support for BlockAddresses.
...
llvm-svn: 85556
2009-10-30 01:27:03 +00:00
Devang Patel
d7ebfe3963
s/DebugLoc.CompileUnit/DebugLoc.Scope/g
...
s/DebugLoc.InlinedLoc/DebugLoc.InlinedAtLoc/g
llvm-svn: 84054
2009-10-13 23:28:53 +00:00
Devang Patel
4598eb6214
Add support to handle debug info attached to an instruction.
...
This is not yet enabled.
llvm-svn: 83400
2009-10-06 18:37:31 +00:00
Dan Gohman
10d3dc569b
Instead of printing unnecessary basic block labels as labels in
...
verbose-asm mode, print comments instead. This eliminates a non-comment
difference between verbose-asm mode and non-verbose-asm mode.
Also, factor out the relevant code out of all the targets and into
target-independent code.
llvm-svn: 83392
2009-10-06 17:38:38 +00:00
Devang Patel
051454a16f
Update processDebugLoc() so that it can be used to process debug info before and after printing an instruction.
...
llvm-svn: 83363
2009-10-06 02:19:11 +00:00
Chris Lattner
fdd8790718
strength reduce a ton of type equality tests to check the typeid (Through
...
the new predicates I added) instead of going through a context and doing a
pointer comparison. Besides being cheaper, this allows a smart compiler
to turn the if sequence into a switch.
llvm-svn: 83297
2009-10-05 05:54:46 +00:00
Devang Patel
34986f12e6
Add another MDNode into DebugLocTuple. This will be used to keep track of inlined functions.
...
llvm-svn: 83190
2009-10-01 01:15:28 +00:00
Devang Patel
e0709cfc92
Use MachineInstr as an processDebugLoc() argument.
...
This will allow processDebugLoc() to handle scopes for DWARF debug info.
llvm-svn: 83183
2009-09-30 23:12:50 +00:00
Devang Patel
3256c751f5
Use MDNode * directly as an RecordSourceLine() argument.
...
llvm-svn: 83182
2009-09-30 22:51:28 +00:00
Bob Wilson
b633d7a665
Add a new virtual EmitStartOfAsmFile method to the AsmPrinter and use this
...
to emit target-specific things at the beginning of the asm output. This
fixes a problem for PPC, where the text sections are not being kept together
as expected. The base class doInitialization code calls DW->BeginModule()
which emits a bunch of DWARF section directives. The PPC doInitialization
code then emits all the TEXT section directives, with the intention that they
will be kept together. But as I understand it, the Darwin assembler treats
the default TEXT section as a special case and moves it to the beginning of
the file, which means that all those DWARF sections are in the middle of
the text. With this change, the EmitStartOfAsmFile hook is called before
the DWARF section directives are emitted, so that all the PPC text section
directives come out right at the beginning of the file.
llvm-svn: 83176
2009-09-30 22:06:26 +00:00
Bob Wilson
53904987ae
Fix a comment.
...
llvm-svn: 83171
2009-09-30 21:26:13 +00:00
Devang Patel
b296942f6d
Remove std::string uses from DebugInfo interface.
...
llvm-svn: 83083
2009-09-29 18:40:58 +00:00
Chris Lattner
87d8f2b9d5
unconditionally compute MMI even if the target doesn't support EH or Debug info, because the target may use it for other things, this fixes PR5036
...
llvm-svn: 82684
2009-09-24 05:44:53 +00:00
Chris Lattner
71a15b1316
add a new hook to allow targets to splat stuff at the end of the file.
...
Overriding doFinalization is pretty lame.
llvm-svn: 82268
2009-09-18 20:17:03 +00:00
Anton Korobeynikov
592638ae05
Allow symbols to start from the digit if target requests it. This allows, e.g. pinning
...
variables to specified absolute address. Make use of this feature for MSP430.
This unbreaks PR4776.
llvm-svn: 82227
2009-09-18 16:57:42 +00:00
Chris Lattner
8df79f2681
remove the AsmPrinter::printMCInst hook hack now that
...
we have MCInstPrinter.
llvm-svn: 82006
2009-09-16 04:57:15 +00:00
Chris Lattner
6b99ae882b
inline AsmPrinter::getCurrentFunctionEHName into its only caller.
...
llvm-svn: 81970
2009-09-16 00:35:39 +00:00
Chris Lattner
d106abfce7
Eliminate AsmPrinter::EmitExternalGlobal, inlining its (now)
...
one implementation into its one caller. This eliminates a totally
awesome and gratuitous hack where we casted a Function* to
GlobalVariable*.
llvm-svn: 81967
2009-09-16 00:17:39 +00:00
Chris Lattner
dd5a989034
eliminate the horrid AsmPrinter::getGlobalLinkName method, inlining
...
it into all of its call sites and simplifying them.
llvm-svn: 81962
2009-09-16 00:08:41 +00:00
Chris Lattner
2251293788
remove some horrible MAI hooks which fortunately turn out to be always empty.
...
llvm-svn: 81946
2009-09-15 23:11:32 +00:00
Chris Lattner
4dc75de733
PIC16 does allow colon after MBB labels, simplify EmitBasicBlockStart.
...
llvm-svn: 81755
2009-09-14 03:15:54 +00:00