Mercurial > hg > CbC > CbC_llvm
comparison lib/CodeGen/TargetLoweringBase.cpp @ 100:7d135dc70f03 LLVM 3.9
LLVM 3.9
author | Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 26 Jan 2016 22:53:40 +0900 |
parents | afa8332a0e37 |
children | 1172e4bd9c6f |
comparison
equal
deleted
inserted
replaced
96:6418606d0ead | 100:7d135dc70f03 |
---|---|
245 Names[RTLIB::FPROUND_F128_F32] = "__trunctfsf2"; | 245 Names[RTLIB::FPROUND_F128_F32] = "__trunctfsf2"; |
246 Names[RTLIB::FPROUND_PPCF128_F32] = "__trunctfsf2"; | 246 Names[RTLIB::FPROUND_PPCF128_F32] = "__trunctfsf2"; |
247 Names[RTLIB::FPROUND_F80_F64] = "__truncxfdf2"; | 247 Names[RTLIB::FPROUND_F80_F64] = "__truncxfdf2"; |
248 Names[RTLIB::FPROUND_F128_F64] = "__trunctfdf2"; | 248 Names[RTLIB::FPROUND_F128_F64] = "__trunctfdf2"; |
249 Names[RTLIB::FPROUND_PPCF128_F64] = "__trunctfdf2"; | 249 Names[RTLIB::FPROUND_PPCF128_F64] = "__trunctfdf2"; |
250 Names[RTLIB::FPTOSINT_F32_I8] = "__fixsfqi"; | |
251 Names[RTLIB::FPTOSINT_F32_I16] = "__fixsfhi"; | |
252 Names[RTLIB::FPTOSINT_F32_I32] = "__fixsfsi"; | 250 Names[RTLIB::FPTOSINT_F32_I32] = "__fixsfsi"; |
253 Names[RTLIB::FPTOSINT_F32_I64] = "__fixsfdi"; | 251 Names[RTLIB::FPTOSINT_F32_I64] = "__fixsfdi"; |
254 Names[RTLIB::FPTOSINT_F32_I128] = "__fixsfti"; | 252 Names[RTLIB::FPTOSINT_F32_I128] = "__fixsfti"; |
255 Names[RTLIB::FPTOSINT_F64_I8] = "__fixdfqi"; | |
256 Names[RTLIB::FPTOSINT_F64_I16] = "__fixdfhi"; | |
257 Names[RTLIB::FPTOSINT_F64_I32] = "__fixdfsi"; | 253 Names[RTLIB::FPTOSINT_F64_I32] = "__fixdfsi"; |
258 Names[RTLIB::FPTOSINT_F64_I64] = "__fixdfdi"; | 254 Names[RTLIB::FPTOSINT_F64_I64] = "__fixdfdi"; |
259 Names[RTLIB::FPTOSINT_F64_I128] = "__fixdfti"; | 255 Names[RTLIB::FPTOSINT_F64_I128] = "__fixdfti"; |
260 Names[RTLIB::FPTOSINT_F80_I32] = "__fixxfsi"; | 256 Names[RTLIB::FPTOSINT_F80_I32] = "__fixxfsi"; |
261 Names[RTLIB::FPTOSINT_F80_I64] = "__fixxfdi"; | 257 Names[RTLIB::FPTOSINT_F80_I64] = "__fixxfdi"; |
264 Names[RTLIB::FPTOSINT_F128_I64] = "__fixtfdi"; | 260 Names[RTLIB::FPTOSINT_F128_I64] = "__fixtfdi"; |
265 Names[RTLIB::FPTOSINT_F128_I128] = "__fixtfti"; | 261 Names[RTLIB::FPTOSINT_F128_I128] = "__fixtfti"; |
266 Names[RTLIB::FPTOSINT_PPCF128_I32] = "__fixtfsi"; | 262 Names[RTLIB::FPTOSINT_PPCF128_I32] = "__fixtfsi"; |
267 Names[RTLIB::FPTOSINT_PPCF128_I64] = "__fixtfdi"; | 263 Names[RTLIB::FPTOSINT_PPCF128_I64] = "__fixtfdi"; |
268 Names[RTLIB::FPTOSINT_PPCF128_I128] = "__fixtfti"; | 264 Names[RTLIB::FPTOSINT_PPCF128_I128] = "__fixtfti"; |
269 Names[RTLIB::FPTOUINT_F32_I8] = "__fixunssfqi"; | |
270 Names[RTLIB::FPTOUINT_F32_I16] = "__fixunssfhi"; | |
271 Names[RTLIB::FPTOUINT_F32_I32] = "__fixunssfsi"; | 265 Names[RTLIB::FPTOUINT_F32_I32] = "__fixunssfsi"; |
272 Names[RTLIB::FPTOUINT_F32_I64] = "__fixunssfdi"; | 266 Names[RTLIB::FPTOUINT_F32_I64] = "__fixunssfdi"; |
273 Names[RTLIB::FPTOUINT_F32_I128] = "__fixunssfti"; | 267 Names[RTLIB::FPTOUINT_F32_I128] = "__fixunssfti"; |
274 Names[RTLIB::FPTOUINT_F64_I8] = "__fixunsdfqi"; | |
275 Names[RTLIB::FPTOUINT_F64_I16] = "__fixunsdfhi"; | |
276 Names[RTLIB::FPTOUINT_F64_I32] = "__fixunsdfsi"; | 268 Names[RTLIB::FPTOUINT_F64_I32] = "__fixunsdfsi"; |
277 Names[RTLIB::FPTOUINT_F64_I64] = "__fixunsdfdi"; | 269 Names[RTLIB::FPTOUINT_F64_I64] = "__fixunsdfdi"; |
278 Names[RTLIB::FPTOUINT_F64_I128] = "__fixunsdfti"; | 270 Names[RTLIB::FPTOUINT_F64_I128] = "__fixunsdfti"; |
279 Names[RTLIB::FPTOUINT_F80_I32] = "__fixunsxfsi"; | 271 Names[RTLIB::FPTOUINT_F80_I32] = "__fixunsxfsi"; |
280 Names[RTLIB::FPTOUINT_F80_I64] = "__fixunsxfdi"; | 272 Names[RTLIB::FPTOUINT_F80_I64] = "__fixunsxfdi"; |
499 | 491 |
500 /// getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or | 492 /// getFPTOSINT - Return the FPTOSINT_*_* value for the given types, or |
501 /// UNKNOWN_LIBCALL if there is none. | 493 /// UNKNOWN_LIBCALL if there is none. |
502 RTLIB::Libcall RTLIB::getFPTOSINT(EVT OpVT, EVT RetVT) { | 494 RTLIB::Libcall RTLIB::getFPTOSINT(EVT OpVT, EVT RetVT) { |
503 if (OpVT == MVT::f32) { | 495 if (OpVT == MVT::f32) { |
504 if (RetVT == MVT::i8) | |
505 return FPTOSINT_F32_I8; | |
506 if (RetVT == MVT::i16) | |
507 return FPTOSINT_F32_I16; | |
508 if (RetVT == MVT::i32) | 496 if (RetVT == MVT::i32) |
509 return FPTOSINT_F32_I32; | 497 return FPTOSINT_F32_I32; |
510 if (RetVT == MVT::i64) | 498 if (RetVT == MVT::i64) |
511 return FPTOSINT_F32_I64; | 499 return FPTOSINT_F32_I64; |
512 if (RetVT == MVT::i128) | 500 if (RetVT == MVT::i128) |
513 return FPTOSINT_F32_I128; | 501 return FPTOSINT_F32_I128; |
514 } else if (OpVT == MVT::f64) { | 502 } else if (OpVT == MVT::f64) { |
515 if (RetVT == MVT::i8) | |
516 return FPTOSINT_F64_I8; | |
517 if (RetVT == MVT::i16) | |
518 return FPTOSINT_F64_I16; | |
519 if (RetVT == MVT::i32) | 503 if (RetVT == MVT::i32) |
520 return FPTOSINT_F64_I32; | 504 return FPTOSINT_F64_I32; |
521 if (RetVT == MVT::i64) | 505 if (RetVT == MVT::i64) |
522 return FPTOSINT_F64_I64; | 506 return FPTOSINT_F64_I64; |
523 if (RetVT == MVT::i128) | 507 if (RetVT == MVT::i128) |
549 | 533 |
550 /// getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or | 534 /// getFPTOUINT - Return the FPTOUINT_*_* value for the given types, or |
551 /// UNKNOWN_LIBCALL if there is none. | 535 /// UNKNOWN_LIBCALL if there is none. |
552 RTLIB::Libcall RTLIB::getFPTOUINT(EVT OpVT, EVT RetVT) { | 536 RTLIB::Libcall RTLIB::getFPTOUINT(EVT OpVT, EVT RetVT) { |
553 if (OpVT == MVT::f32) { | 537 if (OpVT == MVT::f32) { |
554 if (RetVT == MVT::i8) | |
555 return FPTOUINT_F32_I8; | |
556 if (RetVT == MVT::i16) | |
557 return FPTOUINT_F32_I16; | |
558 if (RetVT == MVT::i32) | 538 if (RetVT == MVT::i32) |
559 return FPTOUINT_F32_I32; | 539 return FPTOUINT_F32_I32; |
560 if (RetVT == MVT::i64) | 540 if (RetVT == MVT::i64) |
561 return FPTOUINT_F32_I64; | 541 return FPTOUINT_F32_I64; |
562 if (RetVT == MVT::i128) | 542 if (RetVT == MVT::i128) |
563 return FPTOUINT_F32_I128; | 543 return FPTOUINT_F32_I128; |
564 } else if (OpVT == MVT::f64) { | 544 } else if (OpVT == MVT::f64) { |
565 if (RetVT == MVT::i8) | |
566 return FPTOUINT_F64_I8; | |
567 if (RetVT == MVT::i16) | |
568 return FPTOUINT_F64_I16; | |
569 if (RetVT == MVT::i32) | 545 if (RetVT == MVT::i32) |
570 return FPTOUINT_F64_I32; | 546 return FPTOUINT_F64_I32; |
571 if (RetVT == MVT::i64) | 547 if (RetVT == MVT::i64) |
572 return FPTOUINT_F64_I64; | 548 return FPTOUINT_F64_I64; |
573 if (RetVT == MVT::i128) | 549 if (RetVT == MVT::i128) |
763 PredictableSelectIsExpensive = false; | 739 PredictableSelectIsExpensive = false; |
764 MaskAndBranchFoldingIsLegal = false; | 740 MaskAndBranchFoldingIsLegal = false; |
765 EnableExtLdPromotion = false; | 741 EnableExtLdPromotion = false; |
766 HasFloatingPointExceptions = true; | 742 HasFloatingPointExceptions = true; |
767 StackPointerRegisterToSaveRestore = 0; | 743 StackPointerRegisterToSaveRestore = 0; |
768 ExceptionPointerRegister = 0; | |
769 ExceptionSelectorRegister = 0; | |
770 BooleanContents = UndefinedBooleanContent; | 744 BooleanContents = UndefinedBooleanContent; |
771 BooleanFloatContents = UndefinedBooleanContent; | 745 BooleanFloatContents = UndefinedBooleanContent; |
772 BooleanVectorContents = UndefinedBooleanContent; | 746 BooleanVectorContents = UndefinedBooleanContent; |
773 SchedPreferenceInfo = Sched::ILP; | 747 SchedPreferenceInfo = Sched::ILP; |
774 JumpBufSize = 0; | 748 JumpBufSize = 0; |
775 JumpBufAlignment = 0; | 749 JumpBufAlignment = 0; |
776 MinFunctionAlignment = 0; | 750 MinFunctionAlignment = 0; |
777 PrefFunctionAlignment = 0; | 751 PrefFunctionAlignment = 0; |
778 PrefLoopAlignment = 0; | 752 PrefLoopAlignment = 0; |
753 GatherAllAliasesMaxDepth = 6; | |
779 MinStackArgumentAlignment = 1; | 754 MinStackArgumentAlignment = 1; |
780 InsertFencesForAtomic = false; | 755 InsertFencesForAtomic = false; |
781 MinimumJumpTableEntries = 4; | 756 MinimumJumpTableEntries = 4; |
782 | 757 |
783 InitLibcallNames(LibcallRoutineNames, TM.getTargetTriple()); | 758 InitLibcallNames(LibcallRoutineNames, TM.getTargetTriple()); |
825 setOperationAction(ISD::SSUBO, VT, Expand); | 800 setOperationAction(ISD::SSUBO, VT, Expand); |
826 setOperationAction(ISD::UADDO, VT, Expand); | 801 setOperationAction(ISD::UADDO, VT, Expand); |
827 setOperationAction(ISD::USUBO, VT, Expand); | 802 setOperationAction(ISD::USUBO, VT, Expand); |
828 setOperationAction(ISD::SMULO, VT, Expand); | 803 setOperationAction(ISD::SMULO, VT, Expand); |
829 setOperationAction(ISD::UMULO, VT, Expand); | 804 setOperationAction(ISD::UMULO, VT, Expand); |
830 setOperationAction(ISD::UABSDIFF, VT, Expand); | 805 |
831 setOperationAction(ISD::SABSDIFF, VT, Expand); | 806 setOperationAction(ISD::BITREVERSE, VT, Expand); |
832 | 807 |
833 // These library functions default to expand. | 808 // These library functions default to expand. |
834 setOperationAction(ISD::FROUND, VT, Expand); | 809 setOperationAction(ISD::FROUND, VT, Expand); |
835 | 810 |
836 // These operations default to expand for vector types. | 811 // These operations default to expand for vector types. |
837 if (VT.isVector()) { | 812 if (VT.isVector()) { |
838 setOperationAction(ISD::FCOPYSIGN, VT, Expand); | 813 setOperationAction(ISD::FCOPYSIGN, VT, Expand); |
839 setOperationAction(ISD::ANY_EXTEND_VECTOR_INREG, VT, Expand); | 814 setOperationAction(ISD::ANY_EXTEND_VECTOR_INREG, VT, Expand); |
840 setOperationAction(ISD::SIGN_EXTEND_VECTOR_INREG, VT, Expand); | 815 setOperationAction(ISD::SIGN_EXTEND_VECTOR_INREG, VT, Expand); |
841 setOperationAction(ISD::ZERO_EXTEND_VECTOR_INREG, VT, Expand); | 816 setOperationAction(ISD::ZERO_EXTEND_VECTOR_INREG, VT, Expand); |
842 } | 817 } |
818 | |
819 // For most targets @llvm.get.dynamic.area.offest just returns 0. | |
820 setOperationAction(ISD::GET_DYNAMIC_AREA_OFFSET, VT, Expand); | |
843 } | 821 } |
844 | 822 |
845 // Most targets ignore the @llvm.prefetch intrinsic. | 823 // Most targets ignore the @llvm.prefetch intrinsic. |
846 setOperationAction(ISD::PREFETCH, MVT::Other, Expand); | 824 setOperationAction(ISD::PREFETCH, MVT::Other, Expand); |
847 | 825 |
1114 /// sequence of memory operands that is recognized by PrologEpilogInserter. | 1092 /// sequence of memory operands that is recognized by PrologEpilogInserter. |
1115 MachineBasicBlock* | 1093 MachineBasicBlock* |
1116 TargetLoweringBase::emitPatchPoint(MachineInstr *MI, | 1094 TargetLoweringBase::emitPatchPoint(MachineInstr *MI, |
1117 MachineBasicBlock *MBB) const { | 1095 MachineBasicBlock *MBB) const { |
1118 MachineFunction &MF = *MI->getParent()->getParent(); | 1096 MachineFunction &MF = *MI->getParent()->getParent(); |
1097 MachineFrameInfo &MFI = *MF.getFrameInfo(); | |
1098 | |
1099 // We're handling multiple types of operands here: | |
1100 // PATCHPOINT MetaArgs - live-in, read only, direct | |
1101 // STATEPOINT Deopt Spill - live-through, read only, indirect | |
1102 // STATEPOINT Deopt Alloca - live-through, read only, direct | |
1103 // (We're currently conservative and mark the deopt slots read/write in | |
1104 // practice.) | |
1105 // STATEPOINT GC Spill - live-through, read/write, indirect | |
1106 // STATEPOINT GC Alloca - live-through, read/write, direct | |
1107 // The live-in vs live-through is handled already (the live through ones are | |
1108 // all stack slots), but we need to handle the different type of stackmap | |
1109 // operands and memory effects here. | |
1119 | 1110 |
1120 // MI changes inside this loop as we grow operands. | 1111 // MI changes inside this loop as we grow operands. |
1121 for(unsigned OperIdx = 0; OperIdx != MI->getNumOperands(); ++OperIdx) { | 1112 for(unsigned OperIdx = 0; OperIdx != MI->getNumOperands(); ++OperIdx) { |
1122 MachineOperand &MO = MI->getOperand(OperIdx); | 1113 MachineOperand &MO = MI->getOperand(OperIdx); |
1123 if (!MO.isFI()) | 1114 if (!MO.isFI()) |
1129 MachineInstrBuilder MIB = BuildMI(MF, MI->getDebugLoc(), MI->getDesc()); | 1120 MachineInstrBuilder MIB = BuildMI(MF, MI->getDebugLoc(), MI->getDesc()); |
1130 | 1121 |
1131 // Copy operands before the frame-index. | 1122 // Copy operands before the frame-index. |
1132 for (unsigned i = 0; i < OperIdx; ++i) | 1123 for (unsigned i = 0; i < OperIdx; ++i) |
1133 MIB.addOperand(MI->getOperand(i)); | 1124 MIB.addOperand(MI->getOperand(i)); |
1134 // Add frame index operands: direct-mem-ref tag, #FI, offset. | 1125 // Add frame index operands recognized by stackmaps.cpp |
1135 MIB.addImm(StackMaps::DirectMemRefOp); | 1126 if (MFI.isStatepointSpillSlotObjectIndex(FI)) { |
1136 MIB.addOperand(MI->getOperand(OperIdx)); | 1127 // indirect-mem-ref tag, size, #FI, offset. |
1137 MIB.addImm(0); | 1128 // Used for spills inserted by StatepointLowering. This codepath is not |
1129 // used for patchpoints/stackmaps at all, for these spilling is done via | |
1130 // foldMemoryOperand callback only. | |
1131 assert(MI->getOpcode() == TargetOpcode::STATEPOINT && "sanity"); | |
1132 MIB.addImm(StackMaps::IndirectMemRefOp); | |
1133 MIB.addImm(MFI.getObjectSize(FI)); | |
1134 MIB.addOperand(MI->getOperand(OperIdx)); | |
1135 MIB.addImm(0); | |
1136 } else { | |
1137 // direct-mem-ref tag, #FI, offset. | |
1138 // Used by patchpoint, and direct alloca arguments to statepoints | |
1139 MIB.addImm(StackMaps::DirectMemRefOp); | |
1140 MIB.addOperand(MI->getOperand(OperIdx)); | |
1141 MIB.addImm(0); | |
1142 } | |
1138 // Copy the operands after the frame index. | 1143 // Copy the operands after the frame index. |
1139 for (unsigned i = OperIdx + 1; i != MI->getNumOperands(); ++i) | 1144 for (unsigned i = OperIdx + 1; i != MI->getNumOperands(); ++i) |
1140 MIB.addOperand(MI->getOperand(i)); | 1145 MIB.addOperand(MI->getOperand(i)); |
1141 | 1146 |
1142 // Inherit previous memory operands. | 1147 // Inherit previous memory operands. |
1143 MIB->setMemRefs(MI->memoperands_begin(), MI->memoperands_end()); | 1148 MIB->setMemRefs(MI->memoperands_begin(), MI->memoperands_end()); |
1144 assert(MIB->mayLoad() && "Folded a stackmap use to a non-load!"); | 1149 assert(MIB->mayLoad() && "Folded a stackmap use to a non-load!"); |
1145 | 1150 |
1146 // Add a new memory operand for this FI. | 1151 // Add a new memory operand for this FI. |
1147 const MachineFrameInfo &MFI = *MF.getFrameInfo(); | |
1148 assert(MFI.getObjectOffset(FI) != -1); | 1152 assert(MFI.getObjectOffset(FI) != -1); |
1149 | 1153 |
1150 unsigned Flags = MachineMemOperand::MOLoad; | 1154 unsigned Flags = MachineMemOperand::MOLoad; |
1151 if (MI->getOpcode() == TargetOpcode::STATEPOINT) { | 1155 if (MI->getOpcode() == TargetOpcode::STATEPOINT) { |
1152 Flags |= MachineMemOperand::MOStore; | 1156 Flags |= MachineMemOperand::MOStore; |
1277 RegisterTypeForVT[MVT::f32] = RegisterTypeForVT[MVT::i32]; | 1281 RegisterTypeForVT[MVT::f32] = RegisterTypeForVT[MVT::i32]; |
1278 TransformToType[MVT::f32] = MVT::i32; | 1282 TransformToType[MVT::f32] = MVT::i32; |
1279 ValueTypeActions.setTypeAction(MVT::f32, TypeSoftenFloat); | 1283 ValueTypeActions.setTypeAction(MVT::f32, TypeSoftenFloat); |
1280 } | 1284 } |
1281 | 1285 |
1286 // Decide how to handle f16. If the target does not have native f16 support, | |
1287 // promote it to f32, because there are no f16 library calls (except for | |
1288 // conversions). | |
1282 if (!isTypeLegal(MVT::f16)) { | 1289 if (!isTypeLegal(MVT::f16)) { |
1283 // If the target has native f32 support, promote f16 operations to f32. If | 1290 NumRegistersForVT[MVT::f16] = NumRegistersForVT[MVT::f32]; |
1284 // f32 is not supported, generate soft float library calls. | 1291 RegisterTypeForVT[MVT::f16] = RegisterTypeForVT[MVT::f32]; |
1285 if (isTypeLegal(MVT::f32)) { | 1292 TransformToType[MVT::f16] = MVT::f32; |
1286 NumRegistersForVT[MVT::f16] = NumRegistersForVT[MVT::f32]; | 1293 ValueTypeActions.setTypeAction(MVT::f16, TypePromoteFloat); |
1287 RegisterTypeForVT[MVT::f16] = RegisterTypeForVT[MVT::f32]; | |
1288 TransformToType[MVT::f16] = MVT::f32; | |
1289 ValueTypeActions.setTypeAction(MVT::f16, TypePromoteFloat); | |
1290 } else { | |
1291 NumRegistersForVT[MVT::f16] = NumRegistersForVT[MVT::i16]; | |
1292 RegisterTypeForVT[MVT::f16] = RegisterTypeForVT[MVT::i16]; | |
1293 TransformToType[MVT::f16] = MVT::i16; | |
1294 ValueTypeActions.setTypeAction(MVT::f16, TypeSoftenFloat); | |
1295 } | |
1296 } | 1294 } |
1297 | 1295 |
1298 // Loop over all of the vector value types to see which need transformations. | 1296 // Loop over all of the vector value types to see which need transformations. |
1299 for (unsigned i = MVT::FIRST_VECTOR_VALUETYPE; | 1297 for (unsigned i = MVT::FIRST_VECTOR_VALUETYPE; |
1300 i <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++i) { | 1298 i <= (unsigned)MVT::LAST_VECTOR_VALUETYPE; ++i) { |
1572 case Switch: return 0; | 1570 case Switch: return 0; |
1573 case IndirectBr: return 0; | 1571 case IndirectBr: return 0; |
1574 case Invoke: return 0; | 1572 case Invoke: return 0; |
1575 case Resume: return 0; | 1573 case Resume: return 0; |
1576 case Unreachable: return 0; | 1574 case Unreachable: return 0; |
1577 case CleanupEndPad: return 0; | |
1578 case CleanupRet: return 0; | 1575 case CleanupRet: return 0; |
1579 case CatchEndPad: return 0; | |
1580 case CatchRet: return 0; | 1576 case CatchRet: return 0; |
1581 case CatchPad: return 0; | 1577 case CatchPad: return 0; |
1582 case TerminatePad: return 0; | 1578 case CatchSwitch: return 0; |
1583 case CleanupPad: return 0; | 1579 case CleanupPad: return 0; |
1584 case Add: return ISD::ADD; | 1580 case Add: return ISD::ADD; |
1585 case FAdd: return ISD::FADD; | 1581 case FAdd: return ISD::FADD; |
1586 case Sub: return ISD::SUB; | 1582 case Sub: return ISD::SUB; |
1587 case FSub: return ISD::FSUB; | 1583 case FSub: return ISD::FSUB; |
1588 case Mul: return ISD::MUL; | 1584 case Mul: return ISD::MUL; |
1655 return std::make_pair(Cost, MTy.getSimpleVT()); | 1651 return std::make_pair(Cost, MTy.getSimpleVT()); |
1656 | 1652 |
1657 if (LK.first == TypeSplitVector || LK.first == TypeExpandInteger) | 1653 if (LK.first == TypeSplitVector || LK.first == TypeExpandInteger) |
1658 Cost *= 2; | 1654 Cost *= 2; |
1659 | 1655 |
1656 // Do not loop with f128 type. | |
1657 if (MTy == LK.second) | |
1658 return std::make_pair(Cost, MTy.getSimpleVT()); | |
1659 | |
1660 // Keep legalizing the type. | 1660 // Keep legalizing the type. |
1661 MTy = LK.second; | 1661 MTy = LK.second; |
1662 } | 1662 } |
1663 } | |
1664 | |
1665 Value *TargetLoweringBase::getSafeStackPointerLocation(IRBuilder<> &IRB) const { | |
1666 if (!TM.getTargetTriple().isAndroid()) | |
1667 return nullptr; | |
1668 | |
1669 // Android provides a libc function to retrieve the address of the current | |
1670 // thread's unsafe stack pointer. | |
1671 Module *M = IRB.GetInsertBlock()->getParent()->getParent(); | |
1672 Type *StackPtrTy = Type::getInt8PtrTy(M->getContext()); | |
1673 Value *Fn = M->getOrInsertFunction("__safestack_pointer_address", | |
1674 StackPtrTy->getPointerTo(0), nullptr); | |
1675 return IRB.CreateCall(Fn); | |
1663 } | 1676 } |
1664 | 1677 |
1665 //===----------------------------------------------------------------------===// | 1678 //===----------------------------------------------------------------------===// |
1666 // Loop Strength Reduction hooks | 1679 // Loop Strength Reduction hooks |
1667 //===----------------------------------------------------------------------===// | 1680 //===----------------------------------------------------------------------===// |