summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorAmara Emerson <aemerson@apple.com>2019-03-15 21:59:50 +0000
committerAmara Emerson <aemerson@apple.com>2019-03-15 21:59:50 +0000
commit3739a208757308b59e84fbba755e875059583995 (patch)
treee94bdd504a933323ae10605e1b84af9a33555484 /llvm/lib/CodeGen
parent68d9a60573fad118225d5e19303132f75c389936 (diff)
downloadbcm5719-llvm-3739a208757308b59e84fbba755e875059583995.tar.gz
bcm5719-llvm-3739a208757308b59e84fbba755e875059583995.zip
[GlobalISel] Allow MachineIRBuilder to build subregister copies.
This relaxes some asserts about sizes, and adds an optional subreg parameter to buildCopy(). Also update AArch64 instruction selector to use this in places where we previously used MachineInstrBuilder manually. Differential Revision: https://reviews.llvm.org/D59434 llvm-svn: 356304
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp b/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
index 81d26e6addb..6f95c03c899 100644
--- a/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
@@ -242,8 +242,11 @@ MachineInstrBuilder MachineIRBuilder::buildBrIndirect(unsigned Tgt) {
}
MachineInstrBuilder MachineIRBuilder::buildCopy(const DstOp &Res,
- const SrcOp &Op) {
- return buildInstr(TargetOpcode::COPY, Res, Op);
+ const SrcOp &Op,
+ unsigned Subreg) {
+ auto Copy = buildInstr(TargetOpcode::COPY, Res, Op);
+ Copy->getOperand(1).setSubReg(Subreg);
+ return Copy;
}
MachineInstrBuilder MachineIRBuilder::buildConstant(const DstOp &Res,
@@ -913,9 +916,6 @@ MachineInstrBuilder MachineIRBuilder::buildInstr(unsigned Opc,
case TargetOpcode::COPY:
assert(DstOps.size() == 1 && "Invalid Dst");
assert(SrcOps.size() == 1 && "Invalid Srcs");
- assert(DstOps[0].getLLTTy(*getMRI()) == LLT() ||
- SrcOps[0].getLLTTy(*getMRI()) == LLT() ||
- DstOps[0].getLLTTy(*getMRI()) == SrcOps[0].getLLTTy(*getMRI()));
break;
case TargetOpcode::G_FCMP:
case TargetOpcode::G_ICMP: {
OpenPOWER on IntegriCloud