Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/llvm2ice.cpp

Issue 339783002: Add support for undef values in ICE IR. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Comment about uninitialized registers Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | tests_lit/llvm2ice_tests/undef.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | tests_lit/llvm2ice_tests/undef.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698