[LLVMdev] Request for Help: Teach ARM target to auto-detect cpu / subtarget features

Evan Cheng evan.cheng at apple.com
Sat May 12 21:34:35 PDT 2012



On May 12, 2012, at 8:16 PM, 陳韋任 <chenwj at iis.sinica.edu.tw> wrote:

> Hi Chris,
> 
>> The right place to implement this is in lib/Support/Host.cpp.  X86 has an implementation of sys::getHostCPUName(), but everything else just uses the:
>> 
>> std::string sys::getHostCPUName() {
>>  return "generic";
>> }
>> 
>> implementation.
> 
>  I tried to let it return "armv7l" or "cortex-a9" on pandaboard, but the
> bitcode output by clang still has 
> 
>  target triple = "armv4t-unknown-linux-gnueabi"
> 
> not what I expect 
> 
>  target triple = "armv7l-unknown-linux-gnueabi"
> 
> Do I miss something? Thanks.

No, it should be armv7-unknown-linux-gnueabi. Then first part of the triple is not the cpu name, it's architecture string. I think you need to add some code so clang would derive the architecture from the CPU name. Alternatively, you might want to add a llvm system routine that does this (or auto-detect the arch string). So you invoke clang, add -v. You will be what triple and CPU are being passed to the backend.

Evan

> 
> Regards,
> chenwj
> 
> -- 
> Wei-Ren Chen (陳韋任)
> Computer Systems Lab, Institute of Information Science,
> Academia Sinica, Taiwan (R.O.C.)
> Tel:886-2-2788-3799 #1667
> Homepage: http://people.cs.nctu.edu.tw/~chenwj
> 
> _______________________________________________
> 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