diff --git a/tools/transforms/OffsetInference.cpp b/tools/transforms/OffsetInference.cpp index 92dabbaa7d6b931ddca5056fc3daf8b2ea737228..20a7437d08d2e20585cb73e98a097cbe4974de8b 100644 --- a/tools/transforms/OffsetInference.cpp +++ b/tools/transforms/OffsetInference.cpp @@ -171,6 +171,8 @@ PNStackLayout* OffsetInference::SetupLayout(BasicBlock_t *entry, Function_t *fun //TODO: what about moving esp into a register? //TODO: Try catches for exceptions thrown by PNStackLayout, for now asserts will fail in PNStackLayout + +//TODO: For t&e this function will void OffsetInference::FindAllOffsets(Function_t *func) { PNStackLayout *pn_all_offsets = NULL; @@ -198,6 +200,10 @@ void OffsetInference::FindAllOffsets(Function_t *func) pn_all_offsets = SetupLayout(block,func); + //TODO: this is just for t&e, remove for other versions, + //for t&e don't produce an inference if not dealloc is found + bool dealloc_flag=false; + if(pn_all_offsets != NULL) { unsigned int stack_frame_size = pn_all_offsets->GetOriginalAllocSize(); @@ -460,12 +466,26 @@ void OffsetInference::FindAllOffsets(Function_t *func) } } } + else if(regexec(&(pn_regex.regex_stack_dealloc), disasm_str.c_str(), max, pmatch, 0)==0) + { + //if we find a dealloc, set a flag indicating as such + dealloc_flag = true; + } else { cerr<<"OffsetInference: FindAllOffsets: No Pattern Match"<<endl; } } + //if no dealloc is found, set all inferences to null + if(!dealloc_flag) + { + pn_direct_offsets = NULL; + pn_scaled_offsets = NULL; + pn_all_offsets = NULL; + pn_p1_offsets = NULL; + } + direct[func->GetName()] = pn_direct_offsets; scaled[func->GetName()] = pn_scaled_offsets; all_offsets[func->GetName()] = pn_all_offsets; diff --git a/tools/transforms/PNTransformDriver.cpp b/tools/transforms/PNTransformDriver.cpp index 5839362f2d3d03e4c7380c8afc448b1fb06b1bff..754af3c22257b43ffb17d2c53e52acce16d80047 100644 --- a/tools/transforms/PNTransformDriver.cpp +++ b/tools/transforms/PNTransformDriver.cpp @@ -504,6 +504,7 @@ void PNTransformDriver::GenerateTransforms(VariantIR_t *virp, string BED_script, } +//TODO: rewrite, this was a hackish solution to clean up the code for the hierarchy, which isn't even used for T&E vector<PNStackLayout*> PNTransformDriver::GenerateInferences(Function_t *func,int level) { vector<PNStackLayout*> layouts;