#include "llvm/SymbolTable.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Support/CFG.h"
-#include "Support/StringExtras.h"
-#include "Support/STLExtras.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/STLExtras.h"
#include <algorithm>
using namespace llvm;
} else if (isa<ConstantPointerNull>(CV)) {
Out << "null";
+ } else if (isa<UndefValue>(CV)) {
+ Out << "undef";
+
} else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
Out << CE->getOpcodeName() << " (";
const Module* getModule() { return TheModule; }
-private :
+private:
void printModule(const Module *M);
void printSymbolTable(const SymbolTable &ST);
void printConstant(const Constant *CPV);
} else if (const ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {
Out << '[' << ATy->getNumElements() << " x ";
printType(ATy->getElementType()) << ']';
- } else if (const OpaqueType *OTy = dyn_cast<OpaqueType>(Ty)) {
+ } else if (const PackedType *PTy = dyn_cast<PackedType>(Ty)) {
+ Out << '<' << PTy->getNumElements() << " x ";
+ printType(PTy->getElementType()) << '>';
+ }
+ else if (const OpaqueType *OTy = dyn_cast<OpaqueType>(Ty)) {
Out << "opaque";
} else {
if (!Ty->isPrimitiveType())
void AssemblyWriter::writeOperand(const Value *Operand, bool PrintType,
bool PrintName) {
+ assert(Operand != 0 && "Illegal Operand");
if (PrintType) { Out << ' '; printType(Operand->getType()); }
WriteAsOperandInternal(Out, Operand, PrintName, TypeNames, &Machine);
}
if (!M->getTargetTriple().empty())
Out << "target triple = \"" << M->getTargetTriple() << "\"\n";
- // Loop over the dependent libraries and emit them
- Module::lib_iterator LI= M->lib_begin();
- Module::lib_iterator LE= M->lib_end();
+ // Loop over the dependent libraries and emit them.
+ Module::lib_iterator LI = M->lib_begin();
+ Module::lib_iterator LE = M->lib_end();
if (LI != LE) {
- Out << "deplibs = [\n";
- while ( LI != LE ) {
- Out << "\"" << *LI << "\"";
+ Out << "deplibs = [ ";
+ while (LI != LE) {
+ Out << '"' << *LI << '"';
++LI;
- if ( LI != LE )
- Out << ",\n";
+ if (LI != LE)
+ Out << ", ";
}
Out << " ]\n";
}
-
- // Loop over the symbol table, emitting all named constants...
+
+ // Loop over the symbol table, emitting all named constants.
printSymbolTable(M->getSymbolTable());
for (Module::const_giterator I = M->gbegin(), E = M->gend(); I != E; ++I)
Out << "\nimplementation ; Functions:\n";
- // Output all of the functions...
+ // Output all of the functions.
for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
printFunction(I);
}
case GlobalValue::WeakLinkage: Out << "weak "; break;
case GlobalValue::AppendingLinkage: Out << "appending "; break;
case GlobalValue::ExternalLinkage: break;
+ case GlobalValue::GhostLinkage:
+ std::cerr << "GhostLinkage not allowed in AsmWriter!\n";
+ abort();
}
Out << (GV->isConstant() ? "constant " : "global ");
case GlobalValue::WeakLinkage: Out << "weak "; break;
case GlobalValue::AppendingLinkage: Out << "appending "; break;
case GlobalValue::ExternalLinkage: break;
+ case GlobalValue::GhostLinkage:
+ std::cerr << "GhostLinkage not allowed in AsmWriter!\n";
+ abort();
}
printType(F->getReturnType()) << ' ';