[LLVMdev] Inserting nodes into SelectionDAG (X86)

Artjom Kochtchi artjom.kochtchi at googlemail.com
Mon Jun 29 09:00:00 PDT 2009


Sorry to ask again, but I still can't get it right.

The following code compiles and runs, but produces no instructions:
  Ops.push_back(DAG.getRegister(X86::EAX, MVT::i32));
  Ops.push_back(DAG.getConstant(1, MVT::i32));
  DAG.getNode(ISD::ADD, DAG.getVTList(MVT::i32), &Ops[0], Ops.size());

I reckon that has something to do with the fact that I am not using the
Chain object. But as soon as I try to chain that node, llc tells me that I
have the wrong number of operands:
  Ops.push_back(Chain);
  Ops.push_back(DAG.getRegister(X86::EAX, MVT::i32));
  Ops.push_back(DAG.getConstant(1, MVT::i32));
  Chain = DAG.getNode(ISD::ADD, DAG.getVTList(MVT::Other, MVT::i32),
&Ops[0], Ops.size());

Isn't that the way how it is supposed to work?

Artjom
-- 
View this message in context: http://www.nabble.com/Inserting-nodes-into-SelectionDAG-%28X86%29-tp24211066p24256897.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.




More information about the llvm-dev mailing list