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

Side by Side Diff: src/IceTypeConverter.h

Issue 952953002: Subzero: Improve class definition hygiene. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix typo Created 5 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
« no previous file with comments | « src/IceTranslator.h ('k') | src/IceUtils.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.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 10 matching lines...) Expand all
21 #include "IceTypes.h" 21 #include "IceTypes.h"
22 22
23 namespace llvm { 23 namespace llvm {
24 class LLVMContext; 24 class LLVMContext;
25 } // end of llvm namespace. 25 } // end of llvm namespace.
26 26
27 namespace Ice { 27 namespace Ice {
28 28
29 /// Converts LLVM types to ICE types, and ICE types to LLVM types. 29 /// Converts LLVM types to ICE types, and ICE types to LLVM types.
30 class TypeConverter { 30 class TypeConverter {
31 TypeConverter() = delete;
31 TypeConverter(const TypeConverter &) = delete; 32 TypeConverter(const TypeConverter &) = delete;
32 TypeConverter &operator=(const TypeConverter &) = delete; 33 TypeConverter &operator=(const TypeConverter &) = delete;
33 34
34 public: 35 public:
35 /// Context is the context to use to build llvm types. 36 /// Context is the context to use to build llvm types.
36 TypeConverter(llvm::LLVMContext &Context); 37 explicit TypeConverter(llvm::LLVMContext &Context);
37 38
38 /// Converts LLVM type LLVMTy to an ICE type. Returns 39 /// Converts LLVM type LLVMTy to an ICE type. Returns
39 /// Ice::IceType_NUM if unable to convert. 40 /// Ice::IceType_NUM if unable to convert.
40 Type convertToIceType(llvm::Type *LLVMTy) const { 41 Type convertToIceType(llvm::Type *LLVMTy) const {
41 auto Pos = LLVM2IceMap.find(LLVMTy); 42 auto Pos = LLVM2IceMap.find(LLVMTy);
42 if (Pos == LLVM2IceMap.end()) 43 if (Pos == LLVM2IceMap.end())
43 return convertToIceTypeOther(LLVMTy); 44 return convertToIceTypeOther(LLVMTy);
44 return Pos->second; 45 return Pos->second;
45 } 46 }
46 47
47 private: 48 private:
48 // The mapping from LLVM types to corresopnding Ice types. 49 // The mapping from LLVM types to corresopnding Ice types.
49 std::map<llvm::Type *, Type> LLVM2IceMap; 50 std::map<llvm::Type *, Type> LLVM2IceMap;
50 51
51 // Add LLVM/ICE pair to internal tables. 52 // Add LLVM/ICE pair to internal tables.
52 void addLLVMType(Type Ty, llvm::Type *LLVMTy); 53 void addLLVMType(Type Ty, llvm::Type *LLVMTy);
53 54
54 // Converts types not in LLVM2IceMap. 55 // Converts types not in LLVM2IceMap.
55 Type convertToIceTypeOther(llvm::Type *LLVMTy) const; 56 Type convertToIceTypeOther(llvm::Type *LLVMTy) const;
56 }; 57 };
57 58
58 } // end of Ice namespace. 59 } // end of Ice namespace.
59 60
60 #endif // SUBZERO_SRC_ICETYPECONVERTER_H 61 #endif // SUBZERO_SRC_ICETYPECONVERTER_H
OLDNEW
« no previous file with comments | « src/IceTranslator.h ('k') | src/IceUtils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698