mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-28 22:20:37 +00:00
Add MachineOperand::ChangeToFPImmediate and setFPImm
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218579 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3f40848670
commit
0df40b4969
@ -506,6 +506,11 @@ public:
|
||||
Contents.ImmVal = immVal;
|
||||
}
|
||||
|
||||
void setFPImm(const ConstantFP *CFP) {
|
||||
assert(isFPImm() && "Wrong MachineOperand mutator");
|
||||
Contents.CFP = CFP;
|
||||
}
|
||||
|
||||
void setOffset(int64_t Offset) {
|
||||
assert((isGlobal() || isSymbol() || isCPI() || isTargetIndex() ||
|
||||
isBlockAddress()) && "Wrong MachineOperand accessor");
|
||||
@ -544,6 +549,11 @@ public:
|
||||
/// the setImm method should be used.
|
||||
void ChangeToImmediate(int64_t ImmVal);
|
||||
|
||||
/// ChangeToFPImmediate - Replace this operand with a new FP immediate operand
|
||||
/// of the specified value. If an operand is known to be an FP immediate
|
||||
/// already, the setFPImm method should be used.
|
||||
void ChangeToFPImmediate(const ConstantFP *FPImm);
|
||||
|
||||
/// ChangeToRegister - Replace this operand with a new register operand of
|
||||
/// the specified value. If an operand is known to be an register already,
|
||||
/// the setReg method should be used.
|
||||
@ -702,6 +712,8 @@ public:
|
||||
friend class MachineInstr;
|
||||
friend class MachineRegisterInfo;
|
||||
private:
|
||||
void removeRegFromUses();
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Methods for handling register use/def lists.
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
@ -106,23 +106,41 @@ void MachineOperand::setIsDef(bool Val) {
|
||||
IsDef = Val;
|
||||
}
|
||||
|
||||
// If this operand is currently a register operand, and if this is in a
|
||||
// function, deregister the operand from the register's use/def list.
|
||||
void MachineOperand::removeRegFromUses() {
|
||||
if (!isReg() || !isOnRegUseList())
|
||||
return;
|
||||
|
||||
if (MachineInstr *MI = getParent()) {
|
||||
if (MachineBasicBlock *MBB = MI->getParent()) {
|
||||
if (MachineFunction *MF = MBB->getParent())
|
||||
MF->getRegInfo().removeRegOperandFromUseList(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// ChangeToImmediate - Replace this operand with a new immediate operand of
|
||||
/// the specified value. If an operand is known to be an immediate already,
|
||||
/// the setImm method should be used.
|
||||
void MachineOperand::ChangeToImmediate(int64_t ImmVal) {
|
||||
assert((!isReg() || !isTied()) && "Cannot change a tied operand into an imm");
|
||||
// If this operand is currently a register operand, and if this is in a
|
||||
// function, deregister the operand from the register's use/def list.
|
||||
if (isReg() && isOnRegUseList())
|
||||
if (MachineInstr *MI = getParent())
|
||||
if (MachineBasicBlock *MBB = MI->getParent())
|
||||
if (MachineFunction *MF = MBB->getParent())
|
||||
MF->getRegInfo().removeRegOperandFromUseList(this);
|
||||
|
||||
removeRegFromUses();
|
||||
|
||||
OpKind = MO_Immediate;
|
||||
Contents.ImmVal = ImmVal;
|
||||
}
|
||||
|
||||
void MachineOperand::ChangeToFPImmediate(const ConstantFP *FPImm) {
|
||||
assert((!isReg() || !isTied()) && "Cannot change a tied operand into an imm");
|
||||
|
||||
removeRegFromUses();
|
||||
|
||||
OpKind = MO_FPImmediate;
|
||||
Contents.CFP = FPImm;
|
||||
}
|
||||
|
||||
/// ChangeToRegister - Replace this operand with a new register operand of
|
||||
/// the specified value. If an operand is known to be an register already,
|
||||
/// the setReg method should be used.
|
||||
|
Loading…
Reference in New Issue
Block a user