mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 07:24:25 +00:00
simplify this code, it is still broken but will follow up on llvm-commits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123558 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -2169,16 +2169,10 @@ static bool isSimpleEnoughPointerToCommit(Constant *C) {
|
|||||||
// and we know how to evaluate it by moving the bitcast from the pointer
|
// and we know how to evaluate it by moving the bitcast from the pointer
|
||||||
// operand to the value operand.
|
// operand to the value operand.
|
||||||
} else if (CE->getOpcode() == Instruction::BitCast &&
|
} else if (CE->getOpcode() == Instruction::BitCast &&
|
||||||
isa<GlobalVariable>(CE->getOperand(0)) &&
|
isa<GlobalVariable>(CE->getOperand(0))) {
|
||||||
CE->getType()->isPointerTy() &&
|
|
||||||
CE->getOperand(0)->getType()->isPointerTy()) {
|
|
||||||
GlobalVariable *GV = cast<GlobalVariable>(CE->getOperand(0));
|
|
||||||
// Do not allow weak/*_odr/linkonce/dllimport/dllexport linkage or
|
// Do not allow weak/*_odr/linkonce/dllimport/dllexport linkage or
|
||||||
// external globals.
|
// external globals.
|
||||||
if (!GV->hasUniqueInitializer())
|
return cast<GlobalVariable>(CE->getOperand(0))->hasUniqueInitializer();
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2360,12 +2354,9 @@ static bool EvaluateFunction(Function *F, Constant *&RetVal,
|
|||||||
// If we're evaluating a store through a bitcast, then we need
|
// If we're evaluating a store through a bitcast, then we need
|
||||||
// to pull the bitcast off the pointer type and push it onto the
|
// to pull the bitcast off the pointer type and push it onto the
|
||||||
// stored value.
|
// stored value.
|
||||||
Ptr = dyn_cast<Constant>(Ptr->getOperand(0));
|
Ptr = CE->getOperand(0);
|
||||||
if (!Ptr) return false;
|
|
||||||
|
|
||||||
const PointerType *Ty = dyn_cast<PointerType>(Ptr->getType());
|
const Type *NewTy=cast<PointerType>(Ptr->getType())->getElementType();
|
||||||
if (!Ty) return false;
|
|
||||||
const Type *NewTy = Ty->getElementType();
|
|
||||||
|
|
||||||
// A bitcast'd pointer implicitly points to the first field of a
|
// A bitcast'd pointer implicitly points to the first field of a
|
||||||
// struct. Insert implicity "gep @x, 0, 0, ..." until we get down
|
// struct. Insert implicity "gep @x, 0, 0, ..." until we get down
|
||||||
@ -2374,8 +2365,7 @@ static bool EvaluateFunction(Function *F, Constant *&RetVal,
|
|||||||
while (const StructType *STy = dyn_cast<StructType>(NewTy)) {
|
while (const StructType *STy = dyn_cast<StructType>(NewTy)) {
|
||||||
NewTy = STy->getTypeAtIndex(0U);
|
NewTy = STy->getTypeAtIndex(0U);
|
||||||
|
|
||||||
const IntegerType *IdxTy =
|
const IntegerType *IdxTy =IntegerType::get(NewTy->getContext(), 32);
|
||||||
IntegerType::get(NewTy->getContext(), 32);
|
|
||||||
Constant *IdxZero = ConstantInt::get(IdxTy, 0, false);
|
Constant *IdxZero = ConstantInt::get(IdxTy, 0, false);
|
||||||
Constant * const IdxList[] = {IdxZero, IdxZero};
|
Constant * const IdxList[] = {IdxZero, IdxZero};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user