| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "courgette/adjustment_method.h" | 5 #include "courgette/adjustment_method.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 Solve(model_abs32_, prog_abs32_); | 588 Solve(model_abs32_, prog_abs32_); |
| 589 Solve(model_rel32_, prog_rel32_); | 589 Solve(model_rel32_, prog_rel32_); |
| 590 prog_->AssignRemainingIndexes(); | 590 prog_->AssignRemainingIndexes(); |
| 591 return true; | 591 return true; |
| 592 } | 592 } |
| 593 | 593 |
| 594 private: | 594 private: |
| 595 | 595 |
| 596 void CollectTraces(const AssemblyProgram* program, Trace* abs32, Trace* rel32, | 596 void CollectTraces(const AssemblyProgram* program, Trace* abs32, Trace* rel32, |
| 597 bool is_model) { | 597 bool is_model) { |
| 598 const std::vector<Instruction*>& instructions = program->instructions(); | 598 const InstructionVector& instructions = program->instructions(); |
| 599 for (size_t i = 0; i < instructions.size(); ++i) { | 599 for (size_t i = 0; i < instructions.size(); ++i) { |
| 600 Instruction* instruction = instructions.at(i); | 600 Instruction* instruction = instructions.at(i); |
| 601 if (Label* label = program->InstructionAbs32Label(instruction)) | 601 if (Label* label = program->InstructionAbs32Label(instruction)) |
| 602 ReferenceLabel(abs32, label, is_model); | 602 ReferenceLabel(abs32, label, is_model); |
| 603 if (Label* label = program->InstructionRel32Label(instruction)) | 603 if (Label* label = program->InstructionRel32Label(instruction)) |
| 604 ReferenceLabel(rel32, label, is_model); | 604 ReferenceLabel(rel32, label, is_model); |
| 605 } | 605 } |
| 606 // TODO(sra): we could simply append all the labels in index order to | 606 // TODO(sra): we could simply append all the labels in index order to |
| 607 // incorporate some costing for entropy (bigger deltas) that will be | 607 // incorporate some costing for entropy (bigger deltas) that will be |
| 608 // introduced into the label address table by non-monotonic ordering. This | 608 // introduced into the label address table by non-monotonic ordering. This |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 AdjustmentMethod* method = AdjustmentMethod::MakeProductionAdjustmentMethod(); | 686 AdjustmentMethod* method = AdjustmentMethod::MakeProductionAdjustmentMethod(); |
| 687 bool ok = method->Adjust(model, program); | 687 bool ok = method->Adjust(model, program); |
| 688 method->Destroy(); | 688 method->Destroy(); |
| 689 if (ok) | 689 if (ok) |
| 690 return C_OK; | 690 return C_OK; |
| 691 else | 691 else |
| 692 return C_ADJUSTMENT_FAILED; | 692 return C_ADJUSTMENT_FAILED; |
| 693 } | 693 } |
| 694 | 694 |
| 695 } // namespace courgette | 695 } // namespace courgette |
| OLD | NEW |