[llvm] r188366 - Make more helper methods into static functions.
Tom Stellard
tom at stellard.net
Wed Aug 14 09:09:42 PDT 2013
On Wed, Aug 14, 2013 at 07:53:41AM -0000, Craig Topper wrote:
> Author: ctopper
> Date: Wed Aug 14 02:53:41 2013
> New Revision: 188366
>
> URL: http://llvm.org/viewvc/llvm-project?rev=188366&view=rev
> Log:
> Make more helper methods into static functions.
>
Hi Craig,
Whenever I write helper functions, I'm never sure whether to make them
static or private member functions. What criteria did you use when
choosing to make these functions static?
Thanks,
Tom
> Modified:
> llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
> llvm/trunk/lib/Target/X86/X86ISelLowering.h
>
> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=188366&r1=188365&r2=188366&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Aug 14 02:53:41 2013
> @@ -12087,7 +12087,7 @@ static SDValue LowerMUL(SDValue Op, cons
> return DAG.getNode(ISD::ADD, dl, VT, Res, AhiBlo);
> }
>
> -SDValue X86TargetLowering::LowerSDIV(SDValue Op, SelectionDAG &DAG) const {
> +static SDValue LowerSDIV(SDValue Op, SelectionDAG &DAG) {
> EVT VT = Op.getValueType();
> EVT EltTy = VT.getVectorElementType();
> unsigned NumElts = VT.getVectorNumElements();
> @@ -12434,7 +12434,8 @@ static SDValue LowerScalarVariableShift(
> return SDValue();
> }
>
> -SDValue X86TargetLowering::LowerShift(SDValue Op, SelectionDAG &DAG) const {
> +static SDValue LowerShift(SDValue Op, const X86Subtarget* Subtarget,
> + SelectionDAG &DAG) {
>
> EVT VT = Op.getValueType();
> SDLoc dl(Op);
> @@ -12792,9 +12793,10 @@ static SDValue LowerREADCYCLECOUNTER(SDV
> return DAG.getMergeValues(Ops, array_lengthof(Ops), dl);
> }
>
> -SDValue X86TargetLowering::LowerBITCAST(SDValue Op, SelectionDAG &DAG) const {
> - EVT SrcVT = Op.getOperand(0).getValueType();
> - EVT DstVT = Op.getValueType();
> +static SDValue LowerBITCAST(SDValue Op, const X86Subtarget *Subtarget,
> + SelectionDAG &DAG) {
> + MVT SrcVT = Op.getOperand(0).getValueType().getSimpleVT();
> + MVT DstVT = Op.getValueType().getSimpleVT();
> assert(Subtarget->is64Bit() && !Subtarget->hasSSE2() &&
> Subtarget->hasMMX() && "Unexpected custom BITCAST");
> assert((DstVT == MVT::i64 ||
> @@ -12879,7 +12881,8 @@ static SDValue LowerADDC_ADDE_SUBC_SUBE(
> Op.getOperand(1), Op.getOperand(2));
> }
>
> -SDValue X86TargetLowering::LowerFSINCOS(SDValue Op, SelectionDAG &DAG) const {
> +static SDValue LowerFSINCOS(SDValue Op, const X86Subtarget *Subtarget,
> + SelectionDAG &DAG) {
> assert(Subtarget->isTargetDarwin() && Subtarget->is64Bit());
>
> // For MacOSX, we want to call an alternative entry point: __sincos_stret,
> @@ -12890,8 +12893,8 @@ SDValue X86TargetLowering::LowerFSINCOS(
> EVT ArgVT = Arg.getValueType();
> Type *ArgTy = ArgVT.getTypeForEVT(*DAG.getContext());
>
> - ArgListTy Args;
> - ArgListEntry Entry;
> + TargetLowering::ArgListTy Args;
> + TargetLowering::ArgListEntry Entry;
>
> Entry.Node = Arg;
> Entry.Ty = ArgTy;
> @@ -12904,7 +12907,8 @@ SDValue X86TargetLowering::LowerFSINCOS(
> // the small struct {f32, f32} is returned in (eax, edx). For f64,
> // the results are returned via SRet in memory.
> const char *LibcallName = isF64 ? "__sincos_stret" : "__sincosf_stret";
> - SDValue Callee = DAG.getExternalSymbol(LibcallName, getPointerTy());
> + const TargetLowering &TLI = DAG.getTargetLoweringInfo();
> + SDValue Callee = DAG.getExternalSymbol(LibcallName, TLI.getPointerTy());
>
> Type *RetTy = isF64
> ? (Type*)StructType::get(ArgTy, ArgTy, NULL)
> @@ -12915,7 +12919,7 @@ SDValue X86TargetLowering::LowerFSINCOS(
> CallingConv::C, /*isTaillCall=*/false,
> /*doesNotRet=*/false, /*isReturnValueUsed*/true,
> Callee, Args, DAG, dl);
> - std::pair<SDValue, SDValue> CallResult = LowerCallTo(CLI);
> + std::pair<SDValue, SDValue> CallResult = TLI.LowerCallTo(CLI);
>
> if (isF64)
> // Returned in xmm0 and xmm1.
> @@ -12995,7 +12999,7 @@ SDValue X86TargetLowering::LowerOperatio
> case ISD::MUL: return LowerMUL(Op, Subtarget, DAG);
> case ISD::SRA:
> case ISD::SRL:
> - case ISD::SHL: return LowerShift(Op, DAG);
> + case ISD::SHL: return LowerShift(Op, Subtarget, DAG);
> case ISD::SADDO:
> case ISD::UADDO:
> case ISD::SSUBO:
> @@ -13003,7 +13007,7 @@ SDValue X86TargetLowering::LowerOperatio
> case ISD::SMULO:
> case ISD::UMULO: return LowerXALUO(Op, DAG);
> case ISD::READCYCLECOUNTER: return LowerREADCYCLECOUNTER(Op, Subtarget,DAG);
> - case ISD::BITCAST: return LowerBITCAST(Op, DAG);
> + case ISD::BITCAST: return LowerBITCAST(Op, Subtarget, DAG);
> case ISD::ADDC:
> case ISD::ADDE:
> case ISD::SUBC:
> @@ -13011,7 +13015,7 @@ SDValue X86TargetLowering::LowerOperatio
> case ISD::ADD: return LowerADD(Op, DAG);
> case ISD::SUB: return LowerSUB(Op, DAG);
> case ISD::SDIV: return LowerSDIV(Op, DAG);
> - case ISD::FSINCOS: return LowerFSINCOS(Op, DAG);
> + case ISD::FSINCOS: return LowerFSINCOS(Op, Subtarget, DAG);
> }
> }
>
>
> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=188366&r1=188365&r2=188366&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original)
> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Wed Aug 14 02:53:41 2013
> @@ -854,7 +854,6 @@ namespace llvm {
> SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
> SDValue LowerExternalSymbol(SDValue Op, SelectionDAG &DAG) const;
> SDValue LowerShiftParts(SDValue Op, SelectionDAG &DAG) const;
> - SDValue LowerBITCAST(SDValue op, SelectionDAG &DAG) const;
> SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG) const;
> SDValue LowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG) const;
> SDValue LowerUINT_TO_FP_i64(SDValue Op, SelectionDAG &DAG) const;
> @@ -889,10 +888,7 @@ namespace llvm {
> SDValue lowerEH_SJLJ_LONGJMP(SDValue Op, SelectionDAG &DAG) const;
> SDValue LowerINIT_TRAMPOLINE(SDValue Op, SelectionDAG &DAG) const;
> SDValue LowerFLT_ROUNDS_(SDValue Op, SelectionDAG &DAG) const;
> - SDValue LowerShift(SDValue Op, SelectionDAG &DAG) const;
> - SDValue LowerSDIV(SDValue Op, SelectionDAG &DAG) const;
> SDValue LowerSIGN_EXTEND_INREG(SDValue Op, SelectionDAG &DAG) const;
> - SDValue LowerFSINCOS(SDValue Op, SelectionDAG &DAG) const;
>
> virtual SDValue
> LowerFormalArguments(SDValue Chain,
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list