summaryrefslogtreecommitdiff
path: root/cuobjdump_to_ptxplus/cuobjdumpInst.cc
diff options
context:
space:
mode:
authorAndrew M. B. Boktor <[email protected]>2012-05-26 21:31:54 -0800
committerAndrew Boktor <[email protected]>2014-08-14 13:47:31 -0700
commite8d76d263c78655767ef87746a7d241a588a2581 (patch)
tree7e21e14e7274a3193f1e6a067fd79f630786022d /cuobjdump_to_ptxplus/cuobjdumpInst.cc
parent3f9052b863ae10e7c1a30ac9acdb6b82db0aa03a (diff)
Trying to get around the problem of having more than 2 modifiers (two on the instruction and one on a memory operand).
In this case, replace the modifier on the instruction with that of the memory operand. [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 12782]
Diffstat (limited to 'cuobjdump_to_ptxplus/cuobjdumpInst.cc')
-rw-r--r--cuobjdump_to_ptxplus/cuobjdumpInst.cc68
1 files changed, 19 insertions, 49 deletions
diff --git a/cuobjdump_to_ptxplus/cuobjdumpInst.cc b/cuobjdump_to_ptxplus/cuobjdumpInst.cc
index 24ca4d2..ad385d6 100644
--- a/cuobjdump_to_ptxplus/cuobjdumpInst.cc
+++ b/cuobjdump_to_ptxplus/cuobjdumpInst.cc
@@ -193,10 +193,15 @@ void cuobjdumpInst::addBaseModifier(const char* addBaseMod)
void cuobjdumpInst::addTypeModifier(const char* addTypeMod)
{
- stringListPiece* tempPiece = new stringListPiece;
- tempPiece->stringText = addTypeMod;
-
- m_typeModifiers->add(tempPiece);
+ //We cannot have more than two modifiers, replace the last
+ //This will be the case if we have memory operand modifiers
+ if (m_typeModifiers->getSize() == 2) {
+ m_typeModifiers->getListEnd()->stringText = addTypeMod;
+ }else {
+ stringListPiece* tempPiece = new stringListPiece;
+ tempPiece->stringText = addTypeMod;
+ m_typeModifiers->add(tempPiece);
+ }
}
void cuobjdumpInst::addOperand(const char* addOp)
@@ -646,8 +651,8 @@ void cuobjdumpInst::printCuobjdumpOperand(stringListPiece* currentPiece, std::st
hexStringConvert >> addrValue;
unsigned chunksize = 4;
if ( this->m_typeModifiers->getSize()>0 &&
- ( strcmp((m_typeModifiers->getListStart()->stringText), ".S16")==0 ||
- strcmp((m_typeModifiers->getListStart()->stringText), ".U16")==0 )) chunksize = 2;
+ ( strcmp((m_typeModifiers->getListEnd()->stringText), ".S16")==0 ||
+ strcmp((m_typeModifiers->getListEnd()->stringText), ".U16")==0 )) chunksize = 2;
if ( this->m_typeModifiers->getSize()>0 &&
( strcmp((m_typeModifiers->getListEnd()->stringText), ".U8")==0 ||
strcmp((m_typeModifiers->getListEnd()->stringText), ".S8")==0 )) chunksize = 1;
@@ -680,9 +685,12 @@ void cuobjdumpInst::printCuobjdumpOperand(stringListPiece* currentPiece, std::st
if(localFlag == 0)
{
unsigned chunksize = 4;
+ if ( m_typeModifiers->getSize()>0 &&
+ ( strcmp((m_typeModifiers->getListEnd()->stringText), ".S16")==0 ||
+ strcmp((m_typeModifiers->getListEnd()->stringText), ".U16")==0 )) chunksize = 2;
if ( this->m_typeModifiers->getSize()>0 &&
- (strcmp((m_typeModifiers->getListStart()->stringText), ".S16")==0 ||
- strcmp((m_typeModifiers->getListStart()->stringText), ".U16")==0 )) chunksize = 2;
+ ( strcmp((m_typeModifiers->getListEnd()->stringText), ".U8")==0 ||
+ strcmp((m_typeModifiers->getListEnd()->stringText), ".S8")==0 )) chunksize = 1;
addrValue = addrValue*chunksize;
}
std::stringstream outputhex;
@@ -1130,7 +1138,6 @@ void cuobjdumpInst::printCuobjdumpPtxPlus(std::list<std::string> labelList, std:
printCuobjdumpPredicate();
int absFlag = 0;
- int bextFlag = 0;
stringListPiece* currentPiece = m_baseModifiers->getListStart();
while(currentPiece != NULL)
@@ -1141,11 +1148,6 @@ void cuobjdumpInst::printCuobjdumpPtxPlus(std::list<std::string> labelList, std:
absFlag = 1;
break;
}
- if(strcmp(currentPiece->stringText, ".bext")==0)
- {
- bextFlag = 1;
- break;
- }
currentPiece = currentPiece->nextString;
}
if(absFlag == 0)
@@ -1155,44 +1157,12 @@ void cuobjdumpInst::printCuobjdumpPtxPlus(std::list<std::string> labelList, std:
printCuobjdumpBaseModifiers();
- currentPiece = this->m_typeModifiers->getListStart();
- unsigned int maxlength=16;
- unsigned int currlength = 16;
- bool issigned = false;
- std::string tmpstr;
- while(currentPiece != NULL)
- {
- tmpstr = currentPiece->stringText;
- if(tmpstr[1] == 'S')
- {
- issigned = true;
- }
- if(tmpstr.substr(2,2) == "32") {currlength=32;}
- if (currlength > maxlength) {maxlength = currlength;}
- currentPiece = currentPiece->nextString;
- }
-
if(absFlag == 0)
{
- if(bextFlag == 0)
+ if(m_typeModifiers->getSize() == 0)
+ output(int_default_mod()); //TODO: setting default type modifier but I'm not sure if this is right.
+ else
printCuobjdumpTypeModifiers();
- else{
- output(".");
- if (issigned) {output("s");}
- else {output("u");}
- std::stringstream tmp;
- tmp << maxlength;
- output(tmp.str().c_str());
- output(".");
- if (issigned) {output("s");}
- else {output("u");}
- output("8");
- //output(".u16.u8");
- }
- }
- else
- {
- output(int_default_mod()); //TODO: setting default type modifier but I'm not sure if this is right.
}
printCuobjdumpOperands();