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

Side by Side Diff: src/IceAssembler.h

Issue 1738443002: Subzero. Performance tweaks. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments -- all of them Created 4 years, 9 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 | « Makefile.standalone ('k') | src/IceBitVector.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 //===----------------------------------------------------------------------===// 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 "IceUtils.h" 31 #include "IceUtils.h"
32 32
33 #include "llvm/Support/Allocator.h"
34
33 namespace Ice { 35 namespace Ice {
34 36
35 class Assembler; 37 class Assembler;
36 38
37 /// A Label can be in one of three states: 39 /// A Label can be in one of three states:
38 /// - Unused. 40 /// - Unused.
39 /// - Linked, unplaced and tracking the position of branches to the label. 41 /// - Linked, unplaced and tracking the position of branches to the label.
40 /// - Bound, placed and tracking its position. 42 /// - Bound, placed and tracking its position.
41 class Label { 43 class Label {
42 Label(const Label &) = delete; 44 Label(const Label &) = delete;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 333
332 AssemblerKind getKind() const { return Kind; } 334 AssemblerKind getKind() const { return Kind; }
333 335
334 protected: 336 protected:
335 explicit Assembler(AssemblerKind Kind) 337 explicit Assembler(AssemblerKind Kind)
336 : Kind(Kind), Allocator(), Buffer(*this) {} 338 : Kind(Kind), Allocator(), Buffer(*this) {}
337 339
338 private: 340 private:
339 const AssemblerKind Kind; 341 const AssemblerKind Kind;
340 342
341 ArenaAllocator<32 * 1024> Allocator; 343 using AssemblerAllocator =
344 llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, /*SlabSize=*/32 * 1024>;
345 AssemblerAllocator Allocator;
346
342 /// FunctionName and IsInternal are transferred from the original Cfg object, 347 /// FunctionName and IsInternal are transferred from the original Cfg object,
343 /// since the Cfg object may be deleted by the time the assembler buffer is 348 /// since the Cfg object may be deleted by the time the assembler buffer is
344 /// emitted. 349 /// emitted.
345 IceString FunctionName = ""; 350 IceString FunctionName = "";
346 bool IsInternal = false; 351 bool IsInternal = false;
347 /// Preliminary indicates whether a preliminary pass is being made for 352 /// Preliminary indicates whether a preliminary pass is being made for
348 /// calculating bundle padding (Preliminary=true), versus the final pass where 353 /// calculating bundle padding (Preliminary=true), versus the final pass where
349 /// all changes to label bindings, label links, and relocation fixups are 354 /// all changes to label bindings, label links, and relocation fixups are
350 /// fully committed (Preliminary=false). 355 /// fully committed (Preliminary=false).
351 bool Preliminary = false; 356 bool Preliminary = false;
352 357
353 /// Installs a created fixup, after it has been allocated. 358 /// Installs a created fixup, after it has been allocated.
354 void installFixup(AssemblerFixup *F) { Buffer.installFixup(F); } 359 void installFixup(AssemblerFixup *F) { Buffer.installFixup(F); }
355 360
356 protected: 361 protected:
357 // Buffer's constructor uses the Allocator, so it needs to appear after it. 362 // Buffer's constructor uses the Allocator, so it needs to appear after it.
358 // TODO(jpp): dependencies on construction order are a nice way of shooting 363 // TODO(jpp): dependencies on construction order are a nice way of shooting
359 // yourself in the foot. Fix this. 364 // yourself in the foot. Fix this.
360 AssemblerBuffer Buffer; 365 AssemblerBuffer Buffer;
361 }; 366 };
362 367
363 } // end of namespace Ice 368 } // end of namespace Ice
364 369
365 #endif // SUBZERO_SRC_ICEASSEMBLER_H_ 370 #endif // SUBZERO_SRC_ICEASSEMBLER_H_
OLDNEW
« no previous file with comments | « Makefile.standalone ('k') | src/IceBitVector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698