mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
LLVM 13 fixes for debug locations and sret/byval
This commit is contained in:
parent
3cd91832a8
commit
390f27c072
2 changed files with 20 additions and 22 deletions
|
@ -3781,9 +3781,9 @@ void BfIRCodeGen::HandleNextCmd()
|
|||
auto attr = LLVMMapAttribute(attribute);
|
||||
if (attr == llvm::Attribute::StructRet)
|
||||
{
|
||||
// FIXME: StructRet changed from EnumAttr to TypeAttr
|
||||
//llvm::Attribute sret = llvm::Attribute::getWithStructRetType(*mLLVMContext, srt);
|
||||
//((llvm::CallInst*)callInst)->addAttribute(argIdx, sret);
|
||||
auto funcType = ((llvm::CallInst*)callInst)->getFunctionType();
|
||||
llvm::Attribute sret = llvm::Attribute::getWithStructRetType(*mLLVMContext, funcType->getFunctionParamType(argIdx - 1)->getPointerElementType());
|
||||
((llvm::CallInst*)callInst)->addAttribute(argIdx, sret);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3806,13 +3806,11 @@ void BfIRCodeGen::HandleNextCmd()
|
|||
}
|
||||
else if (attribute == BfIRAttribute_ByVal)
|
||||
{
|
||||
// FIXME: Adding integer/type attribute without an argument.
|
||||
/*llvm::AttrBuilder B;
|
||||
B.addAttribute(llvm::Attribute::ByVal);
|
||||
B.addAlignmentAttr(arg);
|
||||
auto attrList = ((llvm::CallInst*)callInst)->getAttributes();
|
||||
attrList = attrList.addAttributes(*mLLVMContext, argIdx, B);
|
||||
((llvm::CallInst*)callInst)->setAttributes(attrList);*/
|
||||
auto funcType = ((llvm::CallInst*)callInst)->getFunctionType();
|
||||
llvm::Attribute byValAttr = llvm::Attribute::getWithByValType(*mLLVMContext, funcType->getFunctionParamType(argIdx - 1)->getPointerElementType());
|
||||
llvm::Attribute alignAttr = llvm::Attribute::getWithAlignment(*mLLVMContext, llvm::Align(arg));
|
||||
((llvm::CallInst*)callInst)->addAttribute(argIdx, byValAttr);
|
||||
((llvm::CallInst*)callInst)->addAttribute(argIdx, alignAttr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3869,9 +3867,9 @@ void BfIRCodeGen::HandleNextCmd()
|
|||
auto attr = LLVMMapAttribute(attribute);
|
||||
if (attr == llvm::Attribute::StructRet)
|
||||
{
|
||||
// FIXME: StructRet changed from EnumAttr to TypeAttr
|
||||
//llvm::Attribute sret = llvm::Attribute::getWithStructRetType(*mLLVMContext, srt);
|
||||
//func->addAttribute(argIdx, sret);
|
||||
auto funcType = func->getFunctionType();
|
||||
llvm::Attribute sret = llvm::Attribute::getWithStructRetType(*mLLVMContext, funcType->getFunctionParamType(argIdx - 1)->getPointerElementType());
|
||||
func->addAttribute(argIdx, sret);
|
||||
}
|
||||
else if (attr != llvm::Attribute::None)
|
||||
func->addAttribute(argIdx, attr);
|
||||
|
@ -3890,13 +3888,11 @@ void BfIRCodeGen::HandleNextCmd()
|
|||
}
|
||||
else if (attribute == BfIRAttribute_ByVal)
|
||||
{
|
||||
// FIXME: Adding integer/type attribute without an argument.
|
||||
/*llvm::AttrBuilder B;
|
||||
B.addAttribute(llvm::Attribute::ByVal);
|
||||
B.addAlignmentAttr(arg);
|
||||
auto attrList = ((llvm::Function*)func)->getAttributes();
|
||||
attrList = attrList.addAttributes(*mLLVMContext, argIdx, B);
|
||||
((llvm::Function*)func)->setAttributes(attrList);*/
|
||||
auto funcType = func->getFunctionType();
|
||||
llvm::Attribute byValAttr = llvm::Attribute::getWithByValType(*mLLVMContext, funcType->getFunctionParamType(argIdx - 1)->getPointerElementType());
|
||||
llvm::Attribute alignAttr = llvm::Attribute::getWithAlignment(*mLLVMContext, llvm::Align(arg));
|
||||
func->addAttribute(argIdx, byValAttr);
|
||||
func->addAttribute(argIdx, alignAttr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -148,7 +148,8 @@ bool BfModule::AddDeferredCallEntry(BfDeferredCallEntry* deferredCallEntry, BfSc
|
|||
mBfIRBuilder->SetInsertPointAtStart(mCurMethodState->mIRInitBlock);
|
||||
|
||||
auto scopeHead = &mCurMethodState->mHeadScope;
|
||||
mBfIRBuilder->SetCurrentDebugLocation(mCurFilePosition.mCurLine + 1, 0, scopeHead->mDIScope, BfIRMDNode());
|
||||
if (scopeHead->mDIScope)
|
||||
mBfIRBuilder->SetCurrentDebugLocation(mCurFilePosition.mCurLine + 1, 0, scopeHead->mDIScope, BfIRMDNode());
|
||||
|
||||
if (WantsLifetimes())
|
||||
mBfIRBuilder->CreateLifetimeStart(listEntry->mDynCallTail);
|
||||
|
@ -164,7 +165,8 @@ bool BfModule::AddDeferredCallEntry(BfDeferredCallEntry* deferredCallEntry, BfSc
|
|||
|
||||
mBfIRBuilder->SetInsertPoint(mCurMethodState->mIRInitBlock);
|
||||
|
||||
mBfIRBuilder->SetCurrentDebugLocation(mCurFilePosition.mCurLine + 1, 0, scopeHead->mDIScope, BfIRMDNode());
|
||||
if (scopeHead->mDIScope)
|
||||
mBfIRBuilder->SetCurrentDebugLocation(mCurFilePosition.mCurLine + 1, 0, scopeHead->mDIScope, BfIRMDNode());
|
||||
mBfIRBuilder->CreateStatementStart();
|
||||
|
||||
//TODO: Make this work for LLVM - we need a proper debug location
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue