Commit Graph

205 Commits

Author SHA1 Message Date
Bill Wendling
bc12c2be18 - Record that the debug info is actually used so that the label folder doesn't
blast it away.
- Move InlineInfo bookkeeping to bookkeep the correct debug info object.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71519 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 00:06:59 +00:00
Bill Wendling
a5c8a4e4e6 This is a large rewrite of how Dwarf info for inlined functions is handled.
The DwarfWriter expects DbgScopes and DIEs to behave themselves according to
DwarfWriter's rules. However, inlined functions violate these rules. There are
two different types of DIEs associated with an inlined function: an abstract
instance, which has information about the original source code for the function
being inlined; and concrete instances, which are created for each place the
function was inlined and point back to the abstract instance.

This patch tries to stay true to this schema. It bypasses how regular DbgScopes
and DIEs are created and used when necessary. It provides special handling for
DIEs of abstract and concrete instances.

This doesn't take care of all of the problems with debug info for inlined
functions, but it's a step in the right direction. For one thing, llvm-gcc
generates wrong IR (it's missing some llvm.dbg intrinsics at the point where the
function's inlined) for this example:

#include <stdio.h>
static __inline__ __attribute__((always_inline))  int bar(int x) { return 4; }
void foo() {
  long long b = 1;
  int Y = bar(4);
  printf("%d\n", Y);
}

while clang generates correct IR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71410 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-10 23:14:38 +00:00
Duncan Sands
777d2306b3 Rename PaddedSize to AllocSize, in the hope that this
will make it more obvious what it represents, and stop
it being confused with the StoreSize.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71349 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09 07:06:46 +00:00
Bill Wendling
e688fafd38 Compute the offsets of the compile units. We need this so that when we emit a
concrete instance of an inlined function, we can get the actual address of the
abstract instance inside of the compile unit.

This isn't currently used, but will be by a future check-in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71263 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 21:03:15 +00:00
Bill Wendling
a9519579b7 Minor clean ups. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71256 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 20:38:02 +00:00
Dan Gohman
9a38e3e399 Revert 71165. It did more than just revert 71158 and it introduced
several regressions. The problem due to 71158 is now fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71176 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 19:46:24 +00:00
Bill Wendling
5b8479c385 Temporarily revert r71158. It was causing a failure during a full bootstrap:
checking for bcopy... no
checking for getc_unlocked... Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decUtility.c:360: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[4]: *** [decUtility.o] Error 1
make[4]: *** Waiting for unfinished jobs....
Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decNumber.c:5591: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[4]: *** [decNumber.o] Error 1
make[3]: *** [all-stage2-libdecnumber] Error 2
make[3]: *** Waiting for unfinished jobs....



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71165 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 17:26:14 +00:00
Argyrios Kyrtzidis
cd76240f3d Move the tablegen-produced DebugLoc handling into a AsmWriter::processDebugLoc function.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71156 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 13:55:51 +00:00
Argyrios Kyrtzidis
116b27444a Make DwarfWriter::RecordInlinedFnStart more like the other DwarfWriter's methods:
-Have it return a label ID
-Remove the unused Instruction parameter

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71132 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 00:16:31 +00:00
Bill Wendling
3f500d9358 - Move some debug fields to coincide with how GCC emits them. No functionality
change.
- Reformatting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71118 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 21:21:34 +00:00
Chris Lattner
e3f6cea9e9 Do not require variable debug info nodes to have a compile unit.
For implicit decls like "self" and "_cmd" in ObjC, these decls
should not have a location.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 04:55:56 +00:00
Argyrios Kyrtzidis
28f1412c97 Restore a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70900 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 19:23:45 +00:00
Mike Stump
fe095f39e7 Restore minor deletion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 18:40:41 +00:00
Argyrios Kyrtzidis
77eaa6880b -Move the DwarfWriter::ValidDebugInfo check to a static DIDescriptor::ValidDebugInfo
-Create DebugLocs without the need to have a DwarfWriter around


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70682 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 08:50:41 +00:00
Bill Wendling
d5a6381195 Simplify more code and add timer stuff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70539 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-01 08:40:06 +00:00
Bill Wendling
ff86ef33e2 Simplify more code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70537 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-01 08:35:12 +00:00
Bill Wendling
ef956fc784 Simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70534 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-01 08:32:14 +00:00
Bill Wendling
7fa8162f08 Fix whitespace. It was confusing me.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70533 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-01 08:25:13 +00:00
Argyrios Kyrtzidis
a26eae64dd Make DebugLoc independent of DwarfWriter.
-Replace DebugLocTuple's Source ID with CompileUnit's GlobalVariable*
-Remove DwarfWriter::getOrCreateSourceID
-Make necessary changes for the above (fix callsites, etc.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70520 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30 23:22:31 +00:00
Bill Wendling
98a366d547 Instead of passing in an unsigned value for the optimization level, use an enum,
which better identifies what the optimization is doing. And is more flexible for
future uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70440 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 23:29:43 +00:00
Bill Wendling
be8cc2a3de Second attempt:
Massive check in. This changes the "-fast" flag to "-O#" in llc. If you want to
use the old behavior, the flag is -O0. This change allows for finer-grained
control over which optimizations are run at different -O levels.

Most of this work was pretty mechanical. The majority of the fixes came from
verifying that a "fast" variable wasn't used anymore. The JIT still uses a
"Fast" flag. I'll change the JIT with a follow-up patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70343 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 00:15:41 +00:00
Sanjiv Gupta
d3d965714b Initialized arrays can be in any address space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70297 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 16:34:20 +00:00
Bill Wendling
c69d56f115 r70270 isn't ready yet. Back this out. Sorry for the noise.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70275 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 01:04:53 +00:00
Bill Wendling
2e9d5f912a Massive check in. This changes the "-fast" flag to "-O#" in llc. If you want to
use the old behavior, the flag is -O0. This change allows for finer-grained
control over which optimizations are run at different -O levels.

Most of this work was pretty mechanical. The majority of the fixes came from
verifying that a "fast" variable wasn't used anymore. The JIT still uses a
"Fast" flag. I'm not 100% sure if it's necessary to change it there...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70270 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28 00:21:31 +00:00
Devang Patel
3e3702d00b Fix Visual Studio 2008 build failure.
Patch by Marius Wachtler



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69637 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 00:08:56 +00:00
Devang Patel
7d2f972f59 s/RootDbgScope/FunctionDbgScope/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69216 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 20:41:31 +00:00
Devang Patel
c782ad055e Check isInlinedSubroutine() before creating DW_TAG_inlined_subroutine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69202 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 19:42:57 +00:00
Devang Patel
1be3eccecb Construct and emit DW_TAG_inlined_subroutine DIEs for inlined subroutine scopes (only in FastISel mode).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69116 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 00:10:26 +00:00
Devang Patel
48c7fa21a3 Right now, Debugging information to encode scopes (DW_TAG_lexical_block) relies on DBG_LABEL. Unfortunately this intefers with the quality of optimized code.
This patch updates dwarf writer to encode scoping information in DWARF only in FastISel mode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68973 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 18:13:16 +00:00
Devang Patel
0f7fef3872 Reapply 68847.
Now debug_inlined section is covered by TAI->doesDwarfUsesInlineInfoSection(), which is false by default.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 17:02:03 +00:00
Chris Lattner
266c7bbbbc Add a new "available_externally" linkage type. This is intended
to support C99 inline, GNU extern inline, etc.  Related bugzilla's
include PR3517, PR3100, & PR2933.  Nothing uses this yet, but it
appears to work.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68940 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 05:44:34 +00:00
Dan Gohman
c6fa3ff0bd Revert r68847. It breaks the build on non-Darwin targets, with this message
from the assembler:

Error: unknown pseudo-op: `.debug_inlined'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68863 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-11 15:57:04 +00:00
Devang Patel
2057532679 Keep track of inlined functions and their locations. This information is collected when nested llvm.dbg.func.start intrinsics are seen. (Right now, inliner removes nested llvm.dbg.func.start intrinisics during inlining.)
Create debug_inlined dwarf section using these information. This info is used by gdb, at least on Darwin, to enable better experience debugging inlined functions. See DwarfWriter.cpp for more information on structure of debug_inlined section.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68847 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-11 00:16:47 +00:00
Bill Wendling
7d16e85bfc Pass in the std::string parameter instead of returning it by value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68747 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 00:12:49 +00:00
Bill Wendling
a6f02fbb75 Constify getter methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68745 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 00:00:25 +00:00
Bill Wendling
f34be827ac StringMap<DIE*>::iterator::first() returns a pointer to the first character of
the key. This will cause it to create a new std::string, which isn't
wanted. Instead, pass back the "const char*". Modify the EmitString() method to
take a "const char*".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68741 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 23:51:31 +00:00
Bill Wendling
972bbac789 Use a StringMap instead of std::map for storing std::string->DIE* maps. This
gives a micro speedup in the Dwarf writer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68728 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 21:49:15 +00:00
Devang Patel
75b2738d73 If subprogram type is not tagged as DW_TAG_subroutine_type then use it directly as a return value type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68647 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 22:18:45 +00:00
Chris Lattner
a118c2ee89 change printStringChar to emit characters as unsigned char instead of char,
avoiding sign extension for the top octet.  For "negative" chars, we'd print
stuff like:

.asciz	"\702...
now we print:
.asciz	"\302...



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68577 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 00:28:38 +00:00
Evan Cheng
42bf74be14 CodeGen still defaults to non-verbose asm, but llc now overrides it and default to verbose.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67668 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-25 01:47:28 +00:00
Devang Patel
86bda4174a Do not ignore DW_TAG_class_type!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67661 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-25 00:28:40 +00:00
Evan Cheng
f1c0ae9de5 Do not emit comments unless -asm-verbose.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67580 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 00:17:40 +00:00
Dale Johannesen
1b25cb2416 Fix internal representation of fp80 to be the
same as a normal i80 {low64, high16} rather
than its own {high64, low16}.  A depressing number
of places know about this; I think I got them all.
Bitcode readers and writers convert back to the old
form to avoid breaking compatibility.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67562 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 21:16:53 +00:00
Evan Cheng
697cbbfb00 For inline asm output operand that matches an input. Encode the input operand index in the high bits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67387 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 18:03:34 +00:00
Evan Cheng
1606e8e4cd Fix some significant problems with constant pools that resulted in unnecessary paddings between constant pool entries, larger than necessary alignments (e.g. 8 byte alignment for .literal4 sections), and potentially other issues.
1. ConstantPoolSDNode alignment field is log2 value of the alignment requirement. This is not consistent with other SDNode variants.
2. MachineConstantPool alignment field is also a log2 value.
3. However, some places are creating ConstantPoolSDNode with alignment value rather than log2 values. This creates entries with artificially large alignments, e.g. 256 for SSE vector values.
4. Constant pool entry offsets are computed when they are created. However, asm printer group them by sections. That means the offsets are no longer valid. However, asm printer uses them to determine size of padding between entries.
5. Asm printer uses expensive data structure multimap to track constant pool entries by sections.
6. Asm printer iterate over SmallPtrSet when it's emitting constant pool entries. This is non-deterministic.


Solutions:
1. ConstantPoolSDNode alignment field is changed to keep non-log2 value.
2. MachineConstantPool alignment field is also changed to keep non-log2 value.
3. Functions that create ConstantPool nodes are passing in non-log2 alignments.
4. MachineConstantPoolEntry no longer keeps an offset field. It's replaced with an alignment field. Offsets are not computed when constant pool entries are created. They are computed on the fly in asm printer and JIT.
5. Asm printer uses cheaper data structure to group constant pool entries.
6. Asm printer compute entry offsets after grouping is done.
7. Change JIT code to compute entry offsets on the fly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66875 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 07:51:59 +00:00
Bill Wendling
0582ae99ba Oops...I committed too much.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66867 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 04:39:26 +00:00
Bill Wendling
c7a09ab311 Temporarily XFAIL this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66866 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 04:37:11 +00:00
Bill Wendling
1362f97018 Put the assignment back at the top of this method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66611 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 00:03:50 +00:00
Bill Wendling
dd44632498 Make ivars private. Other cleanup. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66607 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 23:57:09 +00:00
Bill Wendling
68edf5f68a Just make the Dwarf timer group static inside of the getter function. No need to alloc/dealloc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66591 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 22:58:53 +00:00