1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
Commit Graph

52293 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
905edd97e4 Verify that phi instructions refer to MBBs in the CFG.
The machine code verifier no longer tolerates phi instructions with noop
operands. All MBBs on a phi instruction must be in the CFG.

llvm-svn: 82448
2009-09-21 07:19:08 +00:00
Chris Lattner
45b58ae047 enable non-local analysis and PRE of large store -> little load.
This doesn't kick in too much because of phi translation issues,
but this can be resolved in the future.

llvm-svn: 82447
2009-09-21 06:48:08 +00:00
Chris Lattner
8debc9ab3e convert an std::pair to an explicit struct.
llvm-svn: 82446
2009-09-21 06:30:24 +00:00
Chris Lattner
71d74ff16b move some functions, add a comment.
llvm-svn: 82444
2009-09-21 06:24:16 +00:00
Chris Lattner
da0499f01e split HandleLoadFromClobberingStore in two pieces: one that does the
analysis, one that does the xform.

llvm-svn: 82443
2009-09-21 06:22:46 +00:00
Chris Lattner
d24ead5c1e add a note
llvm-svn: 82442
2009-09-21 06:04:07 +00:00
Daniel Dunbar
db16b2c6bb Register the MachineModuleInfo for the ARM JIT, and update JITDwarfEmitter to
assert if the setModuleInfo hasn't been called.

llvm-svn: 82441
2009-09-21 05:58:35 +00:00
Chris Lattner
7e21749266 add pr#
llvm-svn: 82440
2009-09-21 05:57:47 +00:00
Chris Lattner
97e1feed14 Improve GVN to be able to forward substitute a small load
from a piece of a large store when both are in the same block.

This allows clang to compile the testcase in PR4216 to this code:

_test_bitfield:
	movl	4(%esp), %eax
	movl	%eax, %ecx
	andl	$-65536, %ecx
	orl	$32962, %eax
	andl	$40186, %eax
	orl	%ecx, %eax
	ret

This is not ideal, but is a whole lot better than the code produced
by llvm-gcc:

_test_bitfield:
	movw	$-32574, %ax
	orw	4(%esp), %ax
	andw	$-25350, %ax
	movw	%ax, 4(%esp)
	movw	7(%esp), %cx
	shlw	$8, %cx
	movzbl	6(%esp), %edx
	orw	%cx, %dx
	movzwl	%dx, %ecx
	shll	$16, %ecx
	movzwl	%ax, %eax
	orl	%ecx, %eax
	ret

and dramatically better than that produced by gcc 4.2:

_test_bitfield:
	pushl	%ebx
	call	L3
"L00000000001$pb":
L3:
	popl	%ebx
	movl	8(%esp), %eax
	leal	0(,%eax,4), %edx
	sarb	$7, %dl
	movl	%eax, %ecx
	andl	$7168, %ecx
	andl	$-7201, %ebx
	movzbl	%dl, %edx
	andl	$1, %edx
	sall	$5, %edx
	orl	%ecx, %ebx
	orl	%edx, %ebx
	andl	$24, %eax
	andl	$-58336, %ebx
	orl	%eax, %ebx
	orl	$32962, %ebx
	movl	%ebx, %eax
	popl	%ebx
	ret

llvm-svn: 82439
2009-09-21 05:57:11 +00:00
Chris Lattner
0cd0c5c98f add a helper method.
llvm-svn: 82438
2009-09-21 05:52:45 +00:00
Evan Cheng
3edb8b18a5 Fix PR4986. "r1024 = insert_subreg r1024, undef, 2" cannot be turned in an implicit_def. Instead, it's an identity copy so it should be eliminated. Also make sure to update livevariable kill information.
llvm-svn: 82436
2009-09-21 04:32:32 +00:00
Daniel Dunbar
84e383fc42 Don't allow formatted_ostream to be unbuffered, even if its underlying buffer
is.
 - The problem is that formatted_ostream forces its underlying buffer to be
   unbuffered, so if some client happens to wrap a formatted_ostream around
   something, but still use the underlying stream, then we can end up writing on
   a fully unbuffered output (which was never intended to be unbuffered).

 - This makes clang (and presumably llvm-gcc) -emit-llvm -S a mere 10x faster.

llvm-svn: 82434
2009-09-21 03:56:00 +00:00
Chris Lattner
64e3a9984b one case handled, expanded another testcase inline.
llvm-svn: 82427
2009-09-21 02:53:57 +00:00
Chris Lattner
50c869bb19 formatting cleanups, no functionality change.
llvm-svn: 82426
2009-09-21 02:42:51 +00:00
Reid Kleckner
057a723621 Add documentation on how to use enable debug information in the JIT and use it with GDB.
llvm-svn: 82425
2009-09-21 02:34:59 +00:00
Chris Lattner
82a963788d fix a FileCheck bug where:
; CHECK: foo
; CHECK-NOT: foo
; CHECK: bar

would always fail.

llvm-svn: 82424
2009-09-21 02:30:42 +00:00
Daniel Dunbar
5396b3534f Move ARM and X86 specific AsmParser tests into separate subdirectories, and only
run if appropriate target is supported.

llvm-svn: 82419
2009-09-21 00:05:30 +00:00
Reid Kleckner
cb38af30a0 Implement the JIT side of the GDB JIT debugging interface. To enable this
feature, either build the JIT in debug mode to enable it by default or pass
-jit-emit-debug to lli.

Right now, the only debug information that this communicates to GDB is call
frame information, since it's already being generated to support exceptions in
the JIT.  Eventually, when DWARF generation isn't tied so tightly to AsmPrinter,
it will be easy to push that information to GDB through this interface.

Here's a step-by-step breakdown of how the feature works:

- The JIT generates the machine code and DWARF call frame info
  (.eh_frame/.debug_frame) for a function into memory.
- The JIT copies that info into an in-memory ELF file with a symbol for the
  function.
- The JIT creates a code entry pointing to the ELF buffer and adds it to a
  linked list hanging off of a global descriptor at a special symbol that GDB
  knows about.
- The JIT calls a function marked noinline that GDB knows about and has put an
  internal breakpoint in.
- GDB catches the breakpoint and reads the global descriptor to look for new
  code.
- When sees there is new code, it reads the ELF from the inferior's memory and
  adds it to itself as an object file.
- The JIT continues, and the next time we stop the program, we are able to
  produce a proper backtrace.

Consider running the following program through the JIT:

#include <stdio.h>
void baz(short z) {
  long w = z + 1;
  printf("%d, %x\n", w, *((int*)NULL));  // SEGFAULT here
}
void bar(short y) {
  int z = y + 1;
  baz(z);
}
void foo(char x) {
  short y = x + 1;
  bar(y);
}
int main(int argc, char** argv) {
  char x = 1;
  foo(x);
}

Here is a backtrace before this patch:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x2aaaabdfbd10 (LWP 25476)]
0x00002aaaabe7d1a8 in ?? ()
(gdb) bt
#0  0x00002aaaabe7d1a8 in ?? ()
#1  0x0000000000000003 in ?? ()
#2  0x0000000000000004 in ?? ()
#3  0x00032aaaabe7cfd0 in ?? ()
#4  0x00002aaaabe7d12c in ?? ()
#5  0x00022aaa00000003 in ?? ()
#6  0x00002aaaabe7d0aa in ?? ()
#7  0x01000002abe7cff0 in ?? ()
#8  0x00002aaaabe7d02c in ?? ()
#9  0x0100000000000001 in ?? ()
#10 0x00000000014388e0 in ?? ()
#11 0x00007fff00000001 in ?? ()
#12 0x0000000000b870a2 in llvm::JIT::runFunction (this=0x1405b70,
F=0x14024e0, ArgValues=@0x7fffffffe050)
   at /home/rnk/llvm-gdb/lib/ExecutionEngine/JIT/JIT.cpp:395
#13 0x0000000000baa4c5 in llvm::ExecutionEngine::runFunctionAsMain
(this=0x1405b70, Fn=0x14024e0, argv=@0x13f06f8, envp=0x7fffffffe3b0)
   at /home/rnk/llvm-gdb/lib/ExecutionEngine/ExecutionEngine.cpp:377
#14 0x00000000007ebd52 in main (argc=2, argv=0x7fffffffe398,
envp=0x7fffffffe3b0) at /home/rnk/llvm-gdb/tools/lli/lli.cpp:208

And a backtrace after this patch:
Program received signal SIGSEGV, Segmentation fault.
0x00002aaaabe7d1a8 in baz ()
(gdb) bt
#0  0x00002aaaabe7d1a8 in baz ()
#1  0x00002aaaabe7d12c in bar ()
#2  0x00002aaaabe7d0aa in foo ()
#3  0x00002aaaabe7d02c in main ()
#4  0x0000000000b870a2 in llvm::JIT::runFunction (this=0x1405b70,
F=0x14024e0, ArgValues=...)
   at /home/rnk/llvm-gdb/lib/ExecutionEngine/JIT/JIT.cpp:395
#5  0x0000000000baa4c5 in llvm::ExecutionEngine::runFunctionAsMain
(this=0x1405b70, Fn=0x14024e0, argv=..., envp=0x7fffffffe3c0)
   at /home/rnk/llvm-gdb/lib/ExecutionEngine/ExecutionEngine.cpp:377
#6  0x00000000007ebd52 in main (argc=2, argv=0x7fffffffe3a8,
envp=0x7fffffffe3c0) at /home/rnk/llvm-gdb/tools/lli/lli.cpp:208

llvm-svn: 82418
2009-09-20 23:52:43 +00:00
Daniel Dunbar
e06837d0ee Work around a FileCheck bug, for now.
llvm-svn: 82416
2009-09-20 23:30:31 +00:00
Chris Lattner
86e1459473 simplify as daniel suggests
llvm-svn: 82415
2009-09-20 22:56:43 +00:00
Chris Lattner
e520a0c8e7 write rfind in terms of npos as daniel requested
llvm-svn: 82414
2009-09-20 22:54:26 +00:00
Chris Lattner
a1378ef745 remove a dead method.
llvm-svn: 82413
2009-09-20 22:46:42 +00:00
Chris Lattner
12fdecb172 grammaro
llvm-svn: 82412
2009-09-20 22:45:18 +00:00
Chris Lattner
de39a12610 Revert r82404, it is causing a bootstrap miscompile. This is very very
scary, as it indicates a lurking bug. yay.

llvm-svn: 82411
2009-09-20 22:44:26 +00:00
Chris Lattner
d5f420ca4d rewrite CountNumNewlinesBetween to be in terms of StringRef.
llvm-svn: 82410
2009-09-20 22:42:44 +00:00
Chris Lattner
f427ad4f49 this was not supposed to be committed
llvm-svn: 82409
2009-09-20 22:36:11 +00:00
Chris Lattner
63735b5e10 implement and document support for CHECK-NOT
llvm-svn: 82408
2009-09-20 22:35:26 +00:00
Chris Lattner
4552cc1387 rewrite FileCheck in terms of StringRef instead of manual pointer pairs.
llvm-svn: 82407
2009-09-20 22:11:44 +00:00
Chris Lattner
a9a2b9a4cc improve memdep to eliminate bitcasts (and aliases, and noop geps)
early for the stated reasons: this allows it to find more 
equivalences and depend less on code layout.

llvm-svn: 82404
2009-09-20 21:00:18 +00:00
Chris Lattner
b7d34131d1 Move CoerceAvailableValueToLoadType earlier in GVN.cpp. Hook it up
so that nonlocal and partially redundant loads can use it as well.
The testcase shows examples of craziness this can handle.  This triggers
*many* times in 176.gcc.

llvm-svn: 82403
2009-09-20 20:09:34 +00:00
Chris Lattner
279ec561c6 change the interface to CoerceAvailableValueToLoadType to be
more generic.

llvm-svn: 82402
2009-09-20 19:31:14 +00:00
Daniel Dunbar
2974b9671a Teach 'make check-all' to build the site configuration for clang, if it is in tree.
llvm-svn: 82400
2009-09-20 19:04:28 +00:00
Chris Lattner
6bae20046f enhance GVN to forward substitute a stored value to a load
(and load -> load) when the base pointers must alias but when
they are different types.  This occurs very very frequently in
176.gcc and other code that uses bitfields a lot.

llvm-svn: 82399
2009-09-20 19:03:47 +00:00
Chris Lattner
5963cbb9c9 update an entry, delete an entry which has been fixed.
llvm-svn: 82398
2009-09-20 17:37:38 +00:00
Chris Lattner
3568d49264 tidy up
llvm-svn: 82397
2009-09-20 17:32:21 +00:00
Bill Wendling
69ad4a0004 --- 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
Chris Lattner
3cd0d66e5f remove a temporary hack.
llvm-svn: 82395
2009-09-20 07:47:59 +00:00
Chris Lattner
64f72086ad rename X86ATTAsmPrinter.cpp -> X86AsmPrinter.cpp likewise the .h file.
llvm-svn: 82394
2009-09-20 07:41:30 +00:00
Chris Lattner
9f43a427c6 move target registry stuff to X86ATTAsmPrinter.cpp
llvm-svn: 82393
2009-09-20 07:39:06 +00:00
Chris Lattner
a07073da96 simplify this now that createX86CodePrinterPass is trivial
llvm-svn: 82392
2009-09-20 07:37:51 +00:00
Chris Lattner
271256b7a8 rename X86ATTAsmPrinter class -> X86AsmPrinter
llvm-svn: 82391
2009-09-20 07:35:34 +00:00
Chris Lattner
f34b09b112 remove the asmstring, it is now dead. Improve comment.
llvm-svn: 82390
2009-09-20 07:32:00 +00:00
Nick Lewycky
ecb17d4648 Peer through zext and sext to eliminate them when it is safe to do so.
llvm-svn: 82389
2009-09-20 07:31:25 +00:00
Chris Lattner
d56be552eb kill off printPICLabel now, it's specialness is handled by
the MachineInstr ->MCInst lowering process, not in the 
asmprinter.

llvm-svn: 82388
2009-09-20 07:28:26 +00:00
Chris Lattner
efc89d59f7 delete X86IntelAsmPrinter! Now -x86-asm-syntax just switches
the instruction syntax, not the entire asmprinter.

llvm-svn: 82387
2009-09-20 07:25:17 +00:00
Nick Lewycky
991c5185bb Fold 'icmp eq (icmp), true' into an xor(icmp).
llvm-svn: 82386
2009-09-20 07:21:39 +00:00
Chris Lattner
f411f53f9c Add an intel syntax MCInstPrinter implementation. You can now
transcode from AT&T to intel syntax with "llvm-mc foo.s -output-asm-variant=1"

llvm-svn: 82385
2009-09-20 07:17:49 +00:00
Chris Lattner
268bcdc194 tidy up
llvm-svn: 82384
2009-09-20 07:16:54 +00:00
Nick Lewycky
c09c2772d5 Rewrite this check so that it checks what it's supposed to and doesn't use
CHECK-NOT.

llvm-svn: 82383
2009-09-20 07:00:24 +00:00
Chris Lattner
fd910fd2f7 eliminate a use of strtoul.
llvm-svn: 82382
2009-09-20 06:58:54 +00:00