Dear Mr. Cheng:
Thank you for kind information.
Can you tell me in more detail about that?
For example, I am trying to implement 'demultiplex' instruction as follows:
demultiplex <multiplexid,choose,branch0id,branch1id,…,otherwisebranchid>
In this case, the number of branch#id is not definite. It can be 1, 2, 3...or any number.
My question was about this. I am still not sure how to use CALLpcrel32 you mentioned for this.
Thank you very much.
Seung Jae Lee
You have to provide more information than that. Let's say your target is called FOO, and assuming multiplexid is an i32 immediate. You want to define something like this:
def DEMULTIPLEX : I<(ops i32imm:$id, variable_ops),
"demultiplex $id", [(FOOMutex imm:$id)]>;
The auto-generated instruction selection function will check that operand 0 is a 32-bit immediate and suck up all the other operands (if any) trailing it to form a target specific node with 1 or more operands. It will evetually be translated into a MachineInstr* with 1 or more operands.
If the assembly you are generating will actually print out the additional operands. You need to define a custom operand with its own asm printing method. e.g.
def demux_ops : Operand<i32> {
let PrintMethod = "printDemuxOps";
}
Add this method to the target's asm printer class. The method is passed a MachineInstr* and OpNum. That allows you to know just exactly how many operands there are and etc.
Hope this is enough information.
Evan