forked from microsoft/llvm-mctoll
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MCInstOrData.h
42 lines (32 loc) · 1.09 KB
/
MCInstOrData.h
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
35
36
37
38
39
40
41
42
//===-- MCInstOrData.h ------------------------------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TOOLS_LLVM_MCTOLL_MCINSTORDATA_H
#define LLVM_TOOLS_LLVM_MCTOLL_MCINSTORDATA_H
#include "llvm/MC/MCInst.h"
using namespace llvm;
class MCInstOrData {
private:
enum class Tag { DATA, INSTRUCTION };
union {
uint32_t Data;
MCInst Inst;
};
Tag Type;
public:
~MCInstOrData();
MCInstOrData &operator=(const MCInstOrData &E);
MCInstOrData(const MCInstOrData &V);
MCInstOrData(const MCInst &V);
MCInstOrData(const uint32_t V);
uint32_t getData() const { return Data; }
MCInst getMCInst() const { return Inst; }
bool isData() const { return (Type == Tag::DATA); }
bool isMCInst() const { return (Type == Tag::INSTRUCTION); }
void dump() const;
};
#endif // LLVM_TOOLS_LLVM_MCTOLL_MCINSTRAISER_H