mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 06:29:05 +00:00
Change inferred cast creation calls to more specific cast creations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32460 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -446,7 +446,11 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) {
|
|||||||
// integer type. This promotes constant folding and simplifies this code.
|
// integer type. This promotes constant folding and simplifies this code.
|
||||||
if (isa<PointerType>(Ty)) {
|
if (isa<PointerType>(Ty)) {
|
||||||
const Type *IntPtrTy = TD->getIntPtrType();
|
const Type *IntPtrTy = TD->getIntPtrType();
|
||||||
Op = ConstantExpr::getCast(Op, IntPtrTy);
|
Instruction::CastOps opcode = Instruction::CastOps(CE->getOpcode());
|
||||||
|
if (opcode == Instruction::IntToPtr)
|
||||||
|
Op = ConstantExpr::getIntegerCast(Op, IntPtrTy, false /*ZExt*/);
|
||||||
|
else
|
||||||
|
Op = ConstantExpr::getCast(Instruction::PtrToInt, Op, IntPtrTy);
|
||||||
return EmitConstantValueOnly(Op);
|
return EmitConstantValueOnly(Op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -239,7 +239,7 @@ static Value *LowerCTPOP(Value *V, Instruction *IP) {
|
|||||||
|
|
||||||
for (unsigned i = 1, ct = 0; i != BitSize; i <<= 1, ++ct) {
|
for (unsigned i = 1, ct = 0; i != BitSize; i <<= 1, ++ct) {
|
||||||
Value *MaskCst =
|
Value *MaskCst =
|
||||||
ConstantExpr::getCast(ConstantInt::get(Type::ULongTy, MaskValues[ct]),
|
ConstantExpr::getTruncOrBitCast(ConstantInt::get(Type::ULongTy, MaskValues[ct]),
|
||||||
V->getType());
|
V->getType());
|
||||||
Value *LHS = BinaryOperator::createAnd(V, MaskCst, "cppop.and1", IP);
|
Value *LHS = BinaryOperator::createAnd(V, MaskCst, "cppop.and1", IP);
|
||||||
Value *VShift = new ShiftInst(Instruction::LShr, V,
|
Value *VShift = new ShiftInst(Instruction::LShr, V,
|
||||||
|
@@ -292,7 +292,7 @@ public:
|
|||||||
|
|
||||||
if (GV) {
|
if (GV) {
|
||||||
// Set to pointer to global.
|
// Set to pointer to global.
|
||||||
Elements.push_back(ConstantExpr::getCast(GV, EmptyTy));
|
Elements.push_back(ConstantExpr::getBitCast(GV, EmptyTy));
|
||||||
} else {
|
} else {
|
||||||
// Use NULL.
|
// Use NULL.
|
||||||
Elements.push_back(ConstantPointerNull::get(EmptyTy));
|
Elements.push_back(ConstantPointerNull::get(EmptyTy));
|
||||||
@@ -301,7 +301,7 @@ public:
|
|||||||
virtual void Apply(GlobalVariable *&Field) {
|
virtual void Apply(GlobalVariable *&Field) {
|
||||||
const PointerType *EmptyTy = SR.getEmptyStructPtrType();
|
const PointerType *EmptyTy = SR.getEmptyStructPtrType();
|
||||||
if (Field) {
|
if (Field) {
|
||||||
Elements.push_back(ConstantExpr::getCast(Field, EmptyTy));
|
Elements.push_back(ConstantExpr::getBitCast(Field, EmptyTy));
|
||||||
} else {
|
} else {
|
||||||
Elements.push_back(ConstantPointerNull::get(EmptyTy));
|
Elements.push_back(ConstantPointerNull::get(EmptyTy));
|
||||||
}
|
}
|
||||||
@@ -315,7 +315,7 @@ public:
|
|||||||
for (unsigned i = 0, N = Field.size(); i < N; ++i) {
|
for (unsigned i = 0, N = Field.size(); i < N; ++i) {
|
||||||
if (DebugInfoDesc *Element = Field[i]) {
|
if (DebugInfoDesc *Element = Field[i]) {
|
||||||
GlobalVariable *GVE = SR.Serialize(Element);
|
GlobalVariable *GVE = SR.Serialize(Element);
|
||||||
Constant *CE = ConstantExpr::getCast(GVE, EmptyTy);
|
Constant *CE = ConstantExpr::getBitCast(GVE, EmptyTy);
|
||||||
ArrayElements.push_back(cast<Constant>(CE));
|
ArrayElements.push_back(cast<Constant>(CE));
|
||||||
} else {
|
} else {
|
||||||
ArrayElements.push_back(ConstantPointerNull::get(EmptyTy));
|
ArrayElements.push_back(ConstantPointerNull::get(EmptyTy));
|
||||||
@@ -328,7 +328,7 @@ public:
|
|||||||
CA, "llvm.dbg.array",
|
CA, "llvm.dbg.array",
|
||||||
SR.getModule());
|
SR.getModule());
|
||||||
CAGV->setSection("llvm.metadata");
|
CAGV->setSection("llvm.metadata");
|
||||||
Constant *CAE = ConstantExpr::getCast(CAGV, EmptyTy);
|
Constant *CAE = ConstantExpr::getBitCast(CAGV, EmptyTy);
|
||||||
Elements.push_back(CAE);
|
Elements.push_back(CAE);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1323,7 +1323,7 @@ Constant *DISerializer::getString(const std::string &String) {
|
|||||||
ConstStr, "str", M);
|
ConstStr, "str", M);
|
||||||
StrGV->setSection("llvm.metadata");
|
StrGV->setSection("llvm.metadata");
|
||||||
// Convert to generic string pointer.
|
// Convert to generic string pointer.
|
||||||
Slot = ConstantExpr::getCast(StrGV, getStrPtrType());
|
Slot = ConstantExpr::getBitCast(StrGV, getStrPtrType());
|
||||||
}
|
}
|
||||||
return Slot;
|
return Slot;
|
||||||
|
|
||||||
|
@@ -790,7 +790,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
|
|||||||
// Only do this if the target has a native EXTLOAD instruction from
|
// Only do this if the target has a native EXTLOAD instruction from
|
||||||
// f32.
|
// f32.
|
||||||
TLI.isLoadXLegal(ISD::EXTLOAD, MVT::f32)) {
|
TLI.isLoadXLegal(ISD::EXTLOAD, MVT::f32)) {
|
||||||
LLVMC = cast<ConstantFP>(ConstantExpr::getCast(LLVMC, Type::FloatTy));
|
LLVMC = cast<ConstantFP>(ConstantExpr::getFPCast(LLVMC, Type::FloatTy));
|
||||||
VT = MVT::f32;
|
VT = MVT::f32;
|
||||||
Extend = true;
|
Extend = true;
|
||||||
}
|
}
|
||||||
|
@@ -212,7 +212,7 @@ GenericValue JIT::runFunction(Function *F,
|
|||||||
} else {
|
} else {
|
||||||
C = ConstantInt::get(Type::LongTy, (intptr_t)ArgPtr);
|
C = ConstantInt::get(Type::LongTy, (intptr_t)ArgPtr);
|
||||||
}
|
}
|
||||||
C = ConstantExpr::getCast(C, ArgTy); // Cast the integer to pointer
|
C = ConstantExpr::getIntToPtr(C, ArgTy); // Cast the integer to pointer
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Args.push_back(C);
|
Args.push_back(C);
|
||||||
|
Reference in New Issue
Block a user