OLD | NEW |
1 //===- subzero/src/IceTypeConverter.h - Convert ICE/LLVM Types --*- C++ -*-===// | 1 //===- subzero/src/IceTypeConverter.h - Convert ICE/LLVM Types --*- 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 how to convert LLVM types to ICE types, and ICE types | 10 // This file defines how to convert LLVM types to ICE types, and ICE types |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 /// Returns the LLVM type for the corresponding ICE type Ty. | 37 /// Returns the LLVM type for the corresponding ICE type Ty. |
38 llvm::Type *convertToLLVMType(Type Ty) const { | 38 llvm::Type *convertToLLVMType(Type Ty) const { |
39 // Note: We use "at" here in case Ty wasn't registered. | 39 // Note: We use "at" here in case Ty wasn't registered. |
40 return LLVMTypes.at(Ty); | 40 return LLVMTypes.at(Ty); |
41 } | 41 } |
42 | 42 |
43 /// Converts LLVM type LLVMTy to an ICE type. Returns | 43 /// Converts LLVM type LLVMTy to an ICE type. Returns |
44 /// Ice::IceType_NUM if unable to convert. | 44 /// Ice::IceType_NUM if unable to convert. |
45 Type convertToIceType(llvm::Type *LLVMTy) const { | 45 Type convertToIceType(llvm::Type *LLVMTy) const { |
46 std::map<llvm::Type *, Type>::const_iterator Pos = LLVM2IceMap.find(LLVMTy); | 46 auto Pos = LLVM2IceMap.find(LLVMTy); |
47 if (Pos == LLVM2IceMap.end()) | 47 if (Pos == LLVM2IceMap.end()) |
48 return convertToIceTypeOther(LLVMTy); | 48 return convertToIceTypeOther(LLVMTy); |
49 return Pos->second; | 49 return Pos->second; |
50 } | 50 } |
51 | 51 |
52 /// Returns ICE model of pointer type. | 52 /// Returns ICE model of pointer type. |
53 Type getIcePointerType() const { return IceType_i32; } | 53 Type getIcePointerType() const { return IceType_i32; } |
54 | 54 |
55 /// Returns LLVM integer type with specified number of bits. Returns | 55 /// Returns LLVM integer type with specified number of bits. Returns |
56 /// NULL if not a valid PNaCl integer type. | 56 /// NULL if not a valid PNaCl integer type. |
(...skipping 12 matching lines...) Expand all Loading... |
69 // Add LLVM/ICE pair to internal tables. | 69 // Add LLVM/ICE pair to internal tables. |
70 void AddLLVMType(Type Ty, llvm::Type *LLVMTy); | 70 void AddLLVMType(Type Ty, llvm::Type *LLVMTy); |
71 | 71 |
72 // Converts types not in LLVM2IceMap. | 72 // Converts types not in LLVM2IceMap. |
73 Type convertToIceTypeOther(llvm::Type *LLVMTy) const; | 73 Type convertToIceTypeOther(llvm::Type *LLVMTy) const; |
74 }; | 74 }; |
75 | 75 |
76 } // end of Ice namespace. | 76 } // end of Ice namespace. |
77 | 77 |
78 #endif // SUBZERO_SRC_ICETYPECONVERTER_H | 78 #endif // SUBZERO_SRC_ICETYPECONVERTER_H |
OLD | NEW |