return;
}
+ if (Def->getName() == "undef_tied_input") {
+ std::array<MVT::SimpleValueType, 1> ResultVTs = { N->getSimpleType(0) };
+ std::array<unsigned, 0> InstOps;
+ auto IDOperandNo = NextRecordedOperandNo++;
+ AddMatcher(new EmitNodeMatcher("TargetOpcode::IMPLICIT_DEF",
+ ResultVTs, InstOps, false, false, false,
+ false, -1, IDOperandNo));
+ ResultOps.push_back(IDOperandNo);
+ return;
+ }
+
// Handle a reference to a register class. This is used
// in COPY_TO_SUBREG instructions.
if (Def->isSubClassOf("RegisterOperand"))
importExplicitUseRenderer(action_iterator InsertPt, RuleMatcher &Rule,
BuildMIAction &DstMIBuilder,
TreePatternNode *DstChild);
- Error importDefaultOperandRenderers(BuildMIAction &DstMIBuilder,
+ Error importDefaultOperandRenderers(action_iterator InsertPt, RuleMatcher &M,
+ BuildMIAction &DstMIBuilder,
DagInit *DefaultOps) const;
Error
importImplicitDefRenderers(BuildMIAction &DstMIBuilder,
// end up with too many rendered operands.
if (DstIOperand.Rec->isSubClassOf("OperandWithDefaultOps")) {
DagInit *DefaultOps = DstIOperand.Rec->getValueAsDag("DefaultOps");
- if (auto Error = importDefaultOperandRenderers(DstMIBuilder, DefaultOps))
+ if (auto Error = importDefaultOperandRenderers(
+ InsertPt, M, DstMIBuilder, DefaultOps))
return std::move(Error);
++NumDefaultOps;
continue;
}
Error GlobalISelEmitter::importDefaultOperandRenderers(
- BuildMIAction &DstMIBuilder, DagInit *DefaultOps) const {
+ action_iterator InsertPt, RuleMatcher &M, BuildMIAction &DstMIBuilder,
+ DagInit *DefaultOps) const {
for (const auto *DefaultOp : DefaultOps->getArgs()) {
+ Optional<LLTCodeGen> OpTyOrNone = None;
+
// Look through ValueType operators.
if (const DagInit *DefaultDagOp = dyn_cast<DagInit>(DefaultOp)) {
if (const DefInit *DefaultDagOperator =
dyn_cast<DefInit>(DefaultDagOp->getOperator())) {
if (DefaultDagOperator->getDef()->isSubClassOf("ValueType"))
+ OpTyOrNone = MVTToLLT(getValueType(
+ DefaultDagOperator->getDef()));
DefaultOp = DefaultDagOp->getArg(0);
}
}
if (const DefInit *DefaultDefOp = dyn_cast<DefInit>(DefaultOp)) {
- DstMIBuilder.addRenderer<AddRegisterRenderer>(DefaultDefOp->getDef());
+ auto Def = DefaultDefOp->getDef();
+ if (Def->getName() == "undef_tied_input") {
+ unsigned TempRegID = M.allocateTempRegID();
+ M.insertAction<MakeTempRegisterAction>(
+ InsertPt, OpTyOrNone.getValue(), TempRegID);
+ InsertPt = M.insertAction<BuildMIAction>(
+ InsertPt, M.allocateOutputInsnID(),
+ &Target.getInstruction(RK.getDef("IMPLICIT_DEF")));
+ BuildMIAction &IDMIBuilder = *static_cast<BuildMIAction *>(
+ InsertPt->get());
+ IDMIBuilder.addRenderer<TempRegRenderer>(TempRegID);
+ DstMIBuilder.addRenderer<TempRegRenderer>(TempRegID);
+ } else {
+ DstMIBuilder.addRenderer<AddRegisterRenderer>(Def);
+ }
continue;
}