<div dir="ltr">Hi renato,<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">With the TargetParser, the idea is to avoid that specific knowledge on<br>
the tools themselves, and moving all string parsing (startswith,<br>
StringSwitch) to the parser.<br>
<br>
But that creates the conundrum that we've seen, that we can't parse it<br>
uniquely without more context. <br></blockquote><div><br><span style="color:rgb(0,0,255)"> <span class="">This is just as a filter,</span><span class="">it should not affect the context,I think.<br> </span><span class="">But in order to filter out the invalid arch, I have no idea how to avoid doing the </span></span><span class=""><span style="color:rgb(0,0,255)">string parsing in the tool for now.</span><br></span></div><div><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"> It also seems that we need the Triple<br>
to be able to infer anything about march. That is the logic that needs<br>
to be in Clang, not the string parsing.</blockquote><div><br><span style="color:rgb(0,0,255)"><span class="">Feature parsing is done after the triple</span> <span class="">identified. As we can see </span>below:</span><br><br><span style="color:rgb(102,102,102)">static void getTargetFeatures(const ToolChain &TC, const llvm::Triple &Triple,<br>                              const ArgList &Args, ArgStringList &CmdArgs,<br>                              bool ForAS) {<br>  ... ...<br>  case llvm::Triple::arm:<br>  case llvm::Triple::armeb:<br>  case llvm::Triple::thumb:<br>  case llvm::Triple::thumbeb:<br>    getARMTargetFeatures(TC, Triple, Args, Features, ForAS);<br>    break;<br>  ... ...<br>  case llvm::Triple::aarch64:<br>  case llvm::Triple::aarch64_be:<br>    getAArch64TargetFeatures(D, Args, Features);<br>    break;<br>  ... ...<br>}</span><br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">Another alternative would be to create two checkValid functions, one<br>
explicitly for ARM and one for AArch64, and call them from different<br>
places in Clang.<br></blockquote><br><span style="color:rgb(0,0,255)"><span class="">Yes, it will be more clear.</span></span><br><br></div><div>Thank you very much! Renato.<br></div><div><br></div><div>Regards,<br></div><div>Jojo<br></div><div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"></blockquote></blockquote></blockquote></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 9 May 2016 at 16:39, Renato Golin <span dir="ltr"><<a href="mailto:renato.golin@linaro.org" target="_blank">renato.golin@linaro.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 9 May 2016 at 09:19, Jojo Ma <<a href="mailto:jojo.ma@linaro.org">jojo.ma@linaro.org</a>> wrote:<br>
> +//Only if -march startwith "armv" or "v" or "iwmmxt" or "xscale",it can be<br>
> seen valid and sended to TargetParser<br>
> +//for further parsing<br>
> +static bool checkArchValid(StringRef Arch)<br>
> +{<br>
> +  if ((Arch.startswith("armv")) || Arch[0] == 'v' ||<br>
> +         (Arch.startswith("iwmmxt")) || (Arch.startswith("xscale")))<br>
> +    return true;<br>
> +  return false;<br>
> +}<br>
<br>
</span>Hi Jojo,<br>
<br>
With the TargetParser, the idea is to avoid that specific knowledge on<br>
the tools themselves, and moving all string parsing (startswith,<br>
StringSwitch) to the parser.<br>
<br>
But that creates the conundrum that we've seen, that we can't parse it<br>
uniquely without more context. It also seems that we need the Triple<br>
to be able to infer anything about march. That is the logic that needs<br>
to be in Clang, not the string parsing.<br>
<br>
Another alternative would be to create two checkValid functions, one<br>
explicitly for ARM and one for AArch64, and call them from different<br>
places in Clang.<br>
<br>
Hope that helps.<br>
<br>
cheers,<br>
--renato<br>
</blockquote></div><br></div>