[LLVMdev] strange pass behaviour
ST
st at iss.tu-darmstadt.de
Fri Mar 23 10:01:09 PDT 2007
Hi
I have written a pass which creates some scheduling information. Its called MParSchedule.
This pass works with opt. But when feeding it my experimental backend it seems to loose
instructions and fails to work. I am loading this stuff as .so libraries under linux and i am
using the amd64 version with a self compiled llvm-gcc.
With this call it works:
opt --load=/llvm/Debug/lib/MParSchedule.so -MParSchedule -f -o opt.o a.out.bc
With the following it won't:
llc --load=/llvm/Debug/lib/MParSchedule.so -load=/llvm/Debug/lib/libMyBackend.so -f -march=MyBackend a.out.bc
I am quite puzzled and would be happy if anyone would have a suggestion what goes wrong.
Which means the linefor the first instruction of the second block processed is missing (tmp1)
for my unoptimized example bytecode attached.
Am i not allowed to load a pass dynamically for llc? I doubt that i have memory corruption
since i am using the stl for all lists and stuff.
Thanks
ST
----
relevant code snipped from MParSchedule.cpp
namespace llvm {
bool MParSchedule::runOnFunction(Function &F) {
for (Function::iterator i = F.begin(), e = F.end(); i != e; ++i) {
BasicBlock &B=*i;
runOnBasicBlock(B);
}
return false;
}
bool MParSchedule::runOnBasicBlock(BasicBlock &B) {
// fill the Instruction list and the available values list
InstructionList.clear();
//ValueList.clear(); //FIXME: check if not clearing the Value List might cause problems?
list<Schedule*> *ScheduleList=new list<Schedule*>::list();
for(BasicBlock::iterator j=B.begin(),bbe=B.end();j!=bbe;++j) {
InstructionList.push_back(j);
cerr<<"Copying: "<<j->getName()<<" "<<InstructionList.size()<<endl;
......
......
}
RegisterPass<MParSchedule> X("MParSchedule","MParSchedule");
------------------------
Makefile MParschedule
LEVEL = ../../../..
LIBRARYNAME= MParSchedule
BUILD_ARCHIVE=1
SHARED_LIBRARY = 1
LOADABLE_MODULE= 1
include $(LEVEL)/Makefile.common
-------------------------
Makefile MyBackend
LEVEL = ../../..
LIBRARYNAME = MyBackend
PARALLEL_DIRS = MParSchedule
USEDLIBS = MParSchedule.o
LLVMLIBS = LLVMCore.a LLVMSupport.a LLVMSystem.a MParSchedule.a
#LIBS += -lMParSchedule
#LINK_COMPONENTS= MParSchedule
SHARED_LIBRARY = 1
include $(LEVEL)/Makefile.common
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.out.bc
Type: application/octet-stream
Size: 670 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070323/9ffe5ebb/attachment.obj>
More information about the llvm-dev
mailing list