Commit Graph

62 Commits

Author SHA1 Message Date
Chris Lattner a0566979b7 Final step in the metadata API restructuring: move the
getMDKindID/getMDKindNames methods to LLVMContext (and add
convenience methods to Module), eliminating MetadataContext.
Move the state that it maintains out to LLVMContext.

llvm-svn: 92259
2009-12-29 09:01:33 +00:00
Jeffrey Yasskin 28f244863e This fixes a memory leak in OpaqueType found by Google's internal heapchecker.
llvm-svn: 91611
2009-12-17 19:55:06 +00:00
Chris Lattner 45d040bd85 Remove isPod() from DenseMapInfo, splitting it out to its own
isPodLike type trait.  This is a generally useful type trait for
more than just DenseMap, and we really care about whether something
acts like a pod, not whether it really is a pod.

llvm-svn: 91421
2009-12-15 07:26:43 +00:00
Chris Lattner 37536b90e1 remove a bunch of locking from LLVMContextImpl. Since only one thread
can be banging on a context at a time, this isn't needed.  Owen, please
review.

llvm-svn: 85728
2009-11-01 18:42:03 +00:00
Chris Lattner 31b132c0b7 IR support for the new BlockAddress constant kind. This is
untested and there is no way to use it, next up: doing battle
with asmparser.

llvm-svn: 85349
2009-10-28 00:01:44 +00:00
Jeffrey Yasskin f6ee7bea88 Rename lib/VMCore/ConstantsContext.h:ValueMap<> to ConstantUniqueMap<> to avoid
colliding with llvm/ADT/ValueMap.h:ValueMap<>.

llvm-svn: 85344
2009-10-27 23:45:55 +00:00
Devang Patel 27e0be274e Derive metadata hierarchy from Value instead of User.
llvm-svn: 84801
2009-10-21 23:57:35 +00:00
Owen Anderson 5dab84ca9c Banish ConstantsLock. It's serving no purpose other than slowing things down
at the moment.

llvm-svn: 84529
2009-10-19 20:11:52 +00:00
Devang Patel 2d85eef974 s/class Metadata/class MetadataContext/g
llvm-svn: 83019
2009-09-28 21:41:20 +00:00
Devang Patel d5497a4bf8 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
Devang Patel 5ffc3854f6 Fix whitespaces.
llvm-svn: 81468
2009-09-10 22:36:12 +00:00
Devang Patel 93056ec4e2 Gracefully destroy MDNodes.
llvm-svn: 81353
2009-09-09 17:07:07 +00:00
Devang Patel 926fc3d68d Remove dead code.
llvm-svn: 81235
2009-09-08 18:14:36 +00:00
Devang Patel f7188325ef Now Bitcode reader bug is fixed. Reapply 80839.
Use CallbackVH, instead of WeakVH, to hold MDNode elements.
Use FoldingSetNode to unique MDNodes in a context.
Use CallbackVH hooks to update context's MDNodeSet appropriately.

llvm-svn: 80868
2009-09-03 01:39:20 +00:00
Devang Patel c180029be4 Revert 80839 for now. It causes test failures.
llvm-svn: 80841
2009-09-02 21:49:26 +00:00
Devang Patel 36309cd391 Use CallbackVH, instead of WeakVH, to hold MDNode elements.
Use FoldingSetNode to unique MDNodes in a context.
Use CallbackVH hooks to update context's MDNodeSet appropriately.

llvm-svn: 80839
2009-09-02 21:22:09 +00:00
Devang Patel 8c7f86e698 For now disable MDNode uniquing. This fixes llvm-gcc bootstrap failure on certain Mac OS X 10.5. I am working on a proper fix.
llvm-svn: 80738
2009-09-01 23:56:42 +00:00
Torok Edwin d18e668fbc Free the constants that have no uses in ~LLVMContext.
This fixes leaks from LLVMContext in multithreaded apps.
Since constants are only deleted if they have no uses, it is safe to not delete
a Module on shutdown, as many single-threaded tools do.
Multithreaded apps should however delete the Module before destroying the
Context to ensure that there are no leaks (assuming they use a different context
for each thread).

llvm-svn: 80590
2009-08-31 16:14:59 +00:00
Dan Gohman 97d2cb8394 Allocate the basic types inside the LLVMContextImpl instance,
rather than separately with new. Move the members above the
TypeMap members to avoid destruction order issues. This fixes
a leak of these objects, and eliminates an extra level of
indirection in Type::getInt32Ty and friends.

llvm-svn: 79997
2009-08-25 16:00:35 +00:00
Owen Anderson 3fb4aabc06 Use standard LLVM-style headers.
llvm-svn: 79817
2009-08-23 04:24:24 +00:00
Owen Anderson 6d549d6450 Reapply my less-lock-contention-in-leak-detector patch, now with new files
actually added.

llvm-svn: 79429
2009-08-19 17:07:46 +00:00
Owen Anderson 077df2c4ce Revert my last patch temporarily.
llvm-svn: 79388
2009-08-19 00:52:13 +00:00
Owen Anderson 3042539089 Privatize part of the leak detector mechanism, which turned out to be heavily contended
when trying to run opt in parallel.  This lets parallel opt crunch 403.gcc in about a third
of the time.

llvm-svn: 79387
2009-08-19 00:37:02 +00:00
Owen Anderson e8f2185a2f 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 9801560ace Privatize the last bits of static type state.
llvm-svn: 79258
2009-08-17 17:59:35 +00:00
Owen Anderson 286b3af6ae Move the TypeMap lock to a member on LLVMContextImpl.
llvm-svn: 79256
2009-08-17 17:34:27 +00:00
Owen Anderson a42ac6953b Actually privatize a IntegerTypes, and fix a few bugs exposed by this.
llvm-svn: 78955
2009-08-13 23:27:32 +00:00
Benjamin Kramer 78c3bcb582 Make LLVMContext and LLVMContextImpl classes instead of structs.
llvm-svn: 78690
2009-08-11 17:45:13 +00:00
Devang Patel c5aa8c6d29 Remove dead metadata.
llvm-svn: 78651
2009-08-11 06:31:57 +00:00
Devang Patel 9b4ea1c474 Remove MDNode from ValueMap when MDNode is destroyed.
llvm-svn: 78612
2009-08-10 22:59:46 +00:00
Devang Patel 2c6c743039 Rename MDNodeSet as MDNodes.
llvm-svn: 78607
2009-08-10 22:31:31 +00:00
Owen Anderson 13234f83ac Change the MDNode uniquing to a ValueMap, at Devang's request.
llvm-svn: 78577
2009-08-10 18:16:08 +00:00
Owen Anderson 03cb69fbd1 Privatize the StructType table, which unfortunately involves routing contexts through a number of APIs.
llvm-svn: 78258
2009-08-05 23:16:16 +00:00
Owen Anderson 4b5c761af2 Privatize the FunctionType table.
llvm-svn: 78221
2009-08-05 18:13:27 +00:00
Owen Anderson e565995c65 Privatize the PointerType factory.
llvm-svn: 78130
2009-08-05 00:15:12 +00:00
Owen Anderson d918649d5f Privatize the VectorType uniquing.
llvm-svn: 78125
2009-08-04 23:47:44 +00:00
Owen Anderson 542cffc3eb Begin the process of privatizing the type uniquing tables. No API changes yet, but there will be in the near future.
llvm-svn: 78122
2009-08-04 23:33:01 +00:00
Owen Anderson afd0c4cd56 Factor some of the constants+context related code out into a separate header, to make LLVMContextImpl.h
not hideous.  Also, fix some MSVC compile errors.

llvm-svn: 78115
2009-08-04 22:41:48 +00:00
Owen Anderson 1584a29536 Privatize the last bit of Constant-creation state.
llvm-svn: 78097
2009-08-04 20:25:11 +00:00
Owen Anderson c8c302644c Privatize all but one of the remaining constant tables.
llvm-svn: 77748
2009-07-31 22:45:43 +00:00
Owen Anderson 0087fe6e5c Move the metadata constructors back to 2.5 syntax.
llvm-svn: 77733
2009-07-31 21:35:40 +00:00
Owen Anderson 23a204d91b Move getTrue() and getFalse() to 2.5-like APIs.
llvm-svn: 77685
2009-07-31 17:39:07 +00:00
Owen Anderson b292b8ce70 Move more code back to 2.5 APIs.
llvm-svn: 77635
2009-07-30 23:03:37 +00:00
Owen Anderson 487375e9a2 Move ConstantExpr to 2.5 API.
llvm-svn: 77494
2009-07-29 18:55:55 +00:00
Owen Anderson 4aa3295a65 Return ConstantVector to 2.5 API.
llvm-svn: 77366
2009-07-28 21:19:26 +00:00
Owen Anderson c2c7932c64 Change ConstantArray to 2.5 API.
llvm-svn: 77347
2009-07-28 18:32:17 +00:00
Owen Anderson 45308b578b Move ConstantStruct back to 2.5 API.
llvm-svn: 77266
2009-07-27 22:29:26 +00:00
Owen Anderson 69c464dec4 Move ConstantFP construction back to the 2.5-ish API.
llvm-svn: 77247
2009-07-27 20:59:43 +00:00
Owen Anderson edb4a70325 Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
llvm-svn: 77011
2009-07-24 23:12:02 +00:00
Owen Anderson 0348a13cc6 Privatize the ConstantVector tables.
llvm-svn: 76922
2009-07-24 00:36:24 +00:00