diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-01-26 23:28:04 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-01-26 23:28:04 +0000 |
| commit | 4df279cfda70e9a9a22e1c5ae2f6ed3dd1757f1d (patch) | |
| tree | d4d2cd7e5eaccba0bd026a314fb55f80c9f7a0e8 /llvm/lib | |
| parent | f32b77c83d1d1a48222425175dda78fa275d3f06 (diff) | |
| download | bcm5719-llvm-4df279cfda70e9a9a22e1c5ae2f6ed3dd1757f1d.tar.gz bcm5719-llvm-4df279cfda70e9a9a22e1c5ae2f6ed3dd1757f1d.zip | |
Teach the scheduler to emit the appropriate INLINEASM MachineInstr for an
ISD::INLINEASM node.
llvm-svn: 25668
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp index 6ffa9c720d0..4e45bd65646 100644 --- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp @@ -283,6 +283,35 @@ void ScheduleDAG::EmitNode(NodeInfo *NI) { MRI->copyRegToReg(*BB, BB->end(), VRBase, SrcReg, TRC); break; } + case ISD::INLINEASM: { + unsigned NumOps = Node->getNumOperands(); + if (Node->getOperand(NumOps-1).getValueType() == MVT::Flag) + --NumOps; // Ignore the flag operand. + + // Create the inline asm machine instruction. + MachineInstr *MI = + new MachineInstr(BB, TargetInstrInfo::INLINEASM, (NumOps-2)/2+1); + + // Add the asm string as an external symbol operand. + const char *AsmStr = + cast<ExternalSymbolSDNode>(Node->getOperand(1))->getSymbol(); + MI->addExternalSymbolOperand(AsmStr, false); + + // Add all of the operand registers to the instruction. + for (unsigned i = 2; i != NumOps; i += 2) { + unsigned Reg = cast<RegisterSDNode>(Node->getOperand(i))->getReg(); + unsigned Flags = cast<ConstantSDNode>(Node->getOperand(i))->getValue(); + MachineOperand::UseType UseTy; + switch (Flags) { + default: assert(0 && "Bad flags!"); + case 1: UseTy = MachineOperand::Use; break; + case 2: UseTy = MachineOperand::Def; break; + case 3: UseTy = MachineOperand::UseAndDef; break; + } + MI->addMachineRegOperand(Reg, UseTy); + } + break; + } } } |

