search for: arraytyp

Displaying 20 results from an estimated 162 matches for "arraytyp".

Did you mean: arraytype
2011 Oct 20
2
[LLVMdev] common type at compile time?
I'm a bit confused. For the Type did you mean something like: ArrayType *type = ArrayType::get(Type::getInt8PtrTy(M.getContext()), 4); This does not work, it gives me ""Wrong type in array element initializer" at runtime. Also it doesn't look like ConstantExpr inherits ConstantArray, so I'm not sure how I could use this instead. Thanks On Thu...
2010 Feb 15
2
[LLVMdev] Incorrect execution of global constructor with JIT on ARM
Hello, llvm developers! I am running LLVM with JIT on ARM. For simple programs it runs ok, but for lager code I have stumbled upon some issues. See following C++ code to which I have reduced the problem: #include <stdio.h> struct Global { typedef unsigned char ArrayType[4]; ArrayType value; Global(const ArrayType& arg) { for (int i = 0; i < 4; i++) this->value[i] = arg[i]; } }; static const unsigned char arr[] = { 1, 2, 3, 4 }; static const Global Constant(arr); int main() { for (int i=0; i<4; i++) printf("%i", Constant.value[i]...
2010 Feb 17
0
[LLVMdev] Incorrect execution of global constructor with JIT on ARM
On 15 February 2010 14:49, Martins Mozeiko <49640f8a at gmail.com> wrote: > #include <stdio.h> > struct Global { >  typedef unsigned char ArrayType[4]; >  ArrayType value; >  Global(const ArrayType& arg) { >    for (int i = 0; i < 4; i++) this->value[i] = arg[i]; >  } > }; > static const unsigned char arr[] = { 1, 2, 3, 4 }; > static const Global Constant(arr); > int main() { >  for (int i=0; i<4; i++)...
2011 Oct 20
3
[LLVMdev] common type at compile time?
I'm trying to create a ConstantArray(whose contents will be of types Function*, GlobalVariable *) so I can immediately create a new GlobalVariable(that will be in its own section). I'm doing this so I have these address stored. In order to create this ConstantArray I need a valid ArrayType, but I'm not sure what to use for the element type. I want this to be done at compile time, so I cant use a BitCastInst to make them all generic pointers. What else can I do? In other words * I built up a vector id like to eventually store as a GlobalVariable array: vector<Constant *>...
2011 Oct 20
0
[LLVMdev] common type at compile time?
On 10/20/11 11:34 AM, ret val wrote: > I'm a bit confused. For the Type did you mean something like: > ArrayType *type = ArrayType::get(Type::getInt8PtrTy(M.getContext()), 4); I assume that creates an ArrayType of 4 elements whose elements are pointers to 8-bit values. If so, then this is what I meant. > This does not work, it gives me ""Wrong type in array element > initializer" at...
2009 Jun 18
3
[LLVMdev] Initialising global Array
Hi, I try to create a array that has a nonzero initialiser: What i do is, first create the array type. > const ArrayType *ATy = ArrayType::get(Type::Int32Ty, NumEdges); Then create some constant values for the initializer. > std::vector<Constant*> Initializer; Initializer.reserve(NumEdges); > APInt zero(32,0); Constant* zeroc = ConstantInt::get(zero); > APInt minusone(32,-1); Constant* minus...
2011 Oct 20
0
[LLVMdev] common type at compile time?
...rying to create a ConstantArray(whose contents will be of types > Function*, GlobalVariable *) so I can immediately create a new > GlobalVariable(that will be in its own section). I'm doing this so I > have these address stored. In order to create this ConstantArray I > need a valid ArrayType, but I'm not sure what to use for the element > type. > > I want this to be done at compile time, so I cant use a BitCastInst to > make them all generic pointers. What else can I do? You can use a ConstantExpr (constant expression) for Function and GlobalVariable objects. The A...
2009 Jun 18
0
[LLVMdev] Initialising global Array
Andreas Neustifter wrote: > Hi, > > I try to create a array that has a nonzero initialiser: > > What i do is, first create the array type. > > > const ArrayType *ATy = ArrayType::get(Type::Int32Ty, NumEdges); > > Then create some constant values for the initializer. > > > std::vector<Constant*> Initializer; Initializer.reserve(NumEdges); > > I ran the following two functions in a ModulePass. The Initializer initialization...
2019 Sep 03
2
Get constants of undefined types in IR
.... 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); Internet gives different solutions for this error but none of them was appropriate for this case. Could you please help? Regards,Iulia On Tuesday, September 3, 2019, 8:15:26 PM GMT+3, Tim Northover <t.p.northover at gmail.com> wrote: Adding llv...
2008 Oct 14
5
[LLVMdev] Making GEP into vector illegal?
...2008, at 11:02 AM, Duncan Sands wrote: > Hi Mon Ping, > >> I would like to make it illegal to GEP into a vector as I think it is >> cleaner and more consistent. Opinions? Comments? > > now that arrays are first class types, I think vectors should become > a subclass of ArrayType. This would get rid of a lot of duplicated > code, and also fix a bunch of problems with vectors (eg: that sizes > are wrong; currently we think that a <n x i1> has length n bits, and > that a vector <n x x86_fp80> has length 80*n bits, both of which are > untenable). I&...
2010 Jun 01
2
[LLVMdev] How to create global string array? (user question)
...de "llvm/Constants.h" #include "llvm/Instructions.h" #include "llvm/Analysis/Verifier.h" #include <stdio.h> #include <vector> using namespace llvm; using namespace std; Constant* mk_string(Module *M, LLVMContext &Context, const string &svalue) { ArrayType *Ty = ArrayType::get(Type::getInt8Ty(Context),svalue.size()+1); GlobalVariable *GV = new llvm::GlobalVariable( *M, Ty, true, GlobalValue::InternalLinkage, ConstantArray::get(Context,svalue), "str", 0, false, 0); vector<Constant*>...
2012 Jul 04
2
[LLVMdev] Bogus assert in VMCore/Instructions.cpp CallInst::Create?
...on intrinsic function, which has a signature of (i32, i8*, i8*, i32). The code is below. void addAnnotation( BasicBlock *block, Function *F) { string foo = "foo"; string bar = "barr"; Type *charTy = Type::getInt8Ty(block->getContext()); ArrayType *s1Ty = ArrayType::get(charTy, foo.size()+1); ArrayType *s2Ty = ArrayType::get(charTy, bar.size()+1); Constant *ar1 = ConstantArray::get(block->getContext(), foo); Constant *ar2 = ConstantArray::get(block->getContext(), bar); GlobalVariable *g1 = NULL; Global...
2010 Jan 18
5
[LLVMdev] [patch] Union Types - work in progress
...ou can use SmallVector instead of std::vector for ParamsList & ParamsListTy. @@ -2135,7 +2173,8 @@ ParseToken(lltok::rparen, "expected ')' in extractvalue constantexpr")) return true; - if (!isa<StructType>(Val->getType()) && !isa<ArrayType>(Val- >getType())) + if (!isa<StructType>(Val->getType()) && !isa<ArrayType>(Val- >getType()) && + !isa<UnionType>(Val->getType())) return Error(ID.Loc, "extractvalue operand must be array or struct"); if (!Ex...
2008 Oct 15
0
[LLVMdev] Making GEP into vector illegal?
Hi Chris, > I'm happy about factoring the code better, but a vectortype isn't an > arraytype (isa<ArrayType>(V) should be false). Maybe a common base > class (like sequential type) would be better? currently anything you can do with an array you can do with a vector. So from this functional viewpoint it would make sense to have a vector be an array with more stuff (i.e. a sub...
2010 Apr 08
2
[LLVMdev] Declaring constant global variables
Hiya, I want to declare a constant global variable as: @.str = private constant [4 x i8] c"%f\0A\00", align 1 ; <[4 x i8]*> [#uses=1] I guess I should firstly declare an arrayType object, then declare a GlobalVariable object. I have two problems: 1. What element type I should set for the arrayType? 2. How to set the constant value as :c"%f\0A\00" Cheers, Zheng
2010 Feb 17
2
[LLVMdev] Incorrect codegen of getelementptr for ARM with JIT
...this is a bug? Or am I missing something else here? -- Martins Mozeiko On Feb 17, 2010, at 12:23 , Renato Golin wrote: > On 15 February 2010 14:49, Martins Mozeiko <49640f8a at gmail.com> wrote: >> #include <stdio.h> >> struct Global { >> typedef unsigned char ArrayType[4]; >> ArrayType value; >> Global(const ArrayType& arg) { >> for (int i = 0; i < 4; i++) this->value[i] = arg[i]; >> } >> }; >> static const unsigned char arr[] = { 1, 2, 3, 4 }; >> static const Global Constant(arr); >> int main() { &...
2012 Jul 04
0
[LLVMdev] Bogus assert in VMCore/Instructions.cpp CallInst::Create?
...2, > i8*, i8*, i32). The code is below. > > void addAnnotation( BasicBlock *block, Function *F) > { > string foo = "foo"; > string bar = "barr"; > > Type *charTy = Type::getInt8Ty(block->getContext()); > > ArrayType *s1Ty = ArrayType::get(charTy, foo.size()+1); > ArrayType *s2Ty = ArrayType::get(charTy, bar.size()+1); > > Constant *ar1 = ConstantArray::get(block->getContext(), foo); > Constant *ar2 = ConstantArray::get(block->getContext(), bar); > > Global...
2010 Jan 28
0
[LLVMdev] [patch] Union Types - work in progress
...td::vector > for ParamsList & ParamsListTy. > > @@ -2135,7 +2173,8 @@ > ParseToken(lltok::rparen, "expected ')' in extractvalue > constantexpr")) > return true; > > - if (!isa<StructType>(Val->getType()) && > !isa<ArrayType>(Val->getType())) > + if (!isa<StructType>(Val->getType()) && > !isa<ArrayType>(Val->getType()) && > + !isa<UnionType>(Val->getType())) > return Error(ID.Loc, "extractvalue operand must be array or struct"); &gt...
2011 Aug 05
3
[LLVMdev] Experimental fixes to CBackend
...sulting into declarations being placed directly into functions prototypes (previously it was not happening as well) I'm not very familiar with llvm internals, but tried by best to fix the problems. Please see proposed patches in attachment. Briefly, I'm creating fictive StructType for each ArrayType and slightly changing logic of anonymous structs definition to account the special case of ArrayType-s. - D. -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm.patch Type: text/x-patch Size: 5153 bytes Desc: not available URL: <http://lists.llvm.org/piperm...
2013 Aug 05
2
[LLVMdev] Can I add GlobalVariable in MachineFunctionPass ?
Hello, I want to add a global variable of arrayType in my MachineFunctionPass. However, I only get const Module from MachineFunction.getMMI().getModule(). I can't add any global variable to a const Module. Another way is to add a global variable in doInitialization in my MachineFunctionPass, but I can't determine the size of my arrayType f...