Commit Graph

1224 Commits

Author SHA1 Message Date
Benjamin Kramer 96956ed0ff Reduce string trashing.
llvm-svn: 100038
2010-03-31 20:15:45 +00:00
Benjamin Kramer 74729ae094 DwarfDebug: Allocate DIEValues with a BumpPtrAllocator. Most of them are
POD-like anyway, so we don't even care about calling their d'tors (DIEBlock
being the exception).

~6% less mallocs and ~1% compile time improvement on clang -O0 -g oggenc.c

llvm-svn: 100035
2010-03-31 19:34:01 +00:00
Chris Lattner 17d38594fe reduce indentation
llvm-svn: 99999
2010-03-31 06:09:04 +00:00
Chris Lattner 71696ef1ad tidy up
llvm-svn: 99998
2010-03-31 06:06:37 +00:00
Chris Lattner 03e1b5ab5c MI != 0 is checked in the assert right above this.
llvm-svn: 99995
2010-03-31 05:42:48 +00:00
Chris Lattner 848c7d2e49 use the isDebugValue() predicate and pop_back_val()
llvm-svn: 99993
2010-03-31 05:39:57 +00:00
Chris Lattner 8d2fe28910 assert is a function-like macro, not a control flow operator.
llvm-svn: 99992
2010-03-31 05:36:29 +00:00
Chris Lattner 009de335ac add new apis for getting/setting !dbg metadata on
instructions.  In addition to being a convenience,
they are faster than the old apis, particularly when
not going from an MDKindID like people should be
doing.

llvm-svn: 99982
2010-03-31 03:34:40 +00:00
Devang Patel 57c644f926 Ignore invalid metadata.
llvm-svn: 99938
2010-03-30 22:09:52 +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
Devang Patel 67d94ab0f8 There is no need to fall through after processing DBG_VALUE machine instruction.
llvm-svn: 99899
2010-03-30 18:07:00 +00:00
Devang Patel 23b2ae621c Encode start location of debug value, communicated through DBG_VALUE machine instruction, in a variable's DIE.
llvm-svn: 99845
2010-03-29 22:59:58 +00:00
Chris Lattner 6efa201f7f use RAII for ExceptionTimer too
llvm-svn: 99833
2010-03-29 20:39:38 +00:00
Chris Lattner 4787975994 fix a variety of issues were we'd start DebugTimer but
not stop it by using RAII.

llvm-svn: 99832
2010-03-29 20:38:20 +00:00
Devang Patel bd477bef25 Refactor code to push DILocation prcessing into DwarfDebug.cpp from AsmPrinter.cpp.
This is same as r99772 (which was reverted) with just one meaningful difference where two source lines exchanged their positions.

llvm-svn: 99816
2010-03-29 17:20:31 +00:00
Devang Patel 1e8ccb5f8b Revert 99772.
llvm-svn: 99778
2010-03-28 21:23:37 +00:00
Devang Patel 32bdaef3fe Refactoring. Push DILocation processing in to DwarfDebug from AsmPrinter.
llvm-svn: 99772
2010-03-28 18:57:09 +00:00
Devang Patel 95cd4b9c0a Add comment.
llvm-svn: 99507
2010-03-25 15:09:44 +00:00
Devang Patel 834392fcc6 Use SP filename directly instead of SP's context's filename.
llvm-svn: 99429
2010-03-24 21:30:35 +00:00
Devang Patel d22ed622b3 Emit DW_AT_low_pc and DW_AT_high_pc attributes for TAG_compile_unit.
llvm-svn: 99225
2010-03-22 23:11:36 +00:00
Devang Patel 53e91f0836 DW_AT_stmt_list attribute attached with a compile unit encodes offset of line number information for this compile unit in debug_line section. This offset is always zero when only one compile unit is emitted in a object file.
llvm-svn: 99223
2010-03-22 22:38:48 +00:00
Jeffrey Yasskin 54ebc986b1 Fix a memory leak from DIE::addSiblingOffset() by adding the DIEValue
it allocates to DwarfDebug::DIEValues.

llvm-svn: 99196
2010-03-22 18:47:14 +00:00
Devang Patel 852a04e7ce Fix EmitSectionOffset incorrect argument. DwarfDebug is emitting debug info so isEH is always false. This was hiding until now from compilers because of default arguments. This was hiding from dwarf debug info users because for most of the platform isAbsoluteEHSectionOffsets() is same as isAbsoluteDebugSectionOffsets(). But Chris found it while updating dwarf printer to use MC*.
llvm-svn: 98743
2010-03-17 17:29:55 +00:00
Chris Lattner 8fce3dddfa reapply r98656 unmodified, which exposed the asmprinter not
handling constant unions.

llvm-svn: 98680
2010-03-16 21:25:55 +00:00
Daniel Dunbar 3a374da973 Revert r98656, its breaking all over the place.
llvm-svn: 98662
2010-03-16 19:35:34 +00:00
Chris Lattner 9ae99e0df5 improve support for uniontype and ConstantUnion, patch by Tim Northover!
llvm-svn: 98656
2010-03-16 19:15:03 +00:00
Chris Lattner db035a0af2 Fix the third (and last known) case of code update problems due
to LLVM IR changes with addr label weirdness.  In the testcase, we
generate references to the two bb's when codegen'ing the first
function:

_test1:                                 ## @test1
	leaq	Ltmp0(%rip), %rax
..
	leaq	Ltmp1(%rip), %rax

Then continue to codegen the second function where the blocks
get merged.  We're now smart enough to emit both labels, producing
this code:

_test_fun:                              ## @test_fun
## BB#0:                                ## %entry
Ltmp1:                                  ## Block address taken
Ltmp0:
## BB#1:                                ## %ret
	movl	$-1, %eax
	ret

Rejoice.

llvm-svn: 98595
2010-03-16 00:29:39 +00:00
Chris Lattner 561334a81f Implement support for the case when a reference to a addr-of-bb
label is generated, but then the block is deleted.  Since the
value is undefined, we just emit the label right after the entry 
label of the function.  It might matter that the label is in the
same section as the function was afterall.

llvm-svn: 98579
2010-03-15 20:39:00 +00:00
Devang Patel a3e9c9ca7b Emit dwarf variable info communicated by code generator through DBG_VALUE machine instructions.
This is a work in progress.

llvm-svn: 98556
2010-03-15 18:33:46 +00:00
Chris Lattner f18c0e6b4b remove dead method.
llvm-svn: 98526
2010-03-15 00:00:42 +00:00
Chris Lattner 9efbbcbe45 fix AsmPrinter::GetBlockAddressSymbol to always return a unique
label instead of trying to form one based on the BB name (which
causes collisions if the name is empty).  This fixes PR6608

llvm-svn: 98495
2010-03-14 17:53:23 +00:00
Chris Lattner 6e52e9db31 get MMI out of the label uniquing business, just go to MCContext
to get unique assembler temporary labels.

llvm-svn: 98489
2010-03-14 08:36:50 +00:00
Chris Lattner 6dcaba516f don't use getDWLabel("label" anymore, always go through MMI.
llvm-svn: 98485
2010-03-14 08:18:13 +00:00
Chris Lattner ff1fdd6787 remove now-dead code, all labels use MCSymbols.
llvm-svn: 98484
2010-03-14 08:17:53 +00:00
Chris Lattner b4666f4517 change SrcLineInfo to contain a label instead of a label ID.
llvm-svn: 98483
2010-03-14 08:15:55 +00:00
Chris Lattner d5e8d9f29a Now that DBG_LABEL is updated, we can finally make MachineMove
contain an MCSymbol instead of a label index.

llvm-svn: 98482
2010-03-14 08:12:40 +00:00
Chris Lattner c26f44fb07 change the DBG_LABEL MachineInstr to always be created
with an MCSymbol instead of an immediate.

llvm-svn: 98481
2010-03-14 07:56:48 +00:00
Chris Lattner 8e2b12b164 unbreak the build, grr symlinks.
llvm-svn: 98477
2010-03-14 07:36:49 +00:00
Chris Lattner 1065f49ad9 switch GC_LABEL to use an MCSymbol operand instead of a label ID operand.
llvm-svn: 98474
2010-03-14 07:27:07 +00:00
Chris Lattner 5a6e262c72 Fix some EH failures on NNT I introduced in r98461
llvm-svn: 98471
2010-03-14 07:02:50 +00:00
Chris Lattner 04857fab70 fix a bug I introduced in r98459, causing some NNT failures.
llvm-svn: 98470
2010-03-14 06:50:56 +00:00
Chris Lattner ee2fbbc978 change the LabelSDNode to be EHLabelSDNode and make it hold
an MCSymbol.  Make the EH_LABEL MachineInstr hold its label
with an MCSymbol instead of ID.  Fix a bug in MMI.cpp which
would return labels named "Label4" instead of "label4".

llvm-svn: 98463
2010-03-14 02:33:54 +00:00
Chris Lattner ee95d4c61c use Label->isDefined() instead of isLabelDeleted() now that we
consistently use MCSymbol and only call this predicate after
they should have been emitted.

llvm-svn: 98461
2010-03-14 02:20:58 +00:00
Chris Lattner 34adc8d225 change EH related stuff (other than EH_LABEL) to use MCSymbol
instead of label ID's.  This cleans up and regularizes a bunch 
of code and makes way for future progress.

Unfortunately, this pointed out to me that JITDwarfEmitter.cpp
is largely copy and paste from DwarfException/MachineModuleInfo
and other places.  This is very sad and disturbing. :(

One major change here is that TidyLandingPads moved from being
called in DwarfException::BeginFunction to being called in
DwarfException::EndFunction.  There should not be any 
functionality change from doing this, but I'm not an EH expert.

llvm-svn: 98459
2010-03-14 01:41:15 +00:00
Chris Lattner 29bdac4928 eliminate the now-unneeded context argument of MBB::getSymbol()
llvm-svn: 98451
2010-03-13 21:04:28 +00:00
Chris Lattner e468f88b26 rearrange MCContext ownership. Before LLVMTargetMachine created it
and passing off ownership to AsmPrinter.  Now MachineModuleInfo
creates it and owns it by value.  This allows us to use MCSymbols
more consistently throughout the rest of the code generator, and
simplifies a bit of code.  This also allows MachineFunction to 
keep an MCContext reference handy, and cleans up the TargetRegistry
interfaces for AsmPrinters.

llvm-svn: 98450
2010-03-13 20:55:24 +00:00
Chris Lattner 41e275dc8e simplify EmitFrameMoves to take BaseLabel in as a symbol
instead of as a stem+idx pair, simplify the "is a new 
location" check to use symbol comparison.

llvm-svn: 98432
2010-03-13 08:05:25 +00:00
Chris Lattner 8811e12314 factor some labels, simplify some code.
llvm-svn: 98429
2010-03-13 07:40:56 +00:00
Chris Lattner 2c3f478c0b various cleanups.
llvm-svn: 98426
2010-03-13 07:26:18 +00:00
Chris Lattner b7aa9527ef reimplement the string pool used for inlined function
entries to not thrash std::strings and MCSymbols.

llvm-svn: 98415
2010-03-13 02:17:42 +00:00
Chris Lattner 5ea039ad5c remove gone method, grr symlinks.
llvm-svn: 98392
2010-03-12 21:30:49 +00:00
Chris Lattner 9e4cafe6f1 inline the now-trivial implementation of GetGlobalValueSymbol into
some of its callers.

llvm-svn: 98388
2010-03-12 21:09:07 +00:00
Chris Lattner c7b46f9d9c give Mangler access to TargetData.
llvm-svn: 98378
2010-03-12 20:47:28 +00:00
Chris Lattner be3242b523 finally give Mangler a getSymbol method, which returns an MCSymbol
for a global instead of messing around with string buffers.

llvm-svn: 98366
2010-03-12 18:55:20 +00:00
Chris Lattner 45ec3f8944 remove dead code.
llvm-svn: 98365
2010-03-12 18:49:32 +00:00
Chris Lattner 2eff505fba make the mangler take an MCContext instead of an MAI.
No functionality change.

llvm-svn: 98363
2010-03-12 18:44:54 +00:00
Chris Lattner 77b0a2ee03 fix a bug emitting .secrel32 that I introduced, PR6587, patch
by A.Mazur!

llvm-svn: 98360
2010-03-12 18:10:35 +00:00
Jeffrey Yasskin 35b4e4f641 Free DbgScopes in DwarfDebug::endFunction(). Also increased the const-ness of
several fields to make it easier to figure out where bugs might be creeping in.

llvm-svn: 98358
2010-03-12 17:45:06 +00:00
Devang Patel f5c2a6b371 There is no need to create specification DIE for definitions at DIFile level.
llvm-svn: 98302
2010-03-11 23:44:52 +00:00
Chris Lattner 03627cb12c fix a fixme in TargetLoweringObjectFile::getExprForDwarfReference
where we used ot create an MCSymbol for ".".  Now emit an assembler
temporary label and reference it instead of "." textually.

rdar://7739457

llvm-svn: 98292
2010-03-11 21:55:20 +00:00
Chris Lattner 2562356992 rename getSymbolForDwarf* to getExprForDwarf* since it returns
an MCExpr and not an MCSymbol.  Change it to take an MCStreamer,
which is currently unused.

No functionality change.

llvm-svn: 98278
2010-03-11 19:41:58 +00:00
Jeffrey Yasskin 0708de1f97 Avoid leaking CompileUnits in DwarfDebug.cpp.
llvm-svn: 98268
2010-03-11 18:29:55 +00:00
Richard Osborne 6d3e92dfee Add a new jump table encoding to indicate jump tables entries
are inside the function by the target at the point of use.

llvm-svn: 98255
2010-03-11 14:58:16 +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 eec9bf1198 mcize the rest of EH emission, only one more directive missing
for darwin/x86 to be completely mcized.

llvm-svn: 98130
2010-03-10 02:48:06 +00:00
Chris Lattner a26fbe4d68 add missing filename!
llvm-svn: 98125
2010-03-10 02:29:31 +00:00
Chris Lattner ac2361a9b0 set the temporary bit on MCSymbols correctly.
llvm-svn: 98124
2010-03-10 02:25:11 +00:00
Chris Lattner b245dfb408 inline away a form of IsPCRelative, eliminating the
dead IsPCRel argument.

llvm-svn: 98117
2010-03-10 01:17:49 +00:00
Chris Lattner 7e998b7363 add some fixme's for MCizing. EH still has a few things that
need to be MCized, but the last debug info thing are LEB and
cygwin specific (which the MC api doesn't support yet) and
one specific form of EmitReference which I'll tackle next.

llvm-svn: 98116
2010-03-10 01:04:13 +00:00
Chris Lattner caea64b098 mcize uses of PrintRelDirective and eliminate it.
llvm-svn: 98107
2010-03-10 00:09:21 +00:00
Chris Lattner 1df0cf40ea inline the bool form of PrintRelDirective away, leaving just the unsigned form.
llvm-svn: 98106
2010-03-09 23:54:52 +00:00
Chris Lattner 566cae9086 eliminate EOL, adding all comments with the OutStreamer.AddComment
method.  With this, comments should end up on the same lines as the .byte
directives (for example) and we now get no output with:

$ llc CodeGen/X86/2009-02-12-DebugInfoVLA.ll -o - -filetype=null -asm-verbose

woot.

llvm-svn: 98105
2010-03-09 23:52:58 +00:00
Chris Lattner 3d72a678de eliminate a bunch of \n's that are being printed to O. Next up is to kill
off "EOL".

llvm-svn: 98102
2010-03-09 23:38:23 +00:00
Chris Lattner 1b6d60d1c0 convert the non-"ispcrel" case of EmitReference to MC,
significant debug info testcases are now all going through
MCStreamer, though they print a lot of extraneous newlines to "O".

llvm-svn: 98101
2010-03-09 23:19:15 +00:00
Chris Lattner ba35a67062 reapply r98035:
Now that setStartLabel takes an MCSymbol, we can de-ID'ize
beginScope and RecordSourceLine.

llvm-svn: 98047
2010-03-09 04:54:43 +00:00
Chris Lattner 54a6876821 add some extra checks. I'm not sure why, but this does unbreak a
failure remaining on mainline.

llvm-svn: 98046
2010-03-09 04:48:35 +00:00
Eric Christopher 66194fbf86 Speculatively revert r98035. It appears to have caused a set of buildbot
failures.

llvm-svn: 98039
2010-03-09 02:36:31 +00:00
Chris Lattner 06c5e9060c Now that setStartLabel takes an MCSymbol, we can de-ID'ize
beginScope and RecordSourceLine.

llvm-svn: 98035
2010-03-09 02:08:02 +00:00
Chris Lattner e13c37232a change DbgScope to keep track of the start/end label as MCSymbol*
now that the dependence on ID is removed from MMI.

llvm-svn: 98034
2010-03-09 01:58:53 +00:00
Chris Lattner a552246b3d remove a useless optimization: now that label replacement never
happens, the start/end of a scope can never be the same.

llvm-svn: 98032
2010-03-09 01:52:43 +00:00
Chris Lattner c3b70f636f strength reduce MMI::MappedLabel to MMI::isLabelDeleted,
and add a FIXME about how we are eventually going to zap this
lookup table once mc world domination is complete.

llvm-svn: 98031
2010-03-09 01:51:43 +00:00
Chris Lattner 9e57c676dd mcstreamerize AsmPrinter::printLabel.
llvm-svn: 98025
2010-03-09 01:02:30 +00:00
Chris Lattner b14490d912 add a EmitSymbolValue convenience method to MCStreamer.
llvm-svn: 98017
2010-03-09 00:39:24 +00:00
Chris Lattner 085b65283c make InlineInfoLabels hold MCSymbol*'s, avoiding
recomputation of the labels.

llvm-svn: 98016
2010-03-09 00:31:02 +00:00
Chris Lattner 53d6d1e87d mc'ize the last use of PrintLabelName and eliminate PrintLabelName.
llvm-svn: 98015
2010-03-09 00:26:09 +00:00
Chris Lattner 292ec6c299 eliminate an argument from PrintRelDirective, sinking
the one special case into EmitSectionOffset.  MCize
the non-special case in EmitSectionOffset.

llvm-svn: 98014
2010-03-09 00:17:58 +00:00
Chris Lattner b242ae6dcc remove the suffix form of PrintLabelName, which was only
used for 'flavor'.

llvm-svn: 98012
2010-03-09 00:00:57 +00:00
Chris Lattner 4d728127fb now that the debug and eh emitters use a common .set counter,
we can eliminate "flavor".

llvm-svn: 98011
2010-03-09 00:00:15 +00:00
Chris Lattner 9889c1eb9e move .set generation out of DwarfPrinter into AsmPrinter and
MCize it.

llvm-svn: 98010
2010-03-08 23:58:37 +00:00
Chris Lattner 27a9732450 simplify EmitSectionOffset to always use .set if it is
available, the only thing this affects is that we produce
.set in one case we didn't before, which shouldn't harm
anything.  Make EmitSectionOffset call EmitDifference
instead of duplicating it.

llvm-svn: 98005
2010-03-08 23:23:25 +00:00
Chris Lattner 449a9ff14b Remove a version of EmitDifference.
llvm-svn: 98002
2010-03-08 23:02:59 +00:00
Chris Lattner ee20b5f236 eliminate a form of PrintLabelName.
llvm-svn: 97999
2010-03-08 22:52:49 +00:00
Chris Lattner 3c081995f6 remove another form of EmitReference.
llvm-svn: 97998
2010-03-08 22:50:36 +00:00
Chris Lattner b779eb6a1d eliminate the non-MCSymbol versions of EmitReference.
llvm-svn: 97997
2010-03-08 22:47:57 +00:00
Chris Lattner 722714dde2 mc'ize EmitLabel.
llvm-svn: 97996
2010-03-08 22:44:40 +00:00
Chris Lattner 8dcf41ed66 merge DIEObjectLabel and DIEDwarfLabel into DIELabel.
Yes, DIE you fiendish labels, die all of you.

llvm-svn: 97995
2010-03-08 22:31:46 +00:00
Chris Lattner bc9210cb70 elimiante the DWLabel class, using MCSymbol instead. Start
switching some stuff over to passing around MCSymbol* instead
of stem+ID.

llvm-svn: 97993
2010-03-08 22:23:36 +00:00
Devang Patel 8119fe87d8 Derive DIType from DIScope. This simplifies getContext() where for members the context is a type. This also eliminates need of CompileUnitMaps maintained by dwarf writer.
llvm-svn: 97990
2010-03-08 22:02:50 +00:00
Devang Patel 3b548aa8e2 Avoid using DIDescriptor.isNull().
This is a first step towards eliminating checks in Descriptor constructors.

llvm-svn: 97975
2010-03-08 20:52:55 +00:00
Devang Patel bc97f6b757 Revert r97947.
llvm-svn: 97963
2010-03-08 19:20:38 +00:00
Devang Patel fe28599f6f Avoid using DIDescriptor.isNull().
This is a first step towards eliminating unncessary constructor checks in light weight DIDescriptor wrappers.

llvm-svn: 97947
2010-03-08 18:25:48 +00:00
Douglas Gregor 9abb538be0 Revert r97917, which was causing Clang Debug self-host failures.
llvm-svn: 97932
2010-03-08 02:58:37 +00:00
Jeffrey Yasskin 37a0372fc4 Roll r97906 forward again, without double-deleting CompileUnit::IndexTyDie.
llvm-svn: 97917
2010-03-07 17:10:13 +00:00
Jeffrey Yasskin 7068bdba50 _2_ gcc crashes, ah, ah, ah...
(Rolling back r97906.)

llvm-svn: 97909
2010-03-07 07:16:49 +00:00
Jeffrey Yasskin 413721b050 Avoid leaking CompileUnits and DbgScopes from DwarfDebug. Leaks found by Valgrind!
llvm-svn: 97906
2010-03-07 06:55:35 +00:00
Devang Patel f200b39d13 Fix grammar.
Thanks Duncan!

llvm-svn: 97572
2010-03-02 17:58:15 +00:00
Devang Patel d0fa304dc7 Constructors and operators for anonymous aggregates does not names. Do not force empty AT_name attribute in such cases.
llvm-svn: 97533
2010-03-02 01:26:20 +00:00
Bill Wendling c3a9376215 A much cleaner (and less code!) way of inserting the correct amount of padding
for alignment into the LSDA. If the TType base offset is emitted, then put the
padding there. Otherwise, put it in the call site table length. There will be no
conflict between the two sites when placing the padding in one place.

llvm-svn: 97277
2010-02-26 22:17:52 +00:00
Bill Wendling fea6c4efc7 Comment typo.
llvm-svn: 97269
2010-02-26 21:31:01 +00:00
Bill Wendling 098c91e95b Fix comments.
llvm-svn: 97200
2010-02-26 01:12:52 +00:00
Bill Wendling 6394521a2b Add another (and hopefully the last) exception case, where once we recalculate
the alignment requirement, if it no longer makes the TType base offset overflow
into extra bytes, then we need to pad to those bytes ourselves.

llvm-svn: 97196
2010-02-26 00:43:54 +00:00
Bill Wendling 6f14f6a962 And should use the correct variable.
llvm-svn: 97193
2010-02-26 00:24:25 +00:00
Bill Wendling 47c3269236 Got assertion check backwards.
llvm-svn: 97192
2010-02-26 00:22:42 +00:00
Bill Wendling 24c74f1d9c Catch a corner case where adding the padding to the "TType base offset" field
will eliminate the need for padding in the "Call site table length". E.g., if
we have this:

    GCC_except_table1:
    Lexception1:
        .byte   0xff  ## @LPStart Encoding = omit
        .byte   0x9b  ## @TType Encoding = indirect pcrel sdata4
        .byte   0x7f  ## @TType base offset
        .byte   0x03  ## Call site Encoding = udata4
        .byte   0x89  ## Call site table length

with padding of 1. We want to emit the padding like this:
 
    GCC_except_table1:
    Lexception1:
        .byte   0xff  ## @LPStart Encoding = omit
        .byte   0x9b  ## @TType Encoding = indirect pcrel sdata4
        .byte   0xff  ## @TType base offset
        .space  1,0   ## Padding
        .byte   0x03  ## Call site Encoding = udata4
        .byte   0x89  ## Call site table length

and not with padding on the "Call site table length" entry.

llvm-svn: 97183
2010-02-25 23:52:44 +00:00
Bill Wendling 60aa4dfb53 Make comment more meaningful.
llvm-svn: 97169
2010-02-25 21:19:47 +00:00
Bill Wendling 98aa245070 MC'ize padding when padding the ULEB128 value.
llvm-svn: 97087
2010-02-25 00:24:52 +00:00
Bill Wendling 88fdcd323d LLVM puts padding bytes in the __gcc_except_tab section after the
GCC_except_table label but before the Lexception, which the FDE references.
This causes problems as the FDE does not point to the start of an LSDA chunk.

Use an unnormalized uleb128 for the call-site table length that includes the
padding.

llvm-svn: 97078
2010-02-24 23:34:35 +00:00
Chris Lattner e4f249bc06 use OutStreamer.EmitCodeAlignment for alignment in the text
segment.

llvm-svn: 96967
2010-02-23 18:46:22 +00:00
Chris Lattner 1fa9c2cce4 move isOnlyReachableByFallthrough out of MachineBasicBlock into AsmPrinter,
and add a sparc implementation that knows about delay slots.  Patch by
Nathan Keynes!

llvm-svn: 96492
2010-02-17 18:52:56 +00:00
Devang Patel ca55a04273 Before setting scope end marker, pay attention to scope begin marker and existing scope end marker, if any. Scope must begin before it ends and nested inlined scope do not truncate surrounding scope.
llvm-svn: 96445
2010-02-17 02:20:34 +00:00
Anton Korobeynikov 5d438e4ad2 Use ttype encoding consistently
llvm-svn: 96290
2010-02-15 22:38:25 +00:00
Anton Korobeynikov ec2ba08d16 It turns out that we emitted completely wrong common EH frame since the early beginning! The "z" CIE augmentation mark indicates that there is an extra word containing the size of augmentation section. However, even for frames w/o any augmentation data we emitted size uleb! (this is the case of "unwinding through C code"). Thus frame moves information was emitterd completely wrong.
llvm-svn: 96287
2010-02-15 22:36:41 +00:00
Anton Korobeynikov ae4ccc10da Preliminary patch to improve dwarf EH generation - Hooks to return Personality / FDE / LSDA / TType encoding depending on target / options (e.g. code model / relocation model) - MCIzation of Dwarf EH printer to use encoding information - Stub generation for ELF target (needed for indirect references) - Some other small changes here and there
llvm-svn: 96285
2010-02-15 22:35:59 +00:00
Bill Wendling 243e1f21db Use .empty() instead of .size().
llvm-svn: 95871
2010-02-11 10:37:57 +00:00
Bill Wendling 7c2005aa6d Fix to get it to compile.
llvm-svn: 95840
2010-02-11 01:15:27 +00:00
Bill Wendling 6034260c43 Don't print out a default newline when emitting the section offset. There are
almost always comments afterwards that need printing.

llvm-svn: 95839
2010-02-11 01:13:02 +00:00
Bill Wendling 7742b6406b Use an index instead of pointers into the vector. If the vector resizes, then
the pointer values could be invalid.

llvm-svn: 95813
2010-02-10 21:41:57 +00:00
Dan Gohman 4a618827de Fix "the the" and similar typos.
llvm-svn: 95781
2010-02-10 16:03:48 +00:00
Chris Lattner ea26fa9971 fix a layering violation: VirtRegRewriter.cpp shouldn't use AsmPrinter.h.
llvm-svn: 95748
2010-02-10 01:23:18 +00:00
Bill Wendling a0cd0e11c9 Improve comments a even more.
llvm-svn: 95740
2010-02-10 00:59:47 +00:00
Chris Lattner 74e6852510 Move verbose asm instruction comments to using MCStreamer.
The major win of this is that the code is simpler and they 
print on the same line as the instruction again:

        movl    %eax, 96(%esp)          ## 4-byte Spill
        movl    96(%esp), %eax          ## 4-byte Reload
        cmpl    92(%esp), %eax          ## 4-byte Folded Reload
        jl      LBB7_86

llvm-svn: 95738
2010-02-10 00:47:53 +00:00
Bill Wendling b188e92ca9 Improve comments a bit more.
llvm-svn: 95737
2010-02-10 00:45:28 +00:00
Chris Lattner ff68a42121 print all the newlines at the end of instructions with
OutStreamer.AddBlankLine instead of textually.

llvm-svn: 95734
2010-02-10 00:36:00 +00:00
Bill Wendling bf02536262 Improve comments in the LSDA somewhat. They can be improved much more.
llvm-svn: 95707
2010-02-09 22:49:16 +00:00
Chris Lattner b06015aa69 move target-independent opcodes out of TargetInstrInfo
into TargetOpcodes.h.  #include the new TargetOpcodes.h
into MachineInstr.  Add new inline accessors (like isPHI())
to MachineInstr, and start using them throughout the 
codebase.

llvm-svn: 95687
2010-02-09 19:54:29 +00:00
Devang Patel ce25dd74c0 Add declaration attribute to a variable DIE, if there is a separate DIE for the definition.
llvm-svn: 95646
2010-02-09 01:58:33 +00:00
Dan Gohman 227077d1be Implement AsmPrinter support for several more operators which have
direct MCExpr equivalents. Don't use MCExpr::Shr because it isn't
consistent between targets.

llvm-svn: 95620
2010-02-09 00:02:37 +00:00
Chris Lattner ebc970e4eb now that @GOTOFF is no longer represented as a suffix on a
MCSymbol, we can remove the 'suffix' argument of 
GetBlockAddressSymbol.  Do so.

llvm-svn: 95601
2010-02-08 23:10:08 +00:00
Dan Gohman e51b57bee0 ConstantFoldConstantExpression can theoretically return the original
expression; don't go into an infinite loop if it does.

llvm-svn: 95591
2010-02-08 22:19:11 +00:00
Dan Gohman 4268d6a7c3 When CodeGen'ing unoptimized code, there may be unfolded constant expressions
in global initializers. Instead of aborting, attempt to fold them on the
spot. If folding succeeds, emit the folded expression instead.

This fixes PR6255.

llvm-svn: 95583
2010-02-08 22:02:38 +00:00
Duncan Sands a1b98ab7d5 Give DwarfPrinter a protected (but not virtual) destructor. Cppcheck
warns about this base class not having a virtual destructor, but since
this class has no virtual methods and neither it or the types derived
from it has a destructor, a protected trivial destructor will do (and
shuts cppcheck up) the trick without the cost of introducing a vtable.

llvm-svn: 95526
2010-02-07 21:09:22 +00:00
Devang Patel 6efc8e5120 Set DW_AT_artificial only if argument is marked as artificial.
llvm-svn: 95461
2010-02-06 01:02:37 +00:00
Devang Patel d4be4ced76 Do not generate specification DIE for nested functions.
llvm-svn: 95452
2010-02-05 23:09:20 +00:00
Bill Wendling 6510dc8dc3 An empty global constant (one of size 0) may have a section immediately
following it. However, the EmitGlobalConstant method wasn't emitting a body for
the constant. The assembler doesn't like that. Before, we were generating this:

  .zerofill __DATA, __common, __cmd, 1, 3

This fix puts us back to that semantic.

llvm-svn: 95336
2010-02-05 00:17:02 +00:00
Devang Patel d231689adb Emit appropriate expression to find virtual base offset.
llvm-svn: 95242
2010-02-03 20:08:48 +00:00
Devang Patel 999b499024 Provide interface to identifiy artificial methods.
llvm-svn: 95240
2010-02-03 19:57:19 +00:00
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
Devang Patel 057c642486 Apparently gdb is not amused by empty lines in pubtypes section.
llvm-svn: 95064
2010-02-02 03:47:27 +00:00
Devang Patel 6d404adc1b NULL terminate name in pubtypes sections.
llvm-svn: 95062
2010-02-02 03:37:03 +00:00
Devang Patel 160c92dd19 Emit declaration DIE for the class static variables.
llvm-svn: 94870
2010-01-30 01:08:30 +00:00
Devang Patel aedd6f5b33 Add size and location info in DW_TAG_class_type descriptor.
llvm-svn: 94822
2010-01-29 18:34:58 +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
Jim Grosbach 54c0530834 Update of 94055 to track the IR level call site information via an intrinsic.
This allows code gen and the exception table writer to cooperate to make sure
landing pads are associated with the correct invoke locations.

llvm-svn: 94726
2010-01-28 01:45:32 +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 56e9b5975d remove a noop function.
llvm-svn: 94616
2010-01-26 23:26:29 +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 76555b513c constify a bunch of dwarf stuff now that the registerinfo method
is constified.

llvm-svn: 94613
2010-01-26 23:18:02 +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
Devang Patel 1973df2e3f Use AssertingVH, just to be paranoid.
llvm-svn: 94593
2010-01-26 21:39:14 +00:00
Devang Patel 303a1beea6 Emit DW_AT_containing_type attribute for a class if containing type is known.
llvm-svn: 94587
2010-01-26 21:16:06 +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 3dd38a8112 eliminate MCAsmInfo::NeedsSet: we now just use .set on any platform
that has it.

llvm-svn: 94581
2010-01-26 20:20:43 +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 823aed16f9 make -fno-rtti the default unless a directory builds with REQUIRES_RTTI.
llvm-svn: 94378
2010-01-24 20:43:08 +00:00
Chris Lattner 62f2840572 fix some issues where we weren't emitting enough newlines.
llvm-svn: 94370
2010-01-24 19:01:06 +00:00
Chris Lattner 5adf987417 when emitting DIEs, emit the comment on the same line as the directive.
This fixes FrontendObjC/2009-11-30-Objc-ID.m

llvm-svn: 94369
2010-01-24 18:54:17 +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 ded9af63bb teach MCAsmStreamer::EmitBytes to use .ascii and .asciz
llvm-svn: 94259
2010-01-23 00:15:00 +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 56940ab899 remove uses of EOL.
llvm-svn: 94252
2010-01-22 23:43:14 +00:00
Chris Lattner 7859b1c226 add a new EmitCFAByte method and use it.
llvm-svn: 94251
2010-01-22 23:40:08 +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
Devang Patel ac277eb930 Remove MetadataBase class because it is not adding significant value.
llvm-svn: 94243
2010-01-22 22:52:10 +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 69bb026835 rename the dwarf class to DwarfPrinter. This matches the filename
and much more accurately describes what it is all about.

llvm-svn: 94233
2010-01-22 22:23:57 +00:00
Chris Lattner 00a6ae240e fix indentation
llvm-svn: 94232
2010-01-22 22:19:51 +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 7ba0661f27 Stop building RTTI information for *most* llvm libraries. Notable
missing ones are libsupport, libsystem and libvmcore.  libvmcore is
currently blocked on bugpoint, which uses EH.  Once it stops using
EH, we can switch it off.

This #if 0's out 3 unit tests, because gtest requires RTTI information.
Suggestions welcome on how to fix this.

llvm-svn: 94164
2010-01-22 06:49:46 +00:00
Jim Grosbach 143f7eb4c8 back this out for now. Growing Function is not good.
llvm-svn: 94097
2010-01-21 20:10:22 +00:00
Jim Grosbach e029a6a5ed Make sure that landing pad entries in the EH call site table are in the proper
order for SjLj style exception handling.

llvm-svn: 94055
2010-01-21 00:43:30 +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
Devang Patel 7771b7c621 If a instruction belongs to another function (and not current function) as per debug info attached with the instruction then ignore the dangling lexical scope of this instruction. Such scopes are unreachable.
llvm-svn: 93967
2010-01-20 02:05:23 +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 018b29b039 MDNodes are not expected to disappear or replaced by another MDNode, so there is no need to pay the cost of WeakVH and ValueMaps.
llvm-svn: 93865
2010-01-19 06:19:05 +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
Devang Patel fe189e65d7 Revert accident check-in from r93165.
llvm-svn: 93832
2010-01-19 01:26:02 +00:00
Bill Wendling a73e471c62 - Add a comment to the callback indicating that it's *extremely* not a good
idea, but unfortunately necessary.
- Default to using 4-bytes for the LSDA pointer encoding to agree with the
  encoded value in the CIE.

llvm-svn: 93753
2010-01-18 19:36:27 +00:00
Chris Lattner c8f7717808 remove the MAI argument to MCExpr::print and switch overthing to use << when printing them.
llvm-svn: 93699
2010-01-18 00:37:40 +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 06d45f6e75 Change DIEObjectLabel to take an MCSymbol instead of std::string.
llvm-svn: 93647
2010-01-16 18:50:28 +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 814b7e7488 No need to use WeakVH here.
llvm-svn: 93631
2010-01-16 06:17:40 +00:00
Devang Patel c0e17df3ce Replace DebugLocTuple with DILocation.
llvm-svn: 93630
2010-01-16 06:09:35 +00:00
Bill Wendling bf5cfa1a41 Retrying r91337:
The CIE says that the LSDA point in the FDE section is an "sdata4". That's fine,
but we need it to actually be 4-bytes in the FDE for some platforms. Allow
individual platforms to decide for themselves.

llvm-svn: 93616
2010-01-16 01:40:55 +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
Devang Patel 0633820599 Add FIXME.
llvm-svn: 93562
2010-01-15 22:08:16 +00:00
Devang Patel 89880c8224 Do not use AT_specification die for static variables. It confuses gdb.
llvm-svn: 93494
2010-01-15 01:12:22 +00:00
Devang Patel 2108ee075f Do not emit multiple AT_container_type attributes.
We need to find a better way to emit this info.

llvm-svn: 93481
2010-01-15 00:26:31 +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
Devang Patel 8992323bb9 s/NextValueNo/NextMDValueNo while processing metadata.
llvm-svn: 93165
2010-01-11 18:52:33 +00:00
Benjamin Kramer 2b45998b7b Kill dead store.
llvm-svn: 92920
2010-01-07 17:50:57 +00:00
Devang Patel d146e2e3df If a scope has only one instruction then first instruction is also the last instruction.
llvm-svn: 92736
2010-01-05 16:59:17 +00:00
Devang Patel 43ef34d2a5 Use StringRef.startswith().
llvm-svn: 92671
2010-01-05 01:46:14 +00:00
Devang Patel e6433faba6 Fix debug_inlined section entries for routines whose names are changed through __asm() extension.
llvm-svn: 92533
2010-01-04 23:04:36 +00:00
Devang Patel 530a075f17 Fix begin and end markers for nested scopes.
llvm-svn: 92505
2010-01-04 20:44:00 +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
Chris Lattner f81add3fdf move these out of their own timer groups into the 'uncategorized' groups.
llvm-svn: 92206
2009-12-28 07:41:18 +00:00
Bill Wendling ba27bef114 Remove dead store.
llvm-svn: 92156
2009-12-25 13:37:27 +00:00
David Greene c230cb947a Change errs() to dbgs().
llvm-svn: 92096
2009-12-24 00:31:35 +00:00
David Greene 8bc072cda6 Change errs() to dbgs().
llvm-svn: 92094
2009-12-24 00:27:55 +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
Bill Wendling 03b5aed7d8 Temporarily revert 91337. It's causing testcase failures.
$ svn merge -c -91337 https://llvm.org/svn/llvm-project/llvm/trunk
--- Reverse-merging r91337 into '.':
U    lib/CodeGen/AsmPrinter/DwarfException.cpp

llvm-svn: 91618
2009-12-17 20:41:01 +00:00
Devang Patel 1f4690c624 Add support to emit debug info for C++ namespaces.
llvm-svn: 91440
2009-12-15 19:16:48 +00:00
Chris Lattner 45d040bd85 Remove isPod() from DenseMapInfo, splitting it out to its own
isPodLike type trait.  This is a generally useful type trait for
more than just DenseMap, and we really care about whether something
acts like a pod, not whether it really is a pod.

llvm-svn: 91421
2009-12-15 07:26:43 +00:00
Bill Wendling 1bdf5d6f75 The CIE says that the LSDA point in the FDE section is an "sdata4". That's fine,
but we need it to actually be 4-bytes in the FDE.

llvm-svn: 91337
2009-12-14 21:49:44 +00:00
Devang Patel 525dda05a0 Use DW_AT_specification to point to DIE describing function declaration.
llvm-svn: 91278
2009-12-14 16:18:45 +00:00
Devang Patel b314bd688a Construct CompileUnits lazily.
llvm-svn: 91159
2009-12-11 21:37:07 +00:00
Devang Patel 2eec32d944 If VariableDIe is not created (may be because global was optimzed away) then do not try to use the variable die.
llvm-svn: 91077
2009-12-10 23:25:41 +00:00
Devang Patel 2b75ed2c3d Refactor code that finds context for a given die.
Create global variable DIEs after creating subprogram DIEs. This allows function level static variable's to find their context at the time of DIE creation.

llvm-svn: 91055
2009-12-10 19:14:49 +00:00
Devang Patel b5b60ea4f9 Refactor.
llvm-svn: 91051
2009-12-10 18:05:33 +00:00
Devang Patel 9ccfb641d1 Reapply r90858, a cleanup patch.
llvm-svn: 90979
2009-12-09 18:24:21 +00:00
Devang Patel 512001ac7d Revert 90858 90875 and 90805 for now.
llvm-svn: 90898
2009-12-08 23:21:45 +00:00
Devang Patel 24c0bb1ca1 Cleanup.
There is no need to supply ModuleCU to addType() as a parameter.

llvm-svn: 90858
2009-12-08 15:31:31 +00:00
Devang Patel 7d723ec70d Do not try to push dead variable's debug info into namespace info.
llvm-svn: 90857
2009-12-08 15:01:35 +00:00
Devang Patel b074d1783b Add support to emit debug info for c++ style namespaces.
llvm-svn: 90805
2009-12-07 21:41:32 +00:00
Dan Gohman 0891d759b5 Don't print a space before the : between the file name and line number.
And separate the directory and file name with a '/'.

llvm-svn: 90641
2009-12-05 02:00:34 +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
Devang Patel 8f0460278c In TAG_subrange_type, uppder bound is zero indexed.
llvm-svn: 90617
2009-12-04 23:10:24 +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 3b666fef67 Insert composite type DIE into the map before processing type fields. This allows fields to find their context DIE from the map.
llvm-svn: 90498
2009-12-03 23:46:57 +00:00
Devang Patel eb57c59b66 Add support to emit debug info for virtual functions and virtual base classes.
llvm-svn: 90474
2009-12-03 19:11:07 +00:00
Devang Patel 236526dd18 Emit method definition DIE at module level (even for methods with inlined functino body at soure level) so that the debugger can invoke it. This fixes many test failures in gdb test suite.
llvm-svn: 90375
2009-12-03 01:25:38 +00:00
Devang Patel 8c33959df2 Clarify that DIEString does not keep a copy of the string.
llvm-svn: 90318
2009-12-02 15:25:16 +00:00
Devang Patel a605b9124a Reuse existing subprogram DIE.
llvm-svn: 90281
2009-12-01 23:07:59 +00:00
Devang Patel 0a2c0bcb14 Clear function specific containers while processing end of a function, even if DW_TAG_subprogram for current function is not found.
llvm-svn: 90247
2009-12-01 18:13:48 +00:00
Devang Patel ae466efe2e If pointer type has a name then do not ignore the name.
llvm-svn: 90172
2009-11-30 23:56:56 +00:00
Benjamin Kramer 4cd30817d3 Avoid some possibly unsafe uses of StringRef::data().
llvm-svn: 89873
2009-11-25 18:26:09 +00:00
Devang Patel 2d9caf9fe5 Use StringRef (again) in DebugInfo interface.
llvm-svn: 89866
2009-11-25 17:36:49 +00:00
Devang Patel b3e0168428 Use StringRef instead of std::string in DIEString.
llvm-svn: 89793
2009-11-24 19:42:17 +00:00
Devang Patel c8654eb64e Swith to pubtypes section before emitting pub types.
llvm-svn: 89787
2009-11-24 19:18:41 +00:00
Devang Patel 04d2f2d192 Emit pubtypes.
llvm-svn: 89725
2009-11-24 01:14:22 +00:00
Dan Gohman 3650f4ed0c Simplify this code.
llvm-svn: 89702
2009-11-23 21:30:55 +00:00
Devang Patel b5b51598ba Revert r89487.
llvm-svn: 89686
2009-11-23 18:43:37 +00:00
Jim Grosbach bf6d35893f Add getFrameIndexReference() to TargetRegisterInfo, which allows targets to
tell debug info which base register to use to reference a frame index on a
per-index basis. This is useful, for example, in the presence of dynamic
stack realignment when local variables are indexed via the stack pointer and
stack-based arguments via the frame pointer.

llvm-svn: 89620
2009-11-22 20:14:00 +00:00
Jim Grosbach 00e9c6103b 80-column cleanup
llvm-svn: 89612
2009-11-22 19:20:36 +00:00
Jim Grosbach 042483efb1 remove trailing whitespace
llvm-svn: 89567
2009-11-21 23:12:12 +00:00
Devang Patel 930143b0dc Cosmetic changes, which were long overdue, in DwarfDebug.cpp.
llvm-svn: 89537
2009-11-21 02:48:08 +00:00
Devang Patel e1bbc33355 Remove dead code.
llvm-svn: 89522
2009-11-21 00:54:03 +00:00
Devang Patel 92e8c655b2 There is no need to use FoldingSet to unique DIEs.
DIEs are created from MDNode, which are already uniqued. And DwarfDebug already uses ValueMaps to find and use existing DIE for a given MDNode.

llvm-svn: 89518
2009-11-21 00:31:03 +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
Devang Patel e064ad4741 Do not hold on to a map slot while new entries may be inserted into the map.
Use ValueMap, instead of std::map.

llvm-svn: 89490
2009-11-20 21:37:22 +00:00
Devang Patel 85121a3bda There is no need to emit source location info for DW_TAG_pointer_type.
llvm-svn: 89487
2009-11-20 21:05:37 +00:00
Bill Wendling 31c74dbb10 Reverting the EH table patches.
$ svn merge -c -89279 https://llvm.org/svn/llvm-project/llvm/trunk
--- Reverse-merging r89279 into '.':
U    lib/CodeGen/AsmPrinter/DwarfException.cpp
U    lib/Target/TargetLoweringObjectFile.cpp
$ svn merge -c -89270 https://llvm.org/svn/llvm-project/llvm/trunk
--- Reverse-merging r89270 into '.':
G    lib/CodeGen/AsmPrinter/DwarfException.cpp
G    lib/Target/TargetLoweringObjectFile.cpp

llvm-svn: 89379
2009-11-19 19:21:09 +00:00
Bill Wendling 4b384b0294 The "ReadOnlyWithRel" enum seems to apply more to what Darwin does with the EH
exception table than DataRel.

llvm-svn: 89279
2009-11-19 00:09:14 +00:00
Bill Wendling 07e6e2c6f8 Attempt #2:
Place the EH table in the __TEXT section on MachO. It saves space.

llvm-svn: 89270
2009-11-18 23:18:46 +00:00
Nick Lewycky a1c09d674e Remove VISIBILITY_HIDDEN from the classes in this directory. Fixes bug 5507.
llvm-svn: 89075
2009-11-17 09:17:08 +00:00
Nick Lewycky b7993d61f2 Revert r88939.
llvm-svn: 89066
2009-11-17 08:11:44 +00:00
Bill Wendling bc0020174b Refactor the code that creates the "dot-label" difference. This may be used in
more than one place. No intended functionality change.

llvm-svn: 89024
2009-11-17 01:23:53 +00:00
Devang Patel f3d7c08e34 Revert r88939.
llvm-svn: 88973
2009-11-16 21:53:40 +00:00
Devang Patel 2ffd9935a1 Add VISIBILITY_HIDDEN marker.
llvm-svn: 88939
2009-11-16 19:20:48 +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 97f99fa554 Ignore nameless variables.
llvm-svn: 87069
2009-11-13 02:25:26 +00:00
Bill Wendling c781d7a072 Simplify code a bit
llvm-svn: 87040
2009-11-12 23:13:08 +00:00
Bill Wendling e412064c4c Refactor code that checks if it's a call to a "nounwind" function.
llvm-svn: 87036
2009-11-12 21:59:20 +00:00
Bill Wendling e3ae25b3d8 If there's more than one function operand to a call instruction, be conservative
and don't assume that the call doesn't throw. It would be nice if there were a
way to determine which is the callee and which is a parameter. In practice, the
architecture we care about normally only have one operand for a call instruction
(x86 and arm).

llvm-svn: 87023
2009-11-12 20:51:53 +00:00
Devang Patel 2904aa9f6e "Attach debug info with llvm instructions" mode was enabled a month ago. Now make it permanent and remove old way of inserting intrinsics to encode debug info for line number and scopes.
llvm-svn: 87014
2009-11-12 19:02:56 +00:00
Bill Wendling 7a6b11e707 Don't mark a call as potentially throwing if the function it's calling has the
"nounwind" attribute.

llvm-svn: 86897
2009-11-11 23:17:02 +00:00
Devang Patel d41f119dac If doesSupportDebugInformation() is false then do not try to emit dwarf debug info.
llvm-svn: 86874
2009-11-11 19:55:08 +00:00
Daniel Dunbar 75b4d3562c Fix -Asserts warning.
llvm-svn: 86794
2009-11-11 03:09:50 +00:00
Bill Wendling 676f44062e Make sure that the exception handling data has the same visibility as the
function it's generated for.

llvm-svn: 86779
2009-11-11 01:24:59 +00:00
Devang Patel 78319c67ca Do not assume first function scope seen represents current function.
llvm-svn: 86771
2009-11-11 00:31:36 +00:00
Devang Patel 4450f26621 While creating DbgScopes, do not forget parent scope.
llvm-svn: 86763
2009-11-11 00:18:40 +00:00
Devang Patel cdb7d44d6d Ignore variable if scope info is not available.
llvm-svn: 86753
2009-11-10 23:20:04 +00:00
Devang Patel f6eeaebd76 Implement support to debug inlined functions.
llvm-svn: 86748
2009-11-10 23:06:00 +00:00
Jeffrey Yasskin b40d3f76a0 Fix DenseMap iterator constness.
This patch forbids implicit conversion of DenseMap::const_iterator to
DenseMap::iterator which was possible because DenseMapIterator inherited
(publicly) from DenseMapConstIterator. Conversion the other way around is now
allowed as one may expect.

The template DenseMapConstIterator is removed and the template parameter
IsConst which specifies whether the iterator is constant is added to
DenseMapIterator.

Actually IsConst parameter is not necessary since the constness can be
determined from KeyT but this is not relevant to the fix and can be addressed
later.

Patch by Victor Zverovich!

llvm-svn: 86636
2009-11-10 01:02:17 +00:00
Bob Wilson b29e155c53 Fix comment typos.
llvm-svn: 86295
2009-11-06 22:38:38 +00:00
Devang Patel cc11371b77 Do not bother to emit debug info for nameless global variable.
llvm-svn: 86259
2009-11-06 17:58:12 +00:00
Devang Patel 06ce6506d2 Do not try to emit debug info entry for dead global variable.
llvm-svn: 86212
2009-11-06 01:30:04 +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
Devang Patel f05d57283e While calculating original type size for a derived type, handle type variants encoded as DIDerivedType appropriately.
This improves bitfield support.

llvm-svn: 86073
2009-11-04 23:48:00 +00:00
Devang Patel 67f56f08c2 Fix DW_AT_data_member_location for bit-fields. It points to the location of annonymous field that covers respective field.
llvm-svn: 86054
2009-11-04 22:06:12 +00:00
Devang Patel 5d3fe2fc77 Array element size does not match array size but array is not a bitfield.
llvm-svn: 86043
2009-11-04 19:37:40 +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
Devang Patel ffa7c07352 Ignore unnamed variables.
llvm-svn: 85909
2009-11-03 18:30:27 +00:00
Jeffrey Yasskin 6235b19d7b Fix a funky "declared with greater visibility than the type of its field"
warning from gcc by removing VISIBILITY_HIDDEN attributes.  

llvm-svn: 85873
2009-11-03 06:29:36 +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 cfeaa48642 Do not held on to DenseMap slot accross map insertion. The insertion may cause the map to grow rending the slot invalid.
Use this opportunity to use ValueMap instead of DenseMap.

llvm-svn: 85298
2009-10-27 20:47:17 +00:00
Nick Lewycky 974e12b2d3 Remove includes of Support/Compiler.h that are no longer needed after the
VISIBILITY_HIDDEN removal.

llvm-svn: 85043
2009-10-25 06:57:41 +00:00
Nick Lewycky 02d5f77d26 Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.
Chris claims we should never have visibility_hidden inside any .cpp file but
that's still not true even after this commit.

llvm-svn: 85042
2009-10-25 06:33:48 +00:00
Bill Wendling 4f0b8d7861 Tidying up some code and comments. No functionality change.
llvm-svn: 84894
2009-10-22 20:48:59 +00:00
Devang Patel 12524fd2e5 Do not emit name entry for a pointer type.
llvm-svn: 84276
2009-10-16 21:27:43 +00:00
Devang Patel d0099a94db If there is not any llvm instruction associated with each lexical scope encoded in debug info then create such scope on demand for variable info.
llvm-svn: 84262
2009-10-16 18:18:03 +00:00
Devang Patel 6875c5ebe4 Add support to record DbgScope as inlined scope.
llvm-svn: 84134
2009-10-14 21:08:09 +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
Daniel Dunbar cdf01b5d82 Fix a -Asserts warning.
llvm-svn: 83950
2009-10-13 06:47:08 +00:00