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

Side by Side Diff: src/IceAssemblerARM32.h

Issue 1495093002: Improve error handling in the ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix issues in last patch. Created 5 years 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 | « no previous file | src/IceAssemblerARM32.cpp » ('j') | src/IceAssemblerARM32.cpp » ('J')
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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 309
310 Label *getOrCreateLabel(SizeT Number, LabelVector &Labels); 310 Label *getOrCreateLabel(SizeT Number, LabelVector &Labels);
311 311
312 void bindCfgNodeLabel(const CfgNode *Node) override; 312 void bindCfgNodeLabel(const CfgNode *Node) override;
313 313
314 void emitInst(IValueT Value) { Buffer.emit<IValueT>(Value); } 314 void emitInst(IValueT Value) { Buffer.emit<IValueT>(Value); }
315 315
316 // List of possible checks to apply when calling emitType01() (below). 316 // List of possible checks to apply when calling emitType01() (below).
317 enum EmitChecks { NoChecks, RdIsPcAndSetFlags }; 317 enum EmitChecks { NoChecks, RdIsPcAndSetFlags };
318 318
319 // Pattern cccctttoooosnnnnddddiiiiiiiiiiii where cccc=Cond, ttt=Type, 319 // Pattern cccctttoooosnnnnddddiiiiiiiiiiii where cccc=Cond, ttt=InstType,
320 // s=SetFlags, oooo=Opcode, nnnn=Rn, dddd=Rd, iiiiiiiiiiii=imm12 (See ARM 320 // s=SetFlags, oooo=Opcode, nnnn=Rn, dddd=Rd, iiiiiiiiiiii=imm12 (See ARM
321 // section A5.2.3). 321 // section A5.2.3).
322 void emitType01(CondARM32::Cond Cond, IValueT Type, IValueT Opcode, 322 void emitType01(CondARM32::Cond Cond, IValueT InstType, IValueT Opcode,
323 bool SetFlags, IValueT Rn, IValueT Rd, IValueT imm12, 323 bool SetFlags, IValueT Rn, IValueT Rd, IValueT imm12,
324 EmitChecks RuleChecks); 324 EmitChecks RuleChecks, const char *InstName);
325 325
326 // Converts appropriate representation on a data operation, and then calls 326 // Converts appropriate representation on a data operation, and then calls
327 // emitType01 above. 327 // emitType01 above.
328 void emitType01(IValueT Opcode, const Operand *OpRd, const Operand *OpRn, 328 void emitType01(CondARM32::Cond Cond, IValueT Opcode, const Operand *OpRd,
329 const Operand *OpSrc1, bool SetFlags, CondARM32::Cond Cond, 329 const Operand *OpRn, const Operand *OpSrc1, bool SetFlags,
330 EmitChecks RuleChecks); 330 EmitChecks RuleChecks, const char *InstName);
331 331
332 // Same as above, but the value for Rd and Rn have already been converted 332 // Same as above, but the value for Rd and Rn have already been converted
333 // into instruction values. 333 // into instruction values.
334 void emitType01(IValueT Opcode, IValueT OpRd, IValueT OpRn, 334 void emitType01(CondARM32::Cond Cond, IValueT Opcode, IValueT OpRd,
335 const Operand *OpSrc1, bool SetFlags, CondARM32::Cond Cond, 335 IValueT OpRn, const Operand *OpSrc1, bool SetFlags,
336 EmitChecks RuleChecks); 336 EmitChecks RuleChecks, const char *InstName);
337 337
338 void emitType05(CondARM32::Cond COnd, int32_t Offset, bool Link); 338 void emitType05(CondARM32::Cond Cond, int32_t Offset, bool Link,
339 const char *InstName);
339 340
340 // Emit ccccoooaabalnnnnttttaaaaaaaaaaaa where cccc=Cond, 341 // Emit ccccoooaabalnnnnttttaaaaaaaaaaaa where cccc=Cond,
341 // ooo=InstType, l=isLoad, b=isByte, and 342 // ooo=InstType, l=isLoad, b=isByte, and
342 // aaa0a0aaaa0000aaaaaaaaaaaa=Address. Note that Address is assumed to be 343 // aaa0a0aaaa0000aaaaaaaaaaaa=Address. Note that Address is assumed to be
343 // defined by decodeAddress() in IceAssemblerARM32.cpp. 344 // defined by decodeAddress() in IceAssemblerARM32.cpp.
344 void emitMemOp(CondARM32::Cond Cond, IValueT InstType, bool IsLoad, 345 void emitMemOp(CondARM32::Cond Cond, IValueT InstType, bool IsLoad,
345 bool IsByte, IValueT Rt, IValueT Address); 346 bool IsByte, IValueT Rt, IValueT Address,
347 const char *InstName);
346 348
347 // Emit ldr/ldrb/str/strb instruction with given address. 349 // Emit ldr/ldrb/str/strb instruction with given address.
348 void emitMemOp(CondARM32::Cond Cond, bool IsLoad, bool IsByte, IValueT Rt, 350 void emitMemOp(CondARM32::Cond Cond, bool IsLoad, bool IsByte, IValueT Rt,
349 const Operand *OpAddress, const TargetInfo &TInfo); 351 const Operand *OpAddress, const TargetInfo &TInfo,
352 const char *InstName);
350 353
351 // Emit ldrh/ldrd/strh/strd instruction with given address using encoding 3. 354 // Emit ldrh/ldrd/strh/strd instruction with given address using encoding 3.
352 void emitMemOpEnc3(CondARM32::Cond Cond, IValueT Opcode, IValueT Rt, 355 void emitMemOpEnc3(CondARM32::Cond Cond, IValueT Opcode, IValueT Rt,
353 const Operand *OpAddress, const TargetInfo &TInfo); 356 const Operand *OpAddress, const TargetInfo &TInfo,
357 const char *InstName);
354 358
355 // Pattern cccc100aaaalnnnnrrrrrrrrrrrrrrrr where cccc=Cond, 359 // Pattern cccc100aaaalnnnnrrrrrrrrrrrrrrrr where cccc=Cond,
356 // aaaa<<21=AddressMode, l=IsLoad, nnnn=BaseReg, and 360 // aaaa<<21=AddressMode, l=IsLoad, nnnn=BaseReg, and
357 // rrrrrrrrrrrrrrrr is bitset of Registers. 361 // rrrrrrrrrrrrrrrr is bitset of Registers.
358 void emitMultiMemOp(CondARM32::Cond Cond, BlockAddressMode AddressMode, 362 void emitMultiMemOp(CondARM32::Cond Cond, BlockAddressMode AddressMode,
359 bool IsLoad, IValueT BaseReg, IValueT Registers); 363 bool IsLoad, IValueT BaseReg, IValueT Registers,
364 const char *InstName);
360 365
361 // Pattern cccc011100x1dddd1111mmmm0001nnn where cccc=Cond, 366 // Pattern cccc011100x1dddd1111mmmm0001nnn where cccc=Cond,
362 // x=Opcode, dddd=Rd, nnnn=Rn, mmmm=Rm. 367 // x=Opcode, dddd=Rd, nnnn=Rn, mmmm=Rm.
363 void emitDivOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn, 368 void emitDivOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn,
364 IValueT Rm); 369 IValueT Rm, const char *InstName);
365 370
366 // Pattern ccccxxxxxxxfnnnnddddssss1001mmmm where cccc=Cond, dddd=Rd, nnnn=Rn, 371 // Pattern ccccxxxxxxxfnnnnddddssss1001mmmm where cccc=Cond, dddd=Rd, nnnn=Rn,
367 // mmmm=Rm, ssss=Rs, f=SetFlags and xxxxxxx=Opcode. 372 // mmmm=Rm, ssss=Rs, f=SetFlags and xxxxxxx=Opcode.
368 void emitMulOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn, 373 void emitMulOp(CondARM32::Cond Cond, IValueT Opcode, IValueT Rd, IValueT Rn,
369 IValueT Rm, IValueT Rs, bool SetFlags); 374 IValueT Rm, IValueT Rs, bool SetFlags, const char *InstName);
370 375
371 // Implements various forms of Unsigned extend value, using pattern 376 // Implements various forms of Unsigned extend value, using pattern
372 // ccccxxxxxxxxnnnnddddrr000111mmmm where cccc=Cond, xxxxxxxx<<20=Opcode, 377 // ccccxxxxxxxxnnnnddddrr000111mmmm where cccc=Cond, xxxxxxxx<<20=Opcode,
373 // nnnn=Rn, dddd=Rd, rr=Rotation, and mmmm=Rm. 378 // nnnn=Rn, dddd=Rd, rr=Rotation, and mmmm=Rm.
374 void emitUxt(CondARM32::Cond, IValueT Opcode, IValueT Rd, IValueT Rn, 379 void emitUxt(CondARM32::Cond, IValueT Opcode, IValueT Rd, IValueT Rn,
375 IValueT Rm, RotationValue Rotation); 380 IValueT Rm, RotationValue Rotation, const char *InstName);
376 381
377 // Pattern cccctttxxxxnnnn0000iiiiiiiiiiii where cccc=Cond, nnnn=Rn, 382 // Pattern cccctttxxxxnnnn0000iiiiiiiiiiii where cccc=Cond, nnnn=Rn,
378 // ttt=Instruction type (derived from OpSrc1), iiiiiiiiiiii is derived from 383 // ttt=Instruction type (derived from OpSrc1), iiiiiiiiiiii is derived from
379 // OpSrc1, and xxxx=Opcode. 384 // OpSrc1, and xxxx=Opcode.
380 void emitCompareOp(IValueT Opcode, const Operand *OpRn, const Operand *OpSrc1, 385 void emitCompareOp(CondARM32::Cond Cond, IValueT Opcode, const Operand *OpRn,
381 CondARM32::Cond Cond); 386 const Operand *OpSrc1, const char *CmpName);
382 387
383 void emitBranch(Label *L, CondARM32::Cond, bool Link); 388 void emitBranch(Label *L, CondARM32::Cond, bool Link);
384 389
385 // Encodes the given Offset into the branch instruction Inst. 390 // Encodes the given Offset into the branch instruction Inst.
386 IValueT encodeBranchOffset(IOffsetT Offset, IValueT Inst); 391 IValueT encodeBranchOffset(IOffsetT Offset, IValueT Inst);
387 392
388 // Returns the offset encoded in the branch instruction Inst. 393 // Returns the offset encoded in the branch instruction Inst.
389 static IOffsetT decodeBranchOffset(IValueT Inst); 394 static IOffsetT decodeBranchOffset(IValueT Inst);
390 395
391 // Implements movw, generating pattern ccccxxxxxxxsiiiiddddiiiiiiiiiiii where 396 // Implements movw, generating pattern ccccxxxxxxxsiiiiddddiiiiiiiiiiii where
392 // cccc=Cond, xxxxxxx<<21=Opcode, dddd=Rd, s=SetFlags, and 397 // cccc=Cond, xxxxxxx<<21=Opcode, dddd=Rd, s=SetFlags, and
393 // iiiiiiiiiiiiiiii=Imm16. 398 // iiiiiiiiiiiiiiii=Imm16.
394 void emitMovw(IValueT Opcode, IValueT Rd, IValueT Imm16, bool SetFlags, 399 void emitMovw(IValueT Opcode, IValueT Rd, IValueT Imm16, bool SetFlags,
395 CondARM32::Cond Cond); 400 CondARM32::Cond Cond);
396 }; 401 };
397 402
398 } // end of namespace ARM32 403 } // end of namespace ARM32
399 } // end of namespace Ice 404 } // end of namespace Ice
400 405
401 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H 406 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H
OLDNEW
« no previous file with comments | « no previous file | src/IceAssemblerARM32.cpp » ('j') | src/IceAssemblerARM32.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698