1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Not all constants are legal immediates in load/store instructions.

llvm-svn: 22704
This commit is contained in:
Chris Lattner 2005-08-08 06:25:50 +00:00
parent 5c7ea6550b
commit f6e6e25039

View File

@ -435,7 +435,13 @@ void BasedUser::RewriteInstructionToUseNewBase(Value *NewBase,
static bool isTargetConstant(const SCEVHandle &V) {
// FIXME: Look at the target to decide if &GV is a legal constant immediate.
if (isa<SCEVConstant>(V)) return true;
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(V)) {
// PPC allows a sign-extended 16-bit immediate field.
if ((int64_t)SC->getValue()->getRawValue() > -(1 << 16) &&
(int64_t)SC->getValue()->getRawValue() < (1 << 16)-1)
return true;
return false;
}
return false; // ENABLE this for x86