Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 11819031: Add canonicalize optimization for branches. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 virtual Definition* AsDefinition() { return this; } 1028 virtual Definition* AsDefinition() { return this; }
1029 1029
1030 bool IsComparison() { return (AsComparison() != NULL); } 1030 bool IsComparison() { return (AsComparison() != NULL); }
1031 virtual ComparisonInstr* AsComparison() { return NULL; } 1031 virtual ComparisonInstr* AsComparison() { return NULL; }
1032 1032
1033 // Overridden by definitions that push arguments. 1033 // Overridden by definitions that push arguments.
1034 virtual intptr_t ArgumentCount() const { return 0; } 1034 virtual intptr_t ArgumentCount() const { return 0; }
1035 1035
1036 intptr_t temp_index() const { return temp_index_; } 1036 intptr_t temp_index() const { return temp_index_; }
1037 void set_temp_index(intptr_t index) { temp_index_ = index; } 1037 void set_temp_index(intptr_t index) { temp_index_ = index; }
1038 void ClearTempIndex() { temp_index_ = -1; }
1038 1039
1039 intptr_t ssa_temp_index() const { return ssa_temp_index_; } 1040 intptr_t ssa_temp_index() const { return ssa_temp_index_; }
1040 void set_ssa_temp_index(intptr_t index) { 1041 void set_ssa_temp_index(intptr_t index) {
1041 ASSERT(index >= 0); 1042 ASSERT(index >= 0);
1042 ASSERT(is_used()); 1043 ASSERT(is_used());
1043 ssa_temp_index_ = index; 1044 ssa_temp_index_ = index;
1044 } 1045 }
1045 bool HasSSATemp() const { return ssa_temp_index_ >= 0; } 1046 bool HasSSATemp() const { return ssa_temp_index_ >= 0; }
1047 void ClearSSATempIndex() { ssa_temp_index_ = -1; }
1046 1048
1047 bool is_used() const { return (use_kind_ != kEffect); } 1049 bool is_used() const { return (use_kind_ != kEffect); }
1048 void set_use_kind(UseKind kind) { use_kind_ = kind; } 1050 void set_use_kind(UseKind kind) { use_kind_ = kind; }
1049 1051
1050 // Compile time type of the definition, which may be requested before type 1052 // Compile time type of the definition, which may be requested before type
1051 // propagation during graph building. 1053 // propagation during graph building.
1052 virtual RawAbstractType* CompileType() const = 0; 1054 virtual RawAbstractType* CompileType() const = 0;
1053 1055
1054 virtual intptr_t ResultCid() const = 0; 1056 virtual intptr_t ResultCid() const = 0;
1055 1057
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 virtual LocationSummary* locs(); 1522 virtual LocationSummary* locs();
1521 virtual intptr_t DeoptimizationTarget() const; 1523 virtual intptr_t DeoptimizationTarget() const;
1522 virtual Representation RequiredInputRepresentation(intptr_t i) const; 1524 virtual Representation RequiredInputRepresentation(intptr_t i) const;
1523 1525
1524 // Replace the comparison with another, leaving the branch intact. 1526 // Replace the comparison with another, leaving the branch intact.
1525 void ReplaceWith(ComparisonInstr* other, 1527 void ReplaceWith(ComparisonInstr* other,
1526 ForwardInstructionIterator* ignored) { 1528 ForwardInstructionIterator* ignored) {
1527 comparison_ = other; 1529 comparison_ = other;
1528 } 1530 }
1529 1531
1532 virtual Instruction* Canonicalize(FlowGraphOptimizer* optimizer);
1533
1530 virtual void PrintTo(BufferFormatter* f) const; 1534 virtual void PrintTo(BufferFormatter* f) const;
1531 1535
1532 private: 1536 private:
1533 ComparisonInstr* comparison_; 1537 ComparisonInstr* comparison_;
1534 const bool is_checked_; 1538 const bool is_checked_;
1535 1539
1536 DISALLOW_COPY_AND_ASSIGN(BranchInstr); 1540 DISALLOW_COPY_AND_ASSIGN(BranchInstr);
1537 }; 1541 };
1538 1542
1539 1543
(...skipping 2792 matching lines...) Expand 10 before | Expand all | Expand 10 after
4332 ForwardInstructionIterator* current_iterator_; 4336 ForwardInstructionIterator* current_iterator_;
4333 4337
4334 private: 4338 private:
4335 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 4339 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
4336 }; 4340 };
4337 4341
4338 4342
4339 } // namespace dart 4343 } // namespace dart
4340 4344
4341 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 4345 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698