From 0410d0ba66b70db373eb32d0bd695e3da0764459 Mon Sep 17 00:00:00 2001 From: Laura Ekstrand Date: Wed, 12 Aug 2015 01:54:19 -0400 Subject: backend: Add ASM file name to GenContext object. 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 Signed-off-by: Laura Ekstrand Reviewed-by: Song, Ruiling --- 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(+) (limited to 'backend') diff --git a/backend/src/backend/gen_context.cpp b/backend/src/backend/gen_context.cpp index 06601d62..261e25df 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 e9c6366e..8ef725f6 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 9546ab3d..3c4983ed 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; -- cgit v1.2.3