mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-03 14:21:30 +00:00 
			
		
		
		
	Factorize code: rather than duplication the logic in getPointerTypeSizeInBits,
just call getPointerTypeSizeInBits. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166926 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		@@ -678,20 +678,8 @@ IntegerType *DataLayout::getIntPtrType(LLVMContext &C,
 | 
				
			|||||||
/// getIntPtrType - Return an integer type that is the same size or
 | 
					/// getIntPtrType - Return an integer type that is the same size or
 | 
				
			||||||
/// greater to the pointer size of the specific PointerType.
 | 
					/// greater to the pointer size of the specific PointerType.
 | 
				
			||||||
IntegerType *DataLayout::getIntPtrType(Type *Ty) const {
 | 
					IntegerType *DataLayout::getIntPtrType(Type *Ty) const {
 | 
				
			||||||
  LLVMContext &C = Ty->getContext();
 | 
					  unsigned NumBits = getPointerTypeSizeInBits(Ty);
 | 
				
			||||||
  // For pointers, we return the size for the specific address space.
 | 
					  return IntegerType::get(Ty->getContext(), NumBits);
 | 
				
			||||||
  if (Ty->isPointerTy()) return IntegerType::get(C, getTypeSizeInBits(Ty));
 | 
					 | 
				
			||||||
  // For vector of pointers, we return the size of the address space
 | 
					 | 
				
			||||||
  // of the pointer type.
 | 
					 | 
				
			||||||
  if (Ty->isVectorTy() && cast<VectorType>(Ty)->getElementType()->isPointerTy())
 | 
					 | 
				
			||||||
    return IntegerType::get(C,
 | 
					 | 
				
			||||||
        getTypeSizeInBits(cast<VectorType>(Ty)->getElementType()));
 | 
					 | 
				
			||||||
  // Otherwise return the address space for the default address space.
 | 
					 | 
				
			||||||
  // An example of this occuring is that you want to get the IntPtr
 | 
					 | 
				
			||||||
  // for all of the arguments in a function. However, the IntPtr
 | 
					 | 
				
			||||||
  // for a non-pointer type cannot be determined by the type, so
 | 
					 | 
				
			||||||
  // the default value is used.
 | 
					 | 
				
			||||||
  return getIntPtrType(C, 0);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user