- // All that dis does is write the assembly or C out to a file... which is
- // exactly what the writer or cwriter library is supposed to do...
- if (WriteMode == Default) {
- (*Out) << M; // Print out in list order
- } else if (WriteMode == c) {
- WriteToC(M, *Out);
- } else {
- // TODO: This does not print anything other than the basic blocks in the
- // functions... more should definately be printed. It should be valid
- // output consumable by the assembler.
- //
- for (Module::iterator I = M->begin(), End = M->end(); I != End; ++I) {
- Function *F = *I;
- (*Out) << "-------------- Method: " << F->getName() << " -------------\n";
-
- switch (WriteMode) {
- case dfo: // Depth First ordering
- copy(df_begin(F), df_end(F),
- std::ostream_iterator<BasicBlock*>(*Out, "\n"));
- break;
- case rdfo: // Reverse Depth First ordering
- copy(df_begin(F, true), df_end(F),
- std::ostream_iterator<BasicBlock*>(*Out, "\n"));
- break;
- case po: // Post Order
- copy(po_begin(F), po_end(F),
- std::ostream_iterator<BasicBlock*>(*Out, "\n"));
- break;
- case rpo: { // Reverse Post Order
-#if 0 // FIXME, GCC 3.0.4 bug
- ReversePostOrderTraversal<Function*> RPOT(F);
- copy(RPOT.begin(), RPOT.end(),
- std::ostream_iterator<BasicBlock*>(*Out, "\n"));
-#endif
- break;
- }
- default:
- abort();
- break;
- }
- }