Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you print instruction in llvm

From an llvm pass, I need to print an llvm instruction (Type llvm::Instruction) on the screen, just like as it appears in the llvm bitcode file. Actually my compilation is crashing, and does not reach the point where bitcode file is generated. So for debugging I want to print some instructions to know what is going wrong.

like image 266
pythonic Avatar asked Nov 12 '12 17:11

pythonic


2 Answers

Assuming I is your instruction

I.print(errs());
like image 67
Zhongjun 'Mark' Jin Avatar answered Sep 28 '22 07:09

Zhongjun 'Mark' Jin


By simply using the print method.

like image 33
MetallicPriest Avatar answered Sep 28 '22 06:09

MetallicPriest