summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/R600/R600ControlFlowFinalizer.cpp
diff options
context:
space:
mode:
authorVincent Lejeune <vljn@ovi.com>2013-05-17 16:50:02 +0000
committerVincent Lejeune <vljn@ovi.com>2013-05-17 16:50:02 +0000
commit0fca91d52e8b7d99717578295453e4bc77c28318 (patch)
tree8b6a9ce01fdb7cfadab45a74df6a72588e94df46 /llvm/lib/Target/R600/R600ControlFlowFinalizer.cpp
parentf9f4e1e7db6ea36a449e71f425217e0b3a92c206 (diff)
downloadbcm5719-llvm-0fca91d52e8b7d99717578295453e4bc77c28318.tar.gz
bcm5719-llvm-0fca91d52e8b7d99717578295453e4bc77c28318.zip
R600: Some factorization
llvm-svn: 182123
Diffstat (limited to 'llvm/lib/Target/R600/R600ControlFlowFinalizer.cpp')
-rw-r--r--llvm/lib/Target/R600/R600ControlFlowFinalizer.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/llvm/lib/Target/R600/R600ControlFlowFinalizer.cpp b/llvm/lib/Target/R600/R600ControlFlowFinalizer.cpp
index f1e07326e27..65a4801be03 100644
--- a/llvm/lib/Target/R600/R600ControlFlowFinalizer.cpp
+++ b/llvm/lib/Target/R600/R600ControlFlowFinalizer.cpp
@@ -172,22 +172,20 @@ private:
AMDGPU::ALU_LITERAL_Z,
AMDGPU::ALU_LITERAL_W
};
- for (unsigned i = 0, e = MI->getNumOperands(); i < e; ++i) {
- MachineOperand &MO = MI->getOperand(i);
- if (!MO.isReg())
- continue;
- if (MO.getReg() != AMDGPU::ALU_LITERAL_X)
+ const SmallVector<std::pair<MachineOperand *, int64_t>, 3 > Srcs =
+ TII->getSrcs(MI);
+ for (unsigned i = 0, e = Srcs.size(); i < e; ++i) {
+ if (Srcs[i].first->getReg() != AMDGPU::ALU_LITERAL_X)
continue;
- unsigned ImmIdx = TII->getOperandIdx(MI->getOpcode(), R600Operands::IMM);
- int64_t Imm = MI->getOperand(ImmIdx).getImm();
+ int64_t Imm = Srcs[i].second;
std::vector<int64_t>::iterator It =
std::find(Lits.begin(), Lits.end(), Imm);
if (It != Lits.end()) {
unsigned Index = It - Lits.begin();
- MO.setReg(LiteralRegs[Index]);
+ Srcs[i].first->setReg(LiteralRegs[Index]);
} else {
assert(Lits.size() < 4 && "Too many literals in Instruction Group");
- MO.setReg(LiteralRegs[Lits.size()]);
+ Srcs[i].first->setReg(LiteralRegs[Lits.size()]);
Lits.push_back(Imm);
}
}
OpenPOWER on IntegriCloud