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

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: Fixes the Offsetis typo. Created 5 years 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 void lowerIntrinsicCall(const InstIntrinsicCall *Inst) override; 230 void lowerIntrinsicCall(const InstIntrinsicCall *Inst) override;
231 void lowerInsertElement(const InstInsertElement *Inst) override; 231 void lowerInsertElement(const InstInsertElement *Inst) override;
232 void lowerLoad(const InstLoad *Inst) override; 232 void lowerLoad(const InstLoad *Inst) override;
233 void lowerPhi(const InstPhi *Inst) override; 233 void lowerPhi(const InstPhi *Inst) override;
234 void lowerRet(const InstRet *Inst) override; 234 void lowerRet(const InstRet *Inst) override;
235 void lowerSelect(const InstSelect *Inst) override; 235 void lowerSelect(const InstSelect *Inst) override;
236 void lowerStore(const InstStore *Inst) override; 236 void lowerStore(const InstStore *Inst) override;
237 void lowerSwitch(const InstSwitch *Inst) override; 237 void lowerSwitch(const InstSwitch *Inst) override;
238 void lowerUnreachable(const InstUnreachable *Inst) override; 238 void lowerUnreachable(const InstUnreachable *Inst) override;
239 void prelowerPhis() override; 239 void prelowerPhis() override;
240 uint32_t getCallStackArgumentsSizeBytes(const InstCall *Instr) override;
240 void genTargetHelperCallFor(Inst *Instr) override { (void)Instr; } 241 void genTargetHelperCallFor(Inst *Instr) override { (void)Instr; }
241 void doAddressOptLoad() override; 242 void doAddressOptLoad() override;
242 void doAddressOptStore() override; 243 void doAddressOptStore() override;
243 void randomlyInsertNop(float Probability, 244 void randomlyInsertNop(float Probability,
244 RandomNumberGenerator &RNG) override; 245 RandomNumberGenerator &RNG) override;
245 246
246 OperandARM32Mem *formMemoryOperand(Operand *Ptr, Type Ty); 247 OperandARM32Mem *formMemoryOperand(Operand *Ptr, Type Ty);
247 248
248 Variable64On32 *makeI64RegPair(); 249 Variable64On32 *makeI64RegPair();
249 Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister); 250 Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 void _adds(Variable *Dest, Variable *Src0, Operand *Src1, 283 void _adds(Variable *Dest, Variable *Src0, Operand *Src1,
283 CondARM32::Cond Pred = CondARM32::AL) { 284 CondARM32::Cond Pred = CondARM32::AL) {
284 constexpr bool SetFlags = true; 285 constexpr bool SetFlags = true;
285 Context.insert( 286 Context.insert(
286 InstARM32Add::create(Func, Dest, Src0, Src1, Pred, SetFlags)); 287 InstARM32Add::create(Func, Dest, Src0, Src1, Pred, SetFlags));
287 } 288 }
288 void _adc(Variable *Dest, Variable *Src0, Operand *Src1, 289 void _adc(Variable *Dest, Variable *Src0, Operand *Src1,
289 CondARM32::Cond Pred = CondARM32::AL) { 290 CondARM32::Cond Pred = CondARM32::AL) {
290 Context.insert(InstARM32Adc::create(Func, Dest, Src0, Src1, Pred)); 291 Context.insert(InstARM32Adc::create(Func, Dest, Src0, Src1, Pred));
291 } 292 }
292 void _adjust_stack(int32_t Amount, Operand *SrcAmount) {
293 Context.insert(InstARM32AdjustStack::create(
294 Func, getPhysicalRegister(RegARM32::Reg_sp), Amount, SrcAmount));
295 }
296 void _and(Variable *Dest, Variable *Src0, Operand *Src1, 293 void _and(Variable *Dest, Variable *Src0, Operand *Src1,
297 CondARM32::Cond Pred = CondARM32::AL) { 294 CondARM32::Cond Pred = CondARM32::AL) {
298 Context.insert(InstARM32And::create(Func, Dest, Src0, Src1, Pred)); 295 Context.insert(InstARM32And::create(Func, Dest, Src0, Src1, Pred));
299 } 296 }
300 void _asr(Variable *Dest, Variable *Src0, Operand *Src1, 297 void _asr(Variable *Dest, Variable *Src0, Operand *Src1,
301 CondARM32::Cond Pred = CondARM32::AL) { 298 CondARM32::Cond Pred = CondARM32::AL) {
302 Context.insert(InstARM32Asr::create(Func, Dest, Src0, Src1, Pred)); 299 Context.insert(InstARM32Asr::create(Func, Dest, Src0, Src1, Pred));
303 } 300 }
304 void _bic(Variable *Dest, Variable *Src0, Operand *Src1, 301 void _bic(Variable *Dest, Variable *Src0, Operand *Src1,
305 CondARM32::Cond Pred = CondARM32::AL) { 302 CondARM32::Cond Pred = CondARM32::AL) {
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 Context.insert(InstARM32Vmul::create(Func, Dest, Src0, Src1)); 803 Context.insert(InstARM32Vmul::create(Func, Dest, Src0, Src1));
807 } 804 }
808 void _vsqrt(Variable *Dest, Variable *Src, 805 void _vsqrt(Variable *Dest, Variable *Src,
809 CondARM32::Cond Pred = CondARM32::AL) { 806 CondARM32::Cond Pred = CondARM32::AL) {
810 Context.insert(InstARM32Vsqrt::create(Func, Dest, Src, Pred)); 807 Context.insert(InstARM32Vsqrt::create(Func, Dest, Src, Pred));
811 } 808 }
812 void _vsub(Variable *Dest, Variable *Src0, Variable *Src1) { 809 void _vsub(Variable *Dest, Variable *Src0, Variable *Src1) {
813 Context.insert(InstARM32Vsub::create(Func, Dest, Src0, Src1)); 810 Context.insert(InstARM32Vsub::create(Func, Dest, Src0, Src1));
814 } 811 }
815 812
813 // Iterates over the CFG and determines the maximum outgoing stack arguments
814 // bytes. This information is later used during addProlog() do pre-allocate
Jim Stichnoth 2015/11/22 04:09:43 s/do/to/
John 2015/11/23 18:54:10 Done.
815 // the outargs area.
816 // TODO(jpp): This could live in the Parser, if we provided a Target-specific
817 // method that the Parser could call.
818 void findMaxStackOutArgsSize();
819
816 /// Run a pass through stack variables and ensure that the offsets are legal. 820 /// Run a pass through stack variables and ensure that the offsets are legal.
817 /// If the offset is not legal, use a new base register that accounts for the 821 /// If the offset is not legal, use a new base register that accounts for the
818 /// offset, such that the addressing mode offset bits are now legal. 822 /// offset, such that the addressing mode offset bits are now legal.
819 void legalizeStackSlots(); 823 void legalizeStackSlots();
820 /// Returns true if the given Offset can be represented in a ldr/str. 824 /// Returns true if the given Offset can be represented in a ldr/str.
821 bool isLegalMemOffset(Type Ty, int32_t Offset) const; 825 bool isLegalMemOffset(Type Ty, int32_t Offset) const;
822 // Creates a new Base register centered around 826 // Creates a new Base register centered around
823 // [OrigBaseReg, +/- Offset+StackAdjust]. 827 // [OrigBaseReg, +/- Offset].
824 Variable *newBaseRegister(int32_t Offset, int32_t StackAdjust, 828 Variable *newBaseRegister(int32_t Offset, Variable *OrigBaseReg);
825 Variable *OrigBaseReg); 829 /// Creates a new, legal OperandARM32Mem for accessing OrigBase + Offset. The
826 /// Creates a new, legal OperandARM32Mem for accessing OrigBase + Offset + 830 /// returned mem operand is a legal operand for accessing memory that is of
827 /// StackAdjust. The returned mem operand is a legal operand for accessing 831 /// type Ty.
828 /// memory that is of type Ty.
829 /// 832 ///
830 /// If [OrigBaseReg, #Offset+StackAdjust] is encodable, then the method 833 /// If [OrigBaseReg, #Offset] is encodable, then the method returns a Mem
831 /// returns a Mem operand expressing it. Otherwise, 834 /// operand expressing it. Otherwise,
832 /// 835 ///
833 /// if [*NewBaseReg, #Offset+StackAdjust-*NewBaseOffset] is encodable, the 836 /// if [*NewBaseReg, #Offset-*NewBaseOffset] is encodable, the method will
834 /// method will return that. Otherwise, 837 /// return that. Otherwise,
835 /// 838 ///
836 /// a new base register ip=OrigBaseReg+Offset+StackAdjust is created, and the 839 /// a new base register ip=OrigBaseReg+Offset is created, and the method
837 /// method returns [ip, #0]. 840 /// returns [ip, #0].
838 OperandARM32Mem *createMemOperand(Type Ty, int32_t Offset, 841 OperandARM32Mem *createMemOperand(Type Ty, int32_t Offset,
839 int32_t StackAdjust, Variable *OrigBaseReg, 842 Variable *OrigBaseReg,
840 Variable **NewBaseReg, 843 Variable **NewBaseReg,
841 int32_t *NewBaseOffset); 844 int32_t *NewBaseOffset);
842 /// Legalizes Mov if its Source (or Destination) is a spilled Variable. Moves 845 /// Legalizes Mov if its Source (or Destination) is a spilled Variable. Moves
843 /// to memory become store instructions, and moves from memory, loads. 846 /// to memory become store instructions, and moves from memory, loads.
844 void legalizeMov(InstARM32Mov *Mov, int32_t StackAdjust, 847 void legalizeMov(InstARM32Mov *Mov, Variable *OrigBaseReg,
845 Variable *OrigBaseReg, Variable **NewBaseReg, 848 Variable **NewBaseReg, int32_t *NewBaseOffset);
846 int32_t *NewBaseOffset);
847 849
848 TargetARM32Features CPUFeatures; 850 TargetARM32Features CPUFeatures;
849 bool UsesFramePointer = false; 851 bool UsesFramePointer = false;
850 bool NeedsStackAlignment = false; 852 bool NeedsStackAlignment = false;
851 bool MaybeLeafFunc = true; 853 bool MaybeLeafFunc = true;
852 size_t SpillAreaSizeBytes = 0; 854 size_t SpillAreaSizeBytes = 0;
855 uint32_t MaxOutArgsSizeBytes = 0;
853 // TODO(jpp): std::array instead of array. 856 // TODO(jpp): std::array instead of array.
854 static llvm::SmallBitVector TypeToRegisterSet[RCARM32_NUM]; 857 static llvm::SmallBitVector TypeToRegisterSet[RCARM32_NUM];
855 static llvm::SmallBitVector RegisterAliases[RegARM32::Reg_NUM]; 858 static llvm::SmallBitVector RegisterAliases[RegARM32::Reg_NUM];
856 static llvm::SmallBitVector ScratchRegs; 859 static llvm::SmallBitVector ScratchRegs;
857 llvm::SmallBitVector RegsUsed; 860 llvm::SmallBitVector RegsUsed;
858 VarList PhysicalRegisters[IceType_NUM]; 861 VarList PhysicalRegisters[IceType_NUM];
859 862
860 /// Helper class that understands the Calling Convention and register 863 /// Helper class that understands the Calling Convention and register
861 /// assignments. The first few integer type parameters can use r0-r3, 864 /// assignments. The first few integer type parameters can use r0-r3,
862 /// regardless of their position relative to the floating-point/vector 865 /// regardless of their position relative to the floating-point/vector
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 1011
1009 private: 1012 private:
1010 ~TargetHeaderARM32() = default; 1013 ~TargetHeaderARM32() = default;
1011 1014
1012 TargetARM32Features CPUFeatures; 1015 TargetARM32Features CPUFeatures;
1013 }; 1016 };
1014 1017
1015 } // end of namespace Ice 1018 } // end of namespace Ice
1016 1019
1017 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H 1020 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698