#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
-#if !defined(_MSC_VER)
-#include <cxxabi.h>
-#endif
#include <set>
#include <sstream>
// count at the scope entry.
};
-inline raw_ostream LLVM_ATTRIBUTE_UNUSED &operator<<(raw_ostream &OS,
- const CHRStats &Stats) {
- Stats.print(OS);
- return OS;
-}
-
// RegInfo - some properties of a Region.
struct RegInfo {
RegInfo() : R(nullptr), HasBranch(false) {}
: RegInfos(RegInfosIn), Subs(SubsIn), BranchInsertPoint(nullptr) {}
};
-inline raw_ostream &operator<<(raw_ostream &OS, const CHRScope &Scope) {
- Scope.print(OS);
- return OS;
-}
-
class CHR {
public:
CHR(Function &Fin, BlockFrequencyInfo &BFIin, DominatorTree &DTin,
} // end anonymous namespace
+static inline
+raw_ostream LLVM_ATTRIBUTE_UNUSED &operator<<(raw_ostream &OS,
+ const CHRStats &Stats) {
+ Stats.print(OS);
+ return OS;
+}
+
+static inline
+raw_ostream &operator<<(raw_ostream &OS, const CHRScope &Scope) {
+ Scope.print(OS);
+ return OS;
+}
+
static bool shouldApply(Function &F, ProfileSummaryInfo& PSI) {
if (ForceCHR)
return true;
if (!CHRModuleList.empty() || !CHRFunctionList.empty()) {
if (CHRModules.count(F.getParent()->getName()))
return true;
- StringRef Name = F.getName();
- if (CHRFunctions.count(Name))
- return true;
- const char* DemangledName = nullptr;
-#if !defined(_MSC_VER)
- int Status = -1;
- DemangledName = abi::__cxa_demangle(Name.str().c_str(),
- nullptr, nullptr, &Status);
-#endif
- return DemangledName && CHRFunctions.count(DemangledName);
+ return CHRFunctions.count(F.getName());
}
assert(PSI.hasProfileSummary() && "Empty PSI?");
static void LLVM_ATTRIBUTE_UNUSED dumpIR(Function &F, const char *Label,
CHRStats *Stats) {
- std::string Name = F.getName().str();
- const char *DemangledName = nullptr;
-#if !defined(_MSC_VER)
- int Status = -1;
- DemangledName = abi::__cxa_demangle(Name.c_str(),
- nullptr, nullptr, &Status);
-#endif
- if (DemangledName == nullptr) {
- DemangledName = "<NOT-MANGLED>";
- }
- std::string ModuleName = F.getParent()->getName().str();
+ StringRef FuncName = F.getName();
+ StringRef ModuleName = F.getParent()->getName();
CHR_DEBUG(dbgs() << "CHR IR dump " << Label << " " << ModuleName << " "
- << Name);
+ << FuncName);
if (Stats)
CHR_DEBUG(dbgs() << " " << *Stats);
CHR_DEBUG(dbgs() << "\n");