Lines Matching defs:instruction

39  * converting a DEX instruction to multiple HInstruction, and where those
40 * instructions do not die at the following instruction, but instead spans
49 void Add(HInstruction* instruction) {
51 DCHECK(instruction->GetType() != Primitive::kPrimLong
52 && instruction->GetType() != Primitive::kPrimDouble);
54 instruction->GetBlock()->AddInstruction(temp);
55 DCHECK(temp->GetPrevious() == instruction);
140 void HGraphBuilder::If_22t(const Instruction& instruction, uint32_t dex_offset) {
141 HInstruction* first = LoadLocal(instruction.VRegA(), Primitive::kPrimInt);
142 HInstruction* second = LoadLocal(instruction.VRegB(), Primitive::kPrimInt);
147 HBasicBlock* target = FindBlockStartingAt(dex_offset + instruction.GetTargetOffset());
150 target = FindBlockStartingAt(dex_offset + instruction.SizeInCodeUnits());
157 void HGraphBuilder::If_21t(const Instruction& instruction, uint32_t dex_offset) {
158 HInstruction* value = LoadLocal(instruction.VRegA(), Primitive::kPrimInt);
163 HBasicBlock* target = FindBlockStartingAt(dex_offset + instruction.GetTargetOffset());
166 target = FindBlockStartingAt(dex_offset + instruction.SizeInCodeUnits());
203 const Instruction& instruction = *Instruction::At(code_ptr);
204 if (!AnalyzeDexInstruction(instruction, dex_offset)) return nullptr;
205 dex_offset += instruction.SizeInCodeUnits();
206 code_ptr += instruction.SizeInCodeUnits();
224 // the last instruction of the current block is not a branching
225 // instruction. We add an unconditional goto to the found block.
246 const Instruction& instruction = *Instruction::At(code_ptr);
247 if (instruction.IsBranch()) {
248 int32_t target = instruction.GetTargetOffset() + dex_offset;
249 // Create a block for the target instruction.
254 dex_offset += instruction.SizeInCodeUnits();
255 code_ptr += instruction.SizeInCodeUnits();
261 code_ptr += instruction.SizeInCodeUnits();
262 dex_offset += instruction.SizeInCodeUnits();
273 void HGraphBuilder::Binop_23x(const Instruction& instruction, Primitive::Type type) {
274 HInstruction* first = LoadLocal(instruction.VRegB(), type);
275 HInstruction* second = LoadLocal(instruction.VRegC(), type);
277 UpdateLocal(instruction.VRegA(), current_block_->GetLastInstruction());
281 void HGraphBuilder::Binop_12x(const Instruction& instruction, Primitive::Type type) {
282 HInstruction* first = LoadLocal(instruction.VRegA(), type);
283 HInstruction* second = LoadLocal(instruction.VRegB(), type);
285 UpdateLocal(instruction.VRegA(), current_block_->GetLastInstruction());
289 void HGraphBuilder::Binop_22s(const Instruction& instruction, bool reverse) {
290 HInstruction* first = LoadLocal(instruction.VRegB(), Primitive::kPrimInt);
291 HInstruction* second = GetIntConstant(instruction.VRegC_22s());
296 UpdateLocal(instruction.VRegA(), current_block_->GetLastInstruction());
300 void HGraphBuilder::Binop_22b(const Instruction& instruction, bool reverse) {
301 HInstruction* first = LoadLocal(instruction.VRegB(), Primitive::kPrimInt);
302 HInstruction* second = GetIntConstant(instruction.VRegC_22b());
307 UpdateLocal(instruction.VRegA(), current_block_->GetLastInstruction());
310 void HGraphBuilder::BuildReturn(const Instruction& instruction, Primitive::Type type) {
314 HInstruction* value = LoadLocal(instruction.VRegA(), type);
321 bool HGraphBuilder::BuildInvoke(const Instruction& instruction,
333 instruction.Opcode() != Instruction::INVOKE_STATIC
334 && instruction.Opcode() != Instruction::INVOKE_STATIC_RANGE;
381 bool HGraphBuilder::BuildFieldAccess(const Instruction& instruction,
384 uint32_t source_or_dest_reg = instruction.VRegA_22c();
385 uint32_t obj_reg = instruction.VRegB_22c();
386 uint16_t field_index = instruction.VRegC_22c();
428 void HGraphBuilder::BuildArrayAccess(const Instruction& instruction,
432 uint8_t source_or_dest_reg = instruction.VRegA_23x();
433 uint8_t array_reg = instruction.VRegB_23x();
434 uint8_t index_reg = instruction.VRegC_23x();
463 bool HGraphBuilder::AnalyzeDexInstruction(const Instruction& instruction, int32_t dex_offset) {
468 switch (instruction.Opcode()) {
470 int32_t register_index = instruction.VRegA();
471 HIntConstant* constant = GetIntConstant(instruction.VRegB_11n());
477 int32_t register_index = instruction.VRegA();
478 HIntConstant* constant = GetIntConstant(instruction.VRegB_21s());
484 int32_t register_index = instruction.VRegA();
485 HIntConstant* constant = GetIntConstant(instruction.VRegB_31i());
491 int32_t register_index = instruction.VRegA();
492 HIntConstant* constant = GetIntConstant(instruction.VRegB_21h() << 16);
498 int32_t register_index = instruction.VRegA();
500 int64_t value = instruction.VRegB_21s();
509 int32_t register_index = instruction.VRegA();
511 int64_t value = instruction.VRegB_31i();
520 int32_t register_index = instruction.VRegA();
521 HLongConstant* constant = GetLongConstant(instruction.VRegB_51l());
527 int32_t register_index = instruction.VRegA();
528 int64_t value = static_cast<int64_t>(instruction.VRegB_21h()) << 48;
539 HInstruction* value = LoadLocal(instruction.VRegB(), Primitive::kPrimInt);
540 UpdateLocal(instruction.VRegA(), value);
549 HInstruction* value = LoadLocal(instruction.VRegB(), Primitive::kPrimLong);
550 UpdateLocal(instruction.VRegA(), value);
557 HInstruction* value = LoadLocal(instruction.VRegB(), Primitive::kPrimNot);
558 UpdateLocal(instruction.VRegA(), value);
563 BuildReturn(instruction, Primitive::kPrimVoid);
568 case Instruction::IF_##cond: If_22t<comparison>(instruction, dex_offset); break; \
569 case Instruction::IF_##cond##Z: If_21t<comparison>(instruction, dex_offset); break
581 HBasicBlock* target = FindBlockStartingAt(instruction.GetTargetOffset() + dex_offset);
590 BuildReturn(instruction, Primitive::kPrimInt);
595 BuildReturn(instruction, Primitive::kPrimNot);
600 BuildReturn(instruction, Primitive::kPrimLong);
606 uint32_t method_idx = instruction.VRegB_35c();
607 uint32_t number_of_vreg_arguments = instruction.VRegA_35c();
609 instruction.GetVarArgs(args);
610 if (!BuildInvoke(instruction, dex_offset, method_idx, number_of_vreg_arguments, false, args, -1)) {
618 uint32_t method_idx = instruction.VRegB_3rc();
619 uint32_t number_of_vreg_arguments = instruction.VRegA_3rc();
620 uint32_t register_index = instruction.VRegC();
621 if (!BuildInvoke(instruction, dex_offset, method_idx,
629 Binop_23x<HAdd>(instruction, Primitive::kPrimInt);
634 Binop_23x<HAdd>(instruction, Primitive::kPrimLong);
639 Binop_23x<HSub>(instruction, Primitive::kPrimInt);
644 Binop_23x<HSub>(instruction, Primitive::kPrimLong);
649 Binop_12x<HAdd>(instruction, Primitive::kPrimInt);
654 Binop_12x<HAdd>(instruction, Primitive::kPrimLong);
659 Binop_12x<HSub>(instruction, Primitive::kPrimInt);
664 Binop_12x<HSub>(instruction, Primitive::kPrimLong);
669 Binop_22s<HAdd>(instruction, false);
674 Binop_22s<HSub>(instruction, true);
679 Binop_22b<HAdd>(instruction, false);
684 Binop_22b<HSub>(instruction, true);
690 new (arena_) HNewInstance(dex_offset, instruction.VRegB_21c()));
691 UpdateLocal(instruction.VRegA(), current_block_->GetLastInstruction());
698 UpdateLocal(instruction.VRegA(), current_block_->GetLastInstruction());
702 Binop_23x<HCompare>(instruction, Primitive::kPrimLong);
716 if (!BuildFieldAccess(instruction, dex_offset, false)) {
729 if (!BuildFieldAccess(instruction, dex_offset, true)) {
737 BuildArrayAccess(instruction, dex_offset, false, anticipated_type); \
741 BuildArrayAccess(instruction, dex_offset, true, anticipated_type); \
782 HIntConstant* instruction = new (arena_) HIntConstant(constant);
783 entry_block_->AddInstruction(instruction);
784 return instruction;
790 HLongConstant* instruction = new (arena_) HLongConstant(constant);
791 entry_block_->AddInstruction(instruction);
792 return instruction;
799 void HGraphBuilder::UpdateLocal(int register_index, HInstruction* instruction) const {
801 current_block_->AddInstruction(new (arena_) HStoreLocal(local, instruction));