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

Side by Side Diff: src/IceAssembler.h

Issue 1265023003: Clarify which type "Label" refers to (generic vs X86) (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: simplify the get 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 | « no previous file | src/IceAssemblerARM32.h » ('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/IceAssembler.h - Integrated assembler --------*- C++ -*-===// 1 //===- subzero/src/IceAssembler.h - Integrated assembler --------*- C++ -*-===//
2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 // 5 //
6 // Modified by the Subzero authors. 6 // Modified by the Subzero authors.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // The Subzero Code Generator 10 // The Subzero Code Generator
(...skipping 12 matching lines...) Expand all
23 23
24 #ifndef SUBZERO_SRC_ICEASSEMBLER_H 24 #ifndef SUBZERO_SRC_ICEASSEMBLER_H
25 #define SUBZERO_SRC_ICEASSEMBLER_H 25 #define SUBZERO_SRC_ICEASSEMBLER_H
26 26
27 #include "IceDefs.h" 27 #include "IceDefs.h"
28 #include "IceFixups.h" 28 #include "IceFixups.h"
29 #include "IceUtils.h" 29 #include "IceUtils.h"
30 30
31 namespace Ice { 31 namespace Ice {
32 32
33 /// A Label can be in one of three states: 33 /// A LabelBase can be in one of three states:
34 /// - Unused. 34 /// - Unused.
35 /// - Linked, unplaced and tracking the position of branches to the label. 35 /// - Linked, unplaced and tracking the position of branches to the label.
36 /// - Bound, placed and tracking its position. 36 /// - Bound, placed and tracking its position.
37 class Label { 37 class LabelBase {
ascull 2015/07/31 20:54:54 Given that ARM and MIPS won't extend this is and t
jvoung (off chromium) 2015/08/03 17:19:21 Hmm good point about "Base"... ARM and MIPS don't
38 Label(const Label &) = delete; 38 LabelBase(const LabelBase &) = delete;
39 Label &operator=(const Label &) = delete; 39 LabelBase &operator=(const LabelBase &) = delete;
40 40
41 public: 41 public:
42 Label() = default; 42 LabelBase() = default;
43 ~Label() = default; 43 ~LabelBase() = default;
44 44
45 virtual void finalCheck() const { 45 virtual void finalCheck() const {
46 // Assert if label is being destroyed with unresolved branches pending. 46 // Assert if label is being destroyed with unresolved branches pending.
47 assert(!isLinked()); 47 assert(!isLinked());
48 } 48 }
49 49
50 /// Returns the position for bound labels (branches that come after this are 50 /// Returns the position for bound labels (branches that come after this are
51 /// considered backward branches). Cannot be used for unused or linked labels. 51 /// considered backward branches). Cannot be used for unused or linked labels.
52 intptr_t getPosition() const { 52 intptr_t getPosition() const {
53 assert(isBound()); 53 assert(isBound());
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 242
243 /// Add nop padding of a particular width to the current bundle. 243 /// Add nop padding of a particular width to the current bundle.
244 virtual void padWithNop(intptr_t Padding) = 0; 244 virtual void padWithNop(intptr_t Padding) = 0;
245 245
246 virtual SizeT getBundleAlignLog2Bytes() const = 0; 246 virtual SizeT getBundleAlignLog2Bytes() const = 0;
247 247
248 virtual const char *getAlignDirective() const = 0; 248 virtual const char *getAlignDirective() const = 0;
249 virtual llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const = 0; 249 virtual llvm::ArrayRef<uint8_t> getNonExecBundlePadding() const = 0;
250 250
251 /// Get the label for a CfgNode. 251 /// Get the label for a CfgNode.
252 virtual Label *getOrCreateCfgNodeLabel(SizeT NodeNumber) = 0; 252 virtual LabelBase *getCfgNodeLabel(SizeT NodeNumber) = 0;
253 /// Mark the current text location as the start of a CFG node 253 /// Mark the current text location as the start of a CFG node
254 /// (represented by NodeNumber). 254 /// (represented by NodeNumber).
255 virtual void bindCfgNodeLabel(SizeT NodeNumber) = 0; 255 virtual void bindCfgNodeLabel(SizeT NodeNumber) = 0;
256 256
257 virtual bool fixupIsPCRel(FixupKind Kind) const = 0; 257 virtual bool fixupIsPCRel(FixupKind Kind) const = 0;
258 258
259 // Return a view of all the bytes of code for the current function. 259 // Return a view of all the bytes of code for the current function.
260 llvm::StringRef getBufferView() const; 260 llvm::StringRef getBufferView() const;
261 261
262 const FixupRefList &fixups() const { return Buffer.fixups(); } 262 const FixupRefList &fixups() const { return Buffer.fixups(); }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 protected: 300 protected:
301 // Buffer's constructor uses the Allocator, so it needs to appear after it. 301 // Buffer's constructor uses the Allocator, so it needs to appear after it.
302 // TODO(jpp): dependencies on construction order are a nice way of shooting 302 // TODO(jpp): dependencies on construction order are a nice way of shooting
303 // yourself in the foot. Fix this. 303 // yourself in the foot. Fix this.
304 AssemblerBuffer Buffer; 304 AssemblerBuffer Buffer;
305 }; 305 };
306 306
307 } // end of namespace Ice 307 } // end of namespace Ice
308 308
309 #endif // SUBZERO_SRC_ICEASSEMBLER_H_ 309 #endif // SUBZERO_SRC_ICEASSEMBLER_H_
OLDNEW
« no previous file with comments | « no previous file | src/IceAssemblerARM32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698