| 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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace Ice { | 25 namespace Ice { |
| 26 namespace x86 { | 26 namespace x86 { |
| 27 | 27 |
| 28 class DirectCallRelocation : public AssemblerFixup { | 28 class DirectCallRelocation : public AssemblerFixup { |
| 29 DirectCallRelocation(const DirectCallRelocation &) = delete; | 29 DirectCallRelocation(const DirectCallRelocation &) = delete; |
| 30 DirectCallRelocation &operator=(const DirectCallRelocation &) = delete; | 30 DirectCallRelocation &operator=(const DirectCallRelocation &) = delete; |
| 31 | 31 |
| 32 public: | 32 public: |
| 33 static DirectCallRelocation *create(Assembler *Asm, FixupKind Kind, | 33 static DirectCallRelocation *create(Assembler *Asm, FixupKind Kind, |
| 34 const ConstantRelocatable *Sym) { | 34 const Constant *Sym) { |
| 35 return new (Asm->Allocate<DirectCallRelocation>()) | 35 return new (Asm->Allocate<DirectCallRelocation>()) |
| 36 DirectCallRelocation(Kind, Sym); | 36 DirectCallRelocation(Kind, Sym); |
| 37 } | 37 } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 DirectCallRelocation(FixupKind Kind, const ConstantRelocatable *Sym) | 40 DirectCallRelocation(FixupKind Kind, const Constant *Sym) |
| 41 : AssemblerFixup(Kind, Sym) {} | 41 : AssemblerFixup(Kind, Sym) {} |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 Address Address::ofConstPool(GlobalContext *Ctx, Assembler *Asm, | 44 Address Address::ofConstPool(Assembler *Asm, const Constant *Imm) { |
| 45 const Constant *Imm) { | 45 AssemblerFixup *Fixup = |
| 46 // We should make this much lighter-weight. E.g., just record the const pool | 46 x86::DisplacementRelocation::create(Asm, FK_Abs_4, Imm); |
| 47 // entry ID. | |
| 48 std::string Buffer; | |
| 49 llvm::raw_string_ostream StrBuf(Buffer); | |
| 50 Type Ty = Imm->getType(); | |
| 51 assert(llvm::isa<ConstantFloat>(Imm) || llvm::isa<ConstantDouble>(Imm)); | |
| 52 StrBuf << ".L$" << Ty << "$" << Imm->getPoolEntryID(); | |
| 53 const RelocOffsetT Offset = 0; | 47 const RelocOffsetT Offset = 0; |
| 54 const bool SuppressMangling = true; | 48 return x86::Address::Absolute(Offset, Fixup); |
| 55 Constant *Sym = Ctx->getConstantSym(Offset, StrBuf.str(), SuppressMangling); | |
| 56 AssemblerFixup *Fixup = x86::DisplacementRelocation::create( | |
| 57 Asm, FK_Abs_4, llvm::cast<ConstantRelocatable>(Sym)); | |
| 58 return x86::Address::Absolute(Fixup); | |
| 59 } | 49 } |
| 60 | 50 |
| 61 AssemblerX86::~AssemblerX86() { | 51 AssemblerX86::~AssemblerX86() { |
| 62 #ifndef NDEBUG | 52 #ifndef NDEBUG |
| 63 for (const Label *Label : CfgNodeLabels) { | 53 for (const Label *Label : CfgNodeLabels) { |
| 64 Label->FinalCheck(); | 54 Label->FinalCheck(); |
| 65 } | 55 } |
| 66 for (const Label *Label : LocalLabels) { | 56 for (const Label *Label : LocalLabels) { |
| 67 Label->FinalCheck(); | 57 Label->FinalCheck(); |
| 68 } | 58 } |
| (...skipping 2459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2528 assert(shifter == RegX8632::Encoded_Reg_ecx); | 2518 assert(shifter == RegX8632::Encoded_Reg_ecx); |
| 2529 (void)shifter; | 2519 (void)shifter; |
| 2530 if (Ty == IceType_i16) | 2520 if (Ty == IceType_i16) |
| 2531 EmitOperandSizeOverride(); | 2521 EmitOperandSizeOverride(); |
| 2532 EmitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3); | 2522 EmitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3); |
| 2533 EmitOperand(rm, operand); | 2523 EmitOperand(rm, operand); |
| 2534 } | 2524 } |
| 2535 | 2525 |
| 2536 } // end of namespace x86 | 2526 } // end of namespace x86 |
| 2537 } // end of namespace Ice | 2527 } // end of namespace Ice |
| OLD | NEW |