forked from Hoernchen/Epiphany
-
Notifications
You must be signed in to change notification settings - Fork 2
/
EpiphanyAsmPrinter.h
84 lines (69 loc) · 2.84 KB
/
EpiphanyAsmPrinter.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//===-- EpiphanyAsmPrinter.h - Print machine code to an Epiphany .s file --===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains a printer that converts from our internal representation
// of machine-dependent LLVM code to GAS-format Epiphany assembly language.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_EPIPHANY_EPIPHANYASMPRINTER_H
#define LLVM_LIB_TARGET_EPIPHANY_EPIPHANYASMPRINTER_H
#include "EpiphanyConfig.h"
#include "EpiphanyMachineFunction.h"
#include "EpiphanyMCInstLower.h"
#include "EpiphanySubtarget.h"
#include "EpiphanyTargetMachine.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Target/TargetMachine.h"
namespace llvm {
class MCStreamer;
class MachineInstr;
class MachineBasicBlock;
class Module;
class raw_ostream;
class LLVM_LIBRARY_VISIBILITY EpiphanyAsmPrinter : public AsmPrinter {
void EmitInstrWithMacroNoAT(const MachineInstr *MI);
private:
bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp);
public:
const EpiphanySubtarget *Subtarget;
const EpiphanyMachineFunctionInfo *EpiphanyFI;
EpiphanyMCInstLower MCInstLowering;
explicit EpiphanyAsmPrinter(TargetMachine &TM,
std::unique_ptr<MCStreamer> Streamer)
: AsmPrinter(TM, std::move(Streamer)),
MCInstLowering(*this) {
Subtarget = static_cast<EpiphanyTargetMachine &>(TM).getSubtargetImpl();
}
virtual StringRef getPassName() const override {
return "Epiphany Assembly Printer";
}
virtual bool runOnMachineFunction(MachineFunction &MF) override;
//- EmitInstruction() must exists or will have run time error.
void EmitInstruction(const MachineInstr *MI) override;
void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
void printSavedRegsBitmask(raw_ostream &O);
void printHex32(unsigned int Value, raw_ostream &O);
void emitFrameDirective();
const char *getCurrentABIString() const;
void EmitFunctionEntryLabel() override;
void EmitFunctionBodyStart() override;
void EmitFunctionBodyEnd() override;
void EmitStartOfAsmFile(Module &M) override;
void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
unsigned AsmVariant, const char *ExtraCode,
raw_ostream &O) override;
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
unsigned AsmVariant, const char *ExtraCode,
raw_ostream &O) override;
};
} // End of namespace llvm
#endif