| Dan Gohman | 947c9af | 2010-10-14 23:06:10 +0000 | [diff] [blame] | 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 | |
| 20 | namespace llvm { |
| 21 | class LLVMContext; |
| 22 | class MDNode; |
| 23 | } |
| 24 | |
| 25 | namespace clang { |
| 26 | class ASTContext; |
| 27 | class LangOptions; |
| 28 | class QualType; |
| 29 | class Type; |
| 30 | |
| 31 | namespace CodeGen { |
| Dan Gohman | 2e29eb5 | 2010-10-15 20:23:12 +0000 | [diff] [blame^] | 32 | class MangleContext; |
| Dan Gohman | 947c9af | 2010-10-14 23:06:10 +0000 | [diff] [blame] | 33 | class CGRecordLayout; |
| 34 | |
| 35 | /// CodeGenTBAA - This class organizes the cross-module state that is used |
| 36 | /// while lowering AST types to LLVM types. |
| 37 | class CodeGenTBAA { |
| 38 | ASTContext &Context; |
| 39 | llvm::LLVMContext& VMContext; |
| 40 | const LangOptions &Features; |
| Dan Gohman | 2e29eb5 | 2010-10-15 20:23:12 +0000 | [diff] [blame^] | 41 | MangleContext &MContext; |
| Dan Gohman | 947c9af | 2010-10-14 23:06:10 +0000 | [diff] [blame] | 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 | |
| Dan Gohman | 2e29eb5 | 2010-10-15 20:23:12 +0000 | [diff] [blame^] | 54 | llvm::MDNode *getTBAAInfoForNamedType(llvm::StringRef NameStr, |
| Dan Gohman | 947c9af | 2010-10-14 23:06:10 +0000 | [diff] [blame] | 55 | llvm::MDNode *Parent); |
| 56 | |
| 57 | public: |
| 58 | CodeGenTBAA(ASTContext &Ctx, llvm::LLVMContext &VMContext, |
| Dan Gohman | 2e29eb5 | 2010-10-15 20:23:12 +0000 | [diff] [blame^] | 59 | const LangOptions &Features, |
| 60 | MangleContext &MContext); |
| Dan Gohman | 947c9af | 2010-10-14 23:06:10 +0000 | [diff] [blame] | 61 | ~CodeGenTBAA(); |
| 62 | |
| 63 | llvm::MDNode *getTBAAInfo(QualType QTy); |
| 64 | }; |
| 65 | |
| 66 | } // end namespace CodeGen |
| 67 | } // end namespace clang |
| 68 | |
| 69 | #endif |