mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 06:33:24 +00:00
Pack MachineOperand bitfields better.
Previously, 4 bits were unused. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171814 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b2c79f2f63
commit
6821060509
@ -65,15 +65,11 @@ private:
|
|||||||
/// union.
|
/// union.
|
||||||
unsigned char OpKind; // MachineOperandType
|
unsigned char OpKind; // MachineOperandType
|
||||||
|
|
||||||
// This union is discriminated by OpKind.
|
/// Subregister number for MO_Register. A value of 0 indicates the
|
||||||
union {
|
/// MO_Register has no subReg.
|
||||||
/// SubReg - Subregister number, only valid for MO_Register. A value of 0
|
///
|
||||||
/// indicates the MO_Register has no subReg.
|
/// For all other kinds of operands, this field holds target-specific flags.
|
||||||
unsigned char SubReg;
|
unsigned SubReg_TargetFlags : 12;
|
||||||
|
|
||||||
/// TargetFlags - This is a set of target-specific operand flags.
|
|
||||||
unsigned char TargetFlags;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// TiedTo - Non-zero when this register operand is tied to another register
|
/// TiedTo - Non-zero when this register operand is tied to another register
|
||||||
/// operand. The encoding of this field is described in the block comment
|
/// operand. The encoding of this field is described in the block comment
|
||||||
@ -181,24 +177,25 @@ private:
|
|||||||
} OffsetedInfo;
|
} OffsetedInfo;
|
||||||
} Contents;
|
} Contents;
|
||||||
|
|
||||||
explicit MachineOperand(MachineOperandType K) : OpKind(K), ParentMI(0) {
|
explicit MachineOperand(MachineOperandType K)
|
||||||
TargetFlags = 0;
|
: OpKind(K), SubReg_TargetFlags(0), ParentMI(0) {}
|
||||||
}
|
|
||||||
public:
|
public:
|
||||||
/// getType - Returns the MachineOperandType for this operand.
|
/// getType - Returns the MachineOperandType for this operand.
|
||||||
///
|
///
|
||||||
MachineOperandType getType() const { return (MachineOperandType)OpKind; }
|
MachineOperandType getType() const { return (MachineOperandType)OpKind; }
|
||||||
|
|
||||||
unsigned char getTargetFlags() const {
|
unsigned getTargetFlags() const {
|
||||||
return isReg() ? 0 : TargetFlags;
|
return isReg() ? 0 : SubReg_TargetFlags;
|
||||||
}
|
}
|
||||||
void setTargetFlags(unsigned char F) {
|
void setTargetFlags(unsigned F) {
|
||||||
assert(!isReg() && "Register operands can't have target flags");
|
assert(!isReg() && "Register operands can't have target flags");
|
||||||
TargetFlags = F;
|
SubReg_TargetFlags = F;
|
||||||
|
assert(SubReg_TargetFlags == F && "Target flags out of range");
|
||||||
}
|
}
|
||||||
void addTargetFlag(unsigned char F) {
|
void addTargetFlag(unsigned F) {
|
||||||
assert(!isReg() && "Register operands can't have target flags");
|
assert(!isReg() && "Register operands can't have target flags");
|
||||||
TargetFlags |= F;
|
SubReg_TargetFlags |= F;
|
||||||
|
assert((SubReg_TargetFlags & F) && "Target flags out of range");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -266,7 +263,7 @@ public:
|
|||||||
|
|
||||||
unsigned getSubReg() const {
|
unsigned getSubReg() const {
|
||||||
assert(isReg() && "Wrong MachineOperand accessor");
|
assert(isReg() && "Wrong MachineOperand accessor");
|
||||||
return (unsigned)SubReg;
|
return SubReg_TargetFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isUse() const {
|
bool isUse() const {
|
||||||
@ -341,7 +338,8 @@ public:
|
|||||||
|
|
||||||
void setSubReg(unsigned subReg) {
|
void setSubReg(unsigned subReg) {
|
||||||
assert(isReg() && "Wrong MachineOperand accessor");
|
assert(isReg() && "Wrong MachineOperand accessor");
|
||||||
SubReg = (unsigned char)subReg;
|
SubReg_TargetFlags = subReg;
|
||||||
|
assert(SubReg_TargetFlags == subReg && "SubReg out of range");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// substVirtReg - Substitute the current register with the virtual
|
/// substVirtReg - Substitute the current register with the virtual
|
||||||
@ -579,7 +577,7 @@ public:
|
|||||||
Op.SmallContents.RegNo = Reg;
|
Op.SmallContents.RegNo = Reg;
|
||||||
Op.Contents.Reg.Prev = 0;
|
Op.Contents.Reg.Prev = 0;
|
||||||
Op.Contents.Reg.Next = 0;
|
Op.Contents.Reg.Next = 0;
|
||||||
Op.SubReg = SubReg;
|
Op.setSubReg(SubReg);
|
||||||
return Op;
|
return Op;
|
||||||
}
|
}
|
||||||
static MachineOperand CreateMBB(MachineBasicBlock *MBB,
|
static MachineOperand CreateMBB(MachineBasicBlock *MBB,
|
||||||
|
@ -143,7 +143,7 @@ void MachineOperand::ChangeToRegister(unsigned Reg, bool isDef, bool isImp,
|
|||||||
// Change this to a register and set the reg#.
|
// Change this to a register and set the reg#.
|
||||||
OpKind = MO_Register;
|
OpKind = MO_Register;
|
||||||
SmallContents.RegNo = Reg;
|
SmallContents.RegNo = Reg;
|
||||||
SubReg = 0;
|
SubReg_TargetFlags = 0;
|
||||||
IsDef = isDef;
|
IsDef = isDef;
|
||||||
IsImp = isImp;
|
IsImp = isImp;
|
||||||
IsKill = isKill;
|
IsKill = isKill;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user