[LLVMdev] problem trying to write an LLVM register-allocation pass

Susan Horwitz horwitz at cs.wisc.edu
Wed Oct 31 13:46:16 PDT 2012


I'm trying to write a MachineFunctionPass to do register allocation.  I 
have code that worked with an old version of LLVM.  It does not work 
with llvm-3.1. (or various other versions that I've tried).

The first problem is that including this line:

  AU.addRequiredID(TwoAddressInstructionPassID);

in method getAnalysisUsage causes a runtime error:

Unable to schedule 'Eliminate PHI nodes for register allocation' 
required by 'Unnamed pass: implement Pass::getPassName()'
Unable to schedule pass
UNREACHABLE executed at ...

I'm invoking the pass like this (given input file foo.c):

clang -emit-llvm -O0 -c foo.c -o foo.bc
opt -mem2reg foo.bc > foo.ssa
mv foo.ssa foo.bc
llc -load Debug/lib/P4.so -regalloc=gc foo.bc


I've attached my entire file (it's very short).  Any help would be much 
appreciated!

Susan Horwitz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Gcra.cpp
Type: text/x-c++src
Size: 2041 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121031/5bc8ab45/attachment.cpp>


More information about the llvm-dev mailing list