diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-01-17 20:45:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-01-17 20:45:01 +0000 |
commit | 706b4fc47bbc608932d3b491ae19a3b9cde9497b (patch) | |
tree | 4adf86a776049cbf7f69a1929c4babcbbef925eb /llvm/lib/IR/AsmWriter.cpp | |
parent | 7cc9cf2bf09f069cb2dd947ead05d0b54301fb71 (diff) | |
download | src-706b4fc47bbc608932d3b491ae19a3b9cde9497b.tar.gz src-706b4fc47bbc608932d3b491ae19a3b9cde9497b.zip |
Vendor import of llvm-project master e26a78e70, the last commit beforevendor/llvm-project/llvmorg-10-init-17466-ge26a78e7085
the llvmorg-11-init tag, from which release/10.x was branched.
Notes
Notes:
svn path=/vendor/llvm-project/master/; revision=356843
svn path=/vendor/llvm-project/llvmorg-10-init-17466-ge26a78e7085/; revision=356844; tag=vendor/llvm-project/llvmorg-10-init-17466-ge26a78e7085
Diffstat (limited to 'llvm/lib/IR/AsmWriter.cpp')
-rw-r--r-- | llvm/lib/IR/AsmWriter.cpp | 65 |
1 files changed, 50 insertions, 15 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp index b0c26e0ecaf5..acf0e4afef27 100644 --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -353,6 +353,7 @@ static void PrintCallingConv(unsigned cc, raw_ostream &Out) { case CallingConv::CXX_FAST_TLS: Out << "cxx_fast_tlscc"; break; case CallingConv::GHC: Out << "ghccc"; break; case CallingConv::Tail: Out << "tailcc"; break; + case CallingConv::CFGuard_Check: Out << "cfguard_checkcc"; break; case CallingConv::X86_StdCall: Out << "x86_stdcallcc"; break; case CallingConv::X86_FastCall: Out << "x86_fastcallcc"; break; case CallingConv::X86_ThisCall: Out << "x86_thiscallcc"; break; @@ -363,6 +364,9 @@ static void PrintCallingConv(unsigned cc, raw_ostream &Out) { case CallingConv::ARM_AAPCS: Out << "arm_aapcscc"; break; case CallingConv::ARM_AAPCS_VFP: Out << "arm_aapcs_vfpcc"; break; case CallingConv::AArch64_VectorCall: Out << "aarch64_vector_pcs"; break; + case CallingConv::AArch64_SVE_VectorCall: + Out << "aarch64_sve_vector_pcs"; + break; case CallingConv::MSP430_INTR: Out << "msp430_intrcc"; break; case CallingConv::AVR_INTR: Out << "avr_intrcc "; break; case CallingConv::AVR_SIGNAL: Out << "avr_signalcc "; break; @@ -2053,7 +2057,7 @@ static void writeDIModule(raw_ostream &Out, const DIModule *N, Printer.printString("name", N->getName()); Printer.printString("configMacros", N->getConfigurationMacros()); Printer.printString("includePath", N->getIncludePath()); - Printer.printString("isysroot", N->getISysRoot()); + Printer.printString("sysroot", N->getSysRoot()); Out << ")"; } @@ -2395,6 +2399,8 @@ public: void writeAllMDNodes(); void writeMDNode(unsigned Slot, const MDNode *Node); + void writeAttribute(const Attribute &Attr, bool InAttrGroup = false); + void writeAttributeSet(const AttributeSet &AttrSet, bool InAttrGroup = false); void writeAllAttributeGroups(); void printTypeIdentities(); @@ -2527,8 +2533,10 @@ void AssemblyWriter::writeParamOperand(const Value *Operand, // Print the type TypePrinter.print(Operand->getType(), Out); // Print parameter attributes list - if (Attrs.hasAttributes()) - Out << ' ' << Attrs.getAsString(); + if (Attrs.hasAttributes()) { + Out << ' '; + writeAttributeSet(Attrs); + } Out << ' '; // Print the operand WriteAsOperandInternal(Out, Operand, &TypePrinter, &Machine, TheModule); @@ -2951,13 +2959,14 @@ void AssemblyWriter::printFunctionSummary(const FunctionSummary *FS) { FunctionSummary::FFlags FFlags = FS->fflags(); if (FFlags.ReadNone | FFlags.ReadOnly | FFlags.NoRecurse | - FFlags.ReturnDoesNotAlias | FFlags.NoInline) { + FFlags.ReturnDoesNotAlias | FFlags.NoInline | FFlags.AlwaysInline) { Out << ", funcFlags: ("; Out << "readNone: " << FFlags.ReadNone; Out << ", readOnly: " << FFlags.ReadOnly; Out << ", noRecurse: " << FFlags.NoRecurse; Out << ", returnDoesNotAlias: " << FFlags.ReturnDoesNotAlias; Out << ", noInline: " << FFlags.NoInline; + Out << ", alwaysInline: " << FFlags.AlwaysInline; Out << ")"; } if (!FS->calls().empty()) { @@ -3395,9 +3404,6 @@ void AssemblyWriter::printTypeIdentities() { /// printFunction - Print all aspects of a function. void AssemblyWriter::printFunction(const Function *F) { - // Print out the return type and name. - Out << '\n'; - if (AnnotationWriter) AnnotationWriter->emitFunctionAnnot(F, Out); if (F->isMaterializable()) @@ -3460,8 +3466,10 @@ void AssemblyWriter::printFunction(const Function *F) { TypePrinter.print(FT->getParamType(I), Out); AttributeSet ArgAttrs = Attrs.getParamAttributes(I); - if (ArgAttrs.hasAttributes()) - Out << ' ' << ArgAttrs.getAsString(); + if (ArgAttrs.hasAttributes()) { + Out << ' '; + writeAttributeSet(ArgAttrs); + } } } else { // The arguments are meaningful here, print them in detail. @@ -3547,8 +3555,10 @@ void AssemblyWriter::printArgument(const Argument *Arg, AttributeSet Attrs) { TypePrinter.print(Arg->getType(), Out); // Output parameter attributes list - if (Attrs.hasAttributes()) - Out << ' ' << Attrs.getAsString(); + if (Attrs.hasAttributes()) { + Out << ' '; + writeAttributeSet(Attrs); + } // Output name, if available... if (Arg->hasName()) { @@ -3563,6 +3573,7 @@ void AssemblyWriter::printArgument(const Argument *Arg, AttributeSet Attrs) { /// printBasicBlock - This member is called for each basic block in a method. void AssemblyWriter::printBasicBlock(const BasicBlock *BB) { + assert(BB && BB->getParent() && "block without parent!"); bool IsEntryBlock = BB == &BB->getParent()->getEntryBlock(); if (BB->hasName()) { // Print out the label if it exists... Out << "\n"; @@ -3577,10 +3588,7 @@ void AssemblyWriter::printBasicBlock(const BasicBlock *BB) { Out << "<badref>:"; } - if (!BB->getParent()) { - Out.PadToColumn(50); - Out << "; Error: Block without parent!"; - } else if (!IsEntryBlock) { + if (!IsEntryBlock) { // Output predecessors for the block. Out.PadToColumn(50); Out << ";"; @@ -4126,6 +4134,33 @@ void AssemblyWriter::printMDNodeBody(const MDNode *Node) { WriteMDNodeBodyInternal(Out, Node, &TypePrinter, &Machine, TheModule); } +void AssemblyWriter::writeAttribute(const Attribute &Attr, bool InAttrGroup) { + if (!Attr.isTypeAttribute()) { + Out << Attr.getAsString(InAttrGroup); + return; + } + + assert(Attr.hasAttribute(Attribute::ByVal) && "unexpected type attr"); + + Out << "byval"; + if (Type *Ty = Attr.getValueAsType()) { + Out << '('; + TypePrinter.print(Ty, Out); + Out << ')'; + } +} + +void AssemblyWriter::writeAttributeSet(const AttributeSet &AttrSet, + bool InAttrGroup) { + bool FirstAttr = true; + for (const auto &Attr : AttrSet) { + if (!FirstAttr) + Out << ' '; + writeAttribute(Attr, InAttrGroup); + FirstAttr = false; + } +} + void AssemblyWriter::writeAllAttributeGroups() { std::vector<std::pair<AttributeSet, unsigned>> asVec; asVec.resize(Machine.as_size()); |