mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-06 01:39:11 +00:00
Itanium ABI exception handing support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34480 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bacd304463
commit
c518ccfeb5
@ -58,6 +58,9 @@ STATISTIC(NumSpilled, "Number of registers live across unwind edges");
|
|||||||
static cl::opt<bool> ExpensiveEHSupport("enable-correct-eh-support",
|
static cl::opt<bool> ExpensiveEHSupport("enable-correct-eh-support",
|
||||||
cl::desc("Make the -lowerinvoke pass insert expensive, but correct, EH code"));
|
cl::desc("Make the -lowerinvoke pass insert expensive, but correct, EH code"));
|
||||||
|
|
||||||
|
static cl::opt<bool> ItaniumEHSupport("enable-real-eh-support",
|
||||||
|
cl::desc("Make the -lowerinvoke pass insert itanium ABI EH code"));
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class VISIBILITY_HIDDEN LowerInvoke : public FunctionPass {
|
class VISIBILITY_HIDDEN LowerInvoke : public FunctionPass {
|
||||||
// Used for both models.
|
// Used for both models.
|
||||||
@ -94,6 +97,7 @@ namespace {
|
|||||||
void splitLiveRangesLiveAcrossInvokes(std::vector<InvokeInst*> &Invokes);
|
void splitLiveRangesLiveAcrossInvokes(std::vector<InvokeInst*> &Invokes);
|
||||||
void rewriteExpensiveInvoke(InvokeInst *II, unsigned InvokeNo,
|
void rewriteExpensiveInvoke(InvokeInst *II, unsigned InvokeNo,
|
||||||
AllocaInst *InvokeNum, SwitchInst *CatchSwitch);
|
AllocaInst *InvokeNum, SwitchInst *CatchSwitch);
|
||||||
|
bool insertItaniumEHSupport(Function &F);
|
||||||
bool insertExpensiveEHSupport(Function &F);
|
bool insertExpensiveEHSupport(Function &F);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -111,6 +115,9 @@ FunctionPass *llvm::createLowerInvokePass(const TargetLowering *TLI) {
|
|||||||
// doInitialization - Make sure that there is a prototype for abort in the
|
// doInitialization - Make sure that there is a prototype for abort in the
|
||||||
// current module.
|
// current module.
|
||||||
bool LowerInvoke::doInitialization(Module &M) {
|
bool LowerInvoke::doInitialization(Module &M) {
|
||||||
|
if (ItaniumEHSupport) {
|
||||||
|
// Let Invoke pass through for ItaniumEHSupport support.
|
||||||
|
} else {
|
||||||
const Type *VoidPtrTy = PointerType::get(Type::Int8Ty);
|
const Type *VoidPtrTy = PointerType::get(Type::Int8Ty);
|
||||||
AbortMessage = 0;
|
AbortMessage = 0;
|
||||||
if (ExpensiveEHSupport) {
|
if (ExpensiveEHSupport) {
|
||||||
@ -151,6 +158,7 @@ bool LowerInvoke::doInitialization(Module &M) {
|
|||||||
AbortFn = M.getOrInsertFunction("abort", Type::VoidTy, (Type *)0);
|
AbortFn = M.getOrInsertFunction("abort", Type::VoidTy, (Type *)0);
|
||||||
WriteFn = M.getOrInsertFunction("write", Type::VoidTy, Type::Int32Ty,
|
WriteFn = M.getOrInsertFunction("write", Type::VoidTy, Type::Int32Ty,
|
||||||
VoidPtrTy, Type::Int32Ty, (Type *)0);
|
VoidPtrTy, Type::Int32Ty, (Type *)0);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,6 +396,10 @@ splitLiveRangesLiveAcrossInvokes(std::vector<InvokeInst*> &Invokes) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LowerInvoke::insertItaniumEHSupport(Function &F) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
|
bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
|
||||||
std::vector<ReturnInst*> Returns;
|
std::vector<ReturnInst*> Returns;
|
||||||
std::vector<UnwindInst*> Unwinds;
|
std::vector<UnwindInst*> Unwinds;
|
||||||
@ -569,6 +581,8 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool LowerInvoke::runOnFunction(Function &F) {
|
bool LowerInvoke::runOnFunction(Function &F) {
|
||||||
|
if (ItaniumEHSupport)
|
||||||
|
return insertItaniumEHSupport(F);
|
||||||
if (ExpensiveEHSupport)
|
if (ExpensiveEHSupport)
|
||||||
return insertExpensiveEHSupport(F);
|
return insertExpensiveEHSupport(F);
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user