OLD | NEW |
---|---|
1 //===- subzero/src/IceTargetLoweringX8632Traits.h - x86-32 traits -*- C++ -*-=// | 1 //===- subzero/src/IceTargetLoweringX8632Traits.h - x86-32 traits -*- C++ -*-=// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 /// | 9 /// |
10 /// \file | 10 /// \file |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 Address() = delete; | 175 Address() = delete; |
176 | 176 |
177 public: | 177 public: |
178 Address(const Address &other) : Operand(other) {} | 178 Address(const Address &other) : Operand(other) {} |
179 | 179 |
180 Address &operator=(const Address &other) { | 180 Address &operator=(const Address &other) { |
181 Operand::operator=(other); | 181 Operand::operator=(other); |
182 return *this; | 182 return *this; |
183 } | 183 } |
184 | 184 |
185 Address(GPRRegister base, int32_t disp) { | 185 Address(GPRRegister base, int32_t disp, AssemblerFixup *fixup = nullptr) { |
Jim Stichnoth
2015/10/27 05:52:34
Maybe we can make fixup a required parameter, rath
sehr
2015/10/27 21:48:00
Done.
| |
186 if (disp == 0 && base != RegX8632::Encoded_Reg_ebp) { | 186 if (disp == 0 && base != RegX8632::Encoded_Reg_ebp) { |
187 SetModRM(0, base); | 187 SetModRM(0, base); |
188 if (base == RegX8632::Encoded_Reg_esp) | 188 if (base == RegX8632::Encoded_Reg_esp) |
189 SetSIB(TIMES_1, RegX8632::Encoded_Reg_esp, base); | 189 SetSIB(TIMES_1, RegX8632::Encoded_Reg_esp, base); |
190 } else if (Utils::IsInt(8, disp)) { | 190 } else if (Utils::IsInt(8, disp)) { |
191 SetModRM(1, base); | 191 SetModRM(1, base); |
192 if (base == RegX8632::Encoded_Reg_esp) | 192 if (base == RegX8632::Encoded_Reg_esp) |
193 SetSIB(TIMES_1, RegX8632::Encoded_Reg_esp, base); | 193 SetSIB(TIMES_1, RegX8632::Encoded_Reg_esp, base); |
194 SetDisp8(disp); | 194 SetDisp8(disp); |
195 // TODO(sehr): determine if there are 8-bit relocations. | |
Jim Stichnoth
2015/10/27 13:57:10
Here and in the TODO below, if there is a fixup, I
Jim Stichnoth
2015/10/27 13:57:10
One separate note on these fixups. It seems that
sehr
2015/10/27 21:48:00
Agreed, and that fixed my other bug. Thanks!
sehr
2015/10/27 21:48:00
Added flag/assertions in IceFixups.h
| |
195 } else { | 196 } else { |
196 SetModRM(2, base); | 197 SetModRM(2, base); |
197 if (base == RegX8632::Encoded_Reg_esp) | 198 if (base == RegX8632::Encoded_Reg_esp) |
198 SetSIB(TIMES_1, RegX8632::Encoded_Reg_esp, base); | 199 SetSIB(TIMES_1, RegX8632::Encoded_Reg_esp, base); |
199 SetDisp32(disp); | 200 SetDisp32(disp); |
201 if (fixup) | |
202 SetFixup(fixup); | |
200 } | 203 } |
201 } | 204 } |
202 | 205 |
203 Address(GPRRegister index, ScaleFactor scale, int32_t disp) { | 206 Address(GPRRegister index, ScaleFactor scale, int32_t disp, |
207 AssemblerFixup *fixup = nullptr) { | |
204 assert(index != RegX8632::Encoded_Reg_esp); // Illegal addressing mode. | 208 assert(index != RegX8632::Encoded_Reg_esp); // Illegal addressing mode. |
205 SetModRM(0, RegX8632::Encoded_Reg_esp); | 209 SetModRM(0, RegX8632::Encoded_Reg_esp); |
206 SetSIB(scale, index, RegX8632::Encoded_Reg_ebp); | 210 SetSIB(scale, index, RegX8632::Encoded_Reg_ebp); |
207 SetDisp32(disp); | 211 SetDisp32(disp); |
212 if (fixup) | |
213 SetFixup(fixup); | |
208 } | 214 } |
209 | 215 |
210 Address(GPRRegister base, GPRRegister index, ScaleFactor scale, | 216 Address(GPRRegister base, GPRRegister index, ScaleFactor scale, |
211 int32_t disp) { | 217 int32_t disp, AssemblerFixup *fixup = nullptr) { |
212 assert(index != RegX8632::Encoded_Reg_esp); // Illegal addressing mode. | 218 assert(index != RegX8632::Encoded_Reg_esp); // Illegal addressing mode. |
213 if (disp == 0 && base != RegX8632::Encoded_Reg_ebp) { | 219 if (disp == 0 && base != RegX8632::Encoded_Reg_ebp) { |
214 SetModRM(0, RegX8632::Encoded_Reg_esp); | 220 SetModRM(0, RegX8632::Encoded_Reg_esp); |
215 SetSIB(scale, index, base); | 221 SetSIB(scale, index, base); |
216 } else if (Utils::IsInt(8, disp)) { | 222 } else if (Utils::IsInt(8, disp)) { |
217 SetModRM(1, RegX8632::Encoded_Reg_esp); | 223 SetModRM(1, RegX8632::Encoded_Reg_esp); |
218 SetSIB(scale, index, base); | 224 SetSIB(scale, index, base); |
219 SetDisp8(disp); | 225 SetDisp8(disp); |
226 // TODO(sehr): determine if there are 8-bit relocations. | |
220 } else { | 227 } else { |
221 SetModRM(2, RegX8632::Encoded_Reg_esp); | 228 SetModRM(2, RegX8632::Encoded_Reg_esp); |
222 SetSIB(scale, index, base); | 229 SetSIB(scale, index, base); |
223 SetDisp32(disp); | 230 SetDisp32(disp); |
231 if (fixup) | |
232 SetFixup(fixup); | |
224 } | 233 } |
225 } | 234 } |
226 | 235 |
227 /// AbsoluteTag is a special tag used by clients to create an absolute | 236 /// AbsoluteTag is a special tag used by clients to create an absolute |
228 /// Address. | 237 /// Address. |
229 enum AbsoluteTag { ABSOLUTE }; | 238 enum AbsoluteTag { ABSOLUTE }; |
230 | 239 |
231 Address(AbsoluteTag, const uintptr_t Addr) { | 240 Address(AbsoluteTag, const uintptr_t Addr) { |
232 SetModRM(0, RegX8632::Encoded_Reg_ebp); | 241 SetModRM(0, RegX8632::Encoded_Reg_ebp); |
233 SetDisp32(Addr); | 242 SetDisp32(Addr); |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
741 | 750 |
742 } // end of namespace X86Internal | 751 } // end of namespace X86Internal |
743 | 752 |
744 namespace X8632 { | 753 namespace X8632 { |
745 using Traits = ::Ice::X86Internal::MachineTraits<TargetX8632>; | 754 using Traits = ::Ice::X86Internal::MachineTraits<TargetX8632>; |
746 } // end of namespace X8632 | 755 } // end of namespace X8632 |
747 | 756 |
748 } // end of namespace Ice | 757 } // end of namespace Ice |
749 | 758 |
750 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632TRAITS_H | 759 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632TRAITS_H |
OLD | NEW |