Lines Matching refs:instruction

30 static bool IsAllowedToJumpToExitBlock(HInstruction* instruction) {
31 return instruction->IsThrow() || instruction->IsReturn() || instruction->IsReturnVoid();
94 // Ensure `block` ends with a branch instruction.
97 // instruction. Such code is removed during the SSA-building DCE phase.
99 AddError(StringPrintf("Block %d does not end with a branch instruction.",
111 AddError(StringPrintf("Unexpected instruction %s:%d jumps into the exit block.",
144 AddError(StringPrintf("The recorded last instruction of block %d does not match "
145 "the actual last instruction %d.",
257 // Perform the instruction base checks too.
263 AddError(StringPrintf("A graph compiled OSR cannot have a HDeoptimize instruction"));
266 // Perform the instruction base checks too.
301 // Ensure that LoadException is the first instruction in a catch block.
308 AddError(StringPrintf("%s:%d is not the first instruction in catch block %d.",
315 void GraphChecker::VisitInstruction(HInstruction* instruction) {
316 if (seen_ids_.IsBitSet(instruction->GetId())) {
318 instruction->GetId()));
320 seen_ids_.SetBit(instruction->GetId());
323 // Ensure `instruction` is associated with `current_block_`.
324 if (instruction->GetBlock() == nullptr) {
326 instruction->IsPhi() ? "Phi" : "Instruction",
327 instruction->GetId(),
329 } else if (instruction->GetBlock() != current_block_) {
331 instruction->IsPhi() ? "Phi" : "Instruction",
332 instruction->GetId(),
334 instruction->GetBlock()->GetBlockId()));
337 // Ensure the inputs of `instruction` are defined in a block of the graph.
338 for (HInputIterator input_it(instruction); !input_it.Done();
345 AddError(StringPrintf("Input %d of instruction %d is not defined "
348 instruction->GetId()));
352 // Ensure the uses of `instruction` are defined in a block of the graph,
354 for (const HUseListNode<HInstruction*>& use : instruction->GetUses()) {
360 AddError(StringPrintf("User %s:%d of instruction %d is not defined "
364 instruction->GetId()));
367 if ((use_index >= user->InputCount()) || (user->InputAt(use_index) != instruction)) {
368 AddError(StringPrintf("User %s:%d of instruction %s:%d has a wrong "
372 instruction->DebugName(),
373 instruction->GetId()));
378 for (const HUseListNode<HEnvironment*>& use : instruction->GetEnvUses()) {
381 if ((use_index >= user->Size()) || (user->GetInstructionAt(use_index) != instruction)) {
384 instruction->DebugName(),
385 instruction->GetId()));
389 // Ensure 'instruction' has pointers to its inputs' use entries.
390 for (size_t i = 0, e = instruction->InputCount(); i < e; ++i) {
391 HUserRecord<HInstruction*> input_record = instruction->InputRecordAt(i);
399 instruction->DebugName(),
400 instruction->GetId(),
407 // Ensure an instruction dominates all its uses.
408 for (const HUseListNode<HInstruction*>& use : instruction->GetUses()) {
410 if (!user->IsPhi() && !instruction->StrictlyDominates(user)) {
413 instruction->DebugName(),
414 instruction->GetId(),
422 if (instruction->NeedsEnvironment() && !instruction->HasEnvironment()) {
425 instruction->DebugName(),
426 instruction->GetId(),
430 // Ensure an instruction having an environment is dominated by the
432 for (HEnvironment* environment = instruction->GetEnvironment();
438 && !env_instruction->StrictlyDominates(instruction)) {
439 AddError(StringPrintf("Instruction %d in environment of instruction %d "
440 "from block %d does not dominate instruction %d.",
442 instruction->GetId(),
444 instruction->GetId()));
450 if (instruction->GetType() == Primitive::kPrimNot) {
452 if (!instruction->GetReferenceTypeInfo().IsValid()) {
453 AddError(StringPrintf("Reference type instruction %s:%d does not have "
455 instruction->DebugName(),
456 instruction->GetId()));
460 if (instruction->CanThrowIntoCatchBlock()) {
463 HEnvironment* environment = instruction->GetEnvironment();
468 // Find all catch blocks and test that `instruction` has an environment
470 const HTryBoundary& entry = instruction->GetBlock()->GetTryCatchInformation()->GetTryEntry();
478 instruction->DebugName(),
479 instruction->GetId(),
503 "has a last instruction (%s:%d) which is neither a clinit check "
504 "nor a load class instruction.",
545 void GraphChecker::VisitInstanceOf(HInstanceOf* instruction) {
546 VisitInstruction(instruction);
547 HInstruction* input = instruction->InputAt(1);
550 instruction->DebugName(),
551 instruction->GetId(),
577 "Loop header %d does not have the loop suspend check as the first instruction.",
730 // instruction cannot throw. Instead, we at least test that all phis have the
837 void GraphChecker::HandleBooleanInput(HInstruction* instruction, size_t input_index) {
838 HInstruction* input = instruction->InputAt(input_index);
843 "%s instruction %d has a non-Boolean constant input %d whose value is: %d.",
844 instruction->DebugName(),
845 instruction->GetId(),
853 "%s instruction %d has a non-integer input %d whose type is: %s.",
854 instruction->DebugName(),
855 instruction->GetId(),
861 void GraphChecker::VisitPackedSwitch(HPackedSwitch* instruction) {
862 VisitInstruction(instruction);
865 HBasicBlock* block = instruction->GetBlock();
866 if (instruction->GetNumEntries() + 1u != block->GetSuccessors().size()) {
868 "%s instruction %d in block %d expects %u successors to the block, but found: %zu.",
869 instruction->DebugName(),
870 instruction->GetId(),
872 instruction->GetNumEntries() + 1u,
877 void GraphChecker::VisitIf(HIf* instruction) {
878 VisitInstruction(instruction);
879 HandleBooleanInput(instruction, 0);
882 void GraphChecker::VisitSelect(HSelect* instruction) {
883 VisitInstruction(instruction);
884 HandleBooleanInput(instruction, 2);
887 void GraphChecker::VisitBooleanNot(HBooleanNot* instruction) {
888 VisitInstruction(instruction);
889 HandleBooleanInput(instruction, 0);
922 void GraphChecker::VisitNeg(HNeg* instruction) {
923 VisitInstruction(instruction);
924 Primitive::Type input_type = instruction->InputAt(0)->GetType();
925 Primitive::Type result_type = instruction->GetType();
929 instruction->DebugName(), instruction->GetId(),
994 void GraphChecker::VisitConstant(HConstant* instruction) {
995 HBasicBlock* block = instruction->GetBlock();
999 instruction->DebugName(),
1000 instruction->GetId(),
1005 void GraphChecker::VisitBoundType(HBoundType* instruction) {
1006 VisitInstruction(instruction);
1009 if (!instruction->GetUpperBound().IsValid()) {
1012 instruction->DebugName(),
1013 instruction->GetId()));
1017 void GraphChecker::VisitTypeConversion(HTypeConversion* instruction) {
1018 VisitInstruction(instruction);
1019 Primitive::Type result_type = instruction->GetResultType();
1020 Primitive::Type input_type = instruction->GetInputType();
1025 instruction->DebugName(),
1026 instruction->GetId(),