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

Side by Side Diff: src/assembler_ia32.cpp

Issue 874353006: Write out global initializers and data rel directly to ELF file. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: tweak comment Created 5 years, 10 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
OLDNEW
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 25 matching lines...) Expand all
36 for (const Label *Label : CfgNodeLabels) { 36 for (const Label *Label : CfgNodeLabels) {
37 Label->FinalCheck(); 37 Label->FinalCheck();
38 } 38 }
39 for (const Label *Label : LocalLabels) { 39 for (const Label *Label : LocalLabels) {
40 Label->FinalCheck(); 40 Label->FinalCheck();
41 } 41 }
42 #endif 42 #endif
43 } 43 }
44 44
45 void AssemblerX86::alignFunction() { 45 void AssemblerX86::alignFunction() {
46 intptr_t Pos = buffer_.GetPosition();
47 SizeT Align = 1 << getBundleAlignLog2Bytes(); 46 SizeT Align = 1 << getBundleAlignLog2Bytes();
48 intptr_t Mod = Pos & (Align - 1); 47 SizeT BytesNeeded = Utils::OffsetToAlignment(buffer_.GetPosition(), Align);
49 if (Mod == 0) {
50 return;
51 }
52 SizeT BytesNeeded = Align - Mod;
53 const SizeT HltSize = 1; 48 const SizeT HltSize = 1;
54 while (BytesNeeded > 0) { 49 while (BytesNeeded > 0) {
55 hlt(); 50 hlt();
56 BytesNeeded -= HltSize; 51 BytesNeeded -= HltSize;
57 } 52 }
58 assert((buffer_.GetPosition() & (Align - 1)) == 0);
59 } 53 }
60 54
61 Label *AssemblerX86::GetOrCreateLabel(SizeT Number, LabelVector &Labels) { 55 Label *AssemblerX86::GetOrCreateLabel(SizeT Number, LabelVector &Labels) {
62 Label *L = nullptr; 56 Label *L = nullptr;
63 if (Number == Labels.size()) { 57 if (Number == Labels.size()) {
64 L = new (this->Allocate<Label>()) Label(); 58 L = new (this->Allocate<Label>()) Label();
65 Labels.push_back(L); 59 Labels.push_back(L);
66 return L; 60 return L;
67 } 61 }
68 if (Number > Labels.size()) { 62 if (Number > Labels.size()) {
(...skipping 2432 matching lines...) Expand 10 before | Expand all | Expand 10 after
2501 assert(shifter == RegX8632::Encoded_Reg_ecx); 2495 assert(shifter == RegX8632::Encoded_Reg_ecx);
2502 (void)shifter; 2496 (void)shifter;
2503 if (Ty == IceType_i16) 2497 if (Ty == IceType_i16)
2504 EmitOperandSizeOverride(); 2498 EmitOperandSizeOverride();
2505 EmitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3); 2499 EmitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3);
2506 EmitOperand(rm, operand); 2500 EmitOperand(rm, operand);
2507 } 2501 }
2508 2502
2509 } // end of namespace x86 2503 } // end of namespace x86
2510 } // end of namespace Ice 2504 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698