Commit aff4ccf9 by John Porto

Renames the assembler* files.

Renames the assembler* files to IceAssembler*. Fixes whatever breaks. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4077 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/1179563004.
parent f8b4cc84
...@@ -163,8 +163,8 @@ LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib -Wl,--gc-sections \ ...@@ -163,8 +163,8 @@ LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib -Wl,--gc-sections \
SB_LDFLAGS := $(LINKOPTLEVEL) $(LD_EXTRA) SB_LDFLAGS := $(LINKOPTLEVEL) $(LD_EXTRA)
SRCS = \ SRCS = \
assembler.cpp \ IceAssembler.cpp \
assembler_ia32.cpp \ IceAssemblerX8632.cpp \
IceBrowserCompileServer.cpp \ IceBrowserCompileServer.cpp \
IceCfg.cpp \ IceCfg.cpp \
IceCfgNode.cpp \ IceCfgNode.cpp \
......
//===- 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 // 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 // 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. // BSD-style license that can be found in the LICENSE file.
...@@ -18,81 +18,81 @@ ...@@ -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 "IceGlobalContext.h"
#include "IceOperand.h" #include "IceOperand.h"
namespace Ice { namespace Ice {
static uintptr_t NewContents(Assembler &assembler, intptr_t capacity) { static uintptr_t NewContents(Assembler &Assemblr, intptr_t Capacity) {
uintptr_t result = assembler.AllocateBytes(capacity); uintptr_t Result = Assemblr.allocateBytes(Capacity);
return result; return Result;
} }
AssemblerFixup *AssemblerBuffer::createFixup(FixupKind Kind, AssemblerFixup *AssemblerBuffer::createFixup(FixupKind Kind,
const Constant *Value) { const Constant *Value) {
AssemblerFixup *F = AssemblerFixup *F =
new (assembler_.Allocate<AssemblerFixup>()) AssemblerFixup(); new (Assemblr.allocate<AssemblerFixup>()) AssemblerFixup();
F->set_position(0); F->set_position(0);
F->set_kind(Kind); F->set_kind(Kind);
F->set_value(Value); F->set_value(Value);
if (!assembler_.getPreliminary()) if (!Assemblr.getPreliminary())
fixups_.push_back(F); Fixups.push_back(F);
return F; return F;
} }
#ifndef NDEBUG #ifndef NDEBUG
AssemblerBuffer::EnsureCapacity::EnsureCapacity(AssemblerBuffer *buffer) { AssemblerBuffer::EnsureCapacity::EnsureCapacity(AssemblerBuffer *buffer) {
if (buffer->cursor() >= buffer->limit()) if (buffer->cursor() >= buffer->limit())
buffer->ExtendCapacity(); buffer->extendCapacity();
// In debug mode, we save the assembler buffer along with the gap // In debug mode, we save the assembler buffer along with the gap
// size before we start emitting to the buffer. This allows us to // size before we start emitting to the buffer. This allows us to
// check that any single generated instruction doesn't overflow the // check that any single generated instruction doesn't overflow the
// limit implied by the minimum gap size. // limit implied by the minimum gap size.
buffer_ = buffer; Buffer = buffer;
gap_ = ComputeGap(); Gap = computeGap();
// Make sure that extending the capacity leaves a big enough gap // Make sure that extending the capacity leaves a big enough gap
// for any kind of instruction. // for any kind of instruction.
assert(gap_ >= kMinimumGap); assert(Gap >= kMinimumGap);
// Mark the buffer as having ensured the capacity. // Mark the buffer as having ensured the capacity.
assert(!buffer->HasEnsuredCapacity()); // Cannot nest. assert(!buffer->hasEnsuredCapacity()); // Cannot nest.
buffer->has_ensured_capacity_ = true; buffer->HasEnsuredCapacity = true;
} }
AssemblerBuffer::EnsureCapacity::~EnsureCapacity() { AssemblerBuffer::EnsureCapacity::~EnsureCapacity() {
// Unmark the buffer, so we cannot emit after this. // 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 // Make sure the generated instruction doesn't take up more
// space than the minimum gap. // space than the minimum gap.
intptr_t delta = gap_ - ComputeGap(); intptr_t delta = Gap - computeGap();
assert(delta <= kMinimumGap); assert(delta <= kMinimumGap);
} }
#endif // !NDEBUG #endif // !NDEBUG
AssemblerBuffer::AssemblerBuffer(Assembler &assembler) : assembler_(assembler) { AssemblerBuffer::AssemblerBuffer(Assembler &Asm) : Assemblr(Asm) {
const intptr_t OneKB = 1024; const intptr_t OneKB = 1024;
static const intptr_t kInitialBufferCapacity = 4 * OneKB; static const intptr_t kInitialBufferCapacity = 4 * OneKB;
contents_ = NewContents(assembler_, kInitialBufferCapacity); Contents = NewContents(Assemblr, kInitialBufferCapacity);
cursor_ = contents_; Cursor = Contents;
limit_ = ComputeLimit(contents_, kInitialBufferCapacity); Limit = computeLimit(Contents, kInitialBufferCapacity);
#ifndef NDEBUG #ifndef NDEBUG
has_ensured_capacity_ = false; HasEnsuredCapacity = false;
#endif // !NDEBUG #endif // !NDEBUG
// Verify internal state. // Verify internal state.
assert(Capacity() == kInitialBufferCapacity); assert(capacity() == kInitialBufferCapacity);
assert(Size() == 0); assert(size() == 0);
} }
AssemblerBuffer::~AssemblerBuffer() {} AssemblerBuffer::~AssemblerBuffer() {}
void AssemblerBuffer::ExtendCapacity() { void AssemblerBuffer::extendCapacity() {
intptr_t old_size = Size(); intptr_t old_size = size();
intptr_t old_capacity = Capacity(); intptr_t old_capacity = capacity();
const intptr_t OneMB = 1 << 20; const intptr_t OneMB = 1 << 20;
intptr_t new_capacity = std::min(old_capacity * 2, old_capacity + OneMB); intptr_t new_capacity = std::min(old_capacity * 2, old_capacity + OneMB);
if (new_capacity < old_capacity) { if (new_capacity < old_capacity) {
...@@ -101,42 +101,42 @@ void AssemblerBuffer::ExtendCapacity() { ...@@ -101,42 +101,42 @@ void AssemblerBuffer::ExtendCapacity() {
} }
// Allocate the new data area and copy contents of the old one to it. // 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), 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. // Compute the relocation delta and switch to the new contents area.
intptr_t delta = new_contents - contents_; intptr_t delta = new_contents - Contents;
contents_ = new_contents; Contents = new_contents;
// Update the cursor and recompute the limit. // Update the cursor and recompute the limit.
cursor_ += delta; Cursor += delta;
limit_ = ComputeLimit(new_contents, new_capacity); Limit = computeLimit(new_contents, new_capacity);
// Verify internal state. // Verify internal state.
assert(Capacity() == new_capacity); assert(capacity() == new_capacity);
assert(Size() == old_size); assert(size() == old_size);
} }
llvm::StringRef Assembler::getBufferView() const { llvm::StringRef Assembler::getBufferView() const {
return llvm::StringRef(reinterpret_cast<const char *>(buffer_.contents()), return llvm::StringRef(reinterpret_cast<const char *>(Buffer.contents()),
buffer_.Size()); Buffer.size());
} }
void Assembler::emitIASBytes(GlobalContext *Ctx) const { void Assembler::emitIASBytes(GlobalContext *Ctx) const {
Ostream &Str = Ctx->getStrEmit(); Ostream &Str = Ctx->getStrEmit();
intptr_t EndPosition = buffer_.Size(); intptr_t EndPosition = Buffer.size();
intptr_t CurPosition = 0; intptr_t CurPosition = 0;
const intptr_t FixupSize = 4; const intptr_t FixupSize = 4;
for (const AssemblerFixup *NextFixup : fixups()) { for (const AssemblerFixup *NextFixup : fixups()) {
intptr_t NextFixupLoc = NextFixup->position(); intptr_t NextFixupLoc = NextFixup->position();
for (intptr_t i = CurPosition; i < NextFixupLoc; ++i) { for (intptr_t i = CurPosition; i < NextFixupLoc; ++i) {
Str << "\t.byte 0x"; Str << "\t.byte 0x";
Str.write_hex(buffer_.Load<uint8_t>(i)); Str.write_hex(Buffer.load<uint8_t>(i));
Str << "\n"; Str << "\n";
} }
Str << "\t.long "; Str << "\t.long ";
NextFixup->emit(Ctx, buffer_.Load<RelocOffsetT>(NextFixupLoc)); NextFixup->emit(Ctx, Buffer.load<RelocOffsetT>(NextFixupLoc));
if (fixupIsPCRel(NextFixup->kind())) if (fixupIsPCRel(NextFixup->kind()))
Str << " - ."; Str << " - .";
Str << "\n"; Str << "\n";
...@@ -146,7 +146,7 @@ void Assembler::emitIASBytes(GlobalContext *Ctx) const { ...@@ -146,7 +146,7 @@ void Assembler::emitIASBytes(GlobalContext *Ctx) const {
// Handle any bytes that are not prefixed by a fixup. // Handle any bytes that are not prefixed by a fixup.
for (intptr_t i = CurPosition; i < EndPosition; ++i) { for (intptr_t i = CurPosition; i < EndPosition; ++i) {
Str << "\t.byte 0x"; Str << "\t.byte 0x";
Str.write_hex(buffer_.Load<uint8_t>(i)); Str.write_hex(Buffer.load<uint8_t>(i));
Str << "\n"; Str << "\n";
} }
} }
......
//===- subzero/src/assembler.h - Integrated assembler -----------*- C++ -*-===// //===- subzero/src/IceAssembler.h - Integrated assembler --------*- C++ -*-===//
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // 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 // 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. // BSD-style license that can be found in the LICENSE file.
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef SUBZERO_SRC_ASSEMBLER_H #ifndef SUBZERO_SRC_ICEASSEMBLER_H
#define SUBZERO_SRC_ASSEMBLER_H #define SUBZERO_SRC_ICEASSEMBLER_H
#include "IceDefs.h" #include "IceDefs.h"
#include "IceFixups.h" #include "IceFixups.h"
...@@ -38,30 +38,30 @@ public: ...@@ -38,30 +38,30 @@ public:
~AssemblerBuffer(); ~AssemblerBuffer();
// Basic support for emitting, loading, and storing. // Basic support for emitting, loading, and storing.
template <typename T> void Emit(T value) { template <typename T> void emit(T Value) {
assert(HasEnsuredCapacity()); assert(hasEnsuredCapacity());
*reinterpret_cast<T *>(cursor_) = value; *reinterpret_cast<T *>(Cursor) = Value;
cursor_ += sizeof(T); Cursor += sizeof(T);
} }
template <typename T> T Load(intptr_t position) const { template <typename T> T load(intptr_t Position) const {
assert(position >= 0 && assert(Position >= 0 &&
position <= (Size() - static_cast<intptr_t>(sizeof(T)))); Position <= (size() - static_cast<intptr_t>(sizeof(T))));
return *reinterpret_cast<T *>(contents_ + position); return *reinterpret_cast<T *>(Contents + Position);
} }
template <typename T> void Store(intptr_t position, T value) { template <typename T> void store(intptr_t Position, T Value) {
assert(position >= 0 && assert(Position >= 0 &&
position <= (Size() - static_cast<intptr_t>(sizeof(T)))); Position <= (size() - static_cast<intptr_t>(sizeof(T))));
*reinterpret_cast<T *>(contents_ + position) = value; *reinterpret_cast<T *>(Contents + Position) = Value;
} }
// Emit a fixup at the current location. // Emit a fixup at the current location.
void EmitFixup(AssemblerFixup *fixup) { fixup->set_position(Size()); } void emitFixup(AssemblerFixup *Fixup) { Fixup->set_position(size()); }
// Get the size of the emitted code. // Get the size of the emitted code.
intptr_t Size() const { return cursor_ - contents_; } intptr_t size() const { return Cursor - Contents; }
uintptr_t contents() const { return contents_; } uintptr_t contents() const { return Contents; }
// To emit an instruction to the assembler buffer, the EnsureCapacity helper // To emit an instruction to the assembler buffer, the EnsureCapacity helper
// must be used to guarantee that the underlying data area is big enough to // must be used to guarantee that the underlying data area is big enough to
...@@ -77,47 +77,47 @@ public: ...@@ -77,47 +77,47 @@ public:
EnsureCapacity &operator=(const EnsureCapacity &) = delete; EnsureCapacity &operator=(const EnsureCapacity &) = delete;
public: public:
explicit EnsureCapacity(AssemblerBuffer *buffer); explicit EnsureCapacity(AssemblerBuffer *Buffer);
~EnsureCapacity(); ~EnsureCapacity();
private: private:
AssemblerBuffer *buffer_; AssemblerBuffer *Buffer;
intptr_t gap_; intptr_t Gap;
intptr_t ComputeGap() { return buffer_->Capacity() - buffer_->Size(); } intptr_t computeGap() { return Buffer->capacity() - Buffer->size(); }
}; };
bool has_ensured_capacity_; bool HasEnsuredCapacity;
bool HasEnsuredCapacity() const { return has_ensured_capacity_; } bool hasEnsuredCapacity() const { return HasEnsuredCapacity; }
#else // NDEBUG #else // NDEBUG
class EnsureCapacity { class EnsureCapacity {
EnsureCapacity(const EnsureCapacity &) = delete; EnsureCapacity(const EnsureCapacity &) = delete;
EnsureCapacity &operator=(const EnsureCapacity &) = delete; EnsureCapacity &operator=(const EnsureCapacity &) = delete;
public: public:
explicit EnsureCapacity(AssemblerBuffer *buffer) { explicit EnsureCapacity(AssemblerBuffer *Buffer) {
if (buffer->cursor() >= buffer->limit()) if (Buffer->cursor() >= buffer->limit())
buffer->ExtendCapacity(); buffer->extendCapacity();
} }
}; };
// When building the C++ tests, assertion code is enabled. To allow // When building the C++ tests, assertion code is enabled. To allow
// asserting that the user of the assembler buffer has ensured the // asserting that the user of the assembler buffer has ensured the
// capacity needed for emitting, we add a dummy method in non-debug mode. // capacity needed for emitting, we add a dummy method in non-debug mode.
bool HasEnsuredCapacity() const { return true; } bool hasEnsuredCapacity() const { return true; }
#endif // NDEBUG #endif // NDEBUG
// Returns the position in the instruction stream. // Returns the position in the instruction stream.
intptr_t GetPosition() const { return cursor_ - contents_; } intptr_t getPosition() const { return Cursor - Contents; }
// Create and track a fixup in the current function. // Create and track a fixup in the current function.
AssemblerFixup *createFixup(FixupKind Kind, const Constant *Value); AssemblerFixup *createFixup(FixupKind Kind, const Constant *Value);
const FixupRefList &fixups() const { return fixups_; } const FixupRefList &fixups() const { return Fixups; }
void setSize(intptr_t NewSize) { void setSize(intptr_t NewSize) {
assert(NewSize <= Size()); assert(NewSize <= size());
cursor_ = contents_ + NewSize; Cursor = Contents + NewSize;
} }
private: private:
...@@ -126,27 +126,28 @@ private: ...@@ -126,27 +126,28 @@ private:
// for a single, fast space check per instruction. // for a single, fast space check per instruction.
static const intptr_t kMinimumGap = 32; static const intptr_t kMinimumGap = 32;
uintptr_t contents_; uintptr_t Contents;
uintptr_t cursor_; uintptr_t Cursor;
uintptr_t limit_; uintptr_t Limit;
Assembler &assembler_; // The member variable is named Assemblr to avoid hiding the class Assembler.
Assembler &Assemblr;
// List of pool-allocated fixups relative to the current function. // List of pool-allocated fixups relative to the current function.
FixupRefList fixups_; FixupRefList Fixups;
uintptr_t cursor() const { return cursor_; } uintptr_t cursor() const { return Cursor; }
uintptr_t limit() const { return limit_; } uintptr_t limit() const { return Limit; }
intptr_t Capacity() const { intptr_t capacity() const {
assert(limit_ >= contents_); assert(Limit >= Contents);
return (limit_ - contents_) + kMinimumGap; return (Limit - Contents) + kMinimumGap;
} }
// Compute the limit based on the data area and the capacity. See // Compute the limit based on the data area and the capacity. See
// description of kMinimumGap for the reasoning behind the value. // description of kMinimumGap for the reasoning behind the value.
static uintptr_t ComputeLimit(uintptr_t data, intptr_t capacity) { static uintptr_t computeLimit(uintptr_t Data, intptr_t Capacity) {
return data + capacity - kMinimumGap; return Data + Capacity - kMinimumGap;
} }
void ExtendCapacity(); void extendCapacity();
}; };
class Assembler { class Assembler {
...@@ -155,12 +156,12 @@ class Assembler { ...@@ -155,12 +156,12 @@ class Assembler {
public: public:
Assembler() Assembler()
: FunctionName(""), IsInternal(false), Preliminary(false), : Buffer(*this), FunctionName(""), IsInternal(false),
buffer_(*this) {} Preliminary(false) {}
virtual ~Assembler() {} virtual ~Assembler() = default;
// Allocate a chunk of bytes using the per-Assembler allocator. // Allocate a chunk of bytes using the per-Assembler allocator.
uintptr_t AllocateBytes(size_t bytes) { uintptr_t allocateBytes(size_t bytes) {
// For now, alignment is not related to NaCl bundle alignment, since // For now, alignment is not related to NaCl bundle alignment, since
// the buffer's GetPosition is relative to the base. So NaCl bundle // the buffer's GetPosition is relative to the base. So NaCl bundle
// alignment checks can be relative to that base. Later, the buffer // alignment checks can be relative to that base. Later, the buffer
...@@ -172,7 +173,7 @@ public: ...@@ -172,7 +173,7 @@ public:
} }
// Allocate data of type T using the per-Assembler allocator. // Allocate data of type T using the per-Assembler allocator.
template <typename T> T *Allocate() { return Allocator.Allocate<T>(); } template <typename T> T *allocate() { return Allocator.Allocate<T>(); }
// Align the tail end of the function to the required target alignment. // Align the tail end of the function to the required target alignment.
virtual void alignFunction() = 0; virtual void alignFunction() = 0;
...@@ -187,17 +188,17 @@ public: ...@@ -187,17 +188,17 @@ public:
// Mark the current text location as the start of a CFG node // Mark the current text location as the start of a CFG node
// (represented by NodeNumber). // (represented by NodeNumber).
virtual void BindCfgNodeLabel(SizeT NodeNumber) = 0; virtual void bindCfgNodeLabel(SizeT NodeNumber) = 0;
virtual bool fixupIsPCRel(FixupKind Kind) const = 0; virtual bool fixupIsPCRel(FixupKind Kind) const = 0;
// Return a view of all the bytes of code for the current function. // Return a view of all the bytes of code for the current function.
llvm::StringRef getBufferView() const; llvm::StringRef getBufferView() const;
const FixupRefList &fixups() const { return buffer_.fixups(); } const FixupRefList &fixups() const { return Buffer.fixups(); }
AssemblerFixup *createFixup(FixupKind Kind, const Constant *Value) { AssemblerFixup *createFixup(FixupKind Kind, const Constant *Value) {
return buffer_.createFixup(Kind, Value); return Buffer.createFixup(Kind, Value);
} }
void emitIASBytes(GlobalContext *Ctx) const; void emitIASBytes(GlobalContext *Ctx) const;
...@@ -205,12 +206,15 @@ public: ...@@ -205,12 +206,15 @@ public:
void setInternal(bool Internal) { IsInternal = Internal; } void setInternal(bool Internal) { IsInternal = Internal; }
const IceString &getFunctionName() { return FunctionName; } const IceString &getFunctionName() { return FunctionName; }
void setFunctionName(const IceString &NewName) { FunctionName = NewName; } void setFunctionName(const IceString &NewName) { FunctionName = NewName; }
intptr_t getBufferSize() const { return buffer_.Size(); } intptr_t getBufferSize() const { return Buffer.size(); }
// Roll back to a (smaller) size. // Roll back to a (smaller) size.
void setBufferSize(intptr_t NewSize) { buffer_.setSize(NewSize); } void setBufferSize(intptr_t NewSize) { Buffer.setSize(NewSize); }
void setPreliminary(bool Value) { Preliminary = Value; } void setPreliminary(bool Value) { Preliminary = Value; }
bool getPreliminary() const { return Preliminary; } bool getPreliminary() const { return Preliminary; }
protected:
AssemblerBuffer Buffer;
private: private:
ArenaAllocator<32 * 1024> Allocator; ArenaAllocator<32 * 1024> Allocator;
// FunctionName and IsInternal are transferred from the original Cfg // FunctionName and IsInternal are transferred from the original Cfg
...@@ -223,11 +227,8 @@ private: ...@@ -223,11 +227,8 @@ private:
// final pass where all changes to label bindings, label links, and // final pass where all changes to label bindings, label links, and
// relocation fixups are fully committed (Preliminary=false). // relocation fixups are fully committed (Preliminary=false).
bool Preliminary; bool Preliminary;
protected:
AssemblerBuffer buffer_;
}; };
} // end of namespace Ice } // end of namespace Ice
#endif // SUBZERO_SRC_ASSEMBLER_H_ #endif // SUBZERO_SRC_ICEASSEMBLER_H_
//===- subzero/src/assembler_arm32.h - Assembler for ARM32 ------*- C++ -*-===// //===- subzero/src/IceAssemblerARM32.h - Assembler for ARM32 ----*- C++ -*-===//
// //
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a // for details. All rights reserved. Use of this source code is governed by a
...@@ -19,14 +19,13 @@ ...@@ -19,14 +19,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef SUBZERO_SRC_ASSEMBLER_ARM32_H #ifndef SUBZERO_SRC_ICEASSEMBLERARM32_H
#define SUBZERO_SRC_ASSEMBLER_ARM32_H #define SUBZERO_SRC_ICEASSEMBLERARM32_H
#include "IceAssembler.h"
#include "IceDefs.h" #include "IceDefs.h"
#include "IceFixups.h" #include "IceFixups.h"
#include "assembler.h"
namespace Ice { namespace Ice {
namespace ARM32 { namespace ARM32 {
...@@ -60,7 +59,7 @@ public: ...@@ -60,7 +59,7 @@ public:
llvm_unreachable("Not yet implemented."); llvm_unreachable("Not yet implemented.");
} }
void BindCfgNodeLabel(SizeT NodeNumber) override { void bindCfgNodeLabel(SizeT NodeNumber) override {
(void)NodeNumber; (void)NodeNumber;
llvm_unreachable("Not yet implemented."); llvm_unreachable("Not yet implemented.");
} }
...@@ -74,4 +73,4 @@ public: ...@@ -74,4 +73,4 @@ public:
} // end of namespace ARM32 } // end of namespace ARM32
} // end of namespace Ice } // end of namespace Ice
#endif // SUBZERO_SRC_ASSEMBLER_ARM32_H #endif // SUBZERO_SRC_ICEASSEMBLERARM32_H
...@@ -19,9 +19,10 @@ ...@@ -19,9 +19,10 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef SUBZERO_SRC_ASSEMBLER_IA32_H #ifndef SUBZERO_SRC_ICEASSEMBLERX8632_H
#define SUBZERO_SRC_ASSEMBLER_IA32_H #define SUBZERO_SRC_ICEASSEMBLERX8632_H
#include "IceAssembler.h"
#include "IceConditionCodesX8632.h" #include "IceConditionCodesX8632.h"
#include "IceDefs.h" #include "IceDefs.h"
#include "IceOperand.h" #include "IceOperand.h"
...@@ -29,8 +30,6 @@ ...@@ -29,8 +30,6 @@
#include "IceTypes.h" #include "IceTypes.h"
#include "IceUtils.h" #include "IceUtils.h"
#include "assembler.h"
namespace Ice { namespace Ice {
using RegX8632::GPRRegister; using RegX8632::GPRRegister;
...@@ -369,7 +368,7 @@ public: ...@@ -369,7 +368,7 @@ public:
} }
Label *GetOrCreateCfgNodeLabel(SizeT NodeNumber); Label *GetOrCreateCfgNodeLabel(SizeT NodeNumber);
void BindCfgNodeLabel(SizeT NodeNumber) override; void bindCfgNodeLabel(SizeT NodeNumber) override;
Label *GetOrCreateLocalLabel(SizeT Number); Label *GetOrCreateLocalLabel(SizeT Number);
void BindLocalLabel(SizeT Number); void BindLocalLabel(SizeT Number);
...@@ -820,35 +819,35 @@ public: ...@@ -820,35 +819,35 @@ public:
void xadd(Type Ty, const Address &address, GPRRegister reg, bool Locked); void xadd(Type Ty, const Address &address, GPRRegister reg, bool Locked);
void xchg(Type Ty, const Address &address, GPRRegister reg); void xchg(Type Ty, const Address &address, GPRRegister reg);
void EmitSegmentOverride(uint8_t prefix); void emitSegmentOverride(uint8_t prefix);
intptr_t PreferredLoopAlignment() { return 16; } intptr_t preferredLoopAlignment() { return 16; }
void Align(intptr_t alignment, intptr_t offset); void align(intptr_t alignment, intptr_t offset);
void Bind(Label *label); void bind(Label *label);
intptr_t CodeSize() const { return buffer_.Size(); } intptr_t CodeSize() const { return Buffer.size(); }
private: private:
inline void EmitUint8(uint8_t value); inline void emitUint8(uint8_t value);
inline void EmitInt16(int16_t value); inline void emitInt16(int16_t value);
inline void EmitInt32(int32_t value); inline void emitInt32(int32_t value);
inline void EmitRegisterOperand(int rm, int reg); inline void emitRegisterOperand(int rm, int reg);
inline void EmitXmmRegisterOperand(int rm, XmmRegister reg); inline void emitXmmRegisterOperand(int rm, XmmRegister reg);
inline void EmitFixup(AssemblerFixup *fixup); inline void emitFixup(AssemblerFixup *fixup);
inline void EmitOperandSizeOverride(); inline void emitOperandSizeOverride();
void EmitOperand(int rm, const Operand &operand); void emitOperand(int rm, const Operand &operand);
void EmitImmediate(Type ty, const Immediate &imm); void emitImmediate(Type ty, const Immediate &imm);
void EmitComplexI8(int rm, const Operand &operand, void emitComplexI8(int rm, const Operand &operand,
const Immediate &immediate); const Immediate &immediate);
void EmitComplex(Type Ty, int rm, const Operand &operand, void emitComplex(Type Ty, int rm, const Operand &operand,
const Immediate &immediate); const Immediate &immediate);
void EmitLabel(Label *label, intptr_t instruction_size); void emitLabel(Label *label, intptr_t instruction_size);
void EmitLabelLink(Label *label); void emitLabelLink(Label *label);
void EmitNearLabelLink(Label *label); void emitNearLabelLink(Label *label);
void EmitGenericShift(int rm, Type Ty, GPRRegister reg, const Immediate &imm); void emitGenericShift(int rm, Type Ty, GPRRegister reg, const Immediate &imm);
void EmitGenericShift(int rm, Type Ty, const Operand &operand, void emitGenericShift(int rm, Type Ty, const Operand &operand,
GPRRegister shifter); GPRRegister shifter);
typedef std::vector<Label *> LabelVector; typedef std::vector<Label *> LabelVector;
...@@ -860,34 +859,34 @@ private: ...@@ -860,34 +859,34 @@ private:
Label *GetOrCreateLabel(SizeT Number, LabelVector &Labels); Label *GetOrCreateLabel(SizeT Number, LabelVector &Labels);
}; };
inline void AssemblerX8632::EmitUint8(uint8_t value) { inline void AssemblerX8632::emitUint8(uint8_t value) {
buffer_.Emit<uint8_t>(value); Buffer.emit<uint8_t>(value);
} }
inline void AssemblerX8632::EmitInt16(int16_t value) { inline void AssemblerX8632::emitInt16(int16_t value) {
buffer_.Emit<int16_t>(value); Buffer.emit<int16_t>(value);
} }
inline void AssemblerX8632::EmitInt32(int32_t value) { inline void AssemblerX8632::emitInt32(int32_t value) {
buffer_.Emit<int32_t>(value); Buffer.emit<int32_t>(value);
} }
inline void AssemblerX8632::EmitRegisterOperand(int rm, int reg) { inline void AssemblerX8632::emitRegisterOperand(int rm, int reg) {
assert(rm >= 0 && rm < 8); assert(rm >= 0 && rm < 8);
buffer_.Emit<uint8_t>(0xC0 + (rm << 3) + reg); Buffer.emit<uint8_t>(0xC0 + (rm << 3) + reg);
} }
inline void AssemblerX8632::EmitXmmRegisterOperand(int rm, XmmRegister reg) { inline void AssemblerX8632::emitXmmRegisterOperand(int rm, XmmRegister reg) {
EmitRegisterOperand(rm, static_cast<GPRRegister>(reg)); emitRegisterOperand(rm, static_cast<GPRRegister>(reg));
} }
inline void AssemblerX8632::EmitFixup(AssemblerFixup *fixup) { inline void AssemblerX8632::emitFixup(AssemblerFixup *fixup) {
buffer_.EmitFixup(fixup); Buffer.emitFixup(fixup);
} }
inline void AssemblerX8632::EmitOperandSizeOverride() { EmitUint8(0x66); } inline void AssemblerX8632::emitOperandSizeOverride() { emitUint8(0x66); }
} // end of namespace X8632 } // end of namespace X8632
} // end of namespace Ice } // end of namespace Ice
#endif // SUBZERO_SRC_ASSEMBLER_IA32_H #endif // SUBZERO_SRC_ICEASSEMBLERX8632_H
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "assembler.h" #include "IceAssembler.h"
#include "IceCfg.h" #include "IceCfg.h"
#include "IceCfgNode.h" #include "IceCfgNode.h"
#include "IceClFlags.h" #include "IceClFlags.h"
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#ifndef SUBZERO_SRC_ICECFG_H #ifndef SUBZERO_SRC_ICECFG_H
#define SUBZERO_SRC_ICECFG_H #define SUBZERO_SRC_ICECFG_H
#include "assembler.h" #include "IceAssembler.h"
#include "IceClFlags.h" #include "IceClFlags.h"
#include "IceDefs.h" #include "IceDefs.h"
#include "IceGlobalContext.h" #include "IceGlobalContext.h"
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "assembler.h" #include "IceAssembler.h"
#include "IceCfg.h" #include "IceCfg.h"
#include "IceCfgNode.h" #include "IceCfgNode.h"
#include "IceGlobalInits.h" #include "IceGlobalInits.h"
...@@ -1062,7 +1062,7 @@ void CfgNode::emitIAS(Cfg *Func) const { ...@@ -1062,7 +1062,7 @@ void CfgNode::emitIAS(Cfg *Func) const {
// TODO(stichnot): When sandboxing, defer binding the node label // TODO(stichnot): When sandboxing, defer binding the node label
// until just before the first instruction is emitted, to reduce the // until just before the first instruction is emitted, to reduce the
// chance that a padding nop is a branch target. // chance that a padding nop is a branch target.
Asm->BindCfgNodeLabel(getIndex()); Asm->bindCfgNodeLabel(getIndex());
for (const Inst &I : Phis) { for (const Inst &I : Phis) {
if (I.isDeleted()) if (I.isDeleted())
continue; continue;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "llvm/Support/MathExtras.h" #include "llvm/Support/MathExtras.h"
#include "assembler.h" #include "IceAssembler.h"
#include "IceDefs.h" #include "IceDefs.h"
#include "IceELFObjectWriter.h" #include "IceELFObjectWriter.h"
#include "IceELFSection.h" #include "IceELFSection.h"
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "assembler_arm32.h" #include "IceAssemblerARM32.h"
#include "IceCfg.h" #include "IceCfg.h"
#include "IceCfgNode.h" #include "IceCfgNode.h"
#include "IceInst.h" #include "IceInst.h"
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "assembler_ia32.h" #include "IceAssemblerX8632.h"
#include "IceCfg.h" #include "IceCfg.h"
#include "IceCfgNode.h" #include "IceCfgNode.h"
#include "IceConditionCodesX8632.h" #include "IceConditionCodesX8632.h"
...@@ -2927,7 +2927,7 @@ void OperandX8632Mem::dump(const Cfg *Func, Ostream &Str) const { ...@@ -2927,7 +2927,7 @@ void OperandX8632Mem::dump(const Cfg *Func, Ostream &Str) const {
void OperandX8632Mem::emitSegmentOverride(X8632::AssemblerX8632 *Asm) const { void OperandX8632Mem::emitSegmentOverride(X8632::AssemblerX8632 *Asm) const {
if (SegmentReg != DefaultSegment) { if (SegmentReg != DefaultSegment) {
assert(SegmentReg >= 0 && SegmentReg < SegReg_NUM); assert(SegmentReg >= 0 && SegmentReg < SegReg_NUM);
Asm->EmitSegmentOverride(InstX8632SegmentPrefixes[SegmentReg]); Asm->emitSegmentOverride(InstX8632SegmentPrefixes[SegmentReg]);
} }
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#ifndef SUBZERO_SRC_ICEINSTX8632_H #ifndef SUBZERO_SRC_ICEINSTX8632_H
#define SUBZERO_SRC_ICEINSTX8632_H #define SUBZERO_SRC_ICEINSTX8632_H
#include "assembler_ia32.h" #include "IceAssemblerX8632.h"
#include "IceConditionCodesX8632.h" #include "IceConditionCodesX8632.h"
#include "IceDefs.h" #include "IceDefs.h"
#include "IceInst.h" #include "IceInst.h"
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "assembler_arm32.h" #include "IceAssemblerARM32.h"
#include "assembler_ia32.h" #include "IceAssemblerX8632.h"
#include "IceCfg.h" // setError() #include "IceCfg.h" // setError()
#include "IceCfgNode.h" #include "IceCfgNode.h"
#include "IceOperand.h" #include "IceOperand.h"
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <unordered_map> #include <unordered_map>
#include "assembler_ia32.h" #include "IceAssemblerX8632.h"
#include "IceDefs.h" #include "IceDefs.h"
#include "IceInst.h" #include "IceInst.h"
#include "IceInstX8632.h" #include "IceInstX8632.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment