mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 16:33:28 +00:00
Turn memset/memcpy/memmove into the corresponding operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19463 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ef36aa75d7
commit
7041ee35ad
@ -311,9 +311,7 @@ public:
|
|||||||
void visitVACopy(CallInst &I);
|
void visitVACopy(CallInst &I);
|
||||||
void visitFrameReturnAddress(CallInst &I, bool isFrameAddress);
|
void visitFrameReturnAddress(CallInst &I, bool isFrameAddress);
|
||||||
|
|
||||||
void visitMemSet(CallInst &I);
|
void visitMemIntrinsic(CallInst &I, unsigned Op);
|
||||||
void visitMemCpy(CallInst &I);
|
|
||||||
void visitMemMove(CallInst &I);
|
|
||||||
|
|
||||||
void visitUserOp1(Instruction &I) {
|
void visitUserOp1(Instruction &I) {
|
||||||
assert(0 && "UserOp1 should not exist at instruction selection time!");
|
assert(0 && "UserOp1 should not exist at instruction selection time!");
|
||||||
@ -583,9 +581,9 @@ void SelectionDAGLowering::visitCall(CallInst &I) {
|
|||||||
return;
|
return;
|
||||||
case Intrinsic::setjmp: RenameFn = "setjmp"; break;
|
case Intrinsic::setjmp: RenameFn = "setjmp"; break;
|
||||||
case Intrinsic::longjmp: RenameFn = "longjmp"; break;
|
case Intrinsic::longjmp: RenameFn = "longjmp"; break;
|
||||||
case Intrinsic::memcpy: visitMemCpy(I); return;
|
case Intrinsic::memcpy: visitMemIntrinsic(I, ISD::MEMCPY); return;
|
||||||
case Intrinsic::memset: visitMemSet(I); return;
|
case Intrinsic::memset: visitMemIntrinsic(I, ISD::MEMSET); return;
|
||||||
case Intrinsic::memmove: visitMemMove(I); return;
|
case Intrinsic::memmove: visitMemIntrinsic(I, ISD::MEMMOVE); return;
|
||||||
|
|
||||||
case Intrinsic::isunordered:
|
case Intrinsic::isunordered:
|
||||||
setValue(&I, DAG.getSetCC(ISD::SETUO, getValue(I.getOperand(1)),
|
setValue(&I, DAG.getSetCC(ISD::SETUO, getValue(I.getOperand(1)),
|
||||||
@ -727,54 +725,19 @@ void SelectionDAGLowering::visitFrameReturnAddress(CallInst &I, bool isFrame) {
|
|||||||
DAG.setRoot(Result.second);
|
DAG.setRoot(Result.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectionDAGLowering::visitMemSet(CallInst &I) {
|
void SelectionDAGLowering::visitMemIntrinsic(CallInst &I, unsigned Op) {
|
||||||
MVT::ValueType IntPtr = TLI.getPointerTy();
|
std::vector<SDOperand> Ops;
|
||||||
const Type *IntPtrTy = TLI.getTargetData().getIntPtrType();
|
Ops.push_back(DAG.getRoot());
|
||||||
|
Ops.push_back(getValue(I.getOperand(1)));
|
||||||
// Extend the ubyte argument to be an int value for the call.
|
Ops.push_back(getValue(I.getOperand(2)));
|
||||||
SDOperand Val = getValue(I.getOperand(2));
|
Ops.push_back(getValue(I.getOperand(3)));
|
||||||
Val = DAG.getNode(ISD::ZERO_EXTEND, MVT::i32, Val);
|
Ops.push_back(getValue(I.getOperand(4)));
|
||||||
|
DAG.setRoot(DAG.getNode(Op, MVT::Other, Ops));
|
||||||
std::vector<std::pair<SDOperand, const Type*> > Args;
|
|
||||||
Args.push_back(std::make_pair(getValue(I.getOperand(1)), IntPtrTy));
|
|
||||||
Args.push_back(std::make_pair(Val, Type::IntTy));
|
|
||||||
Args.push_back(std::make_pair(getValue(I.getOperand(3)), IntPtrTy));
|
|
||||||
|
|
||||||
std::pair<SDOperand,SDOperand> Result =
|
|
||||||
TLI.LowerCallTo(DAG.getRoot(), Type::VoidTy,
|
|
||||||
DAG.getExternalSymbol("memset", IntPtr), Args, DAG);
|
|
||||||
DAG.setRoot(Result.second);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectionDAGLowering::visitMemCpy(CallInst &I) {
|
//===----------------------------------------------------------------------===//
|
||||||
MVT::ValueType IntPtr = TLI.getPointerTy();
|
// SelectionDAGISel code
|
||||||
const Type *IntPtrTy = TLI.getTargetData().getIntPtrType();
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
std::vector<std::pair<SDOperand, const Type*> > Args;
|
|
||||||
Args.push_back(std::make_pair(getValue(I.getOperand(1)), IntPtrTy));
|
|
||||||
Args.push_back(std::make_pair(getValue(I.getOperand(2)), IntPtrTy));
|
|
||||||
Args.push_back(std::make_pair(getValue(I.getOperand(3)), IntPtrTy));
|
|
||||||
|
|
||||||
std::pair<SDOperand,SDOperand> Result =
|
|
||||||
TLI.LowerCallTo(DAG.getRoot(), Type::VoidTy,
|
|
||||||
DAG.getExternalSymbol("memcpy", IntPtr), Args, DAG);
|
|
||||||
DAG.setRoot(Result.second);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SelectionDAGLowering::visitMemMove(CallInst &I) {
|
|
||||||
MVT::ValueType IntPtr = TLI.getPointerTy();
|
|
||||||
const Type *IntPtrTy = TLI.getTargetData().getIntPtrType();
|
|
||||||
|
|
||||||
std::vector<std::pair<SDOperand, const Type*> > Args;
|
|
||||||
Args.push_back(std::make_pair(getValue(I.getOperand(1)), IntPtrTy));
|
|
||||||
Args.push_back(std::make_pair(getValue(I.getOperand(2)), IntPtrTy));
|
|
||||||
Args.push_back(std::make_pair(getValue(I.getOperand(3)), IntPtrTy));
|
|
||||||
|
|
||||||
std::pair<SDOperand,SDOperand> Result =
|
|
||||||
TLI.LowerCallTo(DAG.getRoot(), Type::VoidTy,
|
|
||||||
DAG.getExternalSymbol("memmove", IntPtr), Args, DAG);
|
|
||||||
DAG.setRoot(Result.second);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned SelectionDAGISel::MakeReg(MVT::ValueType VT) {
|
unsigned SelectionDAGISel::MakeReg(MVT::ValueType VT) {
|
||||||
return RegMap->createVirtualRegister(TLI.getRegClassFor(VT));
|
return RegMap->createVirtualRegister(TLI.getRegClassFor(VT));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user