LCOV - code coverage report
Current view: top level - lib/Target/AArch64/MCTargetDesc - AArch64TargetStreamer.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 11 14 78.6 %
Date: 2018-10-20 13:21:21 Functions: 4 5 80.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- AArch64TargetStreamer.cpp - AArch64TargetStreamer class ------------===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : //
      10             : // This file implements the AArch64TargetStreamer class.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #include "AArch64TargetStreamer.h"
      15             : #include "llvm/MC/ConstantPools.h"
      16             : 
      17             : using namespace llvm;
      18             : 
      19             : //
      20             : // AArch64TargetStreamer Implemenation
      21             : //
      22        3399 : AArch64TargetStreamer::AArch64TargetStreamer(MCStreamer &S)
      23        3399 :     : MCTargetStreamer(S), ConstantPools(new AssemblerConstantPools()) {}
      24             : 
      25             : AArch64TargetStreamer::~AArch64TargetStreamer() = default;
      26             : 
      27             : // The constant pool handling is shared by all AArch64TargetStreamer
      28             : // implementations.
      29          32 : const MCExpr *AArch64TargetStreamer::addConstantPoolEntry(const MCExpr *Expr,
      30             :                                                           unsigned Size,
      31             :                                                           SMLoc Loc) {
      32          32 :   return ConstantPools->addEntry(Streamer, Expr, Size, Loc);
      33             : }
      34             : 
      35           0 : void AArch64TargetStreamer::emitCurrentConstantPool() {
      36           0 :   ConstantPools->emitForCurrentSection(Streamer);
      37           0 : }
      38             : 
      39             : // finish() - write out any non-empty assembler constant pools.
      40        4996 : void AArch64TargetStreamer::finish() { ConstantPools->emitAll(Streamer); }
      41             : 
      42           2 : void AArch64TargetStreamer::emitInst(uint32_t Inst) {
      43             :   char Buffer[4];
      44             : 
      45             :   // We can't just use EmitIntValue here, as that will swap the
      46             :   // endianness on big-endian systems (instructions are always
      47             :   // little-endian).
      48          10 :   for (unsigned I = 0; I < 4; ++I) {
      49           8 :     Buffer[I] = uint8_t(Inst);
      50           8 :     Inst >>= 8;
      51             :   }
      52             : 
      53           4 :   getStreamer().EmitBytes(StringRef(Buffer, 4));
      54           2 : }

Generated by: LCOV version 1.13