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

Submitted by Laura Ekstrand on July 27, 2015, 5:25 p.m.

Details

Message ID 1438017917-4304-7-git-send-email-laura.d.ekstrand@intel.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Laura Ekstrand July 27, 2015, 5:25 p.m.
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.
---
 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 f10ecbe..446b693 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 6516316..cdb1401 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 */
@@ -217,6 +219,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 b30ed8d..1a8903e 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;