mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 01:24:30 +00:00
Add addrspacecast instruction.
Patch by Michele Scandale! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194760 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -283,6 +283,7 @@ namespace {
|
||||
void visitIntToPtrInst(IntToPtrInst &I);
|
||||
void visitPtrToIntInst(PtrToIntInst &I);
|
||||
void visitBitCastInst(BitCastInst &I);
|
||||
void visitAddrSpaceCastInst(AddrSpaceCastInst &I);
|
||||
void visitPHINode(PHINode &PN);
|
||||
void visitBinaryOperator(BinaryOperator &B);
|
||||
void visitICmpInst(ICmpInst &IC);
|
||||
@ -965,11 +966,9 @@ void Verifier::VerifyBitcastType(const Value *V, Type *DestTy, Type *SrcTy) {
|
||||
unsigned SrcAS = SrcTy->getPointerAddressSpace();
|
||||
unsigned DstAS = DestTy->getPointerAddressSpace();
|
||||
|
||||
unsigned SrcASSize = DL->getPointerSizeInBits(SrcAS);
|
||||
unsigned DstASSize = DL->getPointerSizeInBits(DstAS);
|
||||
Assert1(SrcASSize == DstASSize,
|
||||
"Bitcasts between pointers of different address spaces must have "
|
||||
"the same size pointers, otherwise use PtrToInt/IntToPtr.", V);
|
||||
Assert1(SrcAS == DstAS,
|
||||
"Bitcasts between pointers of different address spaces is not legal."
|
||||
"Use AddrSpaceCast instead.", V);
|
||||
}
|
||||
|
||||
void Verifier::VerifyConstantExprBitcastType(const ConstantExpr *CE) {
|
||||
@ -1455,6 +1454,22 @@ void Verifier::visitBitCastInst(BitCastInst &I) {
|
||||
visitInstruction(I);
|
||||
}
|
||||
|
||||
void Verifier::visitAddrSpaceCastInst(AddrSpaceCastInst &I) {
|
||||
Type *SrcTy = I.getOperand(0)->getType();
|
||||
Type *DestTy = I.getType();
|
||||
|
||||
Assert1(SrcTy->isPtrOrPtrVectorTy(),
|
||||
"AddrSpaceCast source must be a pointer", &I);
|
||||
Assert1(DestTy->isPtrOrPtrVectorTy(),
|
||||
"AddrSpaceCast result must be a pointer", &I);
|
||||
Assert1(SrcTy->getPointerAddressSpace() != DestTy->getPointerAddressSpace(),
|
||||
"AddrSpaceCast must be between different address spaces", &I);
|
||||
if (SrcTy->isVectorTy())
|
||||
Assert1(SrcTy->getVectorNumElements() == DestTy->getVectorNumElements(),
|
||||
"AddrSpaceCast vector pointer number of elements mismatch", &I);
|
||||
visitInstruction(I);
|
||||
}
|
||||
|
||||
/// visitPHINode - Ensure that a PHI node is well formed.
|
||||
///
|
||||
void Verifier::visitPHINode(PHINode &PN) {
|
||||
|
Reference in New Issue
Block a user