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

Side by Side Diff: src/IceTargetLoweringX8664.cpp

Issue 1838753002: Subzero: Remove IceString. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 4 years, 8 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
« no previous file with comments | « src/IceTargetLoweringX8632Traits.h ('k') | src/IceTargetLoweringX8664Traits.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceTargetLoweringX8664.cpp - x86-64 lowering -----------===// 1 //===- subzero/src/IceTargetLoweringX8664.cpp - x86-64 lowering -----------===//
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 18 matching lines...) Expand all
29 } 29 }
30 30
31 std::unique_ptr<::Ice::TargetHeaderLowering> 31 std::unique_ptr<::Ice::TargetHeaderLowering>
32 createTargetHeaderLowering(::Ice::GlobalContext *Ctx) { 32 createTargetHeaderLowering(::Ice::GlobalContext *Ctx) {
33 return ::Ice::X8664::TargetHeaderX86::create(Ctx); 33 return ::Ice::X8664::TargetHeaderX86::create(Ctx);
34 } 34 }
35 35
36 void staticInit(::Ice::GlobalContext *Ctx) { 36 void staticInit(::Ice::GlobalContext *Ctx) {
37 ::Ice::X8664::TargetX8664::staticInit(Ctx); 37 ::Ice::X8664::TargetX8664::staticInit(Ctx);
38 } 38 }
39
40 bool shouldBePooled(const class ::Ice::Constant *C) {
41 return ::Ice::X8664::TargetX8664::shouldBePooled(C);
42 }
43
39 } // end of namespace X8664 44 } // end of namespace X8664
40 45
41 namespace Ice { 46 namespace Ice {
42 namespace X8664 { 47 namespace X8664 {
43 48
44 //------------------------------------------------------------------------------ 49 //------------------------------------------------------------------------------
45 // ______ ______ ______ __ ______ ______ 50 // ______ ______ ______ __ ______ ______
46 // /\__ _\ /\ == \ /\ __ \ /\ \ /\__ _\ /\ ___\ 51 // /\__ _\ /\ == \ /\ __ \ /\ \ /\__ _\ /\ ___\
47 // \/_/\ \/ \ \ __< \ \ __ \ \ \ \ \/_/\ \/ \ \___ \ 52 // \/_/\ \/ \ \ __< \ \ __ \ \ \ \ \/_/\ \/ \ \___ \
48 // \ \_\ \ \_\ \_\ \ \_\ \_\ \ \_\ \ \_\ \/\_____\ 53 // \ \_\ \ \_\ \_\ \ \_\ \_\ \ \_\ \ \_\ \/\_____\
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 342
338 Variable *Base = Mem->getBase(); 343 Variable *Base = Mem->getBase();
339 Variable *Index = Mem->getIndex(); 344 Variable *Index = Mem->getIndex();
340 uint16_t Shift = 0; 345 uint16_t Shift = 0;
341 Variable *ZeroReg = RebasePtr; 346 Variable *ZeroReg = RebasePtr;
342 Constant *Offset = Mem->getOffset(); 347 Constant *Offset = Mem->getOffset();
343 Variable *T = nullptr; 348 Variable *T = nullptr;
344 349
345 bool AbsoluteAddress = false; 350 bool AbsoluteAddress = false;
346 if (Base == nullptr && Index == nullptr) { 351 if (Base == nullptr && Index == nullptr) {
347 if (const auto *CR = llvm::dyn_cast<ConstantRelocatable>(Offset)) { 352 if (llvm::isa<ConstantRelocatable>(Offset)) {
348 if (CR->getName() != "") { 353 // Mem is RIP-relative. There's no need to rebase it.
349 // Mem is RIP-relative. There's no need to rebase it. 354 return Mem;
350 return Mem;
351 }
352 } 355 }
353 // Offset is an absolute address, so we need to emit 356 // Offset is an absolute address, so we need to emit
354 // Offset(%r15) 357 // Offset(%r15)
355 AbsoluteAddress = true; 358 AbsoluteAddress = true;
356 } 359 }
357 360
358 if (Mem->getIsRebased()) { 361 if (Mem->getIsRebased()) {
359 // If Mem.IsRebased, then we don't need to update Mem, as it's already been 362 // If Mem.IsRebased, then we don't need to update Mem, as it's already been
360 // updated to contain a reference to one of %rsp, %rbp, or %r15. 363 // updated to contain a reference to one of %rsp, %rbp, or %r15.
361 // We don't return early because we still need to zero extend Index. 364 // We don't return early because we still need to zero extend Index.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 } 407 }
405 408
406 // NeedsLea is a flags indicating whether Mem needs to be materialized to a 409 // NeedsLea is a flags indicating whether Mem needs to be materialized to a
407 // GPR prior to being used. A LEA is needed if Mem.Offset is a constant 410 // GPR prior to being used. A LEA is needed if Mem.Offset is a constant
408 // relocatable, or if Mem.Offset is negative. In both these cases, the LEA is 411 // relocatable, or if Mem.Offset is negative. In both these cases, the LEA is
409 // needed to ensure the sandboxed memory operand will only use the lower 412 // needed to ensure the sandboxed memory operand will only use the lower
410 // 32-bits of T+Offset. 413 // 32-bits of T+Offset.
411 bool NeedsLea = false; 414 bool NeedsLea = false;
412 if (Offset != nullptr) { 415 if (Offset != nullptr) {
413 if (const auto *CR = llvm::dyn_cast<ConstantRelocatable>(Offset)) { 416 if (const auto *CR = llvm::dyn_cast<ConstantRelocatable>(Offset)) {
414 NeedsLea = CR->getName() != "" || CR->getOffset() < 0; 417 NeedsLea = CR->getOffset() < 0;
415 } else if (const auto *Imm = llvm::dyn_cast<ConstantInteger32>(Offset)) { 418 } else if (const auto *Imm = llvm::dyn_cast<ConstantInteger32>(Offset)) {
416 NeedsLea = Imm->getValue() < 0; 419 NeedsLea = Imm->getValue() < 0;
417 } else { 420 } else {
418 llvm::report_fatal_error("Unexpected Offset type."); 421 llvm::report_fatal_error("Unexpected Offset type.");
419 } 422 }
420 } 423 }
421 424
422 RegNumT RegNum, RegNum32; 425 RegNumT RegNum, RegNum32;
423 if (T != nullptr) { 426 if (T != nullptr) {
424 if (T->hasReg()) { 427 if (T->hasReg()) {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 // 622 //
620 // ReturnReloc has an offset that is only known during binary emission. 623 // ReturnReloc has an offset that is only known during binary emission.
621 // Therefore, we set a custom emit string for ReturnReloc that will be 624 // Therefore, we set a custom emit string for ReturnReloc that will be
622 // used instead. In this particular case, the code will be emitted as 625 // used instead. In this particular case, the code will be emitted as
623 // 626 //
624 // push .after_call 627 // push .after_call
625 InstX86Label *ReturnAddress = InstX86Label::create(Func, this); 628 InstX86Label *ReturnAddress = InstX86Label::create(Func, this);
626 auto *ReturnRelocOffset = RelocOffset::create(Func->getAssembler()); 629 auto *ReturnRelocOffset = RelocOffset::create(Func->getAssembler());
627 ReturnAddress->setRelocOffset(ReturnRelocOffset); 630 ReturnAddress->setRelocOffset(ReturnRelocOffset);
628 constexpr RelocOffsetT NoFixedOffset = 0; 631 constexpr RelocOffsetT NoFixedOffset = 0;
629 const IceString EmitString = ReturnAddress->getName(Func); 632 const std::string EmitString =
633 BuildDefs::dump() ? ReturnAddress->getLabelName().toString() : "";
630 auto *ReturnReloc = ConstantRelocatable::create( 634 auto *ReturnReloc = ConstantRelocatable::create(
631 Func->getAssembler(), IceType_i32, 635 Func->getAssembler(), IceType_i32,
632 RelocatableTuple(NoFixedOffset, {ReturnRelocOffset}, 636 RelocatableTuple(NoFixedOffset, {ReturnRelocOffset},
633 Func->getFunctionName(), EmitString)); 637 Func->getFunctionName(), EmitString));
634 /* AutoBundle scoping */ { 638 /* AutoBundle scoping */ {
635 std::unique_ptr<AutoBundle> Bundler; 639 std::unique_ptr<AutoBundle> Bundler;
636 if (CallTargetR == nullptr) { 640 if (CallTargetR == nullptr) {
637 Bundler = makeUnique<AutoBundle>(this, InstBundleLock::Opt_PadToEnd); 641 Bundler = makeUnique<AutoBundle>(this, InstBundleLock::Opt_PadToEnd);
638 _push(ReturnReloc); 642 _push(ReturnReloc);
639 } else { 643 } else {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 #define X(tag, sizeLog2, align, elts, elty, str, rcstr) \ 810 #define X(tag, sizeLog2, align, elts, elty, str, rcstr) \
807 static_assert(_table1_##tag == _table2_##tag, \ 811 static_assert(_table1_##tag == _table2_##tag, \
808 "Inconsistency between ICETYPEX8664_TABLE and ICETYPE_TABLE"); 812 "Inconsistency between ICETYPEX8664_TABLE and ICETYPE_TABLE");
809 ICETYPE_TABLE 813 ICETYPE_TABLE
810 #undef X 814 #undef X
811 } // end of namespace dummy3 815 } // end of namespace dummy3
812 } // end of anonymous namespace 816 } // end of anonymous namespace
813 817
814 } // end of namespace X8664 818 } // end of namespace X8664
815 } // end of namespace Ice 819 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX8632Traits.h ('k') | src/IceTargetLoweringX8664Traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698