mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Replace all usages of Type::isPointerType with isa<PointerType>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2486 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d44023ecb7
commit
9b625030c8
@ -76,7 +76,7 @@ struct DefOne : public DefVal {
|
|||||||
// happen for values in the range of 0 to 127.
|
// happen for values in the range of 0 to 127.
|
||||||
//
|
//
|
||||||
static ConstantInt *getUnsignedConstant(uint64_t V, const Type *Ty) {
|
static ConstantInt *getUnsignedConstant(uint64_t V, const Type *Ty) {
|
||||||
if (Ty->isPointerType()) Ty = Type::ULongTy;
|
if (isa<PointerType>(Ty)) Ty = Type::ULongTy;
|
||||||
if (Ty->isSigned()) {
|
if (Ty->isSigned()) {
|
||||||
// If this value is not a valid unsigned value for this type, return null!
|
// If this value is not a valid unsigned value for this type, return null!
|
||||||
if (V > 127 && ((int64_t)V < 0 ||
|
if (V > 127 && ((int64_t)V < 0 ||
|
||||||
@ -320,7 +320,7 @@ ExprType analysis::ClassifyExpression(Value *Expr) {
|
|||||||
case Instruction::Cast: {
|
case Instruction::Cast: {
|
||||||
ExprType Src(ClassifyExpression(I->getOperand(0)));
|
ExprType Src(ClassifyExpression(I->getOperand(0)));
|
||||||
const Type *DestTy = I->getType();
|
const Type *DestTy = I->getType();
|
||||||
if (DestTy->isPointerType())
|
if (isa<PointerType>(DestTy))
|
||||||
DestTy = Type::ULongTy; // Pointer types are represented as ulong
|
DestTy = Type::ULongTy; // Pointer types are represented as ulong
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -57,7 +57,7 @@ bool FindUnsafePointerTypes::run(Module *Mod) {
|
|||||||
for (const_inst_iterator I = inst_begin(M), E = inst_end(M); I != E; ++I) {
|
for (const_inst_iterator I = inst_begin(M), E = inst_end(M); I != E; ++I) {
|
||||||
const Instruction *Inst = *I;
|
const Instruction *Inst = *I;
|
||||||
const Type *ITy = Inst->getType();
|
const Type *ITy = Inst->getType();
|
||||||
if (ITy->isPointerType() && !UnsafeTypes.count((PointerType*)ITy))
|
if (isa<PointerType>(ITy) && !UnsafeTypes.count((PointerType*)ITy))
|
||||||
if (!isSafeInstruction(Inst)) {
|
if (!isSafeInstruction(Inst)) {
|
||||||
UnsafeTypes.insert((PointerType*)ITy);
|
UnsafeTypes.insert((PointerType*)ITy);
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ InductionVariable::InductionVariable(PHINode *P, LoopInfo *LoopInfo) {
|
|||||||
|
|
||||||
// Okay, we have found an induction variable. Save the start and step values
|
// Okay, we have found an induction variable. Save the start and step values
|
||||||
const Type *ETy = Phi->getType();
|
const Type *ETy = Phi->getType();
|
||||||
if (ETy->isPointerType()) ETy = Type::ULongTy;
|
if (isa<PointerType>(ETy)) ETy = Type::ULongTy;
|
||||||
|
|
||||||
Start = (Value*)(E1.Offset ? E1.Offset : ConstantInt::get(ETy, 0));
|
Start = (Value*)(E1.Offset ? E1.Offset : ConstantInt::get(ETy, 0));
|
||||||
Step = (Value*)(E2.Offset ? E2.Offset : ConstantInt::get(ETy, 0));
|
Step = (Value*)(E2.Offset ? E2.Offset : ConstantInt::get(ETy, 0));
|
||||||
@ -132,7 +132,7 @@ InductionVariable::InductionVariable(PHINode *P, LoopInfo *LoopInfo) {
|
|||||||
StepE.Var != Phi) return;
|
StepE.Var != Phi) return;
|
||||||
|
|
||||||
const Type *ETy = Phi->getType();
|
const Type *ETy = Phi->getType();
|
||||||
if (ETy->isPointerType()) ETy = Type::ULongTy;
|
if (isa<PointerType>(ETy)) ETy = Type::ULongTy;
|
||||||
Step = (Value*)(StepE.Offset ? StepE.Offset : ConstantInt::get(ETy, 0));
|
Step = (Value*)(StepE.Offset ? StepE.Offset : ConstantInt::get(ETy, 0));
|
||||||
} else { // We were able to get a step value, simplify with expr analysis
|
} else { // We were able to get a step value, simplify with expr analysis
|
||||||
ExprType StepE = analysis::ClassifyExpression(Step);
|
ExprType StepE = analysis::ClassifyExpression(Step);
|
||||||
@ -145,7 +145,7 @@ InductionVariable::InductionVariable(PHINode *P, LoopInfo *LoopInfo) {
|
|||||||
else
|
else
|
||||||
Step = Constant::getNullValue(Step->getType());
|
Step = Constant::getNullValue(Step->getType());
|
||||||
const Type *ETy = Phi->getType();
|
const Type *ETy = Phi->getType();
|
||||||
if (ETy->isPointerType()) ETy = Type::ULongTy;
|
if (isa<PointerType>(ETy)) ETy = Type::ULongTy;
|
||||||
Step = (Value*)(StepE.Offset ? StepE.Offset : ConstantInt::get(ETy,0));
|
Step = (Value*)(StepE.Offset ? StepE.Offset : ConstantInt::get(ETy,0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -321,7 +321,7 @@ static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
|
|||||||
return ConstantFP::get(Ty, D.ConstPoolFP);
|
return ConstantFP::get(Ty, D.ConstPoolFP);
|
||||||
|
|
||||||
case ValID::ConstNullVal: // Is it a null value?
|
case ValID::ConstNullVal: // Is it a null value?
|
||||||
if (!Ty->isPointerType())
|
if (!isa<PointerType>(Ty))
|
||||||
ThrowException("Cannot create a a non pointer null!");
|
ThrowException("Cannot create a a non pointer null!");
|
||||||
return ConstantPointerNull::get(cast<PointerType>(Ty));
|
return ConstantPointerNull::get(cast<PointerType>(Ty));
|
||||||
|
|
||||||
@ -1549,14 +1549,14 @@ MemoryInst : MALLOC Types {
|
|||||||
delete $2;
|
delete $2;
|
||||||
}
|
}
|
||||||
| FREE ResolvedVal {
|
| FREE ResolvedVal {
|
||||||
if (!$2->getType()->isPointerType())
|
if (!isa<PointerType>($2->getType()))
|
||||||
ThrowException("Trying to free nonpointer type " +
|
ThrowException("Trying to free nonpointer type " +
|
||||||
$2->getType()->getDescription() + "!");
|
$2->getType()->getDescription() + "!");
|
||||||
$$ = new FreeInst($2);
|
$$ = new FreeInst($2);
|
||||||
}
|
}
|
||||||
|
|
||||||
| LOAD Types ValueRef IndexList {
|
| LOAD Types ValueRef IndexList {
|
||||||
if (!(*$2)->isPointerType())
|
if (!isa<PointerType>(*$2))
|
||||||
ThrowException("Can't load from nonpointer type: " +
|
ThrowException("Can't load from nonpointer type: " +
|
||||||
(*$2)->getDescription());
|
(*$2)->getDescription());
|
||||||
if (LoadInst::getIndexedType(*$2, *$4) == 0)
|
if (LoadInst::getIndexedType(*$2, *$4) == 0)
|
||||||
@ -1567,7 +1567,7 @@ MemoryInst : MALLOC Types {
|
|||||||
delete $2;
|
delete $2;
|
||||||
}
|
}
|
||||||
| STORE ResolvedVal ',' Types ValueRef IndexList {
|
| STORE ResolvedVal ',' Types ValueRef IndexList {
|
||||||
if (!(*$4)->isPointerType())
|
if (!isa<PointerType>(*$4))
|
||||||
ThrowException("Can't store to a nonpointer type: " +
|
ThrowException("Can't store to a nonpointer type: " +
|
||||||
(*$4)->getDescription());
|
(*$4)->getDescription());
|
||||||
const Type *ElTy = StoreInst::getIndexedType(*$4, *$6);
|
const Type *ElTy = StoreInst::getIndexedType(*$4, *$6);
|
||||||
@ -1580,7 +1580,7 @@ MemoryInst : MALLOC Types {
|
|||||||
delete $4; delete $6;
|
delete $4; delete $6;
|
||||||
}
|
}
|
||||||
| GETELEMENTPTR Types ValueRef IndexList {
|
| GETELEMENTPTR Types ValueRef IndexList {
|
||||||
if (!(*$2)->isPointerType())
|
if (!isa<PointerType>(*$2))
|
||||||
ThrowException("getelementptr insn requires pointer operand!");
|
ThrowException("getelementptr insn requires pointer operand!");
|
||||||
if (!GetElementPtrInst::getIndexedType(*$2, *$4, true))
|
if (!GetElementPtrInst::getIndexedType(*$2, *$4, true))
|
||||||
ThrowException("Can't get element ptr '" + (*$2)->getDescription()+ "'!");
|
ThrowException("Can't get element ptr '" + (*$2)->getDescription()+ "'!");
|
||||||
|
@ -345,7 +345,7 @@ bool BytecodeParser::ParseInstruction(const uchar *&Buf, const uchar *EndBuf,
|
|||||||
|
|
||||||
case Instruction::Free:
|
case Instruction::Free:
|
||||||
V = getValue(Raw.Ty, Raw.Arg1);
|
V = getValue(Raw.Ty, Raw.Arg1);
|
||||||
if (!V->getType()->isPointerType()) return failure(true);
|
if (!isa<PointerType>(V->getType())) return failure(true);
|
||||||
Res = new FreeInst(V);
|
Res = new FreeInst(V);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ bool BytecodeParser::ParseModuleGlobalInfo(const uchar *&Buf, const uchar *End,
|
|||||||
// VarType Fields: bit0 = isConstant, bit1 = hasInitializer,
|
// VarType Fields: bit0 = isConstant, bit1 = hasInitializer,
|
||||||
// bit2 = isInternal, bit3+ = slot#
|
// bit2 = isInternal, bit3+ = slot#
|
||||||
const Type *Ty = getType(VarType >> 3);
|
const Type *Ty = getType(VarType >> 3);
|
||||||
if (!Ty || !Ty->isPointerType()) {
|
if (!Ty || !isa<PointerType>(Ty)) {
|
||||||
Error = "Global not pointer type! Ty = " + Ty->getDescription();
|
Error = "Global not pointer type! Ty = " + Ty->getDescription();
|
||||||
return failure(true);
|
return failure(true);
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ void BytecodeWriter::processInstruction(const Instruction *I) {
|
|||||||
break;
|
break;
|
||||||
case Instruction::Store:
|
case Instruction::Store:
|
||||||
Ty = I->getOperand(1)->getType(); // Encode the pointer type...
|
Ty = I->getOperand(1)->getType(); // Encode the pointer type...
|
||||||
assert(Ty->isPointerType() && "Store to nonpointer type!?!?");
|
assert(isa<PointerType>(Ty) && "Store to nonpointer type!?!?");
|
||||||
break;
|
break;
|
||||||
default: // Otherwise use the default behavior...
|
default: // Otherwise use the default behavior...
|
||||||
Ty = NumOperands ? I->getOperand(0)->getType() : I->getType();
|
Ty = NumOperands ? I->getOperand(0)->getType() : I->getType();
|
||||||
|
@ -277,7 +277,7 @@ ChooseRegOrImmed(Value* val,
|
|||||||
|
|
||||||
// Otherwise it needs to be an integer or a NULL pointer
|
// Otherwise it needs to be an integer or a NULL pointer
|
||||||
if (! CPV->getType()->isIntegral() &&
|
if (! CPV->getType()->isIntegral() &&
|
||||||
! (CPV->getType()->isPointerType() &&
|
! (isa<PointerType>(CPV->getType()) &&
|
||||||
CPV->isNullValue()))
|
CPV->isNullValue()))
|
||||||
return opType;
|
return opType;
|
||||||
|
|
||||||
@ -287,7 +287,7 @@ ChooseRegOrImmed(Value* val,
|
|||||||
// unsigned constants to signed).
|
// unsigned constants to signed).
|
||||||
//
|
//
|
||||||
int64_t intValue;
|
int64_t intValue;
|
||||||
if (CPV->getType()->isPointerType())
|
if (isa<PointerType>(CPV->getType()))
|
||||||
{
|
{
|
||||||
intValue = 0;
|
intValue = 0;
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ ChooseRegOrImmed(Value* val,
|
|||||||
|
|
||||||
// Otherwise it needs to be an integer or a NULL pointer
|
// Otherwise it needs to be an integer or a NULL pointer
|
||||||
if (! CPV->getType()->isIntegral() &&
|
if (! CPV->getType()->isIntegral() &&
|
||||||
! (CPV->getType()->isPointerType() &&
|
! (isa<PointerType>(CPV->getType()) &&
|
||||||
CPV->isNullValue()))
|
CPV->isNullValue()))
|
||||||
return opType;
|
return opType;
|
||||||
|
|
||||||
@ -287,7 +287,7 @@ ChooseRegOrImmed(Value* val,
|
|||||||
// unsigned constants to signed).
|
// unsigned constants to signed).
|
||||||
//
|
//
|
||||||
int64_t intValue;
|
int64_t intValue;
|
||||||
if (CPV->getType()->isPointerType())
|
if (isa<PointerType>(CPV->getType()))
|
||||||
{
|
{
|
||||||
intValue = 0;
|
intValue = 0;
|
||||||
}
|
}
|
||||||
|
@ -235,9 +235,9 @@ UltraSparcInstrInfo::CreateCodeToCopyIntToFloat(Function *F,
|
|||||||
std::vector<TmpInstruction*>& tempVec,
|
std::vector<TmpInstruction*>& tempVec,
|
||||||
TargetMachine& target) const
|
TargetMachine& target) const
|
||||||
{
|
{
|
||||||
assert((val->getType()->isIntegral() || val->getType()->isPointerType())
|
assert((val->getType()->isIntegral() || isa<PointerType>(val->getType()))
|
||||||
&& "Source type must be integral");
|
&& "Source type must be integral");
|
||||||
assert((dest->getType() == Type::FloatTy || dest->getType() == Type::DoubleTy)
|
assert(dest->getType()->isFloatingPoint()
|
||||||
&& "Dest type must be float/double");
|
&& "Dest type must be float/double");
|
||||||
|
|
||||||
MachineCodeForMethod& mcinfo = MachineCodeForMethod::get(F);
|
MachineCodeForMethod& mcinfo = MachineCodeForMethod::get(F);
|
||||||
@ -279,9 +279,9 @@ UltraSparcInstrInfo::CreateCodeToCopyFloatToInt(Function *F,
|
|||||||
std::vector<TmpInstruction*>& tempVec,
|
std::vector<TmpInstruction*>& tempVec,
|
||||||
TargetMachine& target) const
|
TargetMachine& target) const
|
||||||
{
|
{
|
||||||
assert((val->getType() ==Type::FloatTy || val->getType() ==Type::DoubleTy)
|
assert(val->getType()->isFloatingPoint()
|
||||||
&& "Source type must be float/double");
|
&& "Source type must be float/double");
|
||||||
assert((dest->getType()->isIntegral() || dest->getType()->isPointerType())
|
assert((dest->getType()->isIntegral() || isa<PointerType>(dest->getType()))
|
||||||
&& "Dest type must be integral");
|
&& "Dest type must be integral");
|
||||||
|
|
||||||
MachineCodeForMethod& mcinfo = MachineCodeForMethod::get(F);
|
MachineCodeForMethod& mcinfo = MachineCodeForMethod::get(F);
|
||||||
|
@ -176,9 +176,7 @@ ChooseBccInstruction(const InstructionNode* instrNode,
|
|||||||
BinaryOperator* setCCInstr = (BinaryOperator*) setCCNode->getInstruction();
|
BinaryOperator* setCCInstr = (BinaryOperator*) setCCNode->getInstruction();
|
||||||
const Type* setCCType = setCCInstr->getOperand(0)->getType();
|
const Type* setCCType = setCCInstr->getOperand(0)->getType();
|
||||||
|
|
||||||
isFPBranch = (setCCType == Type::FloatTy || setCCType == Type::DoubleTy);
|
if (setCCType->isFloatingPoint())
|
||||||
|
|
||||||
if (isFPBranch)
|
|
||||||
return ChooseBFpccInstruction(instrNode, setCCInstr);
|
return ChooseBFpccInstruction(instrNode, setCCInstr);
|
||||||
else
|
else
|
||||||
return ChooseBpccInstruction(instrNode, setCCInstr);
|
return ChooseBpccInstruction(instrNode, setCCInstr);
|
||||||
@ -387,10 +385,8 @@ CreateAddConstInstruction(const InstructionNode* instrNode)
|
|||||||
//
|
//
|
||||||
const Type* resultType = instrNode->getInstruction()->getType();
|
const Type* resultType = instrNode->getInstruction()->getType();
|
||||||
|
|
||||||
if (resultType == Type::FloatTy ||
|
if (ConstantFP *FPC = dyn_cast<ConstantFP>(constOp)) {
|
||||||
resultType == Type::DoubleTy)
|
double dval = FPC->getValue();
|
||||||
{
|
|
||||||
double dval = cast<ConstantFP>(constOp)->getValue();
|
|
||||||
if (dval == 0.0)
|
if (dval == 0.0)
|
||||||
minstr = CreateMovFloatInstruction(instrNode, resultType);
|
minstr = CreateMovFloatInstruction(instrNode, resultType);
|
||||||
}
|
}
|
||||||
@ -404,8 +400,7 @@ ChooseSubInstructionByType(const Type* resultType)
|
|||||||
{
|
{
|
||||||
MachineOpCode opCode = INVALID_OPCODE;
|
MachineOpCode opCode = INVALID_OPCODE;
|
||||||
|
|
||||||
if (resultType->isIntegral() ||
|
if (resultType->isIntegral() || isa<PointerType>(resultType))
|
||||||
resultType->isPointerType())
|
|
||||||
{
|
{
|
||||||
opCode = SUB;
|
opCode = SUB;
|
||||||
}
|
}
|
||||||
@ -435,13 +430,11 @@ CreateSubConstInstruction(const InstructionNode* instrNode)
|
|||||||
//
|
//
|
||||||
const Type* resultType = instrNode->getInstruction()->getType();
|
const Type* resultType = instrNode->getInstruction()->getType();
|
||||||
|
|
||||||
if (resultType == Type::FloatTy ||
|
if (ConstantFP *FPC = dyn_cast<ConstantFP>(constOp)) {
|
||||||
resultType == Type::DoubleTy)
|
double dval = FPC->getValue();
|
||||||
{
|
if (dval == 0.0)
|
||||||
double dval = cast<ConstantFP>(constOp)->getValue();
|
minstr = CreateMovFloatInstruction(instrNode, resultType);
|
||||||
if (dval == 0.0)
|
}
|
||||||
minstr = CreateMovFloatInstruction(instrNode, resultType);
|
|
||||||
}
|
|
||||||
|
|
||||||
return minstr;
|
return minstr;
|
||||||
}
|
}
|
||||||
@ -537,7 +530,7 @@ CreateMulConstInstruction(const TargetMachine &target,
|
|||||||
//
|
//
|
||||||
const Type* resultType = destVal->getType();
|
const Type* resultType = destVal->getType();
|
||||||
|
|
||||||
if (resultType->isIntegral() || resultType->isPointerType())
|
if (resultType->isIntegral() || isa<PointerType>(resultType))
|
||||||
{
|
{
|
||||||
unsigned pow;
|
unsigned pow;
|
||||||
bool isValidConst;
|
bool isValidConst;
|
||||||
@ -583,10 +576,9 @@ CreateMulConstInstruction(const TargetMachine &target,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (resultType == Type::FloatTy ||
|
if (ConstantFP *FPC = dyn_cast<ConstantFP>(constOp))
|
||||||
resultType == Type::DoubleTy)
|
|
||||||
{
|
{
|
||||||
double dval = cast<ConstantFP>(constOp)->getValue();
|
double dval = FPC->getValue();
|
||||||
if (fabs(dval) == 1)
|
if (fabs(dval) == 1)
|
||||||
{
|
{
|
||||||
bool needNeg = (dval < 0);
|
bool needNeg = (dval < 0);
|
||||||
@ -771,10 +763,9 @@ CreateDivConstInstruction(TargetMachine &target,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (resultType == Type::FloatTy ||
|
if (ConstantFP *FPC = dyn_cast<ConstantFP>(constOp))
|
||||||
resultType == Type::DoubleTy)
|
|
||||||
{
|
{
|
||||||
double dval = cast<ConstantFP>(constOp)->getValue();
|
double dval = FPC->getValue();
|
||||||
if (fabs(dval) == 1)
|
if (fabs(dval) == 1)
|
||||||
{
|
{
|
||||||
bool needNeg = (dval < 0);
|
bool needNeg = (dval < 0);
|
||||||
@ -987,7 +978,7 @@ SetMemOperands_Internal(vector<MachineInstr*>& mvec,
|
|||||||
|
|
||||||
// This is a real structure reference if the ptr target is a
|
// This is a real structure reference if the ptr target is a
|
||||||
// structure type, and the first offset is [0] (eliminate that offset).
|
// structure type, and the first offset is [0] (eliminate that offset).
|
||||||
if (firstIndexIsZero && ptrType->getElementType()->isStructType())
|
if (firstIndexIsZero && isa<StructType>(ptrType->getElementType()))
|
||||||
{
|
{
|
||||||
// Compute the offset value using the index vector. Create a
|
// Compute the offset value using the index vector. Create a
|
||||||
// virtual reg. for it since it may not fit in the immed field.
|
// virtual reg. for it since it may not fit in the immed field.
|
||||||
@ -1373,7 +1364,7 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
|
|||||||
bool isValidConst;
|
bool isValidConst;
|
||||||
|
|
||||||
if ((constVal->getType()->isIntegral()
|
if ((constVal->getType()->isIntegral()
|
||||||
|| constVal->getType()->isPointerType())
|
|| isa<PointerType>(constVal->getType()))
|
||||||
&& GetConstantValueAsSignedInt(constVal, isValidConst) == 0
|
&& GetConstantValueAsSignedInt(constVal, isValidConst) == 0
|
||||||
&& isValidConst)
|
&& isValidConst)
|
||||||
{
|
{
|
||||||
@ -1519,7 +1510,7 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
|
|||||||
case 22: // reg: ToBoolTy(reg):
|
case 22: // reg: ToBoolTy(reg):
|
||||||
{
|
{
|
||||||
const Type* opType = subtreeRoot->leftChild()->getValue()->getType();
|
const Type* opType = subtreeRoot->leftChild()->getValue()->getType();
|
||||||
assert(opType->isIntegral() || opType->isPointerType()
|
assert(opType->isIntegral() || isa<PointerType>(opType)
|
||||||
|| opType == Type::BoolTy);
|
|| opType == Type::BoolTy);
|
||||||
forwardOperandNum = 0; // forward first operand to user
|
forwardOperandNum = 0; // forward first operand to user
|
||||||
break;
|
break;
|
||||||
@ -1532,7 +1523,7 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
|
|||||||
{
|
{
|
||||||
const Type* opType = subtreeRoot->leftChild()->getValue()->getType();
|
const Type* opType = subtreeRoot->leftChild()->getValue()->getType();
|
||||||
assert(opType->isIntegral() ||
|
assert(opType->isIntegral() ||
|
||||||
opType->isPointerType() ||
|
isa<PointerType>(opType) ||
|
||||||
opType == Type::BoolTy && "Cast is illegal for other types");
|
opType == Type::BoolTy && "Cast is illegal for other types");
|
||||||
forwardOperandNum = 0; // forward first operand to user
|
forwardOperandNum = 0; // forward first operand to user
|
||||||
break;
|
break;
|
||||||
@ -1545,7 +1536,7 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
|
|||||||
{
|
{
|
||||||
const Type* opType = subtreeRoot->leftChild()->getValue()->getType();
|
const Type* opType = subtreeRoot->leftChild()->getValue()->getType();
|
||||||
if (opType->isIntegral()
|
if (opType->isIntegral()
|
||||||
|| opType->isPointerType()
|
|| isa<PointerType>(opType)
|
||||||
|| opType == Type::BoolTy)
|
|| opType == Type::BoolTy)
|
||||||
{
|
{
|
||||||
forwardOperandNum = 0; // forward first operand to user
|
forwardOperandNum = 0; // forward first operand to user
|
||||||
@ -1559,7 +1550,7 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
|
|||||||
Value* destForCast;
|
Value* destForCast;
|
||||||
vector<MachineInstr*> minstrVec;
|
vector<MachineInstr*> minstrVec;
|
||||||
|
|
||||||
if (opType == Type::FloatTy || opType == Type::DoubleTy)
|
if (opType->isFloatingPoint())
|
||||||
{
|
{
|
||||||
// Create a temporary to represent the INT register
|
// Create a temporary to represent the INT register
|
||||||
// into which the FP value will be copied via memory.
|
// into which the FP value will be copied via memory.
|
||||||
@ -1629,7 +1620,7 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
|
|||||||
Instruction *dest = subtreeRoot->getInstruction();
|
Instruction *dest = subtreeRoot->getInstruction();
|
||||||
Value* srcForCast;
|
Value* srcForCast;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
if (opType != Type::FloatTy && opType != Type::DoubleTy)
|
if (opType->isFloatingPoint())
|
||||||
{
|
{
|
||||||
// Create a temporary to represent the FP register
|
// Create a temporary to represent the FP register
|
||||||
// into which the integer will be copied via memory.
|
// into which the integer will be copied via memory.
|
||||||
@ -1872,12 +1863,11 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
|
|||||||
// a FP condition code register.
|
// a FP condition code register.
|
||||||
//
|
//
|
||||||
Value* leftVal = subtreeRoot->leftChild()->getValue();
|
Value* leftVal = subtreeRoot->leftChild()->getValue();
|
||||||
bool isFPCompare = (leftVal->getType() == Type::FloatTy ||
|
bool isFPCompare = leftVal->getType()->isFloatingPoint();
|
||||||
leftVal->getType() == Type::DoubleTy);
|
|
||||||
|
|
||||||
TmpInstruction* tmpForCC = GetTmpForCC(setCCInstr,
|
TmpInstruction* tmpForCC = GetTmpForCC(setCCInstr,
|
||||||
setCCInstr->getParent()->getParent(),
|
setCCInstr->getParent()->getParent(),
|
||||||
isFPCompare? Type::FloatTy : Type::IntTy);
|
isFPCompare ? Type::FloatTy : Type::IntTy);
|
||||||
MachineCodeForInstruction::get(setCCInstr).addTemp(tmpForCC);
|
MachineCodeForInstruction::get(setCCInstr).addTemp(tmpForCC);
|
||||||
|
|
||||||
if (! isFPCompare)
|
if (! isFPCompare)
|
||||||
@ -2104,8 +2094,7 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
|
|||||||
case 62: // reg: Shl(reg, reg)
|
case 62: // reg: Shl(reg, reg)
|
||||||
{ const Type* opType = subtreeRoot->leftChild()->getValue()->getType();
|
{ const Type* opType = subtreeRoot->leftChild()->getValue()->getType();
|
||||||
assert(opType->isIntegral()
|
assert(opType->isIntegral()
|
||||||
|| opType == Type::BoolTy
|
|| isa<PointerType>(opType)&& "Shl unsupported for other types");
|
||||||
|| opType->isPointerType()&& "Shl unsupported for other types");
|
|
||||||
mvec.push_back(new MachineInstr((opType == Type::LongTy)? SLLX : SLL));
|
mvec.push_back(new MachineInstr((opType == Type::LongTy)? SLLX : SLL));
|
||||||
Set3OperandsFromInstr(mvec.back(), subtreeRoot, target);
|
Set3OperandsFromInstr(mvec.back(), subtreeRoot, target);
|
||||||
break;
|
break;
|
||||||
@ -2114,8 +2103,7 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
|
|||||||
case 63: // reg: Shr(reg, reg)
|
case 63: // reg: Shr(reg, reg)
|
||||||
{ const Type* opType = subtreeRoot->leftChild()->getValue()->getType();
|
{ const Type* opType = subtreeRoot->leftChild()->getValue()->getType();
|
||||||
assert(opType->isIntegral()
|
assert(opType->isIntegral()
|
||||||
|| opType == Type::BoolTy
|
|| isa<PointerType>(opType) &&"Shr unsupported for other types");
|
||||||
|| opType->isPointerType() &&"Shr unsupported for other types");
|
|
||||||
mvec.push_back(new MachineInstr((opType->isSigned()
|
mvec.push_back(new MachineInstr((opType->isSigned()
|
||||||
? ((opType == Type::LongTy)? SRAX : SRA)
|
? ((opType == Type::LongTy)? SRAX : SRA)
|
||||||
: ((opType == Type::LongTy)? SRLX : SRL))));
|
: ((opType == Type::LongTy)? SRLX : SRL))));
|
||||||
|
@ -61,10 +61,10 @@ Annotation *TargetData::TypeAnFactory(AnnotationID AID, const Annotable *T,
|
|||||||
void *D) {
|
void *D) {
|
||||||
const TargetData &TD = *(const TargetData*)D;
|
const TargetData &TD = *(const TargetData*)D;
|
||||||
assert(AID == TD.AID && "Target data annotation ID mismatch!");
|
assert(AID == TD.AID && "Target data annotation ID mismatch!");
|
||||||
const Type *Ty = cast<const Type>((const Value *)T);
|
const Type *Ty = cast<Type>((const Value *)T);
|
||||||
assert(Ty->isStructType() &&
|
assert(isa<StructType>(Ty) &&
|
||||||
"Can only create StructLayout annotation on structs!");
|
"Can only create StructLayout annotation on structs!");
|
||||||
return new StructLayout((const StructType *)Ty, TD);
|
return new StructLayout(cast<StructType>(Ty), TD);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@ -16,7 +16,7 @@ static inline const Type *checkType(const Type *Ty) {
|
|||||||
AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
|
AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
|
||||||
const std::string &Name = "")
|
const std::string &Name = "")
|
||||||
: Instruction(Ty, iTy, Name) {
|
: Instruction(Ty, iTy, Name) {
|
||||||
assert(Ty->isPointerType() && "Can't allocate a non pointer type!");
|
assert(isa<PointerType>(Ty) && "Can't allocate a non pointer type!");
|
||||||
|
|
||||||
// ArraySize defaults to 1.
|
// ArraySize defaults to 1.
|
||||||
if (!ArraySize) ArraySize = ConstantUInt::get(Type::UIntTy, 1);
|
if (!ArraySize) ArraySize = ConstantUInt::get(Type::UIntTy, 1);
|
||||||
@ -51,7 +51,7 @@ const Type *AllocationInst::getAllocatedType() const {
|
|||||||
const Type* MemAccessInst::getIndexedType(const Type *Ptr,
|
const Type* MemAccessInst::getIndexedType(const Type *Ptr,
|
||||||
const std::vector<Value*> &Idx,
|
const std::vector<Value*> &Idx,
|
||||||
bool AllowCompositeLeaf = false) {
|
bool AllowCompositeLeaf = false) {
|
||||||
if (!Ptr->isPointerType()) return 0; // Type isn't a pointer type!
|
if (!isa<PointerType>(Ptr)) return 0; // Type isn't a pointer type!
|
||||||
|
|
||||||
// Handle the special case of the empty set index set...
|
// Handle the special case of the empty set index set...
|
||||||
if (Idx.empty()) return cast<PointerType>(Ptr)->getElementType();
|
if (Idx.empty()) return cast<PointerType>(Ptr)->getElementType();
|
||||||
@ -143,7 +143,7 @@ GetElementPtrInst::GetElementPtrInst(Value *Ptr, const std::vector<Value*> &Idx,
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
FreeInst::FreeInst(Value *Ptr) : Instruction(Type::VoidTy, Free, "") {
|
FreeInst::FreeInst(Value *Ptr) : Instruction(Type::VoidTy, Free, "") {
|
||||||
assert(Ptr->getType()->isPointerType() && "Can't free nonpointer!");
|
assert(isa<PointerType>(Ptr->getType()) && "Can't free nonpointer!");
|
||||||
Operands.reserve(1);
|
Operands.reserve(1);
|
||||||
Operands.push_back(Use(Ptr, this));
|
Operands.push_back(Use(Ptr, this));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user