summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2012-08-23 13:55:22 +0000
committerTom Stellard <[email protected]>2012-08-23 15:00:47 +0000
commitead72204f1864008430189421663a5d07a02293b (patch)
tree802028de8e36499126b0c0bcdf602d38790625d6
parent67a47a445b544ac638d10303dc697d70f25d12fb (diff)
radeon/llvm: Remove the last uses of MachineOperand flags
-rw-r--r--src/gallium/drivers/radeon/R600InstrInfo.cpp29
-rw-r--r--src/gallium/drivers/radeon/R600InstrInfo.h6
2 files changed, 27 insertions, 8 deletions
diff --git a/src/gallium/drivers/radeon/R600InstrInfo.cpp b/src/gallium/drivers/radeon/R600InstrInfo.cpp
index 4cca8ebfea7..bcc81e0e383 100644
--- a/src/gallium/drivers/radeon/R600InstrInfo.cpp
+++ b/src/gallium/drivers/radeon/R600InstrInfo.cpp
@@ -316,7 +316,7 @@ R600InstrInfo::InsertBranch(MachineBasicBlock &MBB,
} else {
MachineInstr *PredSet = findFirstPredicateSetterFrom(MBB, MBB.end());
assert(PredSet && "No previous predicate !");
- PredSet->getOperand(1).addTargetFlag(1<<4);
+ AddFlag(PredSet, 1, MO_FLAG_PUSH);
PredSet->getOperand(2).setImm(Cond[1].getImm());
BuildMI(&MBB, DL, get(AMDGPU::JUMP))
@@ -327,7 +327,7 @@ R600InstrInfo::InsertBranch(MachineBasicBlock &MBB,
} else {
MachineInstr *PredSet = findFirstPredicateSetterFrom(MBB, MBB.end());
assert(PredSet && "No previous predicate !");
- PredSet->getOperand(1).addTargetFlag(1<<4);
+ AddFlag(PredSet, 1, MO_FLAG_PUSH);
PredSet->getOperand(2).setImm(Cond[1].getImm());
BuildMI(&MBB, DL, get(AMDGPU::JUMP))
.addMBB(TBB)
@@ -356,8 +356,7 @@ R600InstrInfo::RemoveBranch(MachineBasicBlock &MBB) const
case AMDGPU::JUMP:
if (isPredicated(I)) {
MachineInstr *predSet = findFirstPredicateSetterFrom(MBB, I);
- char flag = predSet->getOperand(1).getTargetFlags() & (~(1<<4));
- predSet->getOperand(1).setTargetFlags(flag);
+ ClearFlag(predSet, 1, MO_FLAG_PUSH);
}
I->eraseFromParent();
break;
@@ -375,8 +374,7 @@ R600InstrInfo::RemoveBranch(MachineBasicBlock &MBB) const
case AMDGPU::JUMP:
if (isPredicated(I)) {
MachineInstr *predSet = findFirstPredicateSetterFrom(MBB, I);
- char flag = predSet->getOperand(1).getTargetFlags() & (~(1<<4));
- predSet->getOperand(1).setTargetFlags(flag);
+ ClearFlag(predSet, 1, MO_FLAG_PUSH);
}
I->eraseFromParent();
break;
@@ -532,14 +530,20 @@ bool R600InstrInfo::HasFlagOperand(const MachineInstr &MI) const
return GET_FLAG_OPERAND_IDX(MI) != 0;
}
-void R600InstrInfo::AddFlag(MachineInstr *MI, unsigned Operand,
- unsigned Flag) const
+MachineOperand &R600InstrInfo::GetFlagOp(MachineInstr *MI) const
{
unsigned FlagIndex = GET_FLAG_OPERAND_IDX(*MI);
assert(FlagIndex != 0 &&
"Instruction flags not supported for this instruction");
MachineOperand &FlagOp = MI->getOperand(FlagIndex);
assert(FlagOp.isImm());
+ return FlagOp;
+}
+
+void R600InstrInfo::AddFlag(MachineInstr *MI, unsigned Operand,
+ unsigned Flag) const
+{
+ MachineOperand &FlagOp = GetFlagOp(MI);
FlagOp.setImm(FlagOp.getImm() | (Flag << (NUM_MO_FLAGS * Operand)));
}
@@ -554,3 +558,12 @@ bool R600InstrInfo::IsFlagSet(const MachineInstr &MI, unsigned Operand,
return !!((MI.getOperand(FlagIndex).getImm() >>
(NUM_MO_FLAGS * Operand)) & Flag);
}
+
+void R600InstrInfo::ClearFlag(MachineInstr *MI, unsigned Operand,
+ unsigned Flag) const
+{
+ MachineOperand &FlagOp = GetFlagOp(MI);
+ unsigned InstFlags = FlagOp.getImm();
+ InstFlags &= ~(Flag << (NUM_MO_FLAGS * Operand));
+ FlagOp.setImm(InstFlags);
+}
diff --git a/src/gallium/drivers/radeon/R600InstrInfo.h b/src/gallium/drivers/radeon/R600InstrInfo.h
index 5e160a0d57a..9bc534f2d0b 100644
--- a/src/gallium/drivers/radeon/R600InstrInfo.h
+++ b/src/gallium/drivers/radeon/R600InstrInfo.h
@@ -119,6 +119,12 @@ namespace llvm {
///IsFlagSet - Determine if the specified flag is set on this Operand.
bool IsFlagSet(const MachineInstr &MI, unsigned Operand, unsigned Flag) const;
+
+ ///GetFlagOp - Return the operand containing the flags for this instruction.
+ MachineOperand &GetFlagOp(MachineInstr *MI) const;
+
+ ///ClearFlag - Clear the specified flag on the instruction.
+ void ClearFlag(MachineInstr *MI, unsigned Operand, unsigned Flag) const;
};
} // End llvm namespace