CodeGenTBAA.h revision 0b5c4fc2ae3b503c2b1f354bf52b718aa50a6aee
1//===--- 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 MangleContext; 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 MangleContext &MContext; 42 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 54 llvm::MDNode *getTBAAInfoForNamedType(llvm::StringRef NameStr, 55 llvm::MDNode *Parent); 56 57public: 58 CodeGenTBAA(ASTContext &Ctx, llvm::LLVMContext &VMContext, 59 const LangOptions &Features, 60 MangleContext &MContext); 61 ~CodeGenTBAA(); 62 63 llvm::MDNode *getTBAAInfo(QualType QTy); 64}; 65 66} // end namespace CodeGen 67} // end namespace clang 68 69#endif 70