36 Streamer.emitInstruction(MCI_STI.first, *MCI_STI.second);
43 bool EHBlock,
bool HasArgAreaLength,
bool HasName) {
44 enum class PPA1Flag1 :
uint8_t {
45 DSA64Bit = (0x80 >> 0),
49 enum class PPA1Flag2 :
uint8_t {
50 ExternalProcedure = (0x80 >> 0),
51 STACKPROTECTOR = (0x80 >> 3),
54 enum class PPA1Flag3 :
uint8_t {
55 HasArgAreaLength = (0x80 >> 1),
56 FPRMask = (0x80 >> 2),
59 enum class PPA1Flag4 :
uint8_t {
60 EPMOffsetPresent = (0x80 >> 0),
62 EHBlock = (0x80 >> 3),
63 ProcedureNamePresent = (0x80 >> 7),
68 auto Flags1 = PPA1Flag1(0);
69 auto Flags2 = PPA1Flag2::ExternalProcedure;
70 auto Flags3 = PPA1Flag3(0);
71 auto Flags4 = PPA1Flag4::EPMOffsetPresent;
73 Flags1 |= PPA1Flag1::DSA64Bit;
76 Flags1 |= PPA1Flag1::VarArg;
79 Flags2 |= PPA1Flag2::STACKPROTECTOR;
82 Flags3 |= PPA1Flag3::HasArgAreaLength;
86 Flags3 |= PPA1Flag3::FPRMask;
89 Flags4 |= PPA1Flag4::VRMask;
92 Flags4 |= PPA1Flag4::EHBlock;
95 Flags4 |= PPA1Flag4::ProcedureNamePresent;
98 OutStreamer.
AddComment(
" Bit 0: 1 = 64-bit DSA");
99 if ((Flags1 & PPA1Flag1::VarArg) == PPA1Flag1::VarArg)
100 OutStreamer.
AddComment(
" Bit 7: 1 = Vararg function");
104 if ((Flags2 & PPA1Flag2::ExternalProcedure) == PPA1Flag2::ExternalProcedure)
105 OutStreamer.
AddComment(
" Bit 0: 1 = External procedure");
106 if ((Flags2 & PPA1Flag2::STACKPROTECTOR) == PPA1Flag2::STACKPROTECTOR)
107 OutStreamer.
AddComment(
" Bit 3: 1 = STACKPROTECT is enabled");
109 OutStreamer.
AddComment(
" Bit 3: 0 = STACKPROTECT is not enabled");
113 if ((Flags3 & PPA1Flag3::HasArgAreaLength) == PPA1Flag3::HasArgAreaLength)
115 " Bit 1: 1 = Argument Area Length is in optional area");
116 if ((Flags3 & PPA1Flag3::FPRMask) == PPA1Flag3::FPRMask)
117 OutStreamer.
AddComment(
" Bit 2: 1 = FP Reg Mask is in optional area");
122 if ((Flags4 & PPA1Flag4::VRMask) == PPA1Flag4::VRMask)
123 OutStreamer.
AddComment(
" Bit 2: 1 = Vector Reg Mask is in optional area");
124 if ((Flags4 & PPA1Flag4::EHBlock) == PPA1Flag4::EHBlock)
125 OutStreamer.
AddComment(
" Bit 3: 1 = C++ EH block");
126 if ((Flags4 & PPA1Flag4::ProcedureNamePresent) ==
127 PPA1Flag4::ProcedureNamePresent)
128 OutStreamer.
AddComment(
" Bit 7: 1 = Name Length and Name");
139 OutName = OutName.
substr(0, UINT16_MAX);
140 OutSize = UINT16_MAX;
143 uint8_t ExtraZeros = 4 - ((2 + OutSize) % 4);
147 OutName = OutnameConv.
str();
171 bool HasArgAreaLength = (Info.AllocaReg != 0) || (Info.CallFrameSize > 128);
175 bool HasPersonalityFn = Info.PersonalityADADisp > 0 || Info.GCCEHADADisp > 0;
185 OutStreamer.
emitInt16(Info.SavedGPRMask);
189 emitPPA1Flags(OutStreamer, Info.IsVarArg, Info.HasStackProtector,
190 Info.SavedFPRMask != 0, Info.SavedVRMask != 0, HasPersonalityFn,
191 HasArgAreaLength, Info.Name.size() > 0);
195 static_cast<uint16_t
>(Info.SizeOfFnParams / 4));
197 OutStreamer.
AddComment(
"Length/2 of Prolog ");
198 if (Info.EndOfProlog)
204 OutStreamer.
AddComment(
"Alloca Reg + Offset/2 to SP Update");
208 const MCExpr *AllocaRegExpr =
210 if (Info.StackUpdate)
214 AllocaRegExpr, OutContext),
222 if (HasArgAreaLength) {
223 OutStreamer.
AddComment(
"Argument Area Length");
224 OutStreamer.
emitInt32(Info.CallFrameSize);
228 if (Info.SavedFPRMask) {
230 OutStreamer.
emitInt16(Info.SavedFPRMask);
233 OutStreamer.
AddComment(
"FPR Save Area Locator");
234 uint64_t FPRSaveAreaOffset = Info.OffsetFPR;
235 assert(FPRSaveAreaOffset < 0x10000000 &&
"Offset out of range");
236 FPRSaveAreaOffset &= 0x0FFFFFFF;
241 OutStreamer.
emitInt32(FPRSaveAreaOffset |
242 (Info.FrameReg << 28));
248 if (Info.SavedVRMask) {
250 OutStreamer.
emitInt8(Info.SavedVRMask);
253 uint64_t VRSaveAreaOffset = Info.OffsetVR;
254 assert(VRSaveAreaOffset < 0x10000000 &&
"Offset out of range");
255 VRSaveAreaOffset &= 0x0FFFFFFF;
256 OutStreamer.
AddComment(
"VR Save Area Locator");
261 OutStreamer.
emitInt32(VRSaveAreaOffset | (Info.FrameReg << 28));
265 if (HasPersonalityFn) {
270 OutStreamer.
AddComment(
"Personality routine");
271 OutStreamer.
emitInt64(Info.PersonalityADADisp);
273 OutStreamer.
emitInt64(Info.GCCEHADADisp);
277 if (Info.Name.size() > 0)
304 assert(
Hi &&
Lo &&
"Symbols required to calculate expression");
305 MCSymbol *Temp = Ctx.createTempSymbol();
306 OS << Temp->
getName() <<
" EQU ";
309 Ctx.getAsmInfo().printExpr(OS, *TempExpr);
317 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.
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.
Information about a single function needed to emit a PPA1 block.