summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.h
diff options
context:
space:
mode:
author Calin Juravle <calin@google.com> 2014-10-28 16:57:40 +0000
committer Calin Juravle <calin@google.com> 2014-10-28 17:53:33 +0000
commit7c4954d429626a6ceafbf05be41bf5f840894e44 (patch)
tree9d4a088cc2e259235819f105a21e5a3d58bd0139 /compiler/optimizing/nodes.h
parent4816ecfc1b2d544685ec5edcdeaad6870f6bfd7e (diff)
[optimizing compiler] Add division for floats and doubles
backends: x86, x86_64, arm. Also: - ordered instructions based on their name. - add missing kNoOutputOverlap to add/sub/mul. Change-Id: Ie47cde3b15ac74e7a1660c67a2eed1d7871f0ad0
Diffstat (limited to 'compiler/optimizing/nodes.h')
-rw-r--r--compiler/optimizing/nodes.h57
1 files changed, 35 insertions, 22 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 7adb84008a..f530708aeb 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -468,46 +468,47 @@ class HBasicBlock : public ArenaObject {
#define FOR_EACH_CONCRETE_INSTRUCTION(M) \
M(Add, BinaryOperation) \
+ M(ArrayGet, Instruction) \
+ M(ArrayLength, Instruction) \
+ M(ArraySet, Instruction) \
+ M(BoundsCheck, Instruction) \
+ M(Compare, BinaryOperation) \
M(Condition, BinaryOperation) \
+ M(Div, BinaryOperation) \
+ M(DoubleConstant, Constant) \
M(Equal, Condition) \
- M(NotEqual, Condition) \
- M(LessThan, Condition) \
- M(LessThanOrEqual, Condition) \
- M(GreaterThan, Condition) \
- M(GreaterThanOrEqual, Condition) \
M(Exit, Instruction) \
+ M(FloatConstant, Constant) \
M(Goto, Instruction) \
+ M(GreaterThan, Condition) \
+ M(GreaterThanOrEqual, Condition) \
M(If, Instruction) \
+ M(InstanceFieldGet, Instruction) \
+ M(InstanceFieldSet, Instruction) \
M(IntConstant, Constant) \
M(InvokeStatic, Invoke) \
M(InvokeVirtual, Invoke) \
+ M(LessThan, Condition) \
+ M(LessThanOrEqual, Condition) \
M(LoadLocal, Instruction) \
M(Local, Instruction) \
M(LongConstant, Constant) \
+ M(Mul, BinaryOperation) \
+ M(Neg, UnaryOperation) \
+ M(NewArray, Instruction) \
M(NewInstance, Instruction) \
M(Not, UnaryOperation) \
- M(ParameterValue, Instruction) \
+ M(NotEqual, Condition) \
+ M(NullCheck, Instruction) \
M(ParallelMove, Instruction) \
+ M(ParameterValue, Instruction) \
M(Phi, Instruction) \
M(Return, Instruction) \
M(ReturnVoid, Instruction) \
M(StoreLocal, Instruction) \
M(Sub, BinaryOperation) \
- M(Compare, BinaryOperation) \
- M(InstanceFieldGet, Instruction) \
- M(InstanceFieldSet, Instruction) \
- M(ArrayGet, Instruction) \
- M(ArraySet, Instruction) \
- M(ArrayLength, Instruction) \
- M(BoundsCheck, Instruction) \
- M(NullCheck, Instruction) \
- M(Temporary, Instruction) \
M(SuspendCheck, Instruction) \
- M(Mul, BinaryOperation) \
- M(Neg, UnaryOperation) \
- M(FloatConstant, Constant) \
- M(DoubleConstant, Constant) \
- M(NewArray, Instruction) \
+ M(Temporary, Instruction) \
#define FOR_EACH_INSTRUCTION(M) \
FOR_EACH_CONCRETE_INSTRUCTION(M) \
@@ -1658,8 +1659,6 @@ class HSub : public HBinaryOperation {
HSub(Primitive::Type result_type, HInstruction* left, HInstruction* right)
: HBinaryOperation(result_type, left, right) {}
- virtual bool IsCommutative() { return false; }
-
virtual int32_t Evaluate(int32_t x, int32_t y) const OVERRIDE {
return x - y;
}
@@ -1689,6 +1688,20 @@ class HMul : public HBinaryOperation {
DISALLOW_COPY_AND_ASSIGN(HMul);
};
+class HDiv : public HBinaryOperation {
+ public:
+ HDiv(Primitive::Type result_type, HInstruction* left, HInstruction* right)
+ : HBinaryOperation(result_type, left, right) {}
+
+ virtual int32_t Evaluate(int32_t x, int32_t y) const { return x / y; }
+ virtual int64_t Evaluate(int64_t x, int64_t y) const { return x / y; }
+
+ DECLARE_INSTRUCTION(Div);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(HDiv);
+};
+
// The value of a parameter in this method. Its location depends on
// the calling convention.
class HParameterValue : public HExpression<0> {