//===- subzero/src/IceAssemblerX86BaseImpl.h - base x86 assembler -*- C++ -*-=// // 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 // BSD-style license that can be found in the LICENSE file. // // Modified by the Subzero authors. // //===----------------------------------------------------------------------===// // // The Subzero Code Generator // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // /// \file /// \brief Implements the AssemblerX86Base template class, which is the base /// Assembler class for X86 assemblers. // //===----------------------------------------------------------------------===// #include "IceAssemblerX86Base.h" #include "IceCfg.h" #include "IceCfgNode.h" #include "IceOperand.h" namespace Ice { namespace X86NAMESPACE { template AssemblerX86Base::~AssemblerX86Base() { if (BuildDefs::asserts()) { for (const Label *Label : CfgNodeLabels) { Label->finalCheck(); } for (const Label *Label : LocalLabels) { Label->finalCheck(); } } } template void AssemblerX86Base::alignFunction() { const SizeT Align = 1 << getBundleAlignLog2Bytes(); SizeT BytesNeeded = Utils::OffsetToAlignment(Buffer.getPosition(), Align); constexpr SizeT HltSize = 1; while (BytesNeeded > 0) { hlt(); BytesNeeded -= HltSize; } } template typename AssemblerX86Base::Label * AssemblerX86Base::getOrCreateLabel(SizeT Number, LabelVector &Labels) { Label *L = nullptr; if (Number == Labels.size()) { L = new (this->allocate