-
Notifications
You must be signed in to change notification settings - Fork 1
Handle Bitcast Instruction #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: lfcpaInstModel_3June2021
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -180,8 +180,9 @@ std::vector<Token *> LFCPAInstModel::extractToken(llvm::CmpInst *Inst) { | |
| // llvm::errs()<<"\n VALUE= "<<*v; | ||
|
|
||
| I = llvm::dyn_cast<llvm::Instruction>(v); | ||
| q.push(I); | ||
|
|
||
| if(I != nullptr){ | ||
| q.push(I); | ||
| } | ||
|
|
||
| while(!q.empty()) { | ||
| llvm::Instruction *I = q.front(); | ||
|
|
@@ -205,7 +206,9 @@ std::vector<Token *> LFCPAInstModel::extractToken(llvm::CmpInst *Inst) { | |
| llvm::Value* v = U.get(); | ||
| // llvm::errs()<<"\n VALUE= "<<*v; | ||
| llvm::Instruction *I1 = llvm::dyn_cast<llvm::Instruction>(v); | ||
| q.push(I1); | ||
| if(I != nullptr){ | ||
| q.push(I1); | ||
| } | ||
| } | ||
| } | ||
| }//end if load | ||
|
|
@@ -262,6 +265,14 @@ std::vector<Token *> LFCPAInstModel::extractToken(llvm::ReturnInst *Inst) { | |
| Ins = I; | ||
| }//end else | ||
| }//end if load | ||
| else if(llvm::BitCastInst *BI = llvm::dyn_cast<llvm::BitCastInst>(I)){ | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. getting an infinite loop as bitcast was not supported in return. |
||
| Ins = I; | ||
| InstInfoMap[I] = II; | ||
| } | ||
| else { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. getting infinite loop as other instructions are not supported right now. |
||
| skipFlag = true; | ||
| break; | ||
| } | ||
| }//end for | ||
| }//end while | ||
| }//end if | ||
|
|
@@ -285,6 +296,18 @@ std::vector<Token *> LFCPAInstModel::extractToken(llvm::BitCastInst *Inst) { | |
| } else if (llvm::BitCastInst *BI = | ||
| llvm::dyn_cast<llvm::BitCastInst>(Inst->getOperand(0))) { | ||
| TokenVec.push_back(this->getTokenWrapper()->getToken(BI->getDestTy())); | ||
| } else if(llvm::LoadInst *LI = llvm::dyn_cast<llvm::LoadInst>(Inst->getOperand(0))) { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handling one or more load instruction before bitcast. |
||
| Token* TokLIOp = this->getTokenWrapper()->getToken(LI->getPointerOperand()); | ||
| if(!TokLIOp->isGlobalVar()) { | ||
| if(llvm::LoadInst* LIOp = llvm::dyn_cast<llvm::LoadInst>(LI->getPointerOperand())) { | ||
| std::vector<Token*> LITokens = this->extractToken(LIOp); | ||
| if(LITokens.size()==2) { | ||
| TokenVec.push_back(LITokens[1]); | ||
| } | ||
| } | ||
| } else { | ||
| TokenVec.push_back(this->getTokenWrapper()->getToken(LI->getPointerOperand())); | ||
| } | ||
| } | ||
| if (TokenVec.size() == 1) { | ||
| TokenVec.push_back(this->getTokenWrapper()->getToken(Inst->getOperand(0))); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Segmentation fault as
Iwas sometimes a null pointer.