Alexandre Rames | e6dbf48 | 2015-10-19 10:10:41 +0100 | [diff] [blame] | 1 | /* |
| 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 | |
| 20 | namespace 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. |
| 25 | class 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 | |
| 45 | } // namespace art |
| 46 | |
| 47 | #endif // ART_COMPILER_OPTIMIZING_NODES_ARM64_H_ |