OLD | NEW |
1 //===- subzero/src/IceAssemblerX86BaseImpl.h - base x86 assembler -*- C++ -*-=// | 1 //===- subzero/src/IceAssemblerX86BaseImpl.h - base x86 assembler -*- 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 |
11 // | 11 // |
12 // This file is distributed under the University of Illinois Open Source | 12 // This file is distributed under the University of Illinois Open Source |
13 // License. See LICENSE.TXT for details. | 13 // License. See LICENSE.TXT for details. |
14 // | 14 // |
15 //===----------------------------------------------------------------------===// | 15 //===----------------------------------------------------------------------===// |
16 // | 16 // |
17 // This file implements the AssemblerX86Base template class, which is the base | 17 // This file implements the AssemblerX86Base template class, which is the base |
18 // Assembler class for X86 assemblers. | 18 // Assembler class for X86 assemblers. |
19 // | 19 // |
20 //===----------------------------------------------------------------------===// | 20 //===----------------------------------------------------------------------===// |
21 | 21 |
22 #include "IceAssemblerX86Base.h" | 22 #include "IceAssemblerX86Base.h" |
23 | 23 |
24 #include "IceCfg.h" | 24 #include "IceCfg.h" |
| 25 #include "IceCfgNode.h" |
25 #include "IceOperand.h" | 26 #include "IceOperand.h" |
26 | 27 |
27 namespace Ice { | 28 namespace Ice { |
28 namespace X86Internal { | 29 namespace X86Internal { |
29 | 30 |
30 template <class Machine> | 31 template <class Machine> |
31 AssemblerX86Base<Machine>::~AssemblerX86Base<Machine>() { | 32 AssemblerX86Base<Machine>::~AssemblerX86Base<Machine>() { |
32 if (BuildDefs::asserts()) { | 33 if (BuildDefs::asserts()) { |
33 for (const Label *Label : CfgNodeLabels) { | 34 for (const Label *Label : CfgNodeLabels) { |
34 Label->finalCheck(); | 35 Label->finalCheck(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 Label *AssemblerX86Base<Machine>::getOrCreateCfgNodeLabel(SizeT NodeNumber) { | 80 Label *AssemblerX86Base<Machine>::getOrCreateCfgNodeLabel(SizeT NodeNumber) { |
80 return getOrCreateLabel(NodeNumber, CfgNodeLabels); | 81 return getOrCreateLabel(NodeNumber, CfgNodeLabels); |
81 } | 82 } |
82 | 83 |
83 template <class Machine> | 84 template <class Machine> |
84 Label *AssemblerX86Base<Machine>::getOrCreateLocalLabel(SizeT Number) { | 85 Label *AssemblerX86Base<Machine>::getOrCreateLocalLabel(SizeT Number) { |
85 return getOrCreateLabel(Number, LocalLabels); | 86 return getOrCreateLabel(Number, LocalLabels); |
86 } | 87 } |
87 | 88 |
88 template <class Machine> | 89 template <class Machine> |
89 void AssemblerX86Base<Machine>::bindCfgNodeLabel(SizeT NodeNumber) { | 90 void AssemblerX86Base<Machine>::bindCfgNodeLabel(const CfgNode *Node) { |
90 assert(!getPreliminary()); | 91 assert(!getPreliminary()); |
91 Label *L = getOrCreateCfgNodeLabel(NodeNumber); | 92 Label *L = getOrCreateCfgNodeLabel(Node->getIndex()); |
92 this->bind(L); | 93 this->bind(L); |
93 } | 94 } |
94 | 95 |
95 template <class Machine> | 96 template <class Machine> |
96 void AssemblerX86Base<Machine>::bindLocalLabel(SizeT Number) { | 97 void AssemblerX86Base<Machine>::bindLocalLabel(SizeT Number) { |
97 Label *L = getOrCreateLocalLabel(Number); | 98 Label *L = getOrCreateLocalLabel(Number); |
98 if (!getPreliminary()) | 99 if (!getPreliminary()) |
99 this->bind(L); | 100 this->bind(L); |
100 } | 101 } |
101 | 102 |
(...skipping 3334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3436 (void)shifter; | 3437 (void)shifter; |
3437 if (Ty == IceType_i16) | 3438 if (Ty == IceType_i16) |
3438 emitOperandSizeOverride(); | 3439 emitOperandSizeOverride(); |
3439 emitRexB(Ty, operand.rm()); | 3440 emitRexB(Ty, operand.rm()); |
3440 emitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3); | 3441 emitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3); |
3441 emitOperand(rm, operand); | 3442 emitOperand(rm, operand); |
3442 } | 3443 } |
3443 | 3444 |
3444 } // end of namespace X86Internal | 3445 } // end of namespace X86Internal |
3445 } // end of namespace Ice | 3446 } // end of namespace Ice |
OLD | NEW |