| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 private: | 595 private: |
| 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 AssemblyProgram::LabelHandler abs32_handler = | 598 AssemblyProgram::LabelHandler abs32_handler = |
| 599 base::Bind(&GraphAdjuster::ReferenceLabel, base::Unretained(this), | 599 base::Bind(&GraphAdjuster::ReferenceLabel, base::Unretained(this), |
| 600 abs32, is_model); | 600 abs32, is_model); |
| 601 AssemblyProgram::LabelHandler rel32_handler = | 601 AssemblyProgram::LabelHandler rel32_handler = |
| 602 base::Bind(&GraphAdjuster::ReferenceLabel, base::Unretained(this), | 602 base::Bind(&GraphAdjuster::ReferenceLabel, base::Unretained(this), |
| 603 rel32, is_model); | 603 rel32, is_model); |
| 604 | 604 |
| 605 program->HandleInstructionLabels({{ABS32, abs32_handler}, | 605 program->HandleInstructionLabels({{AssemblyOp::ABS32, abs32_handler}, |
| 606 {REL32, rel32_handler}, | 606 {AssemblyOp::REL32, rel32_handler}, |
| 607 {REL32ARM, rel32_handler}}); | 607 {AssemblyOp::REL32ARM, rel32_handler}}); |
| 608 | 608 |
| 609 // TODO(sra): we could simply append all the labels in index order to | 609 // TODO(sra): we could simply append all the labels in index order to |
| 610 // incorporate some costing for entropy (bigger deltas) that will be | 610 // incorporate some costing for entropy (bigger deltas) that will be |
| 611 // introduced into the label address table by non-monotonic ordering. This | 611 // introduced into the label address table by non-monotonic ordering. This |
| 612 // would have some knock-on effects to parts of the algorithm that work on | 612 // would have some knock-on effects to parts of the algorithm that work on |
| 613 // single-occurrence labels. | 613 // single-occurrence labels. |
| 614 } | 614 } |
| 615 | 615 |
| 616 void Solve(const Trace& model, const Trace& problem) { | 616 void Solve(const Trace& model, const Trace& problem) { |
| 617 LinkLabelInfos(model); | 617 LinkLabelInfos(model); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 AdjustmentMethod* method = AdjustmentMethod::MakeProductionAdjustmentMethod(); | 689 AdjustmentMethod* method = AdjustmentMethod::MakeProductionAdjustmentMethod(); |
| 690 bool ok = method->Adjust(model, program); | 690 bool ok = method->Adjust(model, program); |
| 691 method->Destroy(); | 691 method->Destroy(); |
| 692 if (ok) | 692 if (ok) |
| 693 return C_OK; | 693 return C_OK; |
| 694 else | 694 else |
| 695 return C_ADJUSTMENT_FAILED; | 695 return C_ADJUSTMENT_FAILED; |
| 696 } | 696 } |
| 697 | 697 |
| 698 } // namespace courgette | 698 } // namespace courgette |
| OLD | NEW |