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

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 128-bit vector variable on a 32-bit
967 // architecture. In this case 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
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()) {
982 for (SizeT i = 0; i < ElementsPerContainer; ++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 for (Variable *Var : Containers) {
991 Var->setIsArg(getIsArg());
992 }
993 }
994
995 const VarList &getContainers() const { return Containers; }
996
997 void initVecElement(Cfg *Func) {
998 for (SizeT i = 0; i < ElementsPerContainer; ++i) {
999 Variable *Var = Func->makeVariable(IceType_i32);
1000 Var->setIsArg(getIsArg());
1001 if (BuildDefs::dump()) {
1002 Var->setName(Func, getName() + "__cont" + std::to_string(i));
1003 }
1004 Containers.push_back(Var);
1005 }
1006 }
1007
1008 static bool classof(const Operand *Operand) {
1009 OperandKind Kind = Operand->getKind();
1010 return Kind == kVariableVecOn32;
1011 }
1012
1013 // A 128-bit vector value is mapped onto 4 32-bit register values.
1014 static constexpr SizeT ElementsPerContainer = 4;
1015
1016 protected:
1017 VariableVecOn32(const Cfg *Func, OperandKind K, Type Ty, SizeT Index)
1018 : Variable(Func, K, Ty, Index) {
1019 assert(typeWidthInBytes(Ty) ==
1020 ElementsPerContainer * typeWidthInBytes(IceType_i32));
1021 }
1022
1023 VarList Containers;
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
« no previous file with comments | « src/IceInstMIPS32.h ('k') | src/IceTargetLowering.h » ('j') | src/IceTargetLoweringMIPS32.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698