[LLVMdev] Being able to know the jitted code-size before emitting

Evan Cheng evan.cheng at apple.com
Wed Apr 16 10:37:42 PDT 2008


On Apr 16, 2008, at 1:46 AM, Nicolas Geoffray wrote:

>
>>
>> How about a  default GetInstSize() as well? Return 1 for every
>> instruction except for some special TargetInstrInfo instructions,  
>> e.g.
>> PHI, IMPLICIT_DEF, LABEL. I don't know if it's useful or not. But
>> perhaps we can default most targets to it?
>>
>>
>
> I prefer not giving a default implementation and aborting with a  
> message
> that says the target did not implement it. This way we know why it's  
> not
> working. Is it OK?

That's ok.

>
>
>>> //
>>> -unsigned X86RegisterInfo::getX86RegNum(unsigned RegNo) const {
>>> +unsigned X86RegisterInfo::getX86RegNum(unsigned RegNo) {
>>>
>>
>> What happened to "const"?
>>
>
> I made the function static.

Ok.

>
>
>>> +  unsigned Size = GetInstSizeWithDesc(*MI, &Desc, IsPIC,
>>> Is64BitMode);
>>> +  if (Desc.getOpcode() == X86::MOVPC32r) {
>>> +      Size += GetInstSizeWithDesc(*MI, &get(X86::POP32r), IsPIC,
>>> Is64BitMode);
>>> +  }
>>>
>>
>> I would prefer this special case is handled in GetInstSizeWithDesc().
>>
>>
>
> I can not do that in GetInstSizeWithDesc because the test is on the
> MachineInstruction, which will always say that Desc.getOpcode ==  
> MOVPC32
> in GetInstSizeWithDesc (hence the function will endlessly call  
> itself).
> X86CodeEmitter is doing the same.

Ok.

>
>
>>
>> Looks great! Thanks.
>>
>
> Thx to you for reviewing the patch! I'll modify it with your  
> suggestions
> and wait for your response to this email before committing it.
>

Thanks,

Evan

> Nicolas
>
>> Evan
>>
>>
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list