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

llvm-svn: 309761
This commit is contained in:
Adrian Prantl 2017-08-01 22:57:05 +00:00
parent f4891c2a66
commit 81ea122121
1 changed files with 4 additions and 1 deletions

View File

@ -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 &&