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

Unified Diff: src/IceAssembler.cpp

Issue 1179563004: Renames the assembler* files. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Changes the top comment for IceAssemblerX8632.cpp Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceAssembler.h ('k') | src/IceAssemblerARM32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceAssembler.cpp
diff --git a/src/assembler.cpp b/src/IceAssembler.cpp
similarity index 66%
rename from src/assembler.cpp
rename to src/IceAssembler.cpp
index 931998e2b72c73dae1732b32d0aa9df2b0a53e67..a0500d62bbda846787ceb4b455f345603a685135 100644
--- a/src/assembler.cpp
+++ b/src/IceAssembler.cpp
@@ -1,4 +1,4 @@
-//===- subzero/src/assembler.cpp - Assembler base class -------------------===//
+//===- subzero/src/IceAssembler.cpp - Assembler base class ----------------===//
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -18,81 +18,81 @@
//
//===----------------------------------------------------------------------===//
//
-// This file implements the Assembler class.
+// This file implements the Assembler base class.
//
//===----------------------------------------------------------------------===//
-#include "assembler.h"
+#include "IceAssembler.h"
#include "IceGlobalContext.h"
#include "IceOperand.h"
namespace Ice {
-static uintptr_t NewContents(Assembler &assembler, intptr_t capacity) {
- uintptr_t result = assembler.AllocateBytes(capacity);
- return result;
+static uintptr_t NewContents(Assembler &Assemblr, intptr_t Capacity) {
+ uintptr_t Result = Assemblr.allocateBytes(Capacity);
+ return Result;
}
AssemblerFixup *AssemblerBuffer::createFixup(FixupKind Kind,
const Constant *Value) {
AssemblerFixup *F =
- new (assembler_.Allocate<AssemblerFixup>()) AssemblerFixup();
+ new (Assemblr.allocate<AssemblerFixup>()) AssemblerFixup();
F->set_position(0);
F->set_kind(Kind);
F->set_value(Value);
- if (!assembler_.getPreliminary())
- fixups_.push_back(F);
+ if (!Assemblr.getPreliminary())
+ Fixups.push_back(F);
return F;
}
#ifndef NDEBUG
AssemblerBuffer::EnsureCapacity::EnsureCapacity(AssemblerBuffer *buffer) {
if (buffer->cursor() >= buffer->limit())
- buffer->ExtendCapacity();
+ buffer->extendCapacity();
// In debug mode, we save the assembler buffer along with the gap
// size before we start emitting to the buffer. This allows us to
// check that any single generated instruction doesn't overflow the
// limit implied by the minimum gap size.
- buffer_ = buffer;
- gap_ = ComputeGap();
+ Buffer = buffer;
+ Gap = computeGap();
// Make sure that extending the capacity leaves a big enough gap
// for any kind of instruction.
- assert(gap_ >= kMinimumGap);
+ assert(Gap >= kMinimumGap);
// Mark the buffer as having ensured the capacity.
- assert(!buffer->HasEnsuredCapacity()); // Cannot nest.
- buffer->has_ensured_capacity_ = true;
+ assert(!buffer->hasEnsuredCapacity()); // Cannot nest.
+ buffer->HasEnsuredCapacity = true;
}
AssemblerBuffer::EnsureCapacity::~EnsureCapacity() {
// Unmark the buffer, so we cannot emit after this.
- buffer_->has_ensured_capacity_ = false;
+ Buffer->HasEnsuredCapacity = false;
// Make sure the generated instruction doesn't take up more
// space than the minimum gap.
- intptr_t delta = gap_ - ComputeGap();
+ intptr_t delta = Gap - computeGap();
assert(delta <= kMinimumGap);
}
#endif // !NDEBUG
-AssemblerBuffer::AssemblerBuffer(Assembler &assembler) : assembler_(assembler) {
+AssemblerBuffer::AssemblerBuffer(Assembler &Asm) : Assemblr(Asm) {
const intptr_t OneKB = 1024;
static const intptr_t kInitialBufferCapacity = 4 * OneKB;
- contents_ = NewContents(assembler_, kInitialBufferCapacity);
- cursor_ = contents_;
- limit_ = ComputeLimit(contents_, kInitialBufferCapacity);
+ Contents = NewContents(Assemblr, kInitialBufferCapacity);
+ Cursor = Contents;
+ Limit = computeLimit(Contents, kInitialBufferCapacity);
#ifndef NDEBUG
- has_ensured_capacity_ = false;
+ HasEnsuredCapacity = false;
#endif // !NDEBUG
// Verify internal state.
- assert(Capacity() == kInitialBufferCapacity);
- assert(Size() == 0);
+ assert(capacity() == kInitialBufferCapacity);
+ assert(size() == 0);
}
AssemblerBuffer::~AssemblerBuffer() {}
-void AssemblerBuffer::ExtendCapacity() {
- intptr_t old_size = Size();
- intptr_t old_capacity = Capacity();
+void AssemblerBuffer::extendCapacity() {
+ intptr_t old_size = size();
+ intptr_t old_capacity = capacity();
const intptr_t OneMB = 1 << 20;
intptr_t new_capacity = std::min(old_capacity * 2, old_capacity + OneMB);
if (new_capacity < old_capacity) {
@@ -101,42 +101,42 @@ void AssemblerBuffer::ExtendCapacity() {
}
// Allocate the new data area and copy contents of the old one to it.
- uintptr_t new_contents = NewContents(assembler_, new_capacity);
+ uintptr_t new_contents = NewContents(Assemblr, new_capacity);
memmove(reinterpret_cast<void *>(new_contents),
- reinterpret_cast<void *>(contents_), old_size);
+ reinterpret_cast<void *>(Contents), old_size);
// Compute the relocation delta and switch to the new contents area.
- intptr_t delta = new_contents - contents_;
- contents_ = new_contents;
+ intptr_t delta = new_contents - Contents;
+ Contents = new_contents;
// Update the cursor and recompute the limit.
- cursor_ += delta;
- limit_ = ComputeLimit(new_contents, new_capacity);
+ Cursor += delta;
+ Limit = computeLimit(new_contents, new_capacity);
// Verify internal state.
- assert(Capacity() == new_capacity);
- assert(Size() == old_size);
+ assert(capacity() == new_capacity);
+ assert(size() == old_size);
}
llvm::StringRef Assembler::getBufferView() const {
- return llvm::StringRef(reinterpret_cast<const char *>(buffer_.contents()),
- buffer_.Size());
+ return llvm::StringRef(reinterpret_cast<const char *>(Buffer.contents()),
+ Buffer.size());
}
void Assembler::emitIASBytes(GlobalContext *Ctx) const {
Ostream &Str = Ctx->getStrEmit();
- intptr_t EndPosition = buffer_.Size();
+ intptr_t EndPosition = Buffer.size();
intptr_t CurPosition = 0;
const intptr_t FixupSize = 4;
for (const AssemblerFixup *NextFixup : fixups()) {
intptr_t NextFixupLoc = NextFixup->position();
for (intptr_t i = CurPosition; i < NextFixupLoc; ++i) {
Str << "\t.byte 0x";
- Str.write_hex(buffer_.Load<uint8_t>(i));
+ Str.write_hex(Buffer.load<uint8_t>(i));
Str << "\n";
}
Str << "\t.long ";
- NextFixup->emit(Ctx, buffer_.Load<RelocOffsetT>(NextFixupLoc));
+ NextFixup->emit(Ctx, Buffer.load<RelocOffsetT>(NextFixupLoc));
if (fixupIsPCRel(NextFixup->kind()))
Str << " - .";
Str << "\n";
@@ -146,7 +146,7 @@ void Assembler::emitIASBytes(GlobalContext *Ctx) const {
// Handle any bytes that are not prefixed by a fixup.
for (intptr_t i = CurPosition; i < EndPosition; ++i) {
Str << "\t.byte 0x";
- Str.write_hex(buffer_.Load<uint8_t>(i));
+ Str.write_hex(Buffer.load<uint8_t>(i));
Str << "\n";
}
}
« no previous file with comments | « src/IceAssembler.h ('k') | src/IceAssemblerARM32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698