CodeGenTypes.h (199482) | CodeGenTypes.h (199990) |
---|---|
1//===--- CodeGenTypes.h - Type translation 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//===----------------------------------------------------------------------===// --- 6 unchanged lines hidden (view full) --- 15#define CLANG_CODEGEN_CODEGENTYPES_H 16 17#include "llvm/Module.h" 18#include "llvm/ADT/DenseMap.h" 19#include "llvm/ADT/SmallSet.h" 20#include <vector> 21 22#include "CGCall.h" | 1//===--- CodeGenTypes.h - Type translation 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//===----------------------------------------------------------------------===// --- 6 unchanged lines hidden (view full) --- 15#define CLANG_CODEGEN_CODEGENTYPES_H 16 17#include "llvm/Module.h" 18#include "llvm/ADT/DenseMap.h" 19#include "llvm/ADT/SmallSet.h" 20#include <vector> 21 22#include "CGCall.h" |
23#include "CGCXX.h" |
|
23 24namespace llvm { 25 class FunctionType; 26 class Module; 27 class OpaqueType; 28 class PATypeHolder; 29 class TargetData; 30 class Type; 31 class LLVMContext; 32} 33 34namespace clang { 35 class ABIInfo; 36 class ASTContext; | 24 25namespace llvm { 26 class FunctionType; 27 class Module; 28 class OpaqueType; 29 class PATypeHolder; 30 class TargetData; 31 class Type; 32 class LLVMContext; 33} 34 35namespace clang { 36 class ABIInfo; 37 class ASTContext; |
38 class CXXConstructorDecl; 39 class CXXDestructorDecl; |
|
37 class CXXMethodDecl; 38 class FieldDecl; 39 class FunctionProtoType; 40 class ObjCInterfaceDecl; 41 class ObjCIvarDecl; 42 class PointerType; 43 class QualType; 44 class RecordDecl; --- 11 unchanged lines hidden (view full) --- 56 57 /// LLVMType - The LLVMType corresponding to this record layout. 58 const llvm::Type *LLVMType; 59 60 /// ContainsMemberPointer - Whether one of the fields in this record layout 61 /// is a member pointer, or a struct that contains a member pointer. 62 bool ContainsMemberPointer; 63 | 40 class CXXMethodDecl; 41 class FieldDecl; 42 class FunctionProtoType; 43 class ObjCInterfaceDecl; 44 class ObjCIvarDecl; 45 class PointerType; 46 class QualType; 47 class RecordDecl; --- 11 unchanged lines hidden (view full) --- 59 60 /// LLVMType - The LLVMType corresponding to this record layout. 61 const llvm::Type *LLVMType; 62 63 /// ContainsMemberPointer - Whether one of the fields in this record layout 64 /// is a member pointer, or a struct that contains a member pointer. 65 bool ContainsMemberPointer; 66 |
64 /// KeyFunction - The key function of the record layout (if one exists), 65 /// which is the first non-pure virtual function that is not inline at the 66 /// point of class definition. 67 /// See http://www.codesourcery.com/public/cxx-abi/abi.html#vague-vtable. 68 const CXXMethodDecl *KeyFunction; 69 | |
70 public: | 67 public: |
71 CGRecordLayout(const llvm::Type *T, bool ContainsMemberPointer, 72 const CXXMethodDecl *KeyFunction) 73 : LLVMType(T), ContainsMemberPointer(ContainsMemberPointer), 74 KeyFunction(KeyFunction) { } | 68 CGRecordLayout(const llvm::Type *T, bool ContainsMemberPointer) 69 : LLVMType(T), ContainsMemberPointer(ContainsMemberPointer) { } |
75 76 /// getLLVMType - Return llvm type associated with this record. 77 const llvm::Type *getLLVMType() const { 78 return LLVMType; 79 } 80 81 bool containsMemberPointer() const { 82 return ContainsMemberPointer; 83 } | 70 71 /// getLLVMType - Return llvm type associated with this record. 72 const llvm::Type *getLLVMType() const { 73 return LLVMType; 74 } 75 76 bool containsMemberPointer() const { 77 return ContainsMemberPointer; 78 } |
84 85 const CXXMethodDecl *getKeyFunction() const { 86 return KeyFunction; 87 } | |
88 }; 89 90/// CodeGenTypes - This class organizes the cross-module state that is used 91/// while lowering AST types to LLVM types. 92class CodeGenTypes { 93 ASTContext &Context; 94 const TargetInfo &Target; 95 llvm::Module& TheModule; --- 72 unchanged lines hidden (view full) --- 168 /// memory representation is usually i8 or i32, depending on the target. 169 const llvm::Type *ConvertTypeForMem(QualType T); 170 const llvm::Type *ConvertTypeForMemRecursive(QualType T); 171 172 /// GetFunctionType - Get the LLVM function type for \arg Info. 173 const llvm::FunctionType *GetFunctionType(const CGFunctionInfo &Info, 174 bool IsVariadic); 175 | 79 }; 80 81/// CodeGenTypes - This class organizes the cross-module state that is used 82/// while lowering AST types to LLVM types. 83class CodeGenTypes { 84 ASTContext &Context; 85 const TargetInfo &Target; 86 llvm::Module& TheModule; --- 72 unchanged lines hidden (view full) --- 159 /// memory representation is usually i8 or i32, depending on the target. 160 const llvm::Type *ConvertTypeForMem(QualType T); 161 const llvm::Type *ConvertTypeForMemRecursive(QualType T); 162 163 /// GetFunctionType - Get the LLVM function type for \arg Info. 164 const llvm::FunctionType *GetFunctionType(const CGFunctionInfo &Info, 165 bool IsVariadic); 166 |
167 168 /// GetFunctionTypeForVtable - Get the LLVM function type for use in a vtable, 169 /// given a CXXMethodDecl. If the method to has an incomplete return type, 170 /// and/or incomplete argument types, this will return the opaque type. 171 const llvm::Type *GetFunctionTypeForVtable(const CXXMethodDecl *MD); 172 |
|
176 const CGRecordLayout &getCGRecordLayout(const TagDecl*) const; 177 178 /// getLLVMFieldNo - Return llvm::StructType element number 179 /// that corresponds to the field FD. 180 unsigned getLLVMFieldNo(const FieldDecl *FD); 181 182 /// UpdateCompletedType - When we find the full definition for a TagDecl, 183 /// replace the 'opaque' type we previously made for it if applicable. 184 void UpdateCompletedType(const TagDecl *TD); 185 186private: 187 const CGFunctionInfo &getFunctionInfo(const FunctionNoProtoType *FTNP); 188 const CGFunctionInfo &getFunctionInfo(const FunctionProtoType *FTP); 189 190public: 191 /// getFunctionInfo - Get the function info for the specified function decl. 192 const CGFunctionInfo &getFunctionInfo(const FunctionDecl *FD); 193 const CGFunctionInfo &getFunctionInfo(const CXXMethodDecl *MD); 194 const CGFunctionInfo &getFunctionInfo(const ObjCMethodDecl *MD); | 173 const CGRecordLayout &getCGRecordLayout(const TagDecl*) const; 174 175 /// getLLVMFieldNo - Return llvm::StructType element number 176 /// that corresponds to the field FD. 177 unsigned getLLVMFieldNo(const FieldDecl *FD); 178 179 /// UpdateCompletedType - When we find the full definition for a TagDecl, 180 /// replace the 'opaque' type we previously made for it if applicable. 181 void UpdateCompletedType(const TagDecl *TD); 182 183private: 184 const CGFunctionInfo &getFunctionInfo(const FunctionNoProtoType *FTNP); 185 const CGFunctionInfo &getFunctionInfo(const FunctionProtoType *FTP); 186 187public: 188 /// getFunctionInfo - Get the function info for the specified function decl. 189 const CGFunctionInfo &getFunctionInfo(const FunctionDecl *FD); 190 const CGFunctionInfo &getFunctionInfo(const CXXMethodDecl *MD); 191 const CGFunctionInfo &getFunctionInfo(const ObjCMethodDecl *MD); |
195 | 192 const CGFunctionInfo &getFunctionInfo(const CXXConstructorDecl *D, 193 CXXCtorType Type); 194 const CGFunctionInfo &getFunctionInfo(const CXXDestructorDecl *D, 195 CXXDtorType Type); 196 |
196 // getFunctionInfo - Get the function info for a member function. 197 const CGFunctionInfo &getFunctionInfo(const CXXRecordDecl *RD, 198 const FunctionProtoType *FTP); 199 200 /// getFunctionInfo - Get the function info for a function described by a 201 /// return type and argument types. If the calling convention is not 202 /// specified, the "C" calling convention will be used. 203 const CGFunctionInfo &getFunctionInfo(QualType ResTy, --- 35 unchanged lines hidden --- | 197 // getFunctionInfo - Get the function info for a member function. 198 const CGFunctionInfo &getFunctionInfo(const CXXRecordDecl *RD, 199 const FunctionProtoType *FTP); 200 201 /// getFunctionInfo - Get the function info for a function described by a 202 /// return type and argument types. If the calling convention is not 203 /// specified, the "C" calling convention will be used. 204 const CGFunctionInfo &getFunctionInfo(QualType ResTy, --- 35 unchanged lines hidden --- |