37 Streamer.emitInstruction(MCI_STI.first, *MCI_STI.second);
44 bool EHBlock,
bool HasArgAreaLength,
bool HasName) {
45 enum class PPA1Flag1 :
uint8_t {
46 DSA64Bit = (0x80 >> 0),
50 enum class PPA1Flag2 :
uint8_t {
51 ExternalProcedure = (0x80 >> 0),
52 STACKPROTECTOR = (0x80 >> 3),
55 enum class PPA1Flag3 :
uint8_t {
56 HasArgAreaLength = (0x80 >> 1),
57 FPRMask = (0x80 >> 2),
60 enum class PPA1Flag4 :
uint8_t {
61 EPMOffsetPresent = (0x80 >> 0),
63 EHBlock = (0x80 >> 3),
64 ProcedureNamePresent = (0x80 >> 7),
69 auto Flags1 = PPA1Flag1(0);
70 auto Flags2 = PPA1Flag2::ExternalProcedure;
71 auto Flags3 = PPA1Flag3(0);
72 auto Flags4 = PPA1Flag4::EPMOffsetPresent;
74 Flags1 |= PPA1Flag1::DSA64Bit;
77 Flags1 |= PPA1Flag1::VarArg;
80 Flags2 |= PPA1Flag2::STACKPROTECTOR;
83 Flags3 |= PPA1Flag3::HasArgAreaLength;
87 Flags3 |= PPA1Flag3::FPRMask;
90 Flags4 |= PPA1Flag4::VRMask;
93 Flags4 |= PPA1Flag4::EHBlock;
96 Flags4 |= PPA1Flag4::ProcedureNamePresent;
99 OutStreamer.
AddComment(
" Bit 0: 1 = 64-bit DSA");
100 if ((Flags1 & PPA1Flag1::VarArg) == PPA1Flag1::VarArg)
101 OutStreamer.
AddComment(
" Bit 7: 1 = Vararg function");
105 if ((Flags2 & PPA1Flag2::ExternalProcedure) == PPA1Flag2::ExternalProcedure)
106 OutStreamer.
AddComment(
" Bit 0: 1 = External procedure");
107 if ((Flags2 & PPA1Flag2::STACKPROTECTOR) == PPA1Flag2::STACKPROTECTOR)
108 OutStreamer.
AddComment(
" Bit 3: 1 = STACKPROTECT is enabled");
110 OutStreamer.
AddComment(
" Bit 3: 0 = STACKPROTECT is not enabled");
114 if ((Flags3 & PPA1Flag3::HasArgAreaLength) == PPA1Flag3::HasArgAreaLength)
116 " Bit 1: 1 = Argument Area Length is in optional area");
117 if ((Flags3 & PPA1Flag3::FPRMask) == PPA1Flag3::FPRMask)
118 OutStreamer.
AddComment(
" Bit 2: 1 = FP Reg Mask is in optional area");
123 if ((Flags4 & PPA1Flag4::VRMask) == PPA1Flag4::VRMask)
124 OutStreamer.
AddComment(
" Bit 2: 1 = Vector Reg Mask is in optional area");
125 if ((Flags4 & PPA1Flag4::EHBlock) == PPA1Flag4::EHBlock)
126 OutStreamer.
AddComment(
" Bit 3: 1 = C++ EH block");
127 if ((Flags4 & PPA1Flag4::ProcedureNamePresent) ==
128 PPA1Flag4::ProcedureNamePresent)
129 OutStreamer.
AddComment(
" Bit 7: 1 = Name Length and Name");
140 OutName = OutName.
substr(0, UINT16_MAX);
141 OutSize = UINT16_MAX;
144 uint8_t ExtraZeros = 4 - ((2 + OutSize) % 4);
148 OutName = OutnameConv.
str();
173 bool HasArgAreaLength = (Info.AllocaReg != 0) || (Info.CallFrameSize > 128);
177 bool HasPersonalityFn = Info.PersonalityADADisp > 0 || Info.GCCEHADADisp > 0;
187 OutStreamer.
emitInt16(Info.SavedGPRMask);
191 emitPPA1Flags(OutStreamer, Info.IsVarArg, Info.HasStackProtector,
192 Info.SavedFPRMask != 0, Info.SavedVRMask != 0, HasPersonalityFn,
193 HasArgAreaLength, Info.Name.size() > 0);
197 static_cast<uint16_t
>(Info.SizeOfFnParams / 4));
199 OutStreamer.
AddComment(
"Length/2 of Prolog ");
200 if (Info.EndOfProlog)
206 OutStreamer.
AddComment(
"Alloca Reg + Offset/2 to SP Update");
210 const MCExpr *AllocaRegExpr =
212 if (Info.StackUpdate)
216 AllocaRegExpr, OutContext),
224 if (HasArgAreaLength) {
225 OutStreamer.
AddComment(
"Argument Area Length");
226 OutStreamer.
emitInt32(Info.CallFrameSize);
230 if (Info.SavedFPRMask) {
232 OutStreamer.
emitInt16(Info.SavedFPRMask);
235 OutStreamer.
AddComment(
"FPR Save Area Locator");
236 uint64_t FPRSaveAreaOffset = Info.OffsetFPR;
237 assert(FPRSaveAreaOffset < 0x10000000 &&
"Offset out of range");
238 FPRSaveAreaOffset &= 0x0FFFFFFF;
243 OutStreamer.
emitInt32(FPRSaveAreaOffset |
244 (Info.FrameReg << 28));
250 if (Info.SavedVRMask) {
252 OutStreamer.
emitInt8(Info.SavedVRMask);
255 uint64_t VRSaveAreaOffset = Info.OffsetVR;
256 assert(VRSaveAreaOffset < 0x10000000 &&
"Offset out of range");
257 VRSaveAreaOffset &= 0x0FFFFFFF;
258 OutStreamer.
AddComment(
"VR Save Area Locator");
263 OutStreamer.
emitInt32(VRSaveAreaOffset | (Info.FrameReg << 28));
267 if (HasPersonalityFn) {
272 OutStreamer.
AddComment(
"Personality routine");
273 OutStreamer.
emitInt64(Info.PersonalityADADisp);
275 OutStreamer.
emitInt64(Info.GCCEHADADisp);
279 if (Info.Name.size() > 0)
306 assert(
Hi &&
Lo &&
"Symbols required to calculate expression");
307 MCSymbol *Temp = Ctx.createTempSymbol();
308 OS << Temp->
getName() <<
" EQU ";
311 Ctx.getAsmInfo().printExpr(OS, *TempExpr);
319 assert(
Hi &&
Lo &&
"Symbols required to calculate expression");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file provides utility functions for converting between EBCDIC-1047 and UTF-8.
static void emitPPA1Flags(MCStreamer &OutStreamer, bool VarArg, bool StackProtector, bool FPRMask, bool VRMask, bool EHBlock, bool HasArgAreaLength, bool HasName)
static void emitPPA1Name(MCStreamer &OutStreamer, StringRef OutName)
Binary assembler expressions.
static const MCBinaryExpr * createLShr(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
static const MCBinaryExpr * createOr(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Context object for machine code objects.
const MCObjectFileInfo * getObjectFileInfo() const
Base class for the full range of assembler expressions which are needed for parsing.
MCSection * getTextSection() const
Streaming machine code generation interface.
MCContext & getContext() const
virtual void AddComment(const Twine &T, bool EOL=true)
Add a textual comment.
void emitValue(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())
virtual void emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size)
Emit the absolute difference between two symbols.
virtual void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
virtual void emitValueToAlignment(Align Alignment, int64_t Fill=0, uint8_t FillLen=1, unsigned MaxBytesToEmit=0)
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
void emitInt16(uint64_t Value)
void emitInt64(uint64_t Value)
virtual void switchSection(MCSection *Section, uint32_t Subsec=0)
Set the current section where code is being emitted to Section.
void emitInt32(uint64_t Value)
void emitZeros(uint64_t NumBytes)
Emit NumBytes worth of zeros.
void emitInt8(uint64_t Value)
virtual void emitBytes(StringRef Data)
Emit the bytes in Data into the output.
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.
MCStreamer & getStreamer()
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
StringRef str() const
Explicit conversion to 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
Get the string size.
const MCExpr * createWordDiffExpr(MCContext &Ctx, const MCSymbol *Hi, const MCSymbol *Lo) override
SystemZHLASMAsmStreamer & getHLASMStreamer()
const MCExpr * createWordDiffExpr(MCContext &Ctx, const MCSymbol *Hi, const MCSymbol *Lo) override
void emitConstantPools() override
std::pair< MCInst, const MCSubtargetInfo * > MCInstSTIPair
EXRLT2SymMap EXRLTargets2Sym
virtual const MCExpr * createWordDiffExpr(MCContext &Ctx, const MCSymbol *Hi, const MCSymbol *Lo)=0
SmallVector< PPA1Info, 0 > DeferredPPA1
void emitConstantPools() override
void emitPPA1(PPA1Info &Info)
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.
LLVM_ABI std::error_code convertToEBCDIC(StringRef Source, SmallVectorImpl< char > &Result)
constexpr size_t NameSize
This is an optimization pass for GlobalISel generic memory operations.
@ LLVM_MARK_AS_BITMASK_ENUM
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.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Information about a single function needed to emit a PPA1 block.