[llvm-commits] [llvm] r145934 - in /llvm/trunk: include/llvm/Instruction.h lib/AsmParser/LLParser.cpp lib/Transforms/Scalar/LICM.cpp lib/VMCore/Metadata.cpp
Benjamin Kramer
benny.kra at googlemail.com
Tue Dec 6 03:50:26 PST 2011
Author: d0k
Date: Tue Dec 6 05:50:26 2011
New Revision: 145934
URL: http://llvm.org/viewvc/llvm-project?rev=145934&view=rev
Log:
Push StringRefs through the metadata interface.
Modified:
llvm/trunk/include/llvm/Instruction.h
llvm/trunk/lib/AsmParser/LLParser.cpp
llvm/trunk/lib/Transforms/Scalar/LICM.cpp
llvm/trunk/lib/VMCore/Metadata.cpp
Modified: llvm/trunk/include/llvm/Instruction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instruction.h?rev=145934&r1=145933&r2=145934&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instruction.h (original)
+++ llvm/trunk/include/llvm/Instruction.h Tue Dec 6 05:50:26 2011
@@ -143,7 +143,7 @@
/// getMetadata - Get the metadata of given kind attached to this Instruction.
/// If the metadata is not found then return null.
- MDNode *getMetadata(const char *Kind) const {
+ MDNode *getMetadata(StringRef Kind) const {
if (!hasMetadata()) return 0;
return getMetadataImpl(Kind);
}
@@ -168,7 +168,7 @@
/// node. This updates/replaces metadata if already present, or removes it if
/// Node is null.
void setMetadata(unsigned KindID, MDNode *Node);
- void setMetadata(const char *Kind, MDNode *Node);
+ void setMetadata(StringRef Kind, MDNode *Node);
/// setDebugLoc - Set the debug location information for this instruction.
void setDebugLoc(const DebugLoc &Loc) { DbgLoc = Loc; }
@@ -185,7 +185,7 @@
// These are all implemented in Metadata.cpp.
MDNode *getMetadataImpl(unsigned KindID) const;
- MDNode *getMetadataImpl(const char *Kind) const;
+ MDNode *getMetadataImpl(StringRef Kind) const;
void getAllMetadataImpl(SmallVectorImpl<std::pair<unsigned,MDNode*> > &)const;
void getAllMetadataOtherThanDebugLocImpl(SmallVectorImpl<std::pair<unsigned,
MDNode*> > &) const;
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=145934&r1=145933&r2=145934&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Tue Dec 6 05:50:26 2011
@@ -1064,7 +1064,7 @@
return TokError("expected metadata after comma");
std::string Name = Lex.getStrVal();
- unsigned MDK = M->getMDKindID(Name.c_str());
+ unsigned MDK = M->getMDKindID(Name);
Lex.Lex();
MDNode *Node;
Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=145934&r1=145933&r2=145934&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Tue Dec 6 05:50:26 2011
@@ -379,7 +379,7 @@
// in the same alias set as something that ends up being modified.
if (AA->pointsToConstantMemory(LI->getOperand(0)))
return true;
- if (LI->getMetadata(LI->getContext().getMDKindID("invariant.load")))
+ if (LI->getMetadata("invariant.load"))
return true;
// Don't hoist loads which have may-aliased stores in loop.
Modified: llvm/trunk/lib/VMCore/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=145934&r1=145933&r2=145934&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Metadata.cpp (original)
+++ llvm/trunk/lib/VMCore/Metadata.cpp Tue Dec 6 05:50:26 2011
@@ -425,12 +425,12 @@
// Instruction Metadata method implementations.
//
-void Instruction::setMetadata(const char *Kind, MDNode *Node) {
+void Instruction::setMetadata(StringRef Kind, MDNode *Node) {
if (Node == 0 && !hasMetadata()) return;
setMetadata(getContext().getMDKindID(Kind), Node);
}
-MDNode *Instruction::getMetadataImpl(const char *Kind) const {
+MDNode *Instruction::getMetadataImpl(StringRef Kind) const {
return getMetadataImpl(getContext().getMDKindID(Kind));
}
More information about the llvm-commits
mailing list