summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2014-08-20 21:51:26 +0000
committerQuentin Colombet <qcolombet@apple.com>2014-08-20 21:51:26 +0000
commit7e75cbaf47260f4bd22db4ac64d003e443cca672 (patch)
tree032ffe7bc6296a8a491c5d126ee147ff03873b25 /llvm/lib
parente229ec5bfcc937d629d7706416108d02cc103bb4 (diff)
downloadbcm5719-llvm-7e75cbaf47260f4bd22db4ac64d003e443cca672.tar.gz
bcm5719-llvm-7e75cbaf47260f4bd22db4ac64d003e443cca672.zip
Add isExtractSubreg property.
This patch adds a new property: isExtractSubreg and the related target hooks: TargetIntrInfo::getExtractSubregInputs and TargetInstrInfo::getExtractSubregLikeInputs to specify that a target specific instruction is a (kind of) EXTRACT_SUBREG. The approach is similar to r215394. <rdar://problem/12702965> llvm-svn: 216130
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/TargetInstrInfo.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetInstrInfo.cpp b/llvm/lib/CodeGen/TargetInstrInfo.cpp
index 44fbc4bb631..a177b3d71e0 100644
--- a/llvm/lib/CodeGen/TargetInstrInfo.cpp
+++ b/llvm/lib/CodeGen/TargetInstrInfo.cpp
@@ -877,3 +877,26 @@ bool TargetInstrInfo::getRegSequenceInputs(
}
return true;
}
+
+bool TargetInstrInfo::getExtractSubregInputs(
+ const MachineInstr &MI, unsigned DefIdx,
+ RegSubRegPairAndIdx &InputReg) const {
+ assert((MI.isExtractSubreg() ||
+ MI.isExtractSubregLike()) && "Instruction do not have the proper type");
+
+ if (!MI.isExtractSubreg())
+ return getExtractSubregLikeInputs(MI, DefIdx, InputReg);
+
+ // We are looking at:
+ // Def = EXTRACT_SUBREG v0.sub1, sub0.
+ assert(DefIdx == 0 && "EXTRACT_SUBREG only has one def");
+ const MachineOperand &MOReg = MI.getOperand(1);
+ const MachineOperand &MOSubIdx = MI.getOperand(2);
+ assert(MOSubIdx.isImm() &&
+ "The subindex of the extract_subreg is not an immediate");
+
+ InputReg.Reg = MOReg.getReg();
+ InputReg.SubReg = MOReg.getSubReg();
+ InputReg.SubIdx = (unsigned)MOSubIdx.getImm();
+ return true;
+}
OpenPOWER on IntegriCloud