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

Side by Side Diff: src/IceAssembler.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 | « 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 10 matching lines...) Expand all
21 /// from this base class. This base class manages buffers and fixups for 21 /// from this base class. This base class manages buffers and fixups for
22 /// emitting code, etc. 22 /// emitting code, etc.
23 /// 23 ///
24 //===----------------------------------------------------------------------===// 24 //===----------------------------------------------------------------------===//
25 25
26 #ifndef SUBZERO_SRC_ICEASSEMBLER_H 26 #ifndef SUBZERO_SRC_ICEASSEMBLER_H
27 #define SUBZERO_SRC_ICEASSEMBLER_H 27 #define SUBZERO_SRC_ICEASSEMBLER_H
28 28
29 #include "IceDefs.h" 29 #include "IceDefs.h"
30 #include "IceFixups.h" 30 #include "IceFixups.h"
31 #include "IceStringPool.h"
31 #include "IceUtils.h" 32 #include "IceUtils.h"
32 33
33 #include "llvm/Support/Allocator.h" 34 #include "llvm/Support/Allocator.h"
34 35
35 namespace Ice { 36 namespace Ice {
36 37
37 class Assembler; 38 class Assembler;
38 39
39 /// A Label can be in one of three states: 40 /// A Label can be in one of three states:
40 /// - Unused. 41 /// - Unused.
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 void bindRelocOffset(RelocOffset *Offset); 317 void bindRelocOffset(RelocOffset *Offset);
317 318
318 void setNeedsTextFixup() { Buffer.setNeedsTextFixup(); } 319 void setNeedsTextFixup() { Buffer.setNeedsTextFixup(); }
319 void resetNeedsTextFixup() { Buffer.resetNeedsTextFixup(); } 320 void resetNeedsTextFixup() { Buffer.resetNeedsTextFixup(); }
320 321
321 bool needsTextFixup() const { return Buffer.needsTextFixup(); } 322 bool needsTextFixup() const { return Buffer.needsTextFixup(); }
322 323
323 void emitIASBytes(GlobalContext *Ctx) const; 324 void emitIASBytes(GlobalContext *Ctx) const;
324 bool getInternal() const { return IsInternal; } 325 bool getInternal() const { return IsInternal; }
325 void setInternal(bool Internal) { IsInternal = Internal; } 326 void setInternal(bool Internal) { IsInternal = Internal; }
326 const IceString &getFunctionName() { return FunctionName; } 327 GlobalString getFunctionName() const { return FunctionName; }
327 void setFunctionName(const IceString &NewName) { FunctionName = NewName; } 328 void setFunctionName(GlobalString NewName) { FunctionName = NewName; }
328 intptr_t getBufferSize() const { return Buffer.size(); } 329 intptr_t getBufferSize() const { return Buffer.size(); }
329 /// Roll back to a (smaller) size. 330 /// Roll back to a (smaller) size.
330 void setBufferSize(intptr_t NewSize) { Buffer.setSize(NewSize); } 331 void setBufferSize(intptr_t NewSize) { Buffer.setSize(NewSize); }
331 void setPreliminary(bool Value) { Preliminary = Value; } 332 void setPreliminary(bool Value) { Preliminary = Value; }
332 bool getPreliminary() const { return Preliminary; } 333 bool getPreliminary() const { return Preliminary; }
333 334
334 AssemblerKind getKind() const { return Kind; } 335 AssemblerKind getKind() const { return Kind; }
335 336
336 protected: 337 protected:
337 explicit Assembler(AssemblerKind Kind) 338 explicit Assembler(AssemblerKind Kind)
338 : Kind(Kind), Allocator(), Buffer(*this) {} 339 : Kind(Kind), Allocator(), Buffer(*this) {}
339 340
340 private: 341 private:
341 const AssemblerKind Kind; 342 const AssemblerKind Kind;
342 343
343 using AssemblerAllocator = 344 using AssemblerAllocator =
344 llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, /*SlabSize=*/32 * 1024>; 345 llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, /*SlabSize=*/32 * 1024>;
345 AssemblerAllocator Allocator; 346 AssemblerAllocator Allocator;
346 347
347 /// FunctionName and IsInternal are transferred from the original Cfg object, 348 /// FunctionName and IsInternal are transferred from the original Cfg object,
348 /// since the Cfg object may be deleted by the time the assembler buffer is 349 /// since the Cfg object may be deleted by the time the assembler buffer is
349 /// emitted. 350 /// emitted.
350 IceString FunctionName = ""; 351 GlobalString FunctionName;
351 bool IsInternal = false; 352 bool IsInternal = false;
352 /// Preliminary indicates whether a preliminary pass is being made for 353 /// Preliminary indicates whether a preliminary pass is being made for
353 /// calculating bundle padding (Preliminary=true), versus the final pass where 354 /// calculating bundle padding (Preliminary=true), versus the final pass where
354 /// all changes to label bindings, label links, and relocation fixups are 355 /// all changes to label bindings, label links, and relocation fixups are
355 /// fully committed (Preliminary=false). 356 /// fully committed (Preliminary=false).
356 bool Preliminary = false; 357 bool Preliminary = false;
357 358
358 /// Installs a created fixup, after it has been allocated. 359 /// Installs a created fixup, after it has been allocated.
359 void installFixup(AssemblerFixup *F) { Buffer.installFixup(F); } 360 void installFixup(AssemblerFixup *F) { Buffer.installFixup(F); }
360 361
361 protected: 362 protected:
362 // Buffer's constructor uses the Allocator, so it needs to appear after it. 363 // Buffer's constructor uses the Allocator, so it needs to appear after it.
363 // TODO(jpp): dependencies on construction order are a nice way of shooting 364 // TODO(jpp): dependencies on construction order are a nice way of shooting
364 // yourself in the foot. Fix this. 365 // yourself in the foot. Fix this.
365 AssemblerBuffer Buffer; 366 AssemblerBuffer Buffer;
366 }; 367 };
367 368
368 } // end of namespace Ice 369 } // end of namespace Ice
369 370
370 #endif // SUBZERO_SRC_ICEASSEMBLER_H_ 371 #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