1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

1100 Commits

Author SHA1 Message Date
Chris Lattner
344a742ed1 report errors through LLVMContext's inline asm handler if available.
llvm-svn: 100509
2010-04-06 00:55:39 +00:00
Devang Patel
5e0cb53223 Remove unnecessary include.
llvm-svn: 100505
2010-04-06 00:38:32 +00:00
Chris Lattner
f753452587 Give AsmParser an option to control whether it finalizes
the stream.  New demo:

$ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o
$ otool -tv t.o
t.o:
(__TEXT,__text) section
_foo:
0000000000000000	subq	$0x08,%rsp
0000000000000004	movl	%edi,(%rsp)
0000000000000007	movl	%edi,%eax
0000000000000009	incl	%eax
000000000000000b	movl	%eax,(%rsp)
000000000000000e	movl	%eax,0x04(%rsp)
0000000000000012	addq	$0x08,%rsp
0000000000000016	ret

llvm-svn: 100492
2010-04-05 23:15:42 +00:00
Chris Lattner
5b4c7591ac add .o file writing for inline asm in llc. Here's a silly
demo:

$ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o
<inline asm>:1:2: error: unrecognized instruction
	abc incl    %eax
	^
LLVM ERROR: Error parsing inline asm

Only problem seems to be that the parser finalizes OutStreamer 
at the end of the first inline asm, which isn't what we want.
For example:

$ cat asm.c
int foo(int X) {
 __asm__ ("incl    %0" : "+r" (X));
 return X;
}
$ clang asm.c -S -o - -emit-llvm | llc
...
	subq	$8, %rsp
	movl	%edi, (%rsp)
	movl	%edi, %eax
	## InlineAsm Start
	incl    %eax
	## InlineAsm End
	movl	%eax, (%rsp)
	movl	%eax, 4(%rsp)
	addq	$8, %rsp
	ret
$ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o
$ otool -tv t.o
t.o:
(__TEXT,__text) section
_foo:
0000000000000000	subq	$0x08,%rsp
0000000000000004	movl	%edi,(%rsp)
0000000000000007	movl	%edi,%eax
0000000000000009	incl	%eax
$ 

don't stop at inc!

llvm-svn: 100491
2010-04-05 23:11:24 +00:00
Bill Wendling
bf50ddf6ac Output floating point representations in DWARF format. This is done by outputing
the FP encoding directly as a hex representation.

llvm-svn: 100487
2010-04-05 22:59:21 +00:00
Chris Lattner
269737461d stringref-ize the MemoryBuffer::get apis. This requires
a co-committed clang patch.

llvm-svn: 100485
2010-04-05 22:42:30 +00:00
Chris Lattner
91309715b4 hopefully sate the clang self host build, which is apparently
instantiating some folding set stuff that GCC isn't, requiring 
some types to not be incomplete.

I don't know if clang is right or wrong, but unbreaking the
bot is goodness.  Here's the broken build:
http://google1.osuosl.org:8011/builders/clang-x86_64-darwin10-selfhost/builds/1813/steps/compile.llvm.stage2/logs/stdio

llvm-svn: 100418
2010-04-05 06:12:01 +00:00
Chris Lattner
341747c032 privatize more stuff, eliminate vtables.
llvm-svn: 100410
2010-04-05 05:32:45 +00:00
Chris Lattner
5d96bd2bbe reprivatize now that DwarfWriter is gone.
llvm-svn: 100409
2010-04-05 05:31:04 +00:00
Chris Lattner
59156acba1 prune #includes, MMI can never be null
llvm-svn: 100408
2010-04-05 05:28:23 +00:00
Chris Lattner
f2fb401571 prune #includes, realize the MMI can never be null.
llvm-svn: 100407
2010-04-05 05:24:55 +00:00
Chris Lattner
37d4f1e56e finally blast DwarfWriter away.
llvm-svn: 100406
2010-04-05 05:12:59 +00:00
Chris Lattner
df6b0827aa change AsmPrinter to use DwarfDebug/DwarfException directly
instead of going through DwarfWriter.

llvm-svn: 100405
2010-04-05 05:11:15 +00:00
Chris Lattner
248e65ec05 trim some spurious references to DwarfWriter. SDIsel really doesn't
need it anymore, so don't addRequire it.

llvm-svn: 100400
2010-04-05 04:09:20 +00:00
Chris Lattner
16ed3bfb2b eliminate DwarfDebug::shouldEmit, which is the same now as MMI::hasDebugInfo
llvm-svn: 100386
2010-04-05 03:52:55 +00:00
Chris Lattner
697c2edddc fix a regression on 2009-08-17-DebugInfo.m
llvm-svn: 100385
2010-04-05 03:49:26 +00:00
Chris Lattner
1fda8b3a8b fastisel doesn't need DwarfWriter, remove some tendricles.
llvm-svn: 100381
2010-04-05 02:19:28 +00:00
Chris Lattner
6040137045 just have all targets create the DwarfWriter.
llvm-svn: 100377
2010-04-05 00:42:55 +00:00
Chris Lattner
fd80e7cca8 nuke DwarfPrinter
llvm-svn: 100375
2010-04-05 00:27:29 +00:00
Chris Lattner
122288eb97 make DwarfException not inherit from DwarfPrinter.
llvm-svn: 100374
2010-04-05 00:26:50 +00:00
Chris Lattner
c1b63a2dfa change SizeOf to take AsmPrinter instead of TargetData,
simplifying a bunch of code.

llvm-svn: 100373
2010-04-05 00:18:22 +00:00
Chris Lattner
2b89b0d279 1) make DIE take AsmPrinter instead of DwarfPrinter.
2) change DwarfDebug to not inherit from DwarfPrinter.

llvm-svn: 100372
2010-04-05 00:13:49 +00:00
Chris Lattner
0744c47856 Move EmitFrameMoves into AsmPrinter.
llvm-svn: 100371
2010-04-04 23:41:46 +00:00
Chris Lattner
303e9e2e0a simplify code and reduce indentation.
llvm-svn: 100369
2010-04-04 23:31:58 +00:00
Chris Lattner
2eaed62f7c now that the magic is dispelled, move EmitSectionOffset to AsmPrinter.
llvm-svn: 100368
2010-04-04 23:25:33 +00:00
Chris Lattner
ecdad4bb0c eliminate the magic AbsoluteDebugSectionOffsets MAI hook,
which is really a property of the section being referenced.
Add a predicate to MCSection to replace it.

Yay for reduction in magic.

llvm-svn: 100367
2010-04-04 23:22:29 +00:00
Chris Lattner
957eddbcb0 only emit section labels if we have debug info, fixing a few
regtest failures.

llvm-svn: 100366
2010-04-04 23:17:54 +00:00
Chris Lattner
7295a273aa I was wrong, ocaml isn't referencing 'Ldata_begin', so remove it.
llvm-svn: 100365
2010-04-04 23:10:38 +00:00
Chris Lattner
4bd354ecd8 add some assertions to EmitSectionOffset.
llvm-svn: 100364
2010-04-04 23:06:31 +00:00
Chris Lattner
a991a67a29 stop emitting some dead L labels.
llvm-svn: 100363
2010-04-04 23:02:02 +00:00
Chris Lattner
265b59119d Store an use the symbols emitted at the start of the debug
sections instead of magically rematerializing them later.

llvm-svn: 100362
2010-04-04 22:59:04 +00:00
Chris Lattner
53453a2dc8 remove the didInitial ivar, rename emitInitial to be more
descriptive, change EmitSectionOffset back to taking a
symbol instead of a string.

llvm-svn: 100361
2010-04-04 22:33:59 +00:00
Chris Lattner
df18fb3a6d simplify EmitSectionOffset a little bit, improve comments.
llvm-svn: 100360
2010-04-04 22:25:14 +00:00
Chris Lattner
168d49e6cd The "IsSmall" argument to EmitSectionOffset is always true,
constant fold it away.

llvm-svn: 100356
2010-04-04 21:34:40 +00:00
Chris Lattner
da4fe3e7d2 eliminate the "isEH" argument to EmitSectionOffset.
llvm-svn: 100355
2010-04-04 21:31:54 +00:00
Chris Lattner
2f1c065cef isAbsoluteEHSectionOffsets always returns false, eliminate it
and substitute false at the one call site.

llvm-svn: 100354
2010-04-04 21:29:44 +00:00
Chris Lattner
c83be77854 move some more stuff to asmprinter.
llvm-svn: 100351
2010-04-04 20:20:50 +00:00
Chris Lattner
7214d4d564 simplify some code.
llvm-svn: 100350
2010-04-04 20:10:41 +00:00
Chris Lattner
703ccb1b4c move EmitEncodingByte to AsmPrinter.
llvm-svn: 100349
2010-04-04 20:04:21 +00:00
Chris Lattner
071eb40cd2 move EmitCFAByte to AsmPrinter.
llvm-svn: 100348
2010-04-04 20:01:25 +00:00
Chris Lattner
24ed58efd1 inline EmitDifference away.
llvm-svn: 100347
2010-04-04 19:58:12 +00:00
Chris Lattner
779e051357 resolve a fixme.
llvm-svn: 100346
2010-04-04 19:28:59 +00:00
Chris Lattner
c2b0a02be0 move gettemplabel and getdwlabel to AsmPrinter and rename
them for consistency.

llvm-svn: 100345
2010-04-04 19:25:43 +00:00
Chris Lattner
342b44f89f move uleb/sleb printing into AsmPrinter from DwarfPrinter.
llvm-svn: 100344
2010-04-04 19:09:29 +00:00
Chris Lattner
3bdfd5a34d more interface cleanup make some helpers static functions.
llvm-svn: 100343
2010-04-04 18:58:53 +00:00
Chris Lattner
328ffc8c32 clean up the asmprinter header and privatize some stuff.
llvm-svn: 100342
2010-04-04 18:52:31 +00:00
Chris Lattner
dd1f2b6e33 use stringref instead of strtol to avoid errno gymnastics.
llvm-svn: 100341
2010-04-04 18:42:18 +00:00
Chris Lattner
d7a37abb77 split inline asm support out to its own .cpp file.
llvm-svn: 100340
2010-04-04 18:34:07 +00:00
Chris Lattner
e55c5e9d81 inline processDebugLoc and simplify it.
llvm-svn: 100339
2010-04-04 18:18:51 +00:00
Chris Lattner
a5c6be681c minor tidying.
llvm-svn: 100338
2010-04-04 18:16:38 +00:00
Chris Lattner
0d3490e0b0 clean up the asmprinter interface a bit, rename a few
"Print" methods to "Emit".  Emit is something that goes
to an mc streamer, Print is something that goes to a
raw_ostream (for inline asm) 

llvm-svn: 100337
2010-04-04 18:14:01 +00:00
Chris Lattner
cb654f3113 remove TargetMachine.h #include, also, TRI isn't used frequently
enough to warrant caching in AsmPrinter, so remove it.

llvm-svn: 100336
2010-04-04 18:06:11 +00:00
Chris Lattner
71a1b87241 lazily allocate the GCMetadataPrinters map and remove DenseMap
from the AsmPrinter interface.

llvm-svn: 100331
2010-04-04 17:57:56 +00:00
Chris Lattner
3eaaa7bb6c Momentous day: remove the "O" member from AsmPrinter. Now all
"asm printering" happens through MCStreamer.  This also 
Streamerizes PIC16 debug info, which escaped my attention.

This removes a leak from LLVMTargetMachine of the 'legacy'
output stream.

llvm-svn: 100327
2010-04-04 08:18:47 +00:00
Chris Lattner
b0eb3e8e49 now that all operand printing happens to specified streams, we can
print function level inline asm with EmitInlineAsm instead of writing
it directly to "O".

llvm-svn: 100326
2010-04-04 07:50:12 +00:00
Chris Lattner
1917725796 remove the raw_ostream from various dwarf printing things.
The only thing left is LEB printing, which uses EmitRawText
for now.

llvm-svn: 100325
2010-04-04 07:48:20 +00:00
Chris Lattner
6142bb4162 mcize the gc metadata printing stuff.
llvm-svn: 100324
2010-04-04 07:39:04 +00:00
Chris Lattner
da368251bf use EmitRawText instead of O in DwarfPrinter.
llvm-svn: 100323
2010-04-04 07:25:52 +00:00
Chris Lattner
00699c02d5 fix PrintAsmOperand and PrintAsmMemoryOperand to pass down
raw_ostream to print to.

llvm-svn: 100313
2010-04-04 05:29:35 +00:00
Chris Lattner
f56580493f change this back too
llvm-svn: 100310
2010-04-04 05:09:10 +00:00
Chris Lattner
d37e89c481 check in what I tested. :(
llvm-svn: 100309
2010-04-04 05:08:10 +00:00
Chris Lattner
d3805cbfe6 MMI is always available, rename O -> OS in printInlineAsm.
llvm-svn: 100308
2010-04-04 05:07:45 +00:00
Chris Lattner
cdbca3e8fe change a ton of code to not implicitly use the "O" raw_ostream
member of AsmPrinter.  Instead, pass it in explicitly.

llvm-svn: 100306
2010-04-04 04:47:45 +00:00
Chris Lattner
fde2b21277 asmstreamerize the .size directive for function bodies, force clients
of printOffset to pass in a stream to print to.

llvm-svn: 100296
2010-04-03 22:28:33 +00:00
Chris Lattner
e952450d5a emit the cygwin stub thing through mcstreamer.
llvm-svn: 100295
2010-04-03 22:19:41 +00:00
Chris Lattner
b6769a8513 add a twine form of MCStreamer::EmitRawText, and mc'ize
a few more things in AsmPrinter.cpp.

llvm-svn: 100294
2010-04-03 22:12:35 +00:00
Chris Lattner
940911edf1 start moving towards emitting inline asm statements with
EmitInlineAsm.  However, this attempt is foiled by operands
being emitted directly to "O" so I'll have to do some surgery
and finish MCizing the world.

llvm-svn: 100291
2010-04-03 22:01:50 +00:00
Chris Lattner
4e8e791414 add a new EmitInlineAsm function to asmprinter to handle inline asm.
If we have an MCAsmStreamer, we continue to emit asm textually, 
otherwise we (currently) emit an error to errs and ignore it.

llvm-svn: 100289
2010-04-03 21:35:55 +00:00
Chris Lattner
512e2aa3d2 mc'ize comment printing around file scope inline asm.
llvm-svn: 100288
2010-04-03 21:13:18 +00:00
Chris Lattner
305c84b8ee Switch the code generator (except the JIT) onto the new DebugLoc
representation.  This eliminates the 'DILocation' MDNodes for 
file/line/col tuples from -O0 -g codegen.

This remove the old DebugLoc class, making it a typedef for DebugLoc,
I'll rename NewDebugLoc next.

I didn't update the JIT to use the new apis, so it will continue to
work, but be as slow as before.  Someone should eventually do this
or, better yet, rip out the JIT debug info stuff and build the JIT
on top of MC.

llvm-svn: 100209
2010-04-02 19:42:39 +00:00
Devang Patel
1d51b57a85 Revert r100117.
llvm-svn: 100145
2010-04-01 22:47:29 +00:00
Devang Patel
97a60f2ce5 Do not eagerly record known previous location. DBG_VALUE may not cause a new label due to one or other reason.
llvm-svn: 100134
2010-04-01 20:22:44 +00:00
Devang Patel
52c509b85d Skip instructions until new scope is seen.
llvm-svn: 100117
2010-04-01 17:32:01 +00:00
Devang Patel
e55fdcf347 Cosmetic changes.
Update comment, rename a local variable.

llvm-svn: 100116
2010-04-01 17:16:48 +00:00
Stuart Hastings
7c358afa1d Reverting 100048; it broke two Frontend debug info tests.
llvm-svn: 100058
2010-03-31 23:08:46 +00:00
Stuart Hastings
3a9c4bcef8 Debug info can now properly represent functions inside classes inside other functions. Partial fix for Radar 7424645.
llvm-svn: 100048
2010-03-31 21:10:54 +00:00
Benjamin Kramer
b67e098ab6 Reduce string trashing.
llvm-svn: 100038
2010-03-31 20:15:45 +00:00
Benjamin Kramer
a71501e0dd DwarfDebug: Allocate DIEValues with a BumpPtrAllocator. Most of them are
POD-like anyway, so we don't even care about calling their d'tors (DIEBlock
being the exception).

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

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

llvm-svn: 99982
2010-03-31 03:34:40 +00:00
Devang Patel
2a2b092bf0 Ignore invalid metadata.
llvm-svn: 99938
2010-03-30 22:09:52 +00:00
Chris Lattner
8e4cf6f425 Rip out the 'is temporary' nonsense from the MCContext interface to
create symbols.  It is extremely error prone and a source of a lot
of the remaining integrated assembler bugs on x86-64.

This fixes rdar://7807601.

llvm-svn: 99902
2010-03-30 18:10:53 +00:00
Devang Patel
a103a31a3c There is no need to fall through after processing DBG_VALUE machine instruction.
llvm-svn: 99899
2010-03-30 18:07:00 +00:00
Devang Patel
953a86e2bb Encode start location of debug value, communicated through DBG_VALUE machine instruction, in a variable's DIE.
llvm-svn: 99845
2010-03-29 22:59:58 +00:00
Chris Lattner
369d564845 use RAII for ExceptionTimer too
llvm-svn: 99833
2010-03-29 20:39:38 +00:00
Chris Lattner
b01fcba466 fix a variety of issues were we'd start DebugTimer but
not stop it by using RAII.

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

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

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

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

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

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

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

Rejoice.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

llvm-svn: 98415
2010-03-13 02:17:42 +00:00
Chris Lattner
14ab9784f4 remove gone method, grr symlinks.
llvm-svn: 98392
2010-03-12 21:30:49 +00:00
Chris Lattner
7a2e6110bc 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
c101ad818c give Mangler access to TargetData.
llvm-svn: 98378
2010-03-12 20:47:28 +00:00
Chris Lattner
01e70df9b2 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
04cd48f865 remove dead code.
llvm-svn: 98365
2010-03-12 18:49:32 +00:00
Chris Lattner
956582f876 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
4cc9a9004f 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
824bd1b30d 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
93aa350213 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
5aefaeb42e 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
1ce9dfd498 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
239beb0e85 Avoid leaking CompileUnits in DwarfDebug.cpp.
llvm-svn: 98268
2010-03-11 18:29:55 +00:00
Richard Osborne
9c71a0a5ba 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
e34dde1e83 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
270a61db96 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
60b9c3a333 add missing filename!
llvm-svn: 98125
2010-03-10 02:29:31 +00:00
Chris Lattner
ed0b8d36e4 set the temporary bit on MCSymbols correctly.
llvm-svn: 98124
2010-03-10 02:25:11 +00:00
Chris Lattner
e284f80948 inline away a form of IsPCRelative, eliminating the
dead IsPCRel argument.

llvm-svn: 98117
2010-03-10 01:17:49 +00:00
Chris Lattner
cff79125fb 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
915a362856 mcize uses of PrintRelDirective and eliminate it.
llvm-svn: 98107
2010-03-10 00:09:21 +00:00
Chris Lattner
84561d5f46 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
d5d96f76d0 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
58829fcfe9 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
2ede66313d 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
d51f1bdc58 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
43b812b6a8 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
8875eba06a 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
c4a74bf48b 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
f7ad2622cc 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
a72a32a06b 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
d4ce7a73e8 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
4494a28b3c mcstreamerize AsmPrinter::printLabel.
llvm-svn: 98025
2010-03-09 01:02:30 +00:00
Chris Lattner
8147c144d9 add a EmitSymbolValue convenience method to MCStreamer.
llvm-svn: 98017
2010-03-09 00:39:24 +00:00
Chris Lattner
db93b91db1 make InlineInfoLabels hold MCSymbol*'s, avoiding
recomputation of the labels.

llvm-svn: 98016
2010-03-09 00:31:02 +00:00
Chris Lattner
a583d01e79 mc'ize the last use of PrintLabelName and eliminate PrintLabelName.
llvm-svn: 98015
2010-03-09 00:26:09 +00:00
Chris Lattner
644850459d 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
06f5a077de 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
183e87502e 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
99ca33d324 move .set generation out of DwarfPrinter into AsmPrinter and
MCize it.

llvm-svn: 98010
2010-03-08 23:58:37 +00:00
Chris Lattner
10d571f349 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
9dfcbeaca1 Remove a version of EmitDifference.
llvm-svn: 98002
2010-03-08 23:02:59 +00:00
Chris Lattner
81bf3f933d eliminate a form of PrintLabelName.
llvm-svn: 97999
2010-03-08 22:52:49 +00:00
Chris Lattner
bbd8af41d3 remove another form of EmitReference.
llvm-svn: 97998
2010-03-08 22:50:36 +00:00
Chris Lattner
4ccfa3d315 eliminate the non-MCSymbol versions of EmitReference.
llvm-svn: 97997
2010-03-08 22:47:57 +00:00
Chris Lattner
2bbaab13d8 mc'ize EmitLabel.
llvm-svn: 97996
2010-03-08 22:44:40 +00:00
Chris Lattner
bfd38653e6 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
cbce2df237 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
ea239f6e0a 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
176dc29a62 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
a716e313d6 Revert r97947.
llvm-svn: 97963
2010-03-08 19:20:38 +00:00
Devang Patel
1527b2657b 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
c52fc8f922 Revert r97917, which was causing Clang Debug self-host failures.
llvm-svn: 97932
2010-03-08 02:58:37 +00:00
Jeffrey Yasskin
2c23c1d1a1 Roll r97906 forward again, without double-deleting CompileUnit::IndexTyDie.
llvm-svn: 97917
2010-03-07 17:10:13 +00:00
Jeffrey Yasskin
c68dc05867 _2_ gcc crashes, ah, ah, ah...
(Rolling back r97906.)

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

llvm-svn: 97572
2010-03-02 17:58:15 +00:00
Devang Patel
8fffee565c 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
7b47904f6e 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
6928ef4c23 Comment typo.
llvm-svn: 97269
2010-02-26 21:31:01 +00:00
Bill Wendling
720095c22c Fix comments.
llvm-svn: 97200
2010-02-26 01:12:52 +00:00
Bill Wendling
173d797171 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
6c6c5e70e3 And should use the correct variable.
llvm-svn: 97193
2010-02-26 00:24:25 +00:00
Bill Wendling
30d82f42c4 Got assertion check backwards.
llvm-svn: 97192
2010-02-26 00:22:42 +00:00
Bill Wendling
788d3707a8 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
dd2bd801a2 Make comment more meaningful.
llvm-svn: 97169
2010-02-25 21:19:47 +00:00
Bill Wendling
1be1ea831e MC'ize padding when padding the ULEB128 value.
llvm-svn: 97087
2010-02-25 00:24:52 +00:00
Bill Wendling
e22e8b7621 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
45a2c36ddc use OutStreamer.EmitCodeAlignment for alignment in the text
segment.

llvm-svn: 96967
2010-02-23 18:46:22 +00:00
Chris Lattner
2ec1f1a54a 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
0f421b8fc5 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
26310a84b1 Use ttype encoding consistently
llvm-svn: 96290
2010-02-15 22:38:25 +00:00
Anton Korobeynikov
559e34c5fc 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
dccd240998 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
6e7cc490d4 Use .empty() instead of .size().
llvm-svn: 95871
2010-02-11 10:37:57 +00:00