Dr. ERDI Gergo via llvm-dev
2017-May-09 13:16 UTC
[llvm-dev] Instruction selection for 'load' based on static vs. dynamic data
On Tue, 9 May 2017, Krzysztof Parzyszek wrote:> def: Pat<(ld (add (WRAPPER RC:$addr), (sign_extend RC:$offset))), > (load_instruction_rr RC:$addr, RC:$offset)>; > > Where "load_instruction" is a machine load instruction with base address and > an offset, both in registers, and RC is the corresponding register class.Can I also use something more complex than a single machine load instruction here? I.e. can I write something like def: Pat<(ld (add (WRAPPER RC:$addr), (sign_extend RC:$offset))), (load_instruction_rr (special_add RC:$addr, RC:$offset))>; ? Or do I have to go via some pseudo-instruction for that?
Krzysztof Parzyszek via llvm-dev
2017-May-09 14:28 UTC
[llvm-dev] Instruction selection for 'load' based on static vs. dynamic data
On 5/9/2017 8:16 AM, Dr. ERDI Gergo wrote:> > Can I also use something more complex than a single machine load > instruction here? I.e. can I write something like > > def: Pat<(ld (add (WRAPPER RC:$addr), (sign_extend RC:$offset))), > (load_instruction_rr (special_add RC:$addr, RC:$offset))>; > > ? Or do I have to go via some pseudo-instruction for that?You can have any tree of machine instructions as the output. -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Dr. ERDI Gergo via llvm-dev
2017-May-09 15:06 UTC
[llvm-dev] Instruction selection for 'load' based on static vs. dynamic data
On Tue, 9 May 2017, Krzysztof Parzyszek wrote:> You can have any tree of machine instructions as the output.Cool! Even better would be if I could use non-machine (LLVM) instructions in the output pattern, and let ISel do its job on it. Is there a way to do that?
Dr. ERDI Gergo via llvm-dev
2017-May-10 05:23 UTC
[llvm-dev] Instruction selection for 'load' based on static vs. dynamic data
On Tue, 9 May 2017, Krzysztof Parzyszek wrote:> On 5/9/2017 8:16 AM, Dr. ERDI Gergo wrote: >> >> Can I also use something more complex than a single machine load >> instruction here? I.e. can I write something like >> >> def: Pat<(ld (add (WRAPPER RC:$addr), (sign_extend RC:$offset))), >> (load_instruction_rr (special_add RC:$addr, RC:$offset))>; >> >> ? Or do I have to go via some pseudo-instruction for that? > > You can have any tree of machine instructions as the output.Thanks, I managed to get it working using this approach; see https://github.com/gergoerdi/llvm-avr/commit/bf415da65d102d86596753a541af8804b863928b if you're interested in the details.