[6/7] backend: Add ASM file name to GenContext object.

Submitted by Manasi Navare on Aug. 12, 2015, 5:54 a.m.

Details

Message ID 1439358860-6874-7-git-send-email-manasi.d.navare@intel.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Manasi Navare Aug. 12, 2015, 5:54 a.m.
From: Laura Ekstrand <laura.d.ekstrand@intel.com>

Part of the plumbing that passes the ASM file name from the compiler options
level down to the emitCode level so that the assembly can be written to that
file.

Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
Signed-off-by: Laura Ekstrand <laura.d.ekstrand@intel.com>
---
 backend/src/backend/gen_context.cpp | 5 +++++
 backend/src/backend/gen_context.hpp | 3 +++
 backend/src/backend/gen_program.cpp | 1 +
 3 files changed, 9 insertions(+)

Patch hide | download patch | download mbox

diff --git a/backend/src/backend/gen_context.cpp b/backend/src/backend/gen_context.cpp
index c4c8cc6..6353b85 100644
--- a/backend/src/backend/gen_context.cpp
+++ b/backend/src/backend/gen_context.cpp
@@ -49,6 +49,7 @@  namespace gbe
     this->p = NULL;
     this->sel = NULL;
     this->ra = NULL;
+    this->asmFileName = NULL;
     this->ifEndifFix = false;
     this->regSpillTick = 0;
   }
@@ -76,6 +77,10 @@  namespace gbe
     this->regSpillTick = 0;
   }
 
+  void GenContext::setASMFileName(const char* asmFname) {
+    this->asmFileName = asmFname;
+  }
+
   void GenContext::newSelection(void) {
     this->sel = GBE_NEW(Selection, *this);
   }
diff --git a/backend/src/backend/gen_context.hpp b/backend/src/backend/gen_context.hpp
index e9c6366..8ef725f 100644
--- a/backend/src/backend/gen_context.hpp
+++ b/backend/src/backend/gen_context.hpp
@@ -69,6 +69,8 @@  namespace gbe
     #define GEN7_SCRATCH_SIZE  (12 * KB)
     /*! Start new code generation with specific parameters */
     void startNewCG(uint32_t simdWidth, uint32_t reservedSpillRegs, bool limitRegisterPressure);
+    /*! Set the file name for the ASM dump */
+    void setASMFileName(const char* asmFname);
     /*! Target device ID*/
     uint32_t deviceID;
     /*! Implements base class */
@@ -218,6 +220,7 @@  namespace gbe
     CompileErrorCode errCode;
     bool ifEndifFix;
     uint32_t regSpillTick;
+    const char* asmFileName;
     /*! Build the curbe patch list for the given kernel */
     void buildPatchList(void);
     /* Helper for printing the assembly */
diff --git a/backend/src/backend/gen_program.cpp b/backend/src/backend/gen_program.cpp
index 9546ab3..3c4983e 100644
--- a/backend/src/backend/gen_program.cpp
+++ b/backend/src/backend/gen_program.cpp
@@ -172,6 +172,7 @@  namespace gbe {
       ctx = GBE_NEW(Gen9Context, unit, name, deviceID, relaxMath);
     }
     GBE_ASSERTM(ctx != NULL, "Fail to create the gen context\n");
+    ctx->setASMFileName(this->asm_file_name);
 
     for (; codeGen < codeGenNum; ++codeGen) {
       const uint32_t simdWidth = codeGenStrategy[codeGen].simdWidth;