aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenTypes.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CodeGenTypes.h')
-rw-r--r--lib/CodeGen/CodeGenTypes.h82
1 files changed, 9 insertions, 73 deletions
diff --git a/lib/CodeGen/CodeGenTypes.h b/lib/CodeGen/CodeGenTypes.h
index b2912efb3402..9b74106d61ce 100644
--- a/lib/CodeGen/CodeGenTypes.h
+++ b/lib/CodeGen/CodeGenTypes.h
@@ -16,7 +16,6 @@
#include "llvm/Module.h"
#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/SmallSet.h"
#include <vector>
#include "CGCall.h"
@@ -52,37 +51,9 @@ namespace clang {
typedef CanQual<Type> CanQualType;
namespace CodeGen {
+ class CGRecordLayout;
class CodeGenTypes;
- /// CGRecordLayout - This class handles struct and union layout info while
- /// lowering AST types to LLVM types.
- class CGRecordLayout {
- CGRecordLayout(); // DO NOT IMPLEMENT
-
- /// LLVMType - The LLVMType corresponding to this record layout.
- const llvm::Type *LLVMType;
-
- /// ContainsPointerToDataMember - Whether one of the fields in this record
- /// layout is a pointer to data member, or a struct that contains pointer to
- /// data member.
- bool ContainsPointerToDataMember;
-
- public:
- CGRecordLayout(const llvm::Type *T, bool ContainsPointerToDataMember)
- : LLVMType(T), ContainsPointerToDataMember(ContainsPointerToDataMember) { }
-
- /// getLLVMType - Return llvm type associated with this record.
- const llvm::Type *getLLVMType() const {
- return LLVMType;
- }
-
- /// containsPointerToDataMember - Whether this struct contains pointers to
- /// data members.
- bool containsPointerToDataMember() const {
- return ContainsPointerToDataMember;
- }
- };
-
/// CodeGenTypes - This class organizes the cross-module state that is used
/// while lowering AST types to LLVM types.
class CodeGenTypes {
@@ -107,32 +78,12 @@ class CodeGenTypes {
/// CGRecordLayouts - This maps llvm struct type with corresponding
/// record layout info.
- /// FIXME : If CGRecordLayout is less than 16 bytes then use
- /// inline it in the map.
llvm::DenseMap<const Type*, CGRecordLayout *> CGRecordLayouts;
- /// FieldInfo - This maps struct field with corresponding llvm struct type
- /// field no. This info is populated by record organizer.
- llvm::DenseMap<const FieldDecl *, unsigned> FieldInfo;
-
/// FunctionInfos - Hold memoized CGFunctionInfo results.
llvm::FoldingSet<CGFunctionInfo> FunctionInfos;
-public:
- struct BitFieldInfo {
- BitFieldInfo(unsigned FieldNo,
- unsigned Start,
- unsigned Size)
- : FieldNo(FieldNo), Start(Start), Size(Size) {}
-
- unsigned FieldNo;
- unsigned Start;
- unsigned Size;
- };
-
private:
- llvm::DenseMap<const FieldDecl *, BitFieldInfo> BitFields;
-
/// TypeCache - This map keeps cache of llvm::Types (through PATypeHolder)
/// and maps llvm::Types to corresponding clang::Type. llvm::PATypeHolder is
/// used instead of llvm::Type because it allows us to bypass potential
@@ -178,11 +129,7 @@ public:
/// and/or incomplete argument types, this will return the opaque type.
const llvm::Type *GetFunctionTypeForVtable(const CXXMethodDecl *MD);
- const CGRecordLayout &getCGRecordLayout(const TagDecl*) const;
-
- /// getLLVMFieldNo - Return llvm::StructType element number
- /// that corresponds to the field FD.
- unsigned getLLVMFieldNo(const FieldDecl *FD);
+ const CGRecordLayout &getCGRecordLayout(const RecordDecl*) const;
/// UpdateCompletedType - When we find the full definition for a TagDecl,
/// replace the 'opaque' type we previously made for it if applicable.
@@ -202,7 +149,7 @@ public:
const CGFunctionInfo &getFunctionInfo(const CallArgList &Args,
const FunctionType *Ty) {
return getFunctionInfo(Ty->getResultType(), Args,
- Ty->getCallConv(), Ty->getNoReturnAttr());
+ Ty->getExtInfo());
}
const CGFunctionInfo &getFunctionInfo(CanQual<FunctionProtoType> Ty);
const CGFunctionInfo &getFunctionInfo(CanQual<FunctionNoProtoType> Ty);
@@ -216,33 +163,22 @@ public:
/// specified, the "C" calling convention will be used.
const CGFunctionInfo &getFunctionInfo(QualType ResTy,
const CallArgList &Args,
- CallingConv CC,
- bool NoReturn);
+ const FunctionType::ExtInfo &Info);
const CGFunctionInfo &getFunctionInfo(QualType ResTy,
const FunctionArgList &Args,
- CallingConv CC,
- bool NoReturn);
+ const FunctionType::ExtInfo &Info);
/// Retrieves the ABI information for the given function signature.
///
/// \param ArgTys - must all actually be canonical as params
const CGFunctionInfo &getFunctionInfo(CanQualType RetTy,
const llvm::SmallVectorImpl<CanQualType> &ArgTys,
- CallingConv CC,
- bool NoReturn);
+ const FunctionType::ExtInfo &Info);
-public: // These are internal details of CGT that shouldn't be used externally.
- /// addFieldInfo - Assign field number to field FD.
- void addFieldInfo(const FieldDecl *FD, unsigned FieldNo);
-
- /// addBitFieldInfo - Assign a start bit and a size to field FD.
- void addBitFieldInfo(const FieldDecl *FD, unsigned FieldNo,
- unsigned Start, unsigned Size);
-
- /// getBitFieldInfo - Return the BitFieldInfo that corresponds to the field
- /// FD.
- BitFieldInfo getBitFieldInfo(const FieldDecl *FD);
+ /// \brief Compute a new LLVM record layout object for the given record.
+ CGRecordLayout *ComputeRecordLayout(const RecordDecl *D);
+public: // These are internal details of CGT that shouldn't be used externally.
/// ConvertTagDeclType - Lay out a tagged decl type like struct or union or
/// enum.
const llvm::Type *ConvertTagDeclType(const TagDecl *TD);