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

Unified Diff: src/x64/lithium-x64.h

Issue 6132002: Crankshaft: Move LParallelMove to lithium.h, add LGap to lithium-x64.h. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/lithium.cc ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/lithium-x64.h
===================================================================
--- src/x64/lithium-x64.h (revision 6222)
+++ src/x64/lithium-x64.h (working copy)
@@ -41,14 +41,45 @@
class LEnvironment;
class Translation;
+
+// Type hierarchy:
+//
+// LInstruction
+// LGap
+
+#define LITHIUM_ALL_INSTRUCTION_LIST(V) \
+ LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
+
+#define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
+ V(Gap)
+
+
+#define DECLARE_INSTRUCTION(type) \
+ virtual bool Is##type() const { return true; } \
+ static L##type* cast(LInstruction* instr) { \
+ ASSERT(instr->Is##type()); \
+ return reinterpret_cast<L##type*>(instr); \
+ }
+
+
+#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic) \
+ virtual void CompileToNative(LCodeGen* generator); \
+ virtual const char* Mnemonic() const { return mnemonic; } \
+ DECLARE_INSTRUCTION(type)
+
+
+#define DECLARE_HYDROGEN_ACCESSOR(type) \
+ H##type* hydrogen() const { \
+ return H##type::cast(hydrogen_value()); \
+ }
+
+
class LInstruction: public ZoneObject {
public:
- LInstruction() { }
+ LInstruction()
+ : hydrogen_value_(NULL) { }
virtual ~LInstruction() { }
- virtual void PrintTo(StringStream* stream) const { UNIMPLEMENTED(); }
- virtual void PrintDataTo(StringStream* stream) const { }
-
// Predicates should be generated by macro as in lithium-ia32.h.
virtual bool IsLabel() const {
UNIMPLEMENTED();
@@ -59,6 +90,17 @@
return false;
}
+ virtual void CompileToNative(LCodeGen* generator) = 0;
+ virtual const char* Mnemonic() const = 0;
+ virtual void PrintTo(StringStream* stream) const;
+ virtual void PrintDataTo(StringStream* stream) const { }
+
+ // Declare virtual type testers.
+#define DECLARE_DO(type) virtual bool Is##type() const { return false; }
+ LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO)
+#undef DECLARE_DO
+ virtual bool IsControl() const { return false; }
+
void set_environment(LEnvironment* env) { environment_.set(env); }
LEnvironment* environment() const { return environment_.get(); }
bool HasEnvironment() const { return environment_.is_set(); }
@@ -93,33 +135,23 @@
};
-class LParallelMove : public ZoneObject {
+class LGap: public LInstruction {
public:
- LParallelMove() : move_operands_(4) { }
-
- void AddMove(LOperand* from, LOperand* to) {
- UNIMPLEMENTED();
+ explicit LGap(HBasicBlock* block)
+ : block_(block) {
+ parallel_moves_[BEFORE] = NULL;
+ parallel_moves_[START] = NULL;
+ parallel_moves_[END] = NULL;
+ parallel_moves_[AFTER] = NULL;
}
- const ZoneList<LMoveOperands>* move_operands() const {
- UNIMPLEMENTED();
- return NULL;
- }
+ DECLARE_CONCRETE_INSTRUCTION(Gap, "gap")
+ virtual void PrintDataTo(StringStream* stream) const;
- private:
- ZoneList<LMoveOperands> move_operands_;
-};
+ bool IsRedundant() const;
+ HBasicBlock* block() const { return block_; }
-class LGap: public LInstruction {
- public:
- explicit LGap(HBasicBlock* block) { }
-
- HBasicBlock* block() const {
- UNIMPLEMENTED();
- return NULL;
- }
-
enum InnerPosition {
BEFORE,
START,
@@ -130,13 +162,12 @@
};
LParallelMove* GetOrCreateParallelMove(InnerPosition pos) {
- UNIMPLEMENTED();
- return NULL;
+ if (parallel_moves_[pos] == NULL) parallel_moves_[pos] = new LParallelMove;
+ return parallel_moves_[pos];
}
LParallelMove* GetParallelMove(InnerPosition pos) {
- UNIMPLEMENTED();
- return NULL;
+ return parallel_moves_[pos];
}
private:
« no previous file with comments | « src/lithium.cc ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698