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

145 Commits

Author SHA1 Message Date
Daniel Dunbar
34413e6018 Fix commento.
llvm-svn: 82544
2009-09-22 10:30:34 +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
Daniel Dunbar
4e33798de0 Strip trailing whitespace.
llvm-svn: 82359
2009-09-20 04:03:34 +00:00
Benjamin Kramer
b1d15dcefe Initialize HasMetadata to zero.
llvm-svn: 82145
2009-09-17 14:51:57 +00:00
Devang Patel
253aa4d192 Add llvm::Metadata to manage metadata used in a context.
This interface will be used to attach metadata with an instruction.

llvm-svn: 82060
2009-09-16 18:09:00 +00:00
Dan Gohman
fd3cfaae35 Teach getUnderlyingObject and skipPointerCasts about GlobalAliases.
llvm-svn: 80265
2009-08-27 17:55:13 +00:00
Daniel Dunbar
446d29370f Add a fast path for setName("") on an unnamed value.
llvm-svn: 79492
2009-08-19 23:37:23 +00:00
Daniel Dunbar
b606fc6b6c Make a SmallVector size more reasonable.
llvm-svn: 79403
2009-08-19 05:08:06 +00:00
Owen Anderson
73825c1f37 Privatize the ValueHandle global map. Because this is used so heavily throughout the code base, locking all accesses to
it is not practical performance-wise.

llvm-svn: 79355
2009-08-18 18:28:58 +00:00
Owen Anderson
9df206d02d Push LLVMContexts through the IntegerType APIs.
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Dan Gohman
31d5a5e718 Fix a typo in an assertion string.
llvm-svn: 78671
2009-08-11 15:53:15 +00:00
Chris Lattner
46f946526c revert r78048, it isn't worth using assertingvh here.
llvm-svn: 78119
2009-08-04 23:07:12 +00:00
Chris Lattner
43d32f0969 switch ValueMap to using AssertingVH. This is an old patch I had laying
around in a tree I forgot about.

llvm-svn: 78048
2009-08-04 04:31:02 +00:00
Devang Patel
6bc0c66630 Keep track of named mdnodes in a Module using an ilist.
llvm-svn: 77476
2009-07-29 17:16:17 +00:00
Devang Patel
cb23671431 Rename MDNode.h header. It defines MDnode and other metadata classes.
New name is Metadata.h.

llvm-svn: 77370
2009-07-28 21:49:47 +00:00
Daniel Dunbar
d0f5c0b334 Make sure getName().data() is always null terminated.
llvm-svn: 77149
2009-07-26 09:22:02 +00:00
Daniel Dunbar
518cd20f61 Rewrite getName{Start,End,Len} in terms of getName(), instead of vice-versa.
llvm-svn: 77105
2009-07-26 00:51:56 +00:00
Daniel Dunbar
ddf2470263 Simplify.
llvm-svn: 77102
2009-07-26 00:42:33 +00:00
Daniel Dunbar
3e85b410ab Remove Value::setName(const char*, unsigned).
llvm-svn: 77100
2009-07-26 00:34:27 +00:00
Daniel Dunbar
c1ab70760a Remove Value::setName(const char*).
- Split into a separate patch because there is a slight functionality change,
   it is no longer valid to call setName(0), which was equivalent to
   setName(""). I'm hoping no one depends on this...

llvm-svn: 77099
2009-07-26 00:17:14 +00:00
Daniel Dunbar
038a7f0d35 Remove Value::{isName, getNameRef}.
Also, change MDString to use a StringRef.

llvm-svn: 77098
2009-07-25 23:55:21 +00:00
Daniel Dunbar
251177c96e Initial update to VMCore to use Twines for string arguments.
- The only meat here is in Value.{h,cpp} the rest is essential 'const
   std::string &' -> 'const Twine &'.

llvm-svn: 77048
2009-07-25 04:41:11 +00:00
Daniel Dunbar
ea6955ce65 Move more to raw_ostream.
llvm-svn: 76964
2009-07-24 10:05:20 +00:00
Daniel Dunbar
00155504f8 Add llvm::Value::getNameRef, for help in API migration.
llvm-svn: 76893
2009-07-23 18:50:53 +00:00
Devang Patel
5794cb80ad Introduce MetadataBase, a base class for MDString and MDNode.
Derive MDString directly from MetadataBase. 
Introduce new bitcode block to hold metadata.

llvm-svn: 76759
2009-07-22 17:43:22 +00:00
Owen Anderson
cc287b28c9 Get rid of the Pass+Context magic.
llvm-svn: 76702
2009-07-22 00:24:57 +00:00
Dan Gohman
00b05492f1 Revert the addition of hasNoPointerOverflow to GEPOperator.
Getelementptrs that are defined to wrap are virtually useless to
optimization, and getelementptrs that are undefined on any kind
of overflow are too restrictive -- it's difficult to ensure that
all intermediate addresses are within bounds. I'm going to take
a different approach.

Remove a few optimizations that depended on this flag.

llvm-svn: 76437
2009-07-20 17:43:30 +00:00
Dan Gohman
754bb5e64a Fix this accidentally inverted condition.
llvm-svn: 76278
2009-07-18 00:58:38 +00:00
Dan Gohman
e45061eefe Convert more code to use Operator instead of explicitly handling both
ConstantExpr and Instruction. This involves duplicating some code
between GetElementPtrInst and GEPOperator, but it's not a lot.

llvm-svn: 76265
2009-07-17 23:55:56 +00:00
Dan Gohman
93cbd452ed Make BasicAliasAnalysis and Value::getUnderlyingObject use
GEPOperator's hasNoPointer0verflow(), and make a few places in instcombine
that create GEPs that may overflow clear the NoOverflow value. Among
other things, this partially addresses PR2831.

llvm-svn: 76252
2009-07-17 22:25:10 +00:00
Dan Gohman
67f2b7d376 Add a SubclassOptionalData field to Value. See the doxygen comment for
details.

llvm-svn: 76189
2009-07-17 17:16:59 +00:00
Torok Edwin
f955a6ef49 llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").

llvm-svn: 75640
2009-07-14 16:55:14 +00:00
Jeffrey Yasskin
3d0b6f8aa7 Fix the AssertingVH unittests.
llvm-svn: 75060
2009-07-08 22:09:00 +00:00
Torok Edwin
358888da3a Implement changes from Chris's feedback.
Finish converting lib/Target.

llvm-svn: 75043
2009-07-08 20:53:28 +00:00
Torok Edwin
ad3be984b7 Start converting to new error handling API.
cerr+abort -> llvm_report_error
assert(0)+abort -> LLVM_UNREACHABLE (assert(0)+llvm_unreachable-> abort() included)

llvm-svn: 75018
2009-07-08 18:01:40 +00:00
Owen Anderson
75f0f1cc6c Have scoped mutexes take referenes instead of pointers.
llvm-svn: 74931
2009-07-07 18:33:04 +00:00
Owen Anderson
844cf0aa3f Simplify by using no-op-when-not-multithreaded locks.
llvm-svn: 73719
2009-06-18 20:36:21 +00:00
Owen Anderson
a59f91c08d Move Threading.[h|cpp] from Support to System.
llvm-svn: 73707
2009-06-18 16:54:52 +00:00
Owen Anderson
d7312aff32 Protect the ValueHandle table.
llvm-svn: 73620
2009-06-17 17:36:57 +00:00
Dan Gohman
f8f167320d Use true instead of 1 for a boolean value. And fix a copy+pasto
in a comment.

llvm-svn: 70882
2009-05-04 17:25:21 +00:00
Dan Gohman
dc96a23780 Apply Jeffrey Yasskin's CallbackVH patch, with minor tweaks from me
to make the copy constructor and destructor protected, and corresponding
adjustments to the unittests.

llvm-svn: 70644
2009-05-02 21:10:48 +00:00
Nick Lewycky
e9597399f0 Limit the number of times we're willing to chase pointers. Removes an O(n^2)
problem from instcombine.

llvm-svn: 69151
2009-04-15 06:23:41 +00:00
Chris Lattner
939313c44a Add two new classes: WeakVH and AssertingVH. These are both "ValueHandles",
which are effectively smart pointers to Value*'s.  They are both very light
weight and simple, and react to values being destroyed or being RAUW'd.

WeakVN does a best effort to follow a value around, including through RAUW 
operations and will get nulled out of the value is destroyed.  This is useful
for the eventual "metadata that references a value" work, because it is a
reference to a value that does not show up on its use_* list.

AssertingVH is a pointer that compiles down to a dumb raw pointer when 
assertions are disabled.  When enabled, it emits an assertion if the 
pointed-to value is destroyed while it is still being referenced.  This
is very useful for Maps and other things, and should have caught the recent
bugs in CallGraph and Reassociate, for example.

llvm-svn: 68149
2009-03-31 22:11:05 +00:00
Gabor Greif
037f4dc1a4 Rearrange operands of the BranchInst, to be able to
access each with a fixed negative index from op_end().

This has two important implications:
- getUser() will work faster, because there are less iterations
  for the waymarking algorithm to perform. This is important
  when running various analyses that want to determine callers
  of basic blocks.
- getSuccessor() now runs faster, because the indirection via OperandList
  is not necessary: Uses corresponding to the successors are at fixed
  offset to "this".

The price we pay is the slightly more complicated logic in the operator
User::delete, as it has to pick up the information whether it has to free
the memory of an original unconditional BranchInst or a BranchInst that
was originally conditional, but has been shortened to unconditional.
I was not able to come up with a nicer solution to this problem. (And
rest assured, I tried *a lot*).

Similar reorderings will follow for InvokeInst and CallInst. After that
some optimizations to pred_iterator and CallSite will fall out naturally.

llvm-svn: 66815
2009-03-12 18:34:49 +00:00
Duncan Sands
f7fb4d197c Make stripPointerCasts and getUnderlyingObject
non-recursive.

llvm-svn: 61479
2008-12-29 21:06:19 +00:00
Chris Lattner
0be74c4208 These messages should always be emitted when NDEBUG is unset, not when
NDEBUG is unset and -debug is passed.

llvm-svn: 60986
2008-12-13 18:37:58 +00:00
Chris Lattner
2f766df51f Comment typeo fix, thanks Duncan!
llvm-svn: 60429
2008-12-02 18:33:11 +00:00
Chris Lattner
90d1a3c343 add a little helper function that does PHI translation.
llvm-svn: 60405
2008-12-02 07:16:45 +00:00
Duncan Sands
88d8323743 Factorize code: remove variants of "strip off
pointer bitcasts and GEP's", and centralize the
logic in Value::getUnderlyingObject.  The
difference with stripPointerCasts is that
stripPointerCasts only strips GEPs if all
indices are zero, while getUnderlyingObject
strips GEPs no matter what the indices are.

llvm-svn: 56922
2008-10-01 15:25:41 +00:00
Bill Wendling
8b4fecfb09 Make pointer parameter const for isUsedInBasicBlock.
llvm-svn: 56625
2008-09-25 22:42:01 +00:00