Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: src/IceInstX8664.cpp

Issue 1669443002: Subzero. Uses fixups to calculate addend to relocations. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 assert(!getIndex()->isRematerializable()); 261 assert(!getIndex()->isRematerializable());
262 } 262 }
263 263
264 AssemblerFixup *Fixup = nullptr; 264 AssemblerFixup *Fixup = nullptr;
265 // Determine the offset (is it relocatable?) 265 // Determine the offset (is it relocatable?)
266 if (getOffset() != nullptr) { 266 if (getOffset() != nullptr) {
267 if (const auto *CI = llvm::dyn_cast<ConstantInteger32>(getOffset())) { 267 if (const auto *CI = llvm::dyn_cast<ConstantInteger32>(getOffset())) {
268 Disp += static_cast<int32_t>(CI->getValue()); 268 Disp += static_cast<int32_t>(CI->getValue());
269 } else if (const auto *CR = 269 } else if (const auto *CR =
270 llvm::dyn_cast<ConstantRelocatable>(getOffset())) { 270 llvm::dyn_cast<ConstantRelocatable>(getOffset())) {
271 RelocOffsetT DispAdjustment = 0;
272 if (CR->getName() != "") { 271 if (CR->getName() != "") {
273 const auto FixupKind = 272 const auto FixupKind =
274 (getBase() != nullptr || getIndex() != nullptr) ? FK_Abs : FK_PcRel; 273 (getBase() != nullptr || getIndex() != nullptr) ? FK_Abs : FK_PcRel;
275 DispAdjustment = FixupKind == FK_PcRel ? 4 : 0; 274 const RelocOffsetT DispAdjustment = FixupKind == FK_PcRel ? 4 : 0;
276 Fixup = Asm->createFixup(FixupKind, CR); 275 Fixup = Asm->createFixup(FixupKind, CR);
276 Fixup->set_addend(-DispAdjustment);
277 } 277 }
278 Disp = CR->getOffset() - DispAdjustment; 278 Disp = CR->getOffset();
279 } else { 279 } else {
280 llvm_unreachable("Unexpected offset type"); 280 llvm_unreachable("Unexpected offset type");
281 } 281 }
282 } 282 }
283 283
284 // Now convert to the various possible forms. 284 // Now convert to the various possible forms.
285 if (getBase() && getIndex()) { 285 if (getBase() && getIndex()) {
286 const bool NeedSandboxing = Target->needSandboxing(); 286 const bool NeedSandboxing = Target->needSandboxing();
287 (void)NeedSandboxing; 287 (void)NeedSandboxing;
288 assert(!NeedSandboxing || IsLeaAddr || 288 assert(!NeedSandboxing || IsLeaAddr ||
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 Var->dump(Func); 357 Var->dump(Func);
358 else 358 else
359 Var->dump(Str); 359 Var->dump(Str);
360 Str << ")"; 360 Str << ")";
361 } 361 }
362 362
363 } // namespace X8664 363 } // namespace X8664
364 } // end of namespace Ice 364 } // end of namespace Ice
365 365
366 X86INSTS_DEFINE_STATIC_DATA(X8664, X8664::Traits) 366 X86INSTS_DEFINE_STATIC_DATA(X8664, X8664::Traits)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698