mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-22 09:29:31 +00:00
Make getAlignOf return an i64, for consistency with getSizeOf and
getOffsetOf, and remove the comment about assuming i8 is byte-aligned, which is no longer applicable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94738 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0f5efe5625
commit
06ed3e788a
@ -644,8 +644,7 @@ public:
|
|||||||
///
|
///
|
||||||
|
|
||||||
/// getAlignOf constant expr - computes the alignment of a type in a target
|
/// getAlignOf constant expr - computes the alignment of a type in a target
|
||||||
/// independent way (Note: the return type is an i32; Note: assumes that i8
|
/// independent way (Note: the return type is an i64).
|
||||||
/// is byte aligned).
|
|
||||||
static Constant *getAlignOf(const Type* Ty);
|
static Constant *getAlignOf(const Type* Ty);
|
||||||
|
|
||||||
/// getSizeOf constant expr - computes the size of a type in a target
|
/// getSizeOf constant expr - computes the size of a type in a target
|
||||||
|
@ -1484,12 +1484,12 @@ Constant* ConstantExpr::getAlignOf(const Type* Ty) {
|
|||||||
const Type *AligningTy = StructType::get(Ty->getContext(),
|
const Type *AligningTy = StructType::get(Ty->getContext(),
|
||||||
Type::getInt1Ty(Ty->getContext()), Ty, NULL);
|
Type::getInt1Ty(Ty->getContext()), Ty, NULL);
|
||||||
Constant *NullPtr = Constant::getNullValue(AligningTy->getPointerTo());
|
Constant *NullPtr = Constant::getNullValue(AligningTy->getPointerTo());
|
||||||
Constant *Zero = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 0);
|
Constant *Zero = ConstantInt::get(Type::getInt64Ty(Ty->getContext()), 0);
|
||||||
Constant *One = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1);
|
Constant *One = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1);
|
||||||
Constant *Indices[2] = { Zero, One };
|
Constant *Indices[2] = { Zero, One };
|
||||||
Constant *GEP = getGetElementPtr(NullPtr, Indices, 2);
|
Constant *GEP = getGetElementPtr(NullPtr, Indices, 2);
|
||||||
return getCast(Instruction::PtrToInt, GEP,
|
return getCast(Instruction::PtrToInt, GEP,
|
||||||
Type::getInt32Ty(Ty->getContext()));
|
Type::getInt64Ty(Ty->getContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Constant* ConstantExpr::getOffsetOf(const StructType* STy, unsigned FieldNo) {
|
Constant* ConstantExpr::getOffsetOf(const StructType* STy, unsigned FieldNo) {
|
||||||
|
Loading…
Reference in New Issue
Block a user