Add LLVMGetName() utility routines.

Infrastructure for issue #244.
This commit is contained in:
Matt Pharr
2012-04-19 16:24:40 -07:00
parent cb9f50ef63
commit 71bdc67a45
2 changed files with 27 additions and 0 deletions

View File

@@ -1552,3 +1552,24 @@ LLVMShuffleVectors(llvm::Value *v1, llvm::Value *v2, int32_t shuf[],
return new llvm::ShuffleVectorInst(v1, v2, vec, "shuffle", insertBefore);
}
const char *
LLVMGetName(llvm::Value *v, const char *s) {
if (v == NULL) return s;
std::string ret = v->getName();
ret += s;
return strdup(ret.c_str());
}
const char *
LLVMGetName(const char *op, llvm::Value *v1, llvm::Value *v2) {
std::string r = op;
r += "_";
r += v1->getName().str();
r += "_";
r += v2->getName().str();
return strdup(r.c_str());
}