Lines Matching +full:dbg +full:- +full:halt

1 //===- FastISel.cpp - Implementation of the FastISel class ----------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
13 // types (e.g. i64 on 32-bit targets) and operations are not supported. It is
24 // The intended use for "fast" instruction selection is "-O0" mode
27 // at -O0, the LLVM optimizers are not running, and this makes the
31 // in -O0 compiles.
33 // Basic operations are supported in a target-independent way, by reading
37 // target-specific code.
39 //===----------------------------------------------------------------------===//
116 "target-independent selector");
118 "target-specific selector");
131 if (!FuncInfo.MBB->empty()) in startNewBlock()
132 EmitStartPt = &FuncInfo.MBB->back(); in startNewBlock()
147 // Enter arguments into ValueMap for uses in non-entry BBs. in lowerArguments()
148 for (Function::const_arg_iterator I = FuncInfo.Fn->arg_begin(), in lowerArguments()
149 E = FuncInfo.Fn->arg_end(); in lowerArguments()
153 FuncInfo.ValueMap[&*I] = VI->second; in lowerArguments()
195 : FuncInfo.MBB->rend(); in flushLocalValueMap()
207 EmitStartPt = EmitStartPt->getPrevNode(); in flushLocalValueMap()
214 if (FirstNonValue != FuncInfo.MBB->end()) { in flushLocalValueMap()
217 // first non-value instruction's debug location. in flushLocalValueMap()
219 // If EmitStartPt is non-null, this block had copies at the top before in flushLocalValueMap()
226 : FuncInfo.MBB->begin(); in flushLocalValueMap()
227 if (FirstLocalValue != FirstNonValue && !FirstLocalValue->getDebugLoc()) in flushLocalValueMap()
228 FirstLocalValue->setDebugLoc(FirstNonValue->getDebugLoc()); in flushLocalValueMap()
239 EVT RealVT = TLI.getValueType(DL, V->getType(), /*AllowUnknown=*/true); in getRegForValue()
240 // Don't handle non-simple values in FastISel. in getRegForValue()
251 VT = TLI.getTypeToTransformTo(V->getContext(), VT).getSimpleVT(); in getRegForValue()
261 // In bottom-up mode, just create the virtual register which will be used in getRegForValue()
282 if (CI->getValue().getActiveBits() <= 64) in materializeConstant()
283 Reg = fastEmit_i(VT, VT, ISD::Constant, CI->getZExtValue()); in materializeConstant()
288 // local-CSE'd with actual integer zeros. in materializeConstant()
290 getRegForValue(Constant::getNullValue(DL.getIntPtrType(V->getType()))); in materializeConstant()
292 if (CF->isNullValue()) in materializeConstant()
300 const APFloat &Flt = CF->getValueAPF(); in materializeConstant()
308 getRegForValue(ConstantInt::get(V->getContext(), SIntVal)); in materializeConstant()
315 if (!selectOperator(Op, Op->getOpcode())) in materializeConstant()
333 // Give the target-specific code a try first. in materializeRegForValue()
337 // If target-specific code couldn't or didn't want to handle the value, then in materializeRegForValue()
338 // give target-independent code a try. in materializeRegForValue()
355 // def-dominates-use requirement enforced. in lookUpRegForValue()
358 return I->second; in lookUpRegForValue()
386 // Unhandled operand. Halt "fast" selection and bail. in getRegForGEPIndex()
390 EVT IdxVT = EVT::getEVT(Idx->getType(), /*HandleUnknown=*/false); in getRegForGEPIndex()
407 FuncInfo.MBB = FuncInfo.InsertPt->getParent(); in recomputeInsertPt()
410 FuncInfo.InsertPt = FuncInfo.MBB->getFirstNonPHI(); in recomputeInsertPt()
427 Dead->eraseFromParent(); in removeDeadCode()
440 if (FuncInfo.InsertPt != FuncInfo.MBB->begin()) in leaveLocalValueArea()
448 EVT VT = EVT::getEVT(I->getType(), /*HandleUnknown=*/true); in selectBinaryOp()
450 // Unhandled type. Halt "fast" selection and bail. in selectBinaryOp()
453 // We only handle legal types. For example, on x86-32 the instruction in selectBinaryOp()
454 // selector contains all of the 64-bit instructions from x86-64, in selectBinaryOp()
461 VT = TLI.getTypeToTransformTo(I->getContext(), VT); in selectBinaryOp()
466 // Check if the first operand is a constant, and handle it as "ri". At -O0, in selectBinaryOp()
468 if (const auto *CI = dyn_cast<ConstantInt>(I->getOperand(0))) in selectBinaryOp()
469 if (isa<Instruction>(I) && cast<Instruction>(I)->isCommutative()) { in selectBinaryOp()
470 Register Op1 = getRegForValue(I->getOperand(1)); in selectBinaryOp()
475 fastEmit_ri_(VT.getSimpleVT(), ISDOpcode, Op1, CI->getZExtValue(), in selectBinaryOp()
485 Register Op0 = getRegForValue(I->getOperand(0)); in selectBinaryOp()
486 if (!Op0) // Unhandled operand. Halt "fast" selection and bail. in selectBinaryOp()
490 if (const auto *CI = dyn_cast<ConstantInt>(I->getOperand(1))) { in selectBinaryOp()
491 uint64_t Imm = CI->getSExtValue(); in selectBinaryOp()
493 // Transform "sdiv exact X, 8" -> "sra X, 3". in selectBinaryOp()
495 cast<BinaryOperator>(I)->isExact() && isPowerOf2_64(Imm)) { in selectBinaryOp()
500 // Transform "urem x, pow2" -> "and x, pow2-1". in selectBinaryOp()
503 --Imm; in selectBinaryOp()
517 Register Op1 = getRegForValue(I->getOperand(1)); in selectBinaryOp()
518 if (!Op1) // Unhandled operand. Halt "fast" selection and bail. in selectBinaryOp()
525 // Target-specific code wasn't able to find a machine opcode for in selectBinaryOp()
526 // the given ISD opcode and type. Halt "fast" selection and bail. in selectBinaryOp()
535 Register N = getRegForValue(I->getOperand(0)); in selectGetElementPtr()
536 if (!N) // Unhandled operand. Halt "fast" selection and bail. in selectGetElementPtr()
539 // FIXME: The code below does not handle vector GEPs. Halt "fast" selection in selectGetElementPtr()
541 if (isa<VectorType>(I->getType())) in selectGetElementPtr()
549 MVT VT = TLI.getValueType(DL, I->getType()).getSimpleVT(); in selectGetElementPtr()
555 uint64_t Field = cast<ConstantInt>(Idx)->getZExtValue(); in selectGetElementPtr()
558 TotalOffs += DL.getStructLayout(StTy)->getElementOffset(Field); in selectGetElementPtr()
561 if (!N) // Unhandled operand. Halt "fast" selection and bail. in selectGetElementPtr()
569 if (CI->isZero()) in selectGetElementPtr()
572 uint64_t IdxN = CI->getValue().sextOrTrunc(64).getSExtValue(); in selectGetElementPtr()
576 if (!N) // Unhandled operand. Halt "fast" selection and bail. in selectGetElementPtr()
584 if (!N) // Unhandled operand. Halt "fast" selection and bail. in selectGetElementPtr()
592 if (!IdxN) // Unhandled operand. Halt "fast" selection and bail. in selectGetElementPtr()
597 if (!IdxN) // Unhandled operand. Halt "fast" selection and bail. in selectGetElementPtr()
601 if (!N) // Unhandled operand. Halt "fast" selection and bail. in selectGetElementPtr()
607 if (!N) // Unhandled operand. Halt "fast" selection and bail. in selectGetElementPtr()
618 for (unsigned i = StartIdx, e = CI->arg_size(); i != e; ++i) { in addStackMapLiveVars()
619 Value *Val = CI->getArgOperand(i); in addStackMapLiveVars()
623 Ops.push_back(MachineOperand::CreateImm(C->getSExtValue())); in addStackMapLiveVars()
633 Ops.push_back(MachineOperand::CreateFI(SI->second)); in addStackMapLiveVars()
649 assert(I->getCalledFunction()->getReturnType()->isVoidTy() && in selectStackmap()
655 // have to worry about calling conventions and target-specific lowering code. in selectStackmap()
665 assert(isa<ConstantInt>(I->getOperand(PatchPointOpers::IDPos)) && in selectStackmap()
667 const auto *ID = cast<ConstantInt>(I->getOperand(PatchPointOpers::IDPos)); in selectStackmap()
668 Ops.push_back(MachineOperand::CreateImm(ID->getZExtValue())); in selectStackmap()
670 assert(isa<ConstantInt>(I->getOperand(PatchPointOpers::NBytesPos)) && in selectStackmap()
673 cast<ConstantInt>(I->getOperand(PatchPointOpers::NBytesPos)); in selectStackmap()
674 Ops.push_back(MachineOperand::CreateImm(NumBytes->getZExtValue())); in selectStackmap()
685 CallingConv::ID CC = I->getCallingConv(); in selectStackmap()
696 const MCInstrDesc &MCID = Builder.getInstr()->getDesc(); in selectStackmap()
713 FuncInfo.MF->getFrameInfo().setHasStackMap(); in selectStackmap()
731 Value *V = CI->getOperand(ArgI); in lowerCallOperands()
733 assert(!V->getType()->isEmptyTy() && "Empty type passed to intrinsic."); in lowerCallOperands()
737 Entry.Ty = V->getType(); in lowerCallOperands()
742 Type *RetTy = ForceRetVoidTy ? Type::getVoidTy(CI->getType()->getContext()) in lowerCallOperands()
743 : CI->getType(); in lowerCallOperands()
744 CLI.setCallee(CI->getCallingConv(), RetTy, Callee, std::move(Args), NumArgs); in lowerCallOperands()
765 CallingConv::ID CC = I->getCallingConv(); in selectPatchpoint()
767 bool HasDef = !I->getType()->isVoidTy(); in selectPatchpoint()
768 Value *Callee = I->getOperand(PatchPointOpers::TargetPos)->stripPointerCasts(); in selectPatchpoint()
773 ValueType = TLI.getSimpleValueType(DL, I->getType(), /*AllowUnknown=*/true); in selectPatchpoint()
779 assert(isa<ConstantInt>(I->getOperand(PatchPointOpers::NArgPos)) && in selectPatchpoint()
782 cast<ConstantInt>(I->getOperand(PatchPointOpers::NArgPos)); in selectPatchpoint()
783 unsigned NumArgs = NumArgsVal->getZExtValue(); in selectPatchpoint()
786 // This includes all meta-operands up to but not including CC. in selectPatchpoint()
788 assert(I->arg_size() >= NumMetaOpers + NumArgs && in selectPatchpoint()
812 assert(isa<ConstantInt>(I->getOperand(PatchPointOpers::IDPos)) && in selectPatchpoint()
814 const auto *ID = cast<ConstantInt>(I->getOperand(PatchPointOpers::IDPos)); in selectPatchpoint()
815 Ops.push_back(MachineOperand::CreateImm(ID->getZExtValue())); in selectPatchpoint()
817 assert(isa<ConstantInt>(I->getOperand(PatchPointOpers::NBytesPos)) && in selectPatchpoint()
820 cast<ConstantInt>(I->getOperand(PatchPointOpers::NBytesPos)); in selectPatchpoint()
821 Ops.push_back(MachineOperand::CreateImm(NumBytes->getZExtValue())); in selectPatchpoint()
826 cast<ConstantInt>(C->getOperand(0))->getZExtValue(); in selectPatchpoint()
829 if (C->getOpcode() == Instruction::IntToPtr) { in selectPatchpoint()
831 cast<ConstantInt>(C->getOperand(0))->getZExtValue(); in selectPatchpoint()
854 Register Reg = getRegForValue(I->getArgOperand(i)); in selectPatchpoint()
892 MIB->setPhysRegsDeadExcept(CLI.InRegs, TRI); in selectPatchpoint()
895 CLI.Call->eraseFromParent(); in selectPatchpoint()
898 FuncInfo.MF->getFrameInfo().setHasPatchPoint(); in selectPatchpoint()
910 Ops.push_back(MachineOperand::CreateReg(getRegForValue(I->getArgOperand(0)), in selectXRayCustomEvent()
912 Ops.push_back(MachineOperand::CreateReg(getRegForValue(I->getArgOperand(1)), in selectXRayCustomEvent()
929 Ops.push_back(MachineOperand::CreateReg(getRegForValue(I->getArgOperand(0)), in selectXRayTypedEvent()
931 Ops.push_back(MachineOperand::CreateReg(getRegForValue(I->getArgOperand(1)), in selectXRayTypedEvent()
933 Ops.push_back(MachineOperand::CreateReg(getRegForValue(I->getArgOperand(2)), in selectXRayTypedEvent()
956 return AttributeList::get(CLI.RetTy->getContext(), AttributeList::ReturnIndex, in getReturnAttrs()
962 MCContext &Ctx = MF->getContext(); in lowerCallTo()
971 FunctionType *FTy = CI->getFunctionType(); in lowerCallTo()
972 Type *RetTy = CI->getType(); in lowerCallTo()
980 Value *V = CI->getOperand(ArgI); in lowerCallTo()
982 assert(!V->getType()->isEmptyTy() && "Empty type passed to intrinsic."); in lowerCallTo()
986 Entry.Ty = V->getType(); in lowerCallTo()
990 TLI.markLibCallAttributes(MF, CI->getCallingConv(), Args); in lowerCallTo()
1008 CLI.CallConv, *FuncInfo.MF, CLI.IsVarArg, Outs, CLI.RetTy->getContext()); in lowerCallTo()
1010 // FIXME: sret demotion isn't supported yet - bail out. in lowerCallTo()
1015 MVT RegisterVT = TLI.getRegisterType(CLI.RetTy->getContext(), VT); in lowerCallTo()
1016 unsigned NumRegs = TLI.getNumRegisters(CLI.RetTy->getContext(), VT); in lowerCallTo()
1105 CLI.Call->setPhysRegsDeadExcept(CLI.InRegs, TRI); in lowerCallTo()
1112 if (MDNode *MD = CLI.CB->getMetadata("heapallocsite")) in lowerCallTo()
1113 CLI.Call->setHeapAllocMarker(*MF, MD); in lowerCallTo()
1119 FunctionType *FuncTy = CI->getFunctionType(); in lowerCall()
1120 Type *RetTy = CI->getType(); in lowerCall()
1124 Args.reserve(CI->arg_size()); in lowerCall()
1126 for (auto i = CI->arg_begin(), e = CI->arg_end(); i != e; ++i) { in lowerCall()
1130 if (V->getType()->isEmptyTy()) in lowerCall()
1134 Entry.Ty = V->getType(); in lowerCall()
1136 // Skip the first return-type Attribute to get to params. in lowerCall()
1137 Entry.setAttributes(CI, i - CI->arg_begin()); in lowerCall()
1141 // Check if target-independent constraints permit a tail call here. in lowerCall()
1142 // Target-dependent constraints are checked within fastLowerCall. in lowerCall()
1143 bool IsTailCall = CI->isTailCall(); in lowerCall()
1146 if (IsTailCall && !CI->isMustTailCall() && in lowerCall()
1147 MF->getFunction().getFnAttribute("disable-tail-calls").getValueAsBool()) in lowerCall()
1151 CLI.setCallee(RetTy, FuncTy, CI->getCalledOperand(), std::move(Args), *CI) in lowerCall()
1163 if (const InlineAsm *IA = dyn_cast<InlineAsm>(Call->getCalledOperand())) { in selectCall()
1165 if (!IA->getConstraintString().empty()) in selectCall()
1169 if (IA->hasSideEffects()) in selectCall()
1171 if (IA->isAlignStack()) in selectCall()
1173 if (Call->isConvergent()) in selectCall()
1175 ExtraInfo |= IA->getDialect() * InlineAsm::Extra_AsmDialect; in selectCall()
1179 MIB.addExternalSymbol(IA->getAsmString().c_str()); in selectCall()
1182 const MDNode *SrcLoc = Call->getMetadata("srcloc"); in selectCall()
1197 if (!II->hasDbgRecords()) in handleDbgInfo()
1203 // Reverse order of debug records, because fast-isel walks through backwards. in handleDbgInfo()
1204 for (DbgRecord &DR : llvm::reverse(II->getDbgRecordRange())) { in handleDbgInfo()
1209 assert(DLR->getLabel() && "Missing label"); in handleDbgInfo()
1210 if (!FuncInfo.MF->getMMI().hasDebugInfo()) { in handleDbgInfo()
1215 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DLR->getDebugLoc(), in handleDbgInfo()
1217 .addMetadata(DLR->getLabel()); in handleDbgInfo()
1241 LLVM_DEBUG(dbgs() << "Dropping debug-info for " << DVR << "\n";); in handleDbgInfo()
1247 // This form of DBG_VALUE is target-independent. in lowerDbgValue()
1256 // See if there's an expression to constant-fold. in lowerDbgValue()
1258 std::tie(Expr, CI) = Expr->constantFold(CI); in lowerDbgValue()
1259 if (CI->getBitWidth() > 64) in lowerDbgValue()
1267 .addImm(CI->getZExtValue()) in lowerDbgValue()
1282 Arg && Expr && Expr->isEntryValue()) { in lowerDbgValue()
1284 assert(Arg->hasAttribute(Attribute::AttrKind::SwiftAsync)); in lowerDbgValue()
1287 for (auto [PhysReg, VirtReg] : FuncInfo.RegInfo->liveins()) in lowerDbgValue()
1294 LLVM_DEBUG(dbgs() << "Dropping dbg.value: expression is entry_value but " in lowerDbgValue()
1300 MachineOperand FrameIndexOp = MachineOperand::CreateFI(SI->second); in lowerDbgValue()
1307 // FIXME: This does not handle register-indirect values at offset 0. in lowerDbgValue()
1308 if (!FuncInfo.MF->useDebugInstrRef()) { in lowerDbgValue()
1353 if (!Op && !Address->use_empty() && isa<Instruction>(Address) && in lowerDbgDeclare()
1360 assert(Var->isValidLocationForIntrinsic(DL) && in lowerDbgDeclare()
1361 "Expected inlined-at fields to agree"); in lowerDbgDeclare()
1362 if (FuncInfo.MF->useDebugInstrRef() && Op->isReg()) { in lowerDbgDeclare()
1375 // A dbg.declare describes the address of a source variable, so lower it in lowerDbgDeclare()
1391 switch (II->getIntrinsicID()) { in selectIntrinsicCall()
1394 // At -O0 we don't care about the lifetime intrinsics. in selectIntrinsicCall()
1408 assert(DI->getVariable() && "Missing variable"); in selectIntrinsicCall()
1409 if (!FuncInfo.MF->getMMI().hasDebugInfo()) { in selectIntrinsicCall()
1418 const Value *Address = DI->getAddress(); in selectIntrinsicCall()
1419 if (!lowerDbgDeclare(Address, DI->getExpression(), DI->getVariable(), in selectIntrinsicCall()
1426 // A dbg.assign is a dbg.value with more information, typically produced in selectIntrinsicCall()
1428 // happened (such as an optimised function being always-inlined into an in selectIntrinsicCall()
1430 // dbg.assign in that case, just use its dbg.value fields. in selectIntrinsicCall()
1433 // This form of DBG_VALUE is target-independent. in selectIntrinsicCall()
1435 const Value *V = DI->getValue(); in selectIntrinsicCall()
1436 DIExpression *Expr = DI->getExpression(); in selectIntrinsicCall()
1437 DILocalVariable *Var = DI->getVariable(); in selectIntrinsicCall()
1438 if (DI->hasArgList()) in selectIntrinsicCall()
1442 assert(Var->isValidLocationForIntrinsic(MIMD.getDL()) && in selectIntrinsicCall()
1443 "Expected inlined-at fields to agree"); in selectIntrinsicCall()
1452 assert(DI->getLabel() && "Missing label"); in selectIntrinsicCall()
1453 if (!FuncInfo.MF->getMMI().hasDebugInfo()) { in selectIntrinsicCall()
1459 TII.get(TargetOpcode::DBG_LABEL)).addMetadata(DI->getLabel()); in selectIntrinsicCall()
1470 Register ResultReg = getRegForValue(ConstantInt::getTrue(II->getType())); in selectIntrinsicCall()
1480 Register ResultReg = getRegForValue(II->getArgOperand(0)); in selectIntrinsicCall()
1502 EVT SrcVT = TLI.getValueType(DL, I->getOperand(0)->getType()); in selectCast()
1503 EVT DstVT = TLI.getValueType(DL, I->getType()); in selectCast()
1507 // Unhandled type. Halt "fast" selection and bail. in selectCast()
1518 Register InputReg = getRegForValue(I->getOperand(0)); in selectCast()
1520 // Unhandled operand. Halt "fast" selection and bail. in selectCast()
1533 EVT SrcEVT = TLI.getValueType(DL, I->getOperand(0)->getType()); in selectBitCast()
1534 EVT DstEVT = TLI.getValueType(DL, I->getType()); in selectBitCast()
1537 // Unhandled type. Halt "fast" selection and bail. in selectBitCast()
1542 Register Op0 = getRegForValue(I->getOperand(0)); in selectBitCast()
1543 if (!Op0) // Unhandled operand. Halt "fast" selection and bail. in selectBitCast()
1562 Register Reg = getRegForValue(I->getOperand(0)); in selectFreeze()
1567 EVT ETy = TLI.getValueType(DL, I->getOperand(0)->getType()); in selectFreeze()
1589 // This is the instruction after SavedLastLocalValue if it is non-NULL. in removeDeadLocalValueCode()
1595 FirstDeadInst = FuncInfo.MBB->getFirstNonPHI(); in removeDeadLocalValueCode()
1610 if (I->isTerminator()) { in selectInstruction()
1611 if (!handlePHINodesInSuccessorBlocks(I->getParent())) { in selectInstruction()
1623 for (unsigned i = 0, e = Call->getNumOperandBundles(); i != e; ++i) in selectInstruction()
1624 if (Call->getOperandBundleAt(i).getTagID() != LLVMContext::OB_funclet) in selectInstruction()
1632 const Function *F = Call->getCalledFunction(); in selectInstruction()
1637 if (F && !F->hasLocalLinkage() && F->hasName() && in selectInstruction()
1638 LibInfo->getLibFunc(F->getName(), Func) && in selectInstruction()
1639 LibInfo->hasOptimizedCodeGen(Func)) in selectInstruction()
1643 if (F && F->getIntrinsicID() == Intrinsic::trap && in selectInstruction()
1644 Call->hasFnAttr("trap-func-name")) in selectInstruction()
1648 // First, try doing target-independent selection. in selectInstruction()
1650 if (selectOperator(I, I->getOpcode())) { in selectInstruction()
1674 if (I->isTerminator()) { in selectInstruction()
1684 /// (fall-through) successor, and update the CFG.
1687 if (FuncInfo.MBB->getBasicBlock()->sizeWithoutDebug() > 1 && in fastEmitBranch()
1688 FuncInfo.MBB->isLayoutSuccessor(MSucc)) { in fastEmitBranch()
1689 // For more accurate line information if this is the only non-debug in fastEmitBranch()
1691 // unconditional fall-through case, which needs no instructions. in fastEmitBranch()
1698 auto BranchProbability = FuncInfo.BPI->getEdgeProbability( in fastEmitBranch()
1699 FuncInfo.MBB->getBasicBlock(), MSucc->getBasicBlock()); in fastEmitBranch()
1700 FuncInfo.MBB->addSuccessor(MSucc, BranchProbability); in fastEmitBranch()
1702 FuncInfo.MBB->addSuccessorWithoutProb(MSucc); in fastEmitBranch()
1714 FuncInfo.BPI->getEdgeProbability(BranchBB, TrueMBB->getBasicBlock()); in finishCondBranch()
1715 FuncInfo.MBB->addSuccessor(TrueMBB, BranchProbability); in finishCondBranch()
1717 FuncInfo.MBB->addSuccessorWithoutProb(TrueMBB); in finishCondBranch()
1730 EVT VT = TLI.getValueType(DL, I->getType()); in selectFNeg()
1739 // and then bitcast it back to floating-point. in selectFNeg()
1742 EVT IntVT = EVT::getIntegerVT(I->getContext(), VT.getSizeInBits()); in selectFNeg()
1753 UINT64_C(1) << (VT.getSizeInBits() - 1), IntVT.getSimpleVT()); in selectFNeg()
1773 EVT RealVT = TLI.getValueType(DL, EVI->getType(), /*AllowUnknown=*/true); in selectExtractValue()
1780 const Value *Op0 = EVI->getOperand(0); in selectExtractValue()
1781 Type *AggTy = Op0->getType(); in selectExtractValue()
1787 ResultReg = I->second; in selectExtractValue()
1791 return false; // fast-isel can't handle aggregate constants at the moment in selectExtractValue()
1794 unsigned VTIndex = ComputeLinearIndex(AggTy, EVI->getIndices()); in selectExtractValue()
1800 ResultReg += TLI.getNumRegisters(FuncInfo.Fn->getContext(), AggValueVTs[i]); in selectExtractValue()
1846 return selectFNeg(I, I->getOperand(0)); in selectOperator()
1854 if (BI->isUnconditional()) { in selectOperator()
1855 const BasicBlock *LLVMSucc = BI->getSuccessor(0); in selectOperator()
1857 fastEmitBranch(MSucc, BI->getDebugLoc()); in selectOperator()
1862 // Halt "fast" selection and bail. in selectOperator()
1873 // FunctionLowering has the static-sized case covered. in selectOperator()
1877 // Dynamic-sized alloca is not handled yet. in selectOperator()
1881 // On AIX, normal call lowering uses the DAG-ISEL path currently so that the in selectOperator()
1885 // name is the C-linkage name of the source level function. in selectOperator()
1905 case Instruction::IntToPtr: // Deliberate fall-through. in selectOperator()
1907 EVT SrcVT = TLI.getValueType(DL, I->getOperand(0)->getType()); in selectOperator()
1908 EVT DstVT = TLI.getValueType(DL, I->getType()); in selectOperator()
1913 Register Reg = getRegForValue(I->getOperand(0)); in selectOperator()
1930 // Unhandled instruction. Halt "fast" selection and bail. in selectOperator()
1938 : FuncInfo(FuncInfo), MF(FuncInfo.MF), MRI(FuncInfo.MF->getRegInfo()), in FastISel()
1939 MFI(FuncInfo.MF->getFrameInfo()), MCP(*FuncInfo.MF->getConstantPool()), in FastISel()
1940 TM(FuncInfo.MF->getTarget()), DL(MF->getDataLayout()), in FastISel()
1941 TII(*MF->getSubtarget().getInstrInfo()), in FastISel()
1942 TLI(*MF->getSubtarget().getTargetLowering()), in FastISel()
1943 TRI(*MF->getSubtarget().getRegisterInfo()), LibInfo(LibInfo), in FastISel()
1992 // div x, 8 -> srl x, 3 in fastEmit_ri_()
1998 // in-range. in fastEmit_ri_()
2010 // fast-isel, which would be very slow. in fastEmit_ri_()
2012 IntegerType::get(FuncInfo.Fn->getContext(), VT.getSizeInBits()); in fastEmit_ri_()
2251 /// HandlePHINodesInSuccessorBlocks - Handle PHI nodes in successor blocks.
2264 if (!isa<PHINode>(SuccBB->begin())) in handlePHINodesInSuccessorBlocks()
2273 MachineBasicBlock::iterator MBBI = SuccMBB->begin(); in handlePHINodesInSuccessorBlocks()
2275 // At this point we know that there is a 1-1 correspondence between LLVM PHI in handlePHINodesInSuccessorBlocks()
2278 for (const PHINode &PN : SuccBB->phis()) { in handlePHINodesInSuccessorBlocks()
2288 // exactly one register for each non-void instruction. in handlePHINodesInSuccessorBlocks()
2320 assert(LI->hasOneUse() && in tryToFoldLoad()
2324 // this by scanning the single-use users of the load until we get to FoldInst. in tryToFoldLoad()
2325 unsigned MaxUsers = 6; // Don't scan down huge single-use chains of instrs. in tryToFoldLoad()
2327 const Instruction *TheUser = LI->user_back(); in tryToFoldLoad()
2330 TheUser->getParent() == FoldInst->getParent() && in tryToFoldLoad()
2331 --MaxUsers) { // Don't scan too far. in tryToFoldLoad()
2333 if (!TheUser->hasOneUse()) in tryToFoldLoad()
2336 TheUser = TheUser->user_back(); in tryToFoldLoad()
2346 if (LI->isVolatile()) in tryToFoldLoad()
2368 MachineInstr *User = RI->getParent(); in tryToFoldLoad()
2374 FuncInfo.MBB = User->getParent(); in tryToFoldLoad()
2385 if (DL.getTypeSizeInBits(GEP->getType()) != in canFoldAddIntoGEP()
2386 DL.getTypeSizeInBits(Add->getType())) in canFoldAddIntoGEP()
2390 FuncInfo.MBBMap[cast<Instruction>(Add)->getParent()] != FuncInfo.MBB) in canFoldAddIntoGEP()
2393 return isa<ConstantInt>(cast<AddOperator>(Add)->getOperand(1)); in canFoldAddIntoGEP()
2405 Alignment = LI->getAlign(); in createMachineMemOperandFor()
2406 IsVolatile = LI->isVolatile(); in createMachineMemOperandFor()
2408 Ptr = LI->getPointerOperand(); in createMachineMemOperandFor()
2409 ValTy = LI->getType(); in createMachineMemOperandFor()
2411 Alignment = SI->getAlign(); in createMachineMemOperandFor()
2412 IsVolatile = SI->isVolatile(); in createMachineMemOperandFor()
2414 Ptr = SI->getPointerOperand(); in createMachineMemOperandFor()
2415 ValTy = SI->getValueOperand()->getType(); in createMachineMemOperandFor()
2419 bool IsNonTemporal = I->hasMetadata(LLVMContext::MD_nontemporal); in createMachineMemOperandFor()
2420 bool IsInvariant = I->hasMetadata(LLVMContext::MD_invariant_load); in createMachineMemOperandFor()
2421 bool IsDereferenceable = I->hasMetadata(LLVMContext::MD_dereferenceable); in createMachineMemOperandFor()
2422 const MDNode *Ranges = I->getMetadata(LLVMContext::MD_range); in createMachineMemOperandFor()
2424 AAMDNodes AAInfo = I->getAAMetadata(); in createMachineMemOperandFor()
2440 return FuncInfo.MF->getMachineMemOperand(MachinePointerInfo(Ptr), Flags, Size, in createMachineMemOperandFor()
2446 CmpInst::Predicate Predicate = CI->getPredicate(); in optimizeCmpPredicate()
2447 if (CI->getOperand(0) != CI->getOperand(1)) in optimizeCmpPredicate()