mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 19:29:31 +00:00
Implement LLVM intrinsics llvm.setjmp' and
llvm.longjmp' as follows:
* setjmp() simply returns 0 * longjmp() simply calls abort() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7676 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2010f7baec
commit
b8db66eb17
@ -16,10 +16,8 @@
|
|||||||
#include "llvm/CodeGen/MachineFunctionInfo.h"
|
#include "llvm/CodeGen/MachineFunctionInfo.h"
|
||||||
#include "llvm/CodeGen/MachineCodeForInstruction.h"
|
#include "llvm/CodeGen/MachineCodeForInstruction.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/iTerminators.h"
|
#include "llvm/Instructions.h"
|
||||||
#include "llvm/iMemory.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/iOther.h"
|
|
||||||
#include "llvm/Function.h"
|
|
||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
#include "llvm/ConstantHandling.h"
|
#include "llvm/ConstantHandling.h"
|
||||||
#include "llvm/Intrinsics.h"
|
#include "llvm/Intrinsics.h"
|
||||||
@ -1435,6 +1433,22 @@ bool CodeGenIntrinsic(LLVMIntrinsic::ID iid, CallInst &callInstr,
|
|||||||
addReg(callInstr.getOperand(1)));
|
addReg(callInstr.getOperand(1)));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case LLVMIntrinsic::setjmp: {
|
||||||
|
// act as if we return 0
|
||||||
|
unsigned g0 = target.getRegInfo().getZeroRegNum();
|
||||||
|
mvec.push_back(BuildMI(V9::ORr,3).addMReg(g0).addMReg(g0)
|
||||||
|
.addReg(&callInstr, MOTy::Def));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
case LLVMIntrinsic::longjmp: {
|
||||||
|
// call abort()
|
||||||
|
Module* M = callInstr.getParent()->getParent()->getParent();
|
||||||
|
Function *F = M->getNamedFunction("abort");
|
||||||
|
mvec.push_back(BuildMI(V9::CALL, 1).addReg(F));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user