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

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

Issue 12827027: Revert "Compute local variable liveness before translation to SSA." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 Instruction* RemoveFromGraph(bool return_previous = true); 612 Instruction* RemoveFromGraph(bool return_previous = true);
613 613
614 // Normal instructions can have 0 (inside a block) or 1 (last instruction in 614 // Normal instructions can have 0 (inside a block) or 1 (last instruction in
615 // a block) successors. Branch instruction with >1 successors override this 615 // a block) successors. Branch instruction with >1 successors override this
616 // function. 616 // function.
617 virtual intptr_t SuccessorCount() const; 617 virtual intptr_t SuccessorCount() const;
618 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; 618 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const;
619 619
620 void Goto(JoinEntryInstr* entry); 620 void Goto(JoinEntryInstr* entry);
621 621
622 // Mutate assigned_vars to add the local variable index for all
623 // frame-allocated locals assigned to by the instruction.
624 virtual void RecordAssignedVars(BitVector* assigned_vars,
625 intptr_t fixed_parameter_count);
626
622 virtual const char* DebugName() const = 0; 627 virtual const char* DebugName() const = 0;
623 628
624 // Printing support. 629 // Printing support.
625 virtual void PrintTo(BufferFormatter* f) const; 630 virtual void PrintTo(BufferFormatter* f) const;
626 virtual void PrintOperandsTo(BufferFormatter* f) const; 631 virtual void PrintOperandsTo(BufferFormatter* f) const;
627 632
628 #define INSTRUCTION_TYPE_CHECK(type) \ 633 #define INSTRUCTION_TYPE_CHECK(type) \
629 bool Is##type() { return (As##type() != NULL); } \ 634 bool Is##type() { return (As##type() != NULL); } \
630 virtual type##Instr* As##type() { return NULL; } 635 virtual type##Instr* As##type() { return NULL; }
631 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK) 636 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK)
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 // The array 'assigned_vars' maps preorder block numbers to the set of 962 // The array 'assigned_vars' maps preorder block numbers to the set of
958 // assigned frame-allocated local variables in the block. As a side 963 // assigned frame-allocated local variables in the block. As a side
959 // effect of this function, the set of basic block predecessors (e.g., 964 // effect of this function, the set of basic block predecessors (e.g.,
960 // block entry instructions of predecessor blocks) and also the last 965 // block entry instructions of predecessor blocks) and also the last
961 // instruction in the block is recorded in each entry instruction. 966 // instruction in the block is recorded in each entry instruction.
962 void DiscoverBlocks( 967 void DiscoverBlocks(
963 BlockEntryInstr* predecessor, 968 BlockEntryInstr* predecessor,
964 GrowableArray<BlockEntryInstr*>* preorder, 969 GrowableArray<BlockEntryInstr*>* preorder,
965 GrowableArray<BlockEntryInstr*>* postorder, 970 GrowableArray<BlockEntryInstr*>* postorder,
966 GrowableArray<intptr_t>* parent, 971 GrowableArray<intptr_t>* parent,
972 GrowableArray<BitVector*>* assigned_vars,
967 intptr_t variable_count, 973 intptr_t variable_count,
968 intptr_t fixed_parameter_count); 974 intptr_t fixed_parameter_count);
969 975
970 virtual intptr_t InputCount() const { return 0; } 976 virtual intptr_t InputCount() const { return 0; }
971 virtual Value* InputAt(intptr_t i) const { 977 virtual Value* InputAt(intptr_t i) const {
972 UNREACHABLE(); 978 UNREACHABLE();
973 return NULL; 979 return NULL;
974 } 980 }
975 981
976 virtual intptr_t ArgumentCount() const { return 0; } 982 virtual intptr_t ArgumentCount() const { return 0; }
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 // Precondition: use lists must be properly calculated. 1383 // Precondition: use lists must be properly calculated.
1378 // Postcondition: use lists and use values are still valid. 1384 // Postcondition: use lists and use values are still valid.
1379 void ReplaceUsesWith(Definition* other); 1385 void ReplaceUsesWith(Definition* other);
1380 1386
1381 // Replace this definition and all uses with another definition. If 1387 // Replace this definition and all uses with another definition. If
1382 // replacing during iteration, pass the iterator so that the instruction 1388 // replacing during iteration, pass the iterator so that the instruction
1383 // can be replaced without affecting iteration order, otherwise pass a 1389 // can be replaced without affecting iteration order, otherwise pass a
1384 // NULL iterator. 1390 // NULL iterator.
1385 void ReplaceWith(Definition* other, ForwardInstructionIterator* iterator); 1391 void ReplaceWith(Definition* other, ForwardInstructionIterator* iterator);
1386 1392
1393 virtual void RecordAssignedVars(BitVector* assigned_vars,
1394 intptr_t fixed_parameter_count);
1395
1387 // Printing support. These functions are sometimes overridden for custom 1396 // Printing support. These functions are sometimes overridden for custom
1388 // formatting. Otherwise, it prints in the format "opcode(op1, op2, op3)". 1397 // formatting. Otherwise, it prints in the format "opcode(op1, op2, op3)".
1389 virtual void PrintTo(BufferFormatter* f) const; 1398 virtual void PrintTo(BufferFormatter* f) const;
1390 virtual void PrintOperandsTo(BufferFormatter* f) const; 1399 virtual void PrintOperandsTo(BufferFormatter* f) const;
1391 1400
1392 // A value in the constant propagation lattice. 1401 // A value in the constant propagation lattice.
1393 // - non-constant sentinel 1402 // - non-constant sentinel
1394 // - a constant (any non-sentinel value) 1403 // - a constant (any non-sentinel value)
1395 // - unknown sentinel 1404 // - unknown sentinel
1396 Object& constant_value() const { return constant_value_; } 1405 Object& constant_value() const { return constant_value_; }
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
2693 2702
2694 // 'True' for recognized list constructors. 2703 // 'True' for recognized list constructors.
2695 bool is_known_list_constructor_; 2704 bool is_known_list_constructor_;
2696 2705
2697 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); 2706 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr);
2698 }; 2707 };
2699 2708
2700 2709
2701 class LoadLocalInstr : public TemplateDefinition<0> { 2710 class LoadLocalInstr : public TemplateDefinition<0> {
2702 public: 2711 public:
2703 explicit LoadLocalInstr(const LocalVariable& local) 2712 explicit LoadLocalInstr(const LocalVariable& local) : local_(local) { }
2704 : local_(local), is_last_(false) { }
2705 2713
2706 DECLARE_INSTRUCTION(LoadLocal) 2714 DECLARE_INSTRUCTION(LoadLocal)
2707 virtual CompileType ComputeType() const; 2715 virtual CompileType ComputeType() const;
2708 2716
2709 const LocalVariable& local() const { return local_; } 2717 const LocalVariable& local() const { return local_; }
2710 2718
2711 virtual void PrintOperandsTo(BufferFormatter* f) const; 2719 virtual void PrintOperandsTo(BufferFormatter* f) const;
2712 2720
2713 virtual bool CanDeoptimize() const { return false; } 2721 virtual bool CanDeoptimize() const { return false; }
2714 2722
2715 virtual bool HasSideEffect() const { 2723 virtual bool HasSideEffect() const {
2716 UNREACHABLE(); 2724 UNREACHABLE();
2717 return false; 2725 return false;
2718 } 2726 }
2719 2727
2720 void mark_last() { is_last_ = true; }
2721 bool is_last() const { return is_last_; }
2722
2723 private: 2728 private:
2724 const LocalVariable& local_; 2729 const LocalVariable& local_;
2725 bool is_last_;
2726 2730
2727 DISALLOW_COPY_AND_ASSIGN(LoadLocalInstr); 2731 DISALLOW_COPY_AND_ASSIGN(LoadLocalInstr);
2728 }; 2732 };
2729 2733
2730 2734
2731 class StoreLocalInstr : public TemplateDefinition<1> { 2735 class StoreLocalInstr : public TemplateDefinition<1> {
2732 public: 2736 public:
2733 StoreLocalInstr(const LocalVariable& local, Value* value) 2737 StoreLocalInstr(const LocalVariable& local, Value* value) : local_(local) {
2734 : local_(local), is_dead_(false), is_last_(false) {
2735 SetInputAt(0, value); 2738 SetInputAt(0, value);
2736 } 2739 }
2737 2740
2738 DECLARE_INSTRUCTION(StoreLocal) 2741 DECLARE_INSTRUCTION(StoreLocal)
2739 virtual CompileType* ComputeInitialType() const; 2742 virtual CompileType* ComputeInitialType() const;
2740 2743
2741 const LocalVariable& local() const { return local_; } 2744 const LocalVariable& local() const { return local_; }
2742 Value* value() const { return inputs_[0]; } 2745 Value* value() const { return inputs_[0]; }
2743 2746
2747 virtual void RecordAssignedVars(BitVector* assigned_vars,
2748 intptr_t fixed_parameter_count);
2749
2744 virtual void PrintOperandsTo(BufferFormatter* f) const; 2750 virtual void PrintOperandsTo(BufferFormatter* f) const;
2745 2751
2746 virtual bool CanDeoptimize() const { return false; } 2752 virtual bool CanDeoptimize() const { return false; }
2747 2753
2748 virtual bool HasSideEffect() const { 2754 virtual bool HasSideEffect() const {
2749 UNREACHABLE(); 2755 UNREACHABLE();
2750 return false; 2756 return false;
2751 } 2757 }
2752 2758
2753 void mark_dead() { is_dead_ = true; }
2754 bool is_dead() const { return is_dead_; }
2755
2756 void mark_last() { is_last_ = true; }
2757 bool is_last() const { return is_last_; }
2758
2759 private: 2759 private:
2760 const LocalVariable& local_; 2760 const LocalVariable& local_;
2761 bool is_dead_;
2762 bool is_last_;
2763 2761
2764 DISALLOW_COPY_AND_ASSIGN(StoreLocalInstr); 2762 DISALLOW_COPY_AND_ASSIGN(StoreLocalInstr);
2765 }; 2763 };
2766 2764
2767 2765
2768 class NativeCallInstr : public TemplateDefinition<0> { 2766 class NativeCallInstr : public TemplateDefinition<0> {
2769 public: 2767 public:
2770 explicit NativeCallInstr(NativeBodyNode* node) 2768 explicit NativeCallInstr(NativeBodyNode* node)
2771 : ast_node_(*node) {} 2769 : ast_node_(*node) {}
2772 2770
(...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after
4677 ForwardInstructionIterator* current_iterator_; 4675 ForwardInstructionIterator* current_iterator_;
4678 4676
4679 private: 4677 private:
4680 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 4678 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
4681 }; 4679 };
4682 4680
4683 4681
4684 } // namespace dart 4682 } // namespace dart
4685 4683
4686 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 4684 #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