similar to: [LLVMdev] How to construct parameters for a insert function? one from a return value from previous call, the other one is a string....

Displaying 20 results from an estimated 3000 matches similar to: "[LLVMdev] How to construct parameters for a insert function? one from a return value from previous call, the other one is a string...."

2010 Nov 23
1
[LLVMdev] how to get a void type value in llvm
Hi, sivart Thanks for pointing it out. I used it, and it works. Thank you again. BTW, for any later reference, the function prototype declaration with no arguments is not what I wrote: fcall2 = M.getOrInsertFunction("foo", IntegerType::get(M.getContext(), 32), Type::getVoidTy(M.getContext())); INSTEAD, I changed to : fcall2 = M.getOrInsertFunction("foo",
2010 Nov 23
0
[LLVMdev] how to get a void type value in llvm
Hi Shuying, You will find in the documentation that amongst the overloaded CallInst::Create()'s there is one that takes no function arguments: static CallInst* llvm::CallInst::Create ( Value * F, const Twine & NameStr, BasicBlock * InsertAtEnd); Regards On 23/11/2010, at 11:20 AM, Shuying Liang wrote: > Hi, I want to insert a function with a void type parameter, > for example:
2010 Nov 23
2
[LLVMdev] how to get a void type value in llvm
Hi, I want to insert a function with a void type parameter, for example: int foo(void); OI declared fcall2 = M.getOrInsertFunction("foo", IntegerType::get(M.getContext(), 32), Type::getVoidTy(M.getContext())); then the question is how to get the void type value to make the CallInst inserted sucessfully? (what should be ********) CallInst::Create(fcall2, ******,
2011 May 18
2
[LLVMdev] access array problem
Thank you, Duncan. I rewrote the code, please help check why it still does not work: //declare global variable const Type *IntTy = Type::getInt32Ty(M.getContext()); const Type *ATyC = ArrayType::get(Type::getInt64Ty(M.getContext()), 1); GlobalVariable *CounterSize = new GlobalVariable(M, ATyC, false, GlobalValue::InternalLinkage,
2014 Jan 08
3
[LLVMdev] reference to non-static member function must be called
Hi,everyone. I'm writing a pass in which a CallInst to an external function will be inserted. The function is declared like this: void func(int a, unsigned chat *p); and in the Pass(a Function Pass ,and using the InstVistor template ), I wrote like this: void visitStoreInst(StoreInst &SI) { //Get the refference of the types Module *M =
2011 May 18
2
[LLVMdev] access array problem
于 2011/5/18 14:29, Duncan Sands 写道: > Hi Tan Guangming, > >> I want to access an array in my instrumentation code. For example: >> >> GlobalVariable: >> int *counter; //counter the number of load/store operations in run-time >> int *counterArray; //record the load/store addresses > strictly speaking these are not arrays, they are pointers. Also, you have
2012 Jun 17
3
[LLVMdev] BlockAddress instruction is copied instead of cloned during module link?
I have a module having the blockaddress instruction. When I link it into another module and delete the original, blockaddress disappears and is replaced by inttoptr (i32 1 to i8*). Please compile and run the attached program to see the demo of this problem. Right after linking modules, blockaddress still exists: @switch.bbs = internal global [3 x i8*] [i8* blockaddress(@my_func,
2015 Jan 15
2
[LLVMdev] AllocaInst for FunctionType?
Hi, I'm trying to get my head around c++ - IR - c++ API and getting used tramform manual information to code. The manual states alloca is defined for <type>. FunstionType is a type, so alloca for functionType should be possible? Not? If we have a valid Module *m we can get an allocate instruction allocating space for a non-argumented function as follows: AllocaInst* pa2 = new
2012 Feb 22
1
[LLVMdev] Size of structs & arrays
Eli Friedman-2 wrote: > > > Try llvm::Constant::getNullValue(). > > I'm trying this: llvm::Constant* one = llvm::Constant::getNullValue(llvm::IntegerType::get(mod->getContext(), 64)); llvm::ConstantInt* two = llvm::ConstantInt::get(mod->getContext(), llvm::APInt(32, llvm::StringRef("1"), 10)); std::vector<llvm::Value*> indices;
2009 May 21
3
[LLVMdev] Passing a pointer to a function
I recently began hacking around with my first LLVM pass. The big picture is that I would like to insert function calls for each instruction type, and pass some parameters based on the instruction type. Then I will link the output to some C file that implements those functions. Things were going well until I started trying to make function calls with a pointer as a parameter. For example, I would
2011 May 18
0
[LLVMdev] access array problem
Hi Tan Guangming, > I want to access an array in my instrumentation code. For example: > > GlobalVariable: > int *counter; //counter the number of load/store operations in run-time > int *counterArray; //record the load/store addresses strictly speaking these are not arrays, they are pointers. Also, you have written them in some kind of C-style idiom. What are the declarations
2011 May 18
3
[LLVMdev] access array problem
Hi, I want to access an array in my instrumentation code. For example: GlobalVariable: int *counter; //counter the number of load/store operations in run-time int *counterArray; //record the load/store addresses //increase the counter if a load/store is performed std::vector<Constant *>index(2); index[0] = Constant::getNullvalue(Type:getInt32Ty(Context)); index[1] =
2011 May 18
0
[LLVMdev] access array problem
Hi Guangming Tan, >>> GlobalVariable: >>> int *counter; //counter the number of load/store operations in run-time >>> int *counterArray; //record the load/store addresses >> strictly speaking these are not arrays, they are pointers. Also, you have >> written them in some kind of C-style idiom. What are the declarations in >> LLVM IR? > const Type
2013 Aug 19
4
[LLVMdev] Generating GetElementPtr inlined in a function argument list programmatically
Hello LLVMDev List, It's my first time sending a message to the List - I have been working on a tool for my research project using LLVM. Thanks for your awesome work! I have come across some bytecode like the following with an GetElementPtr instruction in brackets: Bytecode:%3 = call i32 @_Z4funcPKc(i8* getelementptr inbounds ([5 x i8]* @.str2, i32 0, i32 0)) C++ code:func("bleh");
2011 Apr 26
1
[LLVMdev] inserting a fucntion call at the end of basic bloc
2011/4/26 Duncan Sands <baldrick at free.fr> > Hi Nabila, > > > where did the "noalias" attribute and "tail call" (rather than "call") >> come >> from? Are you setting these yourself or running some optimization pass >> after >> your pass? >> >> >> i have written a module pass and i have compiled
2018 Jan 09
2
Passing Array base address/pointer to runtime function in LLVM IR
Hello LLVM, I am a beginner in LLVM My Goal is to initialize array element with random values. llvm::Type *i32_type = llvm::IntegerType::getInt32Ty(allocaInst->getContext()); llvm::Value *value = llvm::ConstantInt::get(i32_type, numberOfElement); args.push_back(getElementPtrInst->getPointerOperand()); args.push_back(value); callInst =
2013 May 13
3
[LLVMdev] Q: When is a boolean not a boolean?
A: When the types are created in different contexts. I've been running into a module validation error related to phi nodes produced by the GVN pass, where the types of the incoming values aren't the same instance of IntegerType i1. I'm not certain I've found the root cause of the problem yet, it's probably due to my handling of LLVMContext & Module life cycles, and this
2011 Sep 16
0
[LLVMdev] How to duplicate a function?
Hi all, I am a newbie in LLVM and I am trying to replace the function like: old function || new function ======================================= int haha(int a) { int haha(int a, char* ID) { ===> } } Of course in the newly replaced function "int haha(int,
2013 May 13
0
[LLVMdev] Q: When is a boolean not a boolean?
Jeremy Lakeman wrote: > A: When the types are created in different contexts. > > I've been running into a module validation error related to phi nodes > produced by the GVN pass, where the types of the incoming values aren't > the same instance of IntegerType i1. > > I'm not certain I've found the root cause of the problem yet, it's > probably due to my
2019 Sep 03
2
Get constants of undefined types in IR
Hi Tim, My mistake not including the llvm-dev, excuse me. affinityElement.__bits[0] worked fine for me, thank you. I am new in using the API for Constants and I am facing the error "incomplete type is not allowed" on the last last of below code: Type * ET = IntegerType::getInt64Ty(I.getContext()); unsigned long size = cpuAffinityVector.size(); ArrayType * AT = ArrayType::get(ET,size);