[llvm] r309761 - Assert that the offset of a MachineLocation is always 0.

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 15:57:05 PDT 2017


Author: adrian
Date: Tue Aug  1 15:57:05 2017
New Revision: 309761

URL: http://llvm.org/viewvc/llvm-project?rev=309761&view=rev
Log:
Assert that the offset of a MachineLocation is always 0.
This is to convince me that it may safely be removed in a follow-up commit.

rdar://problem/33580047

Modified:
    llvm/trunk/include/llvm/MC/MachineLocation.h

Modified: llvm/trunk/include/llvm/MC/MachineLocation.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MachineLocation.h?rev=309761&r1=309760&r2=309761&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MachineLocation.h (original)
+++ llvm/trunk/include/llvm/MC/MachineLocation.h Tue Aug  1 15:57:05 2017
@@ -16,6 +16,7 @@
 #define LLVM_MC_MACHINELOCATION_H
 
 #include <cstdint>
+#include <cassert>
 
 namespace llvm {
 
@@ -36,7 +37,9 @@ public:
   /// Create a direct register location.
   explicit MachineLocation(unsigned R) : IsRegister(true), Register(R) {}
   /// Create a register-indirect location with an offset.
-  MachineLocation(unsigned R, int O) : Register(R), Offset(O) {}
+  MachineLocation(unsigned R, int O) : Register(R), Offset(O) {
+    assert(O == 0 && "offset is expected to always be zero");
+  }
 
   bool operator==(const MachineLocation &Other) const {
       return IsRegister == Other.IsRegister && Register == Other.Register &&




More information about the llvm-commits mailing list