X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FVMCore%2FAsmWriter.cpp;h=d8a1394497b7c4b4f30b75719e990de3b453d510;hb=ce8a14915d2971039b576e03a32e0ba7c421dba7;hp=e33d9f400ab4b584595b3f1dae09563afeab68ab;hpb=c1b2718acf9d566c26188f2968dece0bf3f187e3;p=oota-llvm.git diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index e33d9f400ab..d8a1394497b 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -29,8 +29,10 @@ using std::map; using std::vector; using std::ostream; -static RegisterPass X("printm", "Print module to stderr"); -static RegisterPass Y("print", "Print function to stderr"); +static RegisterPass +X("printm", "Print module to stderr",PassInfo::Analysis|PassInfo::Optimization); +static RegisterPass +Y("print","Print function to stderr",PassInfo::Analysis|PassInfo::Optimization); static void WriteAsOperandInternal(ostream &Out, const Value *V, bool PrintName, map &TypeTable, @@ -269,7 +271,7 @@ static void WriteConstantInt(ostream &Out, const Constant *CV, bool PrintName, (unsigned char)cast(CA->getOperand(i))->getValue() : (unsigned char)cast(CA->getOperand(i))->getValue(); - if (isprint(C) && C != '"') { + if (isprint(C) && C != '"' && C != '\\') { Out << C; } else { Out << '\\' @@ -331,21 +333,25 @@ static void WriteConstantInt(ostream &Out, const Constant *CV, bool PrintName, Out << ""; } - } else if (const ConstantExpr *CE=dyn_cast(CV)) { + } else if (const ConstantExpr *CE = dyn_cast(CV)) { Out << CE->getOpcodeName(); bool isGEP = CE->getOpcode() == Instruction::GetElementPtr; - Out << (isGEP? " (" : " "); + Out << " ("; for (User::const_op_iterator OI=CE->op_begin(); OI != CE->op_end(); ++OI) { printTypeInt(Out, (*OI)->getType(), TypeTable); WriteAsOperandInternal(Out, *OI, PrintName, TypeTable, Table); if (OI+1 != CE->op_end()) - Out << ", "; // ((isGEP && OI == CE->op_begin())? " " : ", "); + Out << ", "; } - if (isGEP) - Out << ")"; + if (CE->getOpcode() == Instruction::Cast) { + Out << " to "; + printTypeInt(Out, CE->getType(), TypeTable); + } + Out << ")"; + } else { Out << ""; }