#ifndef LLVM_MC_MACHINELOCATION_H
#define LLVM_MC_MACHINELOCATION_H
#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
namespace llvm {
class MCSymbol;
class MachineLocation {
private:
bool IsRegister; unsigned Register; int Offset; public:
enum : uint32_t {
VirtualFP = ~0U
};
MachineLocation()
: IsRegister(false), Register(0), Offset(0) {}
explicit MachineLocation(unsigned R)
: IsRegister(true), Register(R), Offset(0) {}
MachineLocation(unsigned R, int O)
: IsRegister(false), Register(R), Offset(O) {}
bool operator==(const MachineLocation &Other) const {
return IsRegister == Other.IsRegister && Register == Other.Register &&
Offset == Other.Offset;
}
bool isIndirect() const { return !IsRegister; }
bool isReg() const { return IsRegister; }
unsigned getReg() const { return Register; }
int getOffset() const { return Offset; }
void setIsRegister(bool Is) { IsRegister = Is; }
void setRegister(unsigned R) { Register = R; }
void setOffset(int O) { Offset = O; }
void set(unsigned R) {
IsRegister = true;
Register = R;
Offset = 0;
}
void set(unsigned R, int O) {
IsRegister = false;
Register = R;
Offset = O;
}
#ifndef NDEBUG
void dump();
#endif
};
inline bool operator!=(const MachineLocation &LHS, const MachineLocation &RHS) {
return !(LHS == RHS);
}
}
#endif