100 if (
MI->memoperands_empty())
105 EE =
MI->memoperands_end(); MMOI != EE; ++MMOI)
106 if ((*MMOI)->getAlign() < Alignment)
107 Alignment = (*MMOI)->getAlign();
109 unsigned AlignmentHint = 0;
110 if (Alignment >=
Align(16))
112 else if (Alignment >=
Align(8))
114 if (AlignmentHint == 0)
128 .
addReg(
MI->getOperand(3).getReg());
166void SystemZAsmPrinter::emitCallInformation(CallType CT) {
168 MCInstBuilder(SystemZ::BCRAsm)
173uint32_t SystemZAsmPrinter::AssociatedDataAreaTable::insert(
const MCSymbol *Sym,
175 auto Key = std::make_pair(Sym, SlotKind);
176 auto It = Displacements.find(
Key);
178 if (It != Displacements.end())
192 uint32_t Displacement = NextDisplacement;
193 Displacements[std::make_pair(Sym, SlotKind)] = NextDisplacement;
194 NextDisplacement +=
Length;
200SystemZAsmPrinter::AssociatedDataAreaTable::insert(
const MachineOperand MO) {
205 assert(Sym &&
"No symbol");
209 assert(Sym &&
"No symbol");
214 return insert(Sym, ADAslotType);
218 SystemZ_MC::verifyInstructionPredicates(
MI->getOpcode(),
223 switch (
MI->getOpcode()) {
224 case SystemZ::Return:
229 case SystemZ::Return_XPLINK:
236 case SystemZ::CondReturn:
243 case SystemZ::CondReturn_XPLINK:
252 case SystemZ::CRBReturn:
261 case SystemZ::CGRBReturn:
270 case SystemZ::CIBReturn:
279 case SystemZ::CGIBReturn:
288 case SystemZ::CLRBReturn:
297 case SystemZ::CLGRBReturn:
306 case SystemZ::CLIBReturn:
315 case SystemZ::CLGIBReturn:
324 case SystemZ::CallBRASL_XPLINK64:
326 .addReg(SystemZ::R7D)
327 .addExpr(
Lower.getExpr(
MI->getOperand(0),
329 emitCallInformation(CallType::BRASL7);
332 case SystemZ::CallBASR_XPLINK64:
334 .addReg(SystemZ::R7D)
335 .addReg(
MI->getOperand(0).getReg()));
336 emitCallInformation(CallType::BASR76);
339 case SystemZ::CallBASR_STACKEXT:
341 .addReg(SystemZ::R3D)
342 .addReg(
MI->getOperand(0).getReg()));
343 emitCallInformation(CallType::BASR33);
346 case SystemZ::ADA_ENTRY_VALUE:
347 case SystemZ::ADA_ENTRY: {
350 uint32_t Disp = ADATable.insert(
MI->getOperand(1));
351 Register TargetReg =
MI->getOperand(0).getReg();
354 Disp +=
MI->getOperand(3).getImm();
355 bool LoadAddr =
MI->getOpcode() == SystemZ::ADA_ENTRY;
357 unsigned Op0 = LoadAddr ? SystemZ::LA : SystemZ::LG;
358 unsigned Op =
TII->getOpcodeForOffset(Op0, Disp);
362 if (TargetReg != ADAReg) {
363 IndexReg = TargetReg;
367 MCInstBuilder(SystemZ::LLILF).addReg(TargetReg).addImm(Disp));
384 case SystemZ::CallBRASL:
390 case SystemZ::CallBASR:
393 .
addReg(
MI->getOperand(0).getReg());
396 case SystemZ::CallJG:
401 case SystemZ::CallBRCL:
408 case SystemZ::CallBR:
410 .
addReg(
MI->getOperand(0).getReg());
413 case SystemZ::CallBCR:
417 .
addReg(
MI->getOperand(2).getReg());
420 case SystemZ::CRBCall:
429 case SystemZ::CGRBCall:
438 case SystemZ::CIBCall:
447 case SystemZ::CGIBCall:
456 case SystemZ::CLRBCall:
465 case SystemZ::CLGRBCall:
474 case SystemZ::CLIBCall:
483 case SystemZ::CLGIBCall:
492 case SystemZ::TLS_GDCALL:
500 case SystemZ::TLS_LDCALL:
514 case SystemZ::IILF64:
517 .
addImm(
MI->getOperand(2).getImm());
520 case SystemZ::IIHF64:
523 .
addImm(
MI->getOperand(2).getImm());
526 case SystemZ::RISBHH:
527 case SystemZ::RISBHL:
531 case SystemZ::RISBLH:
532 case SystemZ::RISBLL:
536 case SystemZ::VLVGP32:
598 case SystemZ::LFER_16:
606 case SystemZ::LEFR_16:
610#define LOWER_LOW(NAME) \
611 case SystemZ::NAME##64: LoweredMI = lowerRILow(MI, SystemZ::NAME); break
627#define LOWER_HIGH(NAME) \
628 case SystemZ::NAME##64: LoweredMI = lowerRIHigh(MI, SystemZ::NAME); break
644 case SystemZ::Serialize:
657 case SystemZ::Trap: {
670 case SystemZ::CondTrap: {
683 case TargetOpcode::FENTRY_CALL:
687 case TargetOpcode::STACKMAP:
691 case TargetOpcode::PATCHPOINT:
695 case TargetOpcode::PATCHABLE_FUNCTION_ENTER:
696 LowerPATCHABLE_FUNCTION_ENTER(*
MI,
Lower);
699 case TargetOpcode::PATCHABLE_RET:
700 LowerPATCHABLE_RET(*
MI,
Lower);
703 case TargetOpcode::PATCHABLE_FUNCTION_EXIT:
706 case TargetOpcode::PATCHABLE_TAIL_CALL:
710 "around this assert.");
712 case SystemZ::EXRL_Pseudo: {
713 unsigned TargetInsOpc =
MI->getOperand(0).getImm();
714 Register LenMinus1Reg =
MI->getOperand(1).getReg();
715 Register DestReg =
MI->getOperand(2).getReg();
716 int64_t DestDisp =
MI->getOperand(3).getImm();
718 int64_t SrcDisp =
MI->getOperand(5).getImm();
735 MCInstBuilder(SystemZ::EXRL).addReg(LenMinus1Reg).addExpr(Dot));
741 case SystemZ::EH_SjLj_Setup:
759 else if (NumBytes < 4) {
761 MCInstBuilder(SystemZ::BCRAsm).addImm(0).addReg(SystemZ::R0D), STI);
764 else if (NumBytes < 6) {
766 MCInstBuilder(SystemZ::BCAsm).addImm(0).addReg(0).addImm(0).addReg(0),
775 MCInstBuilder(SystemZ::BRCLAsm).addImm(0).addExpr(Dot), STI);
780void SystemZAsmPrinter::LowerFENTRY_CALL(
const MachineInstr &
MI,
781 SystemZMCInstLower &
Lower) {
782 MCContext &Ctx =
MF->getContext();
783 if (
MF->getFunction().hasFnAttribute(
"mrecord-mcount")) {
793 if (
MF->getFunction().hasFnAttribute(
"mnop-mcount")) {
799 const MCSymbolRefExpr *
Op =
802 MCInstBuilder(SystemZ::BRASL).addReg(SystemZ::R0D).addExpr(
Op),
806void SystemZAsmPrinter::LowerSTACKMAP(
const MachineInstr &
MI) {
807 auto *
TII =
MF->getSubtarget<SystemZSubtarget>().getInstrInfo();
809 unsigned NumNOPBytes =
MI.getOperand(1).getImm();
815 SM.recordStackMap(*MILabel,
MI);
816 assert(NumNOPBytes % 2 == 0 &&
"Invalid number of NOP bytes requested!");
819 unsigned ShadowBytes = 0;
820 const MachineBasicBlock &
MBB = *
MI.getParent();
823 while (ShadowBytes < NumNOPBytes) {
825 MII->getOpcode() == TargetOpcode::PATCHPOINT ||
826 MII->getOpcode() == TargetOpcode::STACKMAP)
828 ShadowBytes +=
TII->getInstSizeInBytes(*MII);
835 while (ShadowBytes < NumNOPBytes)
842void SystemZAsmPrinter::LowerPATCHPOINT(
const MachineInstr &
MI,
843 SystemZMCInstLower &
Lower) {
848 SM.recordPatchPoint(*MILabel,
MI);
849 PatchPointOpers Opers(&
MI);
851 unsigned EncodedBytes = 0;
852 const MachineOperand &CalleeMO = Opers.getCallTarget();
854 if (CalleeMO.
isImm()) {
855 uint64_t CallTarget = CalleeMO.
getImm();
857 unsigned ScratchIdx = -1;
858 unsigned ScratchReg = 0;
860 ScratchIdx = Opers.getNextScratchIdx(ScratchIdx + 1);
861 ScratchReg =
MI.getOperand(ScratchIdx).getReg();
862 }
while (ScratchReg == SystemZ::R0D);
867 .addImm(CallTarget & 0xFFFFFFFF));
869 if (CallTarget >> 32) {
872 .addImm(CallTarget >> 32));
877 .addReg(SystemZ::R14D)
878 .addReg(ScratchReg));
884 .addReg(SystemZ::R14D)
890 unsigned NumBytes = Opers.getNumPatchBytes();
891 assert(NumBytes >= EncodedBytes &&
892 "Patchpoint can't request size less than the length of a call.");
893 assert((NumBytes - EncodedBytes) % 2 == 0 &&
894 "Invalid number of NOP bytes requested!");
895 while (EncodedBytes < NumBytes)
900void SystemZAsmPrinter::LowerPATCHABLE_FUNCTION_ENTER(
901 const MachineInstr &
MI, SystemZMCInstLower &
Lower) {
911 bool HasVectorFeature =
912 TM.getMCSubtargetInfo()->hasFeature(SystemZ::FeatureVector) &&
913 !
TM.getMCSubtargetInfo()->hasFeature(SystemZ::FeatureSoftFloat);
915 HasVectorFeature ?
"__xray_FunctionEntryVec" :
"__xray_FunctionEntry");
920 MCInstBuilder(SystemZ::J)
924 MCInstBuilder(SystemZ::LLILF).addReg(SystemZ::R2D).addImm(0));
926 .addReg(SystemZ::R14D)
933void SystemZAsmPrinter::LowerPATCHABLE_RET(
const MachineInstr &
MI,
934 SystemZMCInstLower &
Lower) {
935 unsigned OpCode =
MI.getOperand(0).getImm();
936 MCSymbol *FallthroughLabel =
nullptr;
937 if (OpCode == SystemZ::CondReturn) {
938 FallthroughLabel =
OutContext.createTempSymbol();
939 int64_t Cond0 =
MI.getOperand(1).getImm();
940 int64_t Cond1 =
MI.getOperand(2).getImm();
943 .addImm(Cond1 ^ Cond0)
956 bool HasVectorFeature =
957 TM.getMCSubtargetInfo()->hasFeature(SystemZ::FeatureVector) &&
958 !
TM.getMCSubtargetInfo()->hasFeature(SystemZ::FeatureSoftFloat);
960 HasVectorFeature ?
"__xray_FunctionExitVec" :
"__xray_FunctionExit");
964 MCInstBuilder(SystemZ::BR).addReg(SystemZ::R14D));
967 MCInstBuilder(SystemZ::LLILF).addReg(SystemZ::R2D).addImm(0));
971 if (FallthroughLabel)
979void SystemZAsmPrinter::emitAttributes(
Module &M) {
980 if (
M.getModuleFlag(
"s390x-visible-vector-ABI")) {
981 bool HasVectorFeature =
982 TM.getMCSubtargetInfo()->hasFeature(SystemZ::FeatureVector);
983 OutStreamer->emitGNUAttribute(8, HasVectorFeature ? 2 : 1);
1040 else if (MCOp.
isImm())
1049 const MCOperand &DispMO,
unsigned Index,
1052 if (
Base || Index) {
1066 const char *ExtraCode,
1072 if (ExtraCode[0] ==
'N' && !ExtraCode[1] && MO.
isReg() &&
1073 SystemZ::GR128BitRegClass.contains(MO.
getReg()))
1080 MCOp =
Lower.lowerOperand(MO);
1088 const char *ExtraCode,
1090 if (ExtraCode && ExtraCode[0] && !ExtraCode[1]) {
1091 switch (ExtraCode[0]) {
1098 OS <<
MI->getOperand(OpNo + 1).getImm();
1107 MI->getOperand(OpNo + 2).getReg(), OS);
1120void SystemZAsmPrinter::emitADASection() {
1126 unsigned EmittedBytes = 0;
1127 for (
auto &Entry : ADATable.getTable()) {
1130 std::tie(Sym, SlotKind) = Entry.first;
1131 unsigned Offset = Entry.second;
1132 assert(
Offset == EmittedBytes &&
"Offset not as expected");
1134#define EMIT_COMMENT(Str) \
1135 OutStreamer->AddComment(Twine("Offset ") \
1136 .concat(utostr(Offset)) \
1137 .concat(" " Str " ") \
1138 .concat(Sym->getName()));
1152 EmittedBytes += PointerSize * 2;
1160 EmittedBytes += PointerSize;
1174 EmittedBytes += PointerSize;
1186 std::string ProductID;
1187 if (
auto *MD = M.getModuleFlag(
"zos_product_id"))
1189 if (ProductID.empty())
1196 M.getModuleFlag(
"zos_product_major_version")))
1197 return VersionVal->getZExtValue();
1198 return LLVM_VERSION_MAJOR;
1203 M.getModuleFlag(
"zos_product_minor_version")))
1204 return ReleaseVal->getZExtValue();
1205 return LLVM_VERSION_MINOR;
1210 M.getModuleFlag(
"zos_product_patchlevel")))
1211 return PatchVal->getZExtValue();
1212 return LLVM_VERSION_PATCH;
1216 std::time_t Time = 0;
1218 M.getModuleFlag(
"zos_translation_time"))) {
1219 long SecondsSinceEpoch = Val->getSExtValue();
1220 Time =
static_cast<time_t
>(SecondsSinceEpoch);
1225void SystemZAsmPrinter::emitIDRLSection(
Module &M) {
1228 constexpr unsigned IDRLDataLength = 30;
1236 SmallString<IDRLDataLength + 1> TempStr;
1237 raw_svector_ostream
O(TempStr);
1238 O <<
formatv(
"{0,-10}{1,0-2:d}{2,0-2:d}{3:%Y%m%d%H%M%S}{4,0-2}",
1239 ProductID.substr(0, 10).c_str(), ProductVersion, ProductRelease,
1241 SmallString<IDRLDataLength>
Data;
1252 if (
TM.getTargetTriple().isOSzOS()) {
1264 CurrentFnPPA1Sym =
nullptr;
1265 CurrentFnEPMarkerSym =
nullptr;
1271 bool EHBlock,
bool HasArgAreaLength,
bool HasName) {
1272 enum class PPA1Flag1 :
uint8_t {
1273 DSA64Bit = (0x80 >> 0),
1274 VarArg = (0x80 >> 7),
1277 enum class PPA1Flag2 :
uint8_t {
1278 ExternalProcedure = (0x80 >> 0),
1279 STACKPROTECTOR = (0x80 >> 3),
1282 enum class PPA1Flag3 :
uint8_t {
1283 HasArgAreaLength = (0x80 >> 1),
1284 FPRMask = (0x80 >> 2),
1287 enum class PPA1Flag4 :
uint8_t {
1288 EPMOffsetPresent = (0x80 >> 0),
1289 VRMask = (0x80 >> 2),
1290 EHBlock = (0x80 >> 3),
1291 ProcedureNamePresent = (0x80 >> 7),
1296 auto Flags1 = PPA1Flag1(0);
1297 auto Flags2 = PPA1Flag2::ExternalProcedure;
1298 auto Flags3 = PPA1Flag3(0);
1299 auto Flags4 = PPA1Flag4::EPMOffsetPresent;
1301 Flags1 |= PPA1Flag1::DSA64Bit;
1304 Flags1 |= PPA1Flag1::VarArg;
1307 Flags2 |= PPA1Flag2::STACKPROTECTOR;
1309 if (HasArgAreaLength)
1310 Flags3 |= PPA1Flag3::HasArgAreaLength;
1314 Flags3 |= PPA1Flag3::FPRMask;
1317 Flags4 |= PPA1Flag4::VRMask;
1320 Flags4 |= PPA1Flag4::EHBlock;
1323 Flags4 |= PPA1Flag4::ProcedureNamePresent;
1326 if ((Flags1 & PPA1Flag1::DSA64Bit) == PPA1Flag1::DSA64Bit)
1327 OutStreamer->AddComment(
" Bit 0: 1 = 64-bit DSA");
1329 OutStreamer->AddComment(
" Bit 0: 0 = 32-bit DSA");
1330 if ((Flags1 & PPA1Flag1::VarArg) == PPA1Flag1::VarArg)
1331 OutStreamer->AddComment(
" Bit 7: 1 = Vararg function");
1335 if ((Flags2 & PPA1Flag2::ExternalProcedure) == PPA1Flag2::ExternalProcedure)
1336 OutStreamer->AddComment(
" Bit 0: 1 = External procedure");
1337 if ((Flags2 & PPA1Flag2::STACKPROTECTOR) == PPA1Flag2::STACKPROTECTOR)
1338 OutStreamer->AddComment(
" Bit 3: 1 = STACKPROTECT is enabled");
1340 OutStreamer->AddComment(
" Bit 3: 0 = STACKPROTECT is not enabled");
1344 if ((Flags3 & PPA1Flag3::HasArgAreaLength) == PPA1Flag3::HasArgAreaLength)
1346 " Bit 1: 1 = Argument Area Length is in optional area");
1347 if ((Flags3 & PPA1Flag3::FPRMask) == PPA1Flag3::FPRMask)
1348 OutStreamer->AddComment(
" Bit 2: 1 = FP Reg Mask is in optional area");
1350 static_cast<uint8_t>(Flags3));
1353 if ((Flags4 & PPA1Flag4::VRMask) == PPA1Flag4::VRMask)
1354 OutStreamer->AddComment(
" Bit 2: 1 = Vector Reg Mask is in optional area");
1355 if ((Flags4 & PPA1Flag4::EHBlock) == PPA1Flag4::EHBlock)
1356 OutStreamer->AddComment(
" Bit 3: 1 = C++ EH block");
1357 if ((Flags4 & PPA1Flag4::ProcedureNamePresent) ==
1358 PPA1Flag4::ProcedureNamePresent)
1359 OutStreamer->AddComment(
" Bit 7: 1 = Name Length and Name");
1371 OutName = OutName.
substr(0, UINT16_MAX);
1372 OutSize = UINT16_MAX;
1375 uint8_t ExtraZeros = 4 - ((2 + OutSize) % 4);
1379 OutName = OutnameConv.
str();
1388void SystemZAsmPrinter::emitPPA1(MCSymbol *FnEndSym) {
1389 assert(PPA2Sym !=
nullptr &&
"PPA2 Symbol not defined");
1391 const TargetRegisterInfo *
TRI =
MF->getRegInfo().getTargetRegisterInfo();
1392 const SystemZSubtarget &Subtarget =
MF->getSubtarget<SystemZSubtarget>();
1393 const auto TargetHasVector = Subtarget.hasVector();
1395 const SystemZMachineFunctionInfo *ZFI =
1396 MF->getInfo<SystemZMachineFunctionInfo>();
1397 const auto *ZFL =
static_cast<const SystemZXPLINKFrameLowering *
>(
1399 const MachineFrameInfo &MFFrame =
MF->getFrameInfo();
1403 uint16_t SavedGPRMask = 0;
1404 uint16_t SavedFPRMask = 0;
1405 uint8_t SavedVRMask = 0;
1406 int64_t OffsetFPR = 0;
1407 int64_t OffsetVR = 0;
1408 const int64_t TopOfStack =
1415 I &&
E &&
I <=
E; ++
I) {
1417 assert(V < 16 &&
"GPR index out of range");
1418 SavedGPRMask |= 1 << (15 -
V);
1421 for (
auto &CS : CSI) {
1422 unsigned Reg = CS.getReg();
1423 unsigned I =
TRI->getEncodingValue(
Reg);
1426 assert(
I < 16 &&
"FPR index out of range");
1427 SavedFPRMask |= 1 << (15 -
I);
1429 if (Temp < OffsetFPR)
1431 }
else if (SystemZ::VR128BitRegClass.
contains(
Reg)) {
1432 assert(
I >= 16 &&
I <= 23 &&
"VPR index out of range");
1433 unsigned BitNum =
I - 16;
1434 SavedVRMask |= 1 << (7 - BitNum);
1436 if (Temp < OffsetVR)
1442 OffsetFPR += (OffsetFPR < 0) ? TopOfStack : 0;
1443 OffsetVR += (OffsetVR < 0) ? TopOfStack : 0;
1446 uint8_t FrameReg =
TRI->getEncodingValue(
TRI->getFrameRegister(*
MF));
1447 uint8_t AllocaReg = ZFL->hasFP(*
MF) ? FrameReg : 0;
1448 assert(AllocaReg < 16 &&
"Can't have alloca register larger than 15");
1452 uint32_t FrameAndFPROffset = 0;
1454 uint64_t FPRSaveAreaOffset = OffsetFPR;
1455 assert(FPRSaveAreaOffset < 0x10000000 &&
"Offset out of range");
1457 FrameAndFPROffset = FPRSaveAreaOffset & 0x0FFFFFFF;
1458 FrameAndFPROffset |= FrameReg << 28;
1462 uint32_t FrameAndVROffset = 0;
1463 if (TargetHasVector && SavedVRMask) {
1464 uint64_t VRSaveAreaOffset = OffsetVR;
1465 assert(VRSaveAreaOffset < 0x10000000 &&
"Offset out of range");
1467 FrameAndVROffset = VRSaveAreaOffset & 0x0FFFFFFF;
1468 FrameAndVROffset |= FrameReg << 28;
1481 OutStreamer->emitAbsoluteSymbolDiff(PPA2Sym, CurrentFnPPA1Sym, 4);
1483 bool NeedEmitEHBlock = !
MF->getLandingPads().empty();
1495 bool HasArgAreaLength =
1499 MF->getFunction().hasName() &&
MF->getFunction().getName().size() > 0;
1503 TargetHasVector && SavedVRMask != 0, NeedEmitEHBlock,
1504 HasArgAreaLength, HasName);
1510 OutStreamer->emitAbsoluteSymbolDiff(FnEndSym, CurrentFnEPMarkerSym, 4);
1512 if (HasArgAreaLength) {
1524 OutStreamer->AddComment(Twine(
" Bit 0-3: Register R")
1527 OutStreamer->AddComment(Twine(
" Bit 4-31: Offset ")
1536 if (TargetHasVector && SavedVRMask) {
1542 OutStreamer->AddComment(Twine(
" Bit 0-3: Register R")
1545 OutStreamer->AddComment(Twine(
" Bit 4-31: Offset ")
1553 if (NeedEmitEHBlock) {
1555 MF->getFunction().getPersonalityFn()->stripPointerCasts());
1557 Per ?
MF->getTarget().getSymbol(Per) :
nullptr;
1558 assert(PersonalityRoutine &&
"Missing personality routine");
1568 MCSymbol *GCCEH =
MF->getContext().getOrCreateSymbol(
1569 Twine(
"GCC_except_table") + Twine(
MF->getFunctionNumber()));
1579 OutStreamer->emitAbsoluteSymbolDiff(CurrentFnEPMarkerSym, CurrentFnPPA1Sym,
1584 if (
TM.getTargetTriple().isOSzOS())
1589void SystemZAsmPrinter::emitPPA2(
Module &M) {
1595 const char *StartSymbolName =
"CELQSTRT";
1615 ostr <<
formatv(
"{0,0-2:d}{1,0-2:d}{2,0-2:d}", ProductVersion, ProductRelease,
1619 SmallString<
sizeof(CompilationTime) - 1> CompilationTimeStr;
1625 enum class PPA2MemberId :
uint8_t {
1630 enum class PPA2MemberSubId :
uint8_t {
1636 LLVMBasedLang = 0xe7,
1639 enum class PPA2Flags : uint8_t {
1640 CompileForBinaryFloatingPoint = 0x80,
1641 CompiledWithXPLink = 0x01,
1642 CompiledUnitASCII = 0x04,
1643 HasServiceInfo = 0x20,
1646 PPA2MemberSubId MemberSubId = PPA2MemberSubId::LLVMBasedLang;
1647 if (
auto *MD =
M.getModuleFlag(
"zos_cu_language")) {
1649 MemberSubId = StringSwitch<PPA2MemberSubId>(Language)
1650 .Case(
"C", PPA2MemberSubId::C)
1651 .Case(
"C++", PPA2MemberSubId::CXX)
1652 .Case(
"Swift", PPA2MemberSubId::Swift)
1653 .Case(
"Go", PPA2MemberSubId::Go)
1654 .Default(PPA2MemberSubId::LLVMBasedLang);
1659 OutStreamer->emitInt8(
static_cast<uint8_t
>(PPA2MemberId::LE_C_Runtime));
1660 OutStreamer->emitInt8(
static_cast<uint8_t
>(MemberSubId));
1663 OutStreamer->emitAbsoluteSymbolDiff(CELQSTRT, PPA2Sym, 4);
1665 OutStreamer->emitAbsoluteSymbolDiff(DateVersionSym, PPA2Sym, 4);
1668 uint8_t Flgs =
static_cast<uint8_t
>(PPA2Flags::CompileForBinaryFloatingPoint);
1669 Flgs |=
static_cast<uint8_t
>(PPA2Flags::CompiledWithXPLink);
1671 if (
auto *MD =
M.getModuleFlag(
"zos_le_char_mode")) {
1673 if (CharMode ==
"ascii") {
1674 Flgs |=
static_cast<uint8_t
>(
1675 PPA2Flags::CompiledUnitASCII);
1676 }
else if (CharMode !=
"ebcdic") {
1678 "Only ascii or ebcdic are valid values for zos_le_char_mode "
1703 OutStreamer->emitAbsoluteSymbolDiff(PPA2Sym, CELQSTRT, 8);
1710 if (Subtarget.getTargetTriple().isOSzOS()) {
1714 std::string
N(
MF->getFunction().hasName()
1718 CurrentFnEPMarkerSym =
1737 uint32_t DSAAndFlags = DSASize & 0xFFFFFFE0;
1738 DSAAndFlags |= Flags;
1741 OutStreamer->AddComment(
"XPLINK Routine Layout Entry");
1743 OutStreamer->AddComment(
"Eyecatcher 0x00C300C500C500");
1744 OutStreamer->emitIntValueInHex(0x00C300C500C500, 7);
1748 OutStreamer->emitAbsoluteSymbolDiff(CurrentFnPPA1Sym, CurrentFnEPMarkerSym,
1754 OutStreamer->AddComment(
" Bit 1: 1 = Leaf function");
1756 OutStreamer->AddComment(
" Bit 1: 0 = Non-leaf function");
1758 OutStreamer->AddComment(
" Bit 2: 1 = Uses alloca");
1760 OutStreamer->AddComment(
" Bit 2: 0 = Does not use alloca");
1771 "SystemZ Assembly Printer",
false,
false)
1775LLVMInitializeSystemZAsmPrinter() {
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_EXTERNAL_VISIBILITY
This file provides utility functions for converting between EBCDIC-1047 and UTF-8.
const HexagonInstrInfo * TII
Module.h This file contains the declarations for the Module class.
Machine Check Debug Module
Register const TargetRegisterInfo * TRI
Promote Memory to Register
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
static bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
static MCInst lowerVecEltExtraction(const MachineInstr *MI, unsigned Opcode)
static uint8_t getSpecifierFromModifier(SystemZCP::SystemZCPModifier Modifier)
static void emitPPA1Name(std::unique_ptr< MCStreamer > &OutStreamer, StringRef OutName)
static void lowerAlignmentHint(const MachineInstr *MI, MCInst &LoweredMI, unsigned Opcode)
#define EMIT_COMMENT(Str)
static const MCSymbolRefExpr * getGlobalOffsetTable(MCContext &Context)
static void printFormattedRegName(const MCAsmInfo *MAI, unsigned RegNo, raw_ostream &OS)
static MCInst lowerRILow(const MachineInstr *MI, unsigned Opcode)
static uint32_t getProductVersion(Module &M)
static std::string getProductID(Module &M)
static MCInst lowerRIHigh(const MachineInstr *MI, unsigned Opcode)
static void printAddress(const MCAsmInfo *MAI, unsigned Base, const MCOperand &DispMO, unsigned Index, raw_ostream &OS)
static time_t getTranslationTime(Module &M)
static const MCSymbolRefExpr * getTLSGetOffset(MCContext &Context)
static void emitPPA1Flags(std::unique_ptr< MCStreamer > &OutStreamer, bool VarArg, bool StackProtector, bool FPRMask, bool VRMask, bool EHBlock, bool HasArgAreaLength, bool HasName)
static MCInst lowerSubvectorStore(const MachineInstr *MI, unsigned Opcode)
static unsigned EmitNop(MCContext &OutContext, MCStreamer &OutStreamer, unsigned NumBytes, const MCSubtargetInfo &STI)
static MCInst lowerVecEltInsertion(const MachineInstr *MI, unsigned Opcode)
static uint32_t getProductRelease(Module &M)
static MCInst lowerSubvectorLoad(const MachineInstr *MI, unsigned Opcode)
static uint32_t getProductPatch(Module &M)
static MCInst lowerRIEfLow(const MachineInstr *MI, unsigned Opcode)
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
MCSymbol * getSymbol(const GlobalValue *GV) const
void EmitToStreamer(MCStreamer &S, const MCInst &Inst)
TargetMachine & TM
Target machine description.
const MCAsmInfo * MAI
Target Asm Printer information.
MachineFunction * MF
The current machine function.
virtual void emitStartOfAsmFile(Module &)
This virtual method can be overridden by targets that want to emit something at the start of their fi...
void recordSled(MCSymbol *Sled, const MachineInstr &MI, SledKind Kind, uint8_t Version=0)
MCContext & OutContext
This is the context for the output file that we are streaming.
MCSymbol * createTempSymbol(const Twine &Name) const
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
const DataLayout & getDataLayout() const
Return information about data layout.
virtual void emitFunctionEntryLabel()
EmitFunctionEntryLabel - Emit the label that is the entrypoint for the function.
const MCSubtargetInfo & getSubtargetInfo() const
Return information about subtarget.
virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &OS)
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant.
LLVM_ABI TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
LLVM_ABI unsigned getPointerSize(unsigned AS=0) const
The pointer representation size in bytes, rounded up to a whole number of bytes.
This class is intended to be used as a base class for asm properties and features specific to the tar...
unsigned getAssemblerDialect() const
void printExpr(raw_ostream &, const MCExpr &) const
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Context object for machine code objects.
LLVM_ABI MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
LLVM_ABI MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
Base class for the full range of assembler expressions which are needed for parsing.
MCInstBuilder & addReg(MCRegister Reg)
Add a new register operand.
MCInstBuilder & addImm(int64_t Val)
Add a new integer immediate operand.
MCInstBuilder & addExpr(const MCExpr *Val)
Add a new MCExpr operand.
Instances of this class represent a single low-level machine instruction.
void addOperand(const MCOperand Op)
void setOpcode(unsigned Op)
Instances of this class represent operands of the MCInst class.
static MCOperand createReg(MCRegister Reg)
static MCOperand createImm(int64_t Val)
MCRegister getReg() const
Returns the register number.
const MCExpr * getExpr() const
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
static const MCSpecifierExpr * create(const MCExpr *Expr, Spec S, MCContext &Ctx, SMLoc Loc=SMLoc())
Streaming machine code generation interface.
Generic base class for all target subtargets.
Represent a reference to a symbol from inside an expression.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
StringRef getName() const
getName - Get the symbol name.
MachineInstrBundleIterator< const MachineInstr > const_iterator
Abstract base class for all machine specific constantpool value subclasses.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
bool hasVarSizedObjects() const
This method may be called any time after instruction selection is complete to determine if the stack ...
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects.
uint64_t getMaxCallFrameSize() const
Return the maximum size of a call frame that must be allocated for an outgoing function call.
int64_t getOffsetAdjustment() const
Return the correction for frame offsets.
const std::vector< CalleeSavedInfo > & getCalleeSavedInfo() const
Returns a reference to call saved info vector for the current function.
bool hasStackProtectorIndex() const
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
MCContext & getContext() const
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Representation of each machine instruction.
ArrayRef< MachineMemOperand * >::iterator mmo_iterator
LLVM_ABI const MachineFunction * getMF() const
Return the function that contains the basic block that this instruction belongs to.
MachineOperand class - Representation of each machine instruction operand.
const GlobalValue * getGlobal() const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
unsigned getTargetFlags() const
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
const char * getSymbolName() const
Register getReg() const
getReg - Returns the register number.
@ MO_GlobalAddress
Address of a global value.
@ MO_ExternalSymbol
Name of external global symbol.
A Module instance is used to store all the information related to an LLVM module.
Wrapper class representing virtual and physical registers.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
StringRef str() const
Explicit conversion to StringRef.
StringRef - Represent a constant reference to a string, i.e.
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
constexpr size_t size() const
size - Get the string size.
void emitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) override
void emitFunctionBodyEnd() override
Targets can override this to emit stuff after the last basic block in the function.
void emitStartOfAsmFile(Module &M) override
This virtual method can be overridden by targets that want to emit something at the start of their fi...
void emitInstruction(const MachineInstr *MI) override
Targets should implement this to emit instructions.
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &OS) override
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant as...
void emitFunctionEntryLabel() override
EmitFunctionEntryLabel - Emit the label that is the entrypoint for the function.
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, const char *ExtraCode, raw_ostream &OS) override
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant.
void emitEndOfAsmFile(Module &M) override
This virtual method can be overridden by targets that want to emit something at the end of their file...
A SystemZ-specific constant pool value.
static const char * getRegisterName(MCRegister Reg)
static const char * getRegisterName(MCRegister Reg)
SystemZ::GPRRegs getSpillGPRRegs() const
unsigned getSizeOfFnParams() const
const SystemZInstrInfo * getInstrInfo() const override
const TargetFrameLowering * getFrameLowering() const override
std::pair< MCInst, const MCSubtargetInfo * > MCInstSTIPair
EXRLT2SymMap EXRLTargets2Sym
MCSymbol * getSymbol(const GlobalValue *GV) const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM_ABI std::string str() const
Return the twine contents as a std::string.
Twine concat(const Twine &Suffix) const
static Twine utohexstr(uint64_t Val)
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an SmallVector or SmallString.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Language[]
Key for Kernel::Metadata::mLanguage.
@ Swift
Calling convention for Swift.
@ C
The default llvm calling convention, compatible with C.
LLVM_ABI std::error_code convertToEBCDIC(StringRef Source, SmallVectorImpl< char > &Result)
@ MO_ADA_DATA_SYMBOL_ADDR
@ MO_ADA_DIRECT_FUNC_DESC
@ MO_ADA_INDIRECT_FUNC_DESC
unsigned getRegAsGR32(unsigned Reg)
const unsigned GR64Regs[16]
unsigned getRegAsGRH32(unsigned Reg)
unsigned getRegAsVR128(unsigned Reg)
unsigned getRegAsGR64(unsigned Reg)
constexpr size_t NameSize
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract_or_null(Y &&MD)
Extract a Value from Metadata, allowing null.
UtcTime< std::chrono::seconds > toUtcTime(std::time_t T)
Convert a std::time_t to a UtcTime.
This is an optimization pass for GlobalISel generic memory operations.
Target & getTheSystemZTarget()
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
std::string utostr(uint64_t X, bool isNeg=false)
detail::concat_range< ValueT, RangeTs... > concat(RangeTs &&...Ranges)
Returns a concatenated range across two or more ranges.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
FunctionAddr VTableAddr uintptr_t uintptr_t Version
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
@ LLVM_MARK_AS_BITMASK_ENUM
FunctionAddr VTableAddr uintptr_t uintptr_t Data
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI Printable printReg(Register Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
@ MCSA_OSLinkage
symbol uses OS linkage (GOFF)
@ MCSA_IndirectSymbol
.indirect_symbol (MachO)
@ MCSA_Global
.type _foo, @gnu_unique_object
This struct is a compact representation of a valid (non-zero power of two) alignment.
RegisterAsmPrinter - Helper template for registering a target specific assembly printer,...