mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-21 12:38:45 +00:00
Fix VS warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19383 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4d0801b243
commit
22bc934720
@ -53,9 +53,9 @@ static bool MallocConvertibleToType(MallocInst *MI, const Type *Ty,
|
|||||||
ExprType Expr = ClassifyExpr(MI->getArraySize());
|
ExprType Expr = ClassifyExpr(MI->getArraySize());
|
||||||
|
|
||||||
// Get information about the base datatype being allocated, before & after
|
// Get information about the base datatype being allocated, before & after
|
||||||
int ReqTypeSize = TD.getTypeSize(Ty);
|
uint64_t ReqTypeSize = TD.getTypeSize(Ty);
|
||||||
if (ReqTypeSize == 0) return false;
|
if (ReqTypeSize == 0) return false;
|
||||||
unsigned OldTypeSize = TD.getTypeSize(MI->getType()->getElementType());
|
uint64_t OldTypeSize = TD.getTypeSize(MI->getType()->getElementType());
|
||||||
|
|
||||||
// Must have a scale or offset to analyze it...
|
// Must have a scale or offset to analyze it...
|
||||||
if (!Expr.Offset && !Expr.Scale && OldTypeSize == 1) return false;
|
if (!Expr.Offset && !Expr.Scale && OldTypeSize == 1) return false;
|
||||||
@ -66,8 +66,8 @@ static bool MallocConvertibleToType(MallocInst *MI, const Type *Ty,
|
|||||||
|
|
||||||
// The old type might not be of unit size, take old size into consideration
|
// The old type might not be of unit size, take old size into consideration
|
||||||
// here...
|
// here...
|
||||||
int64_t Offset = OffsetVal * OldTypeSize;
|
uint64_t Offset = OffsetVal * OldTypeSize;
|
||||||
int64_t Scale = ScaleVal * OldTypeSize;
|
uint64_t Scale = ScaleVal * OldTypeSize;
|
||||||
|
|
||||||
// In order to be successful, both the scale and the offset must be a multiple
|
// In order to be successful, both the scale and the offset must be a multiple
|
||||||
// of the requested data type's size.
|
// of the requested data type's size.
|
||||||
@ -92,8 +92,8 @@ static Instruction *ConvertMallocToType(MallocInst *MI, const Type *Ty,
|
|||||||
const PointerType *AllocTy = cast<PointerType>(Ty);
|
const PointerType *AllocTy = cast<PointerType>(Ty);
|
||||||
const Type *ElType = AllocTy->getElementType();
|
const Type *ElType = AllocTy->getElementType();
|
||||||
|
|
||||||
unsigned DataSize = TD.getTypeSize(ElType);
|
uint64_t DataSize = TD.getTypeSize(ElType);
|
||||||
unsigned OldTypeSize = TD.getTypeSize(MI->getType()->getElementType());
|
uint64_t OldTypeSize = TD.getTypeSize(MI->getType()->getElementType());
|
||||||
|
|
||||||
// Get the offset and scale coefficients that we are allocating...
|
// Get the offset and scale coefficients that we are allocating...
|
||||||
int64_t OffsetVal = (Expr.Offset ? getConstantValue(Expr.Offset) : 0);
|
int64_t OffsetVal = (Expr.Offset ? getConstantValue(Expr.Offset) : 0);
|
||||||
@ -101,8 +101,8 @@ static Instruction *ConvertMallocToType(MallocInst *MI, const Type *Ty,
|
|||||||
|
|
||||||
// The old type might not be of unit size, take old size into consideration
|
// The old type might not be of unit size, take old size into consideration
|
||||||
// here...
|
// here...
|
||||||
unsigned Offset = (uint64_t)OffsetVal * OldTypeSize / DataSize;
|
unsigned Offset = OffsetVal * OldTypeSize / DataSize;
|
||||||
unsigned Scale = (uint64_t)ScaleVal * OldTypeSize / DataSize;
|
unsigned Scale = ScaleVal * OldTypeSize / DataSize;
|
||||||
|
|
||||||
// Locate the malloc instruction, because we may be inserting instructions
|
// Locate the malloc instruction, because we may be inserting instructions
|
||||||
It = MI;
|
It = MI;
|
||||||
@ -784,7 +784,7 @@ static bool OperandConvertibleToType(User *U, Value *V, const Type *Ty,
|
|||||||
//
|
//
|
||||||
if (I->getNumOperands() == 2) {
|
if (I->getNumOperands() == 2) {
|
||||||
const Type *OldElTy = cast<PointerType>(I->getType())->getElementType();
|
const Type *OldElTy = cast<PointerType>(I->getType())->getElementType();
|
||||||
unsigned DataSize = TD.getTypeSize(OldElTy);
|
uint64_t DataSize = TD.getTypeSize(OldElTy);
|
||||||
Value *Index = I->getOperand(1);
|
Value *Index = I->getOperand(1);
|
||||||
Instruction *TempScale = 0;
|
Instruction *TempScale = 0;
|
||||||
|
|
||||||
@ -1103,7 +1103,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
|
|||||||
//
|
//
|
||||||
BasicBlock::iterator It = I;
|
BasicBlock::iterator It = I;
|
||||||
const Type *OldElTy = cast<PointerType>(I->getType())->getElementType();
|
const Type *OldElTy = cast<PointerType>(I->getType())->getElementType();
|
||||||
unsigned DataSize = TD.getTypeSize(OldElTy);
|
uint64_t DataSize = TD.getTypeSize(OldElTy);
|
||||||
Value *Index = I->getOperand(1);
|
Value *Index = I->getOperand(1);
|
||||||
|
|
||||||
if (DataSize != 1) {
|
if (DataSize != 1) {
|
||||||
|
@ -73,7 +73,7 @@ const Type *llvm::getStructOffsetType(const Type *Ty, unsigned &Offset,
|
|||||||
"Offset not in composite!");
|
"Offset not in composite!");
|
||||||
|
|
||||||
NextType = ATy->getElementType();
|
NextType = ATy->getElementType();
|
||||||
unsigned ChildSize = TD.getTypeSize(NextType);
|
unsigned ChildSize = (unsigned)TD.getTypeSize(NextType);
|
||||||
if (ConstantSInt::isValueValidForType(Type::IntTy, Offset/ChildSize))
|
if (ConstantSInt::isValueValidForType(Type::IntTy, Offset/ChildSize))
|
||||||
Indices.push_back(ConstantSInt::get(Type::IntTy, Offset/ChildSize));
|
Indices.push_back(ConstantSInt::get(Type::IntTy, Offset/ChildSize));
|
||||||
else
|
else
|
||||||
@ -84,10 +84,10 @@ const Type *llvm::getStructOffsetType(const Type *Ty, unsigned &Offset,
|
|||||||
return Ty; // Return the leaf type
|
return Ty; // Return the leaf type
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned SubOffs = Offset - ThisOffset;
|
unsigned SubOffs = unsigned(Offset - ThisOffset);
|
||||||
const Type *LeafTy = getStructOffsetType(NextType, SubOffs,
|
const Type *LeafTy = getStructOffsetType(NextType, SubOffs,
|
||||||
Indices, TD, StopEarly);
|
Indices, TD, StopEarly);
|
||||||
Offset = ThisOffset + SubOffs;
|
Offset = unsigned(ThisOffset + SubOffs);
|
||||||
return LeafTy;
|
return LeafTy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user