diff options
author | Quentin Colombet <qcolombet@apple.com> | 2014-08-20 23:49:36 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2014-08-20 23:49:36 +0000 |
commit | 7e3da6677a4239da77ea83e7005a603618e7a725 (patch) | |
tree | 6ffcec69fcaaaf80a4ea604ee8f617bdbd9b3231 /llvm/lib/CodeGen/TargetInstrInfo.cpp | |
parent | 44937d98a30c5ad8b6fdcdfece07228b159fbf24 (diff) | |
download | bcm5719-llvm-7e3da6677a4239da77ea83e7005a603618e7a725.tar.gz bcm5719-llvm-7e3da6677a4239da77ea83e7005a603618e7a725.zip |
Add isInsertSubreg property.
This patch adds a new property: isInsertSubreg and the related target hooks:
TargetIntrInfo::getInsertSubregInputs and
TargetInstrInfo::getInsertSubregLikeInputs to specify that a target specific
instruction is a (kind of) INSERT_SUBREG.
The approach is similar to r215394.
<rdar://problem/12702965>
llvm-svn: 216139
Diffstat (limited to 'llvm/lib/CodeGen/TargetInstrInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetInstrInfo.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetInstrInfo.cpp b/llvm/lib/CodeGen/TargetInstrInfo.cpp index a177b3d71e0..24141afd5cc 100644 --- a/llvm/lib/CodeGen/TargetInstrInfo.cpp +++ b/llvm/lib/CodeGen/TargetInstrInfo.cpp @@ -900,3 +900,29 @@ bool TargetInstrInfo::getExtractSubregInputs( InputReg.SubIdx = (unsigned)MOSubIdx.getImm(); return true; } + +bool TargetInstrInfo::getInsertSubregInputs( + const MachineInstr &MI, unsigned DefIdx, + RegSubRegPair &BaseReg, RegSubRegPairAndIdx &InsertedReg) const { + assert((MI.isInsertSubreg() || + MI.isInsertSubregLike()) && "Instruction do not have the proper type"); + + if (!MI.isInsertSubreg()) + return getInsertSubregLikeInputs(MI, DefIdx, BaseReg, InsertedReg); + + // We are looking at: + // Def = INSERT_SEQUENCE v0, v1, sub0. + assert(DefIdx == 0 && "INSERT_SUBREG only has one def"); + const MachineOperand &MOBaseReg = MI.getOperand(1); + const MachineOperand &MOInsertedReg = MI.getOperand(2); + const MachineOperand &MOSubIdx = MI.getOperand(3); + assert(MOSubIdx.isImm() && + "One of the subindex of the reg_sequence is not an immediate"); + BaseReg.Reg = MOBaseReg.getReg(); + BaseReg.SubReg = MOBaseReg.getSubReg(); + + InsertedReg.Reg = MOInsertedReg.getReg(); + InsertedReg.SubReg = MOInsertedReg.getSubReg(); + InsertedReg.SubIdx = (unsigned)MOSubIdx.getImm(); + return true; +} |