blob: db1d707089409878bc43892789ec6b3f61d83ca3 [file] [log] [blame]
Sid Manning7da3f9a2014-10-03 13:18:11 +00001//===-- HexagonMCCodeEmitter.h - Hexagon Target Descriptions ----*- C++ -*-===//
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/// \file
11/// \brief Definition for classes that emit Hexagon machine code from MCInsts
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef HEXAGONMCCODEEMITTER_H
16#define HEXAGONMCCODEEMITTER_H
17
18#include "llvm/MC/MCCodeEmitter.h"
19#include "llvm/MC/MCExpr.h"
20#include "llvm/MC/MCInst.h"
21#include "llvm/MC/MCInstrInfo.h"
22#include "llvm/MC/MCRegisterInfo.h"
23#include "llvm/MC/MCSubtargetInfo.h"
24#include "llvm/Support/raw_ostream.h"
25
26namespace llvm {
27
28class HexagonMCCodeEmitter : public MCCodeEmitter {
29 MCSubtargetInfo const &MST;
30 MCContext &MCT;
Colin LeMahieuaf304e52015-02-19 19:00:00 +000031 MCInstrInfo const &MCII;
Sid Manning7da3f9a2014-10-03 13:18:11 +000032
33public:
34 HexagonMCCodeEmitter(MCInstrInfo const &aMII, MCSubtargetInfo const &aMST,
35 MCContext &aMCT);
36
37 MCSubtargetInfo const &getSubtargetInfo() const;
38
39 void EncodeInstruction(MCInst const &MI, raw_ostream &OS,
40 SmallVectorImpl<MCFixup> &Fixups,
41 MCSubtargetInfo const &STI) const override;
42
Colin LeMahieu70553652014-10-21 16:03:10 +000043 // \brief TableGen'erated function for getting the
Sid Manning7da3f9a2014-10-03 13:18:11 +000044 // binary encoding for an instruction.
45 uint64_t getBinaryCodeForInstr(MCInst const &MI,
46 SmallVectorImpl<MCFixup> &Fixups,
47 MCSubtargetInfo const &STI) const;
48
49 /// \brief Return binary encoding of operand.
50 unsigned getMachineOpValue(MCInst const &MI, MCOperand const &MO,
51 SmallVectorImpl<MCFixup> &Fixups,
52 MCSubtargetInfo const &STI) const;
53
54private:
Aaron Ballmanf9a18972015-02-15 22:54:22 +000055 HexagonMCCodeEmitter(HexagonMCCodeEmitter const &) = delete;
56 void operator=(HexagonMCCodeEmitter const &) = delete;
Sid Manning7da3f9a2014-10-03 13:18:11 +000057}; // class HexagonMCCodeEmitter
58
59} // namespace llvm
60
61#endif /* HEXAGONMCCODEEMITTER_H */