mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 06:33:24 +00:00
Use type helper functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191574 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5972df2696
commit
b060a46b0d
@ -313,8 +313,7 @@ DecomposeGEPExpression(const Value *V, int64_t &BaseOffs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Don't attempt to analyze GEPs over unsized objects.
|
// Don't attempt to analyze GEPs over unsized objects.
|
||||||
if (!cast<PointerType>(GEPOp->getOperand(0)->getType())
|
if (!GEPOp->getOperand(0)->getType()->getPointerElementType()->isSized())
|
||||||
->getElementType()->isSized())
|
|
||||||
return V;
|
return V;
|
||||||
|
|
||||||
// If we are lacking DataLayout information, we can't compute the offets of
|
// If we are lacking DataLayout information, we can't compute the offets of
|
||||||
@ -354,7 +353,7 @@ DecomposeGEPExpression(const Value *V, int64_t &BaseOffs,
|
|||||||
|
|
||||||
// If the integer type is smaller than the pointer size, it is implicitly
|
// If the integer type is smaller than the pointer size, it is implicitly
|
||||||
// sign extended to pointer size.
|
// sign extended to pointer size.
|
||||||
unsigned Width = cast<IntegerType>(Index->getType())->getBitWidth();
|
unsigned Width = Index->getType()->getIntegerBitWidth();
|
||||||
if (TD->getPointerSizeInBits() > Width)
|
if (TD->getPointerSizeInBits() > Width)
|
||||||
Extension = EK_SignExt;
|
Extension = EK_SignExt;
|
||||||
|
|
||||||
|
@ -1057,7 +1057,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
|
|||||||
if (ParamPTy == 0 || !ParamPTy->getElementType()->isSized() || TD == 0)
|
if (ParamPTy == 0 || !ParamPTy->getElementType()->isSized() || TD == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Type *CurElTy = cast<PointerType>(ActTy)->getElementType();
|
Type *CurElTy = ActTy->getPointerElementType();
|
||||||
if (TD->getTypeAllocSize(CurElTy) !=
|
if (TD->getTypeAllocSize(CurElTy) !=
|
||||||
TD->getTypeAllocSize(ParamPTy->getElementType()))
|
TD->getTypeAllocSize(ParamPTy->getElementType()))
|
||||||
return false;
|
return false;
|
||||||
|
@ -1782,8 +1782,7 @@ Instruction *InstCombiner::visitICmpInstWithCastAndCast(ICmpInst &ICI) {
|
|||||||
// Turn icmp (ptrtoint x), (ptrtoint/c) into a compare of the input if the
|
// Turn icmp (ptrtoint x), (ptrtoint/c) into a compare of the input if the
|
||||||
// integer type is the same size as the pointer type.
|
// integer type is the same size as the pointer type.
|
||||||
if (TD && LHSCI->getOpcode() == Instruction::PtrToInt &&
|
if (TD && LHSCI->getOpcode() == Instruction::PtrToInt &&
|
||||||
TD->getPointerSizeInBits() ==
|
TD->getPointerSizeInBits() == DestTy->getIntegerBitWidth()) {
|
||||||
cast<IntegerType>(DestTy)->getBitWidth()) {
|
|
||||||
Value *RHSOp = 0;
|
Value *RHSOp = 0;
|
||||||
if (Constant *RHSC = dyn_cast<Constant>(ICI.getOperand(1))) {
|
if (Constant *RHSC = dyn_cast<Constant>(ICI.getOperand(1))) {
|
||||||
RHSOp = ConstantExpr::getIntToPtr(RHSC, SrcTy);
|
RHSOp = ConstantExpr::getIntToPtr(RHSC, SrcTy);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user