mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-21 19:32:16 +00:00
BuildLibCalls: Nuke EmitMemCpy, EmitMemMove and EmitMemSet. They are dead and superseded by IRBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122576 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a1bf4ca773
commit
def548f9a0
@ -48,22 +48,12 @@ namespace llvm {
|
|||||||
Value *EmitStrNCpy(Value *Dst, Value *Src, Value *Len, IRBuilder<> &B,
|
Value *EmitStrNCpy(Value *Dst, Value *Src, Value *Len, IRBuilder<> &B,
|
||||||
const TargetData *TD, StringRef Name = "strncpy");
|
const TargetData *TD, StringRef Name = "strncpy");
|
||||||
|
|
||||||
/// EmitMemCpy - Emit a call to the memcpy function to the builder. This
|
|
||||||
/// always expects that the size has type 'intptr_t' and Dst/Src are pointers.
|
|
||||||
Value *EmitMemCpy(Value *Dst, Value *Src, Value *Len, unsigned Align,
|
|
||||||
bool isVolatile, IRBuilder<> &B, const TargetData *TD);
|
|
||||||
|
|
||||||
/// EmitMemCpyChk - Emit a call to the __memcpy_chk function to the builder.
|
/// EmitMemCpyChk - Emit a call to the __memcpy_chk function to the builder.
|
||||||
/// This expects that the Len and ObjSize have type 'intptr_t' and Dst/Src
|
/// This expects that the Len and ObjSize have type 'intptr_t' and Dst/Src
|
||||||
/// are pointers.
|
/// are pointers.
|
||||||
Value *EmitMemCpyChk(Value *Dst, Value *Src, Value *Len, Value *ObjSize,
|
Value *EmitMemCpyChk(Value *Dst, Value *Src, Value *Len, Value *ObjSize,
|
||||||
IRBuilder<> &B, const TargetData *TD);
|
IRBuilder<> &B, const TargetData *TD);
|
||||||
|
|
||||||
/// EmitMemMove - Emit a call to the memmove function to the builder. This
|
|
||||||
/// always expects that the size has type 'intptr_t' and Dst/Src are pointers.
|
|
||||||
Value *EmitMemMove(Value *Dst, Value *Src, Value *Len, unsigned Align,
|
|
||||||
bool isVolatile, IRBuilder<> &B, const TargetData *TD);
|
|
||||||
|
|
||||||
/// EmitMemChr - Emit a call to the memchr function. This assumes that Ptr is
|
/// EmitMemChr - Emit a call to the memchr function. This assumes that Ptr is
|
||||||
/// a pointer, Val is an i32 value, and Len is an 'intptr_t' value.
|
/// a pointer, Val is an i32 value, and Len is an 'intptr_t' value.
|
||||||
Value *EmitMemChr(Value *Ptr, Value *Val, Value *Len, IRBuilder<> &B,
|
Value *EmitMemChr(Value *Ptr, Value *Val, Value *Len, IRBuilder<> &B,
|
||||||
@ -73,10 +63,6 @@ namespace llvm {
|
|||||||
Value *EmitMemCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B,
|
Value *EmitMemCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B,
|
||||||
const TargetData *TD);
|
const TargetData *TD);
|
||||||
|
|
||||||
/// EmitMemSet - Emit a call to the memset function
|
|
||||||
Value *EmitMemSet(Value *Dst, Value *Val, Value *Len, bool isVolatile,
|
|
||||||
IRBuilder<> &B, const TargetData *TD);
|
|
||||||
|
|
||||||
/// EmitUnaryFloatFnCall - Emit a call to the unary function named 'Name'
|
/// EmitUnaryFloatFnCall - Emit a call to the unary function named 'Name'
|
||||||
/// (e.g. 'floor'). This function is known to take a single of type matching
|
/// (e.g. 'floor'). This function is known to take a single of type matching
|
||||||
/// 'Op' and returns one value with the same type. If 'Op' is a long double,
|
/// 'Op' and returns one value with the same type. If 'Op' is a long double,
|
||||||
|
@ -131,21 +131,6 @@ Value *llvm::EmitStrNCpy(Value *Dst, Value *Src, Value *Len,
|
|||||||
return CI;
|
return CI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// EmitMemCpy - Emit a call to the memcpy function to the builder. This always
|
|
||||||
/// expects that Len has type 'intptr_t' and Dst/Src are pointers.
|
|
||||||
Value *llvm::EmitMemCpy(Value *Dst, Value *Src, Value *Len, unsigned Align,
|
|
||||||
bool isVolatile, IRBuilder<> &B, const TargetData *TD) {
|
|
||||||
Module *M = B.GetInsertBlock()->getParent()->getParent();
|
|
||||||
Dst = CastToCStr(Dst, B);
|
|
||||||
Src = CastToCStr(Src, B);
|
|
||||||
const Type *ArgTys[3] = { Dst->getType(), Src->getType(), Len->getType() };
|
|
||||||
Value *MemCpy = Intrinsic::getDeclaration(M, Intrinsic::memcpy, ArgTys, 3);
|
|
||||||
return B.CreateCall5(MemCpy, Dst, Src, Len,
|
|
||||||
ConstantInt::get(B.getInt32Ty(), Align),
|
|
||||||
ConstantInt::get(B.getInt1Ty(), isVolatile));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// EmitMemCpyChk - Emit a call to the __memcpy_chk function to the builder.
|
/// EmitMemCpyChk - Emit a call to the __memcpy_chk function to the builder.
|
||||||
/// This expects that the Len and ObjSize have type 'intptr_t' and Dst/Src
|
/// This expects that the Len and ObjSize have type 'intptr_t' and Dst/Src
|
||||||
/// are pointers.
|
/// are pointers.
|
||||||
@ -170,22 +155,6 @@ Value *llvm::EmitMemCpyChk(Value *Dst, Value *Src, Value *Len, Value *ObjSize,
|
|||||||
return CI;
|
return CI;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EmitMemMove - Emit a call to the memmove function to the builder. This
|
|
||||||
/// always expects that the size has type 'intptr_t' and Dst/Src are pointers.
|
|
||||||
Value *llvm::EmitMemMove(Value *Dst, Value *Src, Value *Len, unsigned Align,
|
|
||||||
bool isVolatile, IRBuilder<> &B, const TargetData *TD) {
|
|
||||||
Module *M = B.GetInsertBlock()->getParent()->getParent();
|
|
||||||
LLVMContext &Context = B.GetInsertBlock()->getContext();
|
|
||||||
const Type *ArgTys[3] = { Dst->getType(), Src->getType(),
|
|
||||||
TD->getIntPtrType(Context) };
|
|
||||||
Value *MemMove = Intrinsic::getDeclaration(M, Intrinsic::memmove, ArgTys, 3);
|
|
||||||
Dst = CastToCStr(Dst, B);
|
|
||||||
Src = CastToCStr(Src, B);
|
|
||||||
Value *A = ConstantInt::get(B.getInt32Ty(), Align);
|
|
||||||
Value *Vol = ConstantInt::get(B.getInt1Ty(), isVolatile);
|
|
||||||
return B.CreateCall5(MemMove, Dst, Src, Len, A, Vol);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// EmitMemChr - Emit a call to the memchr function. This assumes that Ptr is
|
/// EmitMemChr - Emit a call to the memchr function. This assumes that Ptr is
|
||||||
/// a pointer, Val is an i32 value, and Len is an 'intptr_t' value.
|
/// a pointer, Val is an i32 value, and Len is an 'intptr_t' value.
|
||||||
Value *llvm::EmitMemChr(Value *Ptr, Value *Val,
|
Value *llvm::EmitMemChr(Value *Ptr, Value *Val,
|
||||||
@ -233,18 +202,6 @@ Value *llvm::EmitMemCmp(Value *Ptr1, Value *Ptr2,
|
|||||||
return CI;
|
return CI;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EmitMemSet - Emit a call to the memset function
|
|
||||||
Value *llvm::EmitMemSet(Value *Dst, Value *Val, Value *Len, bool isVolatile,
|
|
||||||
IRBuilder<> &B, const TargetData *TD) {
|
|
||||||
Module *M = B.GetInsertBlock()->getParent()->getParent();
|
|
||||||
Intrinsic::ID IID = Intrinsic::memset;
|
|
||||||
const Type *Tys[2] = { Dst->getType(), Len->getType() };
|
|
||||||
Value *MemSet = Intrinsic::getDeclaration(M, IID, Tys, 2);
|
|
||||||
Value *Align = ConstantInt::get(B.getInt32Ty(), 1);
|
|
||||||
Value *Vol = ConstantInt::get(B.getInt1Ty(), isVolatile);
|
|
||||||
return B.CreateCall5(MemSet, CastToCStr(Dst, B), Val, Len, Align, Vol);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// EmitUnaryFloatFnCall - Emit a call to the unary function named 'Name' (e.g.
|
/// EmitUnaryFloatFnCall - Emit a call to the unary function named 'Name' (e.g.
|
||||||
/// 'floor'). This function is known to take a single of type matching 'Op' and
|
/// 'floor'). This function is known to take a single of type matching 'Op' and
|
||||||
/// returns one value with the same type. If 'Op' is a long double, 'l' is
|
/// returns one value with the same type. If 'Op' is a long double, 'l' is
|
||||||
@ -422,8 +379,8 @@ bool SimplifyFortifiedLibCalls::fold(CallInst *CI, const TargetData *TD) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (isFoldable(3, 2, false)) {
|
if (isFoldable(3, 2, false)) {
|
||||||
EmitMemCpy(CI->getArgOperand(0), CI->getArgOperand(1),
|
B.CreateMemCpy(CI->getArgOperand(0), CI->getArgOperand(1),
|
||||||
CI->getArgOperand(2), 1, false, B, TD);
|
CI->getArgOperand(2), 1);
|
||||||
replaceCall(CI->getArgOperand(0));
|
replaceCall(CI->getArgOperand(0));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -445,8 +402,8 @@ bool SimplifyFortifiedLibCalls::fold(CallInst *CI, const TargetData *TD) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (isFoldable(3, 2, false)) {
|
if (isFoldable(3, 2, false)) {
|
||||||
EmitMemMove(CI->getArgOperand(0), CI->getArgOperand(1),
|
B.CreateMemMove(CI->getArgOperand(0), CI->getArgOperand(1),
|
||||||
CI->getArgOperand(2), 1, false, B, TD);
|
CI->getArgOperand(2), 1);
|
||||||
replaceCall(CI->getArgOperand(0));
|
replaceCall(CI->getArgOperand(0));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -465,8 +422,7 @@ bool SimplifyFortifiedLibCalls::fold(CallInst *CI, const TargetData *TD) {
|
|||||||
if (isFoldable(3, 2, false)) {
|
if (isFoldable(3, 2, false)) {
|
||||||
Value *Val = B.CreateIntCast(CI->getArgOperand(1), B.getInt8Ty(),
|
Value *Val = B.CreateIntCast(CI->getArgOperand(1), B.getInt8Ty(),
|
||||||
false);
|
false);
|
||||||
EmitMemSet(CI->getArgOperand(0), Val, CI->getArgOperand(2),
|
B.CreateMemSet(CI->getArgOperand(0), Val, CI->getArgOperand(2), 1);
|
||||||
false, B, TD);
|
|
||||||
replaceCall(CI->getArgOperand(0));
|
replaceCall(CI->getArgOperand(0));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user