You've already forked linux-packaging-mono
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
compiler-rt
libcxx
libcxxabi
libunwind
lld
lldb
llvm
bindings
cmake
docs
examples
include
lib
Analysis
AsmParser
BinaryFormat
Bitcode
CodeGen
DebugInfo
Demangle
ExecutionEngine
FuzzMutate
Fuzzer
IR
IRReader
LTO
LineEditor
Linker
MC
Object
ObjectYAML
Option
Passes
ProfileData
Support
TableGen
Target
AArch64
AMDGPU
ARC
ARM
AVR
BPF
Hexagon
Lanai
MSP430
Mips
NVPTX
Nios2
PowerPC
RISCV
Sparc
SystemZ
AsmParser
Disassembler
InstPrinter
CMakeLists.txt
LLVMBuild.txt
SystemZInstPrinter.cpp
SystemZInstPrinter.h
MCTargetDesc
TargetInfo
CMakeLists.txt
LLVMBuild.txt
README.txt
SystemZ.h
SystemZ.td
SystemZAsmPrinter.cpp
SystemZAsmPrinter.h
SystemZCallingConv.cpp
SystemZCallingConv.h
SystemZCallingConv.td
SystemZConstantPoolValue.cpp
SystemZConstantPoolValue.h
SystemZElimCompare.cpp
SystemZExpandPseudo.cpp
SystemZFeatures.td
SystemZFrameLowering.cpp
SystemZFrameLowering.h
SystemZHazardRecognizer.cpp
SystemZHazardRecognizer.h
SystemZISelDAGToDAG.cpp
SystemZISelLowering.cpp.REMOVED.git-id
SystemZISelLowering.h
SystemZInstrBuilder.h
SystemZInstrDFP.td
SystemZInstrFP.td
SystemZInstrFormats.td.REMOVED.git-id
SystemZInstrHFP.td
SystemZInstrInfo.cpp
SystemZInstrInfo.h
SystemZInstrInfo.td
SystemZInstrSystem.td
SystemZInstrVector.td
SystemZLDCleanup.cpp
SystemZLongBranch.cpp
SystemZMCInstLower.cpp
SystemZMCInstLower.h
SystemZMachineFunctionInfo.cpp
SystemZMachineFunctionInfo.h
SystemZMachineScheduler.cpp
SystemZMachineScheduler.h
SystemZOperands.td
SystemZOperators.td
SystemZPatterns.td
SystemZProcessors.td
SystemZRegisterInfo.cpp
SystemZRegisterInfo.h
SystemZRegisterInfo.td
SystemZSchedule.td
SystemZScheduleZ13.td
SystemZScheduleZ14.td
SystemZScheduleZ196.td
SystemZScheduleZEC12.td
SystemZSelectionDAGInfo.cpp
SystemZSelectionDAGInfo.h
SystemZShortenInst.cpp
SystemZSubtarget.cpp
SystemZSubtarget.h
SystemZTDC.cpp
SystemZTargetMachine.cpp
SystemZTargetMachine.h
SystemZTargetTransformInfo.cpp
SystemZTargetTransformInfo.h
WebAssembly
X86
XCore
CMakeLists.txt
LLVMBuild.txt
README.txt
Target.cpp
TargetIntrinsicInfo.cpp
TargetLoweringObjectFile.cpp
TargetMachine.cpp
TargetMachineC.cpp
Testing
ToolDrivers
Transforms
WindowsManifest
XRay
CMakeLists.txt
LLVMBuild.txt
projects
resources
runtimes
scripts
test
tools
unittests
utils
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in
openmp
polly
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mk
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
235 lines
7.6 KiB
C++
235 lines
7.6 KiB
C++
//===- SystemZInstPrinter.cpp - Convert SystemZ MCInst to assembly syntax -===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "SystemZInstPrinter.h"
|
|
#include "llvm/MC/MCExpr.h"
|
|
#include "llvm/MC/MCInst.h"
|
|
#include "llvm/MC/MCSymbol.h"
|
|
#include "llvm/Support/Casting.h"
|
|
#include "llvm/Support/ErrorHandling.h"
|
|
#include "llvm/Support/MathExtras.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
#include <cassert>
|
|
#include <cstdint>
|
|
|
|
using namespace llvm;
|
|
|
|
#define DEBUG_TYPE "asm-printer"
|
|
|
|
#include "SystemZGenAsmWriter.inc"
|
|
|
|
void SystemZInstPrinter::printAddress(unsigned Base, int64_t Disp,
|
|
unsigned Index, raw_ostream &O) {
|
|
O << Disp;
|
|
if (Base || Index) {
|
|
O << '(';
|
|
if (Index) {
|
|
O << '%' << getRegisterName(Index);
|
|
if (Base)
|
|
O << ',';
|
|
}
|
|
if (Base)
|
|
O << '%' << getRegisterName(Base);
|
|
O << ')';
|
|
}
|
|
}
|
|
|
|
void SystemZInstPrinter::printOperand(const MCOperand &MO, const MCAsmInfo *MAI,
|
|
raw_ostream &O) {
|
|
if (MO.isReg())
|
|
O << '%' << getRegisterName(MO.getReg());
|
|
else if (MO.isImm())
|
|
O << MO.getImm();
|
|
else if (MO.isExpr())
|
|
MO.getExpr()->print(O, MAI);
|
|
else
|
|
llvm_unreachable("Invalid operand");
|
|
}
|
|
|
|
void SystemZInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
|
StringRef Annot,
|
|
const MCSubtargetInfo &STI) {
|
|
printInstruction(MI, O);
|
|
printAnnotation(O, Annot);
|
|
}
|
|
|
|
void SystemZInstPrinter::printRegName(raw_ostream &O, unsigned RegNo) const {
|
|
O << '%' << getRegisterName(RegNo);
|
|
}
|
|
|
|
template <unsigned N>
|
|
static void printUImmOperand(const MCInst *MI, int OpNum, raw_ostream &O) {
|
|
int64_t Value = MI->getOperand(OpNum).getImm();
|
|
assert(isUInt<N>(Value) && "Invalid uimm argument");
|
|
O << Value;
|
|
}
|
|
|
|
template <unsigned N>
|
|
static void printSImmOperand(const MCInst *MI, int OpNum, raw_ostream &O) {
|
|
int64_t Value = MI->getOperand(OpNum).getImm();
|
|
assert(isInt<N>(Value) && "Invalid simm argument");
|
|
O << Value;
|
|
}
|
|
|
|
void SystemZInstPrinter::printU1ImmOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
printUImmOperand<1>(MI, OpNum, O);
|
|
}
|
|
|
|
void SystemZInstPrinter::printU2ImmOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
printUImmOperand<2>(MI, OpNum, O);
|
|
}
|
|
|
|
void SystemZInstPrinter::printU3ImmOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
printUImmOperand<3>(MI, OpNum, O);
|
|
}
|
|
|
|
void SystemZInstPrinter::printU4ImmOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
printUImmOperand<4>(MI, OpNum, O);
|
|
}
|
|
|
|
void SystemZInstPrinter::printU6ImmOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
printUImmOperand<6>(MI, OpNum, O);
|
|
}
|
|
|
|
void SystemZInstPrinter::printS8ImmOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
printSImmOperand<8>(MI, OpNum, O);
|
|
}
|
|
|
|
void SystemZInstPrinter::printU8ImmOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
printUImmOperand<8>(MI, OpNum, O);
|
|
}
|
|
|
|
void SystemZInstPrinter::printU12ImmOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
printUImmOperand<12>(MI, OpNum, O);
|
|
}
|
|
|
|
void SystemZInstPrinter::printS16ImmOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
printSImmOperand<16>(MI, OpNum, O);
|
|
}
|
|
|
|
void SystemZInstPrinter::printU16ImmOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
printUImmOperand<16>(MI, OpNum, O);
|
|
}
|
|
|
|
void SystemZInstPrinter::printS32ImmOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
printSImmOperand<32>(MI, OpNum, O);
|
|
}
|
|
|
|
void SystemZInstPrinter::printU32ImmOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
printUImmOperand<32>(MI, OpNum, O);
|
|
}
|
|
|
|
void SystemZInstPrinter::printU48ImmOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
printUImmOperand<48>(MI, OpNum, O);
|
|
}
|
|
|
|
void SystemZInstPrinter::printPCRelOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
const MCOperand &MO = MI->getOperand(OpNum);
|
|
if (MO.isImm()) {
|
|
O << "0x";
|
|
O.write_hex(MO.getImm());
|
|
} else
|
|
MO.getExpr()->print(O, &MAI);
|
|
}
|
|
|
|
void SystemZInstPrinter::printPCRelTLSOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
// Output the PC-relative operand.
|
|
printPCRelOperand(MI, OpNum, O);
|
|
|
|
// Output the TLS marker if present.
|
|
if ((unsigned)OpNum + 1 < MI->getNumOperands()) {
|
|
const MCOperand &MO = MI->getOperand(OpNum + 1);
|
|
const MCSymbolRefExpr &refExp = cast<MCSymbolRefExpr>(*MO.getExpr());
|
|
switch (refExp.getKind()) {
|
|
case MCSymbolRefExpr::VK_TLSGD:
|
|
O << ":tls_gdcall:";
|
|
break;
|
|
case MCSymbolRefExpr::VK_TLSLDM:
|
|
O << ":tls_ldcall:";
|
|
break;
|
|
default:
|
|
llvm_unreachable("Unexpected symbol kind");
|
|
}
|
|
O << refExp.getSymbol().getName();
|
|
}
|
|
}
|
|
|
|
void SystemZInstPrinter::printOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
printOperand(MI->getOperand(OpNum), &MAI, O);
|
|
}
|
|
|
|
void SystemZInstPrinter::printBDAddrOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
printAddress(MI->getOperand(OpNum).getReg(),
|
|
MI->getOperand(OpNum + 1).getImm(), 0, O);
|
|
}
|
|
|
|
void SystemZInstPrinter::printBDXAddrOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
printAddress(MI->getOperand(OpNum).getReg(),
|
|
MI->getOperand(OpNum + 1).getImm(),
|
|
MI->getOperand(OpNum + 2).getReg(), O);
|
|
}
|
|
|
|
void SystemZInstPrinter::printBDLAddrOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
unsigned Base = MI->getOperand(OpNum).getReg();
|
|
uint64_t Disp = MI->getOperand(OpNum + 1).getImm();
|
|
uint64_t Length = MI->getOperand(OpNum + 2).getImm();
|
|
O << Disp << '(' << Length;
|
|
if (Base)
|
|
O << ",%" << getRegisterName(Base);
|
|
O << ')';
|
|
}
|
|
|
|
void SystemZInstPrinter::printBDRAddrOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
unsigned Base = MI->getOperand(OpNum).getReg();
|
|
uint64_t Disp = MI->getOperand(OpNum + 1).getImm();
|
|
unsigned Length = MI->getOperand(OpNum + 2).getReg();
|
|
O << Disp << "(%" << getRegisterName(Length);
|
|
if (Base)
|
|
O << ",%" << getRegisterName(Base);
|
|
O << ')';
|
|
}
|
|
|
|
void SystemZInstPrinter::printBDVAddrOperand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
printAddress(MI->getOperand(OpNum).getReg(),
|
|
MI->getOperand(OpNum + 1).getImm(),
|
|
MI->getOperand(OpNum + 2).getReg(), O);
|
|
}
|
|
|
|
void SystemZInstPrinter::printCond4Operand(const MCInst *MI, int OpNum,
|
|
raw_ostream &O) {
|
|
static const char *const CondNames[] = {
|
|
"o", "h", "nle", "l", "nhe", "lh", "ne",
|
|
"e", "nlh", "he", "nl", "le", "nh", "no"
|
|
};
|
|
uint64_t Imm = MI->getOperand(OpNum).getImm();
|
|
assert(Imm > 0 && Imm < 15 && "Invalid condition");
|
|
O << CondNames[Imm - 1];
|
|
}
|