2017-08-02 05:20:10 +08:00
|
|
|
//===- HexagonAsmPrinter.h - Print machine code to an Hexagon .s file -----===//
|
2012-04-13 01:55:53 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// 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
|
2012-04-13 01:55:53 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Hexagon Assembly printer class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
|
|
|
|
#define LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
|
2012-04-13 01:55:53 +08:00
|
|
|
|
|
|
|
#include "Hexagon.h"
|
2017-08-02 05:20:10 +08:00
|
|
|
#include "HexagonSubtarget.h"
|
2012-04-13 01:55:53 +08:00
|
|
|
#include "llvm/CodeGen/AsmPrinter.h"
|
2017-08-02 05:20:10 +08:00
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
2018-04-02 23:06:55 +08:00
|
|
|
#include "llvm/MC/MCStreamer.h"
|
|
|
|
#include <utility>
|
2012-04-13 01:55:53 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
2017-08-02 05:20:10 +08:00
|
|
|
|
|
|
|
class MachineInstr;
|
|
|
|
class MCInst;
|
|
|
|
class raw_ostream;
|
|
|
|
class TargetMachine;
|
|
|
|
|
2012-04-13 01:55:53 +08:00
|
|
|
class HexagonAsmPrinter : public AsmPrinter {
|
2017-08-02 05:20:10 +08:00
|
|
|
const HexagonSubtarget *Subtarget = nullptr;
|
2012-04-13 01:55:53 +08:00
|
|
|
|
|
|
|
public:
|
2015-01-19 04:29:04 +08:00
|
|
|
explicit HexagonAsmPrinter(TargetMachine &TM,
|
2018-04-02 23:06:55 +08:00
|
|
|
std::unique_ptr<MCStreamer> Streamer)
|
|
|
|
: AsmPrinter(TM, std::move(Streamer)) {}
|
2012-04-13 01:55:53 +08:00
|
|
|
|
2015-02-03 14:40:22 +08:00
|
|
|
bool runOnMachineFunction(MachineFunction &Fn) override {
|
|
|
|
Subtarget = &Fn.getSubtarget<HexagonSubtarget>();
|
|
|
|
return AsmPrinter::runOnMachineFunction(Fn);
|
|
|
|
}
|
|
|
|
|
2016-10-01 10:56:57 +08:00
|
|
|
StringRef getPassName() const override {
|
2012-04-13 01:55:53 +08:00
|
|
|
return "Hexagon Assembly Printer";
|
|
|
|
}
|
|
|
|
|
2018-04-02 23:06:55 +08:00
|
|
|
bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB)
|
|
|
|
const override;
|
2012-04-13 01:55:53 +08:00
|
|
|
|
2014-04-29 15:58:16 +08:00
|
|
|
void EmitInstruction(const MachineInstr *MI) override;
|
2018-04-02 23:06:55 +08:00
|
|
|
void HexagonProcessInstruction(MCInst &Inst, const MachineInstr &MBB);
|
2015-12-16 01:05:45 +08:00
|
|
|
|
2012-04-13 01:55:53 +08:00
|
|
|
void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O);
|
|
|
|
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
[AsmPrinter] refactor to remove remove AsmVariant. NFC
Summary:
The InlineAsm::AsmDialect is only required for X86; no architecture
makes use of it and as such it gets passed around between arch-specific
and general code while being unused for all architectures but X86.
Since the AsmDialect is queried from a MachineInstr, which we also pass
around, remove the additional AsmDialect parameter and query for it deep
in the X86AsmPrinter only when needed/as late as possible.
This refactor should help later planned refactors to AsmPrinter, as this
difference in the X86AsmPrinter makes it harder to make AsmPrinter more
generic.
Reviewers: craig.topper
Subscribers: jholewinski, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, javed.absar, sbc100, jgravelle-google, eraman, hiraditya, aheejin, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, llvm-commits, peter.smith, srhines
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60488
llvm-svn: 358101
2019-04-11 00:38:43 +08:00
|
|
|
const char *ExtraCode, raw_ostream &OS) override;
|
2012-04-13 01:55:53 +08:00
|
|
|
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
[AsmPrinter] refactor to remove remove AsmVariant. NFC
Summary:
The InlineAsm::AsmDialect is only required for X86; no architecture
makes use of it and as such it gets passed around between arch-specific
and general code while being unused for all architectures but X86.
Since the AsmDialect is queried from a MachineInstr, which we also pass
around, remove the additional AsmDialect parameter and query for it deep
in the X86AsmPrinter only when needed/as late as possible.
This refactor should help later planned refactors to AsmPrinter, as this
difference in the X86AsmPrinter makes it harder to make AsmPrinter more
generic.
Reviewers: craig.topper
Subscribers: jholewinski, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, javed.absar, sbc100, jgravelle-google, eraman, hiraditya, aheejin, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, llvm-commits, peter.smith, srhines
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60488
llvm-svn: 358101
2019-04-11 00:38:43 +08:00
|
|
|
const char *ExtraCode, raw_ostream &OS) override;
|
2012-04-13 01:55:53 +08:00
|
|
|
};
|
|
|
|
|
2017-08-02 05:20:10 +08:00
|
|
|
} // end namespace llvm
|
2012-04-13 01:55:53 +08:00
|
|
|
|
2017-08-02 05:20:10 +08:00
|
|
|
#endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONASMPRINTER_H
|