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

Side by Side Diff: src/IceInst.h

Issue 1838753002: Subzero: Remove IceString. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 4 years, 8 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
« no previous file with comments | « src/IceGlobalInits.cpp ('k') | src/IceInst.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceInst.h - High-level instructions ----------*- C++ -*-===// 1 //===- subzero/src/IceInst.h - High-level instructions ----------*- 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 JumpTable, // not part of LLVM/PNaCl bitcode 69 JumpTable, // not part of LLVM/PNaCl bitcode
70 // Anything >= Target is an InstTarget subclass. Note that the value-spaces 70 // Anything >= Target is an InstTarget subclass. Note that the value-spaces
71 // are shared across targets. To avoid confusion over the definition of 71 // are shared across targets. To avoid confusion over the definition of
72 // shared values, an object specific to one target should never be passed 72 // shared values, an object specific to one target should never be passed
73 // to a different target. 73 // to a different target.
74 Target, 74 Target,
75 Target_Max = std::numeric_limits<uint8_t>::max(), 75 Target_Max = std::numeric_limits<uint8_t>::max(),
76 }; 76 };
77 static_assert(Target <= Target_Max, "Must not be above max."); 77 static_assert(Target <= Target_Max, "Must not be above max.");
78 InstKind getKind() const { return Kind; } 78 InstKind getKind() const { return Kind; }
79 virtual IceString getInstName() const; 79 virtual const char *getInstName() const;
80 80
81 InstNumberT getNumber() const { return Number; } 81 InstNumberT getNumber() const { return Number; }
82 void renumber(Cfg *Func); 82 void renumber(Cfg *Func);
83 enum { 83 enum {
84 NumberDeleted = -1, 84 NumberDeleted = -1,
85 NumberSentinel = 0, 85 NumberSentinel = 0,
86 NumberInitial = 2, 86 NumberInitial = 2,
87 NumberExtended = NumberInitial - 1 87 NumberExtended = NumberInitial - 1
88 }; 88 };
89 89
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 _num 283 _num
284 }; 284 };
285 285
286 static InstArithmetic *create(Cfg *Func, OpKind Op, Variable *Dest, 286 static InstArithmetic *create(Cfg *Func, OpKind Op, Variable *Dest,
287 Operand *Source1, Operand *Source2) { 287 Operand *Source1, Operand *Source2) {
288 return new (Func->allocate<InstArithmetic>()) 288 return new (Func->allocate<InstArithmetic>())
289 InstArithmetic(Func, Op, Dest, Source1, Source2); 289 InstArithmetic(Func, Op, Dest, Source1, Source2);
290 } 290 }
291 OpKind getOp() const { return Op; } 291 OpKind getOp() const { return Op; }
292 292
293 virtual IceString getInstName() const override; 293 virtual const char *getInstName() const override;
294 294
295 static const char *getOpName(OpKind Op); 295 static const char *getOpName(OpKind Op);
296 bool isCommutative() const; 296 bool isCommutative() const;
297 void dump(const Cfg *Func) const override; 297 void dump(const Cfg *Func) const override;
298 static bool classof(const Inst *Instr) { 298 static bool classof(const Inst *Instr) {
299 return Instr->getKind() == Arithmetic; 299 return Instr->getKind() == Arithmetic;
300 } 300 }
301 301
302 private: 302 private:
303 InstArithmetic(Cfg *Func, OpKind Op, Variable *Dest, Operand *Source1, 303 InstArithmetic(Cfg *Func, OpKind Op, Variable *Dest, Operand *Source1,
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 SizeT getNumTargets() const { return NumTargets; } 935 SizeT getNumTargets() const { return NumTargets; }
936 CfgNode *getTarget(SizeT I) const { 936 CfgNode *getTarget(SizeT I) const {
937 assert(I < NumTargets); 937 assert(I < NumTargets);
938 return Targets[I]; 938 return Targets[I];
939 } 939 }
940 void dump(const Cfg *Func) const override; 940 void dump(const Cfg *Func) const override;
941 static bool classof(const Inst *Instr) { 941 static bool classof(const Inst *Instr) {
942 return Instr->getKind() == JumpTable; 942 return Instr->getKind() == JumpTable;
943 } 943 }
944 944
945 static IceString makeName(const IceString &FuncName, SizeT Id) { 945 // TODO(stichnot): Should this create&save GlobalString values?
946 return ".L" + FuncName + "$jumptable$__" + std::to_string(Id); 946 static std::string makeName(GlobalString FuncName, SizeT Id) {
947 if (FuncName.hasStdString())
948 return ".L" + FuncName + "$jumptable$__" + std::to_string(Id);
949 return ".L" + std::to_string(FuncName.getID()) + "_" + std::to_string(Id);
947 } 950 }
948 951
949 private: 952 private:
950 InstJumpTable(Cfg *Func, SizeT NumTargets, CfgNode *Default); 953 InstJumpTable(Cfg *Func, SizeT NumTargets, CfgNode *Default);
951 void destroy(Cfg *Func) override { 954 void destroy(Cfg *Func) override {
952 Func->deallocateArrayOf<CfgNode *>(Targets); 955 Func->deallocateArrayOf<CfgNode *>(Targets);
953 Inst::destroy(Func); 956 Inst::destroy(Func);
954 } 957 }
955 958
956 const SizeT Id; 959 const SizeT Id;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 static void noteHead(Ice::Inst *, Ice::Inst *) {} 1000 static void noteHead(Ice::Inst *, Ice::Inst *) {}
998 void deleteNode(Ice::Inst *) {} 1001 void deleteNode(Ice::Inst *) {}
999 1002
1000 private: 1003 private:
1001 mutable ilist_half_node<Ice::Inst> Sentinel; 1004 mutable ilist_half_node<Ice::Inst> Sentinel;
1002 }; 1005 };
1003 1006
1004 } // end of namespace llvm 1007 } // end of namespace llvm
1005 1008
1006 #endif // SUBZERO_SRC_ICEINST_H 1009 #endif // SUBZERO_SRC_ICEINST_H
OLDNEW
« no previous file with comments | « src/IceGlobalInits.cpp ('k') | src/IceInst.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698