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

Side by Side Diff: src/IceAssemblerARM32.h

Issue 1413473005: Add TST(register, immediate) to ARM32 integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix conflict when merging into master. Created 5 years, 1 month 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/DartARM32/assembler_arm.cc ('k') | src/IceAssemblerARM32.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/IceAssemblerARM32.h - Assembler for ARM32 ----*- C++ -*-===// 1 //===- subzero/src/IceAssemblerARM32.h - Assembler for ARM32 ----*- C++ -*-===//
2 // 2 //
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 // for details. All rights reserved. Use of this source code is governed by a 4 // for details. All rights reserved. Use of this source code is governed by a
5 // BSD-style license that can be found in the LICENSE file. 5 // BSD-style license that can be found in the LICENSE file.
6 // 6 //
7 // Modified by the Subzero authors. 7 // Modified by the Subzero authors.
8 // 8 //
9 //===----------------------------------------------------------------------===// 9 //===----------------------------------------------------------------------===//
10 // 10 //
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 void bic(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, 161 void bic(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1,
162 bool SetFlags, CondARM32::Cond Cond); 162 bool SetFlags, CondARM32::Cond Cond);
163 163
164 void eor(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, 164 void eor(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1,
165 bool SetFlags, CondARM32::Cond Cond); 165 bool SetFlags, CondARM32::Cond Cond);
166 166
167 void ldr(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond); 167 void ldr(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond);
168 168
169 void mov(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond); 169 void mov(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond);
170 170
171 void mul(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1,
172 bool SetFlags, CondARM32::Cond Cond);
173
174 void movw(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond); 171 void movw(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond);
175 172
176 void movt(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond); 173 void movt(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond);
177 174
175 void mul(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1,
176 bool SetFlags, CondARM32::Cond Cond);
177
178 void orr(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, 178 void orr(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1,
179 bool SetFlags, CondARM32::Cond Cond); 179 bool SetFlags, CondARM32::Cond Cond);
180 180
181 void sbc(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, 181 void sbc(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1,
182 bool SetFlags, CondARM32::Cond Cond); 182 bool SetFlags, CondARM32::Cond Cond);
183 183
184 void sdiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, 184 void sdiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1,
185 CondARM32::Cond Cond); 185 CondARM32::Cond Cond);
186 186
187 void str(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond); 187 void str(const Operand *OpRt, const Operand *OpAddress, CondARM32::Cond Cond);
188 188
189 void sub(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, 189 void sub(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1,
190 bool SetFlags, CondARM32::Cond Cond); 190 bool SetFlags, CondARM32::Cond Cond);
191 191
192 void tst(const Operand *OpRn, const Operand *OpSrc1, CondARM32::Cond Cond);
193
192 void udiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, 194 void udiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1,
193 CondARM32::Cond Cond); 195 CondARM32::Cond Cond);
194 196
195 static bool classof(const Assembler *Asm) { 197 static bool classof(const Assembler *Asm) {
196 return Asm->getKind() == Asm_ARM32; 198 return Asm->getKind() == Asm_ARM32;
197 } 199 }
198 200
199 void emitTextInst(const std::string &Text, SizeT InstSize = sizeof(IValueT)); 201 void emitTextInst(const std::string &Text, SizeT InstSize = sizeof(IValueT));
200 202
201 private: 203 private:
202 // A vector of pool-allocated x86 labels for CFG nodes. 204 // A vector of pool-allocated x86 labels for CFG nodes.
203 using LabelVector = std::vector<Label *>; 205 using LabelVector = std::vector<Label *>;
204 LabelVector CfgNodeLabels; 206 LabelVector CfgNodeLabels;
205 // A vector of pool-allocated x86 labels for Local labels. 207 // A vector of pool-allocated x86 labels for Local labels.
206 LabelVector LocalLabels; 208 LabelVector LocalLabels;
207 209
208 Label *getOrCreateLabel(SizeT Number, LabelVector &Labels); 210 Label *getOrCreateLabel(SizeT Number, LabelVector &Labels);
209 211
210 void bindCfgNodeLabel(const CfgNode *Node) override; 212 void bindCfgNodeLabel(const CfgNode *Node) override;
211 213
212 void emitInst(IValueT Value) { Buffer.emit<IValueT>(Value); } 214 void emitInst(IValueT Value) { Buffer.emit<IValueT>(Value); }
213 215
214 // Pattern cccctttoooosnnnnddddiiiiiiiiiiii where cccc=Cond, ttt=Type, 216 // Pattern cccctttoooosnnnnddddiiiiiiiiiiii where cccc=Cond, ttt=Type,
215 // oooo=Opcode, nnnn=Rn, dddd=Rd, iiiiiiiiiiii=imm12 (See ARM section A5.2.3). 217 // oooo=Opcode, nnnn=Rn, dddd=Rd, iiiiiiiiiiii=imm12 (See ARM section A5.2.3).
216 void emitType01(CondARM32::Cond Cond, IValueT Type, IValueT Opcode, 218 void emitType01(CondARM32::Cond Cond, IValueT Type, IValueT Opcode,
217 bool SetCc, IValueT Rn, IValueT Rd, IValueT imm12); 219 bool SetCc, IValueT Rn, IValueT Rd, IValueT imm12);
218 220
219 // Converts arguments to appropriate representation on a data operation, 221 // List of possible checks to apply when calling emitType01() (below).
220 // and then calls emitType01 above. 222 enum Type01Checks {
223 NoChecks,
224 RdIsPcAndSetFlags,
225 };
226
227 // Converts appropriate representation on a data operation, and then calls
228 // emitType01 above.
221 void emitType01(IValueT Opcode, const Operand *OpRd, const Operand *OpRn, 229 void emitType01(IValueT Opcode, const Operand *OpRd, const Operand *OpRn,
222 const Operand *OpSrc1, bool SetFlags, CondARM32::Cond Cond); 230 const Operand *OpSrc1, bool SetFlags, CondARM32::Cond Cond,
231 Type01Checks RuleChecks = RdIsPcAndSetFlags);
232
233 // Same as above, but the value for Rd and Rn have already been converted
234 // into instruction values.
235 void emitType01(IValueT Opcode, IValueT OpRd, IValueT OpRn,
236 const Operand *OpSrc1, bool SetFlags, CondARM32::Cond Cond,
237 Type01Checks RuleChecks = RdIsPcAndSetFlags);
223 238
224 void emitType05(CondARM32::Cond COnd, int32_t Offset, bool Link); 239 void emitType05(CondARM32::Cond COnd, int32_t Offset, bool Link);
225 240
226 // Pattern ccccoooaabalnnnnttttaaaaaaaaaaaa where cccc=Cond, ooo=InstType, 241 // Pattern ccccoooaabalnnnnttttaaaaaaaaaaaa where cccc=Cond, ooo=InstType,
227 // l=isLoad, b=isByte, and aaa0a0aaaa0000aaaaaaaaaaaa=Address. Note that 242 // l=isLoad, b=isByte, and aaa0a0aaaa0000aaaaaaaaaaaa=Address. Note that
228 // Address is assumed to be defined by decodeAddress() in 243 // Address is assumed to be defined by decodeAddress() in
229 // IceAssemblerARM32.cpp. 244 // IceAssemblerARM32.cpp.
230 void emitMemOp(CondARM32::Cond Cond, IValueT InstType, bool IsLoad, 245 void emitMemOp(CondARM32::Cond Cond, IValueT InstType, bool IsLoad,
231 bool IsByte, uint32_t Rt, uint32_t Address); 246 bool IsByte, uint32_t Rt, uint32_t Address);
232 247
233 // Pattern cccc011100x1dddd1111mmmm0001nnn where cccc=Cond, 248 // Pattern cccc011100x1dddd1111mmmm0001nnn where cccc=Cond,
234 // x=Opcode, dddd=Rd, nnnn=Rn, mmmm=Rm. 249 // x=Opcode, dddd=Rd, nnnn=Rn, mmmm=Rm.
235 void emitDivOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn, 250 void emitDivOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn,
236 IValueT Rm); 251 IValueT Rm);
237 252
238 // Pattern ccccxxxxxxxfnnnnddddssss1001mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, 253 // Pattern ccccxxxxxxxfnnnnddddssss1001mmmm where cccc=Cond, dddd=Rd, nnnn=Rn,
239 // mmmm=Rm, ssss=Rs, f=SetCc, and xxxxxxx=Opcode. 254 // mmmm=Rm, ssss=Rs, f=SetCc, and xxxxxxx=Opcode.
240 void emitMulOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn, 255 void emitMulOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn,
241 IValueT Rm, IValueT Rs, bool SetCc); 256 IValueT Rm, IValueT Rs, bool SetCc);
242 257
258 // Pattern cccctttxxxxnnnn0000iiiiiiiiiiii where cccc=Cond, nnnn=Rn,
259 // ttt=Instruction type (derived from OpSrc1), iiiiiiiiiiii is derived from
260 // OpSrc1, and xxxx=Opcode.
261 void emitCompareOp(IValueT Opcode, const Operand *OpRn, const Operand *OpSrc1,
262 CondARM32::Cond Cond);
263
243 void emitBranch(Label *L, CondARM32::Cond, bool Link); 264 void emitBranch(Label *L, CondARM32::Cond, bool Link);
244 265
245 // Encodes the given Offset into the branch instruction Inst. 266 // Encodes the given Offset into the branch instruction Inst.
246 IValueT encodeBranchOffset(IOffsetT Offset, IValueT Inst); 267 IValueT encodeBranchOffset(IOffsetT Offset, IValueT Inst);
247 268
248 // Returns the offset encoded in the branch instruction Inst. 269 // Returns the offset encoded in the branch instruction Inst.
249 static IOffsetT decodeBranchOffset(IValueT Inst); 270 static IOffsetT decodeBranchOffset(IValueT Inst);
250 }; 271 };
251 272
252 } // end of namespace ARM32 273 } // end of namespace ARM32
253 } // end of namespace Ice 274 } // end of namespace Ice
254 275
255 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H 276 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H
OLDNEW
« no previous file with comments | « src/DartARM32/assembler_arm.cc ('k') | src/IceAssemblerARM32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698