[PATCH] D54252: [llvm-exegesis][NFC] Add missing header guard + cosmetics.

Clement Courbet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 8 02:46:03 PST 2018


courbet created this revision.
courbet added a reviewer: gchatelet.
Herald added a subscriber: tschuett.

Repository:
  rL LLVM

https://reviews.llvm.org/D54252

Files:
  tools/llvm-exegesis/lib/RegisterValue.h
  tools/llvm-exegesis/lib/SnippetGenerator.cpp


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);
         }
       }
Index: tools/llvm-exegesis/lib/RegisterValue.h
===================================================================
--- tools/llvm-exegesis/lib/RegisterValue.h
+++ tools/llvm-exegesis/lib/RegisterValue.h
@@ -14,14 +14,18 @@
 ///
 //===----------------------------------------------------------------------===//
 
+#ifndef LLVM_TOOLS_LLVM_EXEGESIS_REGISTERVALUE_H
+#define LLVM_TOOLS_LLVM_EXEGESIS_REGISTERVALUE_H
+
 #include <llvm/ADT/APFloat.h>
 #include <llvm/ADT/APInt.h>
 
 namespace llvm {
 namespace exegesis {
 
 // 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54252.173136.patch
Type: text/x-patch
Size: 1372 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181108/b2c1c587/attachment.bin>


More information about the llvm-commits mailing list