[llvm-dev] how to set BaseOpcode when using multiclass for relation model in td file

林政宗 via llvm-dev llvm-dev at lists.llvm.org
Mon May 24 08:03:22 PDT 2021


Hi, 


I am trying to relate normal instructions with predicate instructions. I have read the document How To Use Instruction Mappings — LLVM 12 documentation.
If normal instruction and the corresponding instruction are related, they should have the same BaseOpcode. 

The document covers class/def only. It doesn't cover multiclass/defm.
for example:
class VFORM<...> {...}
multiclass MFORM<...> {
def _aa: VFORM<...>;
def _bb: VFORM<...>;
}
defm MOV: MFORM<...>;
defm P_MOV: MFORM<...>;


P_MOV_aa and P_MOV_bb are the corresponding predicate instruction of MOV_aa and MOV_bb.
when relating P_MOV_aa with MOV_aa and P_MOV_bb with MOV_bb, they should have the same BaseOpcode.
I think the normal instruction definition name is the best option for BaseOpcode, such as "MOV_aa" and "MOV_bb".
Could I get the instruction definition name automatically and assign it to BaseOpcode in td file?
Or is there a convenint way to set BaseOpcode for normal/predicate instruction when using multiclass/defm?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210524/3a9a91cf/attachment.html>


More information about the llvm-dev mailing list