Lines Matching refs:instruction

31   ValueBound(HInstruction* instruction, int32_t constant) {
32 if (instruction != nullptr && instruction->IsIntConstant()) {
33 // Normalize ValueBound with constant instruction.
34 int32_t instr_const = instruction->AsIntConstant()->GetValue();
41 instruction_ = instruction;
61 static bool IsAddOrSubAConstant(HInstruction* instruction,
64 if (instruction->IsAdd() || instruction->IsSub()) {
65 HBinaryOperation* bin_op = instruction->AsBinaryOperation();
71 *right_constant = instruction->IsAdd() ? c : -c;
80 // Try to detect useful value bound format from an instruction, e.g.
82 static ValueBound DetectValueBoundFromValue(HInstruction* instruction, bool* found) {
83 DCHECK(instruction != nullptr);
84 if (instruction->IsIntConstant()) {
86 return ValueBound(nullptr, instruction->AsIntConstant()->GetValue());
89 if (instruction->IsArrayLength()) {
91 return ValueBound(instruction, 0);
96 if (IsAddOrSubAConstant(instruction, &left, &right)) {
112 // Some bounds are created with HNewArray* as the instruction instead
129 static HInstruction* FromArrayLengthToArray(HInstruction* instruction) {
130 DCHECK(instruction->IsArrayLength() || instruction->IsNewArray());
131 if (instruction->IsArrayLength()) {
132 HInstruction* input = instruction->InputAt(0);
138 return instruction;
150 // Some bounds are created with HNewArray* as the instruction instead
325 for (HInstruction* instruction = block->GetFirstInstruction();
326 instruction != nullptr;
327 instruction = instruction->GetNext()) {
328 if (!instruction->IsBoundsCheck()) {
332 HInstruction* length_value = instruction->InputAt(1);
365 HInstruction* index = instruction->AsBoundsCheck()->InputAt(0);
390 // The instruction that corresponds to a MonotonicValueRange.
524 HInstruction* instruction = header->GetLastInstruction();
525 DCHECK(instruction->IsIf());
526 HIf* h_if = instruction->AsIf();
1147 ValueRange* LookupValueRange(HInstruction* instruction, HBasicBlock* basic_block) {
1151 if (map->find(instruction->GetId()) != map->end()) {
1152 return map->Get(instruction->GetId());
1163 // Narrow the value range of `instruction` at the end of `basic_block` with `range`,
1165 void ApplyRangeFromComparison(HInstruction* instruction, HBasicBlock* basic_block,
1167 ValueRange* existing_range = LookupValueRange(instruction, basic_block);
1170 GetValueRangeMap(successor)->Overwrite(instruction->GetId(), range);
1175 DCHECK(instruction->IsLoopHeaderPhi());
1178 if (instruction->GetBlock() != basic_block) {
1183 GetValueRangeMap(successor)->Overwrite(instruction->GetId(), narrowed_range);
1188 void HandleIfBetweenTwoMonotonicValueRanges(HIf* instruction,
1196 if (instruction->GetBlock() != left->GetBlock()) {
1214 successor = instruction->IfTrueSuccessor();
1216 successor = instruction->IfTrueSuccessor();
1218 successor = instruction->IfFalseSuccessor();
1222 successor = instruction->IfFalseSuccessor();
1237 ApplyRangeFromComparison(left, instruction->GetBlock(), successor,
1246 ApplyRangeFromComparison(right, instruction->GetBlock(), successor,
1254 void HandleIf(HIf* instruction, HInstruction* left, HInstruction* right, IfCondition cond) {
1255 HBasicBlock* block = instruction->GetBlock();
1257 HBasicBlock* true_successor = instruction->IfTrueSuccessor();
1261 HBasicBlock* false_successor = instruction->IfFalseSuccessor();
1271 if (instruction->GetBlock() != loop_head) {
1272 // For monotonic value range, don't handle `instruction`
1292 HandleIfBetweenTwoMonotonicValueRanges(instruction, left, right, cond,
1313 instruction->IfFalseSuccessor()->GetLoopInformation() == block->GetLoopInformation()) {
1347 instruction->IfFalseSuccessor()->GetLoopInformation() == block->GetLoopInformation()) {
1436 // That bounds check instruction has an associated HEnvironment where we
1486 HInstruction* instruction = phi->InputAt(1);
1489 if (ValueBound::IsAddOrSubAConstant(instruction, &left, &increment)) {
1529 void VisitIf(HIf* instruction) {
1530 if (instruction->InputAt(0)->IsCondition()) {
1531 HCondition* cond = instruction->InputAt(0)->AsCondition();
1537 HandleIf(instruction, left, right, cmp);
1539 HBasicBlock* block = instruction->GetBlock();
1646 void FindAndHandlePartialArrayLength(HBinaryOperation* instruction) {
1647 DCHECK(instruction->IsDiv() || instruction->IsShr() || instruction->IsUShr());
1648 HInstruction* right = instruction->GetRight();
1653 if ((instruction->IsDiv() && right_const <= 1) ||
1654 (instruction->IsShr() && right_const < 1) ||
1655 (instruction->IsUShr() && right_const < 1)) {
1663 HInstruction* left = instruction->GetLeft();
1669 // The value of left input of instruction equals (left + c).
1675 if (instruction->IsUShr() && c < 0) {
1685 GetValueRangeMap(instruction->GetBlock())->Overwrite(instruction->GetId(), range);
1701 void VisitAnd(HAnd* instruction) {
1702 if (instruction->GetRight()->IsIntConstant()) {
1703 int32_t constant = instruction->GetRight()->AsIntConstant()->GetValue();
1711 GetValueRangeMap(instruction->GetBlock())->Overwrite(instruction->GetId(), range);
1726 // which isn't available as an instruction yet. new_array will
1744 HInstruction* instruction = less_than_or_equal->InputAt(0);
1745 if (instruction->IsArrayLength()) {
1752 GetValueRangeMap(deoptimize->GetBlock())->Overwrite(instruction->GetId(), range);
1822 // Map an HArrayLength instruction's id to the first HBoundsCheck instruction in
1826 // For the block, there is at least one HArrayLength instruction for which there
1827 // is more than one bounds check instruction with constant indexing. And it's
1828 // beneficial to add a compare instruction that has deoptimization fallback and
1846 // be bounded by a range at one instruction, it must be true that all uses of
1847 // that value dominated by that instruction fits in that range. Range of that