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

Side by Side Diff: src/IceIntrinsics.h

Issue 1341423002: Reflow comments to use the full width. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix spelling and rebase Created 5 years, 3 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/IceInstX86BaseImpl.h ('k') | src/IceIntrinsics.cpp » ('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/IceIntrinsics.h - List of Ice Intrinsics -----*- C++ -*-===// 1 //===- subzero/src/IceIntrinsics.h - List of Ice Intrinsics -----*- 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 /// \file 10 /// \file
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 Memmove, 55 Memmove,
56 Memset, 56 Memset,
57 NaClReadTP, 57 NaClReadTP,
58 Setjmp, 58 Setjmp,
59 Sqrt, 59 Sqrt,
60 Stacksave, 60 Stacksave,
61 Stackrestore, 61 Stackrestore,
62 Trap 62 Trap
63 }; 63 };
64 64
65 /// Operations that can be represented by the AtomicRMW 65 /// Operations that can be represented by the AtomicRMW intrinsic.
66 /// intrinsic.
67 /// 66 ///
68 /// Do not reorder these values: their order offers forward 67 /// Do not reorder these values: their order offers forward compatibility of
69 /// compatibility of bitcode targeted to PNaCl. 68 /// bitcode targeted to PNaCl.
70 enum AtomicRMWOperation { 69 enum AtomicRMWOperation {
71 AtomicInvalid = 0, // Invalid, keep first. 70 AtomicInvalid = 0, // Invalid, keep first.
72 AtomicAdd, 71 AtomicAdd,
73 AtomicSub, 72 AtomicSub,
74 AtomicOr, 73 AtomicOr,
75 AtomicAnd, 74 AtomicAnd,
76 AtomicXor, 75 AtomicXor,
77 AtomicExchange, 76 AtomicExchange,
78 AtomicNum // Invalid, keep last. 77 AtomicNum // Invalid, keep last.
79 }; 78 };
80 79
81 /// Memory orderings supported by PNaCl IR. 80 /// Memory orderings supported by PNaCl IR.
82 /// 81 ///
83 /// Do not reorder these values: their order offers forward 82 /// Do not reorder these values: their order offers forward compatibility of
84 /// compatibility of bitcode targeted to PNaCl. 83 /// bitcode targeted to PNaCl.
85 enum MemoryOrder { 84 enum MemoryOrder {
86 MemoryOrderInvalid = 0, // Invalid, keep first. 85 MemoryOrderInvalid = 0, // Invalid, keep first.
87 MemoryOrderRelaxed, 86 MemoryOrderRelaxed,
88 MemoryOrderConsume, 87 MemoryOrderConsume,
89 MemoryOrderAcquire, 88 MemoryOrderAcquire,
90 MemoryOrderRelease, 89 MemoryOrderRelease,
91 MemoryOrderAcquireRelease, 90 MemoryOrderAcquireRelease,
92 MemoryOrderSequentiallyConsistent, 91 MemoryOrderSequentiallyConsistent,
93 MemoryOrderNum // Invalid, keep last. 92 MemoryOrderNum // Invalid, keep last.
94 }; 93 };
95 94
96 /// Verify memory ordering rules for atomic intrinsics. For 95 /// Verify memory ordering rules for atomic intrinsics. For AtomicCmpxchg,
97 /// AtomicCmpxchg, Order is the "success" ordering and OrderOther is 96 /// Order is the "success" ordering and OrderOther is the "failure" ordering.
98 /// the "failure" ordering. Returns true if valid, false if invalid. 97 /// Returns true if valid, false if invalid.
99 // TODO(stichnot,kschimpf): Perform memory order validation in the 98 // TODO(stichnot,kschimpf): Perform memory order validation in the bitcode
100 // bitcode reader/parser, allowing LLVM and Subzero to share. See 99 // reader/parser, allowing LLVM and Subzero to share. See
101 // https://code.google.com/p/nativeclient/issues/detail?id=4126 . 100 // https://code.google.com/p/nativeclient/issues/detail?id=4126 .
102 static bool isMemoryOrderValid(IntrinsicID ID, uint64_t Order, 101 static bool isMemoryOrderValid(IntrinsicID ID, uint64_t Order,
103 uint64_t OrderOther = MemoryOrderInvalid); 102 uint64_t OrderOther = MemoryOrderInvalid);
104 103
105 enum SideEffects { SideEffects_F = 0, SideEffects_T = 1 }; 104 enum SideEffects { SideEffects_F = 0, SideEffects_T = 1 };
106 105
107 enum ReturnsTwice { ReturnsTwice_F = 0, ReturnsTwice_T = 1 }; 106 enum ReturnsTwice { ReturnsTwice_F = 0, ReturnsTwice_T = 1 };
108 107
109 /// Basic attributes related to each intrinsic, that are relevant to 108 /// Basic attributes related to each intrinsic, that are relevant to code
110 /// code generation. Perhaps the attributes representation can be shared 109 /// generation. Perhaps the attributes representation can be shared with
111 /// with general function calls, but PNaCl currently strips all 110 /// general function calls, but PNaCl currently strips all attributes from
112 /// attributes from functions. 111 /// functions.
113 struct IntrinsicInfo { 112 struct IntrinsicInfo {
114 enum IntrinsicID ID : 30; 113 enum IntrinsicID ID : 30;
115 enum SideEffects HasSideEffects : 1; 114 enum SideEffects HasSideEffects : 1;
116 enum ReturnsTwice ReturnsTwice : 1; 115 enum ReturnsTwice ReturnsTwice : 1;
117 }; 116 };
118 117
119 /// The types of validation values for FullIntrinsicInfo.validateCall. 118 /// The types of validation values for FullIntrinsicInfo.validateCall.
120 enum ValidateCallValue { 119 enum ValidateCallValue {
121 IsValidCall, /// Valid use of instrinsic call. 120 IsValidCall, /// Valid use of instrinsic call.
122 BadReturnType, /// Return type invalid for intrinsic. 121 BadReturnType, /// Return type invalid for intrinsic.
123 WrongNumOfArgs, /// Wrong number of arguments for intrinsic. 122 WrongNumOfArgs, /// Wrong number of arguments for intrinsic.
124 WrongCallArgType, /// Argument of wrong type. 123 WrongCallArgType, /// Argument of wrong type.
125 }; 124 };
126 125
127 /// The complete set of information about an intrinsic. 126 /// The complete set of information about an intrinsic.
128 struct FullIntrinsicInfo { 127 struct FullIntrinsicInfo {
129 struct IntrinsicInfo Info; /// Information that CodeGen would care about. 128 struct IntrinsicInfo Info; /// Information that CodeGen would care about.
130 129
131 // Sanity check during parsing. 130 // Sanity check during parsing.
132 Type Signature[kMaxIntrinsicParameters]; 131 Type Signature[kMaxIntrinsicParameters];
133 uint8_t NumTypes; 132 uint8_t NumTypes;
134 133
135 /// Validates that type signature of call matches intrinsic. 134 /// Validates that type signature of call matches intrinsic. If
136 /// If WrongArgumentType is returned, ArgIndex is set to corresponding 135 /// WrongArgumentType is returned, ArgIndex is set to corresponding argument
137 /// argument index. 136 /// index.
138 ValidateCallValue validateCall(const Ice::InstCall *Call, 137 ValidateCallValue validateCall(const Ice::InstCall *Call,
139 SizeT &ArgIndex) const; 138 SizeT &ArgIndex) const;
140 139
141 /// Returns the return type of the intrinsic. 140 /// Returns the return type of the intrinsic.
142 Type getReturnType() const { 141 Type getReturnType() const {
143 assert(NumTypes > 0); 142 assert(NumTypes > 0);
144 return Signature[0]; 143 return Signature[0];
145 } 144 }
146 145
147 /// Returns number of arguments expected. 146 /// Returns number of arguments expected.
148 SizeT getNumArgs() const { 147 SizeT getNumArgs() const {
149 assert(NumTypes > 0); 148 assert(NumTypes > 0);
150 return NumTypes - 1; 149 return NumTypes - 1;
151 } 150 }
152 151
153 /// Returns type of Index-th argument. 152 /// Returns type of Index-th argument.
154 Type getArgType(SizeT Index) const; 153 Type getArgType(SizeT Index) const;
155 }; 154 };
156 155
157 /// Find the information about a given intrinsic, based on function name. If 156 /// Find the information about a given intrinsic, based on function name. If
158 /// the function name does not have the common "llvm." prefix, nullptr is 157 /// the function name does not have the common "llvm." prefix, nullptr is
159 /// returned and Error is set to false. Otherwise, tries to find a reference 158 /// returned and Error is set to false. Otherwise, tries to find a reference
160 /// to a FullIntrinsicInfo entry (valid for the lifetime of the map). If 159 /// to a FullIntrinsicInfo entry (valid for the lifetime of the map). If
161 /// found, sets Error to false and returns the reference. If not found, sets 160 /// found, sets Error to false and returns the reference. If not found, sets
162 /// Error to true and returns nullptr (indicating an unknown "llvm.foo" 161 /// Error to true and returns nullptr (indicating an unknown "llvm.foo"
163 /// intrinsic). 162 /// intrinsic).
164 const FullIntrinsicInfo *find(const IceString &Name, bool &Error) const; 163 const FullIntrinsicInfo *find(const IceString &Name, bool &Error) const;
165 164
166 private: 165 private:
167 // TODO(jvoung): May want to switch to something like LLVM's StringMap. 166 // TODO(jvoung): May want to switch to something like LLVM's StringMap.
168 using IntrinsicMap = std::map<IceString, FullIntrinsicInfo>; 167 using IntrinsicMap = std::map<IceString, FullIntrinsicInfo>;
169 IntrinsicMap Map; 168 IntrinsicMap Map;
170 }; 169 };
171 170
172 } // end of namespace Ice 171 } // end of namespace Ice
173 172
174 #endif // SUBZERO_SRC_ICEINTRINSICS_H 173 #endif // SUBZERO_SRC_ICEINTRINSICS_H
OLDNEW
« no previous file with comments | « src/IceInstX86BaseImpl.h ('k') | src/IceIntrinsics.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698