Displaying 3 results from an estimated 3 matches for "entry_inst".
2010 Apr 18
4
[LLVMdev] create two Twine object
...ew std::string(ss.str());
return varname->c_str();
}
const char *VarNum = getVarNum();
Twine *x1 = new Twine(StringRef("status"), VarNum); // 1
Twine *x2 = new Twine(StringRef("request"), VarNum); // 2
Instruction *sstatusInst = new AllocaInst(StatusTy, *x1, entry_inst); //
3
Instruction *sreqInst = new AllocaInst(ReqTy, *x2, entry_inst); //
4
with only 1&3, my code works well, I can have status1, status2, status3,
......
with 1&2&3&4 exists at the same time, it compiles without problem, but
segmentation fault happens.
Instruct...
2010 Apr 18
0
[LLVMdev] create two Twine object
According to documentation Twines should be used only for temporary
values and not stored, so allocating the in heap sounds wrong.
I think all you need here is
static int varNum;
++varNum;
Instruction *sstatusInst = new AllocaInst(StatusTy, Twine("status") +
Twine(varNum), entry_inst);
Instruction *sreqInst = new AllocaInst(ReqTy, Twine("request") +
Twine(varNum), entry_inst);
btw, your getVarNum() leaks.
Eugene
On Sun, Apr 18, 2010 at 5:55 AM, Yuanfang Chen <tabloid.adroit at gmail.com> wrote:
> I need to generate variables like
> status1, status2, st...
2010 Apr 18
1
[LLVMdev] create two Twine object
...ine for an integer. All other uses
should be considered poor style, as they are dangerously subtle.
- Daniel
> I think all you need here is
>
> static int varNum;
>
> ++varNum;
> Instruction *sstatusInst = new AllocaInst(StatusTy, Twine("status") +
> Twine(varNum), entry_inst);
> Instruction *sreqInst = new AllocaInst(ReqTy, Twine("request") +
> Twine(varNum), entry_inst);
>
>
> btw, your getVarNum() leaks.
>
> Eugene
>
> On Sun, Apr 18, 2010 at 5:55 AM, Yuanfang Chen <tabloid.adroit at gmail.com> wrote:
>> I need to gene...