Lines Matching +full:input +full:- +full:depth

1 //===- lib/CodeGen/GlobalISel/GISelKnownBits.cpp --------------*- C++ *-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
26 #define DEBUG_TYPE "gisel-known-bits"
39 Align GISelKnownBits::computeKnownAlignment(Register R, unsigned Depth) { in computeKnownAlignment() argument
41 switch (MI->getOpcode()) { in computeKnownAlignment()
43 return computeKnownAlignment(MI->getOperand(1).getReg(), Depth); in computeKnownAlignment()
46 return Align(MI->getOperand(2).getImm()); in computeKnownAlignment()
49 int FrameIdx = MI->getOperand(1).getIndex(); in computeKnownAlignment()
57 return TL.computeKnownAlignForTargetInstr(*this, R, MRI, Depth + 1); in computeKnownAlignment()
78 unsigned Depth) { in getKnownBits() argument
83 computeKnownBitsImpl(R, Known, DemandedElts, Depth); in getKnownBits()
101 dumpResult(const MachineInstr &MI, const KnownBits &Known, unsigned Depth) { in dumpResult() argument
102 dbgs() << "[" << Depth << "] Compute known bits: " << MI << "[" << Depth in dumpResult()
103 << "] Computed for: " << MI << "[" << Depth << "] Known: 0x" in dumpResult()
105 << "[" << Depth << "] Zero: 0x" << toString(Known.Zero, 16, false) in dumpResult()
107 << "[" << Depth << "] One: 0x" << toString(Known.One, 16, false) in dumpResult()
115 unsigned Depth) { in computeKnownBitsMin() argument
117 computeKnownBitsImpl(Src1, Known, DemandedElts, Depth); in computeKnownBitsMin()
124 computeKnownBitsImpl(Src0, Known2, DemandedElts, Depth); in computeKnownBitsMin()
146 unsigned Depth) { in computeKnownBitsImpl() argument
163 Known = CacheEntry->second; in computeKnownBitsImpl()
165 LLVM_DEBUG(dumpResult(MI, Known, Depth)); in computeKnownBitsImpl()
171 // Depth may get bigger than max depth if it gets passed to a different in computeKnownBitsImpl()
174 // with some max depth, but then we hit TL.computeKnownBitsForTargetInstr in computeKnownBitsImpl()
176 // depth. If we just check for equality, we would never exit if the depth in computeKnownBitsImpl()
178 // already bigger than its max depth. in computeKnownBitsImpl()
179 if (Depth >= getMaxDepth()) in computeKnownBitsImpl()
190 Depth); in computeKnownBitsImpl()
195 for (unsigned i = 0, e = MI.getNumOperands() - 1; i < e; ++i) { in computeKnownBitsImpl()
200 Depth + 1); in computeKnownBitsImpl()
217 // point of the pipeline, otherwise the main live-range will be in computeKnownBitsImpl()
236 // copies or phis of the form `%1:(s32) = OP %0:gpr32`, known-bits in computeKnownBitsImpl()
244 // For COPYs we don't do anything, don't increase the depth. in computeKnownBitsImpl()
246 Depth + (Opcode != TargetOpcode::COPY)); in computeKnownBitsImpl()
261 Known = KnownBits::makeConstant(MI.getOperand(1).getCImm()->getValue()); in computeKnownBitsImpl()
271 Depth + 1); in computeKnownBitsImpl()
273 Depth + 1); in computeKnownBitsImpl()
280 Depth + 1); in computeKnownBitsImpl()
282 Depth + 1); in computeKnownBitsImpl()
298 Depth + 1); in computeKnownBitsImpl()
300 Depth + 1); in computeKnownBitsImpl()
308 Depth + 1); in computeKnownBitsImpl()
310 Depth + 1); in computeKnownBitsImpl()
318 Depth + 1); in computeKnownBitsImpl()
320 Depth + 1); in computeKnownBitsImpl()
327 Depth + 1); in computeKnownBitsImpl()
329 Depth + 1); in computeKnownBitsImpl()
335 Known, DemandedElts, Depth + 1); in computeKnownBitsImpl()
342 Depth + 1); in computeKnownBitsImpl()
344 Depth + 1); in computeKnownBitsImpl()
352 Depth + 1); in computeKnownBitsImpl()
354 Depth + 1); in computeKnownBitsImpl()
361 DemandedElts, Depth + 1); in computeKnownBitsImpl()
363 DemandedElts, Depth + 1); in computeKnownBitsImpl()
370 DemandedElts, Depth + 1); in computeKnownBitsImpl()
372 DemandedElts, Depth + 1); in computeKnownBitsImpl()
389 Depth + 1); in computeKnownBitsImpl()
398 Depth + 1); in computeKnownBitsImpl()
404 Depth + 1); in computeKnownBitsImpl()
410 KnownBits KnownRange(MMO->getMemoryType().getScalarSizeInBits()); in computeKnownBitsImpl()
411 if (const MDNode *Ranges = MMO->getRanges()) in computeKnownBitsImpl()
421 KnownBits KnownRange(MMO->getMemoryType().getScalarSizeInBits()); in computeKnownBitsImpl()
422 if (const MDNode *Ranges = MMO->getRanges()) in computeKnownBitsImpl()
432 Depth + 1); in computeKnownBitsImpl()
434 Depth + 1); in computeKnownBitsImpl()
441 Depth + 1); in computeKnownBitsImpl()
443 Depth + 1); in computeKnownBitsImpl()
450 Depth + 1); in computeKnownBitsImpl()
452 Depth + 1); in computeKnownBitsImpl()
479 computeKnownBitsImpl(SrcReg, Known, DemandedElts, Depth + 1); in computeKnownBitsImpl()
499 for (unsigned I = 0; I != NumOps - 1; ++I) { in computeKnownBitsImpl()
502 DemandedElts, Depth + 1); in computeKnownBitsImpl()
511 Register SrcReg = MI.getOperand(NumOps - 1).getReg(); in computeKnownBitsImpl()
516 computeKnownBitsImpl(SrcReg, SrcOpKnown, DemandedElts, Depth + 1); in computeKnownBitsImpl()
520 for (; DstIdx != NumOps - 1 && MI.getOperand(DstIdx).getReg() != R; in computeKnownBitsImpl()
529 computeKnownBitsImpl(SrcReg, Known, DemandedElts, Depth + 1); in computeKnownBitsImpl()
535 computeKnownBitsImpl(SrcReg, Known, DemandedElts, Depth + 1); in computeKnownBitsImpl()
541 Depth + 1); in computeKnownBitsImpl()
554 Depth + 1); in computeKnownBitsImpl()
556 Depth + 1); in computeKnownBitsImpl()
558 Depth + 1); in computeKnownBitsImpl()
565 Depth + 1); in computeKnownBitsImpl()
567 Depth + 1); in computeKnownBitsImpl()
569 Depth + 1); in computeKnownBitsImpl()
603 Depth + 1); in computeKnownBitsImpl()
612 LLVM_DEBUG(dumpResult(MI, Known, Depth)); in computeKnownBitsImpl()
621 unsigned Depth) { in computeNumSignBitsMin() argument
623 unsigned Src1SignBits = computeNumSignBits(Src1, DemandedElts, Depth); in computeNumSignBitsMin()
626 return std::min(computeNumSignBits(Src0, DemandedElts, Depth), Src1SignBits); in computeNumSignBitsMin()
634 const MDNode *Ranges = Ld->getRanges(); in computeNumSignBitsFromRangeMetadata()
640 switch (Ld->getOpcode()) { in computeNumSignBitsFromRangeMetadata()
658 unsigned Depth) { in computeNumSignBits() argument
663 return MI.getOperand(1).getCImm()->getValue().getNumSignBits(); in computeNumSignBits()
665 if (Depth == getMaxDepth()) in computeNumSignBits()
687 // Don't increment Depth for this one since we didn't do any work. in computeNumSignBits()
688 return computeNumSignBits(Src.getReg(), DemandedElts, Depth); in computeNumSignBits()
696 unsigned Tmp = DstTy.getScalarSizeInBits() - SrcTy.getScalarSizeInBits(); in computeNumSignBits()
697 return computeNumSignBits(Src, DemandedElts, Depth + 1) + Tmp; in computeNumSignBits()
701 // Max of the input and what this extends. in computeNumSignBits()
704 unsigned InRegBits = TyBits - SrcBits + 1; in computeNumSignBits()
705 return std::max(computeNumSignBits(Src, DemandedElts, Depth + 1), InRegBits); in computeNumSignBits()
717 // FIXME: We need an in-memory type representation. in computeNumSignBits()
725 // e.g. i16->i32 = '17' bits known. in computeNumSignBits()
727 return TyBits - MMO->getSizeInBits().getValue() + 1; in computeNumSignBits()
732 // FIXME: We need an in-memory type representation. in computeNumSignBits()
740 // e.g. i16->i32 = '16' bits known. in computeNumSignBits()
742 return TyBits - MMO->getSizeInBits().getValue(); in computeNumSignBits()
749 computeNumSignBits(Src1, DemandedElts, Depth + 1); in computeNumSignBits()
753 computeNumSignBits(Src2, DemandedElts, Depth + 1); in computeNumSignBits()
765 unsigned NumSrcSignBits = computeNumSignBits(Src, DemandedElts, Depth + 1); in computeNumSignBits()
766 if (NumSrcSignBits > (NumSrcBits - DstTyBits)) in computeNumSignBits()
767 return NumSrcSignBits - (NumSrcBits - DstTyBits); in computeNumSignBits()
773 Depth + 1); in computeNumSignBits()
785 // If compares returns 0/-1, all bits are sign bits. in computeNumSignBits()
786 // We know that we have an integer-based boolean since these operations in computeNumSignBits()
805 return TyBits - 1; // Every always-zero bit is a sign bit. in computeNumSignBits()
814 TL.computeNumSignBitsForTargetInstr(*this, R, DemandedElts, MRI, Depth); in computeNumSignBits()
823 KnownBits Known = getKnownBits(R, DemandedElts, Depth); in computeNumSignBits()
835 // the number of identical bits in the top of the input value. in computeNumSignBits()
836 Mask <<= Mask.getBitWidth() - TyBits; in computeNumSignBits()
840 unsigned GISelKnownBits::computeNumSignBits(Register R, unsigned Depth) { in computeNumSignBits() argument
844 return computeNumSignBits(R, DemandedElts, Depth); in computeNumSignBits()