Now will profile all Basic Blocks
authorMehwish Nagda <nagda@cs.uiuc.edu>
Tue, 16 Jul 2002 17:48:27 +0000 (17:48 +0000)
committerMehwish Nagda <nagda@cs.uiuc.edu>
Tue, 16 Jul 2002 17:48:27 +0000 (17:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2922 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/InstrSelection/MappingInfo.cpp
lib/Target/SparcV9/InstrSelection/MappingInfo.cpp

index 9bc5dd435b442fc75532791e59e44da0d0223740..5e7b2f90d24109c510484c83b728ef611c87590e 100644 (file)
@@ -2,6 +2,7 @@
 //
 // Create Map from LLVM BB and Instructions and Machine Instructions
 // and output the information as .byte directives to the .s file
+// Currently Sparc specific but will be extended for others later
 //
 //===--------------------------------------------------------------------===//
 
@@ -13,7 +14,6 @@
 #include "llvm/CodeGen/MachineCodeForInstruction.h"
 #include <map>
 #include <vector>
-#include <iostream>
 using std::vector;
 
 
@@ -31,11 +31,11 @@ namespace {
     vector<vector<int> > BBmap;
     vector<vector<int> > MImap;
 
-    void createFunctionKey(Module *M);
-    void createBasicBlockKey(Module *M);    
-    void createMachineInstructionKey(Module *M);
-    void createBBToMImap(Module *M);
-    void createLLVMToMImap(Module *M);
+    void createFunctionKey(Module &M);
+    void createBasicBlockKey(Module &M);    
+    void createMachineInstructionKey(Module &M);
+    void createBBToMImap(Module &M);
+    void createLLVMToMImap(Module &M);
     void writeNumber(int X);
 
   public:
@@ -57,8 +57,8 @@ Pass *MappingInfoForFunction(std::ostream &out){
 
 //function definitions :
 //create and output maps to the .s file
-bool getMappingInfoForFunction::run(Module &m) {
-  Module *M = &m;
+bool getMappingInfoForFunction::run(Module &M) {
+  //  Module *M = &m;
 
   //map for Function to Function number
   createFunctionKey(M);
@@ -143,10 +143,10 @@ void getMappingInfoForFunction::writeNumber(int X) {
 }
 
 //Assign a number to each Function 
-void getMappingInfoForFunction::createFunctionKey(Module *M){
+void getMappingInfoForFunction::createFunctionKey(Module &M){
   int i = 0;
   int j = 0;
-  for (Module::iterator FI = M->begin(), FE = M->end();
+  for (Module::iterator FI = M.begin(), FE = M.end();
        FI != FE; ++FI){
     if(FI->size() <=1) continue;
     Fkey[FI] = i;
@@ -155,12 +155,12 @@ void getMappingInfoForFunction::createFunctionKey(Module *M){
 }
      
 //Assign a Number to each BB
-void getMappingInfoForFunction::createBasicBlockKey(Module *M){
+void getMappingInfoForFunction::createBasicBlockKey(Module &M){
   int i = 0;
-  for (Module::iterator FI = M->begin(), FE = M->end(); 
+  for (Module::iterator FI = M.begin(), FE = M.end(); 
        FI != FE; ++FI){
     // int i = 0;
-    if(FI->size() <= 1) continue;
+    //if(FI->size() <= 1) continue;
     for (Function::iterator BI = FI->begin(), BE = FI->end(); 
         BI != BE; ++BI){
       MachineCodeForBasicBlock &miBB = MachineCodeForBasicBlock::get(BI);
@@ -170,10 +170,10 @@ void getMappingInfoForFunction::createBasicBlockKey(Module *M){
   }
 }
 
-void getMappingInfoForFunction::createMachineInstructionKey(Module *M){
-  for (Module::iterator FI = M->begin(), FE = M->end(); 
+void getMappingInfoForFunction::createMachineInstructionKey(Module &M){
+  for (Module::iterator FI = M.begin(), FE = M.end(); 
        FI != FE; ++FI){
-    if(FI->size() <= 1) continue;
+    //if(FI->size() <= 1) continue;
     for (Function::iterator BI=FI->begin(), BE=FI->end(); 
         BI != BE; ++BI){
       MachineCodeForBasicBlock &miBB = MachineCodeForBasicBlock::get(BI);
@@ -186,11 +186,11 @@ void getMappingInfoForFunction::createMachineInstructionKey(Module *M){
   }
 }
 
-void getMappingInfoForFunction::createBBToMImap(Module *M){
+void getMappingInfoForFunction::createBBToMImap(Module &M){
   //go thro each function in the module
-  for (Module::iterator FI = M->begin(), FE = M->end();
+  for (Module::iterator FI = M.begin(), FE = M.end();
        FI != FE; ++FI){        
-    if(FI->size() <= 1)continue;
+    //if(FI->size() <= 1)continue;
     //go thro each basic block in that function 
     int i = 0;
     for (Function::iterator BI = FI->begin(), 
@@ -216,11 +216,11 @@ void getMappingInfoForFunction::createBBToMImap(Module *M){
   }
 }
 
-void getMappingInfoForFunction::createLLVMToMImap(Module *M){
+void getMappingInfoForFunction::createLLVMToMImap(Module &M){
   
-  for (Module::iterator FI = M->begin(), FE = M->end();
+  for (Module::iterator FI = M.begin(), FE = M.end();
        FI != FE; ++FI){
-    if(FI->size() <= 1) continue;
+    //if(FI->size() <= 1) continue;
     int i =0;
     for (Function::iterator BI = FI->begin(),  BE = FI->end(); 
         BI != BE; ++BI, ++i){
index 9bc5dd435b442fc75532791e59e44da0d0223740..5e7b2f90d24109c510484c83b728ef611c87590e 100644 (file)
@@ -2,6 +2,7 @@
 //
 // Create Map from LLVM BB and Instructions and Machine Instructions
 // and output the information as .byte directives to the .s file
+// Currently Sparc specific but will be extended for others later
 //
 //===--------------------------------------------------------------------===//
 
@@ -13,7 +14,6 @@
 #include "llvm/CodeGen/MachineCodeForInstruction.h"
 #include <map>
 #include <vector>
-#include <iostream>
 using std::vector;
 
 
@@ -31,11 +31,11 @@ namespace {
     vector<vector<int> > BBmap;
     vector<vector<int> > MImap;
 
-    void createFunctionKey(Module *M);
-    void createBasicBlockKey(Module *M);    
-    void createMachineInstructionKey(Module *M);
-    void createBBToMImap(Module *M);
-    void createLLVMToMImap(Module *M);
+    void createFunctionKey(Module &M);
+    void createBasicBlockKey(Module &M);    
+    void createMachineInstructionKey(Module &M);
+    void createBBToMImap(Module &M);
+    void createLLVMToMImap(Module &M);
     void writeNumber(int X);
 
   public:
@@ -57,8 +57,8 @@ Pass *MappingInfoForFunction(std::ostream &out){
 
 //function definitions :
 //create and output maps to the .s file
-bool getMappingInfoForFunction::run(Module &m) {
-  Module *M = &m;
+bool getMappingInfoForFunction::run(Module &M) {
+  //  Module *M = &m;
 
   //map for Function to Function number
   createFunctionKey(M);
@@ -143,10 +143,10 @@ void getMappingInfoForFunction::writeNumber(int X) {
 }
 
 //Assign a number to each Function 
-void getMappingInfoForFunction::createFunctionKey(Module *M){
+void getMappingInfoForFunction::createFunctionKey(Module &M){
   int i = 0;
   int j = 0;
-  for (Module::iterator FI = M->begin(), FE = M->end();
+  for (Module::iterator FI = M.begin(), FE = M.end();
        FI != FE; ++FI){
     if(FI->size() <=1) continue;
     Fkey[FI] = i;
@@ -155,12 +155,12 @@ void getMappingInfoForFunction::createFunctionKey(Module *M){
 }
      
 //Assign a Number to each BB
-void getMappingInfoForFunction::createBasicBlockKey(Module *M){
+void getMappingInfoForFunction::createBasicBlockKey(Module &M){
   int i = 0;
-  for (Module::iterator FI = M->begin(), FE = M->end(); 
+  for (Module::iterator FI = M.begin(), FE = M.end(); 
        FI != FE; ++FI){
     // int i = 0;
-    if(FI->size() <= 1) continue;
+    //if(FI->size() <= 1) continue;
     for (Function::iterator BI = FI->begin(), BE = FI->end(); 
         BI != BE; ++BI){
       MachineCodeForBasicBlock &miBB = MachineCodeForBasicBlock::get(BI);
@@ -170,10 +170,10 @@ void getMappingInfoForFunction::createBasicBlockKey(Module *M){
   }
 }
 
-void getMappingInfoForFunction::createMachineInstructionKey(Module *M){
-  for (Module::iterator FI = M->begin(), FE = M->end(); 
+void getMappingInfoForFunction::createMachineInstructionKey(Module &M){
+  for (Module::iterator FI = M.begin(), FE = M.end(); 
        FI != FE; ++FI){
-    if(FI->size() <= 1) continue;
+    //if(FI->size() <= 1) continue;
     for (Function::iterator BI=FI->begin(), BE=FI->end(); 
         BI != BE; ++BI){
       MachineCodeForBasicBlock &miBB = MachineCodeForBasicBlock::get(BI);
@@ -186,11 +186,11 @@ void getMappingInfoForFunction::createMachineInstructionKey(Module *M){
   }
 }
 
-void getMappingInfoForFunction::createBBToMImap(Module *M){
+void getMappingInfoForFunction::createBBToMImap(Module &M){
   //go thro each function in the module
-  for (Module::iterator FI = M->begin(), FE = M->end();
+  for (Module::iterator FI = M.begin(), FE = M.end();
        FI != FE; ++FI){        
-    if(FI->size() <= 1)continue;
+    //if(FI->size() <= 1)continue;
     //go thro each basic block in that function 
     int i = 0;
     for (Function::iterator BI = FI->begin(), 
@@ -216,11 +216,11 @@ void getMappingInfoForFunction::createBBToMImap(Module *M){
   }
 }
 
-void getMappingInfoForFunction::createLLVMToMImap(Module *M){
+void getMappingInfoForFunction::createLLVMToMImap(Module &M){
   
-  for (Module::iterator FI = M->begin(), FE = M->end();
+  for (Module::iterator FI = M.begin(), FE = M.end();
        FI != FE; ++FI){
-    if(FI->size() <= 1) continue;
+    //if(FI->size() <= 1) continue;
     int i =0;
     for (Function::iterator BI = FI->begin(),  BE = FI->end(); 
         BI != BE; ++BI, ++i){