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

Side by Side Diff: src/IceTargetLoweringARM32.h

Issue 1241763002: ARM: Add a postRA pass to legalize stack offsets. Greedy approach (reserve IP). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: review Created 5 years, 4 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/IceTargetLowering.cpp ('k') | src/IceTargetLoweringARM32.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/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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 IceString getRegName(SizeT RegNum, Type Ty) const override; 65 IceString getRegName(SizeT RegNum, Type Ty) const override;
66 llvm::SmallBitVector getRegisterSet(RegSetMask Include, 66 llvm::SmallBitVector getRegisterSet(RegSetMask Include,
67 RegSetMask Exclude) const override; 67 RegSetMask Exclude) const override;
68 const llvm::SmallBitVector &getRegisterSetForType(Type Ty) const override { 68 const llvm::SmallBitVector &getRegisterSetForType(Type Ty) const override {
69 return TypeToRegisterSet[Ty]; 69 return TypeToRegisterSet[Ty];
70 } 70 }
71 bool hasFramePointer() const override { return UsesFramePointer; } 71 bool hasFramePointer() const override { return UsesFramePointer; }
72 SizeT getFrameOrStackReg() const override { 72 SizeT getFrameOrStackReg() const override {
73 return UsesFramePointer ? RegARM32::Reg_fp : RegARM32::Reg_sp; 73 return UsesFramePointer ? RegARM32::Reg_fp : RegARM32::Reg_sp;
74 } 74 }
75 SizeT getReservedTmpReg() const { return RegARM32::Reg_ip; }
76
75 size_t typeWidthInBytesOnStack(Type Ty) const override { 77 size_t typeWidthInBytesOnStack(Type Ty) const override {
76 // Round up to the next multiple of 4 bytes. In particular, i1, 78 // Round up to the next multiple of 4 bytes. In particular, i1,
77 // i8, and i16 are rounded up to 4 bytes. 79 // i8, and i16 are rounded up to 4 bytes.
78 return (typeWidthInBytes(Ty) + 3) & ~3; 80 return (typeWidthInBytes(Ty) + 3) & ~3;
79 } 81 }
80 82
81 // TODO(ascull): what size is best for ARM? 83 // TODO(ascull): what size is best for ARM?
82 SizeT getMinJumpTableSize() const override { return 3; } 84 SizeT getMinJumpTableSize() const override { return 3; }
83 85
84 void emitVariable(const Variable *Var) const override; 86 void emitVariable(const Variable *Var) const override;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 InstARM32Umull::create(Func, DestLo, DestHi, Src0, Src1, Pred)); 375 InstARM32Umull::create(Func, DestLo, DestHi, Src0, Src1, Pred));
374 // Model the modification to the second dest as a fake def. 376 // Model the modification to the second dest as a fake def.
375 // Note that the def is not predicated. 377 // Note that the def is not predicated.
376 Context.insert(InstFakeDef::create(Func, DestHi, DestLo)); 378 Context.insert(InstFakeDef::create(Func, DestHi, DestLo));
377 } 379 }
378 void _uxt(Variable *Dest, Variable *Src0, 380 void _uxt(Variable *Dest, Variable *Src0,
379 CondARM32::Cond Pred = CondARM32::AL) { 381 CondARM32::Cond Pred = CondARM32::AL) {
380 Context.insert(InstARM32Uxt::create(Func, Dest, Src0, Pred)); 382 Context.insert(InstARM32Uxt::create(Func, Dest, Src0, Pred));
381 } 383 }
382 384
385 /// Run a pass through stack variables and ensure that the offsets are legal.
386 /// If the offset is not legal, use a new base register that accounts for
387 /// the offset, such that the addressing mode offset bits are now legal.
388 void legalizeStackSlots();
389 /// Returns true if the given Offset can be represented in a stack ldr/str.
390 bool isLegalVariableStackOffset(int32_t Offset) const;
391 /// Assuming Var needs its offset legalized, define a new base register
392 /// centered on the given Var's offset and use it.
393 StackVariable *legalizeVariableSlot(Variable *Var, Variable *OrigBaseReg);
394
383 TargetARM32Features CPUFeatures; 395 TargetARM32Features CPUFeatures;
384 bool UsesFramePointer = false; 396 bool UsesFramePointer = false;
385 bool NeedsStackAlignment = false; 397 bool NeedsStackAlignment = false;
386 bool MaybeLeafFunc = true; 398 bool MaybeLeafFunc = true;
387 size_t SpillAreaSizeBytes = 0; 399 size_t SpillAreaSizeBytes = 0;
388 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; 400 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM];
389 llvm::SmallBitVector ScratchRegs; 401 llvm::SmallBitVector ScratchRegs;
390 llvm::SmallBitVector RegsUsed; 402 llvm::SmallBitVector RegsUsed;
391 VarList PhysicalRegisters[IceType_NUM]; 403 VarList PhysicalRegisters[IceType_NUM];
392 404
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 472
461 private: 473 private:
462 ~TargetHeaderARM32() = default; 474 ~TargetHeaderARM32() = default;
463 475
464 TargetARM32Features CPUFeatures; 476 TargetARM32Features CPUFeatures;
465 }; 477 };
466 478
467 } // end of namespace Ice 479 } // end of namespace Ice
468 480
469 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H 481 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H
OLDNEW
« no previous file with comments | « src/IceTargetLowering.cpp ('k') | src/IceTargetLoweringARM32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698