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

Side by Side Diff: src/assembler_ia32.h

Issue 837553009: Make fixups reference any constant (allow const float/double pool literals). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: go back to one arenaallocator type alias Created 5 years, 11 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/assembler.cpp ('k') | src/assembler_ia32.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/assembler_ia32.h - Assembler for x86-32 ------*- C++ -*-===// 1 //===- subzero/src/assembler_ia32.h - Assembler for x86-32 ------*- C++ -*-===//
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 const int MAX_NOP_SIZE = 8; 44 const int MAX_NOP_SIZE = 8;
45 45
46 enum ScaleFactor { TIMES_1 = 0, TIMES_2 = 1, TIMES_4 = 2, TIMES_8 = 3 }; 46 enum ScaleFactor { TIMES_1 = 0, TIMES_2 = 1, TIMES_4 = 2, TIMES_8 = 3 };
47 47
48 class DisplacementRelocation : public AssemblerFixup { 48 class DisplacementRelocation : public AssemblerFixup {
49 DisplacementRelocation(const DisplacementRelocation &) = delete; 49 DisplacementRelocation(const DisplacementRelocation &) = delete;
50 DisplacementRelocation &operator=(const DisplacementRelocation &) = delete; 50 DisplacementRelocation &operator=(const DisplacementRelocation &) = delete;
51 51
52 public: 52 public:
53 static DisplacementRelocation *create(Assembler *Asm, FixupKind Kind, 53 static DisplacementRelocation *create(Assembler *Asm, FixupKind Kind,
54 const ConstantRelocatable *Sym) { 54 const Constant *Sym) {
55 return new (Asm->Allocate<DisplacementRelocation>()) 55 return new (Asm->Allocate<DisplacementRelocation>())
56 DisplacementRelocation(Kind, Sym); 56 DisplacementRelocation(Kind, Sym);
57 } 57 }
58 58
59 private: 59 private:
60 DisplacementRelocation(FixupKind Kind, const ConstantRelocatable *Sym) 60 DisplacementRelocation(FixupKind Kind, const Constant *Sym)
61 : AssemblerFixup(Kind, Sym) {} 61 : AssemblerFixup(Kind, Sym) {}
62 }; 62 };
63 63
64 class Immediate { 64 class Immediate {
65 Immediate(const Immediate &) = delete; 65 Immediate(const Immediate &) = delete;
66 Immediate &operator=(const Immediate &) = delete; 66 Immediate &operator=(const Immediate &) = delete;
67 67
68 public: 68 public:
69 explicit Immediate(int32_t value) : value_(value), fixup_(nullptr) {} 69 explicit Immediate(int32_t value) : value_(value), fixup_(nullptr) {}
70 70
71 explicit Immediate(AssemblerFixup *fixup) 71 Immediate(RelocOffsetT offset, AssemblerFixup *fixup)
72 : value_(fixup->value()->getOffset()), fixup_(fixup) { 72 : value_(offset), fixup_(fixup) {
73 // Use the Offset in the "value" for now. If the symbol is part of 73 // Use the Offset in the "value" for now. If the symbol is part of
74 // ".bss", then the relocation's symbol will be plain ".bss" and 74 // ".bss", then the relocation's symbol will be plain ".bss" and
75 // the value will need to be adjusted further to be sym's 75 // the value will need to be adjusted further to be sym's
76 // bss offset + Offset. 76 // bss offset + Offset.
77 } 77 }
78 78
79 int32_t value() const { return value_; } 79 int32_t value() const { return value_; }
80 AssemblerFixup *fixup() const { return fixup_; } 80 AssemblerFixup *fixup() const { return fixup_; }
81 81
82 bool is_int8() const { 82 bool is_int8() const {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 } 243 }
244 } 244 }
245 245
246 static Address Absolute(const uintptr_t addr) { 246 static Address Absolute(const uintptr_t addr) {
247 Address result; 247 Address result;
248 result.SetModRM(0, RegX8632::Encoded_Reg_ebp); 248 result.SetModRM(0, RegX8632::Encoded_Reg_ebp);
249 result.SetDisp32(addr); 249 result.SetDisp32(addr);
250 return result; 250 return result;
251 } 251 }
252 252
253 static Address Absolute(AssemblerFixup *fixup) { 253 static Address Absolute(RelocOffsetT Offset, AssemblerFixup *fixup) {
254 Address result; 254 Address result;
255 result.SetModRM(0, RegX8632::Encoded_Reg_ebp); 255 result.SetModRM(0, RegX8632::Encoded_Reg_ebp);
256 // Use the Offset in the displacement for now. If the symbol is part of 256 // Use the Offset in the displacement for now. If the symbol is part of
257 // ".bss", then the relocation's symbol will be plain .bss and the 257 // ".bss", then the relocation's symbol will be plain .bss and the
258 // displacement will need to be adjusted further to be sym's 258 // displacement will need to be adjusted further to be sym's
259 // bss offset + Offset. 259 // bss offset + Offset.
260 result.SetDisp32(fixup->value()->getOffset()); 260 result.SetDisp32(Offset);
261 result.SetFixup(fixup); 261 result.SetFixup(fixup);
262 return result; 262 return result;
263 } 263 }
264 264
265 static Address ofConstPool(GlobalContext *Ctx, Assembler *Asm, 265 static Address ofConstPool(Assembler *Asm, const Constant *Imm);
266 const Constant *Imm);
267 266
268 private: 267 private:
269 Address() {} // Needed by Address::Absolute. 268 Address() {} // Needed by Address::Absolute.
270 }; 269 };
271 270
272 class Label { 271 class Label {
273 Label(const Label &) = delete; 272 Label(const Label &) = delete;
274 Label &operator=(const Label &) = delete; 273 Label &operator=(const Label &) = delete;
275 274
276 public: 275 public:
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 inline void AssemblerX86::EmitFixup(AssemblerFixup *fixup) { 883 inline void AssemblerX86::EmitFixup(AssemblerFixup *fixup) {
885 buffer_.EmitFixup(fixup); 884 buffer_.EmitFixup(fixup);
886 } 885 }
887 886
888 inline void AssemblerX86::EmitOperandSizeOverride() { EmitUint8(0x66); } 887 inline void AssemblerX86::EmitOperandSizeOverride() { EmitUint8(0x66); }
889 888
890 } // end of namespace x86 889 } // end of namespace x86
891 } // end of namespace Ice 890 } // end of namespace Ice
892 891
893 #endif // SUBZERO_SRC_ASSEMBLER_IA32_H_ 892 #endif // SUBZERO_SRC_ASSEMBLER_IA32_H_
OLDNEW
« no previous file with comments | « src/assembler.cpp ('k') | src/assembler_ia32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698