[04/15] Backend: Add profilingInfo to unit.

Submitted by junyan.he@inbox.com on Aug. 12, 2015, 8:48 a.m.

Details

Message ID 1439369327-21513-1-git-send-email-junyan.he@inbox.com
State New
Headers show

Not browsing as part of any series.

Commit Message

junyan.he@inbox.com Aug. 12, 2015, 8:48 a.m.
From: Junyan He <junyan.he@linux.intel.com>

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
---
 backend/src/ir/unit.cpp |    5 ++++-
 backend/src/ir/unit.hpp |    5 +++++
 2 files changed, 9 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/backend/src/ir/unit.cpp b/backend/src/ir/unit.cpp
index 84208e5..2e7677c 100644
--- a/backend/src/ir/unit.cpp
+++ b/backend/src/ir/unit.cpp
@@ -27,9 +27,12 @@ 
 namespace gbe {
 namespace ir {
 
-  Unit::Unit(PointerSize pointerSize) : pointerSize(pointerSize), valid(true) {}
+  Unit::Unit(PointerSize pointerSize) : pointerSize(pointerSize), valid(true) {
+    profilingInfo = GBE_NEW(ProfilingInfo);
+  }
   Unit::~Unit(void) {
     for (const auto &pair : functions) GBE_DELETE(pair.second);
+    delete profilingInfo;
   }
   Function *Unit::getFunction(const std::string &name) const {
     auto it = functions.find(name);
diff --git a/backend/src/ir/unit.hpp b/backend/src/ir/unit.hpp
index 8ff858d..9eef241 100644
--- a/backend/src/ir/unit.hpp
+++ b/backend/src/ir/unit.hpp
@@ -26,6 +26,7 @@ 
 
 #include "ir/constant.hpp"
 #include "ir/register.hpp"
+#include "ir/profiling.hpp"
 #include "sys/map.hpp"
 
 namespace gbe {
@@ -33,6 +34,7 @@  namespace ir {
 
   // A unit contains a set of functions
   class Function;
+  class ProfilingInfo;
 
   /*! Complete unit of compilation. It contains a set of functions and a set of
    *  constant the functions may refer to.
@@ -72,6 +74,8 @@  namespace ir {
     ConstantSet& getConstantSet(void) { return constantSet; }
     /*! Return the constant set */
     const ConstantSet& getConstantSet(void) const { return constantSet; }
+    /*! Get profiling info in this function */
+    ProfilingInfo* getProfilingInfo(void) const { return profilingInfo; }
     void setValid(bool value) { valid = value; }
     bool getValid() { return valid; }
   private:
@@ -79,6 +83,7 @@  namespace ir {
     FunctionSet functions; //!< All the defined functions
     ConstantSet constantSet; //!< All the constants defined in the unit
     PointerSize pointerSize; //!< Size shared by all pointers
+    ProfilingInfo *profilingInfo; //!< profilingInfo store the information for profiling.
     GBE_CLASS(Unit);
     bool valid;
   };