OLD | NEW |
1 //===- subzero/src/IceInstX8632.cpp - X86-32 instruction implementation ---===// | 1 //===- subzero/src/IceInstX8632.cpp - X86-32 instruction implementation ---===// |
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 assert(HasCR == IsRebased); | 124 assert(HasCR == IsRebased); |
125 else | 125 else |
126 assert(!IsRebased); | 126 assert(!IsRebased); |
127 } | 127 } |
128 | 128 |
129 } // end of anonymous namespace | 129 } // end of anonymous namespace |
130 | 130 |
131 void TargetX8632Traits::X86OperandMem::emit(const Cfg *Func) const { | 131 void TargetX8632Traits::X86OperandMem::emit(const Cfg *Func) const { |
132 if (!BuildDefs::dump()) | 132 if (!BuildDefs::dump()) |
133 return; | 133 return; |
134 const bool UseNonsfi = Func->getContext()->getFlags().getUseNonsfi(); | 134 const bool UseNonsfi = getFlags().getUseNonsfi(); |
135 validateMemOperandPIC(this, UseNonsfi); | 135 validateMemOperandPIC(this, UseNonsfi); |
136 const auto *Target = | 136 const auto *Target = |
137 static_cast<const ::Ice::X8632::TargetX8632 *>(Func->getTarget()); | 137 static_cast<const ::Ice::X8632::TargetX8632 *>(Func->getTarget()); |
138 // If the base is rematerializable, we need to replace it with the correct | 138 // If the base is rematerializable, we need to replace it with the correct |
139 // physical register (esp or ebp), and update the Offset. | 139 // physical register (esp or ebp), and update the Offset. |
140 int32_t Disp = 0; | 140 int32_t Disp = 0; |
141 if (getBase() && getBase()->isRematerializable()) { | 141 if (getBase() && getBase()->isRematerializable()) { |
142 Disp += getRematerializableOffset(getBase(), Target); | 142 Disp += getRematerializableOffset(getBase(), Target); |
143 } | 143 } |
144 // The index should never be rematerializable. But if we ever allow it, then | 144 // The index should never be rematerializable. But if we ever allow it, then |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 assert(SegmentReg >= 0 && SegmentReg < SegReg_NUM); | 256 assert(SegmentReg >= 0 && SegmentReg < SegReg_NUM); |
257 Asm->emitSegmentOverride(X8632::Traits::InstSegmentPrefixes[SegmentReg]); | 257 Asm->emitSegmentOverride(X8632::Traits::InstSegmentPrefixes[SegmentReg]); |
258 } | 258 } |
259 } | 259 } |
260 | 260 |
261 TargetX8632Traits::Address TargetX8632Traits::X86OperandMem::toAsmAddress( | 261 TargetX8632Traits::Address TargetX8632Traits::X86OperandMem::toAsmAddress( |
262 TargetX8632Traits::Assembler *Asm, | 262 TargetX8632Traits::Assembler *Asm, |
263 const Ice::TargetLowering *TargetLowering, bool /*IsLeaAddr*/) const { | 263 const Ice::TargetLowering *TargetLowering, bool /*IsLeaAddr*/) const { |
264 const auto *Target = | 264 const auto *Target = |
265 static_cast<const ::Ice::X8632::TargetX8632 *>(TargetLowering); | 265 static_cast<const ::Ice::X8632::TargetX8632 *>(TargetLowering); |
266 const bool UseNonsfi = Target->getGlobalContext()->getFlags().getUseNonsfi(); | 266 const bool UseNonsfi = getFlags().getUseNonsfi(); |
267 validateMemOperandPIC(this, UseNonsfi); | 267 validateMemOperandPIC(this, UseNonsfi); |
268 int32_t Disp = 0; | 268 int32_t Disp = 0; |
269 if (getBase() && getBase()->isRematerializable()) { | 269 if (getBase() && getBase()->isRematerializable()) { |
270 Disp += getRematerializableOffset(getBase(), Target); | 270 Disp += getRematerializableOffset(getBase(), Target); |
271 } | 271 } |
272 // The index should never be rematerializable. But if we ever allow it, then | 272 // The index should never be rematerializable. But if we ever allow it, then |
273 // we should make sure the rematerialization offset is shifted by the Shift | 273 // we should make sure the rematerialization offset is shifted by the Shift |
274 // value. | 274 // value. |
275 if (getIndex()) | 275 if (getIndex()) |
276 assert(!getIndex()->isRematerializable()); | 276 assert(!getIndex()->isRematerializable()); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 Var->dump(Func); | 346 Var->dump(Func); |
347 else | 347 else |
348 Var->dump(Str); | 348 Var->dump(Str); |
349 Str << ")"; | 349 Str << ")"; |
350 } | 350 } |
351 | 351 |
352 } // namespace X8632 | 352 } // namespace X8632 |
353 } // end of namespace Ice | 353 } // end of namespace Ice |
354 | 354 |
355 X86INSTS_DEFINE_STATIC_DATA(X8632, X8632::Traits) | 355 X86INSTS_DEFINE_STATIC_DATA(X8632, X8632::Traits) |
OLD | NEW |