[LLVMdev] NEWBIE: deleting Instructions
Heiko Sturzrehm
woernchen at gmx.de
Fri Mar 23 02:00:59 PDT 2007
Hello,
i just tried to write some passes and in one of them i want to delete a call
Instruction.
I can identify the specific Instruction without a problem, but when i put
the delete operation in the code i always get a error message while running
opt. I already tried to rename my pass, but without any change.
Another question i have is: why do i always get the "opt: CommandLine
Error:" how can i fix it?
Thanks for any help.
Ciao Heiko
Console OUTPUT:
opt -load /home/sturzrehmh/llvm/llvm-1.9/Release/lib/TESTXYZ.so -TESTXYZ <
test.bc > test.bc2
opt: CommandLine Error: Argument 'track-memory' defined more than once!
opt: CommandLine Error: Argument 'info-output-file' defined more than once!
opt: CommandLine Error: Argument 'help' defined more than once!
opt: CommandLine Error: Argument 'help-hidden' defined more than once!
opt: CommandLine Error: Argument 'version' defined more than once!
opt: Pass.cpp:346: void llvm::RegisterPassBase::registerPass(): Assertion
`PassInfoMap->find(PIObj.getTypeInfo()) == PassInfoMap->end() && "Pass
already registered!"' failed.
Aborted
PASS:
virtual bool runOnFunction(Function &F)
{
bool change= false;
Function* func = &F;
for(Function::iterator it = func->begin(), ite = func ->end(); it!=ite ;
++it)
{
BasicBlock* blk =it;
User* u;
Value* val;
std::string s1;
for (BasicBlock::iterator i = blk->begin(), e = blk->end(); i != e ;
++i)
{
if(i->getOpcode()==33)
{
u = i;
val=u->getOperand(0);
s1 = val->getName();
if(s1 == "_Z7startv")
{
//HERE is the problem
blk->getInstList().erase(i);
change=true;
}
}
}
}
return change;
}
--
View this message in context: http://www.nabble.com/NEWBIE%3A-deleting-Instructions-tf3452416.html#a9630465
Sent from the LLVM - Dev mailing list archive at Nabble.com.
More information about the llvm-dev
mailing list