Git Product home page Git Product logo

Comments (6)

gururaj-s avatar gururaj-s commented on August 24, 2024 2

To build on the previous answer - the exact changes needed in the Skeleton.cpp code to make it work with LLVM-10 were the following:

Change line-23 from Constant *logFunc = F.getParent()->getOrInsertFunction("logop", logFuncType);
to : FunctionCallee logFunc = F.getParent()->getOrInsertFunction("logop", logFuncType);

Change line-34 from builder.CreateCall(logFunc, args);
to : builder.CreateCall(logFuncType,logFunc.getCallee(), args);

from llvm-pass-skeleton.

alisemi avatar alisemi commented on August 24, 2024 1

I came here following the Mike Shah's seminar, and I am using LLVM version 11.0. Here is my solution for the problem:
Change the line
Constant* hook = M.getOrInsertFunction(InstrumentingFunctionName, funcTy);
to
Value* hook = M.getOrInsertFunction(InstrumentingFunctionName, funcTy).getCallee();

and add #include "llvm/IR/Value.h" . Here is the explanation, the FunctionCallee class has a *Value attribute and Value class is a super class of Constant. In the new version of LLVM, the CallInst::Create also takes *Value as parameter rather than *Constant. Alternatively, passing the FunctionCallee as an argument to CallInst::Create might also work.

from llvm-pass-skeleton.

sampsyo avatar sampsyo commented on August 24, 2024

Hello! As the README says, this repository currently targets LLVM 3.8. Which version are you trying to use?

from llvm-pass-skeleton.

youngmaia5 avatar youngmaia5 commented on August 24, 2024

I'm using LLVM 8.0. However, I also followed another tutorial by Mike Shah (Northeastern+MIT LLVM Seminar - Introduction to LLVM) that works with LLVM 8.0, and I get the same error using his code. So, I'm thinking it does not have to do with the LLVM version. What do you think?

from llvm-pass-skeleton.

sampsyo avatar sampsyo commented on August 24, 2024

I'm not sure about that other tutorial, but I'm nearly certain that this error with this code is version-related. In 3.8, getOrInsertFunction returned a Function*. Now, it returns a FunctionCallee. You can either try with 3.8 or—if you're feeling generous!—help update the code for the new API changes since then.

from llvm-pass-skeleton.

youngmaia5 avatar youngmaia5 commented on August 24, 2024

OK, that makes sense. Thank you!

from llvm-pass-skeleton.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.