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

Side by Side Diff: src/IceOperand.h

Issue 2380023002: [SubZero] Vector types support for MIPS (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addressed review comments Created 4 years, 2 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
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 kConstInteger32, 45 kConstInteger32,
46 kConstInteger64, 46 kConstInteger64,
47 kConstFloat, 47 kConstFloat,
48 kConstDouble, 48 kConstDouble,
49 kConstRelocatable, 49 kConstRelocatable,
50 kConstUndef, 50 kConstUndef,
51 kConst_Target, // leave space for target-specific constant kinds 51 kConst_Target, // leave space for target-specific constant kinds
52 kConst_Max = kConst_Target + MaxTargetKinds, 52 kConst_Max = kConst_Target + MaxTargetKinds,
53 kVariable, 53 kVariable,
54 kVariable64On32, 54 kVariable64On32,
55 kVariableVecOn32,
55 kVariableBoolean, 56 kVariableBoolean,
56 kVariable_Target, // leave space for target-specific variable kinds 57 kVariable_Target, // leave space for target-specific variable kinds
57 kVariable_Max = kVariable_Target + MaxTargetKinds, 58 kVariable_Max = kVariable_Target + MaxTargetKinds,
58 // Target-specific operand classes use kTarget as the starting point for 59 // Target-specific operand classes use kTarget as the starting point for
59 // their Kind enum space. Note that the value-spaces are shared across 60 // their Kind enum space. Note that the value-spaces are shared across
60 // targets. To avoid confusion over the definition of shared values, an 61 // targets. To avoid confusion over the definition of shared values, an
61 // object specific to one target should never be passed to a different 62 // object specific to one target should never be passed to a different
62 // target. 63 // target.
63 kTarget, 64 kTarget,
64 kTarget_Max = std::numeric_limits<uint8_t>::max(), 65 kTarget_Max = std::numeric_limits<uint8_t>::max(),
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 protected: 956 protected:
956 Variable64On32(const Cfg *Func, OperandKind K, Type Ty, SizeT Index) 957 Variable64On32(const Cfg *Func, OperandKind K, Type Ty, SizeT Index)
957 : Variable(Func, K, Ty, Index) { 958 : Variable(Func, K, Ty, Index) {
958 assert(typeWidthInBytes(Ty) == 8); 959 assert(typeWidthInBytes(Ty) == 8);
959 } 960 }
960 961
961 Variable *LoVar = nullptr; 962 Variable *LoVar = nullptr;
962 Variable *HiVar = nullptr; 963 Variable *HiVar = nullptr;
963 }; 964 };
964 965
966 // VariableVecOn32 represents a vector variable on a 32-bit architecture. In
Jim Stichnoth 2016/09/30 15:41:59 How about: ... represents a 128-bit vector varia
jaydeep.patil 2016/10/03 06:38:55 Done.
967 // this situation the variable must be split into 4 containers.
968 class VariableVecOn32 : public Variable {
969 VariableVecOn32() = delete;
970 VariableVecOn32(const VariableVecOn32 &) = delete;
971 VariableVecOn32 &operator=(const VariableVecOn32 &) = delete;
972
Jim Stichnoth 2016/09/30 15:41:59 In this private section, could you define a static
Jim Stichnoth 2016/09/30 17:37:40 Actually, maybe it would be better to put this con
jaydeep.patil 2016/10/03 06:38:55 Done.
jaydeep.patil 2016/10/03 06:38:56 Acknowledged.
973 public:
974 static VariableVecOn32 *create(Cfg *Func, Type Ty, SizeT Index) {
975 return new (Func->allocate<VariableVecOn32>())
976 VariableVecOn32(Func, kVariableVecOn32, Ty, Index);
977 }
978
979 void setName(const Cfg *Func, const std::string &NewName) override {
980 Variable::setName(Func, NewName);
981 if (!Containers.empty()) {
Jim Stichnoth 2016/09/30 15:41:58 I think you can remove the .empty() test.
jaydeep.patil 2016/10/03 06:38:56 We need this check here. We may not have called in
982 for (SizeT i = 0; i < Containers.size(); ++i) {
983 Containers[i]->setName(Func, getName() + "__cont" + std::to_string(i));
984 }
985 }
986 }
987
988 void setIsArg(bool Val = true) override {
989 Variable::setIsArg(Val);
990 if (!Containers.empty()) {
Jim Stichnoth 2016/09/30 15:41:59 Definitely remove the .empty() test here.
jaydeep.patil 2016/10/03 06:38:56 Done.
991 for (Variable *Var : Containers) {
992 Var->setIsArg(getIsArg());
993 }
994 }
995 }
996
997 const VarList &getContainers() const { return Containers; }
998
999 void initVecElement(Cfg *Func, Type VecType) {
1000 VectorType = VecType;
1001 for (SizeT i = 0; i < 4; ++i) {
Jim Stichnoth 2016/09/30 15:41:58 ... i < ElementsPerContainer; ...
jaydeep.patil 2016/10/03 06:38:56 Done.
1002 Variable *Var = Func->makeVariable(IceType_i32);
1003 Var->setIsArg(getIsArg());
1004 if (BuildDefs::dump()) {
1005 Var->setName(Func, getName() + "__cont" + std::to_string(i));
1006 }
1007 Containers.push_back(Var);
1008 }
1009 }
1010
1011 static bool classof(const Operand *Operand) {
1012 OperandKind Kind = Operand->getKind();
1013 return Kind == kVariableVecOn32;
1014 }
1015
1016 protected:
1017 VariableVecOn32(const Cfg *Func, OperandKind K, Type Ty, SizeT Index)
1018 : Variable(Func, K, Ty, Index) {
1019 assert(typeWidthInBytes(Ty) == 16);
Jim Stichnoth 2016/09/30 15:41:59 Instead of "16", maybe ElementsPerContainer * ty
jaydeep.patil 2016/10/03 06:38:55 Done.
1020 }
1021
1022 VarList Containers;
1023 Type VectorType;
Jim Stichnoth 2016/09/30 15:41:59 It doesn't look like this field is actually used a
jaydeep.patil 2016/10/03 06:38:56 Done.
1024 };
1025
965 enum MetadataKind { 1026 enum MetadataKind {
966 VMK_Uses, /// Track only uses, not defs 1027 VMK_Uses, /// Track only uses, not defs
967 VMK_SingleDefs, /// Track uses+defs, but only record single def 1028 VMK_SingleDefs, /// Track uses+defs, but only record single def
968 VMK_All /// Track uses+defs, including full def list 1029 VMK_All /// Track uses+defs, including full def list
969 }; 1030 };
970 using InstDefList = CfgVector<const Inst *>; 1031 using InstDefList = CfgVector<const Inst *>;
971 1032
972 /// VariableTracking tracks the metadata for a single variable. It is 1033 /// VariableTracking tracks the metadata for a single variable. It is
973 /// only meant to be used internally by VariablesMetadata. 1034 /// only meant to be used internally by VariablesMetadata.
974 class VariableTracking { 1035 class VariableTracking {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 return Operand->getKind() == kVariableBoolean; 1164 return Operand->getKind() == kVariableBoolean;
1104 } 1165 }
1105 1166
1106 private: 1167 private:
1107 Variable *BoolSource = nullptr; 1168 Variable *BoolSource = nullptr;
1108 }; 1169 };
1109 1170
1110 } // end of namespace Ice 1171 } // end of namespace Ice
1111 1172
1112 #endif // SUBZERO_SRC_ICEOPERAND_H 1173 #endif // SUBZERO_SRC_ICEOPERAND_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698