Lines Matching refs:allocator
33 // Note: the register allocator tests rely on the fact that constants have live
40 ArenaAllocator allocator(&pool);
41 HGraph* graph = CreateCFG(&allocator, data);
47 RegisterAllocator register_allocator(&allocator, &codegen, liveness);
53 * Unit testing of RegisterAllocator::ValidateIntervals. Register allocator
58 ArenaAllocator allocator(&pool);
59 HGraph* graph = CreateGraph(&allocator);
63 ArenaVector<LiveInterval*> intervals(allocator.Adapter());
68 intervals.push_back(BuildInterval(ranges, arraysize(ranges), &allocator, 0));
69 intervals.push_back(BuildInterval(ranges, arraysize(ranges), &allocator, 1));
71 intervals, 0, 0, codegen, &allocator, true, false));
75 intervals, 0, 0, codegen, &allocator, true, false));
82 intervals.push_back(BuildInterval(ranges1, arraysize(ranges1), &allocator, 0));
84 intervals.push_back(BuildInterval(ranges2, arraysize(ranges2), &allocator, 1));
86 intervals, 0, 0, codegen, &allocator, true, false));
90 intervals, 0, 0, codegen, &allocator, true, false));
97 intervals.push_back(BuildInterval(ranges1, arraysize(ranges1), &allocator, 0));
99 intervals.push_back(BuildInterval(ranges2, arraysize(ranges2), &allocator, 1));
101 intervals, 0, 0, codegen, &allocator, true, false));
105 intervals, 0, 0, codegen, &allocator, true, false));
112 intervals.push_back(BuildInterval(ranges1, arraysize(ranges1), &allocator, 0));
114 intervals.push_back(BuildInterval(ranges2, arraysize(ranges2), &allocator, 1));
116 intervals, 0, 0, codegen, &allocator, true, false));
120 intervals, 0, 0, codegen, &allocator, true, false));
127 intervals.push_back(BuildInterval(ranges1, arraysize(ranges1), &allocator, 0));
130 intervals.push_back(BuildInterval(ranges2, arraysize(ranges2), &allocator, 1));
132 intervals, 0, 0, codegen, &allocator, true, false));
137 intervals, 0, 0, codegen, &allocator, true, false));
141 intervals, 0, 0, codegen, &allocator, true, false));
291 ArenaAllocator allocator(&pool);
292 HGraph* graph = CreateCFG(&allocator, data);
298 RegisterAllocator register_allocator(&allocator, &codegen, liveness);
325 ArenaAllocator allocator(&pool);
326 HGraph* graph = CreateCFG(&allocator, data);
379 ArenaAllocator allocator(&pool);
380 HGraph* graph = CreateCFG(&allocator, data);
387 RegisterAllocator register_allocator(&allocator, &codegen, liveness);
403 ArenaAllocator allocator(&pool);
404 HGraph* graph = CreateCFG(&allocator, data);
411 RegisterAllocator register_allocator(&allocator, &codegen, liveness);
417 // Populate the instructions in the liveness object, to please the register allocator.
430 LiveInterval* interval = LiveInterval::MakeFixedInterval(&allocator, 0, Primitive::kPrimInt);
434 interval = LiveInterval::MakeFixedInterval(&allocator, 0, Primitive::kPrimInt);
438 interval = LiveInterval::MakeFixedInterval(&allocator, 0, Primitive::kPrimInt);
443 register_allocator.registers_array_ = allocator.AllocArray<size_t>(1);
456 static HGraph* BuildIfElseWithPhi(ArenaAllocator* allocator,
460 HGraph* graph = CreateGraph(allocator);
461 HBasicBlock* entry = new (allocator) HBasicBlock(graph);
465 HInstruction* parameter = new (allocator) HParameterValue(
469 HBasicBlock* block = new (allocator) HBasicBlock(graph);
473 HInstruction* test = new (allocator) HInstanceFieldGet(parameter,
483 block->AddInstruction(new (allocator) HIf(test));
484 HBasicBlock* then = new (allocator) HBasicBlock(graph);
485 HBasicBlock* else_ = new (allocator) HBasicBlock(graph);
486 HBasicBlock* join = new (allocator) HBasicBlock(graph);
495 then->AddInstruction(new (allocator) HGoto());
496 else_->AddInstruction(new (allocator) HGoto());
498 *phi = new (allocator) HPhi(allocator, 0, 0, Primitive::kPrimInt);
500 *input1 = new (allocator) HInstanceFieldGet(parameter,
509 *input2 = new (allocator) HInstanceFieldGet(parameter,
520 join->AddInstruction(new (allocator) HExit());
531 ArenaAllocator allocator(&pool);
536 HGraph* graph = BuildIfElseWithPhi(&allocator, &phi, &input1, &input2);
543 // Check that the register allocator is deterministic.
544 RegisterAllocator register_allocator(&allocator, &codegen, liveness);
553 HGraph* graph = BuildIfElseWithPhi(&allocator, &phi, &input1, &input2);
563 RegisterAllocator register_allocator(&allocator, &codegen, liveness);
572 HGraph* graph = BuildIfElseWithPhi(&allocator, &phi, &input1, &input2);
582 RegisterAllocator register_allocator(&allocator, &codegen, liveness);
591 HGraph* graph = BuildIfElseWithPhi(&allocator, &phi, &input1, &input2);
601 RegisterAllocator register_allocator(&allocator, &codegen, liveness);
610 static HGraph* BuildFieldReturn(ArenaAllocator* allocator,
613 HGraph* graph = CreateGraph(allocator);
615 HBasicBlock* entry = new (allocator) HBasicBlock(graph);
618 HInstruction* parameter = new (allocator) HParameterValue(
622 HBasicBlock* block = new (allocator) HBasicBlock(graph);
626 *field = new (allocator) HInstanceFieldGet(parameter,
636 *ret = new (allocator) HReturn(*field);
639 HBasicBlock* exit = new (allocator) HBasicBlock(graph);
642 exit->AddInstruction(new (allocator) HExit());
650 ArenaAllocator allocator(&pool);
654 HGraph* graph = BuildFieldReturn(&allocator, &field, &ret);
661 RegisterAllocator register_allocator(&allocator, &codegen, liveness);
669 HGraph* graph = BuildFieldReturn(&allocator, &field, &ret);
680 RegisterAllocator register_allocator(&allocator, &codegen, liveness);
687 static HGraph* BuildTwoSubs(ArenaAllocator* allocator,
690 HGraph* graph = CreateGraph(allocator);
691 HBasicBlock* entry = new (allocator) HBasicBlock(graph);
694 HInstruction* parameter = new (allocator) HParameterValue(
701 HBasicBlock* block = new (allocator) HBasicBlock(graph);
705 *first_sub = new (allocator) HSub(Primitive::kPrimInt, parameter, constant1);
707 *second_sub = new (allocator) HSub(Primitive::kPrimInt, *first_sub, constant2);
710 block->AddInstruction(new (allocator) HExit());
718 ArenaAllocator allocator(&pool);
722 HGraph* graph = BuildTwoSubs(&allocator, &first_sub, &second_sub);
729 RegisterAllocator register_allocator(&allocator, &codegen, liveness);
738 HGraph* graph = BuildTwoSubs(&allocator, &first_sub, &second_sub);
751 RegisterAllocator register_allocator(&allocator, &codegen, liveness);
759 static HGraph* BuildDiv(ArenaAllocator* allocator,
761 HGraph* graph = CreateGraph(allocator);
762 HBasicBlock* entry = new (allocator) HBasicBlock(graph);
765 HInstruction* first = new (allocator) HParameterValue(
767 HInstruction* second = new (allocator) HParameterValue(
772 HBasicBlock* block = new (allocator) HBasicBlock(graph);
776 *div = new (allocator) HDiv(Primitive::kPrimInt, first, second, 0); // don't care about dex_pc.
779 block->AddInstruction(new (allocator) HExit());
787 ArenaAllocator allocator(&pool);
791 HGraph* graph = BuildDiv(&allocator, &div);
798 RegisterAllocator register_allocator(&allocator, &codegen, liveness);
806 // Test a bug in the register allocator, where allocating a blocked
814 ArenaAllocator allocator(&pool);
815 HGraph* graph = CreateGraph(&allocator);
816 HBasicBlock* entry = new (&allocator) HBasicBlock(graph);
819 HInstruction* one = new (&allocator) HParameterValue(
821 HInstruction* two = new (&allocator) HParameterValue(
823 HInstruction* three = new (&allocator) HParameterValue(
825 HInstruction* four = new (&allocator) HParameterValue(
832 HBasicBlock* block = new (&allocator) HBasicBlock(graph);
835 block->AddInstruction(new (&allocator) HExit());
839 HPhi* user = new (&allocator) HPhi(&allocator, 0, 1, Primitive::kPrimInt);
842 LocationSummary* locations = new (&allocator) LocationSummary(user, LocationSummary::kNoCall);
845 BuildInterval(phi_ranges, arraysize(phi_ranges), &allocator, -1, user);
849 LiveInterval* first = BuildInterval(ranges1, arraysize(ranges1), &allocator, -1, one);
850 first->first_use_ = new(&allocator) UsePosition(user, 0, false, 8, first->first_use_);
851 first->first_use_ = new(&allocator) UsePosition(user, 0, false, 7, first->first_use_);
852 first->first_use_ = new(&allocator) UsePosition(user, 0, false, 6, first->first_use_);
854 locations = new (&allocator) LocationSummary(first->GetDefinedBy(), LocationSummary::kNoCall);
861 allocator, -1, two);
862 locations = new (&allocator) LocationSummary(second->GetDefinedBy(), LocationSummary::kNoCall);
871 LiveInterval* third = BuildInterval(ranges3, arraysize(ranges3), &allocator, -1, three);
872 third->first_use_ = new(&allocator) UsePosition(user, 0, false, 8, third->first_use_);
873 third->first_use_ = new(&allocator) UsePosition(user, 0, false, 4, third->first_use_);
874 third->first_use_ = new(&allocator) UsePosition(user, 0, false, 3, third->first_use_);
875 locations = new (&allocator) LocationSummary(third->GetDefinedBy(), LocationSummary::kNoCall);
882 LiveInterval* fourth = BuildInterval(ranges4, arraysize(ranges4), &allocator, -1, four);
883 locations = new (&allocator) LocationSummary(fourth->GetDefinedBy(), LocationSummary::kNoCall);
890 // Populate the instructions in the liveness object, to please the register allocator.
895 RegisterAllocator register_allocator(&allocator, &codegen, liveness);
903 register_allocator.registers_array_ = allocator.AllocArray<size_t>(1);
909 ArenaVector<LiveInterval*> intervals(allocator.Adapter());
915 intervals, 0, 0, codegen, &allocator, true, false));