mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Move remaining stuff to the isInteger predicate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92771 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -505,8 +505,7 @@ static uint64_t GetStringLengthH(Value *V, SmallPtrSet<PHINode*, 32> &PHIs) {
|
||||
|
||||
// Must be a Constant Array
|
||||
ConstantArray *Array = dyn_cast<ConstantArray>(GlobalInit);
|
||||
if (!Array ||
|
||||
Array->getType()->getElementType() != Type::getInt8Ty(V->getContext()))
|
||||
if (!Array || !Array->getType()->getElementType()->isInteger(8))
|
||||
return false;
|
||||
|
||||
// Get the number of elements in the array
|
||||
@@ -678,9 +677,7 @@ struct StrChrOpt : public LibCallOptimization {
|
||||
if (!TD) return 0;
|
||||
|
||||
uint64_t Len = GetStringLength(SrcStr);
|
||||
if (Len == 0 ||
|
||||
FT->getParamType(1) != Type::getInt32Ty(*Context)) // memchr needs
|
||||
// i32.
|
||||
if (Len == 0 || !FT->getParamType(1)->isInteger(32)) // memchr needs i32.
|
||||
return 0;
|
||||
|
||||
return EmitMemChr(SrcStr, CI->getOperand(2), // include nul.
|
||||
@@ -722,7 +719,7 @@ struct StrCmpOpt : public LibCallOptimization {
|
||||
// Verify the "strcmp" function prototype.
|
||||
const FunctionType *FT = Callee->getFunctionType();
|
||||
if (FT->getNumParams() != 2 ||
|
||||
FT->getReturnType() != Type::getInt32Ty(*Context) ||
|
||||
!FT->getReturnType()->isInteger(32) ||
|
||||
FT->getParamType(0) != FT->getParamType(1) ||
|
||||
FT->getParamType(0) != Type::getInt8PtrTy(*Context))
|
||||
return 0;
|
||||
@@ -770,7 +767,7 @@ struct StrNCmpOpt : public LibCallOptimization {
|
||||
// Verify the "strncmp" function prototype.
|
||||
const FunctionType *FT = Callee->getFunctionType();
|
||||
if (FT->getNumParams() != 3 ||
|
||||
FT->getReturnType() != Type::getInt32Ty(*Context) ||
|
||||
!FT->getReturnType()->isInteger(32) ||
|
||||
FT->getParamType(0) != FT->getParamType(1) ||
|
||||
FT->getParamType(0) != Type::getInt8PtrTy(*Context) ||
|
||||
!isa<IntegerType>(FT->getParamType(2)))
|
||||
@@ -991,7 +988,7 @@ struct MemCmpOpt : public LibCallOptimization {
|
||||
const FunctionType *FT = Callee->getFunctionType();
|
||||
if (FT->getNumParams() != 3 || !isa<PointerType>(FT->getParamType(0)) ||
|
||||
!isa<PointerType>(FT->getParamType(1)) ||
|
||||
FT->getReturnType() != Type::getInt32Ty(*Context))
|
||||
!FT->getReturnType()->isInteger(32))
|
||||
return 0;
|
||||
|
||||
Value *LHS = CI->getOperand(1), *RHS = CI->getOperand(2);
|
||||
@@ -1353,7 +1350,7 @@ struct FFSOpt : public LibCallOptimization {
|
||||
// Just make sure this has 2 arguments of the same FP type, which match the
|
||||
// result type.
|
||||
if (FT->getNumParams() != 1 ||
|
||||
FT->getReturnType() != Type::getInt32Ty(*Context) ||
|
||||
!FT->getReturnType()->isInteger(32) ||
|
||||
!isa<IntegerType>(FT->getParamType(0)))
|
||||
return 0;
|
||||
|
||||
@@ -1389,7 +1386,7 @@ struct IsDigitOpt : public LibCallOptimization {
|
||||
const FunctionType *FT = Callee->getFunctionType();
|
||||
// We require integer(i32)
|
||||
if (FT->getNumParams() != 1 || !isa<IntegerType>(FT->getReturnType()) ||
|
||||
FT->getParamType(0) != Type::getInt32Ty(*Context))
|
||||
!FT->getParamType(0)->isInteger(32))
|
||||
return 0;
|
||||
|
||||
// isdigit(c) -> (c-'0') <u 10
|
||||
@@ -1410,7 +1407,7 @@ struct IsAsciiOpt : public LibCallOptimization {
|
||||
const FunctionType *FT = Callee->getFunctionType();
|
||||
// We require integer(i32)
|
||||
if (FT->getNumParams() != 1 || !isa<IntegerType>(FT->getReturnType()) ||
|
||||
FT->getParamType(0) != Type::getInt32Ty(*Context))
|
||||
!FT->getParamType(0)->isInteger(32))
|
||||
return 0;
|
||||
|
||||
// isascii(c) -> c <u 128
|
||||
@@ -1451,7 +1448,7 @@ struct ToAsciiOpt : public LibCallOptimization {
|
||||
const FunctionType *FT = Callee->getFunctionType();
|
||||
// We require i32(i32)
|
||||
if (FT->getNumParams() != 1 || FT->getReturnType() != FT->getParamType(0) ||
|
||||
FT->getParamType(0) != Type::getInt32Ty(*Context))
|
||||
!FT->getParamType(0)->isInteger(32))
|
||||
return 0;
|
||||
|
||||
// isascii(c) -> c & 0x7f
|
||||
|
Reference in New Issue
Block a user