Day: February 23, 2024

Adding debug support to tinylang – Advanced IR Generation-2Adding debug support to tinylang – Advanced IR Generation-2

llvm::DIType *CGDebugInfo::getAliasType(AliasTypeDeclaration *Ty) {return DBuilder.createTypedef(getType(Ty->getType()), Ty->getName(),CU->getFile(), getLineNumber(Ty->getLocation()),getScope());} llvm::DIType *CGDebugInfo::getArrayType(ArrayTypeDeclaration *Ty) {auto *ATy =llvm::cast(CGM.convertType(Ty));const llvm::DataLayout &DL =CGM.getModule()->getDataLayout();Expr *Nums = Ty->getNums();uint64_t NumElements =llvm::cast(Nums)->getValue().getZExtValue();llvm::SmallVector Subscripts;Subscripts.push_back(DBuilder.getOrCreateSubrange(0, NumElements));return DBuilder.createArrayType(DL.getTypeSizeInBits(ATy) * 8,1 << Log2(DL.getABITypeAlign(ATy)), getType(Ty->getType()),DBuilder.getOrCreateArray(Subscripts));} llvm::DIType [...]