mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-01 08:12:12 +00:00
Don't need to load a NULL pointer constant from memory!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1305 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c9c6aa0445
commit
c811745156
@ -241,14 +241,22 @@ ChooseRegOrImmed(Value* val,
|
|||||||
return MachineOperand::MO_SignExtendedImmed;
|
return MachineOperand::MO_SignExtendedImmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CPV->getType()->isIntegral()) return opType;
|
// Otherwise it needs to be an integer or a NULL pointer
|
||||||
|
if (! CPV->getType()->isIntegral() &&
|
||||||
|
! (CPV->getType()->isPointerType() &&
|
||||||
|
CPV->isNullValue()))
|
||||||
|
return opType;
|
||||||
|
|
||||||
// Now get the constant value and check if it fits in the IMMED field.
|
// Now get the constant value and check if it fits in the IMMED field.
|
||||||
// Take advantage of the fact that the max unsigned value will rarely
|
// Take advantage of the fact that the max unsigned value will rarely
|
||||||
// fit into any IMMED field and ignore that case (i.e., cast smaller
|
// fit into any IMMED field and ignore that case (i.e., cast smaller
|
||||||
// unsigned constants to signed).
|
// unsigned constants to signed).
|
||||||
//
|
//
|
||||||
int64_t intValue;
|
int64_t intValue;
|
||||||
|
if (CPV->getType()->isPointerType())
|
||||||
|
{
|
||||||
|
intValue = 0;
|
||||||
|
}
|
||||||
if (CPV->getType()->isSigned())
|
if (CPV->getType()->isSigned())
|
||||||
{
|
{
|
||||||
intValue = ((ConstPoolSInt*)CPV)->getValue();
|
intValue = ((ConstPoolSInt*)CPV)->getValue();
|
||||||
|
@ -241,14 +241,22 @@ ChooseRegOrImmed(Value* val,
|
|||||||
return MachineOperand::MO_SignExtendedImmed;
|
return MachineOperand::MO_SignExtendedImmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CPV->getType()->isIntegral()) return opType;
|
// Otherwise it needs to be an integer or a NULL pointer
|
||||||
|
if (! CPV->getType()->isIntegral() &&
|
||||||
|
! (CPV->getType()->isPointerType() &&
|
||||||
|
CPV->isNullValue()))
|
||||||
|
return opType;
|
||||||
|
|
||||||
// Now get the constant value and check if it fits in the IMMED field.
|
// Now get the constant value and check if it fits in the IMMED field.
|
||||||
// Take advantage of the fact that the max unsigned value will rarely
|
// Take advantage of the fact that the max unsigned value will rarely
|
||||||
// fit into any IMMED field and ignore that case (i.e., cast smaller
|
// fit into any IMMED field and ignore that case (i.e., cast smaller
|
||||||
// unsigned constants to signed).
|
// unsigned constants to signed).
|
||||||
//
|
//
|
||||||
int64_t intValue;
|
int64_t intValue;
|
||||||
|
if (CPV->getType()->isPointerType())
|
||||||
|
{
|
||||||
|
intValue = 0;
|
||||||
|
}
|
||||||
if (CPV->getType()->isSigned())
|
if (CPV->getType()->isSigned())
|
||||||
{
|
{
|
||||||
intValue = ((ConstPoolSInt*)CPV)->getValue();
|
intValue = ((ConstPoolSInt*)CPV)->getValue();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user