aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/Mapping/FInfo.cpp
diff options
context:
space:
mode:
authorAnand Shukla <ashukla@cs.uiuc.edu>2002-08-27 22:47:33 +0000
committerAnand Shukla <ashukla@cs.uiuc.edu>2002-08-27 22:47:33 +0000
commitb85d265b16110454a466db9e909a727b746e6c30 (patch)
tree0188bb29b38614707cd9cbeb61e8c363974adb8d /lib/CodeGen/Mapping/FInfo.cpp
parent894e83010014ac3f3a59a8e5362fa454e37994b3 (diff)
moved this file from lib/Reoptimizer/Mapping
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3519 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/Mapping/FInfo.cpp')
-rwxr-xr-xlib/CodeGen/Mapping/FInfo.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/lib/CodeGen/Mapping/FInfo.cpp b/lib/CodeGen/Mapping/FInfo.cpp
new file mode 100755
index 0000000000..504baec154
--- /dev/null
+++ b/lib/CodeGen/Mapping/FInfo.cpp
@@ -0,0 +1,75 @@
+#include "llvm/Reoptimizer/Mapping/FInfo.h"
+#include "llvm/Pass.h"
+#include "llvm/Module.h"
+
+
+namespace {
+ class FunctionInfo : public Pass {
+ std::ostream &Out;
+ public:
+ FunctionInfo(std::ostream &out) : Out(out){}
+ const char* getPassName() const{return "Sparc FunctionInfo";}
+ bool run(Module &M);
+ private:
+ void FunctionInfo::writePrologue(const char *area,
+ const char *label);
+ void FunctionInfo::writeEpilogue(const char *area,
+ const char *label);
+ };
+}
+
+Pass *getFunctionInfo(std::ostream &out){
+ return new FunctionInfo(out);
+}
+
+bool FunctionInfo::run(Module &M){
+ unsigned f;
+
+ writePrologue("FUNCTION MAP", "FunctionBB");
+ f=0;
+ for(Module::iterator FI=M.begin(), FE=M.end(); FE!=FI; ++FI){
+ if(FI->isExternal()) continue;
+ Out << "\t.xword BBMIMap"<<f<<"\n";
+ ++f;
+ }
+ writeEpilogue("FUNCTION MAP", "FunctionBB");
+
+ writePrologue("FUNCTION MAP", "FunctionLI");
+ f=0;
+ for(Module::iterator FI=M.begin(), FE=M.end(); FE!=FI; ++FI){
+ if(FI->isExternal()) continue;
+ Out << "\t.xword LMIMap"<<f<<"\n";
+ ++f;
+ }
+ writeEpilogue("FUNCTION MAP", "FunctionLI");
+
+
+ return false;
+}
+
+
+void FunctionInfo::writePrologue(const char *area,
+ const char *label){
+ Out << "\n\n\n!"<<area<<"\n";
+ Out << "\t.section \".rodata\"\n\t.align 8\n";
+ Out << "\t.global "<<label<<"\n";
+ Out << "\t.type "<<label<<",#object\n";
+ Out << label<<":\n";
+ //Out << "\t.word .end_"<<label<<"-"<<label<<"\n";
+}
+
+void FunctionInfo::writeEpilogue(const char *area,
+ const char *label){
+ Out << ".end_" << label << ":\n";
+ Out << "\t.size " << label << ", .end_"
+ << label << "-" << label << "\n\n\n\n";
+
+ //Out << "\n\n!" << area << " Length\n";
+ //Out << "\t.section \".bbdata\",#alloc,#write\n";
+ //Out << "\t.global " << label << "_length\n";
+ //Out << "\t.align 4\n";
+ //Out << "\t.type " << label << "_length,#object\n";
+ //Out << "\t.size "<< label <<"_length,4\n";
+ //Out << label <<" _length:\n";
+ //Out << "\t.word\t.end_"<<label<<"-"<<label<<"\n\n\n\n";
+}