2014-05-24 20:50:23 +08:00
|
|
|
//===-- AArch64InstPrinter.h - Convert AArch64 MCInst to assembly syntax --===//
|
2014-03-29 18:18:08 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2014-05-24 20:50:23 +08:00
|
|
|
// This class prints an AArch64 MCInst to a .s file.
|
2014-03-29 18:18:08 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_AARCH64_INSTPRINTER_AARCH64INSTPRINTER_H
|
|
|
|
#define LLVM_LIB_TARGET_AARCH64_INSTPRINTER_AARCH64INSTPRINTER_H
|
2014-03-29 18:18:08 +08:00
|
|
|
|
2014-05-24 20:50:23 +08:00
|
|
|
#include "MCTargetDesc/AArch64MCTargetDesc.h"
|
2014-03-29 18:18:08 +08:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
|
|
#include "llvm/MC/MCInstPrinter.h"
|
|
|
|
#include "llvm/MC/MCSubtargetInfo.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class MCOperand;
|
|
|
|
|
2014-05-24 20:50:23 +08:00
|
|
|
class AArch64InstPrinter : public MCInstPrinter {
|
2014-03-29 18:18:08 +08:00
|
|
|
public:
|
2014-05-24 20:50:23 +08:00
|
|
|
AArch64InstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
|
2015-03-31 05:52:26 +08:00
|
|
|
const MCRegisterInfo &MRI);
|
2014-03-29 18:18:08 +08:00
|
|
|
|
2015-03-28 04:36:02 +08:00
|
|
|
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
|
|
|
|
const MCSubtargetInfo &STI) override;
|
2014-04-29 15:58:25 +08:00
|
|
|
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
2014-03-29 18:18:08 +08:00
|
|
|
|
|
|
|
// Autogenerated by tblgen.
|
2015-03-28 04:36:02 +08:00
|
|
|
virtual void printInstruction(const MCInst *MI, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
virtual bool printAliasInstr(const MCInst *MI, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2014-05-13 02:04:06 +08:00
|
|
|
virtual void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
2015-03-28 04:36:02 +08:00
|
|
|
unsigned PrintMethodIdx,
|
|
|
|
const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2014-03-29 18:18:08 +08:00
|
|
|
virtual StringRef getRegName(unsigned RegNo) const {
|
|
|
|
return getRegisterName(RegNo);
|
|
|
|
}
|
|
|
|
static const char *getRegisterName(unsigned RegNo,
|
2014-05-24 20:50:23 +08:00
|
|
|
unsigned AltIdx = AArch64::NoRegAltName);
|
2014-03-29 18:18:08 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool printSysAlias(const MCInst *MI, raw_ostream &O);
|
|
|
|
// Operand printers
|
2015-03-28 04:36:02 +08:00
|
|
|
void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
|
|
|
void printHexImm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2014-03-29 18:18:08 +08:00
|
|
|
void printPostIncOperand(const MCInst *MI, unsigned OpNo, unsigned Imm,
|
|
|
|
raw_ostream &O);
|
2015-03-28 04:36:02 +08:00
|
|
|
template <int Amount>
|
|
|
|
void printPostIncOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O) {
|
2014-04-30 19:43:36 +08:00
|
|
|
printPostIncOperand(MI, OpNo, Amount, O);
|
|
|
|
}
|
|
|
|
|
2015-03-28 04:36:02 +08:00
|
|
|
void printVRegOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printSysCROperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printAddSubImm(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printLogicalImm32(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printLogicalImm64(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printShifter(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printShiftedRegister(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printExtendedRegister(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printArithExtend(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
2014-05-22 19:56:09 +08:00
|
|
|
|
|
|
|
void printMemExtend(const MCInst *MI, unsigned OpNum, raw_ostream &O,
|
|
|
|
char SrcRegKind, unsigned Width);
|
|
|
|
template <char SrcRegKind, unsigned Width>
|
2015-03-28 04:36:02 +08:00
|
|
|
void printMemExtend(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O) {
|
2014-05-22 19:56:09 +08:00
|
|
|
printMemExtend(MI, OpNum, O, SrcRegKind, Width);
|
|
|
|
}
|
|
|
|
|
2015-03-28 04:36:02 +08:00
|
|
|
void printCondCode(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printInverseCondCode(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printAlignedLabel(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
2014-05-22 19:56:09 +08:00
|
|
|
void printUImm12Offset(const MCInst *MI, unsigned OpNum, unsigned Scale,
|
|
|
|
raw_ostream &O);
|
2014-04-09 22:44:31 +08:00
|
|
|
void printAMIndexedWB(const MCInst *MI, unsigned OpNum, unsigned Scale,
|
|
|
|
raw_ostream &O);
|
2014-03-29 18:18:08 +08:00
|
|
|
|
2015-03-28 04:36:02 +08:00
|
|
|
template <int Scale>
|
|
|
|
void printUImm12Offset(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O) {
|
2014-05-22 19:56:09 +08:00
|
|
|
printUImm12Offset(MI, OpNum, Scale, O);
|
2014-04-09 22:44:31 +08:00
|
|
|
}
|
2014-03-29 18:18:08 +08:00
|
|
|
|
2015-03-28 04:36:02 +08:00
|
|
|
template <int BitWidth>
|
|
|
|
void printAMIndexedWB(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O) {
|
2014-04-30 19:43:36 +08:00
|
|
|
printAMIndexedWB(MI, OpNum, BitWidth / 8, O);
|
2014-04-09 22:44:31 +08:00
|
|
|
}
|
2014-03-29 18:18:08 +08:00
|
|
|
|
2015-03-28 04:36:02 +08:00
|
|
|
void printAMNoIndex(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
2014-04-30 19:43:36 +08:00
|
|
|
|
2015-03-28 04:36:02 +08:00
|
|
|
template <int Scale>
|
|
|
|
void printImmScale(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
2014-04-30 19:43:36 +08:00
|
|
|
|
2015-03-28 04:36:02 +08:00
|
|
|
void printPrefetchOp(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
2014-04-30 19:43:36 +08:00
|
|
|
|
2015-03-28 04:36:02 +08:00
|
|
|
void printFPImmOperand(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
2014-03-29 18:18:08 +08:00
|
|
|
|
2015-03-28 04:36:02 +08:00
|
|
|
void printVectorList(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O,
|
2014-03-29 18:18:08 +08:00
|
|
|
StringRef LayoutSuffix);
|
|
|
|
|
|
|
|
/// Print a list of vector registers where the type suffix is implicit
|
|
|
|
/// (i.e. attached to the instruction rather than the registers).
|
|
|
|
void printImplicitlyTypedVectorList(const MCInst *MI, unsigned OpNum,
|
2015-03-28 04:36:02 +08:00
|
|
|
const MCSubtargetInfo &STI,
|
2014-03-29 18:18:08 +08:00
|
|
|
raw_ostream &O);
|
|
|
|
|
|
|
|
template <unsigned NumLanes, char LaneKind>
|
2015-03-28 04:36:02 +08:00
|
|
|
void printTypedVectorList(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
|
|
|
|
void printVectorIndex(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printAdrpLabel(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printBarrierOption(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printMSRSystemRegister(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printMRSSystemRegister(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printSystemPStateField(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
|
|
|
void printSIMDType10Operand(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
2015-06-02 18:58:41 +08:00
|
|
|
template<unsigned size>
|
|
|
|
void printGPRSeqPairsClassOperand(const MCInst *MI, unsigned OpNum,
|
|
|
|
const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O);
|
2014-03-29 18:18:08 +08:00
|
|
|
};
|
|
|
|
|
2014-05-24 20:50:23 +08:00
|
|
|
class AArch64AppleInstPrinter : public AArch64InstPrinter {
|
2014-03-29 18:18:08 +08:00
|
|
|
public:
|
2014-05-24 20:50:23 +08:00
|
|
|
AArch64AppleInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
|
2015-03-31 05:52:26 +08:00
|
|
|
const MCRegisterInfo &MRI);
|
2014-03-29 18:18:08 +08:00
|
|
|
|
2015-03-28 04:36:02 +08:00
|
|
|
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
|
|
|
|
const MCSubtargetInfo &STI) override;
|
2014-03-29 18:18:08 +08:00
|
|
|
|
2015-03-28 04:36:02 +08:00
|
|
|
void printInstruction(const MCInst *MI, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O) override;
|
|
|
|
bool printAliasInstr(const MCInst *MI, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O) override;
|
2014-09-03 19:41:21 +08:00
|
|
|
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
|
|
|
unsigned PrintMethodIdx,
|
2015-03-28 04:36:02 +08:00
|
|
|
const MCSubtargetInfo &STI,
|
2014-09-03 19:41:21 +08:00
|
|
|
raw_ostream &O) override;
|
2014-04-29 15:58:25 +08:00
|
|
|
StringRef getRegName(unsigned RegNo) const override {
|
2014-03-29 18:18:08 +08:00
|
|
|
return getRegisterName(RegNo);
|
|
|
|
}
|
|
|
|
static const char *getRegisterName(unsigned RegNo,
|
2014-05-24 20:50:23 +08:00
|
|
|
unsigned AltIdx = AArch64::NoRegAltName);
|
2014-03-29 18:18:08 +08:00
|
|
|
};
|
2015-06-23 17:49:53 +08:00
|
|
|
}
|
2014-03-29 18:18:08 +08:00
|
|
|
|
|
|
|
#endif
|