| OLD | NEW |
| 1 //===- subzero/src/IceTargetLoweringX86Base.h - x86 lowering ----*- C++ -*-===// | 1 //===- subzero/src/IceTargetLoweringX86Base.h - x86 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 |
| 11 /// This file declares the TargetLoweringX86 template class, which | 11 /// This file declares the TargetLoweringX86 template class, which |
| 12 /// implements the TargetLowering base interface for the x86 | 12 /// implements the TargetLowering base interface for the x86 |
| 13 /// architecture. | 13 /// architecture. |
| 14 /// | 14 /// |
| 15 //===----------------------------------------------------------------------===// | 15 //===----------------------------------------------------------------------===// |
| 16 | 16 |
| 17 #ifndef SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H | 17 #ifndef SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H |
| 18 #define SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H | 18 #define SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H |
| 19 | 19 |
| 20 #include "IceDefs.h" | 20 #include "IceDefs.h" |
| 21 #include "IceInst.h" | 21 #include "IceInst.h" |
| 22 #include "IceSwitchLowering.h" | 22 #include "IceSwitchLowering.h" |
| 23 #include "IceTargetLowering.h" | 23 #include "IceTargetLowering.h" |
| 24 #include "IceUtils.h" | 24 #include "IceUtils.h" |
| 25 | 25 |
| 26 #include <array> |
| 26 #include <type_traits> | 27 #include <type_traits> |
| 27 #include <utility> | 28 #include <utility> |
| 28 | 29 |
| 29 namespace Ice { | 30 namespace Ice { |
| 30 namespace X86Internal { | 31 namespace X86Internal { |
| 31 | 32 |
| 32 template <class MachineTraits> class BoolFolding; | 33 template <class MachineTraits> class BoolFolding; |
| 33 | 34 |
| 34 template <class Machine> struct MachineTraits {}; | 35 template <class Machine> struct MachineTraits {}; |
| 35 | 36 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 SizeT getNumRegisters() const override { | 69 SizeT getNumRegisters() const override { |
| 69 return Traits::RegisterSet::Reg_NUM; | 70 return Traits::RegisterSet::Reg_NUM; |
| 70 } | 71 } |
| 71 Variable *getPhysicalRegister(SizeT RegNum, Type Ty = IceType_void) override; | 72 Variable *getPhysicalRegister(SizeT RegNum, Type Ty = IceType_void) override; |
| 72 IceString getRegName(SizeT RegNum, Type Ty) const override; | 73 IceString getRegName(SizeT RegNum, Type Ty) const override; |
| 73 llvm::SmallBitVector getRegisterSet(RegSetMask Include, | 74 llvm::SmallBitVector getRegisterSet(RegSetMask Include, |
| 74 RegSetMask Exclude) const override; | 75 RegSetMask Exclude) const override; |
| 75 const llvm::SmallBitVector &getRegisterSetForType(Type Ty) const override { | 76 const llvm::SmallBitVector &getRegisterSetForType(Type Ty) const override { |
| 76 return TypeToRegisterSet[Ty]; | 77 return TypeToRegisterSet[Ty]; |
| 77 } | 78 } |
| 79 |
| 80 const llvm::SmallBitVector &getAliasesForRegister(SizeT Reg) const override { |
| 81 assert(Reg < Traits::RegisterSet::Reg_NUM); |
| 82 return RegisterAliases[Reg]; |
| 83 } |
| 84 |
| 78 bool hasFramePointer() const override { return IsEbpBasedFrame; } | 85 bool hasFramePointer() const override { return IsEbpBasedFrame; } |
| 79 SizeT getFrameOrStackReg() const override { | 86 SizeT getFrameOrStackReg() const override { |
| 80 return IsEbpBasedFrame ? Traits::RegisterSet::Reg_ebp | 87 return IsEbpBasedFrame ? Traits::RegisterSet::Reg_ebp |
| 81 : Traits::RegisterSet::Reg_esp; | 88 : Traits::RegisterSet::Reg_esp; |
| 82 } | 89 } |
| 83 size_t typeWidthInBytesOnStack(Type Ty) const override { | 90 size_t typeWidthInBytesOnStack(Type Ty) const override { |
| 84 // Round up to the next multiple of WordType bytes. | 91 // Round up to the next multiple of WordType bytes. |
| 85 const uint32_t WordSizeInBytes = typeWidthInBytes(Traits::WordType); | 92 const uint32_t WordSizeInBytes = typeWidthInBytes(Traits::WordType); |
| 86 return Utils::applyAlignment(typeWidthInBytes(Ty), WordSizeInBytes); | 93 return Utils::applyAlignment(typeWidthInBytes(Ty), WordSizeInBytes); |
| 87 } | 94 } |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 }; | 680 }; |
| 674 | 681 |
| 675 bool optimizeScalarMul(Variable *Dest, Operand *Src0, int32_t Src1); | 682 bool optimizeScalarMul(Variable *Dest, Operand *Src0, int32_t Src1); |
| 676 void findRMW(); | 683 void findRMW(); |
| 677 | 684 |
| 678 typename Traits::InstructionSet InstructionSet = | 685 typename Traits::InstructionSet InstructionSet = |
| 679 Traits::InstructionSet::Begin; | 686 Traits::InstructionSet::Begin; |
| 680 bool IsEbpBasedFrame = false; | 687 bool IsEbpBasedFrame = false; |
| 681 bool NeedsStackAlignment = false; | 688 bool NeedsStackAlignment = false; |
| 682 size_t SpillAreaSizeBytes = 0; | 689 size_t SpillAreaSizeBytes = 0; |
| 683 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; | 690 std::array<llvm::SmallBitVector, IceType_NUM> TypeToRegisterSet; |
| 691 std::array<llvm::SmallBitVector, Traits::RegisterSet::Reg_NUM> |
| 692 RegisterAliases; |
| 684 llvm::SmallBitVector ScratchRegs; | 693 llvm::SmallBitVector ScratchRegs; |
| 685 llvm::SmallBitVector RegsUsed; | 694 llvm::SmallBitVector RegsUsed; |
| 686 VarList PhysicalRegisters[IceType_NUM]; | 695 std::array<VarList, IceType_NUM> PhysicalRegisters; |
| 687 | 696 |
| 688 /// Randomize a given immediate operand | 697 /// Randomize a given immediate operand |
| 689 Operand *randomizeOrPoolImmediate(Constant *Immediate, | 698 Operand *randomizeOrPoolImmediate(Constant *Immediate, |
| 690 int32_t RegNum = Variable::NoRegister); | 699 int32_t RegNum = Variable::NoRegister); |
| 691 typename Traits::X86OperandMem * | 700 typename Traits::X86OperandMem * |
| 692 randomizeOrPoolImmediate(typename Traits::X86OperandMem *MemOperand, | 701 randomizeOrPoolImmediate(typename Traits::X86OperandMem *MemOperand, |
| 693 int32_t RegNum = Variable::NoRegister); | 702 int32_t RegNum = Variable::NoRegister); |
| 694 bool RandomizationPoolingPaused = false; | 703 bool RandomizationPoolingPaused = false; |
| 695 | 704 |
| 696 private: | 705 private: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 717 } | 726 } |
| 718 | 727 |
| 719 BoolFolding FoldingInfo; | 728 BoolFolding FoldingInfo; |
| 720 }; | 729 }; |
| 721 } // end of namespace X86Internal | 730 } // end of namespace X86Internal |
| 722 } // end of namespace Ice | 731 } // end of namespace Ice |
| 723 | 732 |
| 724 #include "IceTargetLoweringX86BaseImpl.h" | 733 #include "IceTargetLoweringX86BaseImpl.h" |
| 725 | 734 |
| 726 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H | 735 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H |
| OLD | NEW |