Displaying 5 results from an estimated 5 matches for "addcase".
2011 Aug 01
0
[LLVMdev] SwitchInst::addCase with BlockAddress
...a switch; I know it's
> not a good approach, I'm just experimenting).
> Suppose I have the following:
>
> SwitchInst *s = SwitchInst::Create(...);
> BasicBlock *bb = ...;
> PtrToIntInst k = new PtrToIntInst(BlockAddress::get(bb), <TYPE>, "", s);
> s->addCase(k, bb);
> ...
>
> is this reasonable? what should I put in place of <TYPE> (the type to cast
> to)?
You can't do that; switch cases are required to be constant integers,
and a blockaddress are not constant integers (at least not at
compile-time).
You can use an explicit comp...
2011 Jul 31
3
[LLVMdev] SwitchInst::addCase with BlockAddress
...cally emulating an indirectbr via a
switch; I know it's not a good approach, I'm just experimenting).
Suppose I have the following:
SwitchInst *s = SwitchInst::Create(...);
BasicBlock *bb = ...;
PtrToIntInst k = new PtrToIntInst(BlockAddress::get(bb), <TYPE>, "", s);
s->addCase(k, bb);
...
is this reasonable? what should I put in place of <TYPE> (the type to
cast to)?
--
Carlo Alberto Ferraris <cafxx at strayorange.com
<mailto:cafxx at strayorange.com>>
website/blog <http://cafxx.strayorange.com> - +39 333 7643 235
-------------- next part ----...
2011 Aug 01
1
[LLVMdev] SwitchInst::addCase with BlockAddress
...>> not a good approach, I'm just experimenting).
>> Suppose I have the following:
>>
>> SwitchInst *s = SwitchInst::Create(...);
>> BasicBlock *bb = ...;
>> PtrToIntInst k = new PtrToIntInst(BlockAddress::get(bb),<TYPE>, "", s);
>> s->addCase(k, bb);
>> ...
>>
>> is this reasonable? what should I put in place of<TYPE> (the type to cast
>> to)?
>
> You can't do that; switch cases are required to be constant integers,
> and a blockaddress are not constant integers (at least not at
> compile-...
2013 Aug 22
2
[LLVMdev] SwitchInst problem
Hi All,
Value* V;
Value* V2;
BasicBlock * BB;
unsigned j; ///number of cases
.... //insert V , V2, j and BB
SwitchInst* sw= builder.CreateSwitch(V, BB, j);
ConstantInt * CI= dyn_cast<ConstantInt>(V2);
sw-> addCase( CI , BB);
At last step there is
Program received signal SIGSEGV, Segmentation fault.
What is wrong in the code?
Thanks in advance
--
* Rasha Salah Omar
Msc Student at E-JUST
Demonestrator at Faculty of Computers and Informatics
Benha University*
* e-mail: rasha.omar at...
2006 May 17
0
[LLVMdev] Obfuscation with LLVM
...oadInst( statePtr, "next", disMainBB );
SwitchInst* switchInst = new SwitchInst( loadState, oldEntryBB,
unsigned( indexBBMap.size() ), disMainBB );
for( BBindexBBMap::iterator idxBBPair = indexBBMap.begin(); idxBBPair !=
indexBBMap.end(); idxBBPair++ )
{
switchInst->addCase( ConstantUInt::get( Type::UIntTy,
idxBBPair->second ), idxBBPair->first );
}
// Unlink all source basic blocks and relink them to the dispatcher's
main block.
for( BBindexBBMap::iterator idxBBPair = indexBBMap.begin(); idxBBPair !=
indexBBMap.end(); idxBBPair++ )
{...