| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 MachineTraits<TargetX8664>::X86OperandMem::toAsmAddress( | 172 MachineTraits<TargetX8664>::X86OperandMem::toAsmAddress( |
| 173 MachineTraits<TargetX8664>::Assembler *Asm) const { | 173 MachineTraits<TargetX8664>::Assembler *Asm) const { |
| 174 int32_t Disp = 0; | 174 int32_t Disp = 0; |
| 175 AssemblerFixup *Fixup = nullptr; | 175 AssemblerFixup *Fixup = nullptr; |
| 176 // Determine the offset (is it relocatable?) | 176 // Determine the offset (is it relocatable?) |
| 177 if (getOffset()) { | 177 if (getOffset()) { |
| 178 if (const auto CI = llvm::dyn_cast<ConstantInteger32>(getOffset())) { | 178 if (const auto CI = llvm::dyn_cast<ConstantInteger32>(getOffset())) { |
| 179 Disp = static_cast<int32_t>(CI->getValue()); | 179 Disp = static_cast<int32_t>(CI->getValue()); |
| 180 } else if (const auto CR = | 180 } else if (const auto CR = |
| 181 llvm::dyn_cast<ConstantRelocatable>(getOffset())) { | 181 llvm::dyn_cast<ConstantRelocatable>(getOffset())) { |
| 182 Disp = CR->getOffset(); | 182 Disp = CR->getOffset() - 4; |
| 183 Fixup = Asm->createFixup(llvm::ELF::R_386_32, CR); | 183 Fixup = Asm->createFixup(PcRelFixup, CR); |
| 184 } else { | 184 } else { |
| 185 llvm_unreachable("Unexpected offset type"); | 185 llvm_unreachable("Unexpected offset type"); |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 | 188 |
| 189 // Now convert to the various possible forms. | 189 // Now convert to the various possible forms. |
| 190 if (getBase() && getIndex()) { | 190 if (getBase() && getIndex()) { |
| 191 return X8664::Traits::Address( | 191 return X8664::Traits::Address( |
| 192 RegX8664::getEncodedGPR(getBase()->getRegNum()), | 192 RegX8664::getEncodedGPR(getBase()->getRegNum()), |
| 193 RegX8664::getEncodedGPR(getIndex()->getRegNum()), | 193 RegX8664::getEncodedGPR(getIndex()->getRegNum()), |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 Var->dump(Func); | 248 Var->dump(Func); |
| 249 else | 249 else |
| 250 Var->dump(Str); | 250 Var->dump(Str); |
| 251 Str << ")"; | 251 Str << ")"; |
| 252 } | 252 } |
| 253 | 253 |
| 254 } // namespace X86Internal | 254 } // namespace X86Internal |
| 255 } // end of namespace Ice | 255 } // end of namespace Ice |
| 256 | 256 |
| 257 X86INSTS_DEFINE_STATIC_DATA(TargetX8664); | 257 X86INSTS_DEFINE_STATIC_DATA(TargetX8664); |
| OLD | NEW |