forked from OSchip/llvm-project
[NFC] Generalize getIslCompatibleName interface.
llvm-svn: 229877
This commit is contained in:
parent
8bc34f4d96
commit
3a7e812c66
|
@ -72,8 +72,13 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
|
|||
}
|
||||
|
||||
/// @brief Return @p Prefix + @p Val->getName() + @p Suffix but Isl compatible.
|
||||
std::string getIslCompatibleName(std::string Prefix, const llvm::Value *Val,
|
||||
std::string Suffix);
|
||||
std::string getIslCompatibleName(const std::string &Prefix,
|
||||
const llvm::Value *Val,
|
||||
const std::string &Suffix);
|
||||
|
||||
std::string getIslCompatibleName(const std::string &Prefix,
|
||||
const std::string &Middle,
|
||||
const std::string &Suffix);
|
||||
|
||||
} // end namespace polly
|
||||
|
||||
|
|
|
@ -136,15 +136,21 @@ static void makeIslCompatible(std::string &str) {
|
|||
replace(str, "\"", "_");
|
||||
}
|
||||
|
||||
std::string polly::getIslCompatibleName(std::string Prefix, const Value *Val,
|
||||
std::string Suffix) {
|
||||
std::string polly::getIslCompatibleName(const std::string &Prefix,
|
||||
const std::string &Middle,
|
||||
const std::string &Suffix) {
|
||||
std::string S = Prefix + Middle + Suffix;
|
||||
makeIslCompatible(S);
|
||||
return S;
|
||||
}
|
||||
|
||||
std::string polly::getIslCompatibleName(const std::string &Prefix, const Value *Val,
|
||||
const std::string &Suffix) {
|
||||
std::string ValStr;
|
||||
raw_string_ostream OS(ValStr);
|
||||
Val->printAsOperand(OS, false);
|
||||
ValStr = OS.str();
|
||||
// Remove the leading %
|
||||
ValStr.erase(0, 1);
|
||||
ValStr = Prefix + ValStr + Suffix;
|
||||
makeIslCompatible(ValStr);
|
||||
return ValStr;
|
||||
return getIslCompatibleName(Prefix, ValStr, Suffix);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue