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

Side by Side Diff: src/IceTypes.cpp

Issue 205613002: Initial skeleton of Subzero. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Address Mark's layout/style comments Created 6 years, 9 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
(Empty)
1 //===- subzero/src/IceTypes.cpp - Primitive type properties ---------------===//
2 //
3 // The Subzero Code Generator
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines a few attributes of Subzero primitive types.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "IceDefs.h"
15 #include "IceTypes.h"
16
17 uint32_t iceTypeWidth(IceType T) {
18 switch (T) {
19 case IceType_i1:
20 return 1;
21 case IceType_i8:
22 return 1;
23 case IceType_i16:
24 return 2;
25 case IceType_i32:
26 return 4;
27 case IceType_i64:
28 return 8;
29 case IceType_f32:
30 return 4;
31 case IceType_f64:
32 return 8;
33 case IceType_void:
34 case IceType_NUM:
35 break;
36 }
37 assert(0 && "Invalid type for iceTypeWidth()");
38 return 0;
39 }
40
41 // ======================== Dump routines ======================== //
42
43 IceOstream &operator<<(IceOstream &Str, IceType T) {
44 switch (T) {
45 case IceType_void:
46 Str << "void";
47 return Str;
48 case IceType_i1:
49 Str << "i1";
50 return Str;
51 case IceType_i8:
52 Str << "i8";
53 return Str;
54 case IceType_i16:
55 Str << "i16";
56 return Str;
57 case IceType_i32:
58 Str << "i32";
59 return Str;
60 case IceType_i64:
61 Str << "i64";
62 return Str;
63 case IceType_f32:
64 Str << "float";
65 return Str;
66 case IceType_f64:
67 Str << "double";
68 return Str;
69 case IceType_NUM:
70 default:
71 assert(0 && "Invalid type for printing");
72 break;
73 }
74 Str << "???";
75 return Str;
76 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698