[llvm-dev] LLVM issuse:AArch64 TargetParser
Jojo Ma via llvm-dev
llvm-dev at lists.llvm.org
Mon May 9 02:53:27 PDT 2016
Hi renato,
With the TargetParser, the idea is to avoid that specific knowledge on
> the tools themselves, and moving all string parsing (startswith,
> StringSwitch) to the parser.
>
> But that creates the conundrum that we've seen, that we can't parse it
> uniquely without more context.
>
This is just as a filter,it should not affect the context,I think.
But in order to filter out the invalid arch, I have no idea how to avoid
doing the string parsing in the tool for now.
It also seems that we need the Triple
> to be able to infer anything about march. That is the logic that needs
> to be in Clang, not the string parsing.
Feature parsing is done after the triple identified. As we can see below:
static void getTargetFeatures(const ToolChain &TC, const llvm::Triple
&Triple,
const ArgList &Args, ArgStringList &CmdArgs,
bool ForAS) {
... ...
case llvm::Triple::arm:
case llvm::Triple::armeb:
case llvm::Triple::thumb:
case llvm::Triple::thumbeb:
getARMTargetFeatures(TC, Triple, Args, Features, ForAS);
break;
... ...
case llvm::Triple::aarch64:
case llvm::Triple::aarch64_be:
getAArch64TargetFeatures(D, Args, Features);
break;
... ...
}
Another alternative would be to create two checkValid functions, one
> explicitly for ARM and one for AArch64, and call them from different
> places in Clang.
>
Yes, it will be more clear.
Thank you very much! Renato.
Regards,
Jojo
>
On 9 May 2016 at 16:39, Renato Golin <renato.golin at linaro.org> wrote:
> On 9 May 2016 at 09:19, Jojo Ma <jojo.ma at linaro.org> wrote:
> > +//Only if -march startwith "armv" or "v" or "iwmmxt" or "xscale",it can
> be
> > seen valid and sended to TargetParser
> > +//for further parsing
> > +static bool checkArchValid(StringRef Arch)
> > +{
> > + if ((Arch.startswith("armv")) || Arch[0] == 'v' ||
> > + (Arch.startswith("iwmmxt")) || (Arch.startswith("xscale")))
> > + return true;
> > + return false;
> > +}
>
> Hi Jojo,
>
> With the TargetParser, the idea is to avoid that specific knowledge on
> the tools themselves, and moving all string parsing (startswith,
> StringSwitch) to the parser.
>
> But that creates the conundrum that we've seen, that we can't parse it
> uniquely without more context. It also seems that we need the Triple
> to be able to infer anything about march. That is the logic that needs
> to be in Clang, not the string parsing.
>
> Another alternative would be to create two checkValid functions, one
> explicitly for ARM and one for AArch64, and call them from different
> places in Clang.
>
> Hope that helps.
>
> cheers,
> --renato
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160509/f8de084b/attachment-0001.html>
More information about the llvm-dev
mailing list