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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
Index: src/IceOperand.h
diff --git a/src/IceOperand.h b/src/IceOperand.h
index fd688348f79c4075fe64cc8c23c3b9c6026a491a..0dc9edb205363b32e2692423176fd9d2b8d0f0ac 100644
--- a/src/IceOperand.h
+++ b/src/IceOperand.h
@@ -52,6 +52,7 @@ public:
kConst_Max = kConst_Target + MaxTargetKinds,
kVariable,
kVariable64On32,
+ kVariableVecOn32,
kVariableBoolean,
kVariable_Target, // leave space for target-specific variable kinds
kVariable_Max = kVariable_Target + MaxTargetKinds,
@@ -962,6 +963,66 @@ protected:
Variable *HiVar = nullptr;
};
+// 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.
+// this situation the variable must be split into 4 containers.
+class VariableVecOn32 : public Variable {
+ VariableVecOn32() = delete;
+ VariableVecOn32(const VariableVecOn32 &) = delete;
+ VariableVecOn32 &operator=(const VariableVecOn32 &) = delete;
+
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.
+public:
+ static VariableVecOn32 *create(Cfg *Func, Type Ty, SizeT Index) {
+ return new (Func->allocate<VariableVecOn32>())
+ VariableVecOn32(Func, kVariableVecOn32, Ty, Index);
+ }
+
+ void setName(const Cfg *Func, const std::string &NewName) override {
+ Variable::setName(Func, NewName);
+ 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
+ for (SizeT i = 0; i < Containers.size(); ++i) {
+ Containers[i]->setName(Func, getName() + "__cont" + std::to_string(i));
+ }
+ }
+ }
+
+ void setIsArg(bool Val = true) override {
+ Variable::setIsArg(Val);
+ 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.
+ for (Variable *Var : Containers) {
+ Var->setIsArg(getIsArg());
+ }
+ }
+ }
+
+ const VarList &getContainers() const { return Containers; }
+
+ void initVecElement(Cfg *Func, Type VecType) {
+ VectorType = VecType;
+ 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.
+ Variable *Var = Func->makeVariable(IceType_i32);
+ Var->setIsArg(getIsArg());
+ if (BuildDefs::dump()) {
+ Var->setName(Func, getName() + "__cont" + std::to_string(i));
+ }
+ Containers.push_back(Var);
+ }
+ }
+
+ static bool classof(const Operand *Operand) {
+ OperandKind Kind = Operand->getKind();
+ return Kind == kVariableVecOn32;
+ }
+
+protected:
+ VariableVecOn32(const Cfg *Func, OperandKind K, Type Ty, SizeT Index)
+ : Variable(Func, K, Ty, Index) {
+ 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.
+ }
+
+ VarList Containers;
+ 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.
+};
+
enum MetadataKind {
VMK_Uses, /// Track only uses, not defs
VMK_SingleDefs, /// Track uses+defs, but only record single def

Powered by Google App Engine
This is Rietveld 408576698