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

Side by Side Diff: src/IceAssemblerARM32.h

Issue 1426513004: Fix ARM emit() methods to count instructions generated. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | src/IceAssemblerARM32.cpp » ('j') | src/IceAssemblerARM32.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceAssemblerARM32.h - Assembler for ARM32 ----*- C++ -*-===// 1 //===- subzero/src/IceAssemblerARM32.h - Assembler for ARM32 ----*- C++ -*-===//
2 // 2 //
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 // for details. All rights reserved. Use of this source code is governed by a 4 // for details. All rights reserved. Use of this source code is governed by a
5 // BSD-style license that can be found in the LICENSE file. 5 // BSD-style license that can be found in the LICENSE file.
6 // 6 //
7 // Modified by the Subzero authors. 7 // Modified by the Subzero authors.
8 // 8 //
9 //===----------------------------------------------------------------------===// 9 //===----------------------------------------------------------------------===//
10 // 10 //
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 if (!getPreliminary()) 130 if (!getPreliminary())
131 this->bind(L); 131 this->bind(L);
132 } 132 }
133 133
134 bool fixupIsPCRel(FixupKind Kind) const override { 134 bool fixupIsPCRel(FixupKind Kind) const override {
135 (void)Kind; 135 (void)Kind;
136 // TODO(kschimpf) Decide if we need this. 136 // TODO(kschimpf) Decide if we need this.
137 return false; 137 return false;
138 } 138 }
139 139
140 /// Used inside InstARM32::emitUsingTextFixup() to define the beginning of the
141 /// first assembly instruction to be emitted.
142 void startFirstInst() { TextInstCount = 1; }
Jim Stichnoth 2015/11/04 23:45:26 Bikeshedding a bit. It would be nice if the gette
Karl 2015/11/05 16:18:40 Done.
143
144 /// Used inside InstARM32::emit() methods to define the beginning of the next
145 /// assembly instruction being emitted.
146 void startNextInst() { ++TextInstCount; }
147
148 /// Returns the number of emitted instructions since the last call
149 /// to startFirstInst().
150 size_t getNumberEmittedInsts() const { return TextInstCount; }
151
140 void bind(Label *label); 152 void bind(Label *label);
141 153
142 // List of instructions implemented by integrated assembler. 154 // List of instructions implemented by integrated assembler.
143 155
144 void adc(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, 156 void adc(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1,
145 bool SetFlags, CondARM32::Cond Cond); 157 bool SetFlags, CondARM32::Cond Cond);
146 158
147 void add(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, 159 void add(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1,
148 bool SetFlags, CondARM32::Cond Cond); 160 bool SetFlags, CondARM32::Cond Cond);
149 161
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 void sub(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, 201 void sub(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1,
190 bool SetFlags, CondARM32::Cond Cond); 202 bool SetFlags, CondARM32::Cond Cond);
191 203
192 void udiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1, 204 void udiv(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1,
193 CondARM32::Cond Cond); 205 CondARM32::Cond Cond);
194 206
195 static bool classof(const Assembler *Asm) { 207 static bool classof(const Assembler *Asm) {
196 return Asm->getKind() == Asm_ARM32; 208 return Asm->getKind() == Asm_ARM32;
197 } 209 }
198 210
199 void emitTextInst(const std::string &Text, SizeT InstSize = sizeof(IValueT)); 211 void emitTextInst(const std::string &Text, SizeT InstSize);
200 212
201 private: 213 private:
202 // A vector of pool-allocated x86 labels for CFG nodes. 214 // A vector of pool-allocated x86 labels for CFG nodes.
203 using LabelVector = std::vector<Label *>; 215 using LabelVector = std::vector<Label *>;
204 LabelVector CfgNodeLabels; 216 LabelVector CfgNodeLabels;
205 // A vector of pool-allocated x86 labels for Local labels. 217 // A vector of pool-allocated x86 labels for Local labels.
206 LabelVector LocalLabels; 218 LabelVector LocalLabels;
219 // Counter used to count number of instructions emitted inside
220 // InstARM32::emit() methods, when run inside InstARM32::emitUsingTextFixup().
221 size_t TextInstCount = 0;
207 222
208 Label *getOrCreateLabel(SizeT Number, LabelVector &Labels); 223 Label *getOrCreateLabel(SizeT Number, LabelVector &Labels);
209 224
210 void bindCfgNodeLabel(const CfgNode *Node) override; 225 void bindCfgNodeLabel(const CfgNode *Node) override;
211 226
212 void emitInst(IValueT Value) { Buffer.emit<IValueT>(Value); } 227 void emitInst(IValueT Value) { Buffer.emit<IValueT>(Value); }
213 228
214 // Pattern cccctttoooosnnnnddddiiiiiiiiiiii where cccc=Cond, ttt=Type, 229 // Pattern cccctttoooosnnnnddddiiiiiiiiiiii where cccc=Cond, ttt=Type,
215 // oooo=Opcode, nnnn=Rn, dddd=Rd, iiiiiiiiiiii=imm12 (See ARM section A5.2.3). 230 // oooo=Opcode, nnnn=Rn, dddd=Rd, iiiiiiiiiiii=imm12 (See ARM section A5.2.3).
216 void emitType01(CondARM32::Cond Cond, IValueT Type, IValueT Opcode, 231 void emitType01(CondARM32::Cond Cond, IValueT Type, IValueT Opcode,
(...skipping 29 matching lines...) Expand all
246 IValueT encodeBranchOffset(IOffsetT Offset, IValueT Inst); 261 IValueT encodeBranchOffset(IOffsetT Offset, IValueT Inst);
247 262
248 // Returns the offset encoded in the branch instruction Inst. 263 // Returns the offset encoded in the branch instruction Inst.
249 static IOffsetT decodeBranchOffset(IValueT Inst); 264 static IOffsetT decodeBranchOffset(IValueT Inst);
250 }; 265 };
251 266
252 } // end of namespace ARM32 267 } // end of namespace ARM32
253 } // end of namespace Ice 268 } // end of namespace Ice
254 269
255 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H 270 #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H
OLDNEW
« no previous file with comments | « no previous file | src/IceAssemblerARM32.cpp » ('j') | src/IceAssemblerARM32.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698