[LLVMdev] Fwd: Error While Inserting New Instruction to LLVM IR

Arnamoy Bhattacharyya arnamoy at ualberta.ca
Sun May 20 13:13:59 PDT 2012


Giving reply to my own answer.  I guess I have to modify
SelectionDAGBuilder.cpp itself now.  As it was not included in the guide
and it was said in the guide that - "test your instruction", I thought
without modifying SelectionDAGBuilder.cpp, I would be able to "test" my
code.  Can anyone tell me what do they mean by that?  How do I "test my
instruction"?  Does it mean it has to be tested AFTER modifying the stuff
with SelectionDAG (may be adding a SelectionDAG Node too)?

---------- Forwarded message ----------
From: Arnamoy Bhattacharyya <arnamoy at ualberta.ca>
Date: Sun, May 20, 2012 at 1:24 PM
Subject: Error While Inserting New Instruction to LLVM IR
To: llvmdev at cs.uiuc.edu


Hello;

I wanted to insert two new terminator instructions in LLVM IR.  I modified
the necessary files (as mentioned in the tutorial in LLVM site and some
more to meet the new structure of LLVM, (e.g no Lexer.l now, we have
LLLexer.cpp.  Again in the tutorial, files like LLVMBitCodes.h,
include/llvm-c/core.h that need to be modified are not mentioned) But I am
getting the error while building LLVM.  The SelectionDagBuilder.cpp file is
giving the error.

*In file included from
/home/arnie/llvm-svn/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:946:0:
*
*/home/arnie/llvm-svn/llvm/include/llvm/Instruction.def: In member function
‘void llvm::SelectionDAGBuilder::visit(unsigned int, const llvm::User&)’:*
*/home/arnie/llvm-svn/llvm/include/llvm/Instruction.def:104:1: error:
‘visitXXX’ was not declared in this scope*
*/home/arnie/llvm-svn/llvm/include/llvm/Instruction.def:105:1: error:
‘visitYYY’ was not declared in this scope*

But part of my Instruction.def looks like this (after inserting XXX and
YYY)- .
.......
HANDLE_TERM_INST  ( 7, Unreachable, UnreachableInst)
HANDLE_TERM_INST  ( 8, XXX      , XXXInst)
HANDLE_TERM_INST  ( 9, YYY     , YYYInst)
  LAST_TERM_INST  ( 9)
.......
Can anybody guess what may be the reason of this error?  Did I miss any
files that need to be modified. Below are the list of files I modified to
add new LLVM IR instruction.

llvm/include/llvm/Instruction.def
llvm/include/llvm/Instructions.h
llvm/include/llvm/Support/InstVisitor.h
llvm/lib/AsmParser/< necessary files>
llvm/include/llvm/Bitcode/LLVMBitCodes.h
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/VMCore/Instruction.cpp
llvm/lib/VMCore/Instructions.cpp
llvm/include/llvm-c/core.h

Thank you;


-- 
Arnamoy Bhattacharyya
Athabasca Hall 143
Department of Computing Science - University of Alberta
Edmonton, Alberta, Canada, T6G 2E8
780-680-7073



-- 
Arnamoy Bhattacharyya
Athabasca Hall 143
Department of Computing Science - University of Alberta
Edmonton, Alberta, Canada, T6G 2E8
780-680-7073
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120520/c2e57bcf/attachment.html>


More information about the llvm-dev mailing list