mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 18:24:00 +00:00
Actually privatize a IntegerTypes, and fix a few bugs exposed by this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78955 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -104,12 +104,12 @@ const SCEV *PointerTracking::computeAllocationCount(Value *P,
|
||||
Constant *C = GV->getInitializer();
|
||||
if (const ArrayType *ATy = dyn_cast<ArrayType>(C->getType())) {
|
||||
Ty = ATy->getElementType();
|
||||
return SE->getConstant(Type::getInt32Ty(Ty->getContext()),
|
||||
return SE->getConstant(Type::getInt32Ty(P->getContext()),
|
||||
ATy->getNumElements());
|
||||
}
|
||||
}
|
||||
Ty = GV->getType();
|
||||
return SE->getConstant(Type::getInt32Ty(Ty->getContext()), 1);
|
||||
return SE->getConstant(Type::getInt32Ty(P->getContext()), 1);
|
||||
//TODO: implement more tracking for globals
|
||||
}
|
||||
|
||||
@ -118,13 +118,13 @@ const SCEV *PointerTracking::computeAllocationCount(Value *P,
|
||||
Function *F = dyn_cast<Function>(CS.getCalledValue()->stripPointerCasts());
|
||||
const Loop *L = LI->getLoopFor(CI->getParent());
|
||||
if (F == callocFunc) {
|
||||
Ty = Type::getInt8Ty(Ty->getContext());
|
||||
Ty = Type::getInt8Ty(P->getContext());
|
||||
// calloc allocates arg0*arg1 bytes.
|
||||
return SE->getSCEVAtScope(SE->getMulExpr(SE->getSCEV(CS.getArgument(0)),
|
||||
SE->getSCEV(CS.getArgument(1))),
|
||||
L);
|
||||
} else if (F == reallocFunc) {
|
||||
Ty = Type::getInt8Ty(Ty->getContext());
|
||||
Ty = Type::getInt8Ty(P->getContext());
|
||||
// realloc allocates arg1 bytes.
|
||||
return SE->getSCEVAtScope(CS.getArgument(1), L);
|
||||
}
|
||||
|
Reference in New Issue
Block a user