This is not a new issue. But I am wondering if this may be a compile  
time issue if the number of legal FP immediate is sufficiently large?  
Should we build a hash table for it instead?

Evan

On Feb 14, 2008, at 12:57 AM, Nate Begeman wrote:

>
>     switch (TLI.getOperationAction(ISD::ConstantFP, CFP- 
> >getValueType(0))) {
>     default: assert(0 && "This action is not supported yet!");
> +    case TargetLowering::Legal:
> +      break;
>     case TargetLowering::Custom:
>       Tmp3 = TLI.LowerOperation(Result, DAG);
>       if (Tmp3.Val) {
> @@ -1180,9 +1166,22 @@
>         break;
>       }
>       // FALLTHROUGH
> -    case TargetLowering::Expand:
> +    case TargetLowering::Expand: {
> +      // Check to see if this FP immediate is already legal.
> +      bool isLegal = false;
> +      for (TargetLowering::legal_fpimm_iterator I =  
> TLI.legal_fpimm_begin(),
> +             E = TLI.legal_fpimm_end(); I != E; ++I) {
> +        if (CFP->isExactlyValue(*I)) {
> +          isLegal = true;
> +          break;
> +        }
> +      }
> +      // If this is a legal constant, turn it into a  
> TargetConstantFP node.
> +      if (isLegal)
> +        break;
>       Result = ExpandConstantFP(CFP, true, DAG, TLI);
>     }
> +    }
>     break;
_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to