Lines Matching refs:llvm

24 #include "llvm/IR/DataLayout.h"
25 #include "llvm/IR/DerivedTypes.h"
26 #include "llvm/IR/Type.h"
27 #include "llvm/Support/Debug.h"
28 #include "llvm/Support/MathExtras.h"
29 #include "llvm/Support/raw_ostream.h"
35 /// llvm::Type. Some of the lowering is straightforward, some is not. Here we
38 /// llvm::Type with correct size. We choose a field via a specific heuristic
45 /// when lowered to llvm types. For example unsigned x : 24 gets lowered to
67 /// should because locations of things such as VBases are bogus in the llvm
81 llvm::Type *Data;
86 MemberInfo(CharUnits Offset, InfoKind Kind, llvm::Type *Data,
89 MemberInfo(CharUnits Offset, InfoKind Kind, llvm::Type *Data,
98 /// \brief Constructs a MemberInfo instance from an offset and llvm::Type *.
99 MemberInfo StorageInfo(CharUnits Offset, llvm::Type *Data) {
106 /// \brief Wraps llvm::Type::getIntNTy with some implicit arguments.
107 llvm::Type *getIntNType(uint64_t NumBits) {
108 return llvm::Type::getIntNTy(Types.getLLVMContext(),
109 (unsigned)llvm::RoundUpToAlignment(NumBits, 8));
111 /// \brief Gets an llvm type of size NumBytes and alignment 1.
112 llvm::Type *getByteArrayType(CharUnits NumBytes) {
114 llvm::Type *Type = llvm::Type::getInt8Ty(Types.getLLVMContext());
116 (llvm::Type *)llvm::ArrayType::get(Type, NumBytes.getQuantity());
120 llvm::Type *getStorageType(const FieldDecl *FD) {
121 llvm::Type *Type = Types.ConvertTypeForMem(FD->getType());
126 /// \brief Gets the llvm Basesubobject type from a CXXRecordDecl.
127 llvm::Type *getStorageType(const CXXRecordDecl *RD) {
133 CharUnits getSize(llvm::Type *Type) {
136 CharUnits getAlignment(llvm::Type *Type) {
159 llvm::Type *StorageType);
160 /// \brief Lowers an ASTRecordLayout to a llvm type.
176 /// \brief Determines if we need a packed llvm struct.
188 const llvm::DataLayout &DataLayout;
192 SmallVector<llvm::Type *, 16> FieldTypes;
193 llvm::DenseMap<const FieldDecl *, unsigned> Fields;
194 llvm::DenseMap<const FieldDecl *, CGBitFieldInfo> BitFields;
195 llvm::DenseMap<const CXXRecordDecl *, unsigned> NonVirtualBases;
196 llvm::DenseMap<const CXXRecordDecl *, unsigned> VirtualBases;
214 const FieldDecl *FD, CharUnits StartOffset, llvm::Type *StorageType) {
243 // 4) Determine if the llvm-struct requires packing. It's important that this
244 // phase occur after clipping, because clipping changes the llvm type.
281 llvm::Type *StorageType = nullptr;
295 llvm::Type *FieldType = getStorageType(Field);
301 llvm::Type *FieldType = getStorageType(Field);
361 llvm::Type *Type = Types.ConvertTypeForMem(Field->getType());
403 llvm::Type *Type = getIntNType(Tail - StartBitOffset);
436 llvm::FunctionType::get(getIntNType(32), /*isVarArg=*/true)->
440 llvm::Type::getInt32PtrTy(Types.getLLVMContext())));
527 Prior->Data = getByteArrayType(bitsToCharUnits(llvm::RoundUpToAlignment(
528 cast<llvm::IntegerType>(Prior->Data)->getIntegerBitWidth(), 8)));
611 llvm::Type *Ty = Types.ConvertTypeForMem(FD->getType());
643 llvm::StructType *Ty) {
649 llvm::StructType *BaseTy = nullptr;
655 BaseTy = llvm::StructType::create(
681 llvm::outs() << "\n*** Dumping IRgen Record Layout\n";
682 llvm::outs() << "Record: ";
683 D->dump(llvm::outs());
684 llvm::outs() << "\nLayout: ";
685 RL->print(llvm::outs());
708 llvm::StructType *ST =
709 dyn_cast<llvm::StructType>(RL->getLLVMType());
710 const llvm::StructLayout *SL = getDataLayout().getStructLayout(ST);
735 llvm::Type *ElementTy = ST->getTypeAtIndex(RL->getLLVMFieldNo(FD));
778 for (llvm::DenseMap<const FieldDecl*, CGBitFieldInfo>::const_iterator
788 llvm::array_pod_sort(BFIs.begin(), BFIs.end());
799 print(llvm::errs());
812 print(llvm::errs());