mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 00:32:55 +00:00
Remove more default address space argument usage.
These places are inconsequential in practice. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207021 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
28a24ca471
commit
b5a391a685
@ -1793,7 +1793,7 @@ Constant *ConstantExpr::getAlignOf(Type* Ty) {
|
|||||||
// Note that a non-inbounds gep is used, as null isn't within any object.
|
// Note that a non-inbounds gep is used, as null isn't within any object.
|
||||||
Type *AligningTy =
|
Type *AligningTy =
|
||||||
StructType::get(Type::getInt1Ty(Ty->getContext()), Ty, NULL);
|
StructType::get(Type::getInt1Ty(Ty->getContext()), Ty, NULL);
|
||||||
Constant *NullPtr = Constant::getNullValue(AligningTy->getPointerTo());
|
Constant *NullPtr = Constant::getNullValue(AligningTy->getPointerTo(0));
|
||||||
Constant *Zero = ConstantInt::get(Type::getInt64Ty(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 };
|
||||||
|
@ -2109,7 +2109,8 @@ void SROA::RewriteLifetimeIntrinsic(IntrinsicInst *II, AllocaInst *AI,
|
|||||||
if (NewOffset) {
|
if (NewOffset) {
|
||||||
// Splice the first element and index 'NewOffset' bytes in. SROA will
|
// Splice the first element and index 'NewOffset' bytes in. SROA will
|
||||||
// split the alloca again later.
|
// split the alloca again later.
|
||||||
Value *V = Builder.CreateBitCast(NewElts[Idx], Builder.getInt8PtrTy());
|
unsigned AS = AI->getType()->getAddressSpace();
|
||||||
|
Value *V = Builder.CreateBitCast(NewElts[Idx], Builder.getInt8PtrTy(AS));
|
||||||
V = Builder.CreateGEP(V, Builder.getInt64(NewOffset));
|
V = Builder.CreateGEP(V, Builder.getInt64(NewOffset));
|
||||||
|
|
||||||
IdxTy = NewElts[Idx]->getAllocatedType();
|
IdxTy = NewElts[Idx]->getAllocatedType();
|
||||||
|
@ -27,7 +27,8 @@ using namespace llvm;
|
|||||||
|
|
||||||
/// CastToCStr - Return V if it is an i8*, otherwise cast it to i8*.
|
/// CastToCStr - Return V if it is an i8*, otherwise cast it to i8*.
|
||||||
Value *llvm::CastToCStr(Value *V, IRBuilder<> &B) {
|
Value *llvm::CastToCStr(Value *V, IRBuilder<> &B) {
|
||||||
return B.CreateBitCast(V, B.getInt8PtrTy(), "cstr");
|
unsigned AS = V->getType()->getPointerAddressSpace();
|
||||||
|
return B.CreateBitCast(V, B.getInt8PtrTy(AS), "cstr");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EmitStrLen - Emit a call to the strlen function to the builder, for the
|
/// EmitStrLen - Emit a call to the strlen function to the builder, for the
|
||||||
|
@ -358,7 +358,8 @@ static Value *HandleByValArgument(Value *Arg, Instruction *TheCall,
|
|||||||
const Function *CalledFunc,
|
const Function *CalledFunc,
|
||||||
InlineFunctionInfo &IFI,
|
InlineFunctionInfo &IFI,
|
||||||
unsigned ByValAlignment) {
|
unsigned ByValAlignment) {
|
||||||
Type *AggTy = cast<PointerType>(Arg->getType())->getElementType();
|
PointerType *ArgTy = cast<PointerType>(Arg->getType());
|
||||||
|
Type *AggTy = ArgTy->getElementType();
|
||||||
|
|
||||||
// If the called function is readonly, then it could not mutate the caller's
|
// If the called function is readonly, then it could not mutate the caller's
|
||||||
// copy of the byval'd memory. In this case, it is safe to elide the copy and
|
// copy of the byval'd memory. In this case, it is safe to elide the copy and
|
||||||
@ -420,8 +421,10 @@ static bool isUsedByLifetimeMarker(Value *V) {
|
|||||||
// hasLifetimeMarkers - Check whether the given alloca already has
|
// hasLifetimeMarkers - Check whether the given alloca already has
|
||||||
// lifetime.start or lifetime.end intrinsics.
|
// lifetime.start or lifetime.end intrinsics.
|
||||||
static bool hasLifetimeMarkers(AllocaInst *AI) {
|
static bool hasLifetimeMarkers(AllocaInst *AI) {
|
||||||
Type *Int8PtrTy = Type::getInt8PtrTy(AI->getType()->getContext());
|
Type *Ty = AI->getType();
|
||||||
if (AI->getType() == Int8PtrTy)
|
Type *Int8PtrTy = Type::getInt8PtrTy(Ty->getContext(),
|
||||||
|
Ty->getPointerAddressSpace());
|
||||||
|
if (Ty == Int8PtrTy)
|
||||||
return isUsedByLifetimeMarker(AI);
|
return isUsedByLifetimeMarker(AI);
|
||||||
|
|
||||||
// Do a scan to find all the casts to i8*.
|
// Do a scan to find all the casts to i8*.
|
||||||
|
@ -60,6 +60,7 @@ STATISTIC(NumPHIInsert, "Number of PHI nodes inserted");
|
|||||||
bool llvm::isAllocaPromotable(const AllocaInst *AI) {
|
bool llvm::isAllocaPromotable(const AllocaInst *AI) {
|
||||||
// FIXME: If the memory unit is of pointer or integer type, we can permit
|
// FIXME: If the memory unit is of pointer or integer type, we can permit
|
||||||
// assignments to subsections of the memory unit.
|
// assignments to subsections of the memory unit.
|
||||||
|
unsigned AS = AI->getType()->getAddressSpace();
|
||||||
|
|
||||||
// Only allow direct and non-volatile loads and stores...
|
// Only allow direct and non-volatile loads and stores...
|
||||||
for (const User *U : AI->users()) {
|
for (const User *U : AI->users()) {
|
||||||
@ -80,12 +81,12 @@ bool llvm::isAllocaPromotable(const AllocaInst *AI) {
|
|||||||
II->getIntrinsicID() != Intrinsic::lifetime_end)
|
II->getIntrinsicID() != Intrinsic::lifetime_end)
|
||||||
return false;
|
return false;
|
||||||
} else if (const BitCastInst *BCI = dyn_cast<BitCastInst>(U)) {
|
} else if (const BitCastInst *BCI = dyn_cast<BitCastInst>(U)) {
|
||||||
if (BCI->getType() != Type::getInt8PtrTy(U->getContext()))
|
if (BCI->getType() != Type::getInt8PtrTy(U->getContext(), AS))
|
||||||
return false;
|
return false;
|
||||||
if (!onlyUsedByLifetimeMarkers(BCI))
|
if (!onlyUsedByLifetimeMarkers(BCI))
|
||||||
return false;
|
return false;
|
||||||
} else if (const GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(U)) {
|
} else if (const GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(U)) {
|
||||||
if (GEPI->getType() != Type::getInt8PtrTy(U->getContext()))
|
if (GEPI->getType() != Type::getInt8PtrTy(U->getContext(), AS))
|
||||||
return false;
|
return false;
|
||||||
if (!GEPI->hasAllZeroIndices())
|
if (!GEPI->hasAllZeroIndices())
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user