Commit Graph

2924 Commits

Author SHA1 Message Date
Owen Anderson
3d29df3e8a Push LLVMContext through GlobalVariables and IRBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74985 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 01:26:06 +00:00
Owen Anderson
f81b57694b LLVMContext-ification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74973 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 23:43:39 +00:00
Owen Anderson
62e744b555 LLVMContext-ifiy the implementation of the C API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74950 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 21:33:58 +00:00
Owen Anderson
a9d1f2c559 Have scoped mutexes take referenes instead of pointers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74931 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 18:33:04 +00:00
Owen Anderson
07cf79ef53 "LLVMContext* " --> "LLVMContext *"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74878 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 23:00:19 +00:00
Chris Lattner
e4840bc611 Add two new accessors to the C bindings, patch by Wladimir van der Laan!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74836 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 17:29:59 +00:00
Owen Anderson
0a205a4598 More LLVMContext-ification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74807 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-05 22:41:43 +00:00
Owen Anderson
fa5cbd6d0f Even more passes being LLVMContext'd.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74781 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-03 19:42:02 +00:00
Owen Anderson
0d86e2fa58 Fill in a few more missing accessors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74739 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 23:58:19 +00:00
Owen Anderson
62fabf5fab Add an accessor to Function so that Passes can easily get access to the context.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74714 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 18:03:58 +00:00
Owen Anderson
093811593e Add accessors for metadata constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74707 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 17:19:47 +00:00
Owen Anderson
77cf22c451 Add accessor for MDNode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74705 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 17:12:48 +00:00
Owen Anderson
480752e9f6 Add accessor for getting UndefValue's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74702 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 16:51:51 +00:00
Owen Anderson
c8897d9c2f Restore other bits of the C API that I tore up. All pre-existing APIs default to using the
default global context, while new *InContext() APIs have been added that take a LLVMContextRef parameter.

Apologies to anyone affected by this breakage.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74694 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 07:17:57 +00:00
Owen Anderson
c70e62110b Add a C wrapper for accessing the global default context.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74675 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 00:16:38 +00:00
Owen Anderson
7f41781c3b Add a few methods that got left out earlier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74670 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 23:56:45 +00:00
Owen Anderson
4434ed44c4 Make the use of const with respect to LLVMContext sane. Hopefully this is the last time, for the
moment, that I will need to make far-reaching changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74655 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 23:13:44 +00:00
Dan Gohman
82c32c4272 Use find instead of operator[] to test whether an element is in a std::map.
This fixes a bug that caused -debug-pass=Details to abort.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74654 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 23:12:33 +00:00
Bill Wendling
aa3943bf63 --- Reverse-merging (from foreign repository) r74648 into '.':
U    include/llvm/LLVMContext.h
U    lib/VMCore/LLVMContext.cpp
U    lib/AsmParser/LLParser.cpp
U    lib/AsmParser/LLParser.h

Temporarily reverting r74648. It was causing massive failures in release mode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74653 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 22:33:26 +00:00
Owen Anderson
3f64342e11 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74649 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 21:58:14 +00:00
Owen Anderson
c137ea6cf5 Convert LLParser to use LLVMContext for creating constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74648 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 21:57:44 +00:00
Owen Anderson
31895e7359 Hold the LLVMContext by reference rather than by pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 21:22:36 +00:00
Devang Patel
fcd65ae28f Fix metadata unittests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74638 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 20:59:15 +00:00
Devang Patel
05a0e6a01c Do not print stranded metadata.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74632 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 19:39:39 +00:00
Devang Patel
923078c65d Support stand alone metadata syntax.
!0 = constant metadata !{i32 21, i32 22}
@llvm.blah = constant metadata !{i32 1000, i16 200, metadata !0}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74630 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 19:21:12 +00:00
Owen Anderson
334143d304 I give up on trying to use reader/writer locks for recursive type refinement. Use a recursive mutex instead, which will (in theory) generate more contention, but is really
a much more natural fit for what's going on during recursive type refinement.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74618 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 17:22:27 +00:00
Owen Anderson
8b477ed579 Add a pointer to the owning LLVMContext to Module. This requires threading LLVMContext through a lot
of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools.

Patches for Clang and LLVM-GCC to follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74614 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 16:58:40 +00:00
Owen Anderson
db47ed0925 Add a global context, for easing backwards compatibility.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74574 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 23:39:59 +00:00
Owen Anderson
72bf4473a6 Add wrappers for type construction to LLVMContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74542 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 17:50:28 +00:00
Owen Anderson
5217007006 Fix up header comments to make Chris happy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74537 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 17:06:46 +00:00
Owen Anderson
2bc29dc0bc Add LLVMContext, which will eventually be used as a container for privatizing a lot of (currently) global state, including the
constant and type uniquing tables.  For now, just make it a wrapper around the existing APIs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74488 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 00:48:55 +00:00
Torok Edwin
6c839926ba Set wasRun to false here on Dan's suggestion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74455 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-29 21:05:10 +00:00
Torok Edwin
1970a89a49 Call doInitialization(), releaseMemory(), and doFinalization() for on-the-fly passes as well.
Also don't call finalizers for LoopPass if initialization was not called.
Add a unittest that tests that these methods are called, in the proper
order, and the correct number of times.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74438 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-29 18:49:09 +00:00
David Greene
9b9838dbd4 Add more vector ValueTypes for AVX and other extended vector instruction
sets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74427 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-29 16:47:10 +00:00
Owen Anderson
a6184406b7 Make this const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74317 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 20:21:18 +00:00
Devang Patel
70535451e0 Add constructor to create MDString using std::string
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74133 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 22:42:39 +00:00
Owen Anderson
6b96f6cfeb Guard the listeners list. Unfortunately, this requires a real static rather
than a managed static because other managed statics can (and do) access this
list in their destructors.  Yes, I know it's horrible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74029 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 00:25:42 +00:00
Owen Anderson
6f2c64d70a Revert my last series of commits related to Timer and 64-bit atomics. Not all the targets
we care about are capable of supporting it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73993 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 20:17:22 +00:00
Owen Anderson
f43f9d0ef8 Atomic ops that do arithmetic use signed arithmetic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73980 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 18:30:27 +00:00
Owen Anderson
0de9953e88 Label the existing atomic functions as 32-bit specific, and add a 64-bit one that will be useful in
the near future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73971 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 18:01:04 +00:00
Nick Lewycky
e47f59db44 Expand this test to handle more cases (remainder and shifts) of zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73839 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 01:56:41 +00:00
Chris Lattner
1db6866147 implement PR4424: 0/x is always 0 for integer division.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73835 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 01:15:55 +00:00
Owen Anderson
ac7087ecf0 Forgot this file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73802 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-20 00:26:26 +00:00
Owen Anderson
04fb7c36a9 Revert r73790, and replace it with a significantly less ugly solution. Rather than trying to make the global reader-writer lock work,
create separate recursive mutexes for each value map.  The recursive-ness fixes the double-acquiring issue, which having one per ValueMap
lets us continue to maintain some concurrency.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73801 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-20 00:24:58 +00:00
Owen Anderson
430444b102 Fix a serious bug that would cause deadlock during abstract type refinement. The constant creation
gets involved, and we end up trying to recursively acquire a writer lock.  The fix for this is slightly horrible,
and involves passing a boolean "locked" parameter around in Constants.cpp, but it's better than having locked and
unlocked versions of most of the code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73790 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 23:16:19 +00:00
Owen Anderson
1f0ba8c57b Forgot to remove some explicit locking when it became implicit in the ValueMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73778 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 18:34:09 +00:00
Owen Anderson
8e1c17aa5a Move the memory fences out of the path for single-threaded mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73775 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 17:45:12 +00:00
Owen Anderson
ae60c0f78e Fix incorrect comment pointed out by Duncan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73773 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 17:20:50 +00:00
Owen Anderson
e454067f97 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73725 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 21:35:56 +00:00
Owen Anderson
b2c0fe4d93 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73723 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 20:56:48 +00:00
Owen Anderson
3c8031df6d Add a SmartScopedLock, and use it to simplify code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73722 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 20:51:00 +00:00
Owen Anderson
f0f220a07e Simplify with SmartRWMutex.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73721 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 20:44:31 +00:00
Owen Anderson
bcf9737f1e Simplify by using no-op-when-not-multithreaded locks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73719 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 20:36:21 +00:00
Owen Anderson
6cf69cfdee Simplify using mutexes that become no-ops when not in multithreaded mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73716 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 20:15:26 +00:00
Owen Anderson
ee6aefcaa3 Simplify a lot of code by using a R/W mutex that becomes a no-op when multithreading is disabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73714 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 19:10:19 +00:00
Owen Anderson
0e4d606684 Use SmartMutex to simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73712 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 18:36:34 +00:00
Owen Anderson
e3cd5ca7e7 Move Threading.[h|cpp] from Support to System.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73707 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 16:54:52 +00:00
Owen Anderson
1d36e4fa7c Fix the double checked locking in this file too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73703 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 16:17:42 +00:00
Owen Anderson
3cfc62aa08 As pointed out by Duncan, I accidentally dropped the first MemoryFence of the
double-checked locking pattern here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73701 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 16:08:27 +00:00
Nick Lewycky
b4b0fc28bc Add braces to clarify if/else structure and remove warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73673 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 03:01:42 +00:00
Owen Anderson
bf5ec1b9db Reapply r73647 in a non-broken form.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73662 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 23:49:06 +00:00
Owen Anderson
a23d2c1262 Use double-checked locking for this lazy initialization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73653 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 22:53:57 +00:00
Owen Anderson
b983d67465 Protect the GC table in Function.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73647 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 22:23:31 +00:00
Owen Anderson
de17e9940e Use atomic increment here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73643 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 22:01:09 +00:00
Owen Anderson
92f2c87110 Thread-safe (and ManagedStatic-ized) LeakDetector!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73642 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 21:56:05 +00:00
Owen Anderson
f005a6466a Guard mutation of the timing info global.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73639 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 21:28:54 +00:00
Owen Anderson
f2986e6ca9 We need to use double-checked locking for lazy initialization in this case when running multithreaded.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73636 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 21:16:20 +00:00
Owen Anderson
32a25568fc Factor out some common code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73631 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 20:43:39 +00:00
Owen Anderson
dd561e1539 Add an RAII ScopedWriter, which allows one to acquire a writer lock for the duration of a scope. Simplify a lot of uses of
writer locks in Constants.cpp by using it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73630 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 20:34:43 +00:00
Owen Anderson
31c36f02f2 Simplify the locking on the Constants tables, and make it more efficient, by pushing it into the ValueMap from the callers.
Document those ValueMap functions that are _not_ locked, so that callers are aware that they need to do the locking themselves.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73628 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 20:10:08 +00:00
Owen Anderson
3e456abde2 Type safety for Constants.cpp! Some of this is temporary, as I'm planning to push some of the R/W locking into FoldingSet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73624 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 18:40:29 +00:00
Owen Anderson
f2aac28d30 Protect the ValueHandle table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73620 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 17:36:57 +00:00
Owen Anderson
4f0ac58da1 We need to guard reads of the AbstractTypeUsers list, as well as writes to it. While it would be nice to use a R/W lock here,
we can't, because it HAS to be recursive.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73617 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 17:13:54 +00:00
Owen Anderson
ea808c98d8 Type safety for TypeSymbolTable!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73614 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 16:56:27 +00:00
Owen Anderson
142fb2acdd Add locking around the accessors for AbstractTypeUsers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73586 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 00:12:30 +00:00
Owen Anderson
845e7e812c Use a reader-writer lock to guard large portions of the Type infrastructure, including abstract type refinement.
There's still some more work to be done here, such as guarding removeAbstractTypeUser() and the printers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73575 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 22:51:18 +00:00
Anton Korobeynikov
385f5a99ec Address review comments: add 3 ARM calling conventions.
Dispatch C calling conv. to one of these conventions based on
target triple and subtarget features.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73530 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 18:50:49 +00:00
Dan Gohman
f57478f381 Use Type::isIntOrIntVector and Type::isFPOrFPVector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73433 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 22:25:12 +00:00
Dan Gohman
6de29f8d96 Support vector casts in more places, fixing a variety of assertion
failures.

To support this, add some utility functions to Type to help support
vector/scalar-independent code. Change ConstantInt::get and
ConstantFP::get to support vector types, and add an overload to
ConstantInt::get that uses a static IntegerType type, for
convenience.

Introduce a new getConstant method for ScalarEvolution, to simplify
common use cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73431 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 22:12:54 +00:00
Dan Gohman
a119de86a0 Fix old-style type names in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73362 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 23:30:43 +00:00
Dan Gohman
194ae785e1 Give Instruction::isSameOperationAs a corresponding comment to note
the relationship with MergeFunctions.cpp's isEquivalentOperation,
and make a trivial code reordering so that the two functions are
easier to compare.

Fix the name of Instruction::isSameOperationAs in MergeFunction.cpp's
isEquivalentOperation's comment, and fix a nearby 80-column violation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73241 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 19:03:05 +00:00
Duncan Sands
d6de30ceea Cosmetic changes to parameter attribute verification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73188 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-11 08:11:03 +00:00
Jay Foad
757068f3ba Implement and use new method Function::hasAddressTaken().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73164 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-10 08:41:11 +00:00
Nick Lewycky
a5f54a06b0 Create FunctionType::isValidArgumentType to go along with isValidReturnType.
Also create isValidElementType for ArrayType, PointerType, StructType and
VectorType.

Make LLParser use them. This closes up some holes like an assertion failure on:

  %x = type {label}

but largely doesn't change any semantics. The only thing we accept now which
we didn't before is vectors of opaque type such as "<4 x opaque>". The opaque
can be resolved to an int or float when linking.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73016 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-07 07:26:46 +00:00
Nick Lewycky
dcef849ab0 Remove cyclic MDNode detection. Any attempt to create a cyclic MDNode will
crash LLVM first.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73011 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-07 04:03:01 +00:00
Devang Patel
578efa920a Add new function attribute - noimplicitfloat
Update code generator to use this attribute and remove NoImplicitFloat target option.
Update llc to set this attribute when -no-implicit-float command line option is used.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72959 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 21:57:13 +00:00
Dan Gohman
f38fd690ad Fix a copy+pasto in an assertion string that Jay Foad noticed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 18:34:16 +00:00
Dan Gohman
11cc35de41 Update the Verifier to be aware of the difference between Add and FAdd, etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72946 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 16:10:00 +00:00
Dan Gohman
ae3a0be92e Split the Add, Sub, and Mul instruction opcodes into separate
integer and floating-point opcodes, introducing
FAdd, FSub, and FMul.

For now, the AsmParser, BitcodeReader, and IRBuilder all preserve
backwards compatability, and the Core LLVM APIs preserve backwards
compatibility for IR producers. Most front-ends won't need to change
immediately.

This implements the first step of the plan outlined here:
http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72897 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 22:49:04 +00:00
Devang Patel
d18e31ae17 Add new function attribute - noredzone.
Update code generator to use this attribute and remove DisableRedZone target option.
Update llc to set this attribute when -disable-red-zone command line option is used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72894 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 22:05:33 +00:00
Nick Lewycky
7a0370f66a Give embedded metadata its own type instead of relying on EmptyStructTy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72610 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 05:06:04 +00:00
Bill Wendling
51b16f4737 Untabification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72604 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 01:09:53 +00:00
Duncan Sands
44008257a4 Dan noticed that the verifier wasn't thoroughly checking uses of
invoke results (see the testcases).  Tighten up the checking.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72586 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 19:39:36 +00:00
Nick Lewycky
d67a1666ec Audit the type constructors. Previously it was possible to create [0 x void]
or use labels as members of structures for example. Also included a couple of
whitespace fixes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72402 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-25 21:28:11 +00:00
Duncan Sands
d6752d1666 Always verify dominfo if expensive checking is enabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72253 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-22 08:52:53 +00:00
Torok Edwin
382cb2189a Revert this. There's no way to verifiy indirect calls, and an optimizer can turn
indirect call into direct call, thus the verifier would reject something it
previously accepted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72249 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-22 07:12:05 +00:00
Torok Edwin
9107c54693 Verify that calling conventions match function prototype.
This only rejects mismatches between target specific calling convention
and C/LLVM specific calling convention.
There are too many fastcc/C, coldcc/cc42 mismatches in the testsuite, these are
not reject by the verifier.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72248 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-22 06:41:43 +00:00
Dan Gohman
fea3da9e58 Update an assertion string to new-style type names.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72239 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-22 00:40:35 +00:00
Eli Friedman
0f4012ca9d Fix some incorrect logic in DominanceFrontier::splitBlock. Part of
PR4238.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72223 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 20:40:30 +00:00
Duncan Sands
ef854af5bd Add a getAlignOf helper for getting the ABI alignment of a
type as a target independent constant expression.  I confess
that I didn't check that this method works as intended (though
I did test the equivalent hand-written IR a little).  But what
could possibly go wrong!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72213 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 15:52:21 +00:00
Jay Foad
e3e51c0038 Use v.data() instead of &v[0] when SmallVector v might be empty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72210 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 09:52:38 +00:00
Dan Gohman
16899a2056 Revert r72025. It is possible for clients to convert between signed types
and pointer types safely if they only do so when the sizes are the same.
llvm-gcc is such a client.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72029 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 18:55:39 +00:00
Dan Gohman
c7897e26a4 Add assertions to CastInst::getCastOpcode to catch attempted conversions
between integers and pointers when the source type is marked signed,
since inttoptr and ptrtoint always use zero-extension when the destination
is larger than the source.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72025 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18 18:18:57 +00:00
Bill Wendling
26e2de135c Needed #includes. Thanks Fritz van Bommel!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71413 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-10 23:27:41 +00:00
Nick Lewycky
cb33799b9f Make MDNode use CallbackVH. Also change MDNode to store Value* instead of
Constant* in preperation of a future change to support holding non-Constants
in an MDNode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-10 20:57:05 +00:00
Duncan Sands
e149e9960b OCaml parameter attribute bindings from PR2752.
Incomplete, but better than nothing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71081 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 12:21:17 +00:00
Duncan Sands
7af1c78b98 Allow readonly functions to unwind exceptions. Teach
the optimizers about this.  For example, a readonly
function with no uses cannot be removed unless it is
also marked nounwind.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71071 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 06:49:50 +00:00
Evan Cheng
8f18edd8b6 Quotes should be printed before private prefix; some code clean up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71032 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 22:50:29 +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
Dan Gohman
c09b12c622 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70644 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-02 21:10:48 +00:00
Sanjiv Gupta
9341c808ae Any size of integral indices are allowed in gep for indexing into sequential types. Also adding a test case to check the indices type allowed into struct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70134 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-26 17:14:35 +00:00
Chris Lattner
a2165ed6ee Allow aliasee to be a GEP or bitcast instead of just a bitcast.
The real fix for this whole mess is to require the operand of the
alias to be a *GlobalValue* (not a general constant, including 
constant exprs) but allow the operand and the alias type to be
unrelated.

This fixes PR4066


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70079 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 21:23:19 +00:00
Sanjiv Gupta
7787d4a34b Allow i16 type indices to gep.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69946 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24 02:37:54 +00:00
Dan Gohman
f30a8641d1 It's not necessary for PrintModulePass to flush the output streams
now that errs() is properly non-buffered.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20 16:26:25 +00:00
Dan Gohman
ba0941fbe0 Don't discard an AssemblyAnnotationWriter when writing GlobalValues,
which include Functions, where it can be quite useful to use an
AssemblyAnnotationWriter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69598 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20 16:10:33 +00:00
Dan Gohman
5b7ff35503 Implement operator<<(raw_ostream &OS, const Type &T).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69596 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20 15:55:38 +00:00
Nick Lewycky
300e36503c Limit the number of times we're willing to chase pointers. Removes an O(n^2)
problem from instcombine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69151 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 06:23:41 +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
Chris Lattner
3584a47588 Add a new Type::getPointerTo method, which is shorthand for
llvm::PointerType::get().  Patch by Anders Johnsen!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68772 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 06:42:02 +00:00
Chris Lattner
bd6de0a2b3 disable this code for now, re-breaking PR2975, but fixing
a testcase I'm about to attach to that pr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68592 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 04:36:59 +00:00
Torok Edwin
68c405d6e8 fix style.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68542 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 19:45:59 +00:00
Torok Edwin
eb55f3ea3c Another attempt at fixing PR2975.
Types can have references to eachother, so we can't just call destroy on them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68523 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 17:23:02 +00:00
Torok Edwin
5ce1b11412 revert r68457, its crashing in make check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68459 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 20:57:34 +00:00
Torok Edwin
59d5f83b32 fix (part of) memory leak on shutdown. See PR2975.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68457 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 20:49:21 +00:00
Nick Lewycky
5a30f4f84a Remove bogus include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68421 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-04 07:42:46 +00:00
Nick Lewycky
21cc4460ef Add support for embedded metadata to LLVM. This introduces two new types of
Constant, MDString and MDNode which can only be used by globals with a name
that starts with "llvm." or as arguments to a function with the same naming
restriction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68420 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-04 07:22:01 +00:00
Devang Patel
9dfa1671fc Clean up pass manager cache after each run.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68254 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 22:34:41 +00:00
Chris Lattner
722272df41 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68149 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 22:11:05 +00:00
Anton Korobeynikov
48738b9244 Fix infinite looping
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68034 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 15:28:21 +00:00
Anton Korobeynikov
fd653071b5 Properly propagate Kind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68033 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 15:28:00 +00:00
Anton Korobeynikov
ab267a2823 Extend the relocation tracker handler, so we can filter on different 'kinds' of relocations required.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68004 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 17:13:18 +00:00
Gabor Greif
d257f7d96b "ghostify" the ilist<Function> sentinel
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67872 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-27 22:28:33 +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
Dan Gohman
f871ccb853 Now that errs() is properly non-buffered, there's no need to
explicitly flush it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67526 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 15:57:19 +00:00
Chris Lattner
8c7f24a36a add a fastpath to ConstantExpr::getBitCast to handle the case when an obviously
unneeded bitcast is requested.  This is common for frontends who just unconditionally
cast even if the target is often the right type already.  THis prevents going into
getFoldedCast which switches on the opcode and does a bunch of other stuff before
doing the same opzn.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67435 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-21 06:55:54 +00:00
Nick Lewycky
042348343e Fix a couple glaring whitespace issues. This file isn't internally consistent
either.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67288 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-19 06:31:22 +00:00
Gabor Greif
e14ad7220d typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67080 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 11:38:29 +00:00
Nick Lewycky
57174886c9 Simplify. "Broken" is always true here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67025 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-15 06:40:32 +00:00
Nick Lewycky
34a408639f Remove obviously redundant call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67023 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-15 06:39:52 +00:00
Dan Gohman
c131793904 Apply a patch by Micah Villmow to fix AsmParser to accept vector
shift constant expressions, and add support for folding vector
shift constant expressions. This fixes PR3802.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67010 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-14 17:09:17 +00:00
Bill Wendling
9a507cd915 Revert r66920. It was causing failures in the self-hosting buildbot (in release
mode).

Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/dg.exp ...
FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes > /dev/null
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
6   bugpoint          0x00000004 start + 18446744073709543220
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes 

FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
6   bugpoint          0x00000006 start + 18446744073709543222
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes 

FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll  -bugpoint-crashcalls -silence-passes
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll -bugpoint-crashcalls -silence-passes 

--- Reverse-merging (from foreign repository) r66920 into '.':
U    include/llvm/Support/CallSite.h
U    include/llvm/Instructions.h
U    lib/Analysis/IPA/GlobalsModRef.cpp
U    lib/Analysis/IPA/Andersens.cpp
U    lib/Bitcode/Writer/BitcodeWriter.cpp
U    lib/VMCore/Instructions.cpp
U    lib/VMCore/Verifier.cpp
U    lib/VMCore/AsmWriter.cpp
U    lib/Transforms/Utils/LowerInvoke.cpp
U    lib/Transforms/Scalar/SimplifyCFGPass.cpp
U    lib/Transforms/IPO/PruneEH.cpp
U    lib/Transforms/IPO/DeadArgumentElimination.cpp



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 21:15:59 +00:00
Gabor Greif
b14cda3c0d Second installment of "BasicBlock operands to the back"
changes.

For InvokeInst now all arguments begin at op_begin().
The Callee, Cont and Fail are now faster to get by
access relative to op_end().

This patch introduces some temporary uglyness in CallSite.
Next I'll bring CallInst up to a similar scheme and then
the uglyness will magically vanish.

This patch also exposes all the reliance of the libraries
on InvokeInst's operand ordering. I am thinking of taking
care of that too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66920 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 18:27:29 +00:00
Gabor Greif
ae5a20a917 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66815 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 18:34:49 +00:00
Duncan Sands
4dc2b39bf8 It makes no sense to have a ODR version of common
linkage, so remove it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66690 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 20:14:15 +00:00
Duncan Sands
5f4ee1fc5d Remove the one-definition-rule version of extern_weak
linkage: this linkage type only applies to declarations,
but ODR is only relevant to globals with definitions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66650 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 08:08:06 +00:00
Dan Gohman
ac57b128c4 Use WriteAsOperand instead of manually decorating the name for this
debug output. This improves the printing of anonymous values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66561 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 18:47:59 +00:00
Chris Lattner
319e63234a make GlobalValue::removeDeadConstantUsers() const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66403 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 05:50:45 +00:00
Chris Lattner
bce6091d95 fix Analysis/BasicAA/2004-12-08-BasicAACrash.ll by allowing opaque types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66395 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 04:56:22 +00:00
Chris Lattner
c66996ab34 Fix PR3746 - Crash in isel with GEP of function pointer
by checking that the top-level type of a gep is sized. This
causes us to reject the example with:

llvm-as: t2.ll:2:16: invalid getelementptr indices
getelementptr i32()* null, i32 1
              ^



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66393 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 04:46:40 +00:00
Chris Lattner
cf1bb08368 fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66367 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 04:06:26 +00:00