search for: getpointerto

Displaying 20 results from an estimated 23 matches for "getpointerto".

Did you mean: getpointerty
2018 Jun 12
2
Proper method to initialize all LLVM Internal Data Structures?
...le *M = parseIRFile(InputIR, diag, context).get(); if (M == nullptr) { diag.print("LLVM", errs()); exit(-1); } assert(M->isMaterialized() && "Module not materialized!"); PointerType *ArrayPtrTy = M->getTypeByName("struct._Array")->getPointerTo(); ``` However this piece of code crashes at Module::getTypeByName because getContext().pImpl is NULL pointer. Other similar issues include Module::getTypeByName results in a NULL pointer dereference because TheTable in StringMap is not allocated/initialized. It would be great if someone could...
2012 May 28
3
[LLVMdev] Windows assertion failure
...rivedTypes.h> > #include <llvm/LLVMContext.h> > > using namespace llvm; > > int main( int argc, char const *argv[] ) { > LLVMContext &ctx = getGlobalContext(); > > Type *void_type( Type::getVoidTy( ctx ) ); > PointerType *void_ptr_type( void_type->getPointerTo() ); > > return 0; > } When compiled using the clang binaries with MinGW32 and run, I get: > Assertion failed: isValidElementType(EltTy) && "Invalid type for pointer element!", file /Users/asl/Projects/llvm/release/3.1/src/lib/VMCore/Type.cpp, line 748 Why? - Pa...
2013 Oct 10
0
[LLVMdev] Illegal BitCast assertion failed
...nteger constant, and // typeInFrontOfTheStream be an llvm::Type* that represents the type of the variable // available as the next read from the stream llvm::CallInst *consume = llvm::CallInst::Create(Func, CArgs); llvm::BitCastInst *cbi = new llvm::BitCastInst(consume, typeInFrontOfTheStream->getPointerTo()); For the first example when running this pass, the typeInFrontOfTheStream is an i1, which means the result of typeInFrontOfTheStream->getPointerTo() is an i1*. Remember that consume is a function that returns void*, which is seen in LLVMIR as i8*. And, for a first execution like that, I'...
2010 Jun 01
2
[LLVMdev] How to create global string array? (user question)
...{ LLVMContext Context; Module *M = new Module("test", Context); // vector<Constant*> strs; strs.push_back(mk_string(M, Context, "s1")); strs.push_back(mk_string(M, Context, "s2")); ArrayType *Ty = ArrayType::get(Type::getInt8Ty(Context)->getPointerTo(),2); new llvm::GlobalVariable( *M, Ty, true, GlobalValue::InternalLinkage, ConstantArray::get(Ty,strs), "ss", 0, false, 0); verifyModule(*M); delete M; }
2014 Oct 27
2
[LLVMdev] How to call a pointer that points to a C function
I have a pointer to a function that I need to invoke without going through llvm::Module::getOrInsertFunction. This example does not work: static int add(int x, int y); llvm::Value *one, *two; llvm::Constant* addfn = llvm::ConstantInt::get(JB->getIntPtrTy(DataLayout), (intptr_t)add); llvm::Type* args[] = { Int32Ty, Int32Ty }; llvm::FunctionType* ftype = llvm::FunctionType::get(Int32Ty,
2015 Mar 10
4
[LLVMdev] noob IR builder question
...= llvm::BasicBlock::Create(context, "entrypoint", mainFunc); 15 builder.SetInsertPoint(entry); 16 17 llvm::Value *helloWorld = builder.CreateGlobalStringPtr("hello world!\n"); 18 19 std::vector<llvm::Type *> putsArgs; 20 putsArgs.push_back(builder.getInt8Ty()->getPointerTo()); 21 llvm::ArrayRef<llvm::Type*> argsRef(putsArgs); 22 23 llvm::FunctionType *putsType = 24 llvm::FunctionType::get(builder.getInt32Ty(), argsRef, false); 25 llvm::Constant *putsFunc = module->getOrInsertFunction("puts", putsType); 26 27 Value *a; 28 builder.Cr...
2020 Jul 22
2
[RFC] Requiring explicit address space arguments for PointerType
...ss spaces. We make extensive use of address spaces: all our pointers (CHERI capabilities) use address space 200 instead of the default zero to ensure that we generated CHERI instructions instead of integer arithmetic. The problem we have is that almost every use of PointerType::getUnqual() or ->getPointerTo() without an address space parameter will result in an assertion failure/"cannot select" or even a miscompilation due to creating an addrspace(0) pointer. After every upstream merge I have to fix the new uses that have been introduced since the last merge and I get lots of merge conflicts...
2020 Jul 24
3
[RFC] Requiring explicit address space arguments for PointerType
I agree, improving this makes sense. Alexander, I don’t think that “LLVM_DEFAULT_AS_PARAM” is the right way to go, I would just remove the “ = 0” default parameter entirely. -Chris > On Jul 23, 2020, at 11:02 AM, Nicolai Hähnle via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi Alex, > > I'd be very much in favor of this, thanks for pushing ;) > > On Wed,
2010 Apr 18
2
[LLVMdev] Creating a Return Instruction.
Hi all, I have to create a return instruction in a function. The function is of type -- void * func (void *) . So i have to create a return instruction for the function that should return a void pointer. But actually the function will not return anything useful . it will be something like -- return void * null. The problem i am facing is to create a return instruction the Create function
2011 Jul 12
2
[LLVMdev] r134829
On Jul 12, 2011, at 5:04 AM, Vitaly Lugovskiy wrote: > Hi Chris, > > What's a new way of building recursive types (with C bindings), once > RefineType had been removed? And what's an exact reason for getting > rid of the opaque types - I could not find a relevant discussion in a > mailing list. Hi Vitaly, I didn't add this API, because I'm not very familiar
2009 Nov 18
2
[LLVMdev] Unwinding through a native layer
...fc merely executes an unwind. - fa uses invoke to call fb, passing its own arguments to it, which in turn calls fc. - At runtime fa is called (after jitting from a main(...) C routine), with a pointer to an ExecutionEngine instance, and a Function pointer to fc, both typed as Type::Int8Ty->getPointerTo() (at code generation time). - fa takes these arguments and invokes fb with them. - fb being a non-generated C function, takes the passed in Function pointer and engine instance, retrieves the jitted C pointer, and calls it. - As this pointer is a pointer to fc, the unwind is then executed....
2011 Mar 26
0
[LLVMdev] How to read memory data througn adress of unsigned long
On Fri, Mar 25, 2011 at 8:53 PM, Michael.Kang <blackfin.kang at gmail.com> wrote: > I have a value of long type and like to get the data at the adress in the value: > > ################# > unsigned long v = 0xc0008000 > Value* addr = ConstantInt::get(getIntegerType(64), v) > #################### > > Then I try to use LoadInstr to get a load instruction of ir as the
2010 Oct 19
0
[LLVMdev] How to assign a constant to a register?
> let me say that in general doing this is pointless. Due to SSA form, if %x is > set to 5 you can't set it to something else later. Thus everywhere that > you > use %x you might as well just directly use 5 there instead. My bad... I should've started thinking in SSA way all the time. I got it mixed with common assembly language. So I must hold the initial value until the
2010 Oct 18
3
[LLVMdev] How to assign a constant to a register?
hi, Well, there is no "Register" at the level of LLVM IR, %x = add i32 %y, %z means you define a value "x" by adding value "y" and value "z" together. best regards ether
2010 May 05
2
[LLVMdev] How to cast an integer array to an integer pointer? (user question)
...( GGV, ConstantInt::get(Type::getInt32Ty(Context), 0), "zzz", BB ); // func call Function *PutsF = cast<Function>(M->getOrInsertFunction("puts", Type::getVoidTy(Context), Type::getInt8Ty(Context)->getPointerTo(), (Type *)0)); CallInst::Create(PutsF, (Value* const*)&gepi, (Value* const*)(&gepi)+1, "", BB);
2011 Mar 26
2
[LLVMdev] How to read memory data througn adress of unsigned long
I have a value of long type and like to get the data at the adress in the value: ################# unsigned long v = 0xc0008000 Value* addr = ConstantInt::get(getIntegerType(64), v) #################### Then I try to use LoadInstr to get a load instruction of ir as the following: ############################ Value* data = new LoadInst(addr, "", false, bb); encounter segmentation
2012 Jan 17
0
[LLVMdev] ValueMapper question: no type mapping for GlobalValue?
...er("linker-name", "main-module", context, 0); string errMsg; linker->LinkInModule(mod1, &errMsg); Module *mod2 = new Module("second", context); GlobalVariable *refGVar = new GlobalVariable(*mod2, type->getPointerTo(), false, GlobalValue::ExternalLinkage, gvar, "referencing_variable" ); // do the verifier pass (completes successfully) PassManager pm; pm.add(createVerifierPass());...
2017 Nov 23
1
JIT and atexit crash
Hi, Not sure whether this matches your use case, but the Orc-based JIT used in LLI appears to be using `llvm::orc::LocalCXXRuntimeOverrides` (http://llvm.org/doxygen/classllvm_1_1orc_1_1LocalCXXRuntimeOverrides.html) to override `__cxa_atexit`: https://github.com/llvm-mirror/llvm/blob/release_50/tools/lli/OrcLazyJIT.h#L74
2012 Jan 13
2
[LLVMdev] ValueMapper question: no type mapping for GlobalValue?
=?ISO-8859-1?Q?Rafael_=C1vila_de_Esp=EDndola?= wrote: > > I can reproduce this consistently, but only under an extremely large pile of > > code :-) I haven't tried to strip it down to minimal a test case yet, but I > > will. One salient difference with the code you've provided is that in my > > code, @a is a struct type. However, changing the example to use a
2009 Nov 18
3
[LLVMdev] ABCD Example Failure Given Here
I am trying to employ the ABCD optimization pass to remove unnecessary branches in the code my compiler generates. But in its current form (yesterday's trunk) the pass changes the behavior of the code such that execution yields invalid results, which is obviously not what I want. The switch in the following listing is used to implement a virtual method call, 99999 and 100000 are type