mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-31 10:34:17 +00:00
[WinEH] Cache declarations of frame intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239361 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
dea5078cde
commit
38a2b24c12
@ -83,6 +83,9 @@ private:
|
||||
StructType *EHLinkRegistrationTy = nullptr;
|
||||
StructType *CXXEHRegistrationTy = nullptr;
|
||||
StructType *SEHRegistrationTy = nullptr;
|
||||
Function *FrameRecover = nullptr;
|
||||
Function *FrameAddress = nullptr;
|
||||
Function *FrameEscape = nullptr;
|
||||
|
||||
// Per-function state
|
||||
EHPersonality Personality = EHPersonality::Unknown;
|
||||
@ -109,6 +112,9 @@ char WinEHStatePass::ID = 0;
|
||||
|
||||
bool WinEHStatePass::doInitialization(Module &M) {
|
||||
TheModule = &M;
|
||||
FrameEscape = Intrinsic::getDeclaration(TheModule, Intrinsic::frameescape);
|
||||
FrameRecover = Intrinsic::getDeclaration(TheModule, Intrinsic::framerecover);
|
||||
FrameAddress = Intrinsic::getDeclaration(TheModule, Intrinsic::frameaddress);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -118,6 +124,9 @@ bool WinEHStatePass::doFinalization(Module &M) {
|
||||
EHLinkRegistrationTy = nullptr;
|
||||
CXXEHRegistrationTy = nullptr;
|
||||
SEHRegistrationTy = nullptr;
|
||||
FrameEscape = nullptr;
|
||||
FrameRecover = nullptr;
|
||||
FrameAddress = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -392,10 +401,6 @@ void WinEHStatePass::addCXXStateStores(Function &F, MachineModuleInfo &MMI) {
|
||||
int RegNodeEscapeIndex = escapeRegNode(F);
|
||||
|
||||
// Only insert stores in catch handlers.
|
||||
Function *FrameRecover =
|
||||
Intrinsic::getDeclaration(TheModule, Intrinsic::framerecover);
|
||||
Function *FrameAddress =
|
||||
Intrinsic::getDeclaration(TheModule, Intrinsic::frameaddress);
|
||||
Constant *FI8 =
|
||||
ConstantExpr::getBitCast(&F, Type::getInt8PtrTy(TheModule->getContext()));
|
||||
for (auto P : FuncInfo.HandlerBaseState) {
|
||||
@ -437,8 +442,7 @@ int WinEHStatePass::escapeRegNode(Function &F) {
|
||||
// of the entry block.
|
||||
IRBuilder<> Builder(&F.getEntryBlock(),
|
||||
EscapeCall ? EscapeCall : F.getEntryBlock().end());
|
||||
Builder.CreateCall(
|
||||
Intrinsic::getDeclaration(TheModule, Intrinsic::frameescape), Args);
|
||||
Builder.CreateCall(FrameEscape, Args);
|
||||
if (EscapeCall)
|
||||
EscapeCall->eraseFromParent();
|
||||
return Args.size() - 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user