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

Side by Side Diff: src/IceTypeConverter.cpp

Issue 625243002: Convert Subzero's bitcode reader to generate ICE types. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 6 years, 2 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/IceTypeConverter.h ('k') | src/IceTypes.h » ('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/IceTypeConverter.cpp - Convert ICE/LLVM Types ----------===// 1 //===- subzero/src/IceTypeConverter.cpp - Convert ICE/LLVM Types ----------===//
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 implements how to convert LLVM types to ICE types, and ICE types 10 // This file implements how to convert LLVM types to ICE types, and ICE types
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 Type TypeConverter::convertToIceTypeOther(llvm::Type *LLVMTy) const { 46 Type TypeConverter::convertToIceTypeOther(llvm::Type *LLVMTy) const {
47 switch (LLVMTy->getTypeID()) { 47 switch (LLVMTy->getTypeID()) {
48 case llvm::Type::PointerTyID: 48 case llvm::Type::PointerTyID:
49 case llvm::Type::FunctionTyID: 49 case llvm::Type::FunctionTyID:
50 return getIcePointerType(); 50 return getIcePointerType();
51 default: 51 default:
52 return Ice::IceType_NUM; 52 return Ice::IceType_NUM;
53 } 53 }
54 } 54 }
55 55
56 llvm::Type *TypeConverter::getLLVMIntegerType(unsigned NumBits) const {
57 switch (NumBits) {
58 case 1:
59 return LLVMTypes[IceType_i1];
60 case 8:
61 return LLVMTypes[IceType_i8];
62 case 16:
63 return LLVMTypes[IceType_i16];
64 case 32:
65 return LLVMTypes[IceType_i32];
66 case 64:
67 return LLVMTypes[IceType_i64];
68 default:
69 return NULL;
70 }
71 }
72
73 llvm::Type *TypeConverter::getLLVMVectorType(unsigned Size, Type Ty) const {
74 switch (Ty) {
75 case IceType_i1:
76 switch (Size) {
77 case 4:
78 return convertToLLVMType(IceType_v4i1);
79 case 8:
80 return convertToLLVMType(IceType_v8i1);
81 case 16:
82 return convertToLLVMType(IceType_v16i1);
83 default:
84 break;
85 }
86 break;
87 case IceType_i8:
88 if (Size == 16)
89 return convertToLLVMType(IceType_v16i8);
90 break;
91 case IceType_i16:
92 if (Size == 8)
93 return convertToLLVMType(IceType_v8i16);
94 break;
95 case IceType_i32:
96 if (Size == 4)
97 return convertToLLVMType(IceType_v4i32);
98 break;
99 case IceType_f32:
100 if (Size == 4)
101 return convertToLLVMType(IceType_v4f32);
102 break;
103 default:
104 break;
105 }
106 return NULL;
107 }
108
109 } // end of Ice namespace. 56 } // end of Ice namespace.
OLDNEW
« no previous file with comments | « src/IceTypeConverter.h ('k') | src/IceTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698