Hello,
Im back trying to finish my backend to a simple RISC cpu SABRE now that most of the tedious process of examining undergraduate students is out of the way. I have managed to describe the registers and the instructions in the architecture and have added support for 32 bit immediates (thanks to Christopher Lamb) as the instruction set only supports 17 bit immediates directly.
Could anyone please describe the main features of how an llvm instruction such as SELECT and COND_BRANCH are lowered/expanded into branch instructions?
I have seen this thread
http://lists.cs.uiuc.edu/pipermail/llvmdev/2006-October/006892.html
but was wondering if anyone could comment on this process in a little more detail.
I presume I need to define various target independent nodes, like below ...
def SDT_SABREcondbr : SDTypeProfile<0,3, // no result, 3 operands, rega, regb, immediate
[ SDTCisVT<1,i32>, SDTCisVT<2,OtherVT> ]>;
def SABREcondbranch: SDNode <"SABREISD::COND_BRANCH" , SDT_SABREcondbr,
[SDNPHasChain]>;
def COND_BRANCH: Pseudo<(ops IntRegs:$a, IntRegs:$b, target:$dst),
"${:comment}COND_BRANCH $a, $b, $dst",
[(SABREcondbranch IntRegs:$a, IntRegs:$bm bb:$dst)]>;
and I need a setOperationAction(ISD::BRCOND, MVT::Other, Expand);
Im a little confused as to how BRCOND (or select for that matter) are then actually lowered to a particular branch instruction that is for the sake of argument ....
BLE %a, %b, newpc ie iff %a <= %b then branch to newpc.
I have been looking at the PPC and the sparc backend sources for information. I'd just like a little more (abstract) clarification before diving into this in some detail and gdb-ing through the specifics of the PPC/Sparc codegeneration for my helloworld bytecode.
Thanks,
Andy
Dr. Andy Nisbet: URL http://www.docm.mmu.ac.uk/STAFF/A.Nisbet
Department of Computing and Mathematics, John Dalton Building, Manchester
Metropolitan University, Chester Street, Manchester M1 5GD, UK.
Email: A.Nisbet@mmu.ac.uk, Phone:(+44)-161-247-1556; Fax:(+44)-161-247-1483.
"Before acting on this email or opening any attachments you
should read the Manchester Metropolitan University's email
disclaimer available on its website
Email Disclaimer · Manchester Metropolitan University "