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

Side by Side Diff: src/compiler/instruction.h

Issue 2304423002: [turbofan] Print APIs are for debugging. (Closed)
Patch Set: ostream Created 4 years, 3 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
« no previous file with comments | « no previous file | src/compiler/instruction.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project 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 #ifndef V8_COMPILER_INSTRUCTION_H_ 5 #ifndef V8_COMPILER_INSTRUCTION_H_
6 #define V8_COMPILER_INSTRUCTION_H_ 6 #define V8_COMPILER_INSTRUCTION_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <iosfwd> 9 #include <iosfwd>
10 #include <map> 10 #include <map>
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 bool EqualsCanonicalized(const InstructionOperand& that) const { 98 bool EqualsCanonicalized(const InstructionOperand& that) const {
99 return this->GetCanonicalizedValue() == that.GetCanonicalizedValue(); 99 return this->GetCanonicalizedValue() == that.GetCanonicalizedValue();
100 } 100 }
101 101
102 bool CompareCanonicalized(const InstructionOperand& that) const { 102 bool CompareCanonicalized(const InstructionOperand& that) const {
103 return this->GetCanonicalizedValue() < that.GetCanonicalizedValue(); 103 return this->GetCanonicalizedValue() < that.GetCanonicalizedValue();
104 } 104 }
105 105
106 bool InterferesWith(const InstructionOperand& that) const; 106 bool InterferesWith(const InstructionOperand& that) const;
107 107
108 void Print(std::ostream& os, const RegisterConfiguration* config) const; 108 // APIs to aid debugging. For general-stream APIs, use operator<<
109 void Print(std::ostream& os) const; 109 void Print(const RegisterConfiguration* config) const;
110 void Print() const;
110 111
111 protected: 112 protected:
112 explicit InstructionOperand(Kind kind) : value_(KindField::encode(kind)) {} 113 explicit InstructionOperand(Kind kind) : value_(KindField::encode(kind)) {}
113 114
114 inline uint64_t GetCanonicalizedValue() const; 115 inline uint64_t GetCanonicalizedValue() const;
115 116
116 class KindField : public BitField64<Kind, 0, 3> {}; 117 class KindField : public BitField64<Kind, 0, 3> {};
117 118
118 uint64_t value_; 119 uint64_t value_;
119 }; 120 };
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 return IsEliminated() || source_.EqualsCanonicalized(destination_); 666 return IsEliminated() || source_.EqualsCanonicalized(destination_);
666 } 667 }
667 668
668 // We clear both operands to indicate move that's been eliminated. 669 // We clear both operands to indicate move that's been eliminated.
669 void Eliminate() { source_ = destination_ = InstructionOperand(); } 670 void Eliminate() { source_ = destination_ = InstructionOperand(); }
670 bool IsEliminated() const { 671 bool IsEliminated() const {
671 DCHECK_IMPLIES(source_.IsInvalid(), destination_.IsInvalid()); 672 DCHECK_IMPLIES(source_.IsInvalid(), destination_.IsInvalid());
672 return source_.IsInvalid(); 673 return source_.IsInvalid();
673 } 674 }
674 675
675 void Print(std::ostream& os, const RegisterConfiguration* config) const; 676 // APIs to aid debugging. For general-stream APIs, use operator<<
676 void Print(std::ostream& os) const; 677 void Print(const RegisterConfiguration* config) const;
678 void Print() const;
677 679
678 private: 680 private:
679 InstructionOperand source_; 681 InstructionOperand source_;
680 InstructionOperand destination_; 682 InstructionOperand destination_;
681 683
682 DISALLOW_COPY_AND_ASSIGN(MoveOperands); 684 DISALLOW_COPY_AND_ASSIGN(MoveOperands);
683 }; 685 };
684 686
685 687
686 struct PrintableMoveOperands { 688 struct PrintableMoveOperands {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 907
906 // The block_id may be invalidated in JumpThreading. It is only important for 908 // The block_id may be invalidated in JumpThreading. It is only important for
907 // register allocation, to avoid searching for blocks from instruction 909 // register allocation, to avoid searching for blocks from instruction
908 // indexes. 910 // indexes.
909 InstructionBlock* block() const { return block_; } 911 InstructionBlock* block() const { return block_; }
910 void set_block(InstructionBlock* block) { 912 void set_block(InstructionBlock* block) {
911 DCHECK_NOT_NULL(block); 913 DCHECK_NOT_NULL(block);
912 block_ = block; 914 block_ = block;
913 } 915 }
914 916
915 void Print(std::ostream& os, const RegisterConfiguration* config) const; 917 // APIs to aid debugging. For general-stream APIs, use operator<<
916 void Print(std::ostream& os) const; 918 void Print(const RegisterConfiguration* config) const;
919 void Print() const;
917 920
918 private: 921 private:
919 explicit Instruction(InstructionCode opcode); 922 explicit Instruction(InstructionCode opcode);
920 923
921 Instruction(InstructionCode opcode, size_t output_count, 924 Instruction(InstructionCode opcode, size_t output_count,
922 InstructionOperand* outputs, size_t input_count, 925 InstructionOperand* outputs, size_t input_count,
923 InstructionOperand* inputs, size_t temp_count, 926 InstructionOperand* inputs, size_t temp_count,
924 InstructionOperand* temps); 927 InstructionOperand* temps);
925 928
926 typedef BitField<size_t, 0, 8> OutputCountField; 929 typedef BitField<size_t, 0, 8> OutputCountField;
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 int32_t code_start_; // start index of arch-specific code. 1278 int32_t code_start_; // start index of arch-specific code.
1276 int32_t code_end_; // end index of arch-specific code. 1279 int32_t code_end_; // end index of arch-specific code.
1277 const bool deferred_; // Block contains deferred code. 1280 const bool deferred_; // Block contains deferred code.
1278 const bool handler_; // Block is a handler entry point. 1281 const bool handler_; // Block is a handler entry point.
1279 bool needs_frame_; 1282 bool needs_frame_;
1280 bool must_construct_frame_; 1283 bool must_construct_frame_;
1281 bool must_deconstruct_frame_; 1284 bool must_deconstruct_frame_;
1282 RpoNumber last_deferred_; 1285 RpoNumber last_deferred_;
1283 }; 1286 };
1284 1287
1288 class InstructionSequence;
1289
1290 struct PrintableInstructionBlock {
1291 const RegisterConfiguration* register_configuration_;
1292 const InstructionBlock* block_;
1293 const InstructionSequence* code_;
1294 };
1295
1296 std::ostream& operator<<(std::ostream& os,
1297 const PrintableInstructionBlock& printable_block);
1298
1285 typedef ZoneDeque<Constant> ConstantDeque; 1299 typedef ZoneDeque<Constant> ConstantDeque;
1286 typedef std::map<int, Constant, std::less<int>, 1300 typedef std::map<int, Constant, std::less<int>,
1287 zone_allocator<std::pair<const int, Constant> > > ConstantMap; 1301 zone_allocator<std::pair<const int, Constant> > > ConstantMap;
1288 1302
1289 typedef ZoneDeque<Instruction*> InstructionDeque; 1303 typedef ZoneDeque<Instruction*> InstructionDeque;
1290 typedef ZoneDeque<ReferenceMap*> ReferenceMapDeque; 1304 typedef ZoneDeque<ReferenceMap*> ReferenceMapDeque;
1291 typedef ZoneVector<InstructionBlock*> InstructionBlocks; 1305 typedef ZoneVector<InstructionBlock*> InstructionBlocks;
1292 1306
1293 1307
1294 // Forward declarations. 1308 // Forward declarations.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 bool GetSourcePosition(const Instruction* instr, 1448 bool GetSourcePosition(const Instruction* instr,
1435 SourcePosition* result) const; 1449 SourcePosition* result) const;
1436 void SetSourcePosition(const Instruction* instr, SourcePosition value); 1450 void SetSourcePosition(const Instruction* instr, SourcePosition value);
1437 1451
1438 bool ContainsCall() const { 1452 bool ContainsCall() const {
1439 for (Instruction* instr : instructions_) { 1453 for (Instruction* instr : instructions_) {
1440 if (instr->IsCall()) return true; 1454 if (instr->IsCall()) return true;
1441 } 1455 }
1442 return false; 1456 return false;
1443 } 1457 }
1444 void Print(std::ostream& os, const RegisterConfiguration* config) const;
1445 void Print(std::ostream& os) const;
1446 1458
1447 void PrintBlock(std::ostream& os, const RegisterConfiguration* config, 1459 // APIs to aid debugging. For general-stream APIs, use operator<<
1448 int block_id) const; 1460 void Print(const RegisterConfiguration* config) const;
1449 void PrintBlock(std::ostream& os, int block_id) const; 1461 void Print() const;
1462
1463 void PrintBlock(const RegisterConfiguration* config, int block_id) const;
1464 void PrintBlock(int block_id) const;
1450 1465
1451 void ValidateEdgeSplitForm() const; 1466 void ValidateEdgeSplitForm() const;
1452 void ValidateDeferredBlockExitPaths() const; 1467 void ValidateDeferredBlockExitPaths() const;
1453 void ValidateDeferredBlockEntryPaths() const; 1468 void ValidateDeferredBlockEntryPaths() const;
1454 void ValidateSSA() const; 1469 void ValidateSSA() const;
1455 1470
1456 private: 1471 private:
1457 friend std::ostream& operator<<(std::ostream& os, 1472 friend std::ostream& operator<<(std::ostream& os,
1458 const PrintableInstructionSequence& code); 1473 const PrintableInstructionSequence& code);
1459 1474
(...skipping 25 matching lines...) Expand all
1485 1500
1486 1501
1487 std::ostream& operator<<(std::ostream& os, 1502 std::ostream& operator<<(std::ostream& os,
1488 const PrintableInstructionSequence& code); 1503 const PrintableInstructionSequence& code);
1489 1504
1490 } // namespace compiler 1505 } // namespace compiler
1491 } // namespace internal 1506 } // namespace internal
1492 } // namespace v8 1507 } // namespace v8
1493 1508
1494 #endif // V8_COMPILER_INSTRUCTION_H_ 1509 #endif // V8_COMPILER_INSTRUCTION_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler/instruction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698