similar to: Cast a function parameter to GEP

Displaying 20 results from an estimated 2000 matches similar to: "Cast a function parameter to GEP"

2019 Mar 09
2
Cast a function parameter to GEP
Thanks Tim, I'll try to solve my problem ASAP, if I cannot maybe I'll some other clarifications. Thanks again On Sat, Mar 9, 2019, 06:03 Tim Northover <t.p.northover at gmail.com> wrote: > Hi Alberto, > > On Sat, 9 Mar 2019 at 05:50, Alberto Barbaro via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > i8* getelementptr inbounds ([7 x i8], [7 x i8]*
2014 Nov 22
3
[LLVMdev] How to get the indices in an getelementptr Value?
On Sat, Nov 22, 2014 at 11:09 AM, Sanjoy Das <sanjoy at playingwithpointers.com > wrote: > Hi Qiuping, > > If I'm reading the IR correctly, what you have is a > GetElementPtrConstantExpr [1]. It subclasses from llvm::Constant. > If you want the same code to handle GetElementPtrConstantExpr *and* GetElementPtrInst, you can use GEPOperator. > > Thanks, > --
2019 Jan 26
2
How to pass arbitrary arguments to runFunctionAsMain?
Hi, I'm trying to call the function main passing arbitrary parameters. My code is something like: Please note that MyInterpreter extends Interpreter StringRef filename = argv[1]; std::unique_ptr<Module> m(parseIRFile(filename, error, context)); MyInterpreter * v = new MyInterpreter(std::move(m)); v->finalizeObject(); errs() << "Done\n";
2013 Aug 02
1
[LLVMdev] replacing GetElementPtrConstantExpr with GetElementPtrInst ... sometimes
Hi During a pass, the XCore target lowers thread local global variables by turning them into global variable arrays indexed by the (max 8) thread ID. (see XCoreLowerThreadLocal.cpp) This works fine for instructions e.g. GetElementPtrInst But can't be done for constants e.g. GetElementPtrConstantExpr Thus I would like to replace GetElementPtrConstantExpr with GetElementPtrInst when it is
2009 Apr 30
2
[LLVMdev] Pulling line number/file/path information from DbgStopPointInst instructions
Hmm... if I do a print() on the result of getFileName(), I get i8 * getelementptr ([9 x i8]* @.str, i32 0, i32 0) back, but if I try to dyn_cast this to GetElementPtrInst it fails (returning null), so presumably I'm seeing a GetElementPtrConstantExpr... so how can I get at that constant i8 array without casting to a GetElementPtrInst, and with GetElementPtrConstantExpr being
2010 Jun 01
2
[LLVMdev] How to create global string array? (user question)
I am trying to create such module with API (it's equivalent to c++: const char* ss[] = {"s1","s2"};): @ss = global [2 x i8*] [i8* getelementptr inbounds ([3 x i8]* @.str1, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8]* @.str2, i32 0, i32 0)] ; <[2 x i8*]*> [#uses=0] @.str1 = private constant [3 x i8] c"s1\00", align 1 ; <[3 x i8]*> [#uses=1]
2014 Nov 22
2
[LLVMdev] How to get the indices in an getelementptr Value?
Hi Michael, Thank you very much. But idx_begin/idx_end iterators can only be used through a getelementptr instruction, right? However, I think value "i32* getelementptr inbounds (%struct.Args* @globalArg, i64 0, i32 2)" itself is not a getelementptr instruction, so? Or could you tell me how can I get a getelementptr instruction first from this value?
2012 Jan 27
2
[LLVMdev] How to get the string value?
Hi, if I have some LLVM code like this: @.str = private unnamed_addr constant [7 x i8] c"in_arr\00", align 1 @.str1 = private unnamed_addr constant [8 x i8] c"in_arr2\00", align 1 @.str2 = private unnamed_addr constant [8 x i8] c"out_arr\00", align 1 ... ... call void (...)* @_Z16fooz(i8* *getelementptr inbounds ([7 x i8]* @.str, i64 0, i64 0)*, i32 0, i32 1024)
2010 Jun 18
0
[LLVMdev] Question on Load and GetElementPtr instructions
Good evening, Tang. > What is the type of the first operand of the instruction (i.e., > getOperand(0))? It might be ConstantExpr. You may use dyn_cast<GEPOperator>(getPointerOperand()). Also GetElementPtrInst* can be casted to GEPOperator. ...Takumi 2010/6/18 Xiaolong Tang <xiaolong.snake at gmail.com>: > > Hey, > > Considering the following instruction: >
2012 Jan 27
0
[LLVMdev] How to get the string value?
Hi Welson Sun, > Hi, if I have some LLVM code like this: > > @.str = private unnamed_addr constant [7 x i8] c"in_arr\00", align 1 > @.str1 = private unnamed_addr constant [8 x i8] c"in_arr2\00", align 1 > @.str2 = private unnamed_addr constant [8 x i8] c"out_arr\00", align 1 > ... > ... > > call void (...)* @_Z16fooz(i8* *getelementptr
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");
2012 Jan 28
0
[LLVMdev] How to get the string value?
Hi Welson, > Yes, it is a ConstantExpr! Thank you! > > Now trying to find a clue in ConstantExpr's functions to get that string :-) you can get the pointer operand by doing: getOperand(0) The i'th index is getOperand(i+1). Ciao, Duncan. > > Regards, > Welson > > On Thu, Jan 26, 2012 at 9:04 PM, Duncan Sands <baldrick at free.fr > <mailto:baldrick at
2019 Nov 20
2
Get the address of ConstantDataArray
Hi all, I have a global array declared as: table = internal constant [8 x [256 x i32]] ... At the moment I'm able to get the reference to table using Constant* g_var = cast<GlobalVariable>(I.getOperand(0))->getInitializer(); ( please consider I to be a GetElementPtrInst object ). Now I would like to understand how to get the address of table[2][3], for instance, considering that I
2019 Jul 17
2
Help to understand LoadValueFromMemory
Hi all, I'm trying to print to screen the value read by the fread function. I'm at the point where source refers to the GetElementPtrInst ( pointer to the buffer where fread stored the data - %5 in my case ) and the fread() has been already called. I thought the correct approach to achieve what I need was: ExecutionContext& SF = ECStack.back(); GenericValue SRC =
2012 Jan 27
3
[LLVMdev] How to get the string value?
Thanks Duncan, Yes, it is a ConstantExpr! Thank you! Now trying to find a clue in ConstantExpr's functions to get that string :-) Regards, Welson On Thu, Jan 26, 2012 at 9:04 PM, Duncan Sands <baldrick at free.fr> wrote: > Hi Welson Sun, > > > Hi, if I have some LLVM code like this: > > > > @.str = private unnamed_addr constant [7 x i8]
2008 Jan 06
4
[LLVMdev] Another memory fun
hm.... I think, that is valid in c but next code too doesn't works right: ; ModuleID = 'sample.lz' @.str1 = internal global [6 x i8] c"world\00" ; <[6 x i8]*> [#uses=1] @.str2 = internal global [7 x i8] c"hello \00" ; <[7 x i8]*> [#uses=1] @.str7 = internal global [7 x i8] c"father\00" ; <[7 x i8]*> [#uses=1]
2012 Jan 28
1
[LLVMdev] How to get the string value?
Hey Duncan, Thanks! I figured out this piece of code finally: Value *gep = call->getArgOperand(0); if ( ConstantExpr *pCE = dyn_cast<ConstantExpr>(gep) ) { Value *firstop = pCE->getOperand(0); if (GlobalVariable *GV = dyn_cast<GlobalVariable>(firstop)){ Constant *v = GV->getInitializer(); if
2011 Aug 10
2
using if then statements in a dataframe
I used this service several months ago and was very pleased with the response. I have a dataframe with several thousand lines and to each line I need to apply a series of "if else" statements. For each row I need either a value or a blank/NA. Below is the series of if else statements I have been trying without success to integrate into a function such as "apply". if
2016 Nov 28
2
Looking for help with an ast matcher
Hi Piotr, I think I found a working matcher: match ifStmt(hasCondition(implicitCastExpr(hasImplicitDestinationType(isInteger()), has(cxxMemberCallExpr(callee(cxxMethodDecl(hasName("compare"))), hasArgument(0, declRefExpr().bind("str2")), callee(memberExpr(has(declRefExpr().bind("str1"))))))))).bind("case1") This one bind to both str1 and str2 in
2016 Nov 28
2
Looking for help with an ast matcher
Hi Piotr, Thanks. Yeah, it seemed a little weird, but it was what got me closest. I found out that the matcher I supplied here was working for clang-query 3.8.1. I'm working on a clang-tidy module for 4.0.0 - it's not working there. Could you elaborate on the "onImplicitObjectArgument"? There is no document on it on the clang page. So I wouldn't know how it works or what it