Displaying 3 results from an estimated 3 matches for "dhashty".
Did you mean:
dhash
2020 Sep 30
2
Creating a global variable for a struct array
Let me clarify my question.
I have a struct array h1 as follows:
dhash h1[10];
I want to get a Constant* to variable h1. It looks like I can use ConstantStruct::get(StructType*, ArrayRef<Constant *>) to do this.
My question is how to get the second argument of type ArrayRef<Constant *> from the above variable h1.
Thanks,
Chaitra
________________________________
From: Tim Northover
2020 Oct 01
2
Creating a global variable for a struct array
...itted for brevity).
GlobalVariable *StaticList = Module->getNamedValue("static_list");
// Create the ConstantStruct that will initialize the first
element of the array.
Constant *FirstInitArr[] = { FileName, StaticList };
ConstantStruct *FirstInit = ConstantStruct::get(DHashTy, FirstInitArr);
// Create an all-zero struct for the rest of the array.
Constant *OtherInits = ConstantAggregateZero::get(DHashTy);
// Create the global variable.
Type *H1Ty = ArrayType::get(DHashTy, 10);
Constant *H1InitArr[] = {FirstInit, OtherInits, OtherInits,
OtherInits,...
2020 Oct 01
3
Creating a global variable for a struct array
...= new GlobalVariable(M, intInit->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->...