forked from OSchip/llvm-project
				
			Refactor a bit to make some helper methods static.
llvm-svn: 168546
This commit is contained in:
		
							parent
							
								
									9bcb9226f6
								
							
						
					
					
						commit
						d2638c1894
					
				| 
						 | 
					@ -3687,16 +3687,12 @@ getF32Constant(SelectionDAG &DAG, unsigned Flt) {
 | 
				
			||||||
  return DAG.getConstantFP(APFloat(APInt(32, Flt)), MVT::f32);
 | 
					  return DAG.getConstantFP(APFloat(APInt(32, Flt)), MVT::f32);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// visitExp - Lower an exp intrinsic. Handles the special sequences for
 | 
					/// expandExp - Lower an exp intrinsic. Handles the special sequences for
 | 
				
			||||||
/// limited-precision mode.
 | 
					/// limited-precision mode.
 | 
				
			||||||
void
 | 
					static SDValue expandExp(DebugLoc dl, SDValue Op, SelectionDAG &DAG,
 | 
				
			||||||
SelectionDAGBuilder::visitExp(const CallInst &I) {
 | 
					                         const TargetLowering &TLI) {
 | 
				
			||||||
  SDValue result;
 | 
					  if (Op.getValueType() == MVT::f32 &&
 | 
				
			||||||
  DebugLoc dl = getCurDebugLoc();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (getValue(I.getArgOperand(0)).getValueType() == MVT::f32 &&
 | 
					 | 
				
			||||||
      LimitFloatPrecision > 0 && LimitFloatPrecision <= 18) {
 | 
					      LimitFloatPrecision > 0 && LimitFloatPrecision <= 18) {
 | 
				
			||||||
    SDValue Op = getValue(I.getArgOperand(0));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Put the exponent in the right bit position for later addition to the
 | 
					    // Put the exponent in the right bit position for later addition to the
 | 
				
			||||||
    // final result:
 | 
					    // final result:
 | 
				
			||||||
| 
						 | 
					@ -3785,17 +3781,13 @@ SelectionDAGBuilder::visitExp(const CallInst &I) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Add the exponent into the result in integer domain.
 | 
					    // Add the exponent into the result in integer domain.
 | 
				
			||||||
    SDValue t13 = DAG.getNode(ISD::BITCAST, dl, MVT::i32, TwoToFracPartOfX);
 | 
					    SDValue t13 = DAG.getNode(ISD::BITCAST, dl, MVT::i32, TwoToFracPartOfX);
 | 
				
			||||||
    result = DAG.getNode(ISD::BITCAST, dl, MVT::f32,
 | 
					    return DAG.getNode(ISD::BITCAST, dl, MVT::f32,
 | 
				
			||||||
                       DAG.getNode(ISD::ADD, dl, MVT::i32,
 | 
					                       DAG.getNode(ISD::ADD, dl, MVT::i32,
 | 
				
			||||||
                                   t13, IntegerPartOfX));
 | 
					                                   t13, IntegerPartOfX));
 | 
				
			||||||
  } else {
 | 
					 | 
				
			||||||
    // No special expansion.
 | 
					 | 
				
			||||||
    result = DAG.getNode(ISD::FEXP, dl,
 | 
					 | 
				
			||||||
                         getValue(I.getArgOperand(0)).getValueType(),
 | 
					 | 
				
			||||||
                         getValue(I.getArgOperand(0)));
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  setValue(&I, result);
 | 
					  // No special expansion.
 | 
				
			||||||
 | 
					  return DAG.getNode(ISD::FEXP, dl, Op.getValueType(), Op);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// expandLog - Lower a log intrinsic. Handles the special sequences for
 | 
					/// expandLog - Lower a log intrinsic. Handles the special sequences for
 | 
				
			||||||
| 
						 | 
					@ -4077,17 +4069,12 @@ static SDValue expandLog10(DebugLoc dl, SDValue Op, SelectionDAG &DAG,
 | 
				
			||||||
  return DAG.getNode(ISD::FLOG10, dl, Op.getValueType(), Op);
 | 
					  return DAG.getNode(ISD::FLOG10, dl, Op.getValueType(), Op);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// visitExp2 - Lower an exp2 intrinsic. Handles the special sequences for
 | 
					/// expandExp2 - Lower an exp2 intrinsic. Handles the special sequences for
 | 
				
			||||||
/// limited-precision mode.
 | 
					/// limited-precision mode.
 | 
				
			||||||
void
 | 
					static SDValue expandExp2(DebugLoc dl, SDValue Op, SelectionDAG &DAG,
 | 
				
			||||||
SelectionDAGBuilder::visitExp2(const CallInst &I) {
 | 
					                          const TargetLowering &TLI) {
 | 
				
			||||||
  SDValue result;
 | 
					  if (Op.getValueType() == MVT::f32 &&
 | 
				
			||||||
  DebugLoc dl = getCurDebugLoc();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (getValue(I.getArgOperand(0)).getValueType() == MVT::f32 &&
 | 
					 | 
				
			||||||
      LimitFloatPrecision > 0 && LimitFloatPrecision <= 18) {
 | 
					      LimitFloatPrecision > 0 && LimitFloatPrecision <= 18) {
 | 
				
			||||||
    SDValue Op = getValue(I.getArgOperand(0));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    SDValue IntegerPartOfX = DAG.getNode(ISD::FP_TO_SINT, dl, MVT::i32, Op);
 | 
					    SDValue IntegerPartOfX = DAG.getNode(ISD::FP_TO_SINT, dl, MVT::i32, Op);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //   FractionalPartOfX = x - (float)IntegerPartOfX;
 | 
					    //   FractionalPartOfX = x - (float)IntegerPartOfX;
 | 
				
			||||||
| 
						 | 
					@ -4168,17 +4155,13 @@ SelectionDAGBuilder::visitExp2(const CallInst &I) {
 | 
				
			||||||
    // Add the exponent into the result in integer domain.
 | 
					    // Add the exponent into the result in integer domain.
 | 
				
			||||||
    SDValue t13 = DAG.getNode(ISD::BITCAST, dl, MVT::i32,
 | 
					    SDValue t13 = DAG.getNode(ISD::BITCAST, dl, MVT::i32,
 | 
				
			||||||
                              TwoToFractionalPartOfX);
 | 
					                              TwoToFractionalPartOfX);
 | 
				
			||||||
    result = DAG.getNode(ISD::BITCAST, dl, MVT::f32,
 | 
					    return DAG.getNode(ISD::BITCAST, dl, MVT::f32,
 | 
				
			||||||
                       DAG.getNode(ISD::ADD, dl, MVT::i32,
 | 
					                       DAG.getNode(ISD::ADD, dl, MVT::i32,
 | 
				
			||||||
                                   t13, IntegerPartOfX));
 | 
					                                   t13, IntegerPartOfX));
 | 
				
			||||||
  } else {
 | 
					 | 
				
			||||||
    // No special expansion.
 | 
					 | 
				
			||||||
    result = DAG.getNode(ISD::FEXP2, dl,
 | 
					 | 
				
			||||||
                         getValue(I.getArgOperand(0)).getValueType(),
 | 
					 | 
				
			||||||
                         getValue(I.getArgOperand(0)));
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  setValue(&I, result);
 | 
					  // No special expansion.
 | 
				
			||||||
 | 
					  return DAG.getNode(ISD::FEXP2, dl, Op.getValueType(), Op);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// visitPow - Lower a pow intrinsic. Handles the special sequences for
 | 
					/// visitPow - Lower a pow intrinsic. Handles the special sequences for
 | 
				
			||||||
| 
						 | 
					@ -4896,10 +4879,10 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
 | 
				
			||||||
    setValue(&I, expandLog10(dl, getValue(I.getArgOperand(0)), DAG, TLI));
 | 
					    setValue(&I, expandLog10(dl, getValue(I.getArgOperand(0)), DAG, TLI));
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
  case Intrinsic::exp:
 | 
					  case Intrinsic::exp:
 | 
				
			||||||
    visitExp(I);
 | 
					    setValue(&I, expandExp(dl, getValue(I.getArgOperand(0)), DAG, TLI));
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
  case Intrinsic::exp2:
 | 
					  case Intrinsic::exp2:
 | 
				
			||||||
    visitExp2(I);
 | 
					    setValue(&I, expandExp2(dl, getValue(I.getArgOperand(0)), DAG, TLI));
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
  case Intrinsic::pow:
 | 
					  case Intrinsic::pow:
 | 
				
			||||||
    visitPow(I);
 | 
					    visitPow(I);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -534,8 +534,6 @@ private:
 | 
				
			||||||
  void visitTargetIntrinsic(const CallInst &I, unsigned Intrinsic);
 | 
					  void visitTargetIntrinsic(const CallInst &I, unsigned Intrinsic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void visitPow(const CallInst &I);
 | 
					  void visitPow(const CallInst &I);
 | 
				
			||||||
  void visitExp2(const CallInst &I);
 | 
					 | 
				
			||||||
  void visitExp(const CallInst &I);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void visitVAStart(const CallInst &I);
 | 
					  void visitVAStart(const CallInst &I);
 | 
				
			||||||
  void visitVAArg(const VAArgInst &I);
 | 
					  void visitVAArg(const VAArgInst &I);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue