OLD | NEW |
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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 Context.insert(InstARM32Vsqrt::create(Func, Dest, Src, Pred)); | 537 Context.insert(InstARM32Vsqrt::create(Func, Dest, Src, Pred)); |
538 } | 538 } |
539 void _vsub(Variable *Dest, Variable *Src0, Variable *Src1) { | 539 void _vsub(Variable *Dest, Variable *Src0, Variable *Src1) { |
540 Context.insert(InstARM32Vsub::create(Func, Dest, Src0, Src1)); | 540 Context.insert(InstARM32Vsub::create(Func, Dest, Src0, Src1)); |
541 } | 541 } |
542 | 542 |
543 /// Run a pass through stack variables and ensure that the offsets are legal. | 543 /// Run a pass through stack variables and ensure that the offsets are legal. |
544 /// If the offset is not legal, use a new base register that accounts for the | 544 /// If the offset is not legal, use a new base register that accounts for the |
545 /// offset, such that the addressing mode offset bits are now legal. | 545 /// offset, such that the addressing mode offset bits are now legal. |
546 void legalizeStackSlots(); | 546 void legalizeStackSlots(); |
547 /// Returns true if the given Offset can be represented in a stack ldr/str. | 547 /// Returns true if the given Offset can be represented in a ldr/str. |
548 bool isLegalVariableStackOffset(Type Ty, int32_t Offset) const; | 548 bool isLegalMemOffset(Type Ty, int32_t Offset) const; |
549 /// Assuming Var needs its offset legalized, define a new base register | 549 // Creates a new Base register centered around |
550 /// centered on the given Var's offset plus StackAdjust, and use it. | 550 // [OrigBaseReg, +/- Offset+StackAdjust]. |
551 StackVariable *legalizeVariableSlot(Variable *Var, int32_t StackAdjust, | 551 Variable *newBaseRegister(int32_t Offset, int32_t StackAdjust, |
552 Variable *OrigBaseReg); | 552 Variable *OrigBaseReg); |
| 553 /// Creates a new, legal StackVariable w.r.t. ARM's Immediate requirements. |
| 554 /// This method is not very smart: it will always create and return a new |
| 555 /// StackVariable, even if Offset + StackAdjust is encodable. |
| 556 StackVariable *legalizeStackSlot(Type Ty, int32_t Offset, int32_t StackAdjust, |
| 557 Variable *OrigBaseReg, Variable **NewBaseReg, |
| 558 int32_t *NewBaseOffset); |
| 559 /// Legalizes Mov if its Source (or Destination) contains an invalid |
| 560 /// immediate. |
| 561 void legalizeMovStackAddrImm(InstARM32Mov *Mov, int32_t StackAdjust, |
| 562 Variable *OrigBaseReg, Variable **NewBaseReg, |
| 563 int32_t *NewBaseOffset); |
553 | 564 |
554 TargetARM32Features CPUFeatures; | 565 TargetARM32Features CPUFeatures; |
555 bool UsesFramePointer = false; | 566 bool UsesFramePointer = false; |
556 bool NeedsStackAlignment = false; | 567 bool NeedsStackAlignment = false; |
557 bool MaybeLeafFunc = true; | 568 bool MaybeLeafFunc = true; |
558 size_t SpillAreaSizeBytes = 0; | 569 size_t SpillAreaSizeBytes = 0; |
559 // TODO(jpp): std::array instead of array. | 570 // TODO(jpp): std::array instead of array. |
560 static llvm::SmallBitVector TypeToRegisterSet[RCARM32_NUM]; | 571 static llvm::SmallBitVector TypeToRegisterSet[RCARM32_NUM]; |
561 static llvm::SmallBitVector RegisterAliases[RegARM32::Reg_NUM]; | 572 static llvm::SmallBitVector RegisterAliases[RegARM32::Reg_NUM]; |
562 static llvm::SmallBitVector ScratchRegs; | 573 static llvm::SmallBitVector ScratchRegs; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 private: | 618 private: |
608 uint32_t NumGPRRegsUsed = 0; | 619 uint32_t NumGPRRegsUsed = 0; |
609 llvm::SmallBitVector VFPRegsFree; | 620 llvm::SmallBitVector VFPRegsFree; |
610 llvm::SmallBitVector ValidF64Regs; | 621 llvm::SmallBitVector ValidF64Regs; |
611 llvm::SmallBitVector ValidV128Regs; | 622 llvm::SmallBitVector ValidV128Regs; |
612 }; | 623 }; |
613 | 624 |
614 private: | 625 private: |
615 ~TargetARM32() override = default; | 626 ~TargetARM32() override = default; |
616 | 627 |
| 628 OperandARM32Mem *formAddressingMode(Type Ty, Cfg *Func, const Inst *LdSt, |
| 629 Operand *Base); |
| 630 |
617 void lowerTruncToFlags(Operand *Src, CondARM32::Cond *CondIfTrue, | 631 void lowerTruncToFlags(Operand *Src, CondARM32::Cond *CondIfTrue, |
618 CondARM32::Cond *CondIfFalse); | 632 CondARM32::Cond *CondIfFalse); |
| 633 |
619 class BoolComputationTracker { | 634 class BoolComputationTracker { |
620 public: | 635 public: |
621 BoolComputationTracker() = default; | 636 BoolComputationTracker() = default; |
622 ~BoolComputationTracker() = default; | 637 ~BoolComputationTracker() = default; |
623 | 638 |
624 void forgetProducers() { KnownComputations.clear(); } | 639 void forgetProducers() { KnownComputations.clear(); } |
625 void recordProducers(CfgNode *Node); | 640 void recordProducers(CfgNode *Node); |
626 | 641 |
627 const Inst *getProducerOf(const Operand *Opnd) const { | 642 const Inst *getProducerOf(const Operand *Opnd) const { |
628 auto *Var = llvm::dyn_cast<Variable>(Opnd); | 643 auto *Var = llvm::dyn_cast<Variable>(Opnd); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 | 727 |
713 private: | 728 private: |
714 ~TargetHeaderARM32() = default; | 729 ~TargetHeaderARM32() = default; |
715 | 730 |
716 TargetARM32Features CPUFeatures; | 731 TargetARM32Features CPUFeatures; |
717 }; | 732 }; |
718 | 733 |
719 } // end of namespace Ice | 734 } // end of namespace Ice |
720 | 735 |
721 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H | 736 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H |
OLD | NEW |