Index: src/compiler/instruction-selector-impl.h |
diff --git a/src/compiler/instruction-selector-impl.h b/src/compiler/instruction-selector-impl.h |
index 616b6a53810cf02bbbd68f16b585e24c884edd5a..5e8680e1d8bf658d9b86552969dd0e449d4afb6f 100644 |
--- a/src/compiler/instruction-selector-impl.h |
+++ b/src/compiler/instruction-selector-impl.h |
@@ -143,6 +143,10 @@ class OperandGenerator { |
return sequence()->AddImmediate(ToConstant(node)); |
} |
+ InstructionOperand UseNegatedImmediate(Node* node) { |
+ return sequence()->AddImmediate(ToNegatedConstant(node)); |
+ } |
+ |
InstructionOperand UseLocation(Node* node, LinkageLocation location) { |
return Use(node, ToUnallocatedOperand(location, GetVReg(node))); |
} |
@@ -225,6 +229,19 @@ class OperandGenerator { |
return Constant(static_cast<int32_t>(0)); |
} |
+ static Constant ToNegatedConstant(const Node* node) { |
+ switch (node->opcode()) { |
+ case IrOpcode::kInt32Constant: |
+ return Constant(-OpParameter<int32_t>(node)); |
+ case IrOpcode::kInt64Constant: |
+ return Constant(-OpParameter<int64_t>(node)); |
+ default: |
+ break; |
+ } |
+ UNREACHABLE(); |
+ return Constant(static_cast<int32_t>(0)); |
+ } |
+ |
UnallocatedOperand Define(Node* node, UnallocatedOperand operand) { |
DCHECK_NOT_NULL(node); |
DCHECK_EQ(operand.virtual_register(), GetVReg(node)); |