mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 00:17:01 +00:00
Add in support for getIntPtrType to get the pointer type based on the address space.
This checkin also adds in some tests that utilize these paths and updates some of the clients. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166578 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2120,6 +2120,17 @@ bool CastInst::isNoopCast(Type *IntPtrTy) const {
|
||||
return isNoopCast(getOpcode(), getOperand(0)->getType(), getType(), IntPtrTy);
|
||||
}
|
||||
|
||||
/// @brief Determine if a cast is a no-op
|
||||
bool CastInst::isNoopCast(const DataLayout &DL) const {
|
||||
unsigned AS = 0;
|
||||
if (getOpcode() == Instruction::PtrToInt)
|
||||
AS = getOperand(0)->getType()->getPointerAddressSpace();
|
||||
else if (getOpcode() == Instruction::IntToPtr)
|
||||
AS = getType()->getPointerAddressSpace();
|
||||
Type *IntPtrTy = DL.getIntPtrType(getContext(), AS);
|
||||
return isNoopCast(getOpcode(), getOperand(0)->getType(), getType(), IntPtrTy);
|
||||
}
|
||||
|
||||
/// This function determines if a pair of casts can be eliminated and what
|
||||
/// opcode should be used in the elimination. This assumes that there are two
|
||||
/// instructions like this:
|
||||
|
||||
Reference in New Issue
Block a user