[llvm-commits] [llvm] r47121 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ utils/TableGen/

Evan Cheng evan.cheng at apple.com
Thu Feb 14 15:30:39 PST 2008


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;



More information about the llvm-commits mailing list