Chris Lattner
f543eff71c
rearrange some methods, no functionality change.
...
llvm-svn: 92219
2009-12-28 09:12:35 +00:00
Chris Lattner
d944cf76de
avoid temporary CallbackVH's.
...
llvm-svn: 92218
2009-12-28 09:10:16 +00:00
Chris Lattner
588096e51d
Rewrite the function-local validation logic for MDNodes (most of r91708).
...
Among other benefits, this doesn't leak the SmallPtrSet, has the verifier
code in the verifier pass, actually does the verification at the end,
and is considerably simpler.
llvm-svn: 92217
2009-12-28 09:07:21 +00:00
Chris Lattner
66a4c3d084
rename MDNode instance variables to something meaningful.
...
llvm-svn: 92216
2009-12-28 08:48:12 +00:00
Chris Lattner
5a409bd17a
snip one more #include from Metadata.h
...
llvm-svn: 92214
2009-12-28 08:30:43 +00:00
Chris Lattner
1300f45ba9
prune some #includes
...
llvm-svn: 92212
2009-12-28 08:24:16 +00:00
Chris Lattner
53bb5e4ae0
change the strange MetadataContext::getMDs function to expose less
...
irrelevant internal implementation details to clients.
llvm-svn: 92210
2009-12-28 08:14:54 +00:00
Chris Lattner
1bc810bb89
change NamedMDNode to use a pimpl for its operand list instead
...
of making it a declared part of the value.
llvm-svn: 92209
2009-12-28 08:07:14 +00:00
Chris Lattner
74a6ad6f29
move ElementVH out of the MDNode class into the MDNode.cpp file. Among
...
other things, this avoids vtable and rtti data for it being splatted in
every translation unit that uses it.
llvm-svn: 92207
2009-12-28 07:41:54 +00:00
Eli Friedman
3a7cdaca33
Fix gcc warning.
...
llvm-svn: 91715
2009-12-18 21:07:18 +00:00
Victor Hernandez
0471abd58b
Formalize MDNode's function-localness:
...
- an MDNode is designated as function-local when created, and continues to be even if its operands are modified not to refer to function-local IR
- function-localness is designated via lowest bit in SubclassData
- getLocalFunction() descends MDNode tree to see if it is consistently function-local
Add verification of MDNodes to checks that MDNodes are consistently function-local.
Update AsmWriter to use isFunctionLocal().
llvm-svn: 91708
2009-12-18 20:09:14 +00:00
Victor Hernandez
2003b90807
Use different name for argument and field
...
llvm-svn: 91524
2009-12-16 08:10:57 +00:00
Victor Hernandez
dd7418ae3f
MDNodes that refer to an instruction are local to a function; in that case, explicitly keep track of the function they are local to
...
llvm-svn: 91497
2009-12-16 02:52:09 +00:00
Nick Lewycky
6e0525141f
Oops! Fix bug introduced in my recent cleanup change. Thanks to Tobias Grosser
...
for pointing this out.
llvm-svn: 90015
2009-11-27 19:57:53 +00:00
Nick Lewycky
a75fe185ba
Fix typo spotted by Gabor Greif.
...
llvm-svn: 89976
2009-11-26 23:19:05 +00:00
Nick Lewycky
898e8f756a
Clean up file, no functionality change.
...
llvm-svn: 89974
2009-11-26 22:54:26 +00:00
Devang Patel
862ef782de
Do not use StringRef in DebugInfo interface.
...
This allows StringRef to skip controversial if(str) check in constructor.
Buildbots, wait for corresponding clang and llvm-gcc FE check-ins!
llvm-svn: 86914
2009-11-12 00:50:58 +00:00
Jeffrey Yasskin
b40d3f76a0
Fix DenseMap iterator constness.
...
This patch forbids implicit conversion of DenseMap::const_iterator to
DenseMap::iterator which was possible because DenseMapIterator inherited
(publicly) from DenseMapConstIterator. Conversion the other way around is now
allowed as one may expect.
The template DenseMapConstIterator is removed and the template parameter
IsConst which specifies whether the iterator is constant is added to
DenseMapIterator.
Actually IsConst parameter is not necessary since the constness can be
determined from KeyT but this is not relevant to the fix and can be addressed
later.
Patch by Victor Zverovich!
llvm-svn: 86636
2009-11-10 01:02:17 +00:00
Devang Patel
d6dd2a0840
Do not use expensive sort().
...
llvm-svn: 85130
2009-10-26 17:09:00 +00:00
Devang Patel
1155fdf6dc
Hide MetadataContext implementation details.
...
llvm-svn: 84886
2009-10-22 19:36:54 +00:00
Devang Patel
6da5dbf3c2
Fix getMDs() interface such that it does not expose implementation details.
...
llvm-svn: 84885
2009-10-22 18:55:16 +00:00
Devang Patel
084679e70a
Using TrackingVH instead of WeakVH or WeakMetadataVH.
...
llvm-svn: 84884
2009-10-22 18:25:28 +00:00
Devang Patel
09c319e269
Sort handler names to ensure deterministic behavior.
...
llvm-svn: 84878
2009-10-22 17:40:37 +00:00
Devang Patel
0fffb49d56
Fix getHandlerNames() interface. Now it populate clinet supplied small vector with handler names.
...
llvm-svn: 84820
2009-10-22 01:01:24 +00:00
Devang Patel
6746d43a3f
Use StringRef to construct MDString.
...
llvm-svn: 84811
2009-10-22 00:22:05 +00:00
Devang Patel
dcb99d310a
Remove meaningless const.
...
Pass StringRef by value.
llvm-svn: 84804
2009-10-22 00:10:15 +00:00
Devang Patel
27e0be274e
Derive metadata hierarchy from Value instead of User.
...
llvm-svn: 84801
2009-10-21 23:57:35 +00:00
Benjamin Kramer
8b051b8240
Fix thinko noticed by Chris.
...
llvm-svn: 84797
2009-10-21 23:29:32 +00:00
Benjamin Kramer
22146fbc5f
Remove pointless return; at end of function.
...
llvm-svn: 84794
2009-10-21 23:27:54 +00:00
Benjamin Kramer
b378347796
Simplify code. No intended functionality change.
...
llvm-svn: 84790
2009-10-21 22:55:51 +00:00
Devang Patel
2505c1e17a
Use StringRef.
...
llvm-svn: 84786
2009-10-21 21:57:13 +00:00
Devang Patel
49914e6eb3
Do not use SmallVector to store MDNode elements.
...
llvm-svn: 84784
2009-10-21 21:25:09 +00:00
Devang Patel
3eb5d33b65
Incorporate various suggestions Chris gave during metadata review.
...
- i < getNumElements() instead of getNumElements() > i
- Make setParent() private
- Fix use of resizeOperands
- Reset HasMetadata bit after removing all metadata attached to an instruction
- Efficient use of iterators
llvm-svn: 84765
2009-10-21 17:33:41 +00:00
Devang Patel
0c35dbdf03
Cosmetic changes.
...
s/validName/isValidName/g
s/with an Instruction/to an Instruction/g
s/RegisterMDKind/registerMDKind/g
llvm-svn: 84689
2009-10-20 22:50:27 +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
Chris Lattner
b0c23e81e7
various cleanups.
...
llvm-svn: 84471
2009-10-19 07:10:59 +00:00
Devang Patel
ebaa76ed0d
Add copyMD to copy metadata from one instruction to another instruction.
...
llvm-svn: 84113
2009-10-14 17:02:49 +00:00
Devang Patel
e6f26a7415
Copy metadata when value is RAUW'd. It is debatable whether this is the right approach for custom metadata data in general. However, right now the only custom data user, "dbg", expects this behavior while FE is constructing llvm IR with debug info.
...
llvm-svn: 83977
2009-10-13 17:00:54 +00:00
Devang Patel
7b4d52b170
Lookup handler name only when assertions are enabled.
...
llvm-svn: 83114
2009-09-29 22:05:52 +00:00
Devang Patel
b4034364d6
Add removeMD().
...
llvm-svn: 83107
2009-09-29 20:42:25 +00:00
Devang Patel
5bf7a49fd7
Only one custom meadata of each kind can be attached with an instruction.
...
llvm-svn: 83105
2009-09-29 20:30:57 +00:00
Devang Patel
561977940c
Use assertion instead of early exit to catch malformed custom metadata store.
...
llvm-svn: 83102
2009-09-29 20:01:19 +00:00
Devang Patel
ba4a6fdd17
Parse custom metadata attached with an instruction.
...
llvm-svn: 83033
2009-09-29 00:01:14 +00:00
Devang Patel
2d85eef974
s/class Metadata/class MetadataContext/g
...
llvm-svn: 83019
2009-09-28 21:41:20 +00:00
Devang Patel
b1a4477f1f
Do not use global typedef for MDKindID.
...
llvm-svn: 83016
2009-09-28 21:14:55 +00:00
Devang Patel
add586526e
Do not leave behind metadata while cloning an instruction.
...
llvm-svn: 82638
2009-09-23 18:32:25 +00:00
Devang Patel
af206b8c88
Write and read metadata attachments.
...
llvm-svn: 82259
2009-09-18 19:26:43 +00:00
Devang Patel
dec23fd825
Print debug info attached with an instruction.
...
llvm-svn: 82075
2009-09-16 20:21:17 +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
cbde073d8c
Take lock before removing a node from MDNodeSet.
...
llvm-svn: 81356
2009-09-09 17:44:26 +00:00
Devang Patel
9a767cb5c0
Enable MDNode uniquing.
...
llvm-svn: 81355
2009-09-09 17:30:04 +00:00
Daniel Dunbar
10fcf3354b
Disable MDNode uniquing.
...
- Hopefully this unbreaks some llvm-gcc bootstraps.
llvm-svn: 81141
2009-09-07 04:05:49 +00:00
Devang Patel
a33c5a922d
While replacing an MDNode elment, properly update MDNode's operand list.
...
MDNode's operand list does not include all elements.
llvm-svn: 81045
2009-09-04 21:32:05 +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
Devang Patel
7b8f61f3c8
Remove an entry from ValueMap before removing elements.
...
llvm-svn: 80247
2009-08-27 15:32:38 +00:00
Devang Patel
f08e35d9dc
Revert 79977. It causes llvm-gcc bootstrap failures on some platforms.
...
llvm-svn: 80073
2009-08-26 05:01:18 +00:00
Devang Patel
02aac922b4
Update DebugInfo interface to use metadata, instead of special named llvm.dbg.... global variables, to encode debugging information in llvm IR. This is mostly a mechanical change that tests metadata support very well.
...
This change speeds up llvm-gcc by more then 6% at "-O0 -g" (measured by compiling InstructionCombining.cpp!)
llvm-svn: 79977
2009-08-25 05:24:07 +00:00
Owen Anderson
55f1c09e31
Push LLVMContexts through the IntegerType APIs.
...
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Devang Patel
5c310be0ff
Link NamedMDNodes.
...
llvm-svn: 78696
2009-08-11 18:01:24 +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
Devang Patel
0bdbee14cd
We are not using FoldingSet for metadata uniquing anymore.
...
llvm-svn: 78585
2009-08-10 18:59:07 +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
Devang Patel
d7fd6aba7c
Keep track of metadata used by other metadata.
...
llvm-svn: 78012
2009-08-03 22:51:10 +00:00
Devang Patel
79238d7e6b
Add NamedMDNode destructor.
...
llvm-svn: 77959
2009-08-03 06:19:01 +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
Benjamin Kramer
5656e4fcd3
fix a unitialized pointer in NamedMDNode (and reenable unittest)
...
llvm-svn: 77597
2009-07-30 15:35:55 +00:00
Devang Patel
4a942d0863
There is no need to keep name ref in NamedMDNode.
...
llvm-svn: 77511
2009-07-29 21:58:56 +00:00
Devang Patel
18dfdc99af
Keep track of named mdnodes in a Module using an ilist.
...
llvm-svn: 77476
2009-07-29 17:16:17 +00:00
Devang Patel
05a26fb6dd
Add NamedMDNode.
...
llvm-svn: 77409
2009-07-29 00:33:07 +00:00
Devang Patel
f869caa03f
Remove unused method.
...
llvm-svn: 77378
2009-07-28 22:04:55 +00:00
Devang Patel
a4f43fb5dd
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