OLD | NEW |
1 //===- subzero/src/assembler_ia32.cpp - Assembler for x86-32 -------------===// | 1 //===- subzero/src/assembler_ia32.cpp - Assembler for x86-32 -------------===// |
2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 // | 5 // |
6 // Modified by the Subzero authors. | 6 // Modified by the Subzero authors. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // The Subzero Code Generator | 10 // The Subzero Code Generator |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 StrBuf << "L$" << Ty << "$" << Imm->getPoolEntryID(); | 60 StrBuf << "L$" << Ty << "$" << Imm->getPoolEntryID(); |
61 const RelocOffsetT Offset = 0; | 61 const RelocOffsetT Offset = 0; |
62 const bool SuppressMangling = true; | 62 const bool SuppressMangling = true; |
63 Constant *Sym = | 63 Constant *Sym = |
64 Ctx->getConstantSym(Ty, Offset, StrBuf.str(), SuppressMangling); | 64 Ctx->getConstantSym(Ty, Offset, StrBuf.str(), SuppressMangling); |
65 AssemblerFixup *Fixup = x86::DisplacementRelocation::create( | 65 AssemblerFixup *Fixup = x86::DisplacementRelocation::create( |
66 Asm, FK_Abs_4, llvm::cast<ConstantRelocatable>(Sym)); | 66 Asm, FK_Abs_4, llvm::cast<ConstantRelocatable>(Sym)); |
67 return x86::Address::Absolute(Fixup); | 67 return x86::Address::Absolute(Fixup); |
68 } | 68 } |
69 | 69 |
| 70 AssemblerX86::~AssemblerX86() { |
| 71 #ifndef NDEBUG |
| 72 for (const Label *Label : CfgNodeLabels) { |
| 73 Label->FinalCheck(); |
| 74 } |
| 75 #endif |
| 76 } |
| 77 |
| 78 Label *AssemblerX86::GetOrCreateCfgNodeLabel(SizeT NodeNumber) { |
| 79 Label *L = nullptr; |
| 80 if (NodeNumber == CfgNodeLabels.size()) { |
| 81 L = new (this->Allocate<Label>()) Label(); |
| 82 CfgNodeLabels.push_back(L); |
| 83 return L; |
| 84 } |
| 85 if (NodeNumber > CfgNodeLabels.size()) { |
| 86 CfgNodeLabels.resize(NodeNumber + 1); |
| 87 } |
| 88 L = CfgNodeLabels[NodeNumber]; |
| 89 if (!L) { |
| 90 L = new (this->Allocate<Label>()) Label(); |
| 91 CfgNodeLabels[NodeNumber] = L; |
| 92 } |
| 93 return L; |
| 94 } |
| 95 |
| 96 void AssemblerX86::BindCfgNodeLabel(SizeT NodeNumber) { |
| 97 Label *L = GetOrCreateCfgNodeLabel(NodeNumber); |
| 98 this->Bind(L); |
| 99 } |
| 100 |
70 void AssemblerX86::call(GPRRegister reg) { | 101 void AssemblerX86::call(GPRRegister reg) { |
71 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 102 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
72 EmitUint8(0xFF); | 103 EmitUint8(0xFF); |
73 EmitRegisterOperand(2, reg); | 104 EmitRegisterOperand(2, reg); |
74 } | 105 } |
75 | 106 |
76 void AssemblerX86::call(const Address &address) { | 107 void AssemblerX86::call(const Address &address) { |
77 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 108 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
78 EmitUint8(0xFF); | 109 EmitUint8(0xFF); |
79 EmitOperand(2, address); | 110 EmitOperand(2, address); |
(...skipping 2394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2474 assert(shifter == RegX8632::Encoded_Reg_ecx); | 2505 assert(shifter == RegX8632::Encoded_Reg_ecx); |
2475 (void)shifter; | 2506 (void)shifter; |
2476 if (Ty == IceType_i16) | 2507 if (Ty == IceType_i16) |
2477 EmitOperandSizeOverride(); | 2508 EmitOperandSizeOverride(); |
2478 EmitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3); | 2509 EmitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3); |
2479 EmitOperand(rm, operand); | 2510 EmitOperand(rm, operand); |
2480 } | 2511 } |
2481 | 2512 |
2482 } // end of namespace x86 | 2513 } // end of namespace x86 |
2483 } // end of namespace Ice | 2514 } // end of namespace Ice |
OLD | NEW |