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

Side by Side Diff: src/IceAssembler.h

Issue 1418313003: Handle branch relative to pc in ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix issues in patch set 2. 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
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 29 matching lines...) Expand all
40 40
41 public: 41 public:
42 Label() = default; 42 Label() = default;
43 ~Label() = default; 43 ~Label() = 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 encoded position stored in the label.
51 intptr_t getEncodedPosition() const { return Position; }
52
50 /// Returns the position for bound labels (branches that come after this are 53 /// Returns the position for bound labels (branches that come after this are
51 /// considered backward branches). Cannot be used for unused or linked labels. 54 /// considered backward branches). Cannot be used for unused or linked labels.
52 intptr_t getPosition() const { 55 intptr_t getPosition() const {
53 assert(isBound()); 56 assert(isBound());
54 return -Position - kWordSize; 57 return -Position - kWordSize;
55 } 58 }
56 59
57 /// Returns the position of an earlier branch instruction that was linked to 60 /// Returns the position of an earlier branch instruction that was linked to
58 /// this label (branches that use this are considered forward branches). The 61 /// this label (branches that use this are considered forward branches). The
59 /// linked instructions form a linked list, of sorts, using the instruction's 62 /// linked instructions form a linked list, of sorts, using the instruction's
(...skipping 10 matching lines...) Expand all
70 bool isLinked() const { return Position > 0; } 73 bool isLinked() const { return Position > 0; }
71 74
72 virtual bool isUnused() const { return Position == 0; } 75 virtual bool isUnused() const { return Position == 0; }
73 76
74 void bindTo(intptr_t position) { 77 void bindTo(intptr_t position) {
75 assert(!isBound()); 78 assert(!isBound());
76 Position = -position - kWordSize; 79 Position = -position - kWordSize;
77 assert(isBound()); 80 assert(isBound());
78 } 81 }
79 82
80 protected:
81 void linkTo(intptr_t position) { 83 void linkTo(intptr_t position) {
82 assert(!isBound()); 84 assert(!isBound());
83 Position = position + kWordSize; 85 Position = position + kWordSize;
84 assert(isLinked()); 86 assert(isLinked());
85 } 87 }
86 88
89 protected:
87 intptr_t Position = 0; 90 intptr_t Position = 0;
88 91
89 // TODO(jvoung): why are labels offset by this? 92 // TODO(jvoung): why are labels offset by this?
90 static constexpr uint32_t kWordSize = sizeof(uint32_t); 93 static constexpr uint32_t kWordSize = sizeof(uint32_t);
91 }; 94 };
92 95
93 /// Assembler buffers are used to emit binary code. They grow on demand. 96 /// Assembler buffers are used to emit binary code. They grow on demand.
94 class AssemblerBuffer { 97 class AssemblerBuffer {
95 AssemblerBuffer(const AssemblerBuffer &) = delete; 98 AssemblerBuffer(const AssemblerBuffer &) = delete;
96 AssemblerBuffer &operator=(const AssemblerBuffer &) = delete; 99 AssemblerBuffer &operator=(const AssemblerBuffer &) = delete;
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 GlobalContext *Ctx; 344 GlobalContext *Ctx;
342 // Buffer's constructor uses the Allocator, so it needs to appear after it. 345 // Buffer's constructor uses the Allocator, so it needs to appear after it.
343 // TODO(jpp): dependencies on construction order are a nice way of shooting 346 // TODO(jpp): dependencies on construction order are a nice way of shooting
344 // yourself in the foot. Fix this. 347 // yourself in the foot. Fix this.
345 AssemblerBuffer Buffer; 348 AssemblerBuffer Buffer;
346 }; 349 };
347 350
348 } // end of namespace Ice 351 } // end of namespace Ice
349 352
350 #endif // SUBZERO_SRC_ICEASSEMBLER_H_ 353 #endif // SUBZERO_SRC_ICEASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/DartARM32/assembler_arm.cc ('k') | src/IceAssemblerARM32.h » ('j') | src/IceAssemblerARM32.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698