blob: 8cfad3b6175affc99ab927143fe7cb7215d279e5 [file] [log] [blame]
Dan Gohman947c9af2010-10-14 23:06:10 +00001//===--- CodeGenTBAA.h - TBAA information for LLVM CodeGen ------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This is the code that manages TBAA information.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef CLANG_CODEGEN_CODEGENTBAA_H
15#define CLANG_CODEGEN_CODEGENTBAA_H
16
17#include "llvm/LLVMContext.h"
18#include "llvm/ADT/DenseMap.h"
19
20namespace llvm {
21 class LLVMContext;
22 class MDNode;
23}
24
25namespace clang {
26 class ASTContext;
27 class LangOptions;
28 class QualType;
29 class Type;
30
31namespace CodeGen {
32 class CGCXXABI;
33 class CGRecordLayout;
34
35/// CodeGenTBAA - This class organizes the cross-module state that is used
36/// while lowering AST types to LLVM types.
37class CodeGenTBAA {
38 ASTContext &Context;
39 llvm::LLVMContext& VMContext;
40 const LangOptions &Features;
41
42 /// MetadataCache - This maps clang::Types to llvm::MDNodes describing them.
43 llvm::DenseMap<const Type *, llvm::MDNode *> MetadataCache;
44
45 /// Root - This is the mdnode for the root of the metadata type graph
46 /// for this translation unit.
47 llvm::MDNode *Root;
48
49 /// Char - This is the mdnode for "char", which is special, and any types
50 /// considered to be equivalent to it.
51 llvm::MDNode *Char;
52
53 llvm::MDNode *getTBAAInfoForNamedType(const char *NameStr,
54 llvm::MDNode *Parent);
55
56public:
57 CodeGenTBAA(ASTContext &Ctx, llvm::LLVMContext &VMContext,
58 const LangOptions &Features);
59 ~CodeGenTBAA();
60
61 llvm::MDNode *getTBAAInfo(QualType QTy);
62};
63
64} // end namespace CodeGen
65} // end namespace clang
66
67#endif