nodes_x86.h revision 0616ae081e648f4b9b64b33e2624a943c5fce977
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_X86_H_
18#define ART_COMPILER_OPTIMIZING_NODES_X86_H_
19
20namespace art {
21
22// Compute the address of the method for X86 Constant area support.
23class HX86ComputeBaseMethodAddress : public HExpression<0> {
24 public:
25  // Treat the value as an int32_t, but it is really a 32 bit native pointer.
26  HX86ComputeBaseMethodAddress() : HExpression(Primitive::kPrimInt, SideEffects::None()) {}
27
28  DECLARE_INSTRUCTION(X86ComputeBaseMethodAddress);
29
30 private:
31  DISALLOW_COPY_AND_ASSIGN(HX86ComputeBaseMethodAddress);
32};
33
34// Load a constant value from the constant table.
35class HX86LoadFromConstantTable : public HExpression<2> {
36 public:
37  HX86LoadFromConstantTable(HX86ComputeBaseMethodAddress* method_base,
38                            HConstant* constant,
39                            bool needs_materialization = true)
40      : HExpression(constant->GetType(), SideEffects::None()),
41        needs_materialization_(needs_materialization) {
42    SetRawInputAt(0, method_base);
43    SetRawInputAt(1, constant);
44  }
45
46  bool NeedsMaterialization() const { return needs_materialization_; }
47
48  HX86ComputeBaseMethodAddress* GetBaseMethodAddress() const {
49    return InputAt(0)->AsX86ComputeBaseMethodAddress();
50  }
51
52  HConstant* GetConstant() const {
53    return InputAt(1)->AsConstant();
54  }
55
56  DECLARE_INSTRUCTION(X86LoadFromConstantTable);
57
58 private:
59  const bool needs_materialization_;
60
61  DISALLOW_COPY_AND_ASSIGN(HX86LoadFromConstantTable);
62};
63
64}  // namespace art
65
66#endif  // ART_COMPILER_OPTIMIZING_NODES_X86_H_
67