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

Side by Side Diff: src/IceGlobalContext.cpp

Issue 353553004: Add support for vector types and vector constants. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Print out types in error messages. Created 6 years, 5 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
OLDNEW
1 //===- subzero/src/IceGlobalContext.cpp - Global context defs ---*- C++ -*-===// 1 //===- subzero/src/IceGlobalContext.cpp - Global context defs ---*- C++ -*-===//
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 aspects of the compilation that persist across 10 // This file defines aspects of the compilation that persist across
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 case IceType_i1: 225 case IceType_i1:
226 case IceType_i8: 226 case IceType_i8:
227 case IceType_i16: 227 case IceType_i16:
228 case IceType_i32: 228 case IceType_i32:
229 case IceType_i64: 229 case IceType_i64:
230 return getConstantInt(Ty, 0); 230 return getConstantInt(Ty, 0);
231 case IceType_f32: 231 case IceType_f32:
232 return getConstantFloat(0); 232 return getConstantFloat(0);
233 case IceType_f64: 233 case IceType_f64:
234 return getConstantDouble(0); 234 return getConstantDouble(0);
235 case IceType_v4i1:
236 case IceType_v8i1:
237 case IceType_v16i1:
238 case IceType_v16i8:
239 case IceType_v8i16:
240 case IceType_v4i32:
241 case IceType_v4f32: {
242 IceString Str;
243 llvm::raw_string_ostream BaseOS(Str);
244 Ostream OS(&BaseOS);
245 OS << "Unsupported constant type: " << Ty;
246 llvm_unreachable(BaseOS.str().c_str());
247 } break;
235 case IceType_void: 248 case IceType_void:
236 case IceType_NUM: 249 case IceType_NUM:
237 break; 250 break;
238 } 251 }
239 llvm_unreachable("Unknown type"); 252 llvm_unreachable("Unknown type");
240 } 253 }
241 254
242 ConstantList GlobalContext::getConstantPool(Type Ty) const { 255 ConstantList GlobalContext::getConstantPool(Type Ty) const {
243 switch (Ty) { 256 switch (Ty) {
244 case IceType_i1: 257 case IceType_i1:
245 case IceType_i8: 258 case IceType_i8:
246 case IceType_i16: 259 case IceType_i16:
247 case IceType_i32: 260 case IceType_i32:
248 case IceType_i64: 261 case IceType_i64:
249 return ConstPool->Integers.getConstantPool(); 262 return ConstPool->Integers.getConstantPool();
250 case IceType_f32: 263 case IceType_f32:
251 return ConstPool->Floats.getConstantPool(); 264 return ConstPool->Floats.getConstantPool();
252 case IceType_f64: 265 case IceType_f64:
253 return ConstPool->Doubles.getConstantPool(); 266 return ConstPool->Doubles.getConstantPool();
267 case IceType_v4i1:
268 case IceType_v8i1:
269 case IceType_v16i1:
270 case IceType_v16i8:
271 case IceType_v8i16:
272 case IceType_v4i32:
273 case IceType_v4f32: {
274 IceString Str;
275 llvm::raw_string_ostream BaseOS(Str);
276 Ostream OS(&BaseOS);
277 OS << "Unsupported constant type: " << Ty;
278 llvm_unreachable(BaseOS.str().c_str());
279 } break;
254 case IceType_void: 280 case IceType_void:
255 case IceType_NUM: 281 case IceType_NUM:
256 break; 282 break;
257 } 283 }
258 llvm_unreachable("Unknown type"); 284 llvm_unreachable("Unknown type");
259 } 285 }
260 286
261 void Timer::printElapsedUs(GlobalContext *Ctx, const IceString &Tag) const { 287 void Timer::printElapsedUs(GlobalContext *Ctx, const IceString &Tag) const {
262 if (Ctx->isVerbose(IceV_Timing)) { 288 if (Ctx->isVerbose(IceV_Timing)) {
263 // Prefixing with '#' allows timing strings to be included 289 // Prefixing with '#' allows timing strings to be included
264 // without error in textual assembly output. 290 // without error in textual assembly output.
265 Ctx->getStrDump() << "# " << getElapsedUs() << " usec " << Tag << "\n"; 291 Ctx->getStrDump() << "# " << getElapsedUs() << " usec " << Tag << "\n";
266 } 292 }
267 } 293 }
268 294
269 } // end of namespace Ice 295 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceConverter.cpp ('k') | src/IceInstX8632.h » ('j') | src/IceTargetLoweringX8632.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698