[llvm-dev] Code selection problem in LLVM backend
Krzysztof Parzyszek via llvm-dev
llvm-dev at lists.llvm.org
Wed Mar 22 13:13:30 PDT 2017
You could model the flag as a register that is modified by cmp/add/sub
and read by conditional branches. This should introduce data
dependencies that would prevent incorrect scheduling.
-Krzysztof
On 3/21/2017 10:03 PM, Liu winter via llvm-dev wrote:
> Hi,
>
>
> I'm currently writing a backend for a specific platform. On the target
> platform, "add/sub" always write a flag result. I used SDNode pattern
> "add/sub" for these two instructions, however this leading to a wrongly
> code as follows,
>
>
> cmp
>
> ...
>
> add ...
>
> ...
>
> beq
>
>
> "add" changes the flag. Desired code is:
>
>
> add...
>
> cmp
>
> ... ;No add/sub
>
> beq
>
>
> Then I tried to use SDNode pattern "addc/subc" instead, but it doesn't
> matter and cause some other errors. What should I do to generate code
> that no "add/sub" between "cmp" and "branch"?
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
More information about the llvm-dev
mailing list