summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2003-07-06 20:33:21 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2003-07-06 20:33:21 +0000
commit97539fc4b63031495cbee5441de7a3a583e5ec77 (patch)
treebe0ffbfeda77eba5703c8a52c098c783f28a5acc /lib
parent786833ad3498036db72776f9b708ff08a6f8e29a (diff)
downloadllvm-97539fc4b63031495cbee5441de7a3a583e5ec77.tar.gz
llvm-97539fc4b63031495cbee5441de7a3a583e5ec77.tar.bz2
llvm-97539fc4b63031495cbee5441de7a3a583e5ec77.tar.xz
Choose register instead of immediate for ConstantExpr in ChooseRegOrImmed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7112 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp7
-rw-r--r--lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp7
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp b/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
index 8f35be8a07..ff214500db 100644
--- a/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
+++ b/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
@@ -91,9 +91,10 @@ ChooseRegOrImmed(Value* val,
// To use reg or immed, constant needs to be integer, bool, or a NULL pointer
Constant *CPV = dyn_cast<Constant>(val);
- if (CPV == NULL ||
- (! CPV->getType()->isIntegral() &&
- ! (isa<PointerType>(CPV->getType()) && CPV->isNullValue())))
+ if (CPV == NULL
+ || CPV->isConstantExpr()
+ || (! CPV->getType()->isIntegral() &&
+ ! (isa<PointerType>(CPV->getType()) && CPV->isNullValue())))
return MachineOperand::MO_VirtualRegister;
// Now get the constant value and check if it fits in the IMMED field.
diff --git a/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp b/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp
index 8f35be8a07..ff214500db 100644
--- a/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp
+++ b/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp
@@ -91,9 +91,10 @@ ChooseRegOrImmed(Value* val,
// To use reg or immed, constant needs to be integer, bool, or a NULL pointer
Constant *CPV = dyn_cast<Constant>(val);
- if (CPV == NULL ||
- (! CPV->getType()->isIntegral() &&
- ! (isa<PointerType>(CPV->getType()) && CPV->isNullValue())))
+ if (CPV == NULL
+ || CPV->isConstantExpr()
+ || (! CPV->getType()->isIntegral() &&
+ ! (isa<PointerType>(CPV->getType()) && CPV->isNullValue())))
return MachineOperand::MO_VirtualRegister;
// Now get the constant value and check if it fits in the IMMED field.