1 #include "llvm/Reoptimizer/Mapping/FInfo.h"
3 #include "llvm/Module.h"
7 class FunctionInfo : public Pass {
10 FunctionInfo(std::ostream &out) : Out(out){}
11 const char* getPassName() const{return "Sparc FunctionInfo";}
14 void FunctionInfo::writePrologue(const char *area,
16 void FunctionInfo::writeEpilogue(const char *area,
21 Pass *getFunctionInfo(std::ostream &out){
22 return new FunctionInfo(out);
25 bool FunctionInfo::run(Module &M){
28 writePrologue("FUNCTION MAP", "FunctionBB");
30 for(Module::iterator FI=M.begin(), FE=M.end(); FE!=FI; ++FI){
31 if(FI->isExternal()) continue;
32 Out << "\t.xword BBMIMap"<<f<<"\n";
35 writeEpilogue("FUNCTION MAP", "FunctionBB");
37 writePrologue("FUNCTION MAP", "FunctionLI");
39 for(Module::iterator FI=M.begin(), FE=M.end(); FE!=FI; ++FI){
40 if(FI->isExternal()) continue;
41 Out << "\t.xword LMIMap"<<f<<"\n";
44 writeEpilogue("FUNCTION MAP", "FunctionLI");
51 void FunctionInfo::writePrologue(const char *area,
53 Out << "\n\n\n!"<<area<<"\n";
54 Out << "\t.section \".rodata\"\n\t.align 8\n";
55 Out << "\t.global "<<label<<"\n";
56 Out << "\t.type "<<label<<",#object\n";
58 //Out << "\t.word .end_"<<label<<"-"<<label<<"\n";
61 void FunctionInfo::writeEpilogue(const char *area,
63 Out << ".end_" << label << ":\n";
64 Out << "\t.size " << label << ", .end_"
65 << label << "-" << label << "\n\n\n\n";
67 //Out << "\n\n!" << area << " Length\n";
68 //Out << "\t.section \".bbdata\",#alloc,#write\n";
69 //Out << "\t.global " << label << "_length\n";
70 //Out << "\t.align 4\n";
71 //Out << "\t.type " << label << "_length,#object\n";
72 //Out << "\t.size "<< label <<"_length,4\n";
73 //Out << label <<" _length:\n";
74 //Out << "\t.word\t.end_"<<label<<"-"<<label<<"\n\n\n\n";