Commit Graph

1155 Commits

Author SHA1 Message Date
Bill Wendling ac67e99d53 Use isPrologLabel() instead of checking the opcode directly.
llvm-svn: 108628
2010-07-17 19:18:44 +00:00
Bill Wendling bf8370ff36 Consider this function:
void foo() { __builtin_unreachable(); }

It will output the following on Darwin X86:

_func1:
Leh_func_begin0:
        pushq %rbp
Ltmp0:
        movq %rsp, %rbp
Ltmp1:
Leh_func_end0:

This prolog adds a new Call Frame Information (CFI) row to the FDE with an
address that is not within the address range of the code it describes -- part is
equal to the end of the function -- and therefore results in an invalid EH
frame. If we emit a nop in this situation, then the CFI row is now within the
address range.

llvm-svn: 108568
2010-07-16 22:51:10 +00:00
Bill Wendling 499f797cdd Rename DBG_LABEL PROLOG_LABEL, because it's only used during prolog emission and
thus is a much more meaningful name.

llvm-svn: 108563
2010-07-16 22:20:36 +00:00
Jakob Stoklund Olesen 37c42a3d02 Remove many calls to TII::isMoveInstr. Targets should be producing COPY anyway.
TII::isMoveInstr is going tobe completely removed.

llvm-svn: 108507
2010-07-16 04:45:42 +00:00
Chris Lattner 28fd6785bc a more graceful fix for test/Other/inline-asm-newline-terminator.ll,
follow on to r103765

llvm-svn: 108390
2010-07-15 00:37:34 +00:00
Stuart Hastings d08fb75aaa Reverting r107918 and r107919. Radar 8063111.
llvm-svn: 107930
2010-07-08 23:25:39 +00:00
Devang Patel 4c6bd6612f Relax assertion. In optimized code, it is possible that first instruction is coming from a inlined function.
This fixes PR7596 .

llvm-svn: 107923
2010-07-08 22:39:20 +00:00
Stuart Hastings 43d226deea Fix decl/def debug info for template functions. Radar 8063111.
llvm-svn: 107919
2010-07-08 22:28:59 +00:00
Devang Patel 9c160e1213 Reuse DIEInteger for 1. This is frequently used while emitting an attribute using dwarf::DW_FORM_flag form.
llvm-svn: 107903
2010-07-08 20:10:35 +00:00
Devang Patel a37a95ea2f One MDNode may be used to create regular DIE as well as abstract DIE.
Keep track of abstract subprogram DIEs. 

llvm-svn: 107822
2010-07-07 22:20:57 +00:00
Devang Patel 9a0339fc1f Rename couple of maps.
llvm-svn: 107810
2010-07-07 20:49:57 +00:00
Devang Patel 30265c4f8b 80 cols.
llvm-svn: 107807
2010-07-07 20:12:52 +00:00
Dale Johannesen 4d887f7ca7 Propagate the AlignStack bit in InlineAsm's to the
PrologEpilog code, and use it to determine whether
the asm forces stack alignment or not.  gcc consistently
does not do this for GCC-style asms; Apple gcc inconsistently
sometimes does it for asm blocks.  There is no
convenient place to put a bit in either the SDNode or
the MachineInstr form, so I've added an extra operand
to each; unlovely, but it does allow for expansion for
more bits, should we need it.  PR 5125.  Some
existing testcases are affected.
The operand lists of the SDNode and MachineInstr forms
are indexed with awesome mnemonics, like "2"; I may
fix this someday, but not now.  I'm not making it any
worse.  If anyone is inspired I think you can find all
the right places from this patch.

llvm-svn: 107506
2010-07-02 20:16:09 +00:00
Bill Wendling 504055ce9e Make the "linker_private" linkage type emit a non-weak symbol to the file. It
will still be stripped by the linker when it generates the final image.

llvm-svn: 107440
2010-07-01 22:38:24 +00:00
Bill Wendling 03bcd6ecc8 Implement the "linker_private_weak" linkage type. This will be used for
Objective-C metadata types which should be marked as "weak", but which the
linker will remove upon final linkage. However, this linkage isn't specific to
Objective-C.

For example, the "objc_msgSend_fixup_alloc" symbol is defined like this:

      .globl l_objc_msgSend_fixup_alloc
      .weak_definition l_objc_msgSend_fixup_alloc
      .section __DATA, __objc_msgrefs, coalesced
      .align 3
l_objc_msgSend_fixup_alloc:
       .quad   _objc_msgSend_fixup
       .quad   L_OBJC_METH_VAR_NAME_1

This is different from the "linker_private" linkage type, because it can't have
the metadata defined with ".weak_definition".

Currently only supported on Darwin platforms.

llvm-svn: 107433
2010-07-01 21:55:59 +00:00
Devang Patel 429397529a Do not require line number entry for undefined local variable.
This is a regression caused by r106792 and caught by gdb testsuite.

llvm-svn: 107430
2010-07-01 21:38:08 +00:00
Daniel Dunbar 02877d6e85 MC: Pass the target instance to the AsmParser constructor.
llvm-svn: 107426
2010-07-01 20:41:56 +00:00
Mikhail Glushenkov 4721ad855e Trailing whitespace.
llvm-svn: 107360
2010-07-01 01:00:22 +00:00
Devang Patel c5b3109bec Do not construct DIE for already processed MDNode.
llvm-svn: 107237
2010-06-30 01:40:11 +00:00
Devang Patel 648df7bf64 Add variables into a scope before constructing scope DIE otherwise variables won't be included DIE tree.
llvm-svn: 107228
2010-06-30 00:11:08 +00:00
Bill Wendling 3632171750 Revert r107205 and r107207.
llvm-svn: 107215
2010-06-29 22:34:52 +00:00
Devang Patel be30551600 Print InlinedAt location.
llvm-svn: 107214
2010-06-29 22:29:15 +00:00
Bill Wendling 1767723dbe Introducing the "linker_weak" linkage type. This will be used for Objective-C
metadata types which should be marked as "weak", but which the linker will
remove upon final linkage. For example, the "objc_msgSend_fixup_alloc" symbol is
defined like this:

       .globl l_objc_msgSend_fixup_alloc
       .weak_definition l_objc_msgSend_fixup_alloc
       .section __DATA, __objc_msgrefs, coalesced
       .align 3
l_objc_msgSend_fixup_alloc:
        .quad   _objc_msgSend_fixup
        .quad   L_OBJC_METH_VAR_NAME_1

This is different from the "linker_private" linkage type, because it can't have
the metadata defined with ".weak_definition".

llvm-svn: 107205
2010-06-29 21:24:00 +00:00
Devang Patel 24bc1b5b2f Do not hardcode DW_AT_stmt_list value.
Inspired by Artur Pietrek.

llvm-svn: 107202
2010-06-29 20:17:53 +00:00
Devang Patel 1de21ec498 Use DW_FORM_addr for DW_AT_entry_pc.
llvm-svn: 107085
2010-06-28 22:22:47 +00:00
Devang Patel d10b2af260 Include inlined function in list of processed subprograms.
llvm-svn: 107065
2010-06-28 20:53:04 +00:00
Devang Patel f3b2db68c6 Preserve deleted function's local variables' debug info.
Radar 8122864.

llvm-svn: 107027
2010-06-28 18:25:03 +00:00
Devang Patel fb6f22f010 Remove dead code.
llvm-svn: 106990
2010-06-28 05:59:13 +00:00
Devang Patel 5c0f85c7dd Collect debug info for optimized variables of inlined functions.
llvm-svn: 106895
2010-06-25 22:07:34 +00:00
Devang Patel c657c621b7 DBG_VALUE machine instruction pointing to undefined register for a variable justify a separate scope if the variable is inlined function's argument.
Radar 8122864.

llvm-svn: 106792
2010-06-24 21:51:19 +00:00
Devang Patel b6e058da18 Use single interface, using twine, to get named metadata.
getNamedMetadata().

llvm-svn: 106518
2010-06-22 01:19:38 +00:00
Devang Patel cbc6fd8493 Discard special LLVM prefix from linkage name.
llvm-svn: 106516
2010-06-22 01:06:05 +00:00
Devang Patel ad51735794 Do not rely on Twine temporaries to survive.
llvm-svn: 106515
2010-06-22 01:01:58 +00:00
Dan Gohman 6e681a5fbe Give NamedRegionTimer an Enabled flag, allowing all its clients to
switch from this:

  if (TimePassesIsEnabled) {
    NamedRegionTimer T(Name, GroupName);
    do_something();
  } else {
    do_something(); // duplicate the code, this time without a timer!
  }

to this:

  {
    NamedRegionTimer T(Name, GroupName, TimePassesIsEnabled);
    do_something();
  }

llvm-svn: 106285
2010-06-18 15:56:31 +00:00
Devang Patel a6d20f446f Use separate named MDNode to hold each function's local variable info.
This speeds up local variable handling in DwarfDebug.

llvm-svn: 106075
2010-06-16 00:53:55 +00:00
Eric Christopher b672ab9b53 Don't emit the linkage for initializer label for mach-o tls.
llvm-svn: 106073
2010-06-16 00:27:30 +00:00
Stuart Hastings 9b5005cd4b Added a comment.
llvm-svn: 106063
2010-06-15 23:06:30 +00:00
Stuart Hastings afe54f1625 Support for nested functions/classes in debug output. (Again.) Radar 7424645.
llvm-svn: 105828
2010-06-11 20:08:44 +00:00
Stuart Hastings 3ca391027f Revert 105492 & 105493 due to a testcase regression. Radar 7424645.
llvm-svn: 105511
2010-06-05 00:39:29 +00:00
Stuart Hastings 7c015988fe Support for nested functions/classes in debug output. Radar 7424645.
llvm-svn: 105492
2010-06-04 22:36:03 +00:00
Eric Christopher f67fe3b1e8 One underscore, not two.
llvm-svn: 105379
2010-06-03 04:02:59 +00:00
Devang Patel c2254f6b98 Skip identical instruction while calculating DBG_VALUE range.
llvm-svn: 105340
2010-06-02 19:05:13 +00:00
Devang Patel 21ccf05b4c Use local small vector.
llvm-svn: 105332
2010-06-02 16:42:51 +00:00
Devang Patel d43e0ca916 Ignore line number of debug value in undefined register.
llvm-svn: 105292
2010-06-01 21:43:09 +00:00
Stuart Hastings c1e216583f Revert 104841, 104842, 104876 due to buildbot failures. Radar 7424645.
llvm-svn: 104953
2010-05-28 16:41:07 +00:00
Devang Patel 7a9dedf0ab Do not drop location info for inlined function args.
llvm-svn: 104884
2010-05-27 20:25:04 +00:00
Devang Patel 5e6b71ce34 inlined function's arguments need a label to mark the start point because they are not directly attached to current function.
llvm-svn: 104848
2010-05-27 16:47:30 +00:00
Stuart Hastings 8e99e50d08 Support for nested functions/classes in debug output. Radar 7424645.
llvm-svn: 104841
2010-05-27 16:16:54 +00:00
Devang Patel 6b9a9fe207 Simplify. Eliminate unneeded debug_loc entry.
llvm-svn: 104785
2010-05-26 23:55:23 +00:00
Devang Patel acc32a5c19 There is no need to force an line number entry (using previous location) for a temp label at unknown location.
llvm-svn: 104740
2010-05-26 21:23:46 +00:00
Devang Patel 002d54ddc9 Identify instructions, that needs a label to mark debug info entity, in advance. This simplifies beginScope().
llvm-svn: 104720
2010-05-26 19:37:24 +00:00
Devang Patel 95fcc96752 Remove dead code.
llvm-svn: 104706
2010-05-26 17:42:50 +00:00
Devang Patel 5a5e0bc3b5 Do not construct location list backword!
llvm-svn: 104705
2010-05-26 17:29:32 +00:00
Devang Patel 9fc11706e3 First cut at supporting .debug_loc section.
This is used to track variable information.

llvm-svn: 104649
2010-05-25 23:40:22 +00:00
Eric Christopher f3925438e5 Move the verbose asm output up a bit so it can be used in the special cases
as well.

llvm-svn: 104642
2010-05-25 21:49:43 +00:00
Eric Christopher 19a4b843cc Add support for initialized global data for darwin tls. Update comments
and testcases accordingly.

llvm-svn: 104635
2010-05-25 21:28:50 +00:00
Devang Patel 51b37e0bd8 Do not emit line number entries for unknown debug values.
This fixes recent regression in store.exp from gdb testsuite.

llvm-svn: 104524
2010-05-24 18:26:49 +00:00
Nicolas Geoffray c5327226e4 Encode the Caml frametable by following what the comment says: the number of descriptors
is first emitted, and StackOffsets are emitted in 16 bits.

llvm-svn: 104488
2010-05-24 12:24:11 +00:00
Eric Christopher 6fdea1bda8 Add full bss data support for darwin tls variables.
llvm-svn: 104414
2010-05-22 00:10:22 +00:00
Devang Patel 4a8e6e83dc Collect variable information during endFunction() instead of beginFunction().
llvm-svn: 104412
2010-05-22 00:04:14 +00:00
Devang Patel 1782aae355 Simplify
llvm-svn: 104338
2010-05-21 18:49:09 +00:00
Devang Patel fbd6c45e06 Simplify.
llvm-svn: 104302
2010-05-21 00:10:20 +00:00
Devang Patel 490c8ab76d Refactor.
llvm-svn: 104265
2010-05-20 19:57:06 +00:00
Devang Patel e1c53f29d3 Split DbgVariable. Eventually, variable info will be communicated through frame index, or DBG_VALUE instruction, or collection of DBG_VALUE instructions. Plus each DbgVariable may not need a label.
llvm-svn: 104233
2010-05-20 16:36:41 +00:00
Eric Christopher 27e7ffc7d4 Partial code for emitting thread local bss data.
llvm-svn: 104197
2010-05-20 00:49:07 +00:00
Devang Patel a08130864e Revert r104165.
llvm-svn: 104172
2010-05-19 21:58:28 +00:00
Devang Patel 0fe341e2e2 There is no need to maintain InsnsBeginScopeSet separately.
llvm-svn: 104165
2010-05-19 21:26:53 +00:00
Devang Patel 36debf8046 Do not forget to mark prcessed arguments.
llvm-svn: 103822
2010-05-14 21:55:50 +00:00
Bill Wendling 95f6ebcb37 Rename "HasCalls" in MachineFrameInfo to "AdjustsStack" to better describe what
the variable actually tracks.

N.B., several back-ends are using "HasCalls" as being synonymous for something
that adjusts the stack. This isn't 100% correct and should be looked into.

llvm-svn: 103802
2010-05-14 21:14:32 +00:00
Devang Patel e0a94bfe9f Add support to preserve type info for the variables that are removed by the optimizer.
llvm-svn: 103798
2010-05-14 21:01:35 +00:00
Daniel Dunbar 3439ed6324 Inline Asm: Ensure buffer is newline terminated to match how the text is printed.
- This is a hack, but I can't decide the best place to handle this. Chris?

llvm-svn: 103765
2010-05-14 04:31:50 +00:00
Duncan Sands 2576db727b Remove unused variable. Tweak a comment while there.
llvm-svn: 103586
2010-05-12 07:11:33 +00:00
Nathan Jeffords 76a07580ad updated support for the COFF .linkonce
Now, the .linkonce directive is emitted as part of MCSectionCOFF::PrintSwitchToSection instead of AsmPrinter::EmitLinkage since it is an attribute of the section the symbol was placed into not the symbol itself.

llvm-svn: 103568
2010-05-12 04:26:09 +00:00
Devang Patel 1a0df9a80e Enable multiple Compile Units in one module.
This means now 'llvm-ld a.bc b.bc' will preserve debug info appropriately.

llvm-svn: 103439
2010-05-10 22:49:55 +00:00
Devang Patel 0625af2a88 Instead of just verifying compile unit, verify entire type, variable, namespace etc..
llvm-svn: 103327
2010-05-07 23:33:41 +00:00
Devang Patel cbe7a8508a Remove DIGlobal.
llvm-svn: 103325
2010-05-07 23:19:07 +00:00
Devang Patel 8d6a2b7428 Verify entire type descriptor not just tag.
llvm-svn: 103303
2010-05-07 21:45:47 +00:00
Devang Patel 32cc43c242 Wrap const MDNode * inside DIDescriptor.
llvm-svn: 103295
2010-05-07 20:54:48 +00:00
Devang Patel cfa8e9d45f Avoid DIDescriptor::getNode(). Use overloaded operators instead.
llvm-svn: 103272
2010-05-07 18:11:54 +00:00
Dan Gohman 7421ae48bf Disable the new unknown-location code for now. It causes a major
increase in the debug line info section, and it's causing
regressions in a gdb testsuite.

llvm-svn: 103226
2010-05-07 01:08:53 +00:00
Dan Gohman 47d04e3e41 Update LabelsBeforeInsn also, when creating unknown-position labels.
llvm-svn: 103145
2010-05-06 00:29:41 +00:00
Chris Lattner 35096e82c5 Fix PR7054 - Assertion `Symbol->isUndefined() && "Cannot define a symbol twice!"' failed.
Users can write broken code that emits the same label twice with asm renaming,
detect this and emit a fatal backend error instead of aborting.

llvm-svn: 103140
2010-05-06 00:05:37 +00:00
Dan Gohman 50849c63e4 Emit debug info for MachineInstrs with unknown debug locations, instead
of just letting them inherit the debug locations of adjacent instructions.

Debug info should aim to be either accurate or absent.

llvm-svn: 103135
2010-05-05 23:41:32 +00:00
Devang Patel 075e9b5d66 Set DW_AT_APPLE_omit_frame_ptr in endFunction() where MachineFunction is available all the time.
llvm-svn: 103001
2010-05-04 06:15:30 +00:00
Dale Johannesen 1ebb395cee Don't count debug info as instructions. This was
preventing the emission of the NOP on Darwin for a
function with no actual code.  From timberwolfmc
with TEST=optllcdbg.

llvm-svn: 102843
2010-05-01 16:41:11 +00:00
Devang Patel b4e3b9025c Attach AT_APPLE_optimized attribute to optimized function's debug info.
llvm-svn: 102743
2010-04-30 19:38:23 +00:00
Devang Patel 080e4fb2f0 Print variable scope name in DEBUG_VALUE comment. Useful in some cases. e.g.
##DEBUG_VALUE: runOnMachineFunction:this <- RDI+0
	##DEBUG_VALUE: runOnMachineFunction:fn <- RSI+0
	##DEBUG_VALUE: DeadDefs <- undef ## SimpleRegisterCoalescing.cpp:2706
	##DEBUG_VALUE: getRegInfo:this <- [%rsp+$56]+$0
	##DEBUG_VALUE: getTarget:this <- [%rsp+$56]+$0

llvm-svn: 102655
2010-04-29 18:52:10 +00:00
Chris Lattner 08e9e72fa9 Rework global alignment computation again. Now we do round up
alignment of globals to the preferred alignment, but only when
there is no section specified on the global (by far the common
case).

llvm-svn: 102515
2010-04-28 19:58:07 +00:00
Devang Patel 50c9431203 Emit debug info for byval parameters.
llvm-svn: 102486
2010-04-28 01:39:28 +00:00
Chris Lattner a3facc5cb5 further simplify EmitAlignment by eliminating the
ForcedAlignBits argument, tweaking the single client of it.

llvm-svn: 102484
2010-04-28 01:08:40 +00:00
Chris Lattner 72bdee4c10 remove a dead argument to EmitAlignment.
llvm-svn: 102483
2010-04-28 01:06:02 +00:00
Chris Lattner 9e06e53fc6 remove some default arguments to EmitAlignment.
llvm-svn: 102482
2010-04-28 01:05:45 +00:00
Devang Patel 173b2b9d05 Refactor.
llvm-svn: 102481
2010-04-28 01:03:09 +00:00
Devang Patel cfc76fdaf1 Use isReg(), isImm() and isFPImm().
llvm-svn: 102470
2010-04-27 22:04:41 +00:00
Devang Patel 1f34c2727d Check operand type first.
llvm-svn: 102468
2010-04-27 21:49:04 +00:00
Devang Patel 1a0bbe25e3 Ignore DBG_VALUE instructions that points to undef values.
llvm-svn: 102463
2010-04-27 20:54:45 +00:00
Devang Patel 6c74a872a8 Identify when a lexical scope is split in to multiple instruction ranges. Emit such ranges using DW_AT_ranges.
This patch fixes bug (PR6894) introduced by previous version of this patch.

llvm-svn: 102454
2010-04-27 19:46:33 +00:00
Evan Cheng eb828b6391 Do not count kill, implicit_def instructions as printed instructions.
llvm-svn: 102453
2010-04-27 19:38:45 +00:00
Chris Lattner 64d43d80be round zero-byte .zerofill directives up to 1 byte. This
should fix some "g++.dg-struct-layout-1" failures, 
rdar://7886017

llvm-svn: 102421
2010-04-27 07:41:44 +00:00
Chris Lattner 3af635a296 add a comment in verbose-asm mode indicating why a noop is being generated.
llvm-svn: 102401
2010-04-26 23:41:43 +00:00