[LLVMdev] cs326 mp help
kiyancla at uiuc.edu
kiyancla at uiuc.edu
Sat Apr 24 17:06:03 PDT 2004
Hi,
First, please send any replies to me separately, as I am not
on the list.
I'm trying to run a very simple LLVM pass as a start on a
class project. It compiles fine, but I get a runtime
assertion when running the pass. I'll paste the error and cpp
file below, but basically I'm being told that I haven't
specified a required pass. However, I've looked at some
example files, and i _think_ I'm doing stuff right. Do I have
to run the getAnalysisUsage function manually (I'm subclassing
FunctionPass), or can I trust it's called before runOnFunction
if I implement it?
Any help is greatly appreciated,
Nadir Kiyanclar
kiyancla at uiuc.edu
The command I use (licm is the pass I'm writing)
=========================
opt -load ../../../lib/Debug/liblicm.so -licm < loop1.bc >
loop1.aftermypass.bc
The assertion:
======================================
opt:
/usr/dcs/csil-linux/projects/cs326/kiyancla/llvm/include/llvm/Pass.h:182:
AnalysisType& llvm::Pass::getAnalysisID(const llvm::PassInfo*)
const [with AnalysisType = llvm::LoopInfo]: Assertion `i !=
AnalysisImpls.size() && "getAnalysis*() called on an analysis
that we not " "'required' by pass!"' failed.
Aborted (core dumped)
finally, the cpp file: (sorry about the extraneous includes)
==================================
#include "llvm/Transforms/Scalar.h"
#include "llvm/Function.h"
#include "llvm/Pass.h"
#include "llvm/PassAnalysisSupport.h"
#include "llvm/Function.h"
#include "llvm/Analysis/Dominators.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Support/CFG.h"
#include "llvm/Module.h"
#include "llvm/Instruction.h"
#include "Support/PostOrderIterator.h"
#include <iostream>
using namespace llvm;
namespace {
class LICM : public FunctionPass
{
public:
void getAnalysisUsage(AnalysisUsage &AU){
AU.setPreservesCFG();
AU.addRequiredID(LoopSimplifyID);
AU.addRequired<DominatorTree>();
AU.addRequired<LoopInfo>();
}
bool runOnFunction(Function &F);
};
RegisterOpt<LICM> Z("licm","Nadir Kiyanclar's code motion
pass for cs326, MP3");
bool LICM::runOnFunction(Function &F){
LoopInfo &LI = getAnalysis<LoopInfo>();
return false;
}
}
More information about the llvm-dev
mailing list