aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/AMDGPU/SIInsertWaits.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2015-09-24 19:52:27 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2015-09-24 19:52:27 +0000
commite66621b3065a828772cc633074e98744debba2e8 (patch)
tree533752697fd101990c2c6f8ef6a4fdf50666135e /llvm/lib/Target/AMDGPU/SIInsertWaits.cpp
parentd6adfb401c5e9f7ec111866491ab3223d002a657 (diff)
downloadllvm-e66621b3065a828772cc633074e98744debba2e8.zip
llvm-e66621b3065a828772cc633074e98744debba2e8.tar.gz
llvm-e66621b3065a828772cc633074e98744debba2e8.tar.bz2
AMDGPU: Add s_dcache_* instructions
llvm-svn: 248533
Diffstat (limited to 'llvm/lib/Target/AMDGPU/SIInsertWaits.cpp')
-rw-r--r--llvm/lib/Target/AMDGPU/SIInsertWaits.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIInsertWaits.cpp b/llvm/lib/Target/AMDGPU/SIInsertWaits.cpp
index 2379b1f..b47c09b 100644
--- a/llvm/lib/Target/AMDGPU/SIInsertWaits.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInsertWaits.cpp
@@ -140,7 +140,7 @@ FunctionPass *llvm::createSIInsertWaits(TargetMachine &tm) {
Counters SIInsertWaits::getHwCounts(MachineInstr &MI) {
uint64_t TSFlags = TII->get(MI.getOpcode()).TSFlags;
- Counters Result;
+ Counters Result = { { 0, 0, 0 } };
Result.Named.VM = !!(TSFlags & SIInstrFlags::VM_CNT);
@@ -153,13 +153,21 @@ Counters SIInsertWaits::getHwCounts(MachineInstr &MI) {
if (TII->isSMRD(MI.getOpcode())) {
- MachineOperand &Op = MI.getOperand(0);
- assert(Op.isReg() && "First LGKM operand must be a register!");
+ if (MI.getNumOperands() != 0) {
+ MachineOperand &Op = MI.getOperand(0);
+ assert(Op.isReg() && "First LGKM operand must be a register!");
- unsigned Reg = Op.getReg();
- unsigned Size = TRI->getMinimalPhysRegClass(Reg)->getSize();
- Result.Named.LGKM = Size > 4 ? 2 : 1;
+ unsigned Reg = Op.getReg();
+ // XXX - What if this is a write into a super register?
+ unsigned Size = TRI->getMinimalPhysRegClass(Reg)->getSize();
+ Result.Named.LGKM = Size > 4 ? 2 : 1;
+ } else {
+ // s_dcache_inv etc. do not have a a destination register. Assume we
+ // want a wait on these.
+ // XXX - What is the right value?
+ Result.Named.LGKM = 1;
+ }
} else {
// DS
Result.Named.LGKM = 1;