Displaying 2 results from an estimated 2 matches for "htabinitarr".
2020 Oct 01
3
Creating a global variable for a struct array
...>getType(), false,
GlobalVariable::ExternalLinkage, intInit, ".int");
//create ConstantStruct for each hashtable entry
Constant *dhashInit[] = {filenmConst, intConst};
Constant *dhashConst = ConstantStruct::get(dhashTy, dhashInit);
Constant* htabInitArr[2];
htabInitArr[0] = dhashConst;
htabInitArr[1] = dhashConst;
ArrayType *htabTy = ArrayType::get(dhashTy, 2);
Constant *htabInit = ConstantArray::get(htabTy, makeArrayRef(htabInitArr,2));
GlobalVariable *htabConst = new GlobalVariable(M, htabInit->getType(), false,...
2020 Oct 01
2
Creating a global variable for a struct array
Thank you very much. The code to initialize h1 to non-zero values was what I was looking for.
It's almost working except for a type mismatch wrt dlist* llist field of h1.
dlist static_lst[10] = { {1, 5, NULL}, ... };
dhash h1[10] = {{"myfile.txt", static_lst}, ... };
Along the lines of the code you had sent, I created a GlobalVariable* llist of type [10 x %struct.dlist]* for the