<div dir="ltr"><div dir="ltr"><div>Hello,</div><div><br></div><div>I want to implement LLVM backend for a specific VLIW hardware. I am working on defining its instruction set, and assembly language.</div><div><br></div><div>The hardware has two pipelines, int and float. Each pipeline can do 3 operations/cycle, 3 operations forms an instruction.</div><div><br></div><div>One of the Integer Instruction looks like this:</div><div>    add Ri, Rj, Rk; add Rl, Rm, Rn; add Ro, Rp, Rq</div><div><br></div><div>An int instruction and a float instruction forms a VLIW instruction (bundle), e.g. </div><div><br></div><div>{</div><div>    add Ri, Rj, Rk; add Rl, Rm, Rn; add Ro, Rp, Rq</div><div>    fadd Fi, Fj, Fk; fadd Fl, Fm, Fn; fadd Fo, Fp, Fq</div><div>}    </div><div><br></div><div>I want to express above concept in this way:</div><div>// Assembly Language</div><div>{</div><div>    add Ri, Rj, Rk</div><div>    add Rl, Rm, Rn</div><div>    add Ro, Rp, Rq</div><div>    fadd Fi, Fj, Fk</div><div>    fadd Fl, Fm, Fn</div><div>    fadd Fo, Fp, Fq</div><div>}</div><div><br></div><div>Q1:</div><div>My first question is, the instruction encoding can only be determined after parser has finished parsing the entire bundle. </div><div><br></div><div>e.g. When parser see "add Ri, Rj, Rk", it generates one encoding, but when parser see another "add Ri, Rj, Rk", it will modify previously generated encoding.</div><div><br></div><div>I would like to know can LLVM's assembler support this?</div><div>Or I should define my instruction in this way:</div><div>   add_type1 Ri, Rj, Rk</div><div>   add_type2 Ri, Rj, Rk, Rl, Rm, Rn</div><div>   add_type3 Ri, Rj, Rk, Rl, Rm, Rn, Ro, Rp, Rq</div><div><br></div><div>Q2.</div><div>Some of the instructions need to setup additional configuration, e.g.</div><div>{</div><div>    scache wa   ; Set cache mode: write allocate</div><div>    ssize 64    ; Set write size = 64 bits</div><div>    sendian big ; Set big endian writing</div><div>    store R0, 0x1000000 ; Write "R0" to 0x1000000</div><div>}</div><div><br></div><div>So, again, parser has to parse the entire bundle to generate correct encoding.</div><div>Or I should define my instruction in this way:</div><div><br></div><div>store R0, 0x1000000, wa, 64, big, .... (10 options can be set)</div><div><br></div><div>Q3.</div><div>The destination register can be omitted, e.g.</div><div>    add , Rj, Rk<br></div><div><br></div><div>So can I use this form to express omitting destination, or I should define new instruction for it?</div><div>e.g.</div><div>    add_no_dest Rj, Rk</div><div><br></div><div>Q4.</div><div>Can I define the instruction which has the same name but with different count of operands, e.g.</div><div>    fadd Fi, Fj, Fk</div><div>    fadd Fl, Fm, Fn, rounding_mode</div><div><br></div><div>So fadd has two versions</div><div>(a) normal rounding</div><div>(b) special rounding mode</div><div> </div><div><div>Or I should define it in this way:</div>fadd</div><div>fadd_round_mode1</div><div>fadd_round_mode2<br></div><div>..</div><div><div>fadd_round_mode15</div></div><div>(16 rounding mode)</div><div><br></div><div>Thank You,</div><div>CY</div></div></div>