Commit 6f9b4c68 authored by Fangrui Song's avatar Fangrui Song
Browse files

[SelectionDAT] Simplify SelectionDAGBuilder::visitInlineAsm

Indirect C_Immediate or C_Other constraints have been excluded.

Also simplify an unneeded change to indirect 'X' by D60942.
parent eadc97b0
Loading
Loading
Loading
Loading
+3 −11
Original line number Diff line number Diff line
@@ -8166,10 +8166,7 @@ void SelectionDAGBuilder::visitInlineAsm(ImmutableCallSite CS) {

    switch (OpInfo.Type) {
    case InlineAsm::isOutput:
      if (OpInfo.ConstraintType == TargetLowering::C_Memory ||
          ((OpInfo.ConstraintType == TargetLowering::C_Immediate ||
            OpInfo.ConstraintType == TargetLowering::C_Other) &&
           OpInfo.isIndirect)) {
      if (OpInfo.ConstraintType == TargetLowering::C_Memory) {
        unsigned ConstraintID =
            TLI.getInlineAsmMemConstraint(OpInfo.ConstraintCode);
        assert(ConstraintID != InlineAsm::Constraint_Unknown &&
@@ -8182,11 +8179,7 @@ void SelectionDAGBuilder::visitInlineAsm(ImmutableCallSite CS) {
                                                        MVT::i32));
        AsmNodeOperands.push_back(OpInfo.CallOperand);
        break;
      } else if (((OpInfo.ConstraintType == TargetLowering::C_Immediate ||
                   OpInfo.ConstraintType == TargetLowering::C_Other) &&
                  !OpInfo.isIndirect) ||
                 OpInfo.ConstraintType == TargetLowering::C_Register ||
                 OpInfo.ConstraintType == TargetLowering::C_RegisterClass) {
      } else {
        // Otherwise, this outputs to a register (directly for C_Register /
        // C_RegisterClass, and a target-defined fashion for
        // C_Immediate/C_Other). Find a register that we can use.
@@ -8269,8 +8262,7 @@ void SelectionDAGBuilder::visitInlineAsm(ImmutableCallSite CS) {
      }

      // Treat indirect 'X' constraint as memory.
      if ((OpInfo.ConstraintType == TargetLowering::C_Immediate ||
           OpInfo.ConstraintType == TargetLowering::C_Other) &&
      if (OpInfo.ConstraintType == TargetLowering::C_Other &&
          OpInfo.isIndirect)
        OpInfo.ConstraintType = TargetLowering::C_Memory;