Lines Matching full:llvm
1 //===--- CGDebugInfo.h - DebugInfo for LLVM CodeGen -------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
10 // This is the source-level debug info generator for llvm translation.
22 #include "llvm/ADT/DenseMap.h"
23 #include "llvm/IR/DIBuilder.h"
24 #include "llvm/IR/DebugInfo.h"
25 #include "llvm/IR/ValueHandle.h"
26 #include "llvm/Support/Allocator.h"
28 namespace llvm {
47 /// and is responsible for emitting to llvm globals or pass directly to
54 llvm::DIBuilder DBuilder;
55 llvm::DICompileUnit TheCU;
57 llvm::DIType VTablePtrType;
58 llvm::DIType ClassTy;
59 llvm::DICompositeType ObjTy;
60 llvm::DIType SelTy;
61 llvm::DIType OCLImage1dDITy, OCLImage1dArrayDITy, OCLImage1dBufferDITy;
62 llvm::DIType OCLImage2dDITy, OCLImage2dArrayDITy;
63 llvm::DIType OCLImage3dDITy;
64 llvm::DIType OCLEventDITy;
65 llvm::DIType BlockLiteralGeneric;
68 llvm::DenseMap<const void *, llvm::WeakVH> TypeCache;
72 llvm::DIType Decl;
73 llvm::DIFile Unit;
74 ObjCInterfaceCacheEntry(const ObjCInterfaceType *Type, llvm::DIType Decl,
75 llvm::DIFile Unit)
81 llvm::SmallVector<ObjCInterfaceCacheEntry, 32> ObjCInterfaceCache;
88 std::vector<std::pair<const TagType *, llvm::WeakVH>> ReplaceMap;
91 std::vector<llvm::TrackingVH<llvm::MDNode> > LexicalBlockStack;
92 llvm::DenseMap<const Decl *, llvm::WeakVH> RegionMap;
100 llvm::BumpPtrAllocator DebugInfoNames;
103 llvm::DenseMap<const char *, llvm::WeakVH> DIFileCache;
104 llvm::DenseMap<const FunctionDecl *, llvm::WeakVH> SPCache;
107 llvm::DenseMap<const Decl *, llvm::WeakVH> DeclCache;
108 llvm::DenseMap<const NamespaceDecl *, llvm::WeakVH> NameSpaceCache;
109 llvm::DenseMap<const NamespaceAliasDecl *, llvm::WeakVH> NamespaceAliasCache;
110 llvm::DenseMap<const Decl *, llvm::WeakVH> StaticDataMemberCache;
114 llvm::DIType CreateType(const BuiltinType *Ty);
115 llvm::DIType CreateType(const ComplexType *Ty);
116 llvm::DIType CreateQualifiedType(QualType Ty, llvm::DIFile Fg);
117 llvm::DIType CreateType(const TypedefType *Ty, llvm::DIFile Fg);
118 llvm::DIType CreateType(const TemplateSpecializationType *Ty, llvm::DIFile Fg);
119 llvm::DIType CreateType(const ObjCObjectPointerType *Ty,
120 llvm::DIFile F);
121 llvm::DIType CreateType(const PointerType *Ty, llvm::DIFile F);
122 llvm::DIType CreateType(const BlockPointerType *Ty, llvm::DIFile F);
123 llvm::DIType CreateType(const FunctionType *Ty, llvm::DIFile F);
124 llvm::DIType CreateType(const RecordType *Tyg);
125 llvm::DIType CreateTypeDefinition(const RecordType *Ty);
126 llvm::DICompositeType CreateLimitedType(const RecordType *Ty);
127 void CollectContainingType(const CXXRecordDecl *RD, llvm::DICompositeType CT);
128 llvm::DIType CreateType(const ObjCInterfaceType *Ty, llvm::DIFile F);
129 llvm::DIType CreateTypeDefinition(const ObjCInterfaceType *Ty, llvm::DIFile F);
130 llvm::DIType CreateType(const ObjCObjectType *Ty, llvm::DIFile F);
131 llvm::DIType CreateType(const VectorType *Ty, llvm::DIFile F);
132 llvm::DIType CreateType(const ArrayType *Ty, llvm::DIFile F);
133 llvm::DIType CreateType(const LValueReferenceType *Ty, llvm::DIFile F);
134 llvm::DIType CreateType(const RValueReferenceType *Ty, llvm::DIFile Unit);
135 llvm::DIType CreateType(const MemberPointerType *Ty, llvm::DIFile F);
136 llvm::DIType CreateType(const AtomicType *Ty, llvm::DIFile F);
137 llvm::DIType CreateEnumType(const EnumType *Ty);
138 llvm::DIType CreateTypeDefinition(const EnumType *Ty);
139 llvm::DIType CreateSelfType(const QualType &QualTy, llvm::DIType Ty);
140 llvm::DIType getTypeOrNull(const QualType);
141 llvm::DICompositeType getOrCreateMethodType(const CXXMethodDecl *Method,
142 llvm::DIFile F);
143 llvm::DICompositeType getOrCreateInstanceMethodType(
144 QualType ThisPtr, const FunctionProtoType *Func, llvm::DIFile Unit);
145 llvm::DICompositeType getOrCreateFunctionType(const Decl *D, QualType FnType,
146 llvm::DIFile F);
147 llvm::DIType getOrCreateVTablePtrType(llvm::DIFile F);
148 llvm::DINameSpace getOrCreateNameSpace(const NamespaceDecl *N);
149 llvm::DIType getOrCreateTypeDeclaration(QualType PointeeTy, llvm::DIFile F);
150 llvm::DIType CreatePointerLikeType(llvm::dwarf::Tag Tag,
152 llvm::DIFile F);
154 llvm::Value *getCachedInterfaceTypeOrNull(const QualType Ty);
155 llvm::DIType getOrCreateStructPtrType(StringRef Name, llvm::DIType &Cache);
157 llvm::DISubprogram CreateCXXMemberFunction(const CXXMethodDecl *Method,
158 llvm::DIFile F,
159 llvm::DIType RecordTy);
162 llvm::DIFile F,
163 SmallVectorImpl<llvm::Value *> &E,
164 llvm::DIType T);
167 llvm::DIFile F,
168 SmallVectorImpl<llvm::Value *> &EltTys,
169 llvm::DIType RecordTy);
171 llvm::DIArray
174 llvm::DIFile Unit);
175 llvm::DIArray
176 CollectFunctionTemplateParams(const FunctionDecl *FD, llvm::DIFile Unit);
177 llvm::DIArray
179 llvm::DIFile F);
181 llvm::DIType createFieldType(StringRef name, QualType type,
184 llvm::DIFile tunit,
185 llvm::DIScope scope);
189 SmallVectorImpl<llvm::Value *> &E,
190 llvm::DIType RecordTy);
191 llvm::DIDerivedType CreateRecordStaticField(const VarDecl *Var,
192 llvm::DIType RecordTy);
194 llvm::DIFile F,
195 SmallVectorImpl<llvm::Value *> &E,
196 llvm::DIType RecordTy);
197 void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile F,
198 SmallVectorImpl<llvm::Value *> &E,
199 llvm::DICompositeType RecordTy);
202 llvm::DIFile F,
203 SmallVectorImpl<llvm::Value *> &EltTys);
228 /// EmitFunctionStart - Emit a call to llvm.dbg.function.start to indicate
234 QualType FnType, llvm::Function *Fn,
248 /// EmitDeclareOfAutoVariable - Emit call to llvm.dbg.declare for an automatic
250 void EmitDeclareOfAutoVariable(const VarDecl *Decl, llvm::Value *AI,
253 /// EmitDeclareOfBlockDeclRefVariable - Emit call to llvm.dbg.declare for an
256 llvm::Value *storage,
260 /// EmitDeclareOfArgVariable - Emit call to llvm.dbg.declare for an argument
262 void EmitDeclareOfArgVariable(const VarDecl *Decl, llvm::Value *AI,
266 /// llvm.dbg.declare for the block-literal argument to a block
269 llvm::Value *Arg,
270 llvm::Value *LocalAddr,
274 void EmitGlobalVariable(llvm::GlobalVariable *GV, const VarDecl *Decl);
277 void EmitGlobalVariable(const ValueDecl *VD, llvm::Constant *Init);
286 llvm::DIImportedEntity EmitNamespaceAlias(const NamespaceAliasDecl &NA);
289 llvm::DIType getOrCreateRecordType(QualType Ty, SourceLocation L);
293 llvm::DIType getOrCreateInterfaceType(QualType Ty,
304 /// EmitDeclare - Emit call to llvm.dbg.declare for a variable declaration.
306 /// otherwise would be of type llvm::dwarf::Tag.
307 void EmitDeclare(const VarDecl *decl, llvm::dwarf::LLVMConstants Tag,
308 llvm::Value *AI, unsigned ArgNo, CGBuilderTy &Builder);
312 llvm::DIType EmitTypeForVarWithBlocksAttr(const VarDecl *VD,
316 llvm::DIScope getContextDescriptor(const Decl *Decl);
318 llvm::DIScope getCurrentContextDescriptor(const Decl *Decl);
321 llvm::DICompositeType getOrCreateRecordFwdDecl(const RecordType *,
322 llvm::DIDescriptor);
325 llvm::DIDescriptor createContextChain(const Decl *Decl);
335 llvm::DIFile getOrCreateFile(SourceLocation Loc);
338 llvm::DIFile getOrCreateMainFile();
342 llvm::DIType getOrCreateType(QualType Ty, llvm::DIFile Fg);
346 llvm::DIType getOrCreateLimitedType(const RecordType *Ty, llvm::DIFile F);
349 llvm::DIType CreateTypeNode(QualType Ty, llvm::DIFile Fg);
356 llvm::DIType CreateMemberType(llvm::DIFile Unit, QualType FType,
361 llvm::DIScope getDeclarationOrDefinition(const Decl *D);
365 llvm::DISubprogram getFunctionDeclaration(const Decl *D);
369 llvm::DIDerivedType
374 llvm::DIGlobalVariable
375 CollectAnonRecordDecls(const RecordDecl *RD, llvm::DIFile Unit, unsigned LineNo,
376 StringRef LinkageName, llvm::GlobalVariable *Var,
377 llvm::DIDescriptor DContext);