aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCCodeEmitter.cpp
blob: 76a8406cee7bd570c3a6c040e8094fe109de1f3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//===- MCCodeEmitter.cpp - Instruction Encoding ---------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/MC/MCInst.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <string>

using namespace llvm;

MCCodeEmitter::MCCodeEmitter() = default;

MCCodeEmitter::~MCCodeEmitter() = default;

void MCCodeEmitter::reportUnsupportedInst(const MCInst &Inst) {
  std::string Msg;
  raw_string_ostream OS(Msg);
  OS << "Unsupported instruction : " << Inst;
  reportFatalInternalError(Msg.c_str());
}

void MCCodeEmitter::reportUnsupportedOperand(const MCInst &Inst,
                                             unsigned OpNum) {
  std::string Msg;
  raw_string_ostream OS(Msg);
  OS << "Unsupported instruction operand : \"" << Inst << "\"[" << OpNum << "]";
  reportFatalInternalError(Msg.c_str());
}