[llvm-commits] CVS: llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp

Chris Lattner sabre at nondot.org
Wed May 11 14:21:04 PDT 2005


Looks great to me John!

-Chris

On Wed, 11 May 2005, John Criswell wrote:

>
>
> Changes in directory llvm/lib/Target/SparcV9:
>
> SparcV9PreSelection.cpp updated: 1.43 -> 1.44
> ---
> Log message:
>
> Added support for decomposing constant expressions containing shr and shl
> instructions.
> Review of this commit would be greatly appreciated.
>
>
> ---
> Diffs of the changes:  (+24 -0)
>
> SparcV9PreSelection.cpp |   24 ++++++++++++++++++++++++
> 1 files changed, 24 insertions(+)
>
>
> Index: llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp
> diff -u llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp:1.43 llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp:1.44
> --- llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp:1.43	Thu Apr 21 18:25:42 2005
> +++ llvm/lib/Target/SparcV9/SparcV9PreSelection.cpp	Wed May 11 16:16:42 2005
> @@ -146,6 +146,30 @@
>       return new SelectInst (C, S1, S2, "constantSelect", &insertBefore);
>     }
>
> +    case Instruction::Shr: {
> +      getArg1 = CE->getOperand(0);
> +      if (ConstantExpr* CEarg = dyn_cast<ConstantExpr>(getArg1))
> +        getArg1 = DecomposeConstantExpr(CEarg, insertBefore);
> +      getArg2 = CE->getOperand(1);
> +      if (ConstantExpr* CEarg = dyn_cast<ConstantExpr>(getArg2))
> +        getArg2 = DecomposeConstantExpr(CEarg, insertBefore);
> +      return new ShiftInst (static_cast<Instruction::OtherOps>(CE->getOpcode()),
> +                            getArg1, getArg2,
> +                            "constantShr:" + getArg1->getName(), &insertBefore);
> +    }
> +
> +    case Instruction::Shl: {
> +      getArg1 = CE->getOperand(0);
> +      if (ConstantExpr* CEarg = dyn_cast<ConstantExpr>(getArg1))
> +        getArg1 = DecomposeConstantExpr(CEarg, insertBefore);
> +      getArg2 = CE->getOperand(1);
> +      if (ConstantExpr* CEarg = dyn_cast<ConstantExpr>(getArg2))
> +        getArg2 = DecomposeConstantExpr(CEarg, insertBefore);
> +      return new ShiftInst (static_cast<Instruction::OtherOps>(CE->getOpcode()),
> +                            getArg1, getArg2,
> +                            "constantShl:" + getArg1->getName(), &insertBefore);
> +    }
> +
>     default:                            // must be a binary operator
>       assert(CE->getOpcode() >= Instruction::BinaryOpsBegin &&
>              CE->getOpcode() <  Instruction::BinaryOpsEnd &&
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvm-commits
>

-Chris

-- 
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/




More information about the llvm-commits mailing list