diff options
author | Andrew Lenharth <andrewl@lenharth.org> | 2005-02-02 00:51:15 +0000 |
---|---|---|
committer | Andrew Lenharth <andrewl@lenharth.org> | 2005-02-02 00:51:15 +0000 |
commit | 22d5a41f9a945ea61504477f3d2ea87af11b5c13 (patch) | |
tree | 0a07c9e6acc92bfb0bb2af9eb2d027da13b3f1ae /lib/Target/Alpha/AlphaISelPattern.cpp | |
parent | 270e851c59ce957fba3d37583cf4555fa70eaed8 (diff) |
better constant handling, should fix many remaining cases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19984 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Alpha/AlphaISelPattern.cpp')
-rw-r--r-- | lib/Target/Alpha/AlphaISelPattern.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Target/Alpha/AlphaISelPattern.cpp b/lib/Target/Alpha/AlphaISelPattern.cpp index dcd2407084..e8de3c8bd7 100644 --- a/lib/Target/Alpha/AlphaISelPattern.cpp +++ b/lib/Target/Alpha/AlphaISelPattern.cpp @@ -1021,8 +1021,17 @@ unsigned ISel::SelectExpr(SDOperand N) { 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; } |