mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
- Renamed Type::isIntegral() to Type::isInteger()
- Added new method Type::isIntegral() that is the same as isInteger, but also accepts bool. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3574 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -72,12 +72,12 @@ GetConstantValueAsUnsignedInt(const Value *V,
|
||||
isValidConstant = true;
|
||||
|
||||
if (isa<Constant>(V))
|
||||
if (V->getType() == Type::BoolTy)
|
||||
return (int64_t) cast<ConstantBool>(V)->getValue();
|
||||
else if (V->getType()->isIntegral())
|
||||
return (V->getType()->isUnsigned()
|
||||
? cast<ConstantUInt>(V)->getValue()
|
||||
: (uint64_t) cast<ConstantSInt>(V)->getValue());
|
||||
if (const ConstantBool *CB = dyn_cast<ConstantBool>(V))
|
||||
return (int64_t)CB->getValue();
|
||||
else if (const ConstantSInt *CS = dyn_cast<ConstantSInt>(V))
|
||||
return (uint64_t)CS->getValue();
|
||||
else if (const ConstantUInt *CU = dyn_cast<ConstantUInt>(V))
|
||||
return CU->getValue();
|
||||
|
||||
isValidConstant = false;
|
||||
return 0;
|
||||
@@ -343,7 +343,7 @@ ChooseRegOrImmed(Value* val,
|
||||
}
|
||||
|
||||
// Otherwise it needs to be an integer or a NULL pointer
|
||||
if (! CPV->getType()->isIntegral() &&
|
||||
if (! CPV->getType()->isInteger() &&
|
||||
! (isa<PointerType>(CPV->getType()) &&
|
||||
CPV->isNullValue()))
|
||||
return opType;
|
||||
|
@@ -308,7 +308,7 @@ UltraSparcInstrInfo::CreateCodeToLoadConst(const TargetMachine& target,
|
||||
mcfi.addTemp(tmpReg);
|
||||
CreateSETXLabel(target, val, tmpReg, dest, mvec);
|
||||
}
|
||||
else if (valType->isIntegral() || valType == Type::BoolTy)
|
||||
else if (valType->isIntegral())
|
||||
{
|
||||
bool isValidConstant;
|
||||
unsigned opSize = target.DataLayout.getTypeSize(val->getType());
|
||||
@@ -396,8 +396,8 @@ UltraSparcInstrInfo::CreateCodeToCopyIntToFloat(const TargetMachine& target,
|
||||
vector<MachineInstr*>& mvec,
|
||||
MachineCodeForInstruction& mcfi) const
|
||||
{
|
||||
assert((val->getType()->isIntegral() || isa<PointerType>(val->getType()))
|
||||
&& "Source type must be integral");
|
||||
assert((val->getType()->isInteger() || isa<PointerType>(val->getType()))
|
||||
&& "Source type must be integer or pointer");
|
||||
assert(dest->getType()->isFloatingPoint()
|
||||
&& "Dest type must be float/double");
|
||||
|
||||
@@ -445,8 +445,8 @@ UltraSparcInstrInfo::CreateCodeToCopyFloatToInt(const TargetMachine& target,
|
||||
const Type* destTy = dest->getType();
|
||||
|
||||
assert(opTy->isFloatingPoint() && "Source type must be float/double");
|
||||
assert((destTy->isIntegral() || isa<PointerType>(destTy))
|
||||
&& "Dest type must be integral");
|
||||
assert((destTy->isInteger() || isa<PointerType>(destTy))
|
||||
&& "Dest type must be integer or pointer");
|
||||
|
||||
int offset = MachineCodeForMethod::get(F).allocateLocalVar(target, val);
|
||||
|
||||
|
@@ -396,7 +396,7 @@ ChooseSubInstructionByType(const Type* resultType)
|
||||
{
|
||||
MachineOpCode opCode = INVALID_OPCODE;
|
||||
|
||||
if (resultType->isIntegral() || isa<PointerType>(resultType))
|
||||
if (resultType->isInteger() || isa<PointerType>(resultType))
|
||||
{
|
||||
opCode = SUB;
|
||||
}
|
||||
@@ -474,7 +474,7 @@ ChooseMulInstructionByType(const Type* resultType)
|
||||
{
|
||||
MachineOpCode opCode = INVALID_OPCODE;
|
||||
|
||||
if (resultType->isIntegral())
|
||||
if (resultType->isInteger())
|
||||
opCode = MULX;
|
||||
else
|
||||
switch(resultType->getPrimitiveID())
|
||||
@@ -577,7 +577,7 @@ CreateMulConstInstruction(const TargetMachine &target, Function* F,
|
||||
//
|
||||
const Type* resultType = destVal->getType();
|
||||
|
||||
if (resultType->isIntegral() || isa<PointerType>(resultType))
|
||||
if (resultType->isInteger() || isa<PointerType>(resultType))
|
||||
{
|
||||
bool isValidConst;
|
||||
int64_t C = GetConstantValueAsSignedInt(constOp, isValidConst);
|
||||
@@ -719,7 +719,7 @@ ChooseDivInstruction(TargetMachine &target,
|
||||
|
||||
const Type* resultType = instrNode->getInstruction()->getType();
|
||||
|
||||
if (resultType->isIntegral())
|
||||
if (resultType->isInteger())
|
||||
opCode = resultType->isSigned()? SDIVX : UDIVX;
|
||||
else
|
||||
switch(resultType->getPrimitiveID())
|
||||
@@ -752,7 +752,7 @@ CreateDivConstInstruction(TargetMachine &target,
|
||||
//
|
||||
const Type* resultType = instrNode->getInstruction()->getType();
|
||||
|
||||
if (resultType->isIntegral())
|
||||
if (resultType->isInteger())
|
||||
{
|
||||
unsigned pow;
|
||||
bool isValidConst;
|
||||
@@ -1296,7 +1296,7 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
|
||||
Constant *constVal = cast<Constant>(constNode->getValue());
|
||||
bool isValidConst;
|
||||
|
||||
if ((constVal->getType()->isIntegral()
|
||||
if ((constVal->getType()->isInteger()
|
||||
|| isa<PointerType>(constVal->getType()))
|
||||
&& GetConstantValueAsSignedInt(constVal, isValidConst) == 0
|
||||
&& isValidConst)
|
||||
@@ -1432,8 +1432,7 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
|
||||
case 22: // reg: ToBoolTy(reg):
|
||||
{
|
||||
const Type* opType = subtreeRoot->leftChild()->getValue()->getType();
|
||||
assert(opType->isIntegral() || isa<PointerType>(opType)
|
||||
|| opType == Type::BoolTy);
|
||||
assert(opType->isIntegral() || isa<PointerType>(opType));
|
||||
forwardOperandNum = 0; // forward first operand to user
|
||||
break;
|
||||
}
|
||||
@@ -1446,9 +1445,7 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
|
||||
Instruction* destI = subtreeRoot->getInstruction();
|
||||
Value* opVal = subtreeRoot->leftChild()->getValue();
|
||||
const Type* opType = subtreeRoot->leftChild()->getValue()->getType();
|
||||
if (opType->isIntegral()
|
||||
|| isa<PointerType>(opType)
|
||||
|| opType == Type::BoolTy)
|
||||
if (opType->isIntegral() || isa<PointerType>(opType))
|
||||
{
|
||||
unsigned opSize = target.DataLayout.getTypeSize(opType);
|
||||
unsigned destSize = target.DataLayout.getTypeSize(destI->getType());
|
||||
@@ -1490,9 +1487,7 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
|
||||
MachineCodeForInstruction& mcfi =MachineCodeForInstruction::get(destI);
|
||||
|
||||
const Type* opType = opVal->getType();
|
||||
if (opType->isIntegral()
|
||||
|| isa<PointerType>(opType)
|
||||
|| opType == Type::BoolTy)
|
||||
if (opType->isIntegral() || isa<PointerType>(opType))
|
||||
{
|
||||
// These operand types have the same format as the destination,
|
||||
// but may have different size: add sign bits or mask as needed.
|
||||
@@ -2091,9 +2086,8 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
|
||||
Instruction* shlInstr = subtreeRoot->getInstruction();
|
||||
|
||||
const Type* opType = argVal1->getType();
|
||||
assert(opType->isIntegral()
|
||||
|| opType == Type::BoolTy
|
||||
|| isa<PointerType>(opType)&&"Shl unsupported for other types");
|
||||
assert((opType->isInteger() || isa<PointerType>(opType)) &&
|
||||
"Shl unsupported for other types");
|
||||
|
||||
CreateShiftInstructions(target, shlInstr->getParent()->getParent(),
|
||||
(opType == Type::LongTy)? SLLX : SLL,
|
||||
@@ -2104,8 +2098,8 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
|
||||
|
||||
case 63: // reg: Shr(reg, reg)
|
||||
{ const Type* opType = subtreeRoot->leftChild()->getValue()->getType();
|
||||
assert(opType->isIntegral()
|
||||
|| isa<PointerType>(opType)&&"Shr unsupported for other types");
|
||||
assert((opType->isInteger() || isa<PointerType>(opType)) &&
|
||||
"Shr unsupported for other types");
|
||||
mvec.push_back(new MachineInstr((opType->isSigned()
|
||||
? ((opType == Type::LongTy)? SRAX : SRA)
|
||||
: ((opType == Type::LongTy)? SRLX : SRL))));
|
||||
|
@@ -62,8 +62,7 @@ ChooseAddInstructionByType(const Type* resultType)
|
||||
if (resultType->isIntegral() ||
|
||||
isa<PointerType>(resultType) ||
|
||||
isa<FunctionType>(resultType) ||
|
||||
resultType == Type::LabelTy ||
|
||||
resultType == Type::BoolTy)
|
||||
resultType == Type::LabelTy)
|
||||
{
|
||||
opCode = ADD;
|
||||
}
|
||||
|
@@ -651,7 +651,7 @@ void UltraSparcRegInfo::suggestRegs4CallArgs(MachineInstr *CallMI,
|
||||
const Value *argCopy = argDesc->getArgInfo(i).getArgCopy();
|
||||
if (argCopy != NULL)
|
||||
{
|
||||
assert(regType != IntRegType && argCopy->getType()->isIntegral()
|
||||
assert(regType != IntRegType && argCopy->getType()->isInteger()
|
||||
&& "Must be passing copy of FP argument in int register");
|
||||
int copyRegNum = regNumForIntArg(/*inCallee*/false, /*isVarArgs*/false,
|
||||
argNo, intArgNo, fpArgNo-1,
|
||||
@@ -907,7 +907,7 @@ void UltraSparcRegInfo::colorCallArgs(MachineInstr *CallMI,
|
||||
const Value *argCopy = argDesc->getArgInfo(i).getArgCopy();
|
||||
if (argCopy != NULL)
|
||||
{
|
||||
assert(regType != IntRegType && argCopy->getType()->isIntegral()
|
||||
assert(regType != IntRegType && argCopy->getType()->isInteger()
|
||||
&& "Must be passing copy of FP argument in int register");
|
||||
|
||||
unsigned copyRegClassID = getRegClassIDOfValue(argCopy);
|
||||
|
Reference in New Issue
Block a user