blob: cdb910be155c8271a7225e5af548829785d89840 [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 {
Dan Gohman2e29eb52010-10-15 20:23:12 +000032 class MangleContext;
Dan Gohman947c9af2010-10-14 23:06:10 +000033 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;
Dan Gohman2e29eb52010-10-15 20:23:12 +000041 MangleContext &MContext;
Dan Gohman947c9af2010-10-14 23:06:10 +000042
43 /// MetadataCache - This maps clang::Types to llvm::MDNodes describing them.
44 llvm::DenseMap<const Type *, llvm::MDNode *> MetadataCache;
45
46 /// Root - This is the mdnode for the root of the metadata type graph
47 /// for this translation unit.
48 llvm::MDNode *Root;
49
50 /// Char - This is the mdnode for "char", which is special, and any types
51 /// considered to be equivalent to it.
52 llvm::MDNode *Char;
53
Dan Gohman2e29eb52010-10-15 20:23:12 +000054 llvm::MDNode *getTBAAInfoForNamedType(llvm::StringRef NameStr,
Dan Gohman947c9af2010-10-14 23:06:10 +000055 llvm::MDNode *Parent);
56
57public:
58 CodeGenTBAA(ASTContext &Ctx, llvm::LLVMContext &VMContext,
Dan Gohman2e29eb52010-10-15 20:23:12 +000059 const LangOptions &Features,
60 MangleContext &MContext);
Dan Gohman947c9af2010-10-14 23:06:10 +000061 ~CodeGenTBAA();
62
63 llvm::MDNode *getTBAAInfo(QualType QTy);
64};
65
66} // end namespace CodeGen
67} // end namespace clang
68
69#endif