________________________________ From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Chris Lattner Sent: Friday, September 19, 2008 10:49 AM To: LLVM Developers Mailing List Subject: Re: [LLVMdev] Custom Opcodes versus built-in opcodes On Sep 18, 2008, at 4:04 PM, Villmow, Micah wrote: I am using lowering instructions and using custom opcodes that I can more easily directly map to my backend. These opcodes are then used to emit a custom set of instructions into the MachineBasicBlock. I've been able to get one to work correctly, however, I've ran into an issue where my second one is being confused as a FRAMEADDR opcode instead of my opcode. Make sure to use DAG.getTargetNode() with custom opcodes. "target" nodes are encoded with an implicit delta added to their enum value. Is this documented anywhere that getTargetNode is the preferred method to use in a Custom Lowering function? Even the other backends use getNode in their lowering functions with custom opcodes. This is from SparcISelLowering.cpp CompareFlag = DAG.getNode(SPISD::CMPFCC, MVT::Flag, LHS, RHS); if (SPCC == ~0U) SPCC = FPCondCCodeToFCC(CC); Opc = SPISD::BRFCC; } return DAG.getNode(Opc, MVT::Other, Chain, Dest, DAG.getConstant(SPCC, MVT::i32), CompareFlag); Micah -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080919/f6487803/attachment.html>
On Sep 19, 2008, at 11:35 AM, Villmow, Micah wrote:> Make sure to use DAG.getTargetNode() with custom opcodes. "target" > nodes are encoded with an implicit delta added to their enum value. > > Is this documented anywhere that getTargetNode is the preferred > method to use in a Custom Lowering function? Even the other backends > use getNode in their lowering functions with custom opcodes. > This is from SparcISelLowering.cpp > CompareFlag = DAG.getNode(SPISD::CMPFCC, MVT::Flag, LHS, RHS); > if (SPCC == ~0U) SPCC = FPCondCCodeToFCC(CC); > Opc = SPISD::BRFCC; > } > return DAG.getNode(Opc, MVT::Other, Chain, Dest, > DAG.getConstant(SPCC, MVT::i32), CompareFlag);Actually, I'm wrong, sorry about that. It looks like the encoding is in the definition of the enum: enum { FIRST_NUMBER = ISD::BUILTIN_OP_END+SP::INSTRUCTION_LIST_END, CMPICC, // Compare two GPR operands, set icc. CMPFCC, // Compare two FP operands, set fcc. BRICC, // Branch to dest on icc condition BRFCC, // Branch to dest on fcc condition ... Are your "targetISD" enums properly defined with the offset? getTargetNode is required when passing in MachineInstr opcode numbers at isel time. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080919/d109daf6/attachment.html>
________________________________ From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Chris Lattner Sent: Friday, September 19, 2008 11:47 AM To: LLVM Developers Mailing List Subject: Re: [LLVMdev] Custom Opcodes versus built-in opcodes On Sep 19, 2008, at 11:35 AM, Villmow, Micah wrote: Make sure to use DAG.getTargetNode() with custom opcodes. "target" nodes are encoded with an implicit delta added to their enum value. Is this documented anywhere that getTargetNode is the preferred method to use in a Custom Lowering function? Even the other backends use getNode in their lowering functions with custom opcodes. This is from SparcISelLowering.cpp CompareFlag = DAG.getNode(SPISD::CMPFCC, MVT::Flag, LHS, RHS); if (SPCC == ~0U) SPCC = FPCondCCodeToFCC(CC); Opc = SPISD::BRFCC; } return DAG.getNode(Opc, MVT::Other, Chain, Dest, DAG.getConstant(SPCC, MVT::i32), CompareFlag); Actually, I'm wrong, sorry about that. It looks like the encoding is in the definition of the enum: enum { FIRST_NUMBER = ISD::BUILTIN_OP_END+SP::INSTRUCTION_LIST_END, CMPICC, // Compare two GPR operands, set icc. CMPFCC, // Compare two FP operands, set fcc. BRICC, // Branch to dest on icc condition BRFCC, // Branch to dest on fcc condition ... Are your "targetISD" enums properly defined with the offset? getTargetNode is required when passing in MachineInstr opcode numbers at isel time. Ahhh! Thanks. Micah -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080919/482d7a39/attachment.html>
Possibly Parallel Threads
- [LLVMdev] Custom Opcodes versus built-in opcodes
- [LLVMdev] Custom Opcodes versus built-in opcodes
- [Sparc] builtin setjmp / longjmp - need help to get past last problem
- [LLVMdev] Custom Opcodes versus built-in opcodes
- [LLVMdev] MBlaze select_cc lowering question.