From 0ce06988a6a13f9a8f48f2230b1b9727ee86081e Mon Sep 17 00:00:00 2001 From: Ahmed El-Shafiey Date: Tue, 14 Aug 2012 13:53:25 -0800 Subject: Fixing bugs 169, 170, 171 [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 13761] --- cuobjdump_to_ptxplus/cuobjdumpInst.cc | 41 ++++++++++++++++++++----------- cuobjdump_to_ptxplus/cuobjdumpInstList.cc | 5 ++-- cuobjdump_to_ptxplus/ptx_parser.h | 1 + 3 files changed, 30 insertions(+), 17 deletions(-) (limited to 'cuobjdump_to_ptxplus') diff --git a/cuobjdump_to_ptxplus/cuobjdumpInst.cc b/cuobjdump_to_ptxplus/cuobjdumpInst.cc index dd9bb99..22dbdd3 100644 --- a/cuobjdump_to_ptxplus/cuobjdumpInst.cc +++ b/cuobjdump_to_ptxplus/cuobjdumpInst.cc @@ -539,7 +539,8 @@ void cuobjdumpInst::printCuobjdumpOperand(std::string currentPiece, std::string (m_base == "R2G") || (m_base == "GLD") || (m_base == "GST") || - (m_base == "LST") ))) { + (m_base == "LST") || + (m_base == "LLD")))) { std::string modsub = mod.substr(1); int regNumInt = atoi(modsub.c_str()); std::stringstream temp; @@ -576,8 +577,7 @@ void cuobjdumpInst::printCuobjdumpOperand(std::string currentPiece, std::string std::string modsub2; std::string modsub3; modsub = mod.c_str(); - int localFlag = 0; - + int const_sharedFlag =0; if(mod.find("global14") != std::string::npos) { //Those instructions don't need the dereferencing done by g [*] if( base == "GRED" || @@ -590,15 +590,23 @@ void cuobjdumpInst::printCuobjdumpOperand(std::string currentPiece, std::string } else if(mod[0]=='g') { //Shared memory output("s["); + const_sharedFlag=1; } else if(mod.find("local") != std::string::npos) { - modsub3 = modsub.substr(4, modsub.length()-10); - output(modsub3.c_str()); + if((base=="LST")|| + (base=="LLD")) output("["); - localFlag = 1; + else + output("l["); + //modsub3 = modsub.substr(4, modsub.length()-10); + //output(modsub3.c_str()); + //output("["); + //localFlag = 1; } else if(mod.substr(0,9) == "constant1") { output(modsub.substr(0, modsub.find_first_of("[]")+1).c_str()); + const_sharedFlag=1; } else if(mod.substr(0,9)=="constant0"){ output("constant0["); + const_sharedFlag=1; } else { printf("Unidentified modifier: %s\n", mod.c_str()); assert(0); @@ -636,14 +644,17 @@ void cuobjdumpInst::printCuobjdumpOperand(std::string currentPiece, std::string std::stringstream hexStringConvert; hexStringConvert << std::hex << modsub2; hexStringConvert >> addrValue; - unsigned chunksize = 4; - if ( this->m_typeModifiers->size()>0 && - ( m_typeModifiers->back() == ".S16" || - m_typeModifiers->back() == ".U16")) chunksize = 2; - if ( this->m_typeModifiers->size()>0 && - ( m_typeModifiers->back() == ".U8" || - m_typeModifiers->back() == ".S8")) chunksize = 1; - addrValue = addrValue*chunksize; + if(const_sharedFlag == 1) + { + unsigned chunksize = 4; + if ( this->m_typeModifiers->size()>0 && + ( m_typeModifiers->back() == ".S16" || + m_typeModifiers->back() == ".U16")) chunksize = 2; + if ( this->m_typeModifiers->size()>0 && + ( m_typeModifiers->back() == ".U8" || + m_typeModifiers->back() == ".S8")) chunksize = 1; + addrValue = addrValue*chunksize; + } char outputHex[10]; sprintf(outputHex, "%x", addrValue); std::stringstream outputhex; @@ -669,7 +680,7 @@ void cuobjdumpInst::printCuobjdumpOperand(std::string currentPiece, std::string hexStringConvert << std::hex << modsub; hexStringConvert >> addrValue; - if(localFlag == 0) + if(const_sharedFlag == 1) { unsigned chunksize = 4; if ( m_typeModifiers->size()>0 && diff --git a/cuobjdump_to_ptxplus/cuobjdumpInstList.cc b/cuobjdump_to_ptxplus/cuobjdumpInstList.cc index fabc396..d3ebd9a 100644 --- a/cuobjdump_to_ptxplus/cuobjdumpInstList.cc +++ b/cuobjdump_to_ptxplus/cuobjdumpInstList.cc @@ -350,7 +350,7 @@ void cuobjdumpInstList::addCuobjdumpRegister(std::string reg, bool lo) (typeModifiers->front() == ".S64") && ((baseInst == "G2R")||(baseInst == "R2G")|| (baseInst == "GLD")||(baseInst == "GST")|| - (baseInst == "LST")))) + (baseInst == "LST")|| (baseInst == "LLD")))) { vectorFlag = 64; } @@ -426,6 +426,7 @@ void cuobjdumpInstList::addCuobjdumpMemoryOperand(std::string mem, int memType) } // Local memory + /* if(memType == 3) { std::stringstream out; printf("Trying to find lmem for: %s\n", m_entryList.back().m_entryName.c_str()); @@ -434,7 +435,7 @@ void cuobjdumpInstList::addCuobjdumpMemoryOperand(std::string mem, int memType) out << "l" << kernellmemmap[m_entryList.back().m_entryName];// << mem; mem = out.str(); } - + */ // Add the memory operand to instruction operand list char* memName = new char [strlen(mem.c_str())+1]; strcpy(memName, mem.c_str()); diff --git a/cuobjdump_to_ptxplus/ptx_parser.h b/cuobjdump_to_ptxplus/ptx_parser.h index c6d7027..ce77c2f 100644 --- a/cuobjdump_to_ptxplus/ptx_parser.h +++ b/cuobjdump_to_ptxplus/ptx_parser.h @@ -90,6 +90,7 @@ void add_pred( const char *a, int b, int c ) {DPRINTF(" ");} void add_scalar_operand( const char *a ) {DPRINTF("%s", a);} void add_neg_pred_operand( const char *a ) {DPRINTF(" ");} void add_address_operand( const char *a, int b ) {DPRINTF("%s", a);} +void add_address_operand2( int b ) {DPRINTF(" ");} void change_operand_lohi( int a ) {DPRINTF(" ");} void change_double_operand_type( int a ) {DPRINTF(" ");} void change_operand_neg( ) {DPRINTF(" ");} -- cgit v1.3