blob: d07f019c60acd6a9f90c9f7d33b86f1ea0e16c29 [file] [log] [blame]
Alexandre Ramese6dbf482015-10-19 10:10:41 +01001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ART_COMPILER_OPTIMIZING_NODES_ARM64_H_
18#define ART_COMPILER_OPTIMIZING_NODES_ARM64_H_
19
20namespace art {
21
22// This instruction computes an intermediate address pointing in the 'middle' of an object. The
23// result pointer cannot be handled by GC, so extra care is taken to make sure that this value is
24// never used across anything that can trigger GC.
25class HArm64IntermediateAddress : public HExpression<2> {
26 public:
27 HArm64IntermediateAddress(HInstruction* base_address, HInstruction* offset, uint32_t dex_pc)
28 : HExpression(Primitive::kPrimNot, SideEffects::DependsOnGC(), dex_pc) {
29 SetRawInputAt(0, base_address);
30 SetRawInputAt(1, offset);
31 }
32
33 bool CanBeMoved() const OVERRIDE { return true; }
34 bool InstructionDataEquals(HInstruction* other ATTRIBUTE_UNUSED) const OVERRIDE { return true; }
35
36 HInstruction* GetBaseAddress() const { return InputAt(0); }
37 HInstruction* GetOffset() const { return InputAt(1); }
38
39 DECLARE_INSTRUCTION(Arm64IntermediateAddress);
40
41 private:
42 DISALLOW_COPY_AND_ASSIGN(HArm64IntermediateAddress);
43};
44
Alexandre Rames418318f2015-11-20 15:55:47 +000045class HArm64MultiplyAccumulate : public HExpression<3> {
46 public:
47 HArm64MultiplyAccumulate(Primitive::Type type,
48 InstructionKind op,
49 HInstruction* accumulator,
50 HInstruction* mul_left,
51 HInstruction* mul_right,
52 uint32_t dex_pc = kNoDexPc)
53 : HExpression(type, SideEffects::None(), dex_pc), op_kind_(op) {
54 SetRawInputAt(kInputAccumulatorIndex, accumulator);
55 SetRawInputAt(kInputMulLeftIndex, mul_left);
56 SetRawInputAt(kInputMulRightIndex, mul_right);
57 }
58
59 static constexpr int kInputAccumulatorIndex = 0;
60 static constexpr int kInputMulLeftIndex = 1;
61 static constexpr int kInputMulRightIndex = 2;
62
63 bool CanBeMoved() const OVERRIDE { return true; }
64 bool InstructionDataEquals(HInstruction* other) const OVERRIDE {
65 return op_kind_ == other->AsArm64MultiplyAccumulate()->op_kind_;
66 }
67
68 InstructionKind GetOpKind() const { return op_kind_; }
69
70 DECLARE_INSTRUCTION(Arm64MultiplyAccumulate);
71
72 private:
73 // Indicates if this is a MADD or MSUB.
74 InstructionKind op_kind_;
75
76 DISALLOW_COPY_AND_ASSIGN(HArm64MultiplyAccumulate);
77};
78
Alexandre Ramese6dbf482015-10-19 10:10:41 +010079} // namespace art
80
81#endif // ART_COMPILER_OPTIMIZING_NODES_ARM64_H_