21
llvmutil.cpp
21
llvmutil.cpp
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -290,4 +290,10 @@ extern llvm::Value *LLVMShuffleVectors(llvm::Value *v1, llvm::Value *v2,
|
||||
int32_t shuf[], int shufSize,
|
||||
llvm::Instruction *insertBefore);
|
||||
|
||||
/** Utility routines to concat strings with the names of existing values to
|
||||
create meaningful new names for instruction values.
|
||||
*/
|
||||
extern const char *LLVMGetName(llvm::Value *v, const char *);
|
||||
extern const char *LLVMGetName(const char *op, llvm::Value *v1, llvm::Value *v2);
|
||||
|
||||
#endif // ISPC_LLVMUTIL_H
|
||||
|
||||
Reference in New Issue
Block a user