| OLD | NEW |
| 1 //===- subzero/src/llvm2ice.cpp - Driver for testing ----------------------===// | 1 //===- subzero/src/llvm2ice.cpp - Driver for testing ----------------------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This file defines a driver that uses LLVM capabilities to parse a | 10 // This file defines a driver that uses LLVM capabilities to parse a |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 return Ctx->getConstantInt(convertIntegerType(CI->getType()), | 110 return Ctx->getConstantInt(convertIntegerType(CI->getType()), |
| 111 CI->getZExtValue()); | 111 CI->getZExtValue()); |
| 112 } else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(Const)) { | 112 } else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(Const)) { |
| 113 Ice::Type Type = convertType(CFP->getType()); | 113 Ice::Type Type = convertType(CFP->getType()); |
| 114 if (Type == Ice::IceType_f32) | 114 if (Type == Ice::IceType_f32) |
| 115 return Ctx->getConstantFloat(CFP->getValueAPF().convertToFloat()); | 115 return Ctx->getConstantFloat(CFP->getValueAPF().convertToFloat()); |
| 116 else if (Type == Ice::IceType_f64) | 116 else if (Type == Ice::IceType_f64) |
| 117 return Ctx->getConstantDouble(CFP->getValueAPF().convertToDouble()); | 117 return Ctx->getConstantDouble(CFP->getValueAPF().convertToDouble()); |
| 118 llvm_unreachable("Unexpected floating point type"); | 118 llvm_unreachable("Unexpected floating point type"); |
| 119 return NULL; | 119 return NULL; |
| 120 } else if (const UndefValue *CU = dyn_cast<UndefValue>(Const)) { |
| 121 return Ctx->getConstantUndef(convertType(CU->getType())); |
| 120 } else { | 122 } else { |
| 121 llvm_unreachable("Unhandled constant type"); | 123 llvm_unreachable("Unhandled constant type"); |
| 122 return NULL; | 124 return NULL; |
| 123 } | 125 } |
| 124 } | 126 } |
| 125 | 127 |
| 126 private: | 128 private: |
| 127 // LLVM values (instructions, etc.) are mapped directly to ICE variables. | 129 // LLVM values (instructions, etc.) are mapped directly to ICE variables. |
| 128 // mapValueToIceVar has a version that forces an ICE type on the variable, | 130 // mapValueToIceVar has a version that forces an ICE type on the variable, |
| 129 // and a version that just uses convertType on V. | 131 // and a version that just uses convertType on V. |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 << " sec\n"; | 727 << " sec\n"; |
| 726 } | 728 } |
| 727 } | 729 } |
| 728 } | 730 } |
| 729 | 731 |
| 730 if (!DisableTranslation && Func) | 732 if (!DisableTranslation && Func) |
| 731 Func->getTarget()->emitConstants(); | 733 Func->getTarget()->emitConstants(); |
| 732 | 734 |
| 733 return ExitStatus; | 735 return ExitStatus; |
| 734 } | 736 } |
| OLD | NEW |