00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00027 #include "ShBasicBlock.hpp"
00028 #include <iostream>
00029 #include "ShUtility.hpp"
00030
00031 namespace SH {
00032
00033 ShBasicBlock::~ShBasicBlock()
00034 {
00035 }
00036
00037 void ShBasicBlock::print(std::ostream& out, int indent) const
00038 {
00039 using std::endl;
00040
00041 shPrintIndent(out, indent);
00042 out << "{" << endl;
00043 for (ShStmtList::const_iterator I = m_statements.begin();
00044 I != m_statements.end(); ++I) {
00045 shPrintIndent(out, indent + 2);
00046 out << *I << endl;
00047 }
00048 shPrintIndent(out, indent);
00049 out << "}" << endl;
00050 }
00051
00052 void ShBasicBlock::graphvizDump(std::ostream& out) const
00053 {
00054 for (ShStmtList::const_iterator I = m_statements.begin();
00055 I != m_statements.end(); ++I) {
00056 out << *I << "\\n";
00057 }
00058 }
00059
00060 void ShBasicBlock::addStatement(const ShStatement& stmt)
00061 {
00062 m_statements.push_back(stmt);
00063 }
00064
00065 void ShBasicBlock::prependStatement(const ShStatement& stmt)
00066 {
00067 m_statements.push_front(stmt);
00068 }
00069
00070 ShBasicBlock::ShStmtList::const_iterator ShBasicBlock::begin() const
00071 {
00072 return m_statements.begin();
00073 }
00074
00075 ShBasicBlock::ShStmtList::const_iterator ShBasicBlock::end() const
00076 {
00077 return m_statements.end();
00078 }
00079
00080 ShBasicBlock::ShStmtList::iterator ShBasicBlock::begin()
00081 {
00082 return m_statements.begin();
00083 }
00084
00085 ShBasicBlock::ShStmtList::iterator ShBasicBlock::end()
00086 {
00087 return m_statements.end();
00088 }
00089
00090
00091 }