[cfe-dev] thoughts about n-bit bytes for clang/llvm

Ray Fix rayfix.ml at gmail.com
Tue Sep 8 16:07:22 PDT 2009


On Sep 8, 2009, at 6:04 PM, Eli Friedman wrote:
> On Tue, Sep 8, 2009 at 2:32 PM, Ray Fix<rayfix.ml at gmail.com> wrote:
>> Still working on it.
>
> It doesn't really matter what void* translates to in the IR to;
> nothing should attempt to load from a void* or do arithmetic with it
> anyway.  The use of i8* is purely tradition; I think you could change
> CodeGenTypes::ConvertNewType to use an arbitrary type without any
> trouble.  And ExprConstant.cpp is at a the AST level, so it isn't
> really relevant here beyond the fact that we support void* arithmetic;
> we handle that explicitly in ScalarExprEmitter::EmitAdd and friends,
> though.

Thank you Eli!    I *really* appreciate deep insights like that.  I  
now understand that it doesn't really matter for void, but I went  
ahead and hacked up my version up to look better on my platform.

     case BuiltinType::Void:
     case BuiltinType::ObjCId:
     case BuiltinType::ObjCClass:
       // LLVM void type can only be used as the result of a function  
call.  Just
       // map to the same as char.
       return llvm::IntegerType::get(getLLVMContext(), 8);

To:

       return llvm::IntegerType::get(getLLVMContext(),
                                     Context.getTypeSize 
(Context.CharTy));

For my platform that works nicely out to be i16.

Ray
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090908/2f08d70d/attachment.html>


More information about the cfe-dev mailing list