| OLD | NEW |
| 1 //===- subzero/src/IceInstX8664.cpp - X86-64 instruction implementation ---===// | 1 //===- subzero/src/IceInstX8664.cpp - X86-64 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 if (Index) | 85 if (Index) |
| 86 Vars[I++] = Index; | 86 Vars[I++] = Index; |
| 87 assert(I == NumVars); | 87 assert(I == NumVars); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 void MachineTraits<TargetX8664>::X86OperandMem::emit(const Cfg *Func) const { | 91 void MachineTraits<TargetX8664>::X86OperandMem::emit(const Cfg *Func) const { |
| 92 if (!BuildDefs::dump()) | 92 if (!BuildDefs::dump()) |
| 93 return; | 93 return; |
| 94 Ostream &Str = Func->getContext()->getStrEmit(); | 94 Ostream &Str = Func->getContext()->getStrEmit(); |
| 95 // Emit as Offset(Base,Index,1<<Shift). | 95 // Emit as Offset(Base,Index,1<<Shift). Offset is emitted without the leading |
| 96 // Offset is emitted without the leading '$'. | 96 // '$'. Omit the (Base,Index,1<<Shift) part if Base==nullptr. |
| 97 // Omit the (Base,Index,1<<Shift) part if Base==nullptr. | |
| 98 if (!Offset) { | 97 if (!Offset) { |
| 99 // No offset, emit nothing. | 98 // No offset, emit nothing. |
| 100 } else if (const auto CI = llvm::dyn_cast<ConstantInteger32>(Offset)) { | 99 } else if (const auto CI = llvm::dyn_cast<ConstantInteger32>(Offset)) { |
| 101 if (Base == nullptr || CI->getValue()) | 100 if (Base == nullptr || CI->getValue()) |
| 102 // Emit a non-zero offset without a leading '$'. | 101 // Emit a non-zero offset without a leading '$'. |
| 103 Str << CI->getValue(); | 102 Str << CI->getValue(); |
| 104 } else if (const auto CR = llvm::dyn_cast<ConstantRelocatable>(Offset)) { | 103 } else if (const auto CR = llvm::dyn_cast<ConstantRelocatable>(Offset)) { |
| 105 CR->emitWithoutPrefix(Func->getTarget()); | 104 CR->emitWithoutPrefix(Func->getTarget()); |
| 106 } else { | 105 } else { |
| 107 llvm_unreachable("Invalid offset type for x86 mem operand"); | 106 llvm_unreachable("Invalid offset type for x86 mem operand"); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 Var->dump(Func); | 247 Var->dump(Func); |
| 249 else | 248 else |
| 250 Var->dump(Str); | 249 Var->dump(Str); |
| 251 Str << ")"; | 250 Str << ")"; |
| 252 } | 251 } |
| 253 | 252 |
| 254 } // namespace X86Internal | 253 } // namespace X86Internal |
| 255 } // end of namespace Ice | 254 } // end of namespace Ice |
| 256 | 255 |
| 257 X86INSTS_DEFINE_STATIC_DATA(TargetX8664) | 256 X86INSTS_DEFINE_STATIC_DATA(TargetX8664) |
| OLD | NEW |