V8 Project
v8::internal::compiler::OperandGenerator Class Reference

#include <instruction-selector-impl.h>

+ Inheritance diagram for v8::internal::compiler::OperandGenerator:
+ Collaboration diagram for v8::internal::compiler::OperandGenerator:

Public Member Functions

 OperandGenerator (InstructionSelector *selector)
 
InstructionOperandDefineAsRegister (Node *node)
 
InstructionOperandDefineSameAsFirst (Node *result)
 
InstructionOperandDefineAsFixed (Node *node, Register reg)
 
InstructionOperandDefineAsFixed (Node *node, DoubleRegister reg)
 
InstructionOperandDefineAsConstant (Node *node)
 
InstructionOperandDefineAsLocation (Node *node, LinkageLocation location, MachineType type)
 
InstructionOperandUse (Node *node)
 
InstructionOperandUseRegister (Node *node)
 
InstructionOperandUseUnique (Node *node)
 
InstructionOperandUseUniqueRegister (Node *node)
 
InstructionOperandUseFixed (Node *node, Register reg)
 
InstructionOperandUseFixed (Node *node, DoubleRegister reg)
 
InstructionOperandUseImmediate (Node *node)
 
InstructionOperandUseLocation (Node *node, LinkageLocation location, MachineType type)
 
InstructionOperandTempRegister ()
 
InstructionOperandTempDoubleRegister ()
 
InstructionOperandTempRegister (Register reg)
 
InstructionOperandTempImmediate (int32_t imm)
 
InstructionOperandLabel (BasicBlock *block)
 

Protected Member Functions

Graphgraph () const
 
InstructionSelector * selector () const
 
InstructionSequencesequence () const
 
Isolateisolate () const
 
Zonezone () const
 

Private Member Functions

UnallocatedOperandDefine (Node *node, UnallocatedOperand *operand)
 
UnallocatedOperandUse (Node *node, UnallocatedOperand *operand)
 
UnallocatedOperandToUnallocatedOperand (LinkageLocation location, MachineType type)
 

Static Private Member Functions

static Constant ToConstant (const Node *node)
 

Private Attributes

InstructionSelector * selector_
 

Detailed Description

Definition at line 18 of file instruction-selector-impl.h.

Constructor & Destructor Documentation

◆ OperandGenerator()

v8::internal::compiler::OperandGenerator::OperandGenerator ( InstructionSelector *  selector)
inlineexplicit

Member Function Documentation

◆ Define()

UnallocatedOperand* v8::internal::compiler::OperandGenerator::Define ( Node *  node,
UnallocatedOperand operand 
)
inlineprivate

Definition at line 165 of file instruction-selector-impl.h.

165  {
166  DCHECK_NOT_NULL(node);
167  DCHECK_NOT_NULL(operand);
168  operand->set_virtual_register(node->id());
169  selector()->MarkAsDefined(node);
170  return operand;
171  }
#define DCHECK_NOT_NULL(p)
Definition: logging.h:213

References DCHECK_NOT_NULL, selector(), and v8::internal::compiler::UnallocatedOperand::set_virtual_register().

Referenced by DefineAsFixed(), DefineAsLocation(), DefineAsRegister(), and DefineSameAsFirst().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DefineAsConstant()

InstructionOperand* v8::internal::compiler::OperandGenerator::DefineAsConstant ( Node *  node)
inline

Definition at line 45 of file instruction-selector-impl.h.

45  {
46  selector()->MarkAsDefined(node);
47  sequence()->AddConstant(node->id(), ToConstant(node));
48  return ConstantOperand::Create(node->id(), zone());
49  }
static Constant ToConstant(const Node *node)

References selector(), sequence(), ToConstant(), and zone().

+ Here is the call graph for this function:

◆ DefineAsFixed() [1/2]

InstructionOperand* v8::internal::compiler::OperandGenerator::DefineAsFixed ( Node *  node,
DoubleRegister  reg 
)
inline

Definition at line 39 of file instruction-selector-impl.h.

39  {
40  return Define(node, new (zone())
43  }
UnallocatedOperand * Define(Node *node, UnallocatedOperand *operand)
static int ToAllocationIndex(DwVfpRegister reg)

References Define(), v8::internal::compiler::UnallocatedOperand::FIXED_DOUBLE_REGISTER, v8::internal::DwVfpRegister::ToAllocationIndex(), and zone().

+ Here is the call graph for this function:

◆ DefineAsFixed() [2/2]

InstructionOperand* v8::internal::compiler::OperandGenerator::DefineAsFixed ( Node *  node,
Register  reg 
)
inline

Definition at line 33 of file instruction-selector-impl.h.

33  {
34  return Define(node, new (zone())
35  UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER,
37  }
static int ToAllocationIndex(Register reg)

References Define(), v8::internal::compiler::UnallocatedOperand::FIXED_REGISTER, v8::internal::Register::ToAllocationIndex(), and zone().

+ Here is the call graph for this function:

◆ DefineAsLocation()

InstructionOperand* v8::internal::compiler::OperandGenerator::DefineAsLocation ( Node *  node,
LinkageLocation  location,
MachineType  type 
)
inline

Definition at line 51 of file instruction-selector-impl.h.

52  {
53  return Define(node, ToUnallocatedOperand(location, type));
54  }
UnallocatedOperand * ToUnallocatedOperand(LinkageLocation location, MachineType type)

References Define(), and ToUnallocatedOperand().

+ Here is the call graph for this function:

◆ DefineAsRegister()

InstructionOperand* v8::internal::compiler::OperandGenerator::DefineAsRegister ( Node *  node)
inline

Definition at line 23 of file instruction-selector-impl.h.

23  {
24  return Define(node, new (zone())
25  UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER));
26  }

References Define(), v8::internal::compiler::UnallocatedOperand::MUST_HAVE_REGISTER, and zone().

Referenced by v8::internal::compiler::EmitBic(), v8::internal::compiler::VisitBinop(), v8::internal::compiler::VisitDiv(), v8::internal::compiler::VisitMod(), v8::internal::compiler::VisitRRRFloat64(), v8::internal::compiler::VisitShift(), and v8::internal::compiler::VisitWordCompare().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DefineSameAsFirst()

InstructionOperand* v8::internal::compiler::OperandGenerator::DefineSameAsFirst ( Node *  result)
inline

Definition at line 28 of file instruction-selector-impl.h.

28  {
29  return Define(result, new (zone())
30  UnallocatedOperand(UnallocatedOperand::SAME_AS_FIRST_INPUT));
31  }

References Define(), v8::internal::compiler::UnallocatedOperand::SAME_AS_FIRST_INPUT, and zone().

+ Here is the call graph for this function:

◆ graph()

Graph* v8::internal::compiler::OperandGenerator::graph ( ) const
inlineprotected

Definition at line 136 of file instruction-selector-impl.h.

136 { return selector()->graph(); }

References selector().

+ Here is the call graph for this function:

◆ isolate()

Isolate* v8::internal::compiler::OperandGenerator::isolate ( ) const
inlineprotected

Definition at line 139 of file instruction-selector-impl.h.

139 { return zone()->isolate(); }
Isolate * isolate() const
Definition: zone.h:68

References v8::internal::Zone::isolate(), and zone().

+ Here is the call graph for this function:

◆ Label()

InstructionOperand* v8::internal::compiler::OperandGenerator::Label ( BasicBlock *  block)
inline

Definition at line 130 of file instruction-selector-impl.h.

130  {
131  // TODO(bmeurer): We misuse ImmediateOperand here.
132  return TempImmediate(block->id());
133  }
InstructionOperand * TempImmediate(int32_t imm)

References TempImmediate().

Referenced by v8::internal::compiler::VisitBinop(), v8::internal::compiler::VisitShift(), and v8::internal::compiler::VisitWordCompare().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ selector()

InstructionSelector* v8::internal::compiler::OperandGenerator::selector ( ) const
inlineprotected

Definition at line 137 of file instruction-selector-impl.h.

137 { return selector_; }

References selector_.

Referenced by Define(), DefineAsConstant(), graph(), sequence(), Use(), and zone().

+ Here is the caller graph for this function:

◆ sequence()

InstructionSequence* v8::internal::compiler::OperandGenerator::sequence ( ) const
inlineprotected

Definition at line 138 of file instruction-selector-impl.h.

138 { return selector()->sequence(); }

References selector().

Referenced by DefineAsConstant(), TempDoubleRegister(), TempImmediate(), TempRegister(), and UseImmediate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TempDoubleRegister()

InstructionOperand* v8::internal::compiler::OperandGenerator::TempDoubleRegister ( )
inline

Definition at line 111 of file instruction-selector-impl.h.

111  {
112  UnallocatedOperand* op =
113  new (zone()) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER,
115  op->set_virtual_register(sequence()->NextVirtualRegister());
116  sequence()->MarkAsDouble(op->virtual_register());
117  return op;
118  }

References v8::internal::compiler::UnallocatedOperand::MUST_HAVE_REGISTER, sequence(), v8::internal::compiler::UnallocatedOperand::set_virtual_register(), v8::internal::compiler::UnallocatedOperand::USED_AT_START, v8::internal::compiler::UnallocatedOperand::virtual_register(), and zone().

Referenced by v8::internal::compiler::EmitDiv().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TempImmediate()

InstructionOperand* v8::internal::compiler::OperandGenerator::TempImmediate ( int32_t  imm)
inline

Definition at line 125 of file instruction-selector-impl.h.

125  {
126  int index = sequence()->AddImmediate(Constant(imm));
127  return ImmediateOperand::Create(index, zone());
128  }

References sequence(), and zone().

Referenced by Label().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TempRegister() [1/2]

InstructionOperand* v8::internal::compiler::OperandGenerator::TempRegister ( )
inline

Definition at line 103 of file instruction-selector-impl.h.

103  {
104  UnallocatedOperand* op =
105  new (zone()) UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER,
107  op->set_virtual_register(sequence()->NextVirtualRegister());
108  return op;
109  }

References v8::internal::compiler::UnallocatedOperand::MUST_HAVE_REGISTER, sequence(), v8::internal::compiler::UnallocatedOperand::set_virtual_register(), v8::internal::compiler::UnallocatedOperand::USED_AT_START, and zone().

Referenced by v8::internal::compiler::VisitMod().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TempRegister() [2/2]

InstructionOperand* v8::internal::compiler::OperandGenerator::TempRegister ( Register  reg)
inline

Definition at line 120 of file instruction-selector-impl.h.

120  {
121  return new (zone()) UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER,
123  }

References v8::internal::compiler::UnallocatedOperand::FIXED_REGISTER, v8::internal::Register::ToAllocationIndex(), and zone().

+ Here is the call graph for this function:

◆ ToConstant()

static Constant v8::internal::compiler::OperandGenerator::ToConstant ( const Node *  node)
inlinestaticprivate

Definition at line 143 of file instruction-selector-impl.h.

143  {
144  switch (node->opcode()) {
145  case IrOpcode::kInt32Constant:
146  return Constant(OpParameter<int32_t>(node));
147  case IrOpcode::kInt64Constant:
148  return Constant(OpParameter<int64_t>(node));
149  case IrOpcode::kFloat32Constant:
150  return Constant(OpParameter<float>(node));
151  case IrOpcode::kFloat64Constant:
152  case IrOpcode::kNumberConstant:
153  return Constant(OpParameter<double>(node));
154  case IrOpcode::kExternalConstant:
155  return Constant(OpParameter<ExternalReference>(node));
156  case IrOpcode::kHeapConstant:
157  return Constant(OpParameter<Unique<HeapObject> >(node).handle());
158  default:
159  break;
160  }
161  UNREACHABLE();
162  return Constant(static_cast<int32_t>(0));
163  }
#define UNREACHABLE()
Definition: logging.h:30
int int32_t
Definition: unicode.cc:24
static const T & OpParameter(const Node *node)
Definition: node.h:86
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:146

References v8::internal::handle(), v8::internal::compiler::OpParameter(), and UNREACHABLE.

Referenced by DefineAsConstant(), and UseImmediate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ToUnallocatedOperand()

UnallocatedOperand* v8::internal::compiler::OperandGenerator::ToUnallocatedOperand ( LinkageLocation  location,
MachineType  type 
)
inlineprivate

Definition at line 181 of file instruction-selector-impl.h.

182  {
183  if (location.location_ == LinkageLocation::ANY_REGISTER) {
184  return new (zone())
185  UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER);
186  }
187  if (location.location_ < 0) {
188  return new (zone()) UnallocatedOperand(UnallocatedOperand::FIXED_SLOT,
189  location.location_);
190  }
191  if (RepresentationOf(type) == kRepFloat64) {
192  return new (zone()) UnallocatedOperand(
193  UnallocatedOperand::FIXED_DOUBLE_REGISTER, location.location_);
194  }
195  return new (zone()) UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER,
196  location.location_);
197  }
static const int16_t ANY_REGISTER
Definition: linkage.h:25
MachineType RepresentationOf(MachineType machine_type)
Definition: machine-type.h:76

References v8::internal::compiler::LinkageLocation::ANY_REGISTER, v8::internal::compiler::UnallocatedOperand::FIXED_DOUBLE_REGISTER, v8::internal::compiler::UnallocatedOperand::FIXED_REGISTER, v8::internal::compiler::UnallocatedOperand::FIXED_SLOT, v8::internal::compiler::kRepFloat64, v8::internal::compiler::LinkageLocation::location_, v8::internal::compiler::UnallocatedOperand::MUST_HAVE_REGISTER, v8::internal::compiler::RepresentationOf(), and zone().

Referenced by DefineAsLocation(), and UseLocation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Use() [1/2]

InstructionOperand* v8::internal::compiler::OperandGenerator::Use ( Node *  node)
inline

Definition at line 56 of file instruction-selector-impl.h.

56  {
57  return Use(node,
58  new (zone()) UnallocatedOperand(
60  }

References v8::internal::compiler::UnallocatedOperand::ANY, v8::internal::compiler::UnallocatedOperand::USED_AT_START, and zone().

Referenced by UseFixed(), UseLocation(), UseRegister(), UseUnique(), and UseUniqueRegister().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Use() [2/2]

UnallocatedOperand* v8::internal::compiler::OperandGenerator::Use ( Node *  node,
UnallocatedOperand operand 
)
inlineprivate

Definition at line 173 of file instruction-selector-impl.h.

173  {
174  DCHECK_NOT_NULL(node);
175  DCHECK_NOT_NULL(operand);
176  operand->set_virtual_register(node->id());
177  selector()->MarkAsUsed(node);
178  return operand;
179  }

References DCHECK_NOT_NULL, selector(), and v8::internal::compiler::UnallocatedOperand::set_virtual_register().

+ Here is the call graph for this function:

◆ UseFixed() [1/2]

InstructionOperand* v8::internal::compiler::OperandGenerator::UseFixed ( Node *  node,
DoubleRegister  reg 
)
inline

Definition at line 87 of file instruction-selector-impl.h.

87  {
88  return Use(node, new (zone())
91  }

References v8::internal::compiler::UnallocatedOperand::FIXED_DOUBLE_REGISTER, v8::internal::DwVfpRegister::ToAllocationIndex(), Use(), and zone().

+ Here is the call graph for this function:

◆ UseFixed() [2/2]

InstructionOperand* v8::internal::compiler::OperandGenerator::UseFixed ( Node *  node,
Register  reg 
)
inline

Definition at line 81 of file instruction-selector-impl.h.

81  {
82  return Use(node, new (zone())
83  UnallocatedOperand(UnallocatedOperand::FIXED_REGISTER,
85  }

References v8::internal::compiler::UnallocatedOperand::FIXED_REGISTER, v8::internal::Register::ToAllocationIndex(), Use(), and zone().

+ Here is the call graph for this function:

◆ UseImmediate()

InstructionOperand* v8::internal::compiler::OperandGenerator::UseImmediate ( Node *  node)
inline

Definition at line 93 of file instruction-selector-impl.h.

93  {
94  int index = sequence()->AddImmediate(ToConstant(node));
95  return ImmediateOperand::Create(index, zone());
96  }

References sequence(), ToConstant(), and zone().

Referenced by v8::internal::compiler::TryMatchASR(), v8::internal::compiler::TryMatchImmediateOrShift(), v8::internal::compiler::TryMatchLSL(), v8::internal::compiler::TryMatchLSR(), v8::internal::compiler::TryMatchROR(), v8::internal::compiler::ArmOperandGenerator::UseOperand(), and v8::internal::compiler::UseOrImmediate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UseLocation()

InstructionOperand* v8::internal::compiler::OperandGenerator::UseLocation ( Node *  node,
LinkageLocation  location,
MachineType  type 
)
inline

Definition at line 98 of file instruction-selector-impl.h.

99  {
100  return Use(node, ToUnallocatedOperand(location, type));
101  }

References ToUnallocatedOperand(), and Use().

+ Here is the call graph for this function:

◆ UseRegister()

InstructionOperand* v8::internal::compiler::OperandGenerator::UseRegister ( Node *  node)
inline

Definition at line 62 of file instruction-selector-impl.h.

62  {
63  return Use(node, new (zone())
64  UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER,
66  }

References v8::internal::compiler::UnallocatedOperand::MUST_HAVE_REGISTER, Use(), v8::internal::compiler::UnallocatedOperand::USED_AT_START, and zone().

Referenced by v8::internal::compiler::EmitBic(), v8::internal::compiler::TryMatchASR(), v8::internal::compiler::TryMatchLSL(), v8::internal::compiler::TryMatchLSR(), v8::internal::compiler::TryMatchROR(), v8::internal::compiler::ArmOperandGenerator::UseOperand(), v8::internal::compiler::VisitBinop(), v8::internal::compiler::VisitDiv(), v8::internal::compiler::VisitMod(), v8::internal::compiler::VisitRRRFloat64(), and v8::internal::compiler::VisitWordCompare().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UseUnique()

InstructionOperand* v8::internal::compiler::OperandGenerator::UseUnique ( Node *  node)
inline

Definition at line 70 of file instruction-selector-impl.h.

70  {
71  return Use(node, new (zone()) UnallocatedOperand(UnallocatedOperand::ANY));
72  }

References v8::internal::compiler::UnallocatedOperand::ANY, Use(), and zone().

Referenced by v8::internal::compiler::UseOrImmediate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UseUniqueRegister()

InstructionOperand* v8::internal::compiler::OperandGenerator::UseUniqueRegister ( Node *  node)
inline

Definition at line 76 of file instruction-selector-impl.h.

76  {
77  return Use(node, new (zone())
78  UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER));
79  }

References v8::internal::compiler::UnallocatedOperand::MUST_HAVE_REGISTER, Use(), and zone().

+ Here is the call graph for this function:

◆ zone()

Zone* v8::internal::compiler::OperandGenerator::zone ( ) const
inlineprotected

Definition at line 140 of file instruction-selector-impl.h.

140 { return selector()->instruction_zone(); }

References selector().

Referenced by DefineAsConstant(), DefineAsFixed(), DefineAsRegister(), DefineSameAsFirst(), isolate(), TempDoubleRegister(), TempImmediate(), TempRegister(), ToUnallocatedOperand(), Use(), UseFixed(), UseImmediate(), UseRegister(), UseUnique(), and UseUniqueRegister().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ selector_

InstructionSelector* v8::internal::compiler::OperandGenerator::selector_
private

Definition at line 199 of file instruction-selector-impl.h.

Referenced by selector().


The documentation for this class was generated from the following file: