llvm.org GIT mirror llvm / 76f920d
Add fastcc cc: pass and return VFP / NEON values in registers. Controlled by -arm-fastcc for now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117119 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 9 years ago
2 changed file(s) with 51 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
5252 ]>;
5353
5454 //===----------------------------------------------------------------------===//
55 // ARM APCS Calling Convention for FastCC (when VFP2 or later is available)
56 //===----------------------------------------------------------------------===//
57 def FastCC_ARM_APCS : CallingConv<[
58 // Handle all vector types as either f64 or v2f64.
59 CCIfType<[v1i64, v2i32, v4i16, v8i8, v2f32], CCBitConvertToType>,
60 CCIfType<[v2i64, v4i32, v8i16, v16i8, v4f32], CCBitConvertToType>,
61
62 CCIfType<[v2f64], CCAssignToReg<[Q0, Q1, Q2, Q3]>>,
63 CCIfType<[f64], CCAssignToReg<[D0, D1, D2, D3, D4, D5, D6, D7]>>,
64 CCIfType<[f32], CCAssignToReg<[S0, S1, S2, S3, S4, S5, S6, S7, S8,
65 S9, S10, S11, S12, S13, S14, S15]>>,
66 CCDelegateTo
67 ]>;
68
69 def RetFastCC_ARM_APCS : CallingConv<[
70 // Handle all vector types as either f64 or v2f64.
71 CCIfType<[v1i64, v2i32, v4i16, v8i8, v2f32], CCBitConvertToType>,
72 CCIfType<[v2i64, v4i32, v8i16, v16i8, v4f32], CCBitConvertToType>,
73
74 CCIfType<[v2f64], CCAssignToReg<[Q0, Q1, Q2, Q3]>>,
75 CCIfType<[f64], CCAssignToReg<[D0, D1, D2, D3, D4, D5, D6, D7]>>,
76 CCIfType<[f32], CCAssignToReg<[S0, S1, S2, S3, S4, S5, S6, S7, S8,
77 S9, S10, S11, S12, S13, S14, S15]>>,
78 CCDelegateTo
79 ]>;
80
81
82 //===----------------------------------------------------------------------===//
5583 // ARM AAPCS (EABI) Calling Convention, common parts
5684 //===----------------------------------------------------------------------===//
5785
104132
105133 //===----------------------------------------------------------------------===//
106134 // ARM AAPCS-VFP (EABI) Calling Convention
135 // Also used for FastCC (when VFP2 or later is available)
107136 //===----------------------------------------------------------------------===//
108137
109138 def CC_ARM_AAPCS_VFP : CallingConv<[
6767 ARMInterworking("arm-interworking", cl::Hidden,
6868 cl::desc("Enable / disable ARM interworking (for debugging only)"),
6969 cl::init(true));
70
71 static cl::opt
72 ARMFastCC("arm-fastcc", cl::Hidden,
73 cl::desc("Use AAPCS / AAPCS-VFP calling conventions for fastcc"));
7074
7175 void ARMTargetLowering::addTypeForNEON(EVT VT, EVT PromotedLdStVT,
7276 EVT PromotedBitwiseVT) {
954958 switch (CC) {
955959 default:
956960 llvm_unreachable("Unsupported calling convention");
957 case CallingConv::C:
958961 case CallingConv::Fast:
962 if (ARMFastCC && Subtarget->hasVFP2() && !isVarArg) {
963 if (!Subtarget->isAAPCS_ABI())
964 return (Return ? RetFastCC_ARM_APCS : FastCC_ARM_APCS);
965 // For AAPCS ABI targets, just use VFP variant of the calling convention.
966 return (Return ? RetCC_ARM_AAPCS_VFP : CC_ARM_AAPCS_VFP);
967 }
968 // Fallthrough
969 case CallingConv::C: {
959970 // Use target triple & subtarget features to do actual dispatch.
960 if (Subtarget->isAAPCS_ABI()) {
961 if (Subtarget->hasVFP2() &&
962 FloatABIType == FloatABI::Hard && !isVarArg)
963 return (Return ? RetCC_ARM_AAPCS_VFP: CC_ARM_AAPCS_VFP);
964 else
965 return (Return ? RetCC_ARM_AAPCS: CC_ARM_AAPCS);
966 } else
967 return (Return ? RetCC_ARM_APCS: CC_ARM_APCS);
971 if (!Subtarget->isAAPCS_ABI())
972 return (Return ? RetCC_ARM_APCS : CC_ARM_APCS);
973 else if (Subtarget->hasVFP2() &&
974 FloatABIType == FloatABI::Hard && !isVarArg)
975 return (Return ? RetCC_ARM_AAPCS_VFP : CC_ARM_AAPCS_VFP);
976 return (Return ? RetCC_ARM_AAPCS : CC_ARM_AAPCS);
977 }
968978 case CallingConv::ARM_AAPCS_VFP:
969 return (Return ? RetCC_ARM_AAPCS_VFP: CC_ARM_AAPCS_VFP);
979 return (Return ? RetCC_ARM_AAPCS_VFP : CC_ARM_AAPCS_VFP);
970980 case CallingConv::ARM_AAPCS:
971 return (Return ? RetCC_ARM_AAPCS: CC_ARM_AAPCS);
981 return (Return ? RetCC_ARM_AAPCS : CC_ARM_AAPCS);
972982 case CallingConv::ARM_APCS:
973 return (Return ? RetCC_ARM_APCS: CC_ARM_APCS);
983 return (Return ? RetCC_ARM_APCS : CC_ARM_APCS);
974984 }
975985 }
976986