Remove support for unary operators.
[oota-llvm.git] / lib / VMCore / AsmWriter.cpp
index 091cda85ca7781e50c79e8073936cc847a544a71..aeca6f7e21eacc883b2fe0a020bcef58feacbadd 100644 (file)
@@ -29,8 +29,10 @@ using std::map;
 using std::vector;
 using std::ostream;
 
-static RegisterPass<PrintModulePass>   X("printm", "Print module to stderr");
-static RegisterPass<PrintFunctionPass> Y("print", "Print function to stderr");
+static RegisterPass<PrintModulePass>
+X("printm", "Print module to stderr",PassInfo::Analysis|PassInfo::Optimization);
+static RegisterPass<PrintFunctionPass>
+Y("print","Print function to stderr",PassInfo::Analysis|PassInfo::Optimization);
 
 static void WriteAsOperandInternal(ostream &Out, const Value *V, bool PrintName,
                                    map<const Type *, string> &TypeTable,
@@ -269,7 +271,7 @@ static void WriteConstantInt(ostream &Out, const Constant *CV, bool PrintName,
           (unsigned char)cast<ConstantSInt>(CA->getOperand(i))->getValue() :
           (unsigned char)cast<ConstantUInt>(CA->getOperand(i))->getValue();
         
-        if (isprint(C) && C != '"') {
+        if (isprint(C) && C != '"' && C != '\\') {
           Out << C;
         } else {
           Out << '\\'
@@ -331,7 +333,7 @@ static void WriteConstantInt(ostream &Out, const Constant *CV, bool PrintName,
       Out << "<pointer reference without context info>";
     }
 
-  } else if (const ConstantExpr *CE=dyn_cast<ConstantExpr>(CV)) {
+  } else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
     Out << CE->getOpcodeName();
 
     bool isGEP = CE->getOpcode() == Instruction::GetElementPtr;
@@ -341,7 +343,7 @@ static void WriteConstantInt(ostream &Out, const Constant *CV, bool PrintName,
       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)
@@ -750,7 +752,7 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
     //
     if (RetTy && MTy && !MTy->isVarArg() &&
         (!isa<PointerType>(RetTy) || 
-         !isa<FunctionType>(cast<PointerType>(RetTy)))) {
+         !isa<FunctionType>(cast<PointerType>(RetTy)->getElementType()))) {
       Out << " "; printType(RetTy);
       writeOperand(Operand, false);
     } else {