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

Side by Side Diff: src/IceTargetLoweringARM32.h

Issue 1467473003: Subzero. ARM32. No more SP frobbing. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Adds TODO() for fixing an unrelated bug. 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
OLDNEW
1 //===- subzero/src/IceTargetLoweringARM32.h - ARM32 lowering ----*- C++ -*-===// 1 //===- subzero/src/IceTargetLoweringARM32.h - ARM32 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 void _adds(Variable *Dest, Variable *Src0, Operand *Src1, 281 void _adds(Variable *Dest, Variable *Src0, Operand *Src1,
282 CondARM32::Cond Pred = CondARM32::AL) { 282 CondARM32::Cond Pred = CondARM32::AL) {
283 constexpr bool SetFlags = true; 283 constexpr bool SetFlags = true;
284 Context.insert( 284 Context.insert(
285 InstARM32Add::create(Func, Dest, Src0, Src1, Pred, SetFlags)); 285 InstARM32Add::create(Func, Dest, Src0, Src1, Pred, SetFlags));
286 } 286 }
287 void _adc(Variable *Dest, Variable *Src0, Operand *Src1, 287 void _adc(Variable *Dest, Variable *Src0, Operand *Src1,
288 CondARM32::Cond Pred = CondARM32::AL) { 288 CondARM32::Cond Pred = CondARM32::AL) {
289 Context.insert(InstARM32Adc::create(Func, Dest, Src0, Src1, Pred)); 289 Context.insert(InstARM32Adc::create(Func, Dest, Src0, Src1, Pred));
290 } 290 }
291 void _adjust_stack(int32_t Amount, Operand *SrcAmount) {
292 Context.insert(InstARM32AdjustStack::create(
293 Func, getPhysicalRegister(RegARM32::Reg_sp), Amount, SrcAmount));
294 }
295 void _and(Variable *Dest, Variable *Src0, Operand *Src1, 291 void _and(Variable *Dest, Variable *Src0, Operand *Src1,
296 CondARM32::Cond Pred = CondARM32::AL) { 292 CondARM32::Cond Pred = CondARM32::AL) {
297 Context.insert(InstARM32And::create(Func, Dest, Src0, Src1, Pred)); 293 Context.insert(InstARM32And::create(Func, Dest, Src0, Src1, Pred));
298 } 294 }
299 void _asr(Variable *Dest, Variable *Src0, Operand *Src1, 295 void _asr(Variable *Dest, Variable *Src0, Operand *Src1,
300 CondARM32::Cond Pred = CondARM32::AL) { 296 CondARM32::Cond Pred = CondARM32::AL) {
301 Context.insert(InstARM32Asr::create(Func, Dest, Src0, Src1, Pred)); 297 Context.insert(InstARM32Asr::create(Func, Dest, Src0, Src1, Pred));
302 } 298 }
303 void _bic(Variable *Dest, Variable *Src0, Operand *Src1, 299 void _bic(Variable *Dest, Variable *Src0, Operand *Src1,
304 CondARM32::Cond Pred = CondARM32::AL) { 300 CondARM32::Cond Pred = CondARM32::AL) {
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 Context.insert(InstARM32Vmul::create(Func, Dest, Src0, Src1)); 801 Context.insert(InstARM32Vmul::create(Func, Dest, Src0, Src1));
806 } 802 }
807 void _vsqrt(Variable *Dest, Variable *Src, 803 void _vsqrt(Variable *Dest, Variable *Src,
808 CondARM32::Cond Pred = CondARM32::AL) { 804 CondARM32::Cond Pred = CondARM32::AL) {
809 Context.insert(InstARM32Vsqrt::create(Func, Dest, Src, Pred)); 805 Context.insert(InstARM32Vsqrt::create(Func, Dest, Src, Pred));
810 } 806 }
811 void _vsub(Variable *Dest, Variable *Src0, Variable *Src1) { 807 void _vsub(Variable *Dest, Variable *Src0, Variable *Src1) {
812 Context.insert(InstARM32Vsub::create(Func, Dest, Src0, Src1)); 808 Context.insert(InstARM32Vsub::create(Func, Dest, Src0, Src1));
813 } 809 }
814 810
811 // Iterates over the CFG and determines the maximum outgoing stack arguments
812 // bytes. This information is later used during addProlog() do pre-allocate
813 // the outargs area.
814 // TODO(jpp): This could live in the Parser, if we provided a Target-specific
815 // method that the Parser could call.
816 void findMaxStackOutArgsSize();
sehr 2015/11/20 20:07:35 FWIW, I like the idea of making the method that co
John 2015/11/20 22:17:17 I added the abstract virtual method, and I am now
817
815 /// Run a pass through stack variables and ensure that the offsets are legal. 818 /// Run a pass through stack variables and ensure that the offsets are legal.
816 /// If the offset is not legal, use a new base register that accounts for the 819 /// If the offset is not legal, use a new base register that accounts for the
817 /// offset, such that the addressing mode offset bits are now legal. 820 /// offset, such that the addressing mode offset bits are now legal.
818 void legalizeStackSlots(); 821 void legalizeStackSlots();
819 /// Returns true if the given Offset can be represented in a ldr/str. 822 /// Returns true if the given Offset can be represented in a ldr/str.
820 bool isLegalMemOffset(Type Ty, int32_t Offset) const; 823 bool isLegalMemOffset(Type Ty, int32_t Offset) const;
821 // Creates a new Base register centered around 824 // Creates a new Base register centered around
822 // [OrigBaseReg, +/- Offset+StackAdjust]. 825 // [OrigBaseReg, +/- Offset].
823 Variable *newBaseRegister(int32_t Offset, int32_t StackAdjust, 826 Variable *newBaseRegister(int32_t Offset, Variable *OrigBaseReg);
824 Variable *OrigBaseReg); 827 /// Creates a new, legal OperandARM32Mem for accessing OrigBase + Offset. The
825 /// Creates a new, legal OperandARM32Mem for accessing OrigBase + Offset + 828 /// returned mem operand is a legal operand for accessing memory that is of
826 /// StackAdjust. The returned mem operand is a legal operand for accessing 829 /// type Ty.
827 /// memory that is of type Ty.
828 /// 830 ///
829 /// If [OrigBaseReg, #Offset+StackAdjust] is encodable, then the method 831 /// If [OrigBaseReg, #Offset] is encodable, then the method returns a Mem
830 /// returns a Mem operand expressing it. Otherwise, 832 /// operand expressing it. Otherwise,
831 /// 833 ///
832 /// if [*NewBaseReg, #Offset+StackAdjust-*NewBaseOffset] is encodable, the 834 /// if [*NewBaseReg, #Offset-*NewBaseOffset] is encodable, the method will
833 /// method will return that. Otherwise, 835 /// return that. Otherwise,
834 /// 836 ///
835 /// a new base register ip=OrigBaseReg+Offset+StackAdjust is created, and the 837 /// a new base register ip=OrigBaseReg+Offsetis created, and the method
sehr 2015/11/20 20:07:35 nit: Offset is
John 2015/11/20 22:17:17 Done.
836 /// method returns [ip, #0]. 838 /// returns [ip, #0].
837 OperandARM32Mem *createMemOperand(Type Ty, int32_t Offset, 839 OperandARM32Mem *createMemOperand(Type Ty, int32_t Offset,
838 int32_t StackAdjust, Variable *OrigBaseReg, 840 Variable *OrigBaseReg,
839 Variable **NewBaseReg, 841 Variable **NewBaseReg,
840 int32_t *NewBaseOffset); 842 int32_t *NewBaseOffset);
841 /// Legalizes Mov if its Source (or Destination) is a spilled Variable. Moves 843 /// Legalizes Mov if its Source (or Destination) is a spilled Variable. Moves
842 /// to memory become store instructions, and moves from memory, loads. 844 /// to memory become store instructions, and moves from memory, loads.
843 void legalizeMov(InstARM32Mov *Mov, int32_t StackAdjust, 845 void legalizeMov(InstARM32Mov *Mov, Variable *OrigBaseReg,
844 Variable *OrigBaseReg, Variable **NewBaseReg, 846 Variable **NewBaseReg, int32_t *NewBaseOffset);
845 int32_t *NewBaseOffset);
846 847
847 TargetARM32Features CPUFeatures; 848 TargetARM32Features CPUFeatures;
848 bool UsesFramePointer = false; 849 bool UsesFramePointer = false;
849 bool NeedsStackAlignment = false; 850 bool NeedsStackAlignment = false;
850 bool MaybeLeafFunc = true; 851 bool MaybeLeafFunc = true;
851 size_t SpillAreaSizeBytes = 0; 852 size_t SpillAreaSizeBytes = 0;
853 size_t MaxOutArgsSizeBytes = 0;
852 // TODO(jpp): std::array instead of array. 854 // TODO(jpp): std::array instead of array.
853 static llvm::SmallBitVector TypeToRegisterSet[RCARM32_NUM]; 855 static llvm::SmallBitVector TypeToRegisterSet[RCARM32_NUM];
854 static llvm::SmallBitVector RegisterAliases[RegARM32::Reg_NUM]; 856 static llvm::SmallBitVector RegisterAliases[RegARM32::Reg_NUM];
855 static llvm::SmallBitVector ScratchRegs; 857 static llvm::SmallBitVector ScratchRegs;
856 llvm::SmallBitVector RegsUsed; 858 llvm::SmallBitVector RegsUsed;
857 VarList PhysicalRegisters[IceType_NUM]; 859 VarList PhysicalRegisters[IceType_NUM];
858 860
859 /// Helper class that understands the Calling Convention and register 861 /// Helper class that understands the Calling Convention and register
860 /// assignments. The first few integer type parameters can use r0-r3, 862 /// assignments. The first few integer type parameters can use r0-r3,
861 /// regardless of their position relative to the floating-point/vector 863 /// regardless of their position relative to the floating-point/vector
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 1009
1008 private: 1010 private:
1009 ~TargetHeaderARM32() = default; 1011 ~TargetHeaderARM32() = default;
1010 1012
1011 TargetARM32Features CPUFeatures; 1013 TargetARM32Features CPUFeatures;
1012 }; 1014 };
1013 1015
1014 } // end of namespace Ice 1016 } // end of namespace Ice
1015 1017
1016 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H 1018 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698