Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Markus Timpl <tima0900 <at> googlemail.com>
Subject: Load Instruction that changes value of two registers
Newsgroups: gmane.comp.compilers.llvm.devel
Date: Tuesday 28th January 2014 23:30:10 UTC (over 3 years ago)
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
 
CD: 4ms