1 //===--- CodeGenTBAA.h - TBAA information for LLVM CodeGen ------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This is the code that manages TBAA information and defines the TBAA policy
11 // for the optimizer to use.
13 //===----------------------------------------------------------------------===//
15 #ifndef CLANG_CODEGEN_CODEGENTBAA_H
16 #define CLANG_CODEGEN_CODEGENTBAA_H
18 #include "clang/Basic/LLVM.h"
19 #include "llvm/MDBuilder.h"
20 #include "llvm/ADT/DenseMap.h"
38 /// CodeGenTBAA - This class organizes the cross-module state that is used
39 /// while lowering AST types to LLVM types.
42 const CodeGenOptions &CodeGenOpts;
43 const LangOptions &Features;
44 MangleContext &MContext;
46 // MDHelper - Helper for creating metadata.
47 llvm::MDBuilder MDHelper;
49 /// MetadataCache - This maps clang::Types to llvm::MDNodes describing them.
50 llvm::DenseMap<const Type *, llvm::MDNode *> MetadataCache;
55 /// getRoot - This is the mdnode for the root of the metadata type graph
56 /// for this translation unit.
57 llvm::MDNode *getRoot();
59 /// getChar - This is the mdnode for "char", which is special, and any types
60 /// considered to be equivalent to it.
61 llvm::MDNode *getChar();
64 CodeGenTBAA(ASTContext &Ctx, llvm::LLVMContext &VMContext,
65 const CodeGenOptions &CGO,
66 const LangOptions &Features,
67 MangleContext &MContext);
70 /// getTBAAInfo - Get the TBAA MDNode to be used for a dereference
71 /// of the given type.
72 llvm::MDNode *getTBAAInfo(QualType QTy);
74 /// getTBAAInfoForVTablePtr - Get the TBAA MDNode to be used for a
75 /// dereference of a vtable pointer.
76 llvm::MDNode *getTBAAInfoForVTablePtr();
79 } // end namespace CodeGen
80 } // end namespace clang