[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp
Andrew Lenharth
alenhar2 at cs.uiuc.edu
Tue Feb 1 16:51:30 PST 2005
Changes in directory llvm/lib/Target/Alpha:
AlphaISelPattern.cpp updated: 1.23 -> 1.24
---
Log message:
better constant handling, should fix many remaining cases
---
Diffs of the changes: (+11 -2)
AlphaISelPattern.cpp | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp
diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.23 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.24
--- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.23 Tue Feb 1 14:40:27 2005
+++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Tue Feb 1 18:51:15 2005
@@ -1021,8 +1021,17 @@
case ISD::Constant:
{
- long val = cast<ConstantSDNode>(N)->getValue();
- BuildMI(BB, Alpha::LOAD_IMM, 1, Result).addImm(val);
+ unsigned long val = cast<ConstantSDNode>(N)->getValue();
+ if (val < 32000 && (long)val > -32000)
+ BuildMI(BB, Alpha::LOAD_IMM, 1, Result).addImm(val);
+ else
+ {
+ MachineConstantPool *CP = BB->getParent()->getConstantPool();
+ ConstantUInt *C = ConstantUInt::get(Type::getPrimitiveType(Type::ULongTyID) , val);
+ unsigned CPI = CP->getConstantPoolIndex(C);
+ AlphaLowering.restoreGP(BB);
+ BuildMI(BB, Alpha::LOAD, 1, Result).addConstantPoolIndex(CPI);
+ }
return Result;
}
More information about the llvm-commits
mailing list