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