| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 Type convertToIceType(llvm::Type *LLVMTy) const { | 46 Type convertToIceType(llvm::Type *LLVMTy) const { |
| 47 auto Pos = LLVM2IceMap.find(LLVMTy); | 47 auto Pos = LLVM2IceMap.find(LLVMTy); |
| 48 if (Pos == LLVM2IceMap.end()) | 48 if (Pos == LLVM2IceMap.end()) |
| 49 return convertToIceTypeOther(LLVMTy); | 49 return convertToIceTypeOther(LLVMTy); |
| 50 return Pos->second; | 50 return Pos->second; |
| 51 } | 51 } |
| 52 | 52 |
| 53 /// Returns ICE model of pointer type. | 53 /// Returns ICE model of pointer type. |
| 54 Type getIcePointerType() const { return IceType_i32; } | 54 Type getIcePointerType() const { return IceType_i32; } |
| 55 | 55 |
| 56 /// Returns LLVM integer type with specified number of bits. Returns | |
| 57 /// NULL if not a valid PNaCl integer type. | |
| 58 llvm::Type *getLLVMIntegerType(unsigned NumBits) const; | |
| 59 | |
| 60 /// Returns the LLVM vector type for Size and Ty arguments. Returns | |
| 61 /// NULL if not a valid PNaCl vector type. | |
| 62 llvm::Type *getLLVMVectorType(unsigned Size, Type Ty) const; | |
| 63 | |
| 64 private: | 56 private: |
| 65 // The list of allowable LLVM types. Indexed by ICE type. | 57 // The list of allowable LLVM types. Indexed by ICE type. |
| 66 std::vector<llvm::Type *> LLVMTypes; | 58 std::vector<llvm::Type *> LLVMTypes; |
| 67 // The inverse mapping of LLVMTypes. | 59 // The inverse mapping of LLVMTypes. |
| 68 std::map<llvm::Type *, Type> LLVM2IceMap; | 60 std::map<llvm::Type *, Type> LLVM2IceMap; |
| 69 | 61 |
| 70 // Add LLVM/ICE pair to internal tables. | 62 // Add LLVM/ICE pair to internal tables. |
| 71 void addLLVMType(Type Ty, llvm::Type *LLVMTy); | 63 void addLLVMType(Type Ty, llvm::Type *LLVMTy); |
| 72 | 64 |
| 73 // Converts types not in LLVM2IceMap. | 65 // Converts types not in LLVM2IceMap. |
| 74 Type convertToIceTypeOther(llvm::Type *LLVMTy) const; | 66 Type convertToIceTypeOther(llvm::Type *LLVMTy) const; |
| 75 }; | 67 }; |
| 76 | 68 |
| 77 } // end of Ice namespace. | 69 } // end of Ice namespace. |
| 78 | 70 |
| 79 #endif // SUBZERO_SRC_ICETYPECONVERTER_H | 71 #endif // SUBZERO_SRC_ICETYPECONVERTER_H |
| OLD | NEW |