OLD | NEW |
1 //===- subzero/src/IceOperand.h - High-level operands -----------*- C++ -*-===// | 1 //===- subzero/src/IceOperand.h - High-level operands -----------*- 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 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 | 972 |
973 public: | 973 public: |
974 static VariableVecOn32 *create(Cfg *Func, Type Ty, SizeT Index) { | 974 static VariableVecOn32 *create(Cfg *Func, Type Ty, SizeT Index) { |
975 return new (Func->allocate<VariableVecOn32>()) | 975 return new (Func->allocate<VariableVecOn32>()) |
976 VariableVecOn32(Func, kVariableVecOn32, Ty, Index); | 976 VariableVecOn32(Func, kVariableVecOn32, Ty, Index); |
977 } | 977 } |
978 | 978 |
979 void setName(const Cfg *Func, const std::string &NewName) override { | 979 void setName(const Cfg *Func, const std::string &NewName) override { |
980 Variable::setName(Func, NewName); | 980 Variable::setName(Func, NewName); |
981 if (!Containers.empty()) { | 981 if (!Containers.empty()) { |
982 for (SizeT i = 0; i < ElementsPerContainer; ++i) { | 982 for (SizeT i = 0; i < ContainersPerVector; ++i) { |
983 Containers[i]->setName(Func, getName() + "__cont" + std::to_string(i)); | 983 Containers[i]->setName(Func, getName() + "__cont" + std::to_string(i)); |
984 } | 984 } |
985 } | 985 } |
986 } | 986 } |
987 | 987 |
988 void setIsArg(bool Val = true) override { | 988 void setIsArg(bool Val = true) override { |
989 Variable::setIsArg(Val); | 989 Variable::setIsArg(Val); |
990 for (Variable *Var : Containers) { | 990 for (Variable *Var : Containers) { |
991 Var->setIsArg(getIsArg()); | 991 Var->setIsArg(getIsArg()); |
992 } | 992 } |
993 } | 993 } |
994 | 994 |
995 const VarList &getContainers() const { return Containers; } | 995 const VarList &getContainers() const { return Containers; } |
996 | 996 |
997 void initVecElement(Cfg *Func) { | 997 void initVecElement(Cfg *Func) { |
998 for (SizeT i = 0; i < ElementsPerContainer; ++i) { | 998 for (SizeT i = 0; i < ContainersPerVector; ++i) { |
999 Variable *Var = Func->makeVariable(IceType_i32); | 999 Variable *Var = Func->makeVariable(IceType_i32); |
1000 Var->setIsArg(getIsArg()); | 1000 Var->setIsArg(getIsArg()); |
1001 if (BuildDefs::dump()) { | 1001 if (BuildDefs::dump()) { |
1002 Var->setName(Func, getName() + "__cont" + std::to_string(i)); | 1002 Var->setName(Func, getName() + "__cont" + std::to_string(i)); |
1003 } | 1003 } |
1004 Containers.push_back(Var); | 1004 Containers.push_back(Var); |
1005 } | 1005 } |
1006 } | 1006 } |
1007 | 1007 |
1008 static bool classof(const Operand *Operand) { | 1008 static bool classof(const Operand *Operand) { |
1009 OperandKind Kind = Operand->getKind(); | 1009 OperandKind Kind = Operand->getKind(); |
1010 return Kind == kVariableVecOn32; | 1010 return Kind == kVariableVecOn32; |
1011 } | 1011 } |
1012 | 1012 |
1013 // A 128-bit vector value is mapped onto 4 32-bit register values. | 1013 // A 128-bit vector value is mapped onto 4 32-bit register values. |
1014 static constexpr SizeT ElementsPerContainer = 4; | 1014 static constexpr SizeT ContainersPerVector = 4; |
1015 | 1015 |
1016 protected: | 1016 protected: |
1017 VariableVecOn32(const Cfg *Func, OperandKind K, Type Ty, SizeT Index) | 1017 VariableVecOn32(const Cfg *Func, OperandKind K, Type Ty, SizeT Index) |
1018 : Variable(Func, K, Ty, Index) { | 1018 : Variable(Func, K, Ty, Index) { |
1019 assert(typeWidthInBytes(Ty) == | 1019 assert(typeWidthInBytes(Ty) == |
1020 ElementsPerContainer * typeWidthInBytes(IceType_i32)); | 1020 ContainersPerVector * typeWidthInBytes(IceType_i32)); |
1021 } | 1021 } |
1022 | 1022 |
1023 VarList Containers; | 1023 VarList Containers; |
1024 }; | 1024 }; |
1025 | 1025 |
1026 enum MetadataKind { | 1026 enum MetadataKind { |
1027 VMK_Uses, /// Track only uses, not defs | 1027 VMK_Uses, /// Track only uses, not defs |
1028 VMK_SingleDefs, /// Track uses+defs, but only record single def | 1028 VMK_SingleDefs, /// Track uses+defs, but only record single def |
1029 VMK_All /// Track uses+defs, including full def list | 1029 VMK_All /// Track uses+defs, including full def list |
1030 }; | 1030 }; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 return Operand->getKind() == kVariableBoolean; | 1164 return Operand->getKind() == kVariableBoolean; |
1165 } | 1165 } |
1166 | 1166 |
1167 private: | 1167 private: |
1168 Variable *BoolSource = nullptr; | 1168 Variable *BoolSource = nullptr; |
1169 }; | 1169 }; |
1170 | 1170 |
1171 } // end of namespace Ice | 1171 } // end of namespace Ice |
1172 | 1172 |
1173 #endif // SUBZERO_SRC_ICEOPERAND_H | 1173 #endif // SUBZERO_SRC_ICEOPERAND_H |
OLD | NEW |