blob: 0df732b514f22bcaddd39a2a04374af82aa48348 [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_));
38 }
39
40 llvm::MDNode* GetRootType();
41
42 llvm::MDNode* GetSpecialType(TBAASpecialType special_ty);
43
44 llvm::MDNode* GenTBAANode(llvm::StringRef name,
45 llvm::MDNode* parent = NULL,
46 bool readonly = false);
47
48 private:
49 llvm::LLVMContext& context_;
50 llvm::MDNode* root_;
51 llvm::MDNode* special_type_[MAX_TBAA_SPECIAL_TYPE];
52};
53
54
55} // namespace compiler_llvm
56} // namespace art
57
58#endif // ART_SRC_COMPILER_LLVM_TBAA_INFO_H_