Commit Graph

1224 Commits

Author SHA1 Message Date
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
Devang Patel 0f58bec599 Find enclosing subprogram info.
llvm-svn: 83922
2009-10-12 23:11:24 +00:00
Devang Patel df45c7f642 Extract scope information from the variable itself, instead of relying on alloca or llvm.dbg.declare location.
While recording beginning of a function, use scope info from the first location entry instead of just relying on first location entry itself.

llvm-svn: 83684
2009-10-09 22:42:28 +00:00
Devang Patel fafa1fe2ad Check invalid debug info for enums. This may happen when underlyng enum is optimized away. Eventually DwarfChecker will clean this up during llvm verification stage.
llvm-svn: 83655
2009-10-09 17:51:49 +00:00
Devang Patel 20b2a77765 Do not record line number to implicitly mark start of function if function has arguments. Extra line number entries trip gdb in some cases.
llvm-svn: 83563
2009-10-08 18:48:03 +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 7d838bb66e Fix cut-n-pasto.
llvm-svn: 83367
2009-10-06 03:15: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
Devang Patel 2980a22028 Remove dead code.
llvm-svn: 83362
2009-10-06 02:01:32 +00:00
Devang Patel 8db360da7b Add utility routine to set begin and end labels for DbgScopes.
This will be used by processDebugLoc().

llvm-svn: 83361
2009-10-06 01:50:42 +00:00
Devang Patel 849e59abb2 Remove unintentional function decl.
llvm-svn: 83356
2009-10-06 01:31:35 +00:00
Devang Patel 475d32a987 Add utility routine to collect variable debug info. This is not yet used.
llvm-svn: 83355
2009-10-06 01:26:37 +00:00
Devang Patel d859d86538 Existence of a compile unit for input source file is a good indicator to check debug info's presence in a module.
llvm-svn: 83348
2009-10-06 00:03:14 +00:00
Devang Patel 1c9eef72b4 If subprogram die is not available then construct new one.
This can happen if debug info is processed lazily.

llvm-svn: 83347
2009-10-05 23:59:00 +00:00
Devang Patel 4c420eca41 Adjust context for the global variables that are not at file scope, e.g.
void foo() { static int bar = 42; }
Here, foo's DIE is parent of bar's DIE.

llvm-svn: 83344
2009-10-05 23:40:42 +00:00
Devang Patel 4144a82154 Set address while constructing DIE.
llvm-svn: 83343
2009-10-05 23:22:08 +00:00
Devang Patel 2089d16140 Gracefully handle various scopes while recording source line info.
llvm-svn: 83317
2009-10-05 18:03:19 +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 75cc16c0f2 Add support to extract lexical scope information from DebugLoc attached with an machine instruction.
This is not yet enabled.

llvm-svn: 83210
2009-10-01 20:31:14 +00:00
Devang Patel 787f94c28d Record first and last instruction of a scope in DbgScope.
llvm-svn: 83207
2009-10-01 18:25:23 +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
Mike Stump 14cf8ecf0b Add a way for a frontend to generate more complex dwarf location
information.  This allows arbitrary code involving DW_OP_plus_uconst
and DW_OP_deref.  The scheme allows for easy extention to include,
any, or all of the DW_OP_ opcodes.  I thought about just exposing all
of them, but, wasn't sure if people wanted the dwarf opcodes exposed
in the api.  Is that a layering violation?

With this scheme, the entire existing block scheme used by llvm-gcc
can be switched over to the new scheme.  I think that would be
cleaner, as then the compiler specific bits are not present in llvm
proper.  Before the old code can be yanked however, similar code in
clang would have to be removed.

Next up, more testing.

llvm-svn: 83120
2009-09-30 00:08:22 +00:00
Devang Patel b296942f6d Remove std::string uses from DebugInfo interface.
llvm-svn: 83083
2009-09-29 18:40:58 +00:00
Mike Stump 944fa25934 Delete space after function name, before (, reflow a comment and
delete a few blank lines.

llvm-svn: 82729
2009-09-24 23:21:26 +00:00
Mike Stump d6f9a2f90b Fix spacing.
llvm-svn: 82727
2009-09-24 23:11:08 +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
Mike Stump 8808063181 This is overly constraining with respect to clang.
llvm-svn: 82591
2009-09-23 00:13:30 +00:00
Bill Wendling 692a3ea0b7 --- Reverse-merging r82282 into '.':
U    lib/CodeGen/AsmPrinter/DwarfException.cpp
U    lib/CodeGen/AsmPrinter/DwarfException.h

--- Reverse-merging r82274 into '.':
U    lib/Target/TargetLoweringObjectFile.cpp
G    lib/CodeGen/AsmPrinter/DwarfException.cpp

These revisions were breaking everything.

llvm-svn: 82396
2009-09-20 09:13:15 +00:00
Bill Wendling 0f899601f3 Here's fun! It turns out that these filter functions can be internal. If they're
internal, they shouldn't use the indirect pointer stuff. In the case of
throw_rethrow_test, it was marked as 'internal' and calculated its own offset to
its contents.

llvm-svn: 82354
2009-09-20 02:19:49 +00:00
Daniel Dunbar be22ec4cfc Fix indentation.
llvm-svn: 82333
2009-09-19 20:40:14 +00:00
Daniel Dunbar c418d6b106 Strip trailing whitespace.
llvm-svn: 82332
2009-09-19 20:40:05 +00:00
Bill Wendling 053237109a Factor out label difference creation.
llvm-svn: 82282
2009-09-18 21:37:56 +00:00
Bill Wendling 43f2cd7757 It's inefficient to have place the exception tables (which contain the LSDA)
into the __DATA section. At launch time, dyld has to update most of the section
to fix up the type info pointers. It's better to place it into the __TEXT
section and use pc-rel indirect pointer encodings. Similar to the personality
routine.

llvm-svn: 82274
2009-09-18 21:14:36 +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 a6ebba270d pass machinemoduleinfo down into getSymbolForDwarfGlobalReference,
currently unused.

llvm-svn: 82157
2009-09-17 18:49:52 +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 b866602f06 Big change #1 for personality function references:
Eliminate the PersonalityPrefix/Suffix & NeedsIndirectEncoding
fields from MAI: they aren't part of the asm syntax, they are
related to the structure of the object file.

To replace their functionality, add a new 
TLOF::getSymbolForDwarfGlobalReference method which asks targets
to decide how to reference a global from EH in a pc-relative way.

The default implementation just returns the symbol.  The default
darwin implementation references the symbol through an indirect
$non_lazy_ptr stub.  The bizarro x86-64 darwin specialization
handles the weird "foo@GOTPCREL+4" hack.

DwarfException.cpp now uses this to emit the reference to the
symbol in the right way, and this also eliminates another 
horrible hack from DwarfException.cpp:

-    if (strcmp(MAI->getPersonalitySuffix(), "+4@GOTPCREL"))
-      O << "-" << MAI->getPCSymbol();

llvm-svn: 81991
2009-09-16 01:46:41 +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 7b40df7589 strength reduce a call to PrintRelDirective(true).
llvm-svn: 81942
2009-09-15 22:58:35 +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
Chris Lattner 11b2fc9ea4 Change MCAsmStreamer to take an MCInstPrinter instead of a
full AsmPrinter, and change TargetRegistry to keep track
of registered MCInstPrinters.

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

llvm-svn: 81754
2009-09-14 03:02:37 +00:00
Chris Lattner 6822e695c1 eliminate an extraneous use of TRI::getAsmName in a comment.
llvm-svn: 81705
2009-09-13 19:48:37 +00:00
Chris Lattner d940dd5801 remove MAI::JumpTableSpecialLabelPrefix now that MAI
has real information about linker private linkage.

llvm-svn: 81695
2009-09-13 19:02:16 +00:00
Chris Lattner 1d04aa78f3 replace printBasicBlockLabel with EmitBasicBlockStart,
now that printBasicBlockLabel is only used for starting
a MBB.  This allows elimination of a bunch of arguments.

llvm-svn: 81684
2009-09-13 18:25:37 +00:00
Chris Lattner 4cd449813a convert some uses of printBasicBlockLabel to use GetMBBSymbol
instead.

llvm-svn: 81677
2009-09-13 17:14:04 +00:00
Chris Lattner a602bebb61 devirtualize AsmPrinter::printBasicBlockLabel since it is never overridden.
Move GetMBBSymbol up to AsmPrinter and make printBasicBlockLabel use it so that
we only have one place that decides what to name bb labels.  Hopefully various
clients of printBasicBlockLabel can start using GetMBBSymbol instead.

llvm-svn: 81652
2009-09-12 23:02:08 +00:00
Caroline Tice 183a519771 Don't generate Dwarf line table entries for source line 0.
llvm-svn: 81542
2009-09-11 18:25:54 +00:00
Duncan Sands 4bd8040d14 Fix PR4948 (and a leak): by not destroying the DwarfException
object, the timer it creates was not being deleted.  Since the
timer belonged to a static timer group, the timer group would
be destroyed on shutdown, and would notice and complain that
not all timers it contained were destroyed.

llvm-svn: 81533
2009-09-11 17:24:29 +00:00
Bill Wendling 9535ae42ff Exit early if exception handling isn't supported.
llvm-svn: 81454
2009-09-10 18:28:06 +00:00
Bill Wendling 023ed6480e Comment and whitespace cleanups. No intentional functionality change.
llvm-svn: 81436
2009-09-10 06:50:01 +00:00
Bill Wendling 9e5c2065c5 Revert part of my r81424 patch. I removed what looked like superfluous padding
from the exception tables. However, Duncan explained why it's a can of worms to
do it the GCC way. I went back to doing it the LLVM way and added Duncan's
explanation so that I don't do this again in the future.

llvm-svn: 81434
2009-09-10 06:27:16 +00:00
Bill Wendling 243ac566e2 Don't hardcode the TType format size. In fact, rework the code so that it's more
like what GCC outputs. The mysterious code to insert padding wasn't in GCC at
all. I modified the TType base offset code to calculate the offset like GCC
does, though.

llvm-svn: 81424
2009-09-10 02:07:37 +00:00
Bill Wendling bf56268ff9 Remove the "#if 0" that Noone loved. It wasn't really necessary, because the
code within it was the same inside and out. There's still a problem of the
TypeInfoSize should be the size of the TType format encoding (at least that's
what GCC thinks it should be).

llvm-svn: 81417
2009-09-10 01:12:47 +00:00
Bill Wendling a482ec83c5 Pull check for SJLJ EH into a boolean and use that.
llvm-svn: 81409
2009-09-10 00:17:04 +00:00
Bill Wendling 73094e15c4 Use the SizeOfEncodedValue function instead of magic variables for the
sizeof(DW_EH_PE_udata4).

llvm-svn: 81408
2009-09-10 00:13:16 +00:00
Bill Wendling 7b40b5a243 Add helpful comment.
llvm-svn: 81406
2009-09-10 00:04:48 +00:00
Bill Wendling da3e7547fb Believe it or not, this is a simplification. :-)
Basically, this patch is working towards removing the hard-coded values that are
output for the CIE. In particular, the CIE augmentation and the CIE augmentation
size. Both of these should be calculated. In the process, I was able to make a
bunch of code simpler.

The encodings for the personality, LSDA, and FDE in the CIE are still not
correct. They should be generated either from target-specific callbacks (blech!)
or grokked from first-principles.

llvm-svn: 81404
2009-09-09 23:56:55 +00:00
Chris Lattner 321bc99a74 remove DebugLoc from MCInst and eliminate "Comment printing" from
the MCInst path of the asmprinter.  Instead, pull comment printing
out of the autogenerated asmprinter into each target that uses the
autogenerated asmprinter.  This causes code duplication into each
target, but in a way that will be easier to clean up later when more
asmprinter stuff is commonized into the base AsmPrinter class.

This also fixes an xcore strangeness where it inserted two tabs
before every instruction.

llvm-svn: 81396
2009-09-09 23:14:36 +00:00
Bill Wendling 572a0df0fc Use the EOL that takes the encoding and translates it into DWARF-English.
llvm-svn: 81382
2009-09-09 21:26:19 +00:00
Bill Wendling eaa71c3ae2 Early exit from function.
llvm-svn: 81381
2009-09-09 21:08:12 +00:00
Bill Wendling afd4f30df4 Small amount of code clean-up: Don't use ".size()" when not necessary.
llvm-svn: 81380
2009-09-09 21:06:24 +00:00
Devang Patel f5d5360065 Ignore malformed global variable debug info.
llvm-svn: 81055
2009-09-04 23:59:07 +00:00
Jim Grosbach e4459e466f reduce size of SmallString to something more reasonable
llvm-svn: 80710
2009-09-01 18:55:08 +00:00
Jim Grosbach c5fcbdc7ee Use raw_ostream instead of sstream
llvm-svn: 80704
2009-09-01 18:49:12 +00:00
Jim Grosbach 5afbf2b541 revert inadvertant change from previous commit
llvm-svn: 80689
2009-09-01 17:19:13 +00:00
Jim Grosbach 9372f4d7d5 Simply LSDA lable emission to use a direct special-case output instead of
EmitLabel()

llvm-svn: 80677
2009-09-01 16:43:35 +00:00
Jim Grosbach 20eac92d88 Clean up LSDA name generation and use for SJLJ exception handling. This
makes an eggregious hack somewhat more palatable. Bringing the LSDA forward
and making it a GV available for reference would be even better, but is
beyond the scope of what I'm looking to solve at this point.

Objective C++ code could generate function names that broke the previous
scheme. This fixes that.

llvm-svn: 80649
2009-09-01 01:57:56 +00:00
Devang Patel b2de5fa689 Subprogram is a scope. Derive DISubprogram from DIScope.
llvm-svn: 80637
2009-08-31 22:47:13 +00:00
Devang Patel 869529c58c Rename DIBlock as DILexicalBlock.
llvm-svn: 80633
2009-08-31 22:00:15 +00:00
Caroline Tice c87c1e2cfd Add flag to mark structs for Apple Block "byref" variables; also add code to
modify the type and location debug information for these variables to match the
programmer's expectations.

llvm-svn: 80625
2009-08-31 21:19:37 +00:00
Devang Patel 9fda4bd998 Simplify isDerivedType() and other predicate interface.
llvm-svn: 80602
2009-08-31 18:49:10 +00:00
Bill Wendling 6627c4ec82 Output a hex value, because all of the others are hex.
llvm-svn: 80601
2009-08-31 18:26:48 +00:00
Duncan Sands 9cf8bcb69d Revert commit 80428. It completely broke exception
handling on x86-32 linux.

llvm-svn: 80592
2009-08-31 16:45:16 +00:00
Jim Grosbach ce713134b8 PR4747
Shared landing pads run into trouble with SJLJ, as the dispatch table is
mapped to call sites, and merging the pads will throw that off. There needs
to be a one-to-one mapping of landing pad exception table entries to invoke
call points.

Detecting the shared pad during lowering of SJLJ info insn't sufficient, as
the dispatch function may still need separate destinations to properly
handle phi-nodes.

llvm-svn: 80530
2009-08-31 01:35:03 +00:00
Bill Wendling dc09af3ef5 Nuke moribund "std::string" version of EOL(..., Encoding).
llvm-svn: 80466
2009-08-30 00:28:57 +00:00
Bill Wendling 39bb29f7fe - Add target lowering methods to get the preferred format for the FDE and LSDA
encodings.
- Make some of the values emitted by the FDEs dependent upon the pointer
  size. This is in line with how GCC does things. And it has the benefit of
  working for Darwin in 64-bit mode now.

llvm-svn: 80428
2009-08-29 12:20:54 +00:00
Bill Wendling f8b28e4327 Add a form of EOL which emits the text version of a DWARF format encoding. This
doesn't handle all values of the formatting. Those can be added as needed.

llvm-svn: 80427
2009-08-29 12:17:53 +00:00
Eric Christopher 743dc0ef40 Make the augmentation size and next set of bytes agree on size,
and make the reference pointer size as it should be.

Fixes an abort on a testcase derived from libunwind's personality
test in 64-bit.

llvm-svn: 80414
2009-08-29 01:12:46 +00:00
Devang Patel 80ae34974b Reapply 79977.
Use MDNodes to encode debug info in llvm IR.

llvm-svn: 80406
2009-08-28 23:24:31 +00:00
Eric Christopher d517ac0682 Nuke trailing whitespace.
llvm-svn: 80401
2009-08-28 22:33:43 +00:00
Devang Patel 3082c01d68 Closure is a very generic name. Use AppleBlock instead.
llvm-svn: 80307
2009-08-27 23:51:51 +00:00
Bill Wendling e5b5d293e9 Revert accidental commit.
llvm-svn: 80198
2009-08-27 03:32:50 +00:00
Bill Wendling c7d230f736 --- Reverse-merging r80147 into '.':
A    include/llvm/ADT/iterator.cmake
U    autoconf/configure.ac
--- Reverse-merging r80161 into '.':
U    cmake/config-ix.cmake
--- Reverse-merging r80171 into '.':
U    Makefile
--- Reverse-merging r80173 into '.':
U    configure
U    include/llvm/Config/config.h.in
--- Reverse-merging r80180 into '.':
A    include/llvm/ADT/iterator.h.in

Despite common miscomceptions, iterator.h is alive and well. It broke the build
bots for several hours. And yet no one bothered to look at them.

Gabor and Doug, please review your changes and make sure that they actually
build before resubmitting them.

llvm-svn: 80197
2009-08-27 03:29:26 +00:00
Eric Christopher a258c62ea1 If we're emitting additional CIEs due to personality functions
don't emit the default one. Explicitly check for the NULL
CIE later.

llvm-svn: 80146
2009-08-26 21:30:49 +00:00
Devang Patel f08e35d9dc Revert 79977. It causes llvm-gcc bootstrap failures on some platforms.
llvm-svn: 80073
2009-08-26 05:01:18 +00:00
Devang Patel a1b4dd96f2 Add isClosure() predicate. This is used to add DW_AT_APPLE_block attribute.
Patch by Caroline Tice.

llvm-svn: 80061
2009-08-26 00:39:50 +00:00
Bill Wendling e98ee2a534 - Rename EmitCommonInformationEntry to EmitCIE.
- Rename EmitFunctionDescriptionEntry to EmitFDE.

llvm-svn: 79981
2009-08-25 08:08:33 +00:00
Devang Patel 02aac922b4 Update DebugInfo interface to use metadata, instead of special named llvm.dbg.... global variables, to encode debugging information in llvm IR. This is mostly a mechanical change that tests metadata support very well.
This change speeds up llvm-gcc by more then 6% at "-O0 -g" (measured by compiling InstructionCombining.cpp!)

llvm-svn: 79977
2009-08-25 05:24:07 +00:00
Bill Wendling 86f72fc3d9 - Emit new line after each FDE.
- Fix comment.

llvm-svn: 79971
2009-08-25 02:32:05 +00:00
Bill Wendling d7ace1e530 Rename functions to something more descriptive. At the very least mention the
CIE and FDE in their names.

llvm-svn: 79969
2009-08-25 02:27:42 +00:00
Chris Lattner 06fa176862 prune the #includes in raw_ostream.h by moving a
member out of line. ftostr is not particularly speedy,
so that method is presumably not perf sensitive.

llvm-svn: 79885
2009-08-24 03:52:50 +00:00
Chris Lattner c521f54198 Prune #includes from llvm/Linker.h and llvm/System/Path.h,
forcing them down into various .cpp files.

This change also:
1. Renames TimeValue::toString() and Path::toString() to ::str()
   for similarity with the STL.
2. Removes all stream insertion support for sys::Path, forcing
   clients to call .str().
3. Removes a use of Config/alloca.h from bugpoint, using smallvector
   instead.
4. Weans llvm-db off <iostream>

sys::Path really needs to be gutted, but I don't have the desire to
do it at this point.

llvm-svn: 79869
2009-08-23 22:45:37 +00:00