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

Side by Side Diff: src/a64/decoder-a64.h

Issue 181233002: A64: Move the dispatching logic of the decoder to a separate class. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | « no previous file | src/a64/decoder-a64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 class DecoderVisitor { 90 class DecoderVisitor {
91 public: 91 public:
92 virtual ~DecoderVisitor() {} 92 virtual ~DecoderVisitor() {}
93 93
94 #define DECLARE(A) virtual void Visit##A(Instruction* instr) = 0; 94 #define DECLARE(A) virtual void Visit##A(Instruction* instr) = 0;
95 VISITOR_LIST(DECLARE) 95 VISITOR_LIST(DECLARE)
96 #undef DECLARE 96 #undef DECLARE
97 }; 97 };
98 98
99 99
100 class Decoder { 100 // A visitor that dispatches to a list of visitors.
101 class DispatchingDecoderVisitor : public DecoderVisitor {
101 public: 102 public:
102 Decoder() {} 103 DispatchingDecoderVisitor() {}
103 104 virtual ~DispatchingDecoderVisitor() {}
104 // Top-level instruction decoder function. Decodes an instruction and calls
105 // the visitor functions registered with the Decoder class.
106 void Decode(Instruction *instr);
107 105
108 // Register a new visitor class with the decoder. 106 // Register a new visitor class with the decoder.
109 // Decode() will call the corresponding visitor method from all registered 107 // Decode() will call the corresponding visitor method from all registered
110 // visitor classes when decoding reaches the leaf node of the instruction 108 // visitor classes when decoding reaches the leaf node of the instruction
111 // decode tree. 109 // decode tree.
112 // Visitors are called in the order. 110 // Visitors are called in the order.
113 // A visitor can only be registered once. 111 // A visitor can only be registered once.
114 // Registering an already registered visitor will update its position. 112 // Registering an already registered visitor will update its position.
115 // 113 //
116 // d.AppendVisitor(V1); 114 // d.AppendVisitor(V1);
(...skipping 15 matching lines...) Expand all
132 130
133 // Remove a previously registered visitor class from the list of visitors 131 // Remove a previously registered visitor class from the list of visitors
134 // stored by the decoder. 132 // stored by the decoder.
135 void RemoveVisitor(DecoderVisitor* visitor); 133 void RemoveVisitor(DecoderVisitor* visitor);
136 134
137 #define DECLARE(A) void Visit##A(Instruction* instr); 135 #define DECLARE(A) void Visit##A(Instruction* instr);
138 VISITOR_LIST(DECLARE) 136 VISITOR_LIST(DECLARE)
139 #undef DECLARE 137 #undef DECLARE
140 138
141 private: 139 private:
140 // Visitors are registered in a list.
141 std::list<DecoderVisitor*> visitors_;
142 };
143
144
145 class Decoder : public DispatchingDecoderVisitor {
146 public:
147 Decoder() {}
148
149 // Top-level instruction decoder function. Decodes an instruction and calls
150 // the visitor functions registered with the Decoder class.
151 void Decode(Instruction *instr);
152
153 private:
142 // Decode the PC relative addressing instruction, and call the corresponding 154 // Decode the PC relative addressing instruction, and call the corresponding
143 // visitors. 155 // visitors.
144 // On entry, instruction bits 27:24 = 0x0. 156 // On entry, instruction bits 27:24 = 0x0.
145 void DecodePCRelAddressing(Instruction* instr); 157 void DecodePCRelAddressing(Instruction* instr);
146 158
147 // Decode the add/subtract immediate instruction, and call the corresponding 159 // Decode the add/subtract immediate instruction, and call the corresponding
148 // visitors. 160 // visitors.
149 // On entry, instruction bits 27:24 = 0x1. 161 // On entry, instruction bits 27:24 = 0x1.
150 void DecodeAddSubImmediate(Instruction* instr); 162 void DecodeAddSubImmediate(Instruction* instr);
151 163
(...skipping 29 matching lines...) Expand all
181 193
182 // Decode the Advanced SIMD (NEON) load/store part of the instruction tree, 194 // Decode the Advanced SIMD (NEON) load/store part of the instruction tree,
183 // and call the corresponding visitors. 195 // and call the corresponding visitors.
184 // On entry, instruction bits 29:25 = 0x6. 196 // On entry, instruction bits 29:25 = 0x6.
185 void DecodeAdvSIMDLoadStore(Instruction* instr); 197 void DecodeAdvSIMDLoadStore(Instruction* instr);
186 198
187 // Decode the Advanced SIMD (NEON) data processing part of the instruction 199 // Decode the Advanced SIMD (NEON) data processing part of the instruction
188 // tree, and call the corresponding visitors. 200 // tree, and call the corresponding visitors.
189 // On entry, instruction bits 27:25 = 0x7. 201 // On entry, instruction bits 27:25 = 0x7.
190 void DecodeAdvSIMDDataProcessing(Instruction* instr); 202 void DecodeAdvSIMDDataProcessing(Instruction* instr);
191
192 // Visitors are registered in a list.
193 std::list<DecoderVisitor*> visitors_;
194 }; 203 };
195 204
196 205
197 } } // namespace v8::internal 206 } } // namespace v8::internal
198 207
199 #endif // V8_A64_DECODER_A64_H_ 208 #endif // V8_A64_DECODER_A64_H_
OLDNEW
« no previous file with comments | « no previous file | src/a64/decoder-a64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698