llvm.org GIT mirror llvm / 2b46e8e
Added moveReg2Reg() and moveImm2Reg() to accomodate moving data around due to PHI nodes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5001 91177308-0d34-0410-b5e6-96231b3b80d8 Misha Brukman 17 years ago
3 changed file(s) with 56 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
129129 unsigned ImmOffset, unsigned dataSize) const = 0;
130130
131131 virtual MachineBasicBlock::iterator
132 moveReg2Reg(MachineBasicBlock *MBB,
133 MachineBasicBlock::iterator MBBI,
134 unsigned DestReg, unsigned SrcReg, unsigned dataSize) const = 0;
135
136 virtual MachineBasicBlock::iterator
137 moveImm2Reg(MachineBasicBlock *MBB,
138 MachineBasicBlock::iterator MBBI,
139 unsigned DestReg, unsigned Imm, unsigned dataSize) const = 0;
140
141 virtual MachineBasicBlock::iterator
132142 emitPrologue(MachineBasicBlock *MBB,
133143 MachineBasicBlock::iterator MBBI,
134144 unsigned numBytes) const = 0;
5959
6060 MachineInstr *MI = addRegOffset(BuildMI(opcode, 5).addReg(DestReg),
6161 SrcReg, ImmOffset);
62 return ++(MBB->insert(MBBI, MI));
63 }
64
65 MachineBasicBlock::iterator
66 X86RegisterInfo::moveReg2Reg(MachineBasicBlock *MBB,
67 MachineBasicBlock::iterator MBBI,
68 unsigned DestReg, unsigned SrcReg,
69 unsigned dataSize) const
70 {
71 unsigned opcode;
72 switch (dataSize) {
73 case 1: opcode = X86::MOVrr8; break;
74 case 2: opcode = X86::MOVrr16; break;
75 case 4: opcode = X86::MOVrr32; break;
76 default: assert(0 && "Invalid data size!");
77 }
78
79 MachineInstr *MI = BuildMI(opcode, 2).addReg(DestReg).addReg(SrcReg);
80 return ++(MBB->insert(MBBI, MI));
81 }
82
83 MachineBasicBlock::iterator
84 X86RegisterInfo::moveImm2Reg(MachineBasicBlock *MBB,
85 MachineBasicBlock::iterator MBBI,
86 unsigned DestReg, unsigned Imm, unsigned dataSize)
87 const
88 {
89 unsigned opcode;
90 switch (dataSize) {
91 case 1: opcode = X86::MOVir8; break;
92 case 2: opcode = X86::MOVir16; break;
93 case 4: opcode = X86::MOVir32; break;
94 default: assert(0 && "Invalid data size!");
95 }
96
97 MachineInstr *MI = BuildMI(opcode, 2).addReg(DestReg).addReg(Imm);
6298 return ++(MBB->insert(MBBI, MI));
6399 }
64100
2828 unsigned DestReg, unsigned SrcReg,
2929 unsigned ImmOffset, unsigned dataSize) const;
3030
31 MachineBasicBlock::iterator
32 moveReg2Reg(MachineBasicBlock *MBB,
33 MachineBasicBlock::iterator MBBI,
34 unsigned DestReg, unsigned SrcReg, unsigned dataSize) const;
35
36 MachineBasicBlock::iterator
37 moveImm2Reg(MachineBasicBlock *MBB,
38 MachineBasicBlock::iterator MBBI,
39 unsigned DestReg, unsigned Imm, unsigned dataSize) const;
40
3141 unsigned getFramePointer() const;
3242 unsigned getStackPointer() const;
3343