X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=lib%2FIR%2FAsmWriter.cpp;h=185db47f07e5f1fd735cbc02aba25f26ee037002;hp=fae1ebee5f2a1011ae2a76281177dade80614d96;hb=9889174eadb0f269ef132b3bd34a9f6fe3baa642;hpb=d8def4abd185c430d7649be9347778612c296871 diff --git a/lib/IR/AsmWriter.cpp b/lib/IR/AsmWriter.cpp index fae1ebee5f2..185db47f07e 100644 --- a/lib/IR/AsmWriter.cpp +++ b/lib/IR/AsmWriter.cpp @@ -103,17 +103,9 @@ static OrderMap orderModule(const Module *M) { orderValue(&A, OM); } for (const Function &F : *M) { - if (F.hasPrefixData()) - if (!isa(F.getPrefixData())) - orderValue(F.getPrefixData(), OM); - - if (F.hasPrologueData()) - if (!isa(F.getPrologueData())) - orderValue(F.getPrologueData(), OM); - - if (F.hasPersonalityFn()) - if (!isa(F.getPersonalityFn())) - orderValue(F.getPersonalityFn(), OM); + for (const Use &U : F.operands()) + if (!isa(U.get())) + orderValue(U.get(), OM); orderValue(&F, OM); @@ -263,8 +255,8 @@ static UseListOrderStack predictUseListOrder(const Module *M) { for (const GlobalAlias &A : M->aliases()) predictValueUseListOrder(A.getAliasee(), nullptr, OM, Stack); for (const Function &F : *M) - if (F.hasPrefixData()) - predictValueUseListOrder(F.getPrefixData(), nullptr, OM, Stack); + for (const Use &U : F.operands()) + predictValueUseListOrder(U.get(), nullptr, OM, Stack); return Stack; } @@ -304,6 +296,7 @@ static void PrintCallingConv(unsigned cc, raw_ostream &Out) { case CallingConv::AnyReg: Out << "anyregcc"; break; case CallingConv::PreserveMost: Out << "preserve_mostcc"; break; case CallingConv::PreserveAll: Out << "preserve_allcc"; break; + case CallingConv::CXX_FAST_TLS: Out << "cxx_fast_tlscc"; break; case CallingConv::GHC: Out << "ghccc"; break; case CallingConv::X86_StdCall: Out << "x86_stdcallcc"; break; case CallingConv::X86_FastCall: Out << "x86_fastcallcc"; break; @@ -320,6 +313,7 @@ static void PrintCallingConv(unsigned cc, raw_ostream &Out) { case CallingConv::X86_64_Win64: Out << "x86_64_win64cc"; break; case CallingConv::SPIR_FUNC: Out << "spir_func"; break; case CallingConv::SPIR_KERNEL: Out << "spir_kernel"; break; + case CallingConv::X86_INTR: Out << "x86_intrcc"; break; case CallingConv::HHVM: Out << "hhvmcc"; break; case CallingConv::HHVM_C: Out << "hhvm_ccc"; break; } @@ -1395,6 +1389,7 @@ struct MDFieldPrinter { : Out(Out), TypePrinter(TypePrinter), Machine(Machine), Context(Context) { } void printTag(const DINode *N); + void printMacinfoType(const DIMacroNode *N); void printString(StringRef Name, StringRef Value, bool ShouldSkipEmpty = true); void printMetadata(StringRef Name, const Metadata *MD, @@ -1417,6 +1412,14 @@ void MDFieldPrinter::printTag(const DINode *N) { Out << N->getTag(); } +void MDFieldPrinter::printMacinfoType(const DIMacroNode *N) { + Out << FS << "type: "; + if (const char *Type = dwarf::MacinfoString(N->getMacinfoType())) + Out << Type; + else + Out << N->getMacinfoType(); +} + void MDFieldPrinter::printString(StringRef Name, StringRef Value, bool ShouldSkipEmpty) { if (ShouldSkipEmpty && Value.empty()) @@ -1642,6 +1645,7 @@ static void writeDICompileUnit(raw_ostream &Out, const DICompileUnit *N, Printer.printMetadata("subprograms", N->getRawSubprograms()); Printer.printMetadata("globals", N->getRawGlobalVariables()); Printer.printMetadata("imports", N->getRawImportedEntities()); + Printer.printMetadata("macros", N->getRawMacros()); Printer.printInt("dwoId", N->getDWOId()); Out << ")"; } @@ -1710,6 +1714,29 @@ static void writeDINamespace(raw_ostream &Out, const DINamespace *N, Out << ")"; } +static void writeDIMacro(raw_ostream &Out, const DIMacro *N, + TypePrinting *TypePrinter, SlotTracker *Machine, + const Module *Context) { + Out << "!DIMacro("; + MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); + Printer.printMacinfoType(N); + Printer.printInt("line", N->getLine()); + Printer.printString("name", N->getName()); + Printer.printString("value", N->getValue()); + Out << ")"; +} + +static void writeDIMacroFile(raw_ostream &Out, const DIMacroFile *N, + TypePrinting *TypePrinter, SlotTracker *Machine, + const Module *Context) { + Out << "!DIMacroFile("; + MDFieldPrinter Printer(Out, TypePrinter, Machine, Context); + Printer.printInt("line", N->getLine()); + Printer.printMetadata("file", N->getRawFile(), /* ShouldSkipNull */ false); + Printer.printMetadata("nodes", N->getRawElements()); + Out << ")"; +} + static void writeDIModule(raw_ostream &Out, const DIModule *N, TypePrinting *TypePrinter, SlotTracker *Machine, const Module *Context) { @@ -2856,69 +2883,48 @@ void AssemblyWriter::printInstruction(const Instruction &I) { writeOperand(LPI->getClause(i), true); } - } else if (const auto *CPI = dyn_cast(&I)) { - Out << " ["; - for (unsigned Op = 0, NumOps = CPI->getNumArgOperands(); Op < NumOps; - ++Op) { - if (Op > 0) - Out << ", "; - writeOperand(CPI->getArgOperand(Op), /*PrintType=*/true); - } - Out << "]\n to "; - writeOperand(CPI->getNormalDest(), /*PrintType=*/true); - Out << " unwind "; - writeOperand(CPI->getUnwindDest(), /*PrintType=*/true); - } else if (const auto *TPI = dyn_cast(&I)) { + } else if (const auto *CatchSwitch = dyn_cast(&I)) { + Out << " within "; + writeOperand(CatchSwitch->getParentPad(), /*PrintType=*/false); Out << " ["; - for (unsigned Op = 0, NumOps = TPI->getNumArgOperands(); Op < NumOps; - ++Op) { + unsigned Op = 0; + for (const BasicBlock *PadBB : CatchSwitch->handlers()) { if (Op > 0) Out << ", "; - writeOperand(TPI->getArgOperand(Op), /*PrintType=*/true); + writeOperand(PadBB, /*PrintType=*/true); + ++Op; } Out << "] unwind "; - if (TPI->hasUnwindDest()) - writeOperand(TPI->getUnwindDest(), /*PrintType=*/true); + if (const BasicBlock *UnwindDest = CatchSwitch->getUnwindDest()) + writeOperand(UnwindDest, /*PrintType=*/true); else Out << "to caller"; - } else if (const auto *CPI = dyn_cast(&I)) { + } else if (const auto *FPI = dyn_cast(&I)) { + Out << " within "; + writeOperand(FPI->getParentPad(), /*PrintType=*/false); Out << " ["; - for (unsigned Op = 0, NumOps = CPI->getNumOperands(); Op < NumOps; ++Op) { + for (unsigned Op = 0, NumOps = FPI->getNumArgOperands(); Op < NumOps; + ++Op) { if (Op > 0) Out << ", "; - writeOperand(CPI->getOperand(Op), /*PrintType=*/true); + writeOperand(FPI->getArgOperand(Op), /*PrintType=*/true); } - Out << "]"; + Out << ']'; } else if (isa(I) && !Operand) { Out << " void"; } else if (const auto *CRI = dyn_cast(&I)) { - Out << ' '; - writeOperand(CRI->getCatchPad(), /*PrintType=*/false); + Out << " from "; + writeOperand(CRI->getOperand(0), /*PrintType=*/false); Out << " to "; - writeOperand(CRI->getSuccessor(), /*PrintType=*/true); + writeOperand(CRI->getOperand(1), /*PrintType=*/true); } else if (const auto *CRI = dyn_cast(&I)) { - Out << ' '; - writeOperand(CRI->getCleanupPad(), /*PrintType=*/false); + Out << " from "; + writeOperand(CRI->getOperand(0), /*PrintType=*/false); Out << " unwind "; if (CRI->hasUnwindDest()) - writeOperand(CRI->getUnwindDest(), /*PrintType=*/true); - else - Out << "to caller"; - } else if (const auto *CEPI = dyn_cast(&I)) { - Out << " unwind "; - if (CEPI->hasUnwindDest()) - writeOperand(CEPI->getUnwindDest(), /*PrintType=*/true); - else - Out << "to caller"; - } else if (const auto *CEPI = dyn_cast(&I)) { - Out << ' '; - writeOperand(CEPI->getCleanupPad(), /*PrintType=*/false); - - Out << " unwind "; - if (CEPI->hasUnwindDest()) - writeOperand(CEPI->getUnwindDest(), /*PrintType=*/true); + writeOperand(CRI->getOperand(1), /*PrintType=*/true); else Out << "to caller"; } else if (const CallInst *CI = dyn_cast(&I)) {