Index: tools/llvm-exegesis/lib/RegisterValue.h =================================================================== --- tools/llvm-exegesis/lib/RegisterValue.h +++ tools/llvm-exegesis/lib/RegisterValue.h @@ -14,6 +14,9 @@ /// //===----------------------------------------------------------------------===// +#ifndef LLVM_TOOLS_LLVM_EXEGESIS_REGISTERVALUE_H +#define LLVM_TOOLS_LLVM_EXEGESIS_REGISTERVALUE_H + #include #include @@ -22,6 +25,7 @@ // A simple object storing the value for a particular register. struct RegisterValue { + static RegisterValue zero(unsigned Reg) { return {Reg, llvm::APInt()}; } unsigned Register; llvm::APInt Value; }; @@ -45,3 +49,5 @@ } // namespace exegesis } // namespace llvm + +#endif // LLVM_TOOLS_LLVM_EXEGESIS_REGISTERVALUE_H Index: tools/llvm-exegesis/lib/SnippetGenerator.cpp =================================================================== --- tools/llvm-exegesis/lib/SnippetGenerator.cpp +++ tools/llvm-exegesis/lib/SnippetGenerator.cpp @@ -91,7 +91,7 @@ if (Op.isUse()) { const unsigned Reg = GetOpReg(Op); if (Reg > 0 && !DefinedRegs.test(Reg)) { - RIV.push_back(RegisterValue{Reg, llvm::APInt()}); + RIV.push_back(RegisterValue::zero(Reg)); DefinedRegs.set(Reg); } }