Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1 | //===--- CodeGenTypes.h - Type translation for LLVM CodeGen -----*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 0bc735f | 2007-12-29 19:59:25 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 10 | // This is the code that handles AST -> LLVM type lowering. |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Chris Lattner | ef52a2f | 2008-02-29 17:10:38 +0000 | [diff] [blame] | 14 | #ifndef CLANG_CODEGEN_CODEGENTYPES_H |
| 15 | #define CLANG_CODEGEN_CODEGENTYPES_H |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 16 | |
Owen Anderson | 47a434f | 2009-08-05 23:18:46 +0000 | [diff] [blame] | 17 | #include "llvm/Module.h" |
Anders Carlsson | c9e2091 | 2007-08-21 00:21:21 +0000 | [diff] [blame] | 18 | #include "llvm/ADT/DenseMap.h" |
Devang Patel | eae1560 | 2008-02-05 02:39:50 +0000 | [diff] [blame] | 19 | #include "llvm/ADT/SmallSet.h" |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 20 | #include <vector> |
| 21 | |
Daniel Dunbar | 62d5c1b | 2008-09-10 07:00:50 +0000 | [diff] [blame] | 22 | #include "CGCall.h" |
Anders Carlsson | b2bcf1c | 2010-02-06 02:44:09 +0000 | [diff] [blame^] | 23 | #include "GlobalDecl.h" |
Daniel Dunbar | 62d5c1b | 2008-09-10 07:00:50 +0000 | [diff] [blame] | 24 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 25 | namespace llvm { |
Daniel Dunbar | 45c25ba | 2008-09-10 04:01:49 +0000 | [diff] [blame] | 26 | class FunctionType; |
Anders Carlsson | 4e53328 | 2007-08-17 22:00:32 +0000 | [diff] [blame] | 27 | class Module; |
Chris Lattner | fce71b8 | 2008-04-03 05:50:42 +0000 | [diff] [blame] | 28 | class OpaqueType; |
Devang Patel | 30ec997 | 2007-10-25 18:32:36 +0000 | [diff] [blame] | 29 | class PATypeHolder; |
Devang Patel | 7a4718e | 2007-10-31 20:01:01 +0000 | [diff] [blame] | 30 | class TargetData; |
Daniel Dunbar | 45c25ba | 2008-09-10 04:01:49 +0000 | [diff] [blame] | 31 | class Type; |
Benjamin Kramer | f21efe9 | 2009-08-11 17:46:57 +0000 | [diff] [blame] | 32 | class LLVMContext; |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | namespace clang { |
Daniel Dunbar | 6b1da0e | 2008-10-13 17:02:26 +0000 | [diff] [blame] | 36 | class ABIInfo; |
Chris Lattner | d2d2a11 | 2007-07-14 01:29:45 +0000 | [diff] [blame] | 37 | class ASTContext; |
Anders Carlsson | f6c56e2 | 2009-11-25 03:15:49 +0000 | [diff] [blame] | 38 | class CXXConstructorDecl; |
| 39 | class CXXDestructorDecl; |
Anders Carlsson | f6f8ae5 | 2009-04-03 22:48:58 +0000 | [diff] [blame] | 40 | class CXXMethodDecl; |
Devang Patel | b1e3989 | 2007-10-23 23:26:46 +0000 | [diff] [blame] | 41 | class FieldDecl; |
Douglas Gregor | 72564e7 | 2009-02-26 23:50:07 +0000 | [diff] [blame] | 42 | class FunctionProtoType; |
Chris Lattner | 391d77a | 2008-03-30 23:03:07 +0000 | [diff] [blame] | 43 | class ObjCInterfaceDecl; |
| 44 | class ObjCIvarDecl; |
Daniel Dunbar | 45c25ba | 2008-09-10 04:01:49 +0000 | [diff] [blame] | 45 | class PointerType; |
| 46 | class QualType; |
| 47 | class RecordDecl; |
| 48 | class TagDecl; |
| 49 | class TargetInfo; |
| 50 | class Type; |
Devang Patel | b84a06e | 2007-10-23 02:10:49 +0000 | [diff] [blame] | 51 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 52 | namespace CodeGen { |
Devang Patel | b84a06e | 2007-10-23 02:10:49 +0000 | [diff] [blame] | 53 | class CodeGenTypes; |
| 54 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 55 | /// CGRecordLayout - This class handles struct and union layout info while |
Devang Patel | b84a06e | 2007-10-23 02:10:49 +0000 | [diff] [blame] | 56 | /// lowering AST types to LLVM types. |
Devang Patel | 88a981b | 2007-11-01 19:11:01 +0000 | [diff] [blame] | 57 | class CGRecordLayout { |
| 58 | CGRecordLayout(); // DO NOT IMPLEMENT |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 59 | |
Anders Carlsson | fc3eaa4 | 2009-08-23 01:25:01 +0000 | [diff] [blame] | 60 | /// LLVMType - The LLVMType corresponding to this record layout. |
| 61 | const llvm::Type *LLVMType; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 62 | |
Anders Carlsson | 2c12d03 | 2010-02-02 05:17:25 +0000 | [diff] [blame] | 63 | /// ContainsPointerToDataMember - Whether one of the fields in this record |
| 64 | /// layout is a pointer to data member, or a struct that contains pointer to |
| 65 | /// data member. |
| 66 | bool ContainsPointerToDataMember; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 67 | |
Devang Patel | b84a06e | 2007-10-23 02:10:49 +0000 | [diff] [blame] | 68 | public: |
Anders Carlsson | 2c12d03 | 2010-02-02 05:17:25 +0000 | [diff] [blame] | 69 | CGRecordLayout(const llvm::Type *T, bool ContainsPointerToDataMember) |
| 70 | : LLVMType(T), ContainsPointerToDataMember(ContainsPointerToDataMember) { } |
Devang Patel | b84a06e | 2007-10-23 02:10:49 +0000 | [diff] [blame] | 71 | |
| 72 | /// getLLVMType - Return llvm type associated with this record. |
Anders Carlsson | 45372a6 | 2009-07-23 03:17:50 +0000 | [diff] [blame] | 73 | const llvm::Type *getLLVMType() const { |
Anders Carlsson | fc3eaa4 | 2009-08-23 01:25:01 +0000 | [diff] [blame] | 74 | return LLVMType; |
Devang Patel | b84a06e | 2007-10-23 02:10:49 +0000 | [diff] [blame] | 75 | } |
| 76 | |
Anders Carlsson | 2c12d03 | 2010-02-02 05:17:25 +0000 | [diff] [blame] | 77 | /// containsPointerToDataMember - Whether this struct contains pointers to |
| 78 | /// data members. |
| 79 | bool containsPointerToDataMember() const { |
| 80 | return ContainsPointerToDataMember; |
Anders Carlsson | fc3eaa4 | 2009-08-23 01:25:01 +0000 | [diff] [blame] | 81 | } |
Devang Patel | b84a06e | 2007-10-23 02:10:49 +0000 | [diff] [blame] | 82 | }; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 83 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 84 | /// CodeGenTypes - This class organizes the cross-module state that is used |
| 85 | /// while lowering AST types to LLVM types. |
| 86 | class CodeGenTypes { |
Chris Lattner | d2d2a11 | 2007-07-14 01:29:45 +0000 | [diff] [blame] | 87 | ASTContext &Context; |
Daniel Dunbar | 444be73 | 2009-11-13 05:51:54 +0000 | [diff] [blame] | 88 | const TargetInfo &Target; |
Anders Carlsson | 4e53328 | 2007-08-17 22:00:32 +0000 | [diff] [blame] | 89 | llvm::Module& TheModule; |
Devang Patel | 7a4718e | 2007-10-31 20:01:01 +0000 | [diff] [blame] | 90 | const llvm::TargetData& TheTargetData; |
Anton Korobeynikov | 82d0a41 | 2010-01-10 12:58:08 +0000 | [diff] [blame] | 91 | const ABIInfo& TheABIInfo; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 92 | |
Daniel Dunbar | 6aeae7f | 2009-02-26 19:48:14 +0000 | [diff] [blame] | 93 | llvm::SmallVector<std::pair<QualType, |
Chris Lattner | fce71b8 | 2008-04-03 05:50:42 +0000 | [diff] [blame] | 94 | llvm::OpaqueType *>, 8> PointersToResolve; |
| 95 | |
Daniel Dunbar | efb6d0d | 2008-09-06 02:26:43 +0000 | [diff] [blame] | 96 | llvm::DenseMap<const Type*, llvm::PATypeHolder> TagDeclTypes; |
Devang Patel | b84a06e | 2007-10-23 02:10:49 +0000 | [diff] [blame] | 97 | |
Eli Friedman | b3b6b9b | 2009-03-05 03:16:41 +0000 | [diff] [blame] | 98 | llvm::DenseMap<const Type*, llvm::PATypeHolder> FunctionTypes; |
| 99 | |
Daniel Dunbar | 412f59b | 2009-04-22 10:28:39 +0000 | [diff] [blame] | 100 | /// The opaque type map for Objective-C interfaces. All direct |
| 101 | /// manipulation is done by the runtime interfaces, which are |
| 102 | /// responsible for coercing to the appropriate type; these opaque |
| 103 | /// types are never refined. |
| 104 | llvm::DenseMap<const ObjCInterfaceType*, const llvm::Type *> InterfaceTypes; |
| 105 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 106 | /// CGRecordLayouts - This maps llvm struct type with corresponding |
| 107 | /// record layout info. |
| 108 | /// FIXME : If CGRecordLayout is less than 16 bytes then use |
Devang Patel | 71bcb09 | 2007-10-24 00:32:16 +0000 | [diff] [blame] | 109 | /// inline it in the map. |
Daniel Dunbar | efb6d0d | 2008-09-06 02:26:43 +0000 | [diff] [blame] | 110 | llvm::DenseMap<const Type*, CGRecordLayout *> CGRecordLayouts; |
Devang Patel | b84a06e | 2007-10-23 02:10:49 +0000 | [diff] [blame] | 111 | |
| 112 | /// FieldInfo - This maps struct field with corresponding llvm struct type |
| 113 | /// field no. This info is populated by record organizer. |
| 114 | llvm::DenseMap<const FieldDecl *, unsigned> FieldInfo; |
| 115 | |
Daniel Dunbar | 40a6be6 | 2009-02-03 00:07:12 +0000 | [diff] [blame] | 116 | /// FunctionInfos - Hold memoized CGFunctionInfo results. |
| 117 | llvm::FoldingSet<CGFunctionInfo> FunctionInfos; |
| 118 | |
Lauro Ramos Venancio | 3b8c22d | 2008-01-22 20:17:04 +0000 | [diff] [blame] | 119 | public: |
Anders Carlsson | 8330cee | 2009-07-23 17:01:21 +0000 | [diff] [blame] | 120 | struct BitFieldInfo { |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 121 | BitFieldInfo(unsigned FieldNo, |
| 122 | unsigned Start, |
Anders Carlsson | 8330cee | 2009-07-23 17:01:21 +0000 | [diff] [blame] | 123 | unsigned Size) |
| 124 | : FieldNo(FieldNo), Start(Start), Size(Size) {} |
Lauro Ramos Venancio | 2c46ce8 | 2008-01-21 22:54:57 +0000 | [diff] [blame] | 125 | |
Anders Carlsson | 8330cee | 2009-07-23 17:01:21 +0000 | [diff] [blame] | 126 | unsigned FieldNo; |
| 127 | unsigned Start; |
| 128 | unsigned Size; |
Devang Patel | 159e330 | 2007-11-07 01:57:13 +0000 | [diff] [blame] | 129 | }; |
Lauro Ramos Venancio | 3b8c22d | 2008-01-22 20:17:04 +0000 | [diff] [blame] | 130 | |
| 131 | private: |
Devang Patel | 159e330 | 2007-11-07 01:57:13 +0000 | [diff] [blame] | 132 | llvm::DenseMap<const FieldDecl *, BitFieldInfo> BitFields; |
| 133 | |
Chris Lattner | 4581fff | 2008-02-06 05:21:55 +0000 | [diff] [blame] | 134 | /// TypeCache - This map keeps cache of llvm::Types (through PATypeHolder) |
Devang Patel | 30ec997 | 2007-10-25 18:32:36 +0000 | [diff] [blame] | 135 | /// and maps llvm::Types to corresponding clang::Type. llvm::PATypeHolder is |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 136 | /// used instead of llvm::Type because it allows us to bypass potential |
Devang Patel | 30ec997 | 2007-10-25 18:32:36 +0000 | [diff] [blame] | 137 | /// dangling type pointers due to type refinement on llvm side. |
Chris Lattner | 4581fff | 2008-02-06 05:21:55 +0000 | [diff] [blame] | 138 | llvm::DenseMap<Type *, llvm::PATypeHolder> TypeCache; |
Devang Patel | 5825ac2 | 2007-10-25 21:40:12 +0000 | [diff] [blame] | 139 | |
| 140 | /// ConvertNewType - Convert type T into a llvm::Type. Do not use this |
| 141 | /// method directly because it does not do any type caching. This method |
| 142 | /// is available only for ConvertType(). CovertType() is preferred |
| 143 | /// interface to convert type T into a llvm::Type. |
| 144 | const llvm::Type *ConvertNewType(QualType T); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 145 | public: |
Anton Korobeynikov | 82d0a41 | 2010-01-10 12:58:08 +0000 | [diff] [blame] | 146 | CodeGenTypes(ASTContext &Ctx, llvm::Module &M, const llvm::TargetData &TD, |
| 147 | const ABIInfo &Info); |
Devang Patel | b84a06e | 2007-10-23 02:10:49 +0000 | [diff] [blame] | 148 | ~CodeGenTypes(); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 149 | |
Devang Patel | d9e9ede | 2007-10-31 20:08:22 +0000 | [diff] [blame] | 150 | const llvm::TargetData &getTargetData() const { return TheTargetData; } |
Daniel Dunbar | 444be73 | 2009-11-13 05:51:54 +0000 | [diff] [blame] | 151 | const TargetInfo &getTarget() const { return Target; } |
Devang Patel | 86522b9 | 2007-10-29 20:50:19 +0000 | [diff] [blame] | 152 | ASTContext &getContext() const { return Context; } |
Anton Korobeynikov | 82d0a41 | 2010-01-10 12:58:08 +0000 | [diff] [blame] | 153 | const ABIInfo &getABIInfo() const { return TheABIInfo; } |
Owen Anderson | 47a434f | 2009-08-05 23:18:46 +0000 | [diff] [blame] | 154 | llvm::LLVMContext &getLLVMContext() { return TheModule.getContext(); } |
Devang Patel | 5825ac2 | 2007-10-25 21:40:12 +0000 | [diff] [blame] | 155 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 156 | /// ConvertType - Convert type T into a llvm::Type. |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 157 | const llvm::Type *ConvertType(QualType T); |
Chris Lattner | fce71b8 | 2008-04-03 05:50:42 +0000 | [diff] [blame] | 158 | const llvm::Type *ConvertTypeRecursive(QualType T); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 159 | |
Chris Lattner | 4581fff | 2008-02-06 05:21:55 +0000 | [diff] [blame] | 160 | /// ConvertTypeForMem - Convert type T into a llvm::Type. This differs from |
| 161 | /// ConvertType in that it is used to convert to the memory representation for |
| 162 | /// a type. For example, the scalar representation for _Bool is i1, but the |
| 163 | /// memory representation is usually i8 or i32, depending on the target. |
Chris Lattner | 19009e6 | 2008-01-09 18:47:25 +0000 | [diff] [blame] | 164 | const llvm::Type *ConvertTypeForMem(QualType T); |
Eli Friedman | 57a84fb | 2009-03-03 04:48:01 +0000 | [diff] [blame] | 165 | const llvm::Type *ConvertTypeForMemRecursive(QualType T); |
Daniel Dunbar | 45c25ba | 2008-09-10 04:01:49 +0000 | [diff] [blame] | 166 | |
Daniel Dunbar | 36b5f5e | 2009-01-31 03:05:44 +0000 | [diff] [blame] | 167 | /// GetFunctionType - Get the LLVM function type for \arg Info. |
Daniel Dunbar | bb36d33 | 2009-02-02 21:43:58 +0000 | [diff] [blame] | 168 | const llvm::FunctionType *GetFunctionType(const CGFunctionInfo &Info, |
| 169 | bool IsVariadic); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 170 | |
Anders Carlsson | ecf282b | 2009-11-24 05:08:52 +0000 | [diff] [blame] | 171 | |
| 172 | /// GetFunctionTypeForVtable - Get the LLVM function type for use in a vtable, |
| 173 | /// given a CXXMethodDecl. If the method to has an incomplete return type, |
| 174 | /// and/or incomplete argument types, this will return the opaque type. |
| 175 | const llvm::Type *GetFunctionTypeForVtable(const CXXMethodDecl *MD); |
| 176 | |
Anders Carlsson | ad3e711 | 2009-08-24 17:16:23 +0000 | [diff] [blame] | 177 | const CGRecordLayout &getCGRecordLayout(const TagDecl*) const; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 178 | |
Devang Patel | b84a06e | 2007-10-23 02:10:49 +0000 | [diff] [blame] | 179 | /// getLLVMFieldNo - Return llvm::StructType element number |
| 180 | /// that corresponds to the field FD. |
| 181 | unsigned getLLVMFieldNo(const FieldDecl *FD); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 182 | |
Chris Lattner | c5b8806 | 2008-02-06 05:08:19 +0000 | [diff] [blame] | 183 | /// UpdateCompletedType - When we find the full definition for a TagDecl, |
| 184 | /// replace the 'opaque' type we previously made for it if applicable. |
| 185 | void UpdateCompletedType(const TagDecl *TD); |
Daniel Dunbar | 541b63b | 2009-02-02 23:23:47 +0000 | [diff] [blame] | 186 | |
Daniel Dunbar | bac7c25 | 2009-09-11 22:24:53 +0000 | [diff] [blame] | 187 | private: |
Douglas Gregor | 72564e7 | 2009-02-26 23:50:07 +0000 | [diff] [blame] | 188 | const CGFunctionInfo &getFunctionInfo(const FunctionNoProtoType *FTNP); |
| 189 | const CGFunctionInfo &getFunctionInfo(const FunctionProtoType *FTP); |
Daniel Dunbar | bac7c25 | 2009-09-11 22:24:53 +0000 | [diff] [blame] | 190 | |
| 191 | public: |
| 192 | /// getFunctionInfo - Get the function info for the specified function decl. |
Anders Carlsson | b2bcf1c | 2010-02-06 02:44:09 +0000 | [diff] [blame^] | 193 | const CGFunctionInfo &getFunctionInfo(GlobalDecl GD); |
| 194 | |
Daniel Dunbar | 541b63b | 2009-02-02 23:23:47 +0000 | [diff] [blame] | 195 | const CGFunctionInfo &getFunctionInfo(const FunctionDecl *FD); |
Anders Carlsson | f6f8ae5 | 2009-04-03 22:48:58 +0000 | [diff] [blame] | 196 | const CGFunctionInfo &getFunctionInfo(const CXXMethodDecl *MD); |
Daniel Dunbar | 541b63b | 2009-02-02 23:23:47 +0000 | [diff] [blame] | 197 | const CGFunctionInfo &getFunctionInfo(const ObjCMethodDecl *MD); |
Anders Carlsson | f6c56e2 | 2009-11-25 03:15:49 +0000 | [diff] [blame] | 198 | const CGFunctionInfo &getFunctionInfo(const CXXConstructorDecl *D, |
| 199 | CXXCtorType Type); |
| 200 | const CGFunctionInfo &getFunctionInfo(const CXXDestructorDecl *D, |
| 201 | CXXDtorType Type); |
| 202 | |
John McCall | 04a67a6 | 2010-02-05 21:31:56 +0000 | [diff] [blame] | 203 | const CGFunctionInfo &getFunctionInfo(const CallArgList &Args, |
| 204 | const FunctionType *Ty) { |
| 205 | return getFunctionInfo(Ty->getResultType(), Args, |
| 206 | Ty->getCallConv(), Ty->getNoReturnAttr()); |
| 207 | } |
| 208 | |
Anders Carlsson | 375c31c | 2009-10-03 19:43:08 +0000 | [diff] [blame] | 209 | // getFunctionInfo - Get the function info for a member function. |
| 210 | const CGFunctionInfo &getFunctionInfo(const CXXRecordDecl *RD, |
| 211 | const FunctionProtoType *FTP); |
| 212 | |
Daniel Dunbar | bac7c25 | 2009-09-11 22:24:53 +0000 | [diff] [blame] | 213 | /// getFunctionInfo - Get the function info for a function described by a |
| 214 | /// return type and argument types. If the calling convention is not |
| 215 | /// specified, the "C" calling convention will be used. |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 216 | const CGFunctionInfo &getFunctionInfo(QualType ResTy, |
Daniel Dunbar | bac7c25 | 2009-09-11 22:24:53 +0000 | [diff] [blame] | 217 | const CallArgList &Args, |
John McCall | 04a67a6 | 2010-02-05 21:31:56 +0000 | [diff] [blame] | 218 | CallingConv CC, |
| 219 | bool NoReturn); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 220 | const CGFunctionInfo &getFunctionInfo(QualType ResTy, |
Daniel Dunbar | bac7c25 | 2009-09-11 22:24:53 +0000 | [diff] [blame] | 221 | const FunctionArgList &Args, |
John McCall | 04a67a6 | 2010-02-05 21:31:56 +0000 | [diff] [blame] | 222 | CallingConv CC, |
| 223 | bool NoReturn); |
Daniel Dunbar | bac7c25 | 2009-09-11 22:24:53 +0000 | [diff] [blame] | 224 | const CGFunctionInfo &getFunctionInfo(QualType RetTy, |
| 225 | const llvm::SmallVector<QualType, 16> &ArgTys, |
John McCall | 04a67a6 | 2010-02-05 21:31:56 +0000 | [diff] [blame] | 226 | CallingConv CC, |
| 227 | bool NoReturn); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 228 | |
Chris Lattner | 19009e6 | 2008-01-09 18:47:25 +0000 | [diff] [blame] | 229 | public: // These are internal details of CGT that shouldn't be used externally. |
Devang Patel | b84a06e | 2007-10-23 02:10:49 +0000 | [diff] [blame] | 230 | /// addFieldInfo - Assign field number to field FD. |
Anders Carlsson | 8330cee | 2009-07-23 17:01:21 +0000 | [diff] [blame] | 231 | void addFieldInfo(const FieldDecl *FD, unsigned FieldNo); |
Lauro Ramos Venancio | 2c46ce8 | 2008-01-21 22:54:57 +0000 | [diff] [blame] | 232 | |
| 233 | /// addBitFieldInfo - Assign a start bit and a size to field FD. |
Anders Carlsson | 8330cee | 2009-07-23 17:01:21 +0000 | [diff] [blame] | 234 | void addBitFieldInfo(const FieldDecl *FD, unsigned FieldNo, |
| 235 | unsigned Start, unsigned Size); |
Lauro Ramos Venancio | 2c46ce8 | 2008-01-21 22:54:57 +0000 | [diff] [blame] | 236 | |
Chris Lattner | fc3b8e9 | 2008-02-06 05:18:32 +0000 | [diff] [blame] | 237 | /// getBitFieldInfo - Return the BitFieldInfo that corresponds to the field |
| 238 | /// FD. |
Lauro Ramos Venancio | 2c46ce8 | 2008-01-21 22:54:57 +0000 | [diff] [blame] | 239 | BitFieldInfo getBitFieldInfo(const FieldDecl *FD); |
Chris Lattner | fc3b8e9 | 2008-02-06 05:18:32 +0000 | [diff] [blame] | 240 | |
| 241 | /// ConvertTagDeclType - Lay out a tagged decl type like struct or union or |
| 242 | /// enum. |
Chris Lattner | 8fb1dd0 | 2008-02-06 06:06:49 +0000 | [diff] [blame] | 243 | const llvm::Type *ConvertTagDeclType(const TagDecl *TD); |
Daniel Dunbar | 5627377 | 2008-09-17 00:51:38 +0000 | [diff] [blame] | 244 | |
| 245 | /// GetExpandedTypes - Expand the type \arg Ty into the LLVM |
| 246 | /// argument types it would be passed as on the provided vector \arg |
| 247 | /// ArgTys. See ABIArgInfo::Expand. |
| 248 | void GetExpandedTypes(QualType Ty, std::vector<const llvm::Type*> &ArgTys); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 249 | }; |
Chris Lattner | a7674d8 | 2007-07-13 22:13:22 +0000 | [diff] [blame] | 250 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 251 | } // end namespace CodeGen |
| 252 | } // end namespace clang |
| 253 | |
| 254 | #endif |