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

Side by Side Diff: src/IceTargetLoweringARM32.cpp

Issue 1361803002: Subzero: Improve handling of alloca instructions of constant size. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Apply x86-32 changes to x86-64 Created 5 years, 3 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/IceTargetLoweringARM32.cpp - ARM32 lowering ------------===// 1 //===- subzero/src/IceTargetLoweringARM32.cpp - ARM32 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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 // Helper function for addProlog(). 569 // Helper function for addProlog().
570 // 570 //
571 // This assumes Arg is an argument passed on the stack. This sets the frame 571 // This assumes Arg is an argument passed on the stack. This sets the frame
572 // offset for Arg and updates InArgsSizeBytes according to Arg's width. For an 572 // offset for Arg and updates InArgsSizeBytes according to Arg's width. For an
573 // I64 arg that has been split into Lo and Hi components, it calls itself 573 // I64 arg that has been split into Lo and Hi components, it calls itself
574 // recursively on the components, taking care to handle Lo first because of the 574 // recursively on the components, taking care to handle Lo first because of the
575 // little-endian architecture. Lastly, this function generates an instruction 575 // little-endian architecture. Lastly, this function generates an instruction
576 // to copy Arg into its assigned register if applicable. 576 // to copy Arg into its assigned register if applicable.
577 void TargetARM32::finishArgumentLowering(Variable *Arg, Variable *FramePtr, 577 void TargetARM32::finishArgumentLowering(Variable *Arg, Variable *FramePtr,
578 size_t BasicFrameOffset, 578 size_t BasicFrameOffset,
579 size_t StackAdjBytes,
579 size_t &InArgsSizeBytes) { 580 size_t &InArgsSizeBytes) {
580 if (auto *Arg64On32 = llvm::dyn_cast<Variable64On32>(Arg)) { 581 if (auto *Arg64On32 = llvm::dyn_cast<Variable64On32>(Arg)) {
581 Variable *Lo = Arg64On32->getLo(); 582 Variable *Lo = Arg64On32->getLo();
582 Variable *Hi = Arg64On32->getHi(); 583 Variable *Hi = Arg64On32->getHi();
583 finishArgumentLowering(Lo, FramePtr, BasicFrameOffset, InArgsSizeBytes); 584 finishArgumentLowering(Lo, FramePtr, BasicFrameOffset, StackAdjBytes,
584 finishArgumentLowering(Hi, FramePtr, BasicFrameOffset, InArgsSizeBytes); 585 InArgsSizeBytes);
586 finishArgumentLowering(Hi, FramePtr, BasicFrameOffset, StackAdjBytes,
587 InArgsSizeBytes);
585 return; 588 return;
586 } 589 }
587 Type Ty = Arg->getType(); 590 Type Ty = Arg->getType();
588 InArgsSizeBytes = applyStackAlignmentTy(InArgsSizeBytes, Ty); 591 InArgsSizeBytes = applyStackAlignmentTy(InArgsSizeBytes, Ty);
589 Arg->setStackOffset(BasicFrameOffset + InArgsSizeBytes); 592 Arg->setStackOffset(BasicFrameOffset + InArgsSizeBytes);
590 InArgsSizeBytes += typeWidthInBytesOnStack(Ty); 593 InArgsSizeBytes += typeWidthInBytesOnStack(Ty);
591 // If the argument variable has been assigned a register, we need to load the 594 // If the argument variable has been assigned a register, we need to load the
592 // value from the stack slot. 595 // value from the stack slot.
593 if (Arg->hasReg()) { 596 if (Arg->hasReg()) {
594 assert(Ty != IceType_i64); 597 assert(Ty != IceType_i64);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 int32_t DummyReg; 773 int32_t DummyReg;
771 InRegs = CC.FPInReg(Ty, &DummyReg); 774 InRegs = CC.FPInReg(Ty, &DummyReg);
772 } else if (Ty == IceType_i64) { 775 } else if (Ty == IceType_i64) {
773 std::pair<int32_t, int32_t> DummyRegs; 776 std::pair<int32_t, int32_t> DummyRegs;
774 InRegs = CC.I64InRegs(&DummyRegs); 777 InRegs = CC.I64InRegs(&DummyRegs);
775 } else { 778 } else {
776 assert(Ty == IceType_i32); 779 assert(Ty == IceType_i32);
777 int32_t DummyReg; 780 int32_t DummyReg;
778 InRegs = CC.I32InReg(&DummyReg); 781 InRegs = CC.I32InReg(&DummyReg);
779 } 782 }
780 if (!InRegs) 783 if (!InRegs) {
781 finishArgumentLowering(Arg, FramePtr, BasicFrameOffset, InArgsSizeBytes); 784 constexpr size_t StackAdjBytes = 0;
785 finishArgumentLowering(Arg, FramePtr, BasicFrameOffset, StackAdjBytes,
786 InArgsSizeBytes);
787 }
782 } 788 }
783 789
784 // Fill in stack offsets for locals. 790 // Fill in stack offsets for locals.
785 assignVarStackSlots(SortedSpilledVariables, SpillAreaPaddingBytes, 791 assignVarStackSlots(SortedSpilledVariables, SpillAreaPaddingBytes,
786 SpillAreaSizeBytes, GlobalsAndSubsequentPaddingSize, 792 SpillAreaSizeBytes, GlobalsAndSubsequentPaddingSize,
787 UsesFramePointer); 793 UsesFramePointer);
788 this->HasComputedFrame = true; 794 this->HasComputedFrame = true;
789 795
790 if (BuildDefs::dump() && Func->isVerbose(IceV_Frame)) { 796 if (BuildDefs::dump() && Func->isVerbose(IceV_Frame)) {
791 OstreamLocker L(Func->getContext()); 797 OstreamLocker L(Func->getContext());
(...skipping 2562 matching lines...) Expand 10 before | Expand all | Expand 10 after
3354 << ".eabi_attribute 68, 1 @ Tag_Virtualization_use\n"; 3360 << ".eabi_attribute 68, 1 @ Tag_Virtualization_use\n";
3355 if (CPUFeatures.hasFeature(TargetARM32Features::HWDivArm)) { 3361 if (CPUFeatures.hasFeature(TargetARM32Features::HWDivArm)) {
3356 Str << ".eabi_attribute 44, 2 @ Tag_DIV_use\n"; 3362 Str << ".eabi_attribute 44, 2 @ Tag_DIV_use\n";
3357 } 3363 }
3358 // Technically R9 is used for TLS with Sandboxing, and we reserve it. 3364 // Technically R9 is used for TLS with Sandboxing, and we reserve it.
3359 // However, for compatibility with current NaCl LLVM, don't claim that. 3365 // However, for compatibility with current NaCl LLVM, don't claim that.
3360 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; 3366 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n";
3361 } 3367 }
3362 3368
3363 } // end of namespace Ice 3369 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698