mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 20:23:59 +00:00
Renamed inst_const_iterator -> const_inst_iterator
Renamed op_const_iterator -> const_op_iterator Renamed PointerType::getValueType() -> PointerType::getElementType() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1408 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -220,7 +220,7 @@ static bool PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
|
||||
// type.
|
||||
//
|
||||
if (!HasAddUse) {
|
||||
const Type *DestPointedTy = DestPTy->getValueType();
|
||||
const Type *DestPointedTy = DestPTy->getElementType();
|
||||
unsigned Depth = 1;
|
||||
const CompositeType *CurCTy = CTy;
|
||||
const Type *ElTy = 0;
|
||||
@ -313,12 +313,12 @@ static bool PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
|
||||
if (Value *CastSrc = CI->getOperand(0)) // CSPT = CastSrcPointerType
|
||||
if (PointerType *CSPT = dyn_cast<PointerType>(CastSrc->getType()))
|
||||
// convertable types?
|
||||
if (Val->getType()->isLosslesslyConvertableTo(CSPT->getValueType()) &&
|
||||
if (Val->getType()->isLosslesslyConvertableTo(CSPT->getElementType()) &&
|
||||
!SI->hasIndices()) { // No subscripts yet!
|
||||
PRINT_PEEPHOLE3("st-src-cast:in ", Pointer, Val, SI);
|
||||
|
||||
// Insert the new T cast instruction... stealing old T's name
|
||||
CastInst *NCI = new CastInst(Val, CSPT->getValueType(),
|
||||
CastInst *NCI = new CastInst(Val, CSPT->getElementType(),
|
||||
CI->getName());
|
||||
CI->setName("");
|
||||
BI = BB->getInstList().insert(BI, NCI)+1;
|
||||
@ -372,7 +372,7 @@ static bool PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
|
||||
if (CastInst *CI = dyn_cast<CastInst>(Pointer)) {
|
||||
Value *SrcVal = CI->getOperand(0);
|
||||
const PointerType *SrcTy = dyn_cast<PointerType>(SrcVal->getType());
|
||||
const Type *ElTy = SrcTy ? SrcTy->getValueType() : 0;
|
||||
const Type *ElTy = SrcTy ? SrcTy->getElementType() : 0;
|
||||
|
||||
// Make sure that nothing will be lost in the new cast...
|
||||
if (!LI->hasIndices() && SrcTy &&
|
||||
@ -445,7 +445,7 @@ static bool DoInsertArrayCast(Value *V, BasicBlock *BB,
|
||||
const PointerType *ThePtrType = dyn_cast<PointerType>(V->getType());
|
||||
if (!ThePtrType) return false;
|
||||
|
||||
const Type *ElTy = ThePtrType->getValueType();
|
||||
const Type *ElTy = ThePtrType->getElementType();
|
||||
if (isa<MethodType>(ElTy) || isa<ArrayType>(ElTy)) return false;
|
||||
|
||||
unsigned ElementSize = TD.getTypeSize(ElTy);
|
||||
@ -456,8 +456,8 @@ static bool DoInsertArrayCast(Value *V, BasicBlock *BB,
|
||||
switch (Inst->getOpcode()) {
|
||||
case Instruction::Cast: // There is already a cast instruction!
|
||||
if (const PointerType *PT = dyn_cast<const PointerType>(Inst->getType()))
|
||||
if (const ArrayType *AT = dyn_cast<const ArrayType>(PT->getValueType()))
|
||||
if (AT->getElementType() == ThePtrType->getValueType()) {
|
||||
if (const ArrayType *AT = dyn_cast<const ArrayType>(PT->getElementType()))
|
||||
if (AT->getElementType() == ThePtrType->getElementType()) {
|
||||
// Cast already exists! Don't mess around with it.
|
||||
return false; // No changes made to program though...
|
||||
}
|
||||
|
Reference in New Issue
Block a user