Commit Graph

47 Commits

Author SHA1 Message Date
Benjamin Kramer
fd8d62c0b4 Fix use after free when deleting attributes in a chained folding set.
Can't follow the intrusive linked list when the element is gone.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165898 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-14 08:48:40 +00:00
Bill Wendling
2c79ecbd70 Initial commit for the AttributesImpl class.
This opaque class will contain all of the attributes. All attribute queries will
go through this object. This object will also be uniqued in the LLVMContext.
Currently not used, so no implementation change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164722 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-26 21:07:29 +00:00
Talin
2cb395eae7 Efficient Constant Uniquing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149848 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-05 20:54:10 +00:00
Chris Lattner
27dd9cf5d1 start the implementation of a new ConstantDataVector and ConstantDataArray
classes, per PR1324.  Not all of their helper functions are implemented,
nothing creates them, and the rest of the compiler doesn't handle them yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148741 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-23 22:57:10 +00:00
Chris Lattner
9df0fb4e81 convert CAZ, UndefValue, and CPN to use DenseMap's again, this time without
using OwningPtr.  OwningPtr would barf when the densemap had to reallocate,
which doesn't appear to happen on the regression test suite, but obviously
happens in real life :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148700 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-23 15:20:12 +00:00
Chris Lattner
95889fa9c3 revert r148691 and 148693
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148698 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-23 15:09:44 +00:00
Chris Lattner
3755615411 switch UndefValue and ConstantPointerNull over to DenseMap's for uniquing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148693 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-23 08:52:32 +00:00
Chris Lattner
2a82d82936 Replace a use of ConstantUniqueMap for CAZ constants with a simple DenseMap.
Now that the type system rewrite has landed, there is no need for its
complexity and std::map'ness.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148691 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-23 08:42:38 +00:00
David Blaikie
2d24e2a396 Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146960 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-20 02:50:00 +00:00
Dan Gohman
ce16339930 The powers that be have decided that LLVM IR should now support 16-bit
"half precision" floating-point with a first-class type.

This patch adds basic IR support (but not codegen support).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146786 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-17 00:04:22 +00:00
Chris Lattner
ba3ddf391f bump pointer allocate LLVM IR types, since they are never deallocated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135248 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 05:49:15 +00:00
Chris Lattner
c09ef37171 stop leaking all named struct types with an empty name. Thanks
to Benjamin Kramer for steering me in the right direction here.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135031 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 04:22:39 +00:00
Nick Lewycky
1852e21701 TypeMap had a destructor that destroyed the types it held. DenseMap did not, so
destroy those types in ~LLVMContext.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134945 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-12 00:26:08 +00:00
Chris Lattner
1afcace3a3 Land the long talked about "type system rewrite" patch. This
patch brings numerous advantages to LLVM.  One way to look at it
is through diffstat:
 109 files changed, 3005 insertions(+), 5906 deletions(-)

Removing almost 3K lines of code is a good thing.  Other advantages
include:

1. Value::getType() is a simple load that can be CSE'd, not a mutating
   union-find operation.
2. Types a uniqued and never move once created, defining away PATypeHolder.
3. Structs can be "named" now, and their name is part of the identity that
   uniques them.  This means that the compiler doesn't merge them structurally
   which makes the IR much less confusing.
4. Now that there is no way to get a cycle in a type graph without a named
   struct type, "upreferences" go away.
5. Type refinement is completely gone, which should make LTO much MUCH faster
   in some common cases with C++ code.
6. Types are now generally immutable, so we can use "Type *" instead 
   "const Type *" everywhere.

Downsides of this patch are that it removes some functions from the C API,
so people using those will have to upgrade to (not yet added) new API.  
"LLVM 3.0" is the right time to do this.

There are still some cleanups pending after this, this patch is large enough
as-is.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134829 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 17:41:24 +00:00
Dan Gohman
9b0e47efc6 More SmallVectorImpls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116279 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-12 00:15:27 +00:00
Dale Johannesen
bb811a2445 Add X86 MMX type to bitcode and Type.
(The Ada bindings probably need it too, but all the
obvious places to change say "do not edit this file".)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113618 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 20:55:01 +00:00
Owen Anderson
30268be89d Clarify the ownership model of LLVMContext and Module. Namely, contexts own
modules are instantiated in them.  If the context is deleted, all of its owned
modules are also deleted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113374 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-08 18:03:32 +00:00
Chris Lattner
61c70e98ac remove unions from LLVM IR. They are severely buggy and not
being actively maintained, improved, or extended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112356 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 04:09:24 +00:00
Dan Gohman
b35798347e Fix a bunch of namespace polution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101376 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 17:08:50 +00:00
Chris Lattner
42a4ee0a35 give LLVMContext an inline asm diagnostic hook member.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100506 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-06 00:44:45 +00:00
Jeffrey Yasskin
c1dc067970 Free all Constants in ~LLVMConstantImpl. We avoid assertion failures
by dropping all references from all constants that can use other
constants before trying to destroy any of them.

I also had to free bugpoint's Module in ~BugDriver().



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99160 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-22 05:23:37 +00:00
Jeffrey Yasskin
b4cc66d7b7 Re-add the Metadata.h include to LLVMContextImpl.h so that MDNode is complete
where FoldingSet<MDNode> is instantiated.  Clang and MSVC complain; gcc
doesn't.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99147 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-21 22:08:41 +00:00
Jeffrey Yasskin
2f1efd639c Move the LLVMContextImpl implementation into a .cpp file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99146 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-21 21:17:34 +00:00
Owen Anderson
48b2f3e485 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78115 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-04 22:41:48 +00:00
Owen Anderson
d03eecd063 Privatize the last bit of Constant-creation state.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78097 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-04 20:25:11 +00:00
Edward O'Callaghan
7b4e503cdc One two many newlines at end of file LLVMContextImpl.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77911 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 20:06:26 +00:00
Edward O'Callaghan
079029b949 Fix no newline at end of LLVMContextImpl.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77907 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 19:38:12 +00:00
Owen Anderson
647e3016de Move the metadata constructors back to 2.5 syntax.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77733 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-31 21:35:40 +00:00
Owen Anderson
9e9a0d5fc2 Move more code back to 2.5 APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77635 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-30 23:03:37 +00:00
Devang Patel
0a9f7b9c3e Rename MDNode.h header. It defines MDnode and other metadata classes.
New name is Metadata.h.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77370 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 21:49:47 +00:00
Owen Anderson
af7ec97587 Return ConstantVector to 2.5 API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 21:19:26 +00:00
Owen Anderson
1fd7096407 Change ConstantArray to 2.5 API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77347 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 18:32:17 +00:00
Owen Anderson
8fa3338ed2 Move ConstantStruct back to 2.5 API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77266 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 22:29:26 +00:00
Owen Anderson
6f83c9c6ef Move ConstantFP construction back to the 2.5-ish API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77247 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 20:59:43 +00:00
Daniel Dunbar
03d7651c36 Remove Value::{isName, getNameRef}.
Also, change MDString to use a StringRef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77098 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-25 23:55:21 +00:00
Owen Anderson
eed707b1e6 Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77011 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 23:12:02 +00:00
Owen Anderson
5bd68393ed Privatize the ConstantVector tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76922 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 00:36:24 +00:00
Owen Anderson
006c77df8c Privatize the ConstantStruct table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76912 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 23:25:33 +00:00
Daniel Dunbar
6316fbcb04 Convert StringMap to using StringRef for its APIs.
- Yay for '-'s and simplifications!

 - I kept StringMap::GetOrCreateValue for compatibility purposes, this can
   eventually go away. Likewise the StringMapEntry Create functions still follow
   the old style.

 - NIFC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76888 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 18:17:34 +00:00
Devang Patel
2f9c3b002d MDString
- Rename member function size(). New name is length().
- Store string beginning and length. Earlier it used to store string end.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76841 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 02:00:51 +00:00
Devang Patel
104cf9e02b Derive MDNode from MetadataBase instead of Constant. Emit MDNodes into METADATA_BLOCK in bitcode file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76834 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 01:07:34 +00:00
Owen Anderson
822ccd9974 Privatize the ConstantArray table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76639 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-21 20:55:28 +00:00
Owen Anderson
16e298f980 Privatize the first of the value maps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76634 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-21 20:13:12 +00:00
Owen Anderson
ce032b483c Privatize the MDNode uniquing table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76126 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 23:44:30 +00:00
Owen Anderson
aad3fb7362 Privatize the MDString uniquing table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76113 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 22:11:26 +00:00
Owen Anderson
914e50c841 Privatize the ConstantFP table. I'm on a roll!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76097 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 19:05:41 +00:00
Owen Anderson
001dbfebcb Move the ConstantInt uniquing table into LLVMContextImpl. This exposed a number of issues in
our current context-passing stuff, which is also fixed here


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76089 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 18:04:31 +00:00