================
@@ -710,112 +640,95 @@ static void buildFrameDebugInfo(Function &F, coro::Shape
&Shape,
unsigned LineNum = DIS->getLine();
DICompositeType *FrameDITy = DBuilder.createStructType(
- DIS->getUnit(), Twine(F.getName() + ".coro_frame_ty").str(),
- DFile, LineNum, Shape.FrameSize * 8,
- Shape.FrameAlign.value() * 8, llvm::DINode::FlagArtificial, nullptr,
- llvm::DINodeArray());
- StructType *FrameTy = Shape.FrameTy;
+ DIS->getUnit(), Twine(F.getName() + ".coro_frame_ty").str(), DFile,
+ LineNum, Shape.FrameSize * 8, Shape.FrameAlign.value() * 8,
+ llvm::DINode::FlagArtificial, nullptr, llvm::DINodeArray());
SmallVector<Metadata *, 16> Elements;
DataLayout Layout = F.getDataLayout();
DenseMap<Value *, DILocalVariable *> DIVarCache;
cacheDIVar(FrameData, DIVarCache);
- unsigned ResumeIndex = coro::Shape::SwitchFieldIndex::Resume;
- unsigned DestroyIndex = coro::Shape::SwitchFieldIndex::Destroy;
- unsigned IndexIndex = Shape.SwitchLowering.IndexField;
-
- DenseMap<unsigned, StringRef> NameCache;
- NameCache.insert({ResumeIndex, "__resume_fn"});
- NameCache.insert({DestroyIndex, "__destroy_fn"});
- NameCache.insert({IndexIndex, "__coro_index"});
-
- Type *ResumeFnTy = FrameTy->getElementType(ResumeIndex),
- *DestroyFnTy = FrameTy->getElementType(DestroyIndex),
- *IndexTy = FrameTy->getElementType(IndexIndex);
-
- DenseMap<unsigned, DIType *> TyCache;
- TyCache.insert(
- {ResumeIndex, DBuilder.createPointerType(
- nullptr, Layout.getTypeSizeInBits(ResumeFnTy))});
- TyCache.insert(
- {DestroyIndex, DBuilder.createPointerType(
- nullptr, Layout.getTypeSizeInBits(DestroyFnTy))});
-
- /// FIXME: If we fill the field `SizeInBits` with the actual size of
- /// __coro_index in bits, then __coro_index wouldn't show in the debugger.
- TyCache.insert({IndexIndex, DBuilder.createBasicType(
- "__coro_index",
- (Layout.getTypeSizeInBits(IndexTy) < 8)
- ? 8
- : Layout.getTypeSizeInBits(IndexTy),
- dwarf::DW_ATE_unsigned_char)});
-
- for (auto *V : FrameData.getAllDefs()) {
- auto It = DIVarCache.find(V);
- if (It == DIVarCache.end())
- continue;
-
- auto Index = FrameData.getFieldIndex(V);
-
- NameCache.insert({Index, It->second->getName()});
- TyCache.insert({Index, It->second->getType()});
- }
-
- // Cache from index to (Align, Offset Pair)
- DenseMap<unsigned, std::pair<unsigned, unsigned>> OffsetCache;
- // The Align and Offset of Resume function and Destroy function are fixed.
- OffsetCache.insert({ResumeIndex, {8, 0}});
- OffsetCache.insert({DestroyIndex, {8, 8}});
----------------
vtjnash wrote:
@ChuanqiXu9 here's where the debug information was set wrong previously
(obviously function pointers aren't always 8 bytes, so the comment about them
being fixed size wasn't correct)
https://github.com/llvm/llvm-project/pull/178359
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits