Remove the unused Offset field from MachineLocation (NFC)

rdar://problem/33580047

llvm-svn: 309831
This commit is contained in:
Adrian Prantl 2017-08-02 17:07:38 +00:00
parent e44032f7e7
commit 5577363a2c
3 changed files with 8 additions and 37 deletions

View File

@ -22,9 +22,8 @@ namespace llvm {
class MachineLocation {
private:
bool IsRegister = false; // True if location is a register.
unsigned Register = 0; // gcc/gdb register number.
int Offset = 0; // Displacement if not register.
bool IsRegister = false; ///< True if location is a register.
unsigned Register = 0; ///< gcc/gdb register number.
public:
enum : uint32_t {
@ -35,15 +34,11 @@ public:
MachineLocation() = default;
/// 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) {
assert(O == 0 && "offset is expected to always be zero");
}
explicit MachineLocation(unsigned R, bool Indirect = false)
: IsRegister(!Indirect), Register(R) {}
bool operator==(const MachineLocation &Other) const {
return IsRegister == Other.IsRegister && Register == Other.Register &&
Offset == Other.Offset;
return IsRegister == Other.IsRegister && Register == Other.Register;
}
// Accessors.
@ -51,24 +46,8 @@ public:
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; }
/// Make this location a direct register location.
void set(unsigned R) {
IsRegister = true;
Register = R;
Offset = 0;
}
/// Make this location a register-indirect+offset location.
void set(unsigned R, int O) {
IsRegister = false;
Register = R;
Offset = O;
assert(O == 0 && "offset is expected to always be zero");
}
};
inline bool operator!=(const MachineLocation &LHS, const MachineLocation &RHS) {

View File

@ -483,12 +483,8 @@ DIE *DwarfCompileUnit::constructVariableDIEImpl(const DbgVariable &DV,
if (DVInsn->getOperand(0).isReg()) {
const MachineOperand RegOp = DVInsn->getOperand(0);
// If the second operand is an immediate, this is an indirect value.
if (DVInsn->getOperand(1).isImm()) {
MachineLocation Location(RegOp.getReg(),
DVInsn->getOperand(1).getImm());
MachineLocation Location(RegOp.getReg(), DVInsn->getOperand(1).isImm());
addVariableAddress(DV, *VariableDie, Location);
} else if (RegOp.getReg())
addVariableAddress(DV, *VariableDie, MachineLocation(RegOp.getReg()));
} else if (DVInsn->getOperand(0).isImm()) {
// This variable is described by a single constant.
// Check whether it has a DIExpression.

View File

@ -831,13 +831,9 @@ static DebugLocEntry::Value getDebugLocValue(const MachineInstr *MI) {
assert(MI->getNumOperands() == 4);
if (MI->getOperand(0).isReg()) {
MachineLocation MLoc;
// If the second operand is an immediate, this is a
// register-indirect address.
if (!MI->getOperand(1).isImm())
MLoc.set(MI->getOperand(0).getReg());
else
MLoc.set(MI->getOperand(0).getReg(), MI->getOperand(1).getImm());
MachineLocation MLoc(MI->getOperand(0).getReg(), MI->getOperand(1).isImm());
return DebugLocEntry::Value(Expr, MLoc);
}
if (MI->getOperand(0).isImm())