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

Side by Side Diff: src/IceTargetLoweringX86Base.h

Issue 1435363002: Merge fixed alloca stack adjustments into the prolog (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Final code review comments Created 5 years, 1 month 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/IceTargetLoweringX8632.cpp ('k') | src/PNaClTranslator.cpp » ('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/IceTargetLoweringX86Base.h - x86 lowering ----*- C++ -*-===// 1 //===- subzero/src/IceTargetLoweringX86Base.h - x86 lowering ----*- C++ -*-===//
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 83
84 const llvm::SmallBitVector &getAliasesForRegister(SizeT Reg) const override { 84 const llvm::SmallBitVector &getAliasesForRegister(SizeT Reg) const override {
85 assert(Reg < Traits::RegisterSet::Reg_NUM); 85 assert(Reg < Traits::RegisterSet::Reg_NUM);
86 return RegisterAliases[Reg]; 86 return RegisterAliases[Reg];
87 } 87 }
88 88
89 bool hasFramePointer() const override { return IsEbpBasedFrame; } 89 bool hasFramePointer() const override { return IsEbpBasedFrame; }
90 void setHasFramePointer() override { IsEbpBasedFrame = true; } 90 void setHasFramePointer() override { IsEbpBasedFrame = true; }
91 SizeT getStackReg() const override { return Traits::RegisterSet::Reg_esp; } 91 SizeT getStackReg() const override { return Traits::RegisterSet::Reg_esp; }
92 SizeT getFrameReg() const override { return Traits::RegisterSet::Reg_ebp; }
92 SizeT getFrameOrStackReg() const override { 93 SizeT getFrameOrStackReg() const override {
93 return IsEbpBasedFrame ? Traits::RegisterSet::Reg_ebp 94 return IsEbpBasedFrame ? getFrameReg() : getStackReg();
94 : Traits::RegisterSet::Reg_esp;
95 } 95 }
96 size_t typeWidthInBytesOnStack(Type Ty) const override { 96 size_t typeWidthInBytesOnStack(Type Ty) const override {
97 // Round up to the next multiple of WordType bytes. 97 // Round up to the next multiple of WordType bytes.
98 const uint32_t WordSizeInBytes = typeWidthInBytes(Traits::WordType); 98 const uint32_t WordSizeInBytes = typeWidthInBytes(Traits::WordType);
99 return Utils::applyAlignment(typeWidthInBytes(Ty), WordSizeInBytes); 99 return Utils::applyAlignment(typeWidthInBytes(Ty), WordSizeInBytes);
100 } 100 }
101 uint32_t getStackAlignment() const override { 101 uint32_t getStackAlignment() const override {
102 return Traits::X86_STACK_ALIGNMENT_BYTES; 102 return Traits::X86_STACK_ALIGNMENT_BYTES;
103 } 103 }
104 void reserveFixedAllocaArea(size_t Size, size_t Align) override {
105 FixedAllocaSizeBytes = Size;
106 assert(llvm::isPowerOf2_32(Align));
107 FixedAllocaAlignBytes = Align;
108 PrologEmitsFixedAllocas = true;
109 }
110 /// Returns the (negative) offset from ebp/rbp where the fixed Allocas start.
111 int32_t getFrameFixedAllocaOffset() const override {
112 return FixedAllocaSizeBytes - SpillAreaSizeBytes;
113 }
104 114
105 bool shouldSplitToVariable64On32(Type Ty) const override { 115 bool shouldSplitToVariable64On32(Type Ty) const override {
106 return Traits::Is64Bit ? false : Ty == IceType_i64; 116 return Traits::Is64Bit ? false : Ty == IceType_i64;
107 } 117 }
108 118
109 SizeT getMinJumpTableSize() const override { return 4; } 119 SizeT getMinJumpTableSize() const override { return 4; }
110 120
111 void emitVariable(const Variable *Var) const override; 121 void emitVariable(const Variable *Var) const override;
112 122
113 const char *getConstantPrefix() const final { return "$"; } 123 const char *getConstantPrefix() const final { return "$"; }
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 694
685 bool optimizeScalarMul(Variable *Dest, Operand *Src0, int32_t Src1); 695 bool optimizeScalarMul(Variable *Dest, Operand *Src0, int32_t Src1);
686 void findRMW(); 696 void findRMW();
687 697
688 typename Traits::InstructionSet InstructionSet = 698 typename Traits::InstructionSet InstructionSet =
689 Traits::InstructionSet::Begin; 699 Traits::InstructionSet::Begin;
690 bool IsEbpBasedFrame = false; 700 bool IsEbpBasedFrame = false;
691 bool NeedsStackAlignment = false; 701 bool NeedsStackAlignment = false;
692 size_t SpillAreaSizeBytes = 0; 702 size_t SpillAreaSizeBytes = 0;
693 size_t FixedAllocaSizeBytes = 0; 703 size_t FixedAllocaSizeBytes = 0;
704 size_t FixedAllocaAlignBytes = 0;
705 bool PrologEmitsFixedAllocas = false;
694 static std::array<llvm::SmallBitVector, RCX86_NUM> TypeToRegisterSet; 706 static std::array<llvm::SmallBitVector, RCX86_NUM> TypeToRegisterSet;
695 static std::array<llvm::SmallBitVector, Traits::RegisterSet::Reg_NUM> 707 static std::array<llvm::SmallBitVector, Traits::RegisterSet::Reg_NUM>
696 RegisterAliases; 708 RegisterAliases;
697 static llvm::SmallBitVector ScratchRegs; 709 static llvm::SmallBitVector ScratchRegs;
698 llvm::SmallBitVector RegsUsed; 710 llvm::SmallBitVector RegsUsed;
699 std::array<VarList, IceType_NUM> PhysicalRegisters; 711 std::array<VarList, IceType_NUM> PhysicalRegisters;
700 712
701 /// Randomize a given immediate operand 713 /// Randomize a given immediate operand
702 Operand *randomizeOrPoolImmediate(Constant *Immediate, 714 Operand *randomizeOrPoolImmediate(Constant *Immediate,
703 int32_t RegNum = Variable::NoRegister); 715 int32_t RegNum = Variable::NoRegister);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 lowerIcmp64(const InstIcmp *Icmp, const InstBr *Br); 771 lowerIcmp64(const InstIcmp *Icmp, const InstBr *Br);
760 772
761 BoolFolding FoldingInfo; 773 BoolFolding FoldingInfo;
762 }; 774 };
763 } // end of namespace X86Internal 775 } // end of namespace X86Internal
764 } // end of namespace Ice 776 } // end of namespace Ice
765 777
766 #include "IceTargetLoweringX86BaseImpl.h" 778 #include "IceTargetLoweringX86BaseImpl.h"
767 779
768 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H 780 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | src/PNaClTranslator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698