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

Side by Side Diff: src/IceSwitchLowering.h

Issue 1260183008: Order jump tables for deterministic or randomized emission. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix sort comparison. Created 5 years, 4 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/IceGlobalContext.cpp ('k') | src/IceTargetLoweringX8632.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/IceSwitchLowering.h - Switch lowering --------*- C++ -*-===// 1 //===- subzero/src/IceSwitchLowering.h - Switch lowering --------*- C++ -*-===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 }; 72 };
73 73
74 /// Try and append a cluster returning whether or not it was successful. 74 /// Try and append a cluster returning whether or not it was successful.
75 bool tryAppend(const CaseCluster &New); 75 bool tryAppend(const CaseCluster &New);
76 }; 76 };
77 77
78 /// Store the jump table data so that it can be emitted later in the correct 78 /// Store the jump table data so that it can be emitted later in the correct
79 /// ELF section once the offsets from the start of the function are known. 79 /// ELF section once the offsets from the start of the function are known.
80 class JumpTableData { 80 class JumpTableData {
81 JumpTableData() = delete; 81 JumpTableData() = delete;
82 JumpTableData(const JumpTableData &) = delete;
83 JumpTableData &operator=(const JumpTableData &) = delete; 82 JumpTableData &operator=(const JumpTableData &) = delete;
84 83
85 public: 84 public:
86 JumpTableData(IceString FuncName, SizeT Id, SizeT NumTargets) 85 JumpTableData(IceString FuncName, SizeT Id, SizeT NumTargets)
87 : FuncName(FuncName), Id(Id) { 86 : FuncName(FuncName), Id(Id) {
88 TargetOffsets.reserve(NumTargets); 87 TargetOffsets.reserve(NumTargets);
89 } 88 }
89 JumpTableData(const JumpTableData &) = default;
90 JumpTableData(JumpTableData &&) = default; 90 JumpTableData(JumpTableData &&) = default;
91 JumpTableData &operator=(JumpTableData &&) = default;
91 92
92 void pushTarget(intptr_t Offset) { TargetOffsets.emplace_back(Offset); } 93 void pushTarget(intptr_t Offset) { TargetOffsets.emplace_back(Offset); }
93 94
94 const IceString &getFunctionName() const { return FuncName; } 95 const IceString &getFunctionName() const { return FuncName; }
95 SizeT getId() const { return Id; } 96 SizeT getId() const { return Id; }
96 const std::vector<intptr_t> &getTargetOffsets() const { 97 const std::vector<intptr_t> &getTargetOffsets() const {
97 return TargetOffsets; 98 return TargetOffsets;
98 } 99 }
99 100
100 private: 101 private:
101 const IceString FuncName; 102 IceString FuncName;
102 const SizeT Id; 103 SizeT Id;
103 std::vector<intptr_t> TargetOffsets; 104 std::vector<intptr_t> TargetOffsets;
104 }; 105 };
105 106
106 using JumpTableDataList = std::vector<JumpTableData>; 107 using JumpTableDataList = std::vector<JumpTableData>;
107 108
108 } // end of namespace Ice 109 } // end of namespace Ice
109 110
110 #endif // SUBZERO_SRC_ICESWITCHLOWERING_H 111 #endif // SUBZERO_SRC_ICESWITCHLOWERING_H
OLDNEW
« no previous file with comments | « src/IceGlobalContext.cpp ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698