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

Unified Diff: src/compiler/instruction.h

Issue 1242303005: [turbofan]: Elide extra move when accessing stack or frame register (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: src/compiler/code-generator.cc Created 5 years, 5 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/compiler/ia32/code-generator-ia32.cc ('k') | src/compiler/instruction.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/instruction.h
diff --git a/src/compiler/instruction.h b/src/compiler/instruction.h
index a87ef7dc9c469f865919aeef34a79fbaacb5e033..4994a2c165430e8a9e62167f2a9a61de92a4eccd 100644
--- a/src/compiler/instruction.h
+++ b/src/compiler/instruction.h
@@ -30,7 +30,15 @@ class InstructionOperand {
// TODO(dcarney): recover bit. INVALID can be represented as UNALLOCATED with
// kInvalidVirtualRegister and some DCHECKS.
- enum Kind { INVALID, UNALLOCATED, CONSTANT, IMMEDIATE, ALLOCATED };
+ enum Kind {
+ INVALID,
+ UNALLOCATED,
+ CONSTANT,
+ IMMEDIATE,
+ ALLOCATED,
+ STACK_POINTER,
+ FRAME_POINTER
+ };
InstructionOperand() : InstructionOperand(INVALID) {}
@@ -43,6 +51,8 @@ class InstructionOperand {
INSTRUCTION_OPERAND_PREDICATE(Constant, CONSTANT)
INSTRUCTION_OPERAND_PREDICATE(Immediate, IMMEDIATE)
INSTRUCTION_OPERAND_PREDICATE(Allocated, ALLOCATED)
+ INSTRUCTION_OPERAND_PREDICATE(StackPointer, STACK_POINTER)
+ INSTRUCTION_OPERAND_PREDICATE(FramePointer, FRAME_POINTER)
#undef INSTRUCTION_OPERAND_PREDICATE
inline bool IsRegister() const;
@@ -50,6 +60,10 @@ class InstructionOperand {
inline bool IsStackSlot() const;
inline bool IsDoubleStackSlot() const;
+ inline bool GeneratesRegister() const {
+ return IsRegister() || IsStackPointer() || IsFramePointer();
+ }
+
template <typename SubKindOperand>
static SubKindOperand* New(Zone* zone, const SubKindOperand& op) {
void* buffer = zone->New(sizeof(op));
@@ -411,6 +425,30 @@ class AllocatedOperand : public InstructionOperand {
};
+class StackPointerOperand : public InstructionOperand {
+ public:
+ StackPointerOperand() : InstructionOperand(STACK_POINTER) {}
+
+ static StackPointerOperand* New(Zone* zone) {
+ return InstructionOperand::New(zone, StackPointerOperand());
+ }
+
+ INSTRUCTION_OPERAND_CASTS(StackPointerOperand, STACK_POINTER);
+};
+
+
+class FramePointerOperand : public InstructionOperand {
+ public:
+ FramePointerOperand() : InstructionOperand(FRAME_POINTER) {}
+
+ static FramePointerOperand* New(Zone* zone) {
+ return InstructionOperand::New(zone, FramePointerOperand());
+ }
+
+ INSTRUCTION_OPERAND_CASTS(FramePointerOperand, STACK_POINTER);
+};
+
+
#undef INSTRUCTION_OPERAND_CASTS
« no previous file with comments | « src/compiler/ia32/code-generator-ia32.cc ('k') | src/compiler/instruction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698