blob: 1fe9314703b9be79ef56f80e6a7239631c19112f [file] [log] [blame]
TDYa127aba61122012-05-04 18:28:36 -07001/*
2 * Copyright (C) 2012 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_SRC_COMPILER_LLVM_TBAA_INFO_H_
18#define ART_SRC_COMPILER_LLVM_TBAA_INFO_H_
19
20#include "backend_types.h"
21
22#include <cstring>
23
24namespace llvm {
25 class LLVMContext;
26 class MDNode;
27 class StringRef;
28}
29
30namespace art {
31namespace compiler_llvm {
32
33
34class TBAAInfo {
35 public:
36 TBAAInfo(llvm::LLVMContext& context) : context_(context), root_(NULL) {
37 std::memset(special_type_, 0, sizeof(special_type_));
TDYa127706e7db2012-05-06 00:05:33 -070038 std::memset(memory_jtype_, 0, sizeof(memory_jtype_));
TDYa127aba61122012-05-04 18:28:36 -070039 }
40
41 llvm::MDNode* GetRootType();
42
43 llvm::MDNode* GetSpecialType(TBAASpecialType special_ty);
44
TDYa127706e7db2012-05-06 00:05:33 -070045 llvm::MDNode* GetMemoryJType(TBAASpecialType special_ty, JType j_ty);
46
TDYa127aba61122012-05-04 18:28:36 -070047 llvm::MDNode* GenTBAANode(llvm::StringRef name,
48 llvm::MDNode* parent = NULL,
49 bool readonly = false);
50
51 private:
52 llvm::LLVMContext& context_;
53 llvm::MDNode* root_;
54 llvm::MDNode* special_type_[MAX_TBAA_SPECIAL_TYPE];
TDYa127706e7db2012-05-06 00:05:33 -070055 // There are 3 categories of memory types will not alias: array element, identified field, and
56 // static field.
57 llvm::MDNode* memory_jtype_[3][MAX_JTYPE];
TDYa127aba61122012-05-04 18:28:36 -070058};
59
60
61} // namespace compiler_llvm
62} // namespace art
63
64#endif // ART_SRC_COMPILER_LLVM_TBAA_INFO_H_