<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>First, I got this:<div><br></div><div>oh2.cpp:5:36: fatal error: llvm/Analysis/Verifier.h: No such file or directory</div><div><br></div><div>I know Verifier.h is in llvm/IR so I changed oh2.cpp accordingly. oh2.cpp was created by llc so I don't understand <span style="font-size: 12pt;">why the path was wrong.</span><span style="font-size: 12pt;"> </span><span style="font-size: 12pt;">Now I get these errors:</span></div><div><br></div><div><br></div><div><div>oh2.cpp: In function ‘int main(int, char**)’:</div><div>oh2.cpp:27:22: error: ‘PrintMessageAction’ was not declared in this scope</div><div>   verifyModule(*Mod, PrintMessageAction);</div><div>                      ^</div><div>oh2.cpp:28:3: error: ‘PassManager’ was not declared in this scope</div><div>   PassManager PM;</div><div>   ^</div><div>oh2.cpp:28:3: note: suggested alternative:</div><div>In file included from oh2.cpp:16:0:</div><div>/home/erdem/llvm/include/llvm/IR/LegacyPassManager.h:49:7: note:   ‘llvm::legacy::PassManager’</div><div> class PassManager : public PassManagerBase {</div><div>       ^</div><div>oh2.cpp:28:15: error: expected ‘;’ before ‘PM’</div><div>   PassManager PM;</div><div>               ^</div><div>oh2.cpp:29:3: error: ‘PM’ was not declared in this scope</div><div>   PM.add(createPrintModulePass(&outs()));</div><div>   ^</div><div>oh2.cpp:29:39: error: invalid initialization of non-const reference of type ‘llvm::raw_ostream&’ from an rvalue of type ‘llvm::raw_ostream*’</div><div>   PM.add(createPrintModulePass(&outs()));</div><div>                                       ^</div><div>In file included from oh2.cpp:12:0:</div><div>/home/erdem/llvm/include/llvm/IR/IRPrintingPasses.h:36:13: error: in passing argument 1 of ‘llvm::ModulePass* llvm::createPrintModulePass(llvm::raw_ostream&, const string&, bool)’</div><div> ModulePass *createPrintModulePass(raw_ostream &OS,</div><div>             ^</div><div>oh2.cpp: In function ‘llvm::Module* makeLLVMModule()’:</div><div>oh2.cpp:372:94: error: no matching function for call to ‘llvm::ConstantExpr::getGetElementPtr(llvm::GlobalVariable*&, std::vector<llvm::Constant*, std::allocator<llvm::Constant*> >&)’</div><div> Constant* const_ptr_30 = ConstantExpr::getGetElementPtr(gvar_array__str, const_ptr_30_indices);</div><div>                                                                                              ^</div><div>oh2.cpp:372:94: note: candidates are:</div><div>In file included from oh2.cpp:8:0:</div><div>/home/erdem/llvm/include/llvm/IR/Constants.h:1092:20: note: static llvm::Constant* llvm::ConstantExpr::getGetElementPtr(llvm::Type*, llvm::Constant*, llvm::ArrayRef<llvm::Constant*>, bool, llvm::Type*)</div><div>   static Constant *getGetElementPtr(Type *Ty, Constant *C,</div><div>                    ^</div><div>/home/erdem/llvm/include/llvm/IR/Constants.h:1092:20: note:   candidate expects 5 arguments, 2 provided</div><div>/home/erdem/llvm/include/llvm/IR/Constants.h:1100:20: note: static llvm::Constant* llvm::ConstantExpr::getGetElementPtr(llvm::Type*, llvm::Constant*, llvm::Constant*, bool, llvm::Type*)</div><div>   static Constant *getGetElementPtr(Type *Ty, Constant *C, Constant *Idx,</div><div>                    ^</div><div>/home/erdem/llvm/include/llvm/IR/Constants.h:1100:20: note:   candidate expects 5 arguments, 2 provided</div><div>/home/erdem/llvm/include/llvm/IR/Constants.h:1108:20: note: static llvm::Constant* llvm::ConstantExpr::getGetElementPtr(llvm::Type*, llvm::Constant*, llvm::ArrayRef<llvm::Value*>, bool, llvm::Type*)</div><div>   static Constant *getGetElementPtr(Type *Ty, Constant *C,</div><div>                    ^</div><div>/home/erdem/llvm/include/llvm/IR/Constants.h:1108:20: note:   candidate expects 5 arguments, 2 provided</div><div><br></div><div>... and some unused variable warnings. Is there another way to compile the cpp file generated by -march=cpp?</div><div><br></div><div>Erdem</div><br><div>> Subject: Re: [llvm-dev] LLVM IR to C++<br>> To: erdemderebasoglu@hotmail.com; llvm-dev@lists.llvm.org<br>> From: jonathan@codesourcery.com<br>> Date: Mon, 15 Feb 2016 18:33:50 -0700<br>> <br>> <br>> <br>> On 2/15/16 6:16 PM, Erdem Derebaþoðlu via llvm-dev wrote:<br>> > Hi,<br>> ><br>> > I want to convert LLVM bitcode files to cpp. I use these commands:<br>> ><br>> > 1. clang -c -emit-llvm -fopenmp=libiomp5 oh2.c -o oh2.bc<br>> > 2. llc -march=cpp oh2.bc -o oh2.cpp<br>> > 3. g++ -fno-rtti -O0 -g `$HOME/llvmbuild/bin/llvm-config --cxxflags`<br>> > oh2.cpp `$HOME/llvmbuild/bin/llvm-config --ldflags --libs --system-libs`<br>> > -o oh2c<br>> ><br>> > After the 3rd command, I get a lot of compilation errors. Is it possible<br>> > that llc -march=cpp generates incorrect code?<br>> <br>> What kinds of compilation errors are you seeing?<br>> <br>> <br>> Jon<br>> <br>> ><br>> > Thanks,<br>> ><br>> > Erdem Derebasoglu<br>> ><br>> ><br>> > _______________________________________________<br>> > LLVM Developers mailing list<br>> > llvm-dev@lists.llvm.org<br>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br>> ><br>> <br>> -- <br>> Jon Roelofs<br>> jonathan@codesourcery.com<br>> CodeSourcery / Mentor Embedded<br></div></div>                                       </div></body>
</html>