[LLVMdev] Load Instruction that changes value of two registers
Markus Timpl
tima0900 at googlemail.com
Tue Jan 28 15:30:10 PST 2014
Hello,
I'm writing a backend for an architecture that only has LOAD Instructions
that first copy the old value of the target register in another register
and after that load the provided value into the register.
Example of an addition:
load a, reg1; // -> copies old value of reg1 in reg2 and loads value from a
into reg1
load b, reg1; // -> copies old value of reg1 in reg2 and loads value from b
into reg1
add reg1, reg2; // adds values from a and b and saves the result into reg1
So I need to describe the "load X, reg1" Instruction so that LLVM
understands it correctly.
How can I do that in LLVM? Where is the best place to do that(TableGen,
Instruction Selection, Instruction Lowering)?
It would be fine if I could tell LLVM that reg2 is invalid after a load
Operation, but I don#t know how to do that...
I tried the following in TableGen to let LLVM know that Resg2 isn't valid
anymore after a load but it didn't produce the desired result:
let Defs = [Regs2] in
{
def LD: Inst<(outs Regs1:$dst), (ins MEM:$addr),
"load $addr, $dst;",
[(set Regs1:$dst, (load addr:$addr))]>;
}
Thanks in advance,
Markus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140129/2653ceba/attachment.html>
More information about the llvm-dev
mailing list