[llvm-commits] Auxiliary patch #1

Stepan Dyatkovskiy STPWORLD at narod.ru
Thu Jan 5 11:30:16 PST 2012


05.01.2012, 23:17, "Stepan Dyatkovskiy" <STPWORLD at narod.ru>:
>>  If we were only interested in solving #1, we'd want to have a [start,end] range value for each edge out of a switch.  However, this isn't enough to solve #2...
>
> I think solving #2 solves #1 too. After analysing code I saw that it is more profitable to use case-ranges internal representation.
>
>>  Given a structure like this, I revise my stance and think that it would be easiest to represent this with a ConstantArray, and maybe even represent the ranges as ConstantVectors or something.
>>
>>  What do you think?
>
> I think that ConstantArray is fine. But what the difference for our case between ConstantArray and ConstantVector? Low level implementation? IMHO the main point is that it is inherited from Constant and will stored in LLVMContext. How it will stored in operands collection?
The last one is not a principle. Here we just should hide getOperand and getSuccessor methods (it is low level methods isn't it?).  We should replace code fragments like
CaseValue = SI->getOperand(SomeIndex); // We use User methods keeping SwitchInst format in mind.
CaseSuccessor = SI->getSuccessor(SomeIndex2); // We use TerminatorInst methods keeping what each successor means in mind.
with
CaseValue = SI->getCaseValue(SomeCaseValueIndex);
Successor = SI->getCaseSuccessor(SomeSuccessorIndex);





More information about the llvm-commits mailing list