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

9636 Commits

Author SHA1 Message Date
David Goodwin
3ac3dcacc7 Make the end-of-itinerary mark explicit. Some cleanup.
llvm-svn: 82709
2009-09-24 20:22:50 +00:00
Chris Lattner
b1ee14d64b tidy up, fix a memory leak in Regex::isValid
llvm-svn: 82707
2009-09-24 20:15:51 +00:00
Victor Hernandez
ff8027ced6 Auto-upgrade malloc instructions to malloc calls.
Reviewed by Devang Patel.

llvm-svn: 82694
2009-09-24 17:47:49 +00:00
Evan Cheng
f2090008be Clean up LiveVariables and change how it deals with partial updates and kills. This also eliminate the horrible check which scan forward to the end of the basic block. It should be faster and more accurate.
llvm-svn: 82676
2009-09-24 02:15:22 +00:00
Dan Gohman
fc9e3e3cdb Spruce up some comments.
llvm-svn: 82655
2009-09-23 21:06:36 +00:00
Dan Gohman
1256f9265b Rename several variables from EVT to more descriptive names, now that EVT
is also the name of their type, as declarations like "EVT EVT" look
really odd.

llvm-svn: 82654
2009-09-23 21:02:20 +00:00
Dan Gohman
48889db9d9 Add an EVT::getStoreSize function, like getStoreSizeInBits but in bytes.
llvm-svn: 82653
2009-09-23 20:59:10 +00:00
Dan Gohman
2967c534f7 Correct a comment.
llvm-svn: 82648
2009-09-23 20:40:16 +00:00
Devang Patel
18dae0848f Do not leave behind metadata while cloning an instruction.
llvm-svn: 82638
2009-09-23 18:32:25 +00:00
Devang Patel
9253538963 s/*Location/*DebugLocation/g
llvm-svn: 82635
2009-09-23 17:20:43 +00:00
John McCall
24a3aba8b8 Make the type traits for a const pointer defer to those for a unqualified
pointer, instead of providing independent values modelled on the default
implementation.

llvm-svn: 82620
2009-09-23 06:53:51 +00:00
Evan Cheng
863ed2677b Fix PR5024. LiveVariables physical register defs should *commit* only after all
of the defs are processed.
Also fix a implicit_def propagation bug: a implicit_def of a physical register
should be applied to uses of the sub-registers.

llvm-svn: 82616
2009-09-23 06:28:31 +00:00
Dan Gohman
8b2d3ef326 Give MachineMemOperand an operator<<, factoring out code from
two different places for printing MachineMemOperands.

Drop the virtual from Value::dump and instead give Value a
protected virtual hook that can be overridden by subclasses
to implement custom printing. This lets printing be more
consistent, and simplifies printing of PseudoSourceValue
values.

llvm-svn: 82599
2009-09-23 01:33:16 +00:00
Devang Patel
d3d28d0f25 Add SetLocation() to allow IRBuilder user to set location info for an instruction already created.
llvm-svn: 82570
2009-09-22 20:56:31 +00:00
Devang Patel
d785fbf971 Check exisiting dbg MDKind first.
llvm-svn: 82568
2009-09-22 20:54:13 +00:00
Daniel Dunbar
595fbf539a Revert "Don't allow formatted_ostream to be unbuffered, even if its underlying
buffer", while we work out a solution.

Dan convinced me that making debugging annoying for him is worse than 10x being
slower for me. :)

llvm-svn: 82553
2009-09-22 16:33:42 +00:00
Evan Cheng
6e04d960a3 Forgot this.
llvm-svn: 82536
2009-09-22 08:47:59 +00:00
Daniel Dunbar
badca39b69 Revert "Get rid of GetProcessId in Win32/Program.inc.", this breaks
ExecuteAndWait.

llvm-svn: 82522
2009-09-22 04:44:56 +00:00
Daniel Dunbar
ac9a646035 Switch FoldingSet::AddString to StringRef based API.
- This also fixes a dereference of std::string::end, which makes MSVC unhappy and was causing all the static analyzer clang tests to fail.

llvm-svn: 82517
2009-09-22 03:34:53 +00:00
Daniel Dunbar
14c9a4d355 Switch DIDescriptor to use a TrackingVH. - This makes it much safer to work with debug info, since it was extraordinarily easy to have dangling pointers thanks to MDNode uniquing.
llvm-svn: 82507
2009-09-22 02:03:18 +00:00
Daniel Dunbar
6d5513977b Add a TrackingVH value handle.
This is designed for tracking a value even when it might move (like WeakVH), but it is an error to delete the referenced value (unlike WeakVH0. TrackingVH is templated like AssertingVH on the tracked Value subclass, it is an error to RAUW a tracked value to an incompatible type.

For implementation reasons the latter error is only diagnosed on accesses to a mis-RAUWed TrackingVH, because we don't want a virtual interface in a templated class.

The former error is also only diagnosed on access, so that clients are allowed to delete a tracked value, as long as they don't use it. This makes it easier for the client to reason about destruction.

llvm-svn: 82506
2009-09-22 02:02:33 +00:00
Chris Lattner
1ceac42392 move DominatorTree::dominates for instructions out of line,
no functionality change.

llvm-svn: 82490
2009-09-21 22:30:50 +00:00
Dan Gohman
c50bd99a43 Change MachineMemOperand's alignment value to be the alignment of
the base pointer, without the offset. This matches MemSDNode's
new alignment behavior, and holds more interesting information.

llvm-svn: 82473
2009-09-21 19:47:04 +00:00
Chris Lattner
0cd0c5c98f add a helper method.
llvm-svn: 82438
2009-09-21 05:52:45 +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
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
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
acb70ff251 smallvectorize getExtraOptionNames
llvm-svn: 82377
2009-09-20 06:21:43 +00:00
Chris Lattner
f1dd47fa9d add a helper method.
llvm-svn: 82376
2009-09-20 06:21:20 +00:00
Daniel Dunbar
27de063176 A few more tabs -> spaces.
llvm-svn: 82358
2009-09-20 04:03:25 +00:00
Chris Lattner
72732da2f0 move a couple non-trivial methods out of line, add new
find_first_of/find_first_of methods.

llvm-svn: 82347
2009-09-20 01:22:16 +00:00
Chris Lattner
85478e8cd1 convert a bunch more stuff to use StringRef. The ArgName arguments are now
stringref because they may not be nul terminated.  For options like -Lfoo
this now avoids a O(n)  temporary std::strings where N is the length of 
the string after -L.

llvm-svn: 82345
2009-09-20 00:40:49 +00:00
Chris Lattner
2cdc7b8e76 add size_t and a version of rfind that allows specification of where
to scan from.

llvm-svn: 82343
2009-09-20 00:38:28 +00:00
Chris Lattner
d2a0138c62 add some more overloads of StringRef::getAsInteger for
common and useful integer types.

llvm-svn: 82338
2009-09-19 23:58:48 +00:00
Chris Lattner
4606ccf232 add a simple c_str() method to SmallString.
llvm-svn: 82337
2009-09-19 23:57:31 +00:00
Daniel Dunbar
8ca643da7e Prefer super class constructor to explicit initialization.
llvm-svn: 82335
2009-09-19 20:40:28 +00:00
Daniel Dunbar
8f197cee58 Tabs -> spaces (really?)
llvm-svn: 82334
2009-09-19 20:40:21 +00:00
Daniel Dunbar
39c0d90339 Strip trailing whitespace.
llvm-svn: 82332
2009-09-19 20:40:05 +00:00
Daniel Dunbar
1cc4f6eb9e RHS of assignment should be const reference.
llvm-svn: 82331
2009-09-19 20:39:50 +00:00
Nick Lewycky
3b7df4bbd5 Remove the default value for ConstantStruct::get's isPacked parameter and
update the code which was broken by this.

llvm-svn: 82327
2009-09-19 20:30:26 +00:00
Chris Lattner
e6fa81a475 provide a "strtoull" operation that works on StringRef's.
llvm-svn: 82322
2009-09-19 19:47:14 +00:00
Chris Lattner
86c1fbbc0a convert a bunch of std::strings to use StringRef. This should eliminate
a massive number of temporary strings created when parsing a command line.
More still left to eliminate.

llvm-svn: 82318
2009-09-19 18:55:05 +00:00
Nick Lewycky
441d1e8dd5 Lett users of sparse propagation do their own thing with phi nodes if they want
to. This can be combined with LCSSA or SSI form to store more information on a
PHINode than can be computed by looking at its incoming values.

llvm-svn: 82317
2009-09-19 18:33:36 +00:00
Evan Cheng
4244113f89 Update comments.
llvm-svn: 82313
2009-09-19 10:08:51 +00:00
Chris Lattner
084409a543 remove an extraneous mem2reg pass early in the pipe. Since
this is run after the 'standard function passes', SRoA was
recently run.  This saves a domfrontier construction. Thanks
to Eli for noticing this.

llvm-svn: 82291
2009-09-18 22:03:29 +00:00
Chris Lattner
8deb752897 reduce indentation by using an early exit, and add a comment,
no functionality change.

llvm-svn: 82290
2009-09-18 22:01:30 +00:00
Evan Cheng
7cb9c456e5 Enhance EmitInstrWithCustomInserter() so target can specify CFG changes that sdisel will use to properly complete phi nodes.
Not functionality change yet.

llvm-svn: 82273
2009-09-18 21:02:19 +00:00
Chris Lattner
f50872c2c4 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
Devang Patel
c195f74dee Write and read metadata attachments.
llvm-svn: 82259
2009-09-18 19:26:43 +00:00