LLVM 24.0.0git
SystemZXPLINKAsmPrinter.cpp
Go to the documentation of this file.
1//===-- SystemZXPLINKAsmPrinter.cpp - SystemZ XPLINK asm printer ----------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements the SystemZXPLINKAsmPrinter class.
10//
11//===----------------------------------------------------------------------===//
12
17#include "SystemZInstrInfo.h"
18#include "SystemZMCInstLower.h"
20#include "SystemZSubtarget.h"
24#include "llvm/IR/Function.h"
25#include "llvm/IR/GlobalAlias.h"
27#include "llvm/IR/Module.h"
28#include "llvm/MC/MCExpr.h"
31#include "llvm/Support/Chrono.h"
34
35using namespace llvm;
36
40
42 SM.reset();
43
44 // In HLASM, the only way to represent aliases is to use the
45 // extra-label-at-definition strategy. This is similar to the AIX
46 // implementation with the additional caveat that all symbol attributes must
47 // be emitted before the label is emitted.
48 // Construct an aliasing list for each GlobalObject.
49 for (const auto &Alias : M.aliases()) {
50 const GlobalObject *Aliasee = Alias.getAliaseeObject();
51 if (!Aliasee)
52 OutContext.reportError(
53 {}, "Alias without a base object is not yet supported on z/OS.");
54
55 bool IsFunc = isa<Function>(Aliasee->stripPointerCasts());
56 if (IsFunc) {
57 if (Alias.hasWeakLinkage() || Alias.hasLinkOnceLinkage())
58 OutContext.reportError({},
59 "Weak alias/reference not supported on z/OS");
60
61 GOAliasMap[Aliasee].push_back(&Alias);
62 } else
63 OutContext.reportError({},
64 "Only aliases to functions is supported in GOFF.");
65 }
67}
68
69// The XPLINK ABI requires that a no-op encoding the call type is emitted after
70// each call to a subroutine. This information can be used by the called
71// function to determine its entry point, e.g. for generating a backtrace. The
72// call type is encoded as a register number in the bcr instruction. See
73// enumeration CallType for the possible values.
74void SystemZXPLINKAsmPrinter::emitCallInformation(CallType CT) {
76 MCInstBuilder(SystemZ::BCRAsm)
77 .addImm(0)
78 .addReg(SystemZMC::GR64Regs[static_cast<unsigned>(CT)]));
79}
80
82SystemZXPLINKAsmPrinter::AssociatedDataAreaTable::insert(const MCSymbol *Sym,
83 unsigned SlotKind) {
84 auto Key = std::make_pair(Sym, SlotKind);
85 auto It = Displacements.find(Key);
86
87 if (It != Displacements.end())
88 return (*It).second;
89
90 // Determine length of descriptor.
92 switch (SlotKind) {
94 Length = 2 * PointerSize;
95 break;
96 default:
98 break;
99 }
100
101 uint32_t Displacement = NextDisplacement;
102 Displacements[std::make_pair(Sym, SlotKind)] = NextDisplacement;
103 NextDisplacement += Length;
104
105 return Displacement;
106}
107
108uint32_t SystemZXPLINKAsmPrinter::AssociatedDataAreaTable::insert(
109 const MachineFunction &MF, const MachineOperand &MO) {
110 MCSymbol *Sym;
112 const GlobalValue *GV = MO.getGlobal();
113 Sym = MF.getTarget().getSymbol(GV);
114 assert(Sym && "No symbol");
115 } else if (MO.getType() == MachineOperand::MO_ExternalSymbol) {
116 const char *SymName = MO.getSymbolName();
117 Sym = MF.getContext().getOrCreateSymbol(SymName);
118 assert(Sym && "No symbol");
119 } else
120 llvm_unreachable("Unexpected operand type");
121
122 unsigned ADAslotType = MO.getTargetFlags();
123 return insert(Sym, ADAslotType);
124}
125
127 SystemZMCInstLower Lower(MF->getContext(), *this);
128 MCInst LoweredMI;
129
130 switch (MI->getOpcode()) {
131 case SystemZ::CallBRASL_XPLINK64:
133 .addReg(SystemZ::R7D)
134 .addExpr(Lower.getExpr(MI->getOperand(0),
136 emitCallInformation(CallType::BRASL7);
137 return;
138
139 case SystemZ::CallBASR_XPLINK64:
141 .addReg(SystemZ::R7D)
142 .addReg(MI->getOperand(0).getReg()));
143 emitCallInformation(CallType::BASR76);
144 return;
145
146 case SystemZ::Return_XPLINK:
147 LoweredMI =
148 MCInstBuilder(SystemZ::B).addReg(SystemZ::R7D).addImm(2).addReg(0);
149 break;
150
151 case SystemZ::CondReturn_XPLINK:
152 LoweredMI = MCInstBuilder(SystemZ::BC)
153 .addImm(MI->getOperand(0).getImm())
154 .addImm(MI->getOperand(1).getImm())
155 .addReg(SystemZ::R7D)
156 .addImm(2)
157 .addReg(0);
158 break;
159
160 case SystemZ::CallBASR_STACKEXT:
162 .addReg(SystemZ::R3D)
163 .addReg(MI->getOperand(0).getReg()));
164 emitCallInformation(CallType::BASR33);
165 return;
166
167 case SystemZ::ADA_ENTRY_VALUE:
168 case SystemZ::ADA_ENTRY: {
169 const SystemZSubtarget &Subtarget = MF->getSubtarget<SystemZSubtarget>();
170 const SystemZInstrInfo *TII = Subtarget.getInstrInfo();
171 uint32_t Disp = ADATable.insert(*MF, MI->getOperand(1));
172 Register TargetReg = MI->getOperand(0).getReg();
173
174 Register ADAReg = MI->getOperand(2).getReg();
175 Disp += MI->getOperand(3).getImm();
176 bool LoadAddr = MI->getOpcode() == SystemZ::ADA_ENTRY;
177
178 unsigned Op0 = LoadAddr ? SystemZ::LA : SystemZ::LG;
179 unsigned Op = TII->getOpcodeForOffset(Op0, Disp);
180
181 Register IndexReg = 0;
182 if (!Op) {
183 if (TargetReg != ADAReg) {
184 IndexReg = TargetReg;
185 // Use TargetReg to store displacement.
188 MCInstBuilder(SystemZ::LLILF).addReg(TargetReg).addImm(Disp));
189 } else
191 .addReg(TargetReg)
192 .addReg(TargetReg)
193 .addImm(Disp));
194 Disp = 0;
195 Op = Op0;
196 }
199 MCInstBuilder(Op).addReg(TargetReg).addReg(ADAReg).addImm(Disp).addReg(
200 IndexReg));
201 return;
202 }
203
204 default:
206 return;
207 }
208 EmitToStreamer(*OutStreamer, LoweredMI);
209}
210
212 const Constant *List,
213 bool IsCtor) {
214 assert(TM.getTargetTriple().isOSBinFormatGOFF() && "Only GOFF supported");
215
216 SmallVector<Structor, 8> Structors;
217 preprocessXXStructorList(DL, List, Structors);
218 if (Structors.empty())
219 return;
220
221 const Align Align = llvm::Align(4);
223 static_cast<const TargetLoweringObjectFileGOFF &>(getObjFileLowering());
224 for (Structor &S : Structors) {
225 MCSectionGOFF *Section =
226 static_cast<MCSectionGOFF *>(Obj.getStaticXtorSection(S.Priority));
227 OutStreamer->switchSection(Section);
228 if (OutStreamer->getCurrentSection() != OutStreamer->getPreviousSection())
230
231 // The priority is provided as an input to getStaticXtorSection(), and is
232 // recalculated within that function as `Prio` going to going into the
233 // PR section.
234 // This priority retrieved via the `SortKey` below is the recalculated
235 // Priority.
236 uint32_t XtorPriority = Section->getPRAttributes().SortKey;
237
238 const GlobalValue *GV = dyn_cast<GlobalValue>(S.Func->stripPointerCasts());
239 assert(GV && "C++ xxtor pointer was not a GlobalValue!");
240 MCSymbolGOFF *Symbol = static_cast<MCSymbolGOFF *>(getSymbol(GV));
241
242 // @@SQINIT entry: { unsigned prio; void (*ctor)(); void (*dtor)(); }
243
244 unsigned PointerSizeInBytes = DL.getPointerSize();
245
246 auto &Ctx = OutStreamer->getContext();
247 const MCExpr *ADAFuncRefExpr;
248 unsigned SlotKind = SystemZII::MO_ADA_DIRECT_FUNC_DESC;
249
250 MCSectionGOFF *ADASection =
251 static_cast<MCSectionGOFF *>(Obj.getADASection());
252 assert(ADASection && "ADA section must exist for GOFF targets!");
253 const MCSymbol *ADASym = ADASection->getBeginSymbol();
254 assert(ADASym && "ADA symbol should already be set!");
255
256 ADAFuncRefExpr = MCBinaryExpr::createAdd(
259 MCConstantExpr::create(ADATable.insert(Symbol, SlotKind), Ctx), Ctx);
260
261 emitInt32(XtorPriority);
262 if (IsCtor) {
263 OutStreamer->emitValue(ADAFuncRefExpr, PointerSizeInBytes);
264 OutStreamer->emitIntValue(0, PointerSizeInBytes);
265 } else {
266 OutStreamer->emitIntValue(0, PointerSizeInBytes);
267 OutStreamer->emitValue(ADAFuncRefExpr, PointerSizeInBytes);
268 }
269 }
270}
271
273 auto *ZOS = getTargetStreamer();
274 emitADASection();
275 emitIDRLSection(M);
276 // On z/OS, we need to associate an external data reference with an ED
277 // symbol, for which we use the the ED of the ADA. We also need to mark the
278 // reference as being to data, otherwise we cannot bind with code generated
279 // by XL.
280 for (auto &GO : M.global_objects()) {
281 if (auto *GV = dyn_cast<GlobalVariable>(&GO)) {
282 if (!GV->hasInitializer()) {
283 MCSymbol *Sym = getSymbol(GV);
284 ZOS->emitADA(Sym, OutContext.getObjectFileInfo()->getADASection());
285 OutStreamer->emitSymbolAttribute(Sym, MCSA_ELF_TypeObject);
286 }
287 }
288 }
289}
290
291// Emit CELQMAIN in RENT format (see z/OS Language Environment Vendor
292// Interfaces, "Program initialization and termination for AMODE 64
293// applications"):
294// +0 X'04000001'
295// +8 AD(main entry point)
296// +10 AD(CELQINPL)
297// +18 A(0) / Q(environment); emitted as 8 byte R-con to main, which the
298// binder resolves to the offset of the ADA of main (fits into 4 bytes)
299// followed by a reference to the bootstrap routine CELQBST. CELQSTRT only has
300// a weak reference to CELQBST, so without it autocall would not include it.
301void SystemZXPLINKAsmPrinter::emitCELQMAIN(const Function &MainFn) {
302 MCSymbol *MainSym = getSymbol(&MainFn);
303 auto ExternalOSSymbol = [&](StringRef Name) {
305 OutStreamer->emitSymbolAttribute(Sym, MCSA_OSLinkage);
306 OutStreamer->emitSymbolAttribute(Sym, MCSA_Global);
307 return Sym;
308 };
309 MCSymbol *CELQINPL = ExternalOSSymbol("CELQINPL");
310 MCSymbol *CELQBST = ExternalOSSymbol("CELQBST");
311
312 OutStreamer->pushSection();
313 OutStreamer->switchSection(getObjFileLowering().getTextSection());
314 OutStreamer->emitValueToAlignment(Align(8));
315 MCSymbol *CELQMAIN = OutContext.getOrCreateSymbol("CELQMAIN");
316 // Referenced by CELQSTRT, CELQINPL and CELQBST with OS linkage.
317 OutStreamer->emitSymbolAttribute(CELQMAIN, MCSA_OSLinkage);
318 OutStreamer->emitSymbolAttribute(CELQMAIN, MCSA_Global);
319 OutStreamer->emitSymbolAttribute(CELQMAIN, MCSA_Hidden);
320 OutStreamer->emitLabel(CELQMAIN);
321 OutStreamer->AddComment("CELQMAIN, RENT format");
322 OutStreamer->emitInt32(0x04000001);
323 OutStreamer->emitInt32(0);
324 OutStreamer->AddComment("Address of main");
325 OutStreamer->emitValue(MCSymbolRefExpr::create(MainSym, OutContext), 8);
326 OutStreamer->AddComment("Address of CELQINPL");
327 OutStreamer->emitValue(MCSymbolRefExpr::create(CELQINPL, OutContext), 8);
328 OutStreamer->AddComment("Q(environment) of main");
329 OutStreamer->emitValue(
332 8);
333 OutStreamer->AddComment("Reference to CELQBST");
334 OutStreamer->emitValue(MCSymbolRefExpr::create(CELQBST, OutContext), 8);
335 OutStreamer->popSection();
336}
337
338void SystemZXPLINKAsmPrinter::emitADASection() {
339 OutStreamer->pushSection();
340
341 const unsigned PointerSize = getDataLayout().getPointerSize();
342 OutStreamer->switchSection(getObjFileLowering().getADASection());
343
344 auto *ZOS = getTargetStreamer();
345 unsigned EmittedBytes = 0;
346 for (auto &Entry : ADATable.getTable()) {
347 const MCSymbol *Sym;
348 unsigned SlotKind;
349 std::tie(Sym, SlotKind) = Entry.first;
350 unsigned Offset = Entry.second;
351 assert(Offset == EmittedBytes && "Offset not as expected");
352 (void)EmittedBytes;
353#define EMIT_COMMENT(Str) \
354 OutStreamer->AddComment(Twine("Offset ") \
355 .concat(utostr(Offset)) \
356 .concat(" " Str " ") \
357 .concat(Sym->getName()));
358 switch (SlotKind) {
360 // Language Environment DLL logic requires function descriptors, for
361 // imported functions, that are placed in the ADA to be 8 byte aligned.
362 EMIT_COMMENT("function descriptor of");
363 OutStreamer->emitValue(
367 OutStreamer->emitValue(
371 EmittedBytes += PointerSize * 2;
372 break;
374 EMIT_COMMENT("pointer to data symbol");
375 OutStreamer->emitValue(
379 EmittedBytes += PointerSize;
380 break;
382 MCSymbol *Alias = OutContext.getOrCreateSymbol(
383 Twine(Sym->getName()).concat("@indirect"));
384 OutStreamer->emitSymbolAttribute(Alias, MCSA_IndirectSymbol);
385 OutStreamer->emitSymbolAttribute(Alias, MCSA_ELF_TypeFunction);
386 OutStreamer->emitSymbolAttribute(Alias, MCSA_Global);
387 OutStreamer->emitSymbolAttribute(Alias, MCSA_Extern);
388 MCSymbolGOFF *GOFFSym =
389 static_cast<llvm::MCSymbolGOFF *>(const_cast<llvm::MCSymbol *>(Sym));
390 // A weak reference (extern_weak) stays weak through the indirect
391 // symbol, otherwise the binder fails on the unresolved reference.
392 if (GOFFSym->isWeak())
393 OutStreamer->emitSymbolAttribute(Alias, MCSA_WeakReference);
394 ZOS->emitExternalName(Alias, GOFFSym->getExternalName());
395 EMIT_COMMENT("pointer to function descriptor");
396 OutStreamer->emitValue(
400 EmittedBytes += PointerSize;
401 break;
402 }
403 default:
404 llvm_unreachable("Unexpected slot kind");
405 }
406#undef EMIT_COMMENT
407 }
408 OutStreamer->popSection();
409}
410
411static std::string getProductID(Module &M) {
412 std::string ProductID;
413 if (auto *MD = M.getModuleFlag("zos_product_id"))
414 ProductID = cast<MDString>(MD)->getString().str();
415 if (ProductID.empty())
416 ProductID = "LLVM";
417 return ProductID;
418}
419
421 if (auto *VersionVal = mdconst::extract_or_null<ConstantInt>(
422 M.getModuleFlag("zos_product_major_version")))
423 return VersionVal->getZExtValue();
424 return LLVM_VERSION_MAJOR;
425}
426
428 if (auto *ReleaseVal = mdconst::extract_or_null<ConstantInt>(
429 M.getModuleFlag("zos_product_minor_version")))
430 return ReleaseVal->getZExtValue();
431 return LLVM_VERSION_MINOR;
432}
433
435 if (auto *PatchVal = mdconst::extract_or_null<ConstantInt>(
436 M.getModuleFlag("zos_product_patchlevel")))
437 return PatchVal->getZExtValue();
438 return LLVM_VERSION_PATCH;
439}
440
441static time_t getTranslationTime(Module &M) {
442 std::time_t Time = 0;
444 M.getModuleFlag("zos_translation_time"))) {
445 long SecondsSinceEpoch = Val->getSExtValue();
446 Time = static_cast<time_t>(SecondsSinceEpoch);
447 }
448 return Time;
449}
450
451void SystemZXPLINKAsmPrinter::emitIDRLSection(Module &M) {
452 OutStreamer->pushSection();
453 OutStreamer->switchSection(getObjFileLowering().getIDRLSection());
454 constexpr unsigned IDRLDataLength = 30;
455 std::time_t Time = getTranslationTime(M);
456
457 uint32_t ProductVersion = getProductVersion(M);
458 uint32_t ProductRelease = getProductRelease(M);
459
460 std::string ProductID = getProductID(M);
461
462 SmallString<IDRLDataLength + 1> TempStr;
463 raw_svector_ostream O(TempStr);
464 O << formatv("{0,-10}{1,0-2:d}{2,0-2:d}{3:%Y%m%d%H%M%S}{4,0-2}",
465 ProductID.substr(0, 10).c_str(), ProductVersion, ProductRelease,
466 llvm::sys::toUtcTime(Time), "0");
467 SmallString<IDRLDataLength> Data;
469
470 OutStreamer->emitInt8(0); // Reserved.
471 OutStreamer->emitInt8(3); // Format.
472 OutStreamer->emitInt16(IDRLDataLength); // Length.
473 OutStreamer->emitBytes(Data.str());
474 OutStreamer->popSection();
475}
476
478 // Emit symbol for the end of function if the z/OS target streamer
479 // is used. This is needed to calculate the size of the function.
480 auto *ZOS = getTargetStreamer();
481 OutStreamer->emitLabel(ZOS->DeferredPPA1.back().FnEnd);
482}
483
484// Determine the end of the prolog and the instructions which updates the stack
485// register, and attach symbols to those instructions.
487 MCSymbol *&EndOfPrologSym,
488 MCSymbol *&StackUpdateSym) {
489 EndOfPrologSym = nullptr;
490 StackUpdateSym = nullptr;
491
492 // Scan the basic block for the FENCE instruction which marks the end
493 // of the prologue. We know
494 // the prologue is spread at most across the first 3 basic blocks. Also record
495 // the first instruction updating the stack pointer.
498 MachineInstr *EndOfPrologMI = nullptr;
499 MachineInstr *StackUpdateMI = nullptr;
500 unsigned BBCount = 1;
501
502 for (auto &MBB : *MF) {
503 for (auto &I : MBB) {
504 if (I.getOpcode() == SystemZ::FENCE)
505 EndOfPrologMI = &I;
506 else if (!StackUpdateMI) {
507 unsigned Opcode = I.getOpcode();
508 // TODO: We can instead emit a pseudo instruction in
509 // SystemZFrameLowering to represent a stack adjustment instruction, and
510 // check for that here, instead of having to check for multiple
511 // instructions.
512 if ((Opcode == SystemZ::AGHI || Opcode == SystemZ::AGFI) &&
513 I.getOperand(0).getReg() == Regs.getStackPointerRegister())
514 StackUpdateMI = &I;
515 }
516 }
517
518 // Prologue can be a max of 3 BBs if we need to call stack extension code
519 if (EndOfPrologMI || BBCount == 3)
520 break;
521
522 ++BBCount;
523 }
524
525 // Leaf functions do not have a prologue.
526 if (EndOfPrologMI == nullptr)
527 return;
528
529#ifdef EXPENSIVE_CHECKS
530 // Check that the prolog length is valid.
531 auto *TII = STI.getInstrInfo();
532 size_t Size = 0;
533
534 for (auto &MBB : *MF) {
535 bool TerminateLoop = false;
536 for (auto &I : MBB) {
537 Size += TII->getInstSizeInBytes(I);
538 if (&I == EndOfPrologMI) {
539 TerminateLoop = true;
540 break;
541 }
542 }
543 if (TerminateLoop)
544 break;
545 }
546 if (Size > 128)
548 Twine(MF->getName()).concat(": Prolog exceeds 128 bytes"));
549#endif
550
551 // Attach a temporary symbol to mark the end of the prolog.
552 EndOfPrologSym = MF->getContext().createTempSymbol("end_of_prologue");
553 EndOfPrologMI->setPostInstrSymbol(*MF, EndOfPrologSym);
554
555 if (StackUpdateMI) {
556 StackUpdateSym = MF->getContext().createTempSymbol("stack_update");
557 StackUpdateMI->setPreInstrSymbol(*MF, StackUpdateSym);
558 }
559}
560
561void SystemZXPLINKAsmPrinter::calculatePPA1() {
562 auto *ZOS = getTargetStreamer();
563 assert(ZOS->PPA2Sym != nullptr && "PPA2 Symbol not defined");
564
565 SystemZTargetzOSStreamer::PPA1Info Info;
566
567 const TargetRegisterInfo *TRI = MF->getRegInfo().getTargetRegisterInfo();
568 const SystemZSubtarget &Subtarget = MF->getSubtarget<SystemZSubtarget>();
569
570 const SystemZMachineFunctionInfo *ZFI =
571 MF->getInfo<SystemZMachineFunctionInfo>();
572 const auto *ZFL = static_cast<const SystemZXPLINKFrameLowering *>(
573 Subtarget.getFrameLowering());
574 const MachineFrameInfo &MFFrame = MF->getFrameInfo();
575
576 // Get saved GPR/FPR/VPR masks.
577 const std::vector<CalleeSavedInfo> &CSI = MFFrame.getCalleeSavedInfo();
578 uint16_t SavedGPRMask = 0;
579 uint16_t SavedFPRMask = 0;
580 uint8_t SavedVRMask = 0;
581 int64_t OffsetFPR = 0;
582 int64_t OffsetVR = 0;
583 const int64_t TopOfStack =
584 MFFrame.getOffsetAdjustment() + MFFrame.getStackSize();
585
586 // Loop over the spilled registers. The CalleeSavedInfo can't be used because
587 // it does not contain all spilled registers.
588 for (unsigned I = ZFI->getSpillGPRRegs().LowGPR,
589 E = ZFI->getSpillGPRRegs().HighGPR;
590 I && E && I <= E; ++I) {
591 unsigned V = TRI->getEncodingValue((Register)I);
592 assert(V < 16 && "GPR index out of range");
593 SavedGPRMask |= 1 << (15 - V);
594 }
595
596 for (auto &CS : CSI) {
597 unsigned Reg = CS.getReg();
598 unsigned I = TRI->getEncodingValue(Reg);
599
600 if (SystemZ::FP64BitRegClass.contains(Reg)) {
601 assert(I < 16 && "FPR index out of range");
602 SavedFPRMask |= 1 << (15 - I);
603 int64_t Temp = MFFrame.getObjectOffset(CS.getFrameIdx());
604 if (Temp < OffsetFPR)
605 OffsetFPR = Temp;
606 } else if (SystemZ::VR128BitRegClass.contains(Reg)) {
607 assert(I >= 16 && I <= 23 && "VPR index out of range");
608 unsigned BitNum = I - 16;
609 SavedVRMask |= 1 << (7 - BitNum);
610 int64_t Temp = MFFrame.getObjectOffset(CS.getFrameIdx());
611 if (Temp < OffsetVR)
612 OffsetVR = Temp;
613 }
614 }
615
616 // Adjust the offset.
617 OffsetFPR += (OffsetFPR < 0) ? TopOfStack : 0;
618 OffsetVR += (OffsetVR < 0) ? TopOfStack : 0;
619
620 // Get alloca register.
621 uint8_t FrameReg = TRI->getEncodingValue(TRI->getFrameRegister(*MF));
622 uint8_t AllocaReg = ZFL->hasFP(*MF) ? FrameReg : 0;
623 assert(AllocaReg < 16 && "Can't have alloca register larger than 15");
624
625 MCSymbol *PersonalityRoutine = nullptr;
626 MCSymbol *GCCEH = nullptr;
627 uint64_t PersonalityADADisp = 0;
628 uint64_t GCCEHADADisp = 0;
629 if (!MF->getLandingPads().empty()) {
630 const Function *Per = dyn_cast<Function>(
631 MF->getFunction().getPersonalityFn()->stripPointerCasts());
632 PersonalityRoutine = Per ? MF->getTarget().getSymbol(Per) : nullptr;
633 if (PersonalityRoutine) {
634 GCCEH = MF->getContext().getOrCreateSymbol(
635 Twine("GCC_except_table") + Twine(MF->getFunctionNumber()));
636 PersonalityADADisp = ADATable.insert(
637 PersonalityRoutine, SystemZII::MO_ADA_INDIRECT_FUNC_DESC);
638 GCCEHADADisp = ADATable.insert(GCCEH, SystemZII::MO_ADA_DATA_SYMBOL_ADDR);
639 }
640 }
641
642 // Get the name of the function, with suffix _.
643 std::string N(MF->getFunction().hasName()
644 ? Twine(MF->getFunction().getName()).concat("_").str()
645 : "");
646
647 // Calculate the lables for the prolog size and the stack update symbol.
648 MCSymbol *EndOfPrologSym;
649 MCSymbol *StackUpdateSym;
650 determinePrologueStackUpdateSym(MF, EndOfPrologSym, StackUpdateSym);
651
652 // Save the calculated values.
653 if (MF->getFunction().hasFnAttribute("zos-ppa1-name"))
654 Info.Name =
655 MF->getFunction().getFnAttribute("zos-ppa1-name").getValueAsString();
656 else if (MF->getFunction().hasName())
657 Info.Name = MF->getFunction().getName();
658
659 Info.PPA1 = OutContext.createTempSymbol(Twine("PPA1_").concat(N), true);
660 Info.EPMarker = OutContext.createTempSymbol(Twine("EPM_").concat(N), true);
661 Info.FnEnd = OutContext.createTempSymbol(Twine(N).concat("end_"));
662 Info.Fn = CurrentFnSym;
663 Info.EndOfProlog = EndOfPrologSym;
664 Info.StackUpdate = StackUpdateSym;
665 Info.PersonalityADADisp = PersonalityADADisp;
666 Info.GCCEHADADisp = GCCEHADADisp;
667 Info.OffsetFPR = OffsetFPR;
668 Info.OffsetVR = OffsetVR;
669 Info.CallFrameSize = MFFrame.getMaxCallFrameSize();
670 Info.SizeOfFnParams = ZFI->getSizeOfFnParams();
671 Info.SavedGPRMask = SavedGPRMask;
672 Info.SavedFPRMask = SavedFPRMask;
673 Info.SavedVRMask = SavedVRMask;
674 Info.FrameReg = FrameReg;
675 Info.AllocaReg = AllocaReg;
676 Info.IsVarArg = MF->getFunction().isVarArg();
677 Info.HasStackProtector = MFFrame.hasStackProtectorIndex();
678
679 ZOS->DeferredPPA1.push_back(Info);
680}
681
683 emitPPA2(M);
684 // A main program needs CELQMAIN, through which the Language Environment
685 // startup (CELQSTRT) finds the main routine and its environment. It is
686 // emitted here and not at the end of the file, because the text section
687 // may already be closed then (e.g. after emitting the DWARF aranges).
688 if (const Function *MainFn = M.getFunction("main");
689 MainFn && !MainFn->isDeclaration())
690 emitCELQMAIN(*MainFn);
692}
693
694void SystemZXPLINKAsmPrinter::emitPPA2(Module &M) {
695 auto *ZOS = getTargetStreamer();
696 OutStreamer->pushSection();
697 OutStreamer->switchSection(getObjFileLowering().getTextSection());
698 MCContext &OutContext = OutStreamer->getContext();
699 // Make CELQSTRT symbol.
700 const char *StartSymbolName = "CELQSTRT";
701 MCSymbol *CELQSTRT = OutContext.getOrCreateSymbol(StartSymbolName);
702 OutStreamer->emitSymbolAttribute(CELQSTRT, MCSA_OSLinkage);
703 OutStreamer->emitSymbolAttribute(CELQSTRT, MCSA_Global);
704
705 // Create symbol and assign to streamer field for use in PPA1.
706 ZOS->PPA2Sym = OutContext.createTempSymbol("PPA2", false);
707 MCSymbol *PPA2Sym = ZOS->PPA2Sym;
708 MCSymbol *DateVersionSym = OutContext.createTempSymbol("DVS", false);
709
710 std::time_t Time = getTranslationTime(M);
711 SmallString<14> CompilationTimeEBCDIC, CompilationTime;
712 CompilationTime = formatv("{0:%Y%m%d%H%M%S}", llvm::sys::toUtcTime(Time));
713
714 uint32_t ProductVersion = getProductVersion(M),
715 ProductRelease = getProductRelease(M),
716 ProductPatch = getProductPatch(M);
717
718 SmallString<6> VersionEBCDIC, Version;
719 Version = formatv("{0,0+2:d}{1,0+2:d}{2,0+2:d}", ProductVersion,
720 ProductRelease, ProductPatch);
721
722 ConverterEBCDIC::convertToEBCDIC(CompilationTime, CompilationTimeEBCDIC);
724
725 enum class PPA2MemberId : uint8_t {
726 // See z/OS Language Environment Vendor Interfaces v2r5, p.23, for
727 // complete list. Only the C runtime is supported by this backend.
728 LE_C_Runtime = 3,
729 };
730 enum class PPA2MemberSubId : uint8_t {
731 // List of languages using the LE C runtime implementation.
732 C = 0x00,
733 CXX = 0x01,
734 Swift = 0x03,
735 Go = 0x60,
736 LLVMBasedLang = 0xe7,
737 };
738 // PPA2 Flags
739 enum class PPA2Flags : uint8_t {
740 CompileForBinaryFloatingPoint = 0x80,
741 CompiledWithXPLink = 0x01,
742 CompiledUnitASCII = 0x04,
743 HasServiceInfo = 0x20,
744 };
745
746 PPA2MemberSubId MemberSubId = PPA2MemberSubId::LLVMBasedLang;
747 if (auto *MD = M.getModuleFlag("zos_cu_language")) {
748 StringRef Language = cast<MDString>(MD)->getString();
749 MemberSubId = StringSwitch<PPA2MemberSubId>(Language)
750 .Case("C", PPA2MemberSubId::C)
751 .Case("C++", PPA2MemberSubId::CXX)
752 .Case("Swift", PPA2MemberSubId::Swift)
753 .Case("Go", PPA2MemberSubId::Go)
754 .Default(PPA2MemberSubId::LLVMBasedLang);
755 }
756
757 // Emit PPA2 section.
758 OutStreamer->emitLabel(PPA2Sym);
759 OutStreamer->emitInt8(static_cast<uint8_t>(PPA2MemberId::LE_C_Runtime));
760 OutStreamer->emitInt8(static_cast<uint8_t>(MemberSubId));
761 OutStreamer->emitInt8(0x22); // Member defined, c370_plist+c370_env
762 OutStreamer->emitInt8(0x04); // Control level 4 (XPLink)
763 OutStreamer->emitAbsoluteSymbolDiff(CELQSTRT, PPA2Sym, 4);
764 OutStreamer->emitInt32(0x00000000);
765 OutStreamer->emitAbsoluteSymbolDiff(DateVersionSym, PPA2Sym, 4);
766 OutStreamer->emitInt32(
767 0x00000000); // Offset to main entry point, always 0 (so says TR).
768 uint8_t Flgs = static_cast<uint8_t>(PPA2Flags::CompileForBinaryFloatingPoint);
769 Flgs |= static_cast<uint8_t>(PPA2Flags::CompiledWithXPLink);
770
771 bool IsASCII = true;
772 if (auto *MD = M.getModuleFlag("zos_le_char_mode")) {
773 const StringRef &CharMode = cast<MDString>(MD)->getString();
774 if (CharMode == "ebcdic")
775 IsASCII = false;
776 else if (CharMode != "ascii")
777 OutContext.reportError(
778 {}, "Only ascii or ebcdic are allowed for zos_le_char_mode");
779 }
780 if (IsASCII)
781 Flgs |= static_cast<uint8_t>(
782 PPA2Flags::CompiledUnitASCII); // Setting bit for ASCII char. mode.
783
784 OutStreamer->emitInt8(Flgs);
785 OutStreamer->emitInt8(0x00); // Reserved.
786 // No MD5 signature before timestamp.
787 // No FLOAT(AFP(VOLATILE)).
788 // Remaining 5 flag bits reserved.
789 OutStreamer->emitInt16(0x0000); // 16 Reserved flag bits.
790
791 // Emit date and version section.
792 OutStreamer->emitLabel(DateVersionSym);
793 OutStreamer->emitBytes(CompilationTimeEBCDIC.str());
794 OutStreamer->emitBytes(VersionEBCDIC.str());
795
796 OutStreamer->emitInt16(0x0000); // Service level string length.
797
798 // The binder requires that the offset to the PPA2 be emitted in a different,
799 // specially-named section.
800 OutStreamer->switchSection(getObjFileLowering().getPPA2ListSection());
801 // Emit 8 byte alignment.
802 // Emit pointer to PPA2 label.
803 OutStreamer->AddComment("A(PPA2-CELQSTRT)");
804 OutStreamer->emitAbsoluteSymbolDiff(PPA2Sym, CELQSTRT, 8);
805 OutStreamer->popSection();
806}
807
809 const GlobalAlias &GA) {
810 if (!M.getTargetTriple().isOSzOS())
811 return AsmPrinter::emitGlobalAlias(M, GA);
812
813 // Aliased function labels have already been emitted for z/OS
814}
815
817 const Constant *BaseCV,
818 uint64_t Offset) {
819 const GlobalAlias *GA = dyn_cast<GlobalAlias>(CV);
821 const Function *FV = dyn_cast<Function>(CV);
822 bool IsFunc = !GV && (FV || (GA && isa<Function>(GA->getAliaseeObject())));
823
824 MCSymbol *Sym = NULL;
825
826 if (GA)
827 Sym = getSymbol(GA);
828 else if (IsFunc)
829 Sym = getSymbol(FV);
830 else if (GV)
831 Sym = getSymbol(GV);
832
833 if (IsFunc) {
834 OutStreamer->emitSymbolAttribute(Sym, MCSA_ELF_TypeFunction);
835 // A function pointer must point to a function descriptor (a V-con would
836 // yield the entry point instead), and it must compare equal to the address
837 // of the same function taken in code. For a function that is not internal,
838 // code loads the address of the descriptor from an ADA slot that refers to
839 // the indirect symbol; the binder resolves that reference to the function
840 // descriptor. Use the same reference here. The slot is shared with code
841 // taking the address and defines the indirect symbol.
842 const GlobalValue *FGV = GA ? static_cast<const GlobalValue *>(GA)
843 : static_cast<const GlobalValue *>(FV);
844 if (!FGV->hasLocalLinkage()) {
845 ADATable.insert(Sym, SystemZII::MO_ADA_INDIRECT_FUNC_DESC);
846 MCSymbol *Alias = OutContext.getOrCreateSymbol(
847 Twine(Sym->getName()).concat("@indirect"));
850 }
851 // Internal functions: function descriptor in the ADA.
852 unsigned Disp = ADATable.insert(Sym, SystemZII::MO_ADA_DIRECT_FUNC_DESC);
856 getObjFileLowering().getADASection()->getBeginSymbol(),
857 OutContext),
860 }
861 if (Sym) {
862 OutStreamer->emitSymbolAttribute(Sym, MCSA_ELF_TypeObject);
864 }
865 return AsmPrinter::lowerConstant(CV);
866}
867
869 auto *ZOS = getTargetStreamer();
870 calculatePPA1();
871
872 // EntryPoint Marker
873 const MachineFrameInfo &MFFrame = MF->getFrameInfo();
874 bool IsUsingAlloca = MFFrame.hasVarSizedObjects();
875 uint32_t DSASize = MFFrame.getStackSize();
876 bool IsLeaf = DSASize == 0 && MFFrame.getCalleeSavedInfo().empty();
877
878 // Set Flags.
879 uint8_t Flags = 0;
880 if (IsLeaf)
881 Flags |= 0x08;
882 if (IsUsingAlloca)
883 Flags |= 0x04;
884
885 // Combine into top 27 bits of DSASize and bottom 5 bits of Flags.
886 uint32_t DSAAndFlags = DSASize & 0xFFFFFFE0; // (x/32) << 5
887 DSAAndFlags |= Flags;
888
889 // Emit entry point marker section.
890 OutStreamer->AddComment("XPLINK Routine Layout Entry");
891 OutStreamer->emitLabel(ZOS->DeferredPPA1.back().EPMarker);
892 OutStreamer->AddComment("Eyecatcher 0x00C300C500C500");
893 OutStreamer->emitIntValueInHex(0x00C300C500C500, 7); // Eyecatcher.
894 OutStreamer->AddComment("Mark Type C'1'");
895 OutStreamer->emitInt8(0xF1); // Mark Type.
896 OutStreamer->AddComment("Offset to PPA1");
897 OutStreamer->emitAbsoluteSymbolDiff(ZOS->DeferredPPA1.back().PPA1,
898 ZOS->DeferredPPA1.back().EPMarker, 4);
899 if (OutStreamer->isVerboseAsm()) {
900 OutStreamer->AddComment("DSA Size 0x" + Twine::utohexstr(DSASize));
901 OutStreamer->AddComment("Entry Flags");
902 if (Flags & 0x08)
903 OutStreamer->AddComment(" Bit 1: 1 = Leaf function");
904 else
905 OutStreamer->AddComment(" Bit 1: 0 = Non-leaf function");
906 if (Flags & 0x04)
907 OutStreamer->AddComment(" Bit 2: 1 = Uses alloca");
908 else
909 OutStreamer->AddComment(" Bit 2: 0 = Does not use alloca");
910 }
911 OutStreamer->emitInt32(DSAAndFlags);
912
913 ZOS->emitADA(CurrentFnSym, getObjFileLowering().getADASection());
914
916
917 const Function *F = &MF->getFunction();
918 // Emit aliasing label for function entry point label.
919 for (const GlobalAlias *Alias : GOAliasMap[F]) {
920 MCSymbol *Sym = getSymbol(Alias);
921 OutStreamer->emitSymbolAttribute(Sym, MCSA_ELF_TypeFunction);
922 emitVisibility(Sym, Alias->getVisibility());
923 emitLinkage(Alias, Sym);
924 OutStreamer->emitLabel(Sym);
925 }
926}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
unsigned uint64_t
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file provides utility functions for converting between EBCDIC-1047 and UTF-8.
const HexagonInstrInfo * TII
IRTranslator LLVM IR MI
Module.h This file contains the declarations for the Module class.
This file contains the MCSymbolGOFF class.
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
Register Reg
Register const TargetRegisterInfo * TRI
Promote Memory to Register
Definition Mem2Reg.cpp:110
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
Definition Value.cpp:484
This file contains some functions that are useful when dealing with strings.
std::unique_ptr< MCStreamer > && Streamer
#define EMIT_COMMENT(Str)
static void determinePrologueStackUpdateSym(MachineFunction *MF, MCSymbol *&EndOfPrologSym, MCSymbol *&StackUpdateSym)
static uint32_t getProductVersion(Module &M)
static std::string getProductID(Module &M)
static time_t getTranslationTime(Module &M)
static uint32_t getProductRelease(Module &M)
static uint32_t getProductPatch(Module &M)
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.
Definition AsmPrinter.h:94
virtual void emitGlobalAlias(const Module &M, const GlobalAlias &GA)
Align emitAlignment(Align Alignment, const GlobalObject *GV=nullptr, unsigned MaxBytesToEmit=0) const
Emit an alignment directive to the specified power of two boundary.
MachineFunction * MF
The current machine function.
Definition AsmPrinter.h:109
virtual const MCExpr * lowerConstant(const Constant *CV, const Constant *BaseCV=nullptr, uint64_t Offset=0)
Lower the specified LLVM Constant to an MCExpr.
virtual void emitStartOfAsmFile(Module &)
This virtual method can be overridden by targets that want to emit something at the start of their fi...
Definition AsmPrinter.h:622
unsigned PointerSize
The pointer size in bytes for the default address space.
Definition AsmPrinter.h:115
bool doInitialization(Module &M) override
Set up the AsmPrinter when we are working on a new module.
virtual void emitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const
This emits linkage information about GVSym based on GV, if this is supported by the target.
MCSymbol * CurrentFnSym
The symbol for the current function.
Definition AsmPrinter.h:131
MCContext & OutContext
This is the context for the output file that we are streaming.
Definition AsmPrinter.h:101
void emitVisibility(MCSymbol *Sym, unsigned Visibility, bool IsDefinition=true) const
This emits visibility information about symbol, if this is supported by the target.
void emitInt32(int Value) const
Emit a long directive and value.
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
Definition AsmPrinter.h:106
void preprocessXXStructorList(const DataLayout &DL, const Constant *List, SmallVector< Structor, 8 > &Structors)
This method gathers an array of Structors and then sorts them out by Priority.
const DataLayout & getDataLayout() const
Return information about data layout.
virtual void emitFunctionEntryLabel()
EmitFunctionEntryLabel - Emit the label that is the entrypoint for the function.
This is an important base class in LLVM.
Definition Constant.h:43
const Constant * stripPointerCasts() const
Definition Constant.h:237
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:64
LLVM_ABI unsigned getPointerSize(unsigned AS=0) const
The pointer representation size in bytes, rounded up to a whole number of bytes.
const Function & getFunction() const
Definition Function.h:167
LLVM_ABI const GlobalObject * getAliaseeObject() const
Definition Globals.cpp:730
LLVM_ABI bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
Definition Globals.cpp:408
bool hasLocalLinkage() const
LLVM_ABI const GlobalObject * getAliaseeObject() const
Definition Globals.cpp:521
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition MCExpr.h:342
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Definition MCExpr.cpp:212
Context object for machine code objects.
Definition MCContext.h:83
LLVM_ABI MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
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.
Definition MCExpr.h:34
MCInstBuilder & addReg(MCRegister Reg)
Add a new register operand.
MCInstBuilder & addImm(int64_t Val)
Add a new integer immediate operand.
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
MCSymbol * getBeginSymbol()
Definition MCSection.h:653
static const MCSpecifierExpr * create(const MCExpr *Expr, Spec S, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition MCExpr.cpp:743
StringRef getExternalName() const
bool isWeak() const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition MCExpr.h:213
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
StringRef getName() const
getName - Get the symbol name.
Definition MCSymbol.h:188
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.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
MCContext & getContext() const
Representation of each machine instruction.
LLVM_ABI void setPreInstrSymbol(MachineFunction &MF, MCSymbol *Symbol)
Set a symbol that will be emitted just prior to the instruction itself.
const GlobalValue * getGlobal() const
unsigned getTargetFlags() const
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
const char * getSymbolName() const
@ MO_GlobalAddress
Address of a global value.
@ MO_ExternalSymbol
Name of external global symbol.
iterator find(const KeyT &Key)
Definition MapVector.h:156
iterator end()
Definition MapVector.h:69
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
Wrapper class representing virtual and physical registers.
Definition Register.h:20
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition SmallString.h:26
StringRef str() const
Explicit conversion to StringRef.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
void emitInstruction(const MachineInstr *MI) override
Targets should implement this to emit instructions.
SystemZAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
const SystemZInstrInfo * getInstrInfo() const override
const TargetFrameLowering * getFrameLowering() const override
SystemZCallingConventionRegisters * getSpecialRegisters() const
XPLINK64 calling convention specific use registers Particular to z/OS when in 64 bit mode.
void emitGlobalAlias(const Module &M, const GlobalAlias &GA) override
bool doInitialization(Module &M) override
Set up the AsmPrinter when we are working on a new module.
SystemZXPLINKAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
const MCExpr * lowerConstant(const Constant *CV, const Constant *BaseCV=nullptr, uint64_t Offset=0) override
Lower the specified LLVM Constant to an MCExpr.
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 emitFunctionEntryLabel() override
EmitFunctionEntryLabel - Emit the label that is the entrypoint for the function.
void emitInstruction(const MachineInstr *MI) override
Targets should implement this to emit instructions.
void emitEndOfAsmFile(Module &M) override
This virtual method can be overridden by targets that want to emit something at the end of their file...
void emitXXStructorList(const DataLayout &DL, const Constant *List, bool IsCtor) override
This method emits llvm.global_ctors or llvm.global_dtors list.
Primary interface to the complete machine description for the target machine.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
Twine concat(const Twine &Suffix) const
Definition Twine.h:497
static Twine utohexstr(uint64_t Val)
Definition Twine.h:385
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Language[]
Key for Kernel::Metadata::mLanguage.
@ Entry
Definition COFF.h:862
LLVM_ABI std::error_code convertToEBCDIC(StringRef Source, SmallVectorImpl< char > &Result)
Converts UTF-8 text containing only code points in the range U+0000 to U+00FF to EBCDIC-1047.
const unsigned GR64Regs[16]
std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract_or_null(Y &&MD)
Extract a Value from Metadata, allowing null.
Definition Metadata.h:694
UtcTime< std::chrono::seconds > toUtcTime(std::time_t T)
Convert a std::time_t to a UtcTime.
Definition Chrono.h:44
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
@ Length
Definition DWP.cpp:577
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
detail::concat_range< ValueT, RangeTs... > concat(RangeTs &&...Ranges)
Returns a concatenated range across two or more ranges.
Definition STLExtras.h:1167
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
Definition Error.cpp:163
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
DWARFExpression::Operation Op
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1933
@ ZOS
z/OS MVS Exception Handling.
Definition CodeGen.h:64
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
@ MCSA_OSLinkage
symbol uses OS linkage (GOFF)
@ MCSA_WeakReference
.weak_reference (MachO)
@ MCSA_IndirectSymbol
.indirect_symbol (MachO)
@ MCSA_Global
.type _foo, @gnu_unique_object
@ MCSA_Extern
.extern (XCOFF)
@ MCSA_ELF_TypeObject
.type _foo, STT_OBJECT # aka @object
@ MCSA_ELF_TypeFunction
.type _foo, STT_FUNC # aka @function
@ MCSA_Hidden
.hidden (ELF)
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:878
#define N
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
llvm.global_ctors and llvm.global_dtors are arrays of Structor structs.
Definition AsmPrinter.h:555