#ifndef LLVM_MC_MACHINELOCATION_H
#define LLVM_MC_MACHINELOCATION_H
namespace llvm {
class MCSymbol;
class MachineLocation {
private:
bool IsRegister; unsigned Register; int Offset; public:
enum {
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 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
};
class MachineMove {
private:
MCSymbol *Label;
MachineLocation Destination, Source;
public:
MachineMove() : Label(0) {}
MachineMove(MCSymbol *label, const MachineLocation &D,
const MachineLocation &S)
: Label(label), Destination(D), Source(S) {}
MCSymbol *getLabel() const { return Label; }
const MachineLocation &getDestination() const { return Destination; }
const MachineLocation &getSource() const { return Source; }
};
}
#endif