Skip to content
Snippets Groups Projects
Commit b5e16616 authored by clc5q's avatar clc5q
Browse files

Add SINKMALLOC tag to TRUNCATIONs.

parent 128b49cc
No related branches found
No related tags found
No related merge requests found
...@@ -7982,6 +7982,7 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo ...@@ -7982,6 +7982,7 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo
// of an int or a pointer. Cannot have signedness error in that case, as sign bit // of an int or a pointer. Cannot have signedness error in that case, as sign bit
// is not affected. // is not affected.
char *disasm = DisAsmText.GetDisAsm(this->GetAddr()); char *disasm = DisAsmText.GetDisAsm(this->GetAddr());
string SinkString("");
   
if (this->IsNumericAnnotationSuppressed()) { if (this->IsNumericAnnotationSuppressed()) {
return; // Cannot figure out IdiomCode; suppressed from earlier instruction's analyses return; // Cannot figure out IdiomCode; suppressed from earlier instruction's analyses
...@@ -8144,7 +8145,6 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo ...@@ -8144,7 +8145,6 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo
this->MDGetUnnormalizedOp(AnnotDefOp); this->MDGetUnnormalizedOp(AnnotDefOp);
} }
AnnotPrintOperand(AnnotDefOp, InfoAnnotFile); AnnotPrintOperand(AnnotDefOp, InfoAnnotFile);
string SinkString("");
if (!IgnoreOverflow) { if (!IgnoreOverflow) {
// See if we made a special detection of an operation involved in a hash function, which can // See if we made a special detection of an operation involved in a hash function, which can
// be expected to overflow benignly. // be expected to overflow benignly.
...@@ -8599,12 +8599,19 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo ...@@ -8599,12 +8599,19 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo
// signedness errors are the result of the uncertainty, but all truncations are detected // signedness errors are the result of the uncertainty, but all truncations are detected
// for all nine cases. // for all nine cases.
   
bool HasSinkString = this->GetBlock()->GetFunc()->HasIntErrorCallSink(DestSearchOp, DefSSANum, this->address, SinkString);
if (DefIsUnsigned || UseIsUnsigned) { if (DefIsUnsigned || UseIsUnsigned) {
// First five cases above: any UNSIGNED operand leads to CHECK TRUNCATION UNSIGNED annotation. // First five cases above: any UNSIGNED operand leads to CHECK TRUNCATION UNSIGNED annotation.
if (!SuppressTruncation) { if (!SuppressTruncation) {
SMP_fprintf(InfoAnnotFile, "%10x %6d INSTR CHECK TRUNCATION UNSIGNED %zu %s %zu %s ZZ %s \n", SMP_fprintf(InfoAnnotFile, "%10x %6d INSTR CHECK TRUNCATION UNSIGNED %zu %s %zu %s",
this->address, this->SMPcmd.size, SourceDefBitWidth, this->address, this->SMPcmd.size, SourceDefBitWidth,
MDGetRegName(SearchOp), UseBitWidth, MDGetRegName(UseOp), disasm); MDGetRegName(SearchOp), UseBitWidth, MDGetRegName(UseOp));
if (HasSinkString) {
SMP_fprintf(InfoAnnotFile, " ZZ %s %s \n", SinkString.c_str(), disasm);
}
else {
SMP_fprintf(InfoAnnotFile, " ZZ %s \n", disasm);
}
#if SMP_MEASURE_NUMERIC_ANNOTATIONS #if SMP_MEASURE_NUMERIC_ANNOTATIONS
++TruncationAnnotationsCount; ++TruncationAnnotationsCount;
#endif #endif
...@@ -8636,9 +8643,15 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo ...@@ -8636,9 +8643,15 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo
else if (DefIsSigned && UseIsSigned) { else if (DefIsSigned && UseIsSigned) {
// S => S case above. Emit CHECK TRUNCATION SIGNED annotation. // S => S case above. Emit CHECK TRUNCATION SIGNED annotation.
if (!SuppressTruncation) { if (!SuppressTruncation) {
SMP_fprintf(InfoAnnotFile, "%10x %6d INSTR CHECK TRUNCATION SIGNED %zu %s %zu %s ZZ %s \n", SMP_fprintf(InfoAnnotFile, "%10x %6d INSTR CHECK TRUNCATION SIGNED %zu %s %zu %s",
this->address, this->SMPcmd.size, SourceDefBitWidth, this->address, this->SMPcmd.size, SourceDefBitWidth,
MDGetRegName(SearchOp), UseBitWidth, MDGetRegName(UseOp), disasm); MDGetRegName(SearchOp), UseBitWidth, MDGetRegName(UseOp));
if (HasSinkString) {
SMP_fprintf(InfoAnnotFile, " ZZ %s %s \n", SinkString.c_str(), disasm);
}
else {
SMP_fprintf(InfoAnnotFile, " ZZ %s \n", disasm);
}
#if SMP_MEASURE_NUMERIC_ANNOTATIONS #if SMP_MEASURE_NUMERIC_ANNOTATIONS
++TruncationAnnotationsCount; ++TruncationAnnotationsCount;
#endif #endif
...@@ -8652,9 +8665,15 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo ...@@ -8652,9 +8665,15 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo
else { else {
// S => ?, ? => S, ? => ? cases above: CHECK TRUNCATION UNKNOWNSIGN annotation. // S => ?, ? => S, ? => ? cases above: CHECK TRUNCATION UNKNOWNSIGN annotation.
if (!SuppressTruncation) { if (!SuppressTruncation) {
SMP_fprintf(InfoAnnotFile, "%10x %6d INSTR CHECK TRUNCATION UNKNOWNSIGN %zu %s %zu %s ZZ %s \n", SMP_fprintf(InfoAnnotFile, "%10x %6d INSTR CHECK TRUNCATION UNKNOWNSIGN %zu %s %zu %s",
this->address, this->SMPcmd.size, SourceDefBitWidth, this->address, this->SMPcmd.size, SourceDefBitWidth,
MDGetRegName(SearchOp), UseBitWidth, MDGetRegName(UseOp), disasm); MDGetRegName(SearchOp), UseBitWidth, MDGetRegName(UseOp));
if (HasSinkString) {
SMP_fprintf(InfoAnnotFile, " ZZ %s %s \n", SinkString.c_str(), disasm);
}
else {
SMP_fprintf(InfoAnnotFile, " ZZ %s \n", disasm);
}
#if SMP_MEASURE_NUMERIC_ANNOTATIONS #if SMP_MEASURE_NUMERIC_ANNOTATIONS
++TruncationAnnotationsCount; ++TruncationAnnotationsCount;
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment