FastISel.h revision 40b189e4e257924d90aaf63bf2e12bc7bbca961a
1b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman//===-- FastISel.h - Definition of the FastISel class ---------------------===//
2b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman//
3b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman//                     The LLVM Compiler Infrastructure
4b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman//
5b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman// This file is distributed under the University of Illinois Open Source
6b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman// License. See LICENSE.TXT for details.
7b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman//
8b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman//===----------------------------------------------------------------------===//
9b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman//
10b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman// This file defines the FastISel class.
11b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman//
12b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman//===----------------------------------------------------------------------===//
13b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman
14b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman#ifndef LLVM_CODEGEN_FASTISEL_H
15b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman#define LLVM_CODEGEN_FASTISEL_H
16b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman
17b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman#include "llvm/BasicBlock.h"
18b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman#include "llvm/ADT/DenseMap.h"
19b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman#include "llvm/CodeGen/SelectionDAGNodes.h"
20b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman
21b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohmannamespace llvm {
22b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman
2310df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohmanclass ConstantFP;
24b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohmanclass MachineBasicBlock;
2595267a1e671efc3c14e916b6978bbb15973b4cdcOwen Andersonclass MachineConstantPool;
26b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohmanclass MachineFunction;
27bb466331e7e50d03497ce40ee344870236fd9c32Dan Gohmanclass MachineRegisterInfo;
2883785c80968165b30fcdd111ceb2c28d38bcff86Evan Chengclass TargetData;
29b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohmanclass TargetInstrInfo;
3083785c80968165b30fcdd111ceb2c28d38bcff86Evan Chengclass TargetLowering;
3122bb31103de3337f0bb74c7bee16d1817d4dca14Dan Gohmanclass TargetMachine;
32b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohmanclass TargetRegisterClass;
33b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman
3440610241d00e219341ff4b7106c5baff08ad407bDan Gohman/// FastISel - This is a fast-path instruction selection class that
3540610241d00e219341ff4b7106c5baff08ad407bDan Gohman/// generates poor code and doesn't support illegal types or non-trivial
3640610241d00e219341ff4b7106c5baff08ad407bDan Gohman/// lowering, but runs quickly.
37b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohmanclass FastISel {
3822bb31103de3337f0bb74c7bee16d1817d4dca14Dan Gohmanprotected:
39b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman  MachineBasicBlock *MBB;
40104e4ce1629ea84736691bd1ee7867bdf90e8a2eDan Gohman  DenseMap<const Value *, unsigned> LocalValueMap;
413df24e667f04a7003342b534310919abc9c87418Dan Gohman  DenseMap<const Value *, unsigned> &ValueMap;
423df24e667f04a7003342b534310919abc9c87418Dan Gohman  DenseMap<const BasicBlock *, MachineBasicBlock *> &MBBMap;
43bb466331e7e50d03497ce40ee344870236fd9c32Dan Gohman  MachineFunction &MF;
44bb466331e7e50d03497ce40ee344870236fd9c32Dan Gohman  MachineRegisterInfo &MRI;
4522bb31103de3337f0bb74c7bee16d1817d4dca14Dan Gohman  const TargetMachine &TM;
4683785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  const TargetData &TD;
47bb466331e7e50d03497ce40ee344870236fd9c32Dan Gohman  const TargetInstrInfo &TII;
4822bb31103de3337f0bb74c7bee16d1817d4dca14Dan Gohman  const TargetLowering &TLI;
49b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman
50b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohmanpublic:
513df24e667f04a7003342b534310919abc9c87418Dan Gohman  /// setCurrentBlock - Set the current block, to which generated
523df24e667f04a7003342b534310919abc9c87418Dan Gohman  /// machine instructions will be appended.
533df24e667f04a7003342b534310919abc9c87418Dan Gohman  ///
543df24e667f04a7003342b534310919abc9c87418Dan Gohman  void setCurrentBlock(MachineBasicBlock *mbb) {
553df24e667f04a7003342b534310919abc9c87418Dan Gohman    MBB = mbb;
563df24e667f04a7003342b534310919abc9c87418Dan Gohman  }
573df24e667f04a7003342b534310919abc9c87418Dan Gohman
583df24e667f04a7003342b534310919abc9c87418Dan Gohman  /// SelectInstruction - Do "fast" instruction selection for the given
593df24e667f04a7003342b534310919abc9c87418Dan Gohman  /// LLVM IR instruction, and append generated machine instructions to
603df24e667f04a7003342b534310919abc9c87418Dan Gohman  /// the current block. Return true if selection was successful.
613df24e667f04a7003342b534310919abc9c87418Dan Gohman  ///
623df24e667f04a7003342b534310919abc9c87418Dan Gohman  bool SelectInstruction(Instruction *I);
63b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman
6440b189e4e257924d90aaf63bf2e12bc7bbca961aDan Gohman  /// SelectInstruction - Do "fast" instruction selection for the given
6540b189e4e257924d90aaf63bf2e12bc7bbca961aDan Gohman  /// LLVM IR operator (Instruction or ConstantExpr), and append
6640b189e4e257924d90aaf63bf2e12bc7bbca961aDan Gohman  /// generated machine instructions to the current block. Return true
6740b189e4e257924d90aaf63bf2e12bc7bbca961aDan Gohman  /// if selection was successful.
6840b189e4e257924d90aaf63bf2e12bc7bbca961aDan Gohman  ///
6940b189e4e257924d90aaf63bf2e12bc7bbca961aDan Gohman  bool SelectOperator(User *I, unsigned Opcode);
7040b189e4e257924d90aaf63bf2e12bc7bbca961aDan Gohman
7199b218218c0ca3ebfdd568ddfeafa07842e9d69dDan Gohman  /// TargetSelectInstruction - This method is called by target-independent
7299b218218c0ca3ebfdd568ddfeafa07842e9d69dDan Gohman  /// code when the normal FastISel process fails to select an instruction.
7399b218218c0ca3ebfdd568ddfeafa07842e9d69dDan Gohman  /// This gives targets a chance to emit code for anything that doesn't
7499b218218c0ca3ebfdd568ddfeafa07842e9d69dDan Gohman  /// fit into FastISel's framework. It returns true if it was successful.
7599b218218c0ca3ebfdd568ddfeafa07842e9d69dDan Gohman  ///
7699b218218c0ca3ebfdd568ddfeafa07842e9d69dDan Gohman  virtual bool
773df24e667f04a7003342b534310919abc9c87418Dan Gohman  TargetSelectInstruction(Instruction *I) = 0;
783df24e667f04a7003342b534310919abc9c87418Dan Gohman
793df24e667f04a7003342b534310919abc9c87418Dan Gohman  /// getRegForValue - Create a virtual register and arrange for it to
803df24e667f04a7003342b534310919abc9c87418Dan Gohman  /// be assigned the value for the given LLVM value.
813df24e667f04a7003342b534310919abc9c87418Dan Gohman  unsigned getRegForValue(Value *V);
8299b218218c0ca3ebfdd568ddfeafa07842e9d69dDan Gohman
83cc8430f742b0f1e567292c8a776e94fc1c930b2aDan Gohman  virtual ~FastISel();
84cc8430f742b0f1e567292c8a776e94fc1c930b2aDan Gohman
85b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohmanprotected:
863df24e667f04a7003342b534310919abc9c87418Dan Gohman  FastISel(MachineFunction &mf,
873df24e667f04a7003342b534310919abc9c87418Dan Gohman           DenseMap<const Value *, unsigned> &vm,
883df24e667f04a7003342b534310919abc9c87418Dan Gohman           DenseMap<const BasicBlock *, MachineBasicBlock *> &bm);
89e285a74f7cf9dd3ccf4fe758576cf83301f8a43eDan Gohman
90bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// FastEmit_r - This method is called by target-independent code
91bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// to request that an instruction with the given type and opcode
92bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// be emitted.
93b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman  virtual unsigned FastEmit_(MVT::SimpleValueType VT,
940f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson                             MVT::SimpleValueType RetVT,
95b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                             ISD::NodeType Opcode);
96bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman
97bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// FastEmit_r - This method is called by target-independent code
98bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// to request that an instruction with the given type, opcode, and
99bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// register operand be emitted.
100bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  ///
101b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman  virtual unsigned FastEmit_r(MVT::SimpleValueType VT,
1020f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson                              MVT::SimpleValueType RetVT,
103b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                              ISD::NodeType Opcode, unsigned Op0);
104bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman
105bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// FastEmit_rr - This method is called by target-independent code
106bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// to request that an instruction with the given type, opcode, and
107bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// register operands be emitted.
108bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  ///
109b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman  virtual unsigned FastEmit_rr(MVT::SimpleValueType VT,
1100f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson                               MVT::SimpleValueType RetVT,
111b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                               ISD::NodeType Opcode,
112b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                               unsigned Op0, unsigned Op1);
113b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman
11483785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  /// FastEmit_ri - This method is called by target-independent code
11583785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  /// to request that an instruction with the given type, opcode, and
11683785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  /// register and immediate operands be emitted.
11783785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  ///
11883785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  virtual unsigned FastEmit_ri(MVT::SimpleValueType VT,
1190f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson                               MVT::SimpleValueType RetVT,
12083785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng                               ISD::NodeType Opcode,
121d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman                               unsigned Op0, uint64_t Imm);
122d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman
12310df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// FastEmit_rf - This method is called by target-independent code
12410df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// to request that an instruction with the given type, opcode, and
12510df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// register and floating-point immediate operands be emitted.
12610df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  ///
12710df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  virtual unsigned FastEmit_rf(MVT::SimpleValueType VT,
12810df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                               MVT::SimpleValueType RetVT,
12910df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                               ISD::NodeType Opcode,
13010df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                               unsigned Op0, ConstantFP *FPImm);
13110df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman
132d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// FastEmit_rri - This method is called by target-independent code
133d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// to request that an instruction with the given type, opcode, and
134d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// register and immediate operands be emitted.
135d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  ///
136d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  virtual unsigned FastEmit_rri(MVT::SimpleValueType VT,
1370f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson                                MVT::SimpleValueType RetVT,
138d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman                                ISD::NodeType Opcode,
139d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman                                unsigned Op0, unsigned Op1, uint64_t Imm);
14083785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng
14183785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  /// FastEmit_ri_ - This method is a wrapper of FastEmit_ri. It first tries
14283785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  /// to emit an instruction with an immediate operand using FastEmit_ri.
14383785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  /// If that fails, it materializes the immediate into a register and try
14483785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  /// FastEmit_rr instead.
14583785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  unsigned FastEmit_ri_(MVT::SimpleValueType VT,
14683785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng                        ISD::NodeType Opcode,
14783785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng                        unsigned Op0, uint64_t Imm,
14883785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng                        MVT::SimpleValueType ImmType);
1496d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson
15010df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// FastEmit_rf_ - This method is a wrapper of FastEmit_rf. It first tries
15110df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// to emit an instruction with an immediate operand using FastEmit_rf.
15210df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// If that fails, it materializes the immediate into a register and try
15310df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// FastEmit_rr instead.
15410df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  unsigned FastEmit_rf_(MVT::SimpleValueType VT,
15510df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                        ISD::NodeType Opcode,
15610df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                        unsigned Op0, ConstantFP *FPImm,
15710df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                        MVT::SimpleValueType ImmType);
15810df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman
1596d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson  /// FastEmit_i - This method is called by target-independent code
1606d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson  /// to request that an instruction with the given type, opcode, and
1616d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson  /// immediate operand be emitted.
1626d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson  virtual unsigned FastEmit_i(MVT::SimpleValueType VT,
1630f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson                              MVT::SimpleValueType RetVT,
1646d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson                              ISD::NodeType Opcode,
1656d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson                              uint64_t Imm);
16683785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng
16710df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// FastEmit_f - This method is called by target-independent code
16810df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// to request that an instruction with the given type, opcode, and
16910df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// floating-point immediate operand be emitted.
17010df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  virtual unsigned FastEmit_f(MVT::SimpleValueType VT,
17110df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                              MVT::SimpleValueType RetVT,
17210df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                              ISD::NodeType Opcode,
17310df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                              ConstantFP *FPImm);
17410df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman
175bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// FastEmitInst_ - Emit a MachineInstr with no operands and a
176bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// result register in the given register class.
177bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  ///
178b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman  unsigned FastEmitInst_(unsigned MachineInstOpcode,
179b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                         const TargetRegisterClass *RC);
180bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman
181d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// FastEmitInst_r - Emit a MachineInstr with one register operand
182bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// and a result register in the given register class.
183bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  ///
184b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman  unsigned FastEmitInst_r(unsigned MachineInstOpcode,
185b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                          const TargetRegisterClass *RC,
186b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                          unsigned Op0);
187bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman
188d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// FastEmitInst_rr - Emit a MachineInstr with two register operands
189bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// and a result register in the given register class.
190bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  ///
191b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman  unsigned FastEmitInst_rr(unsigned MachineInstOpcode,
192b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                           const TargetRegisterClass *RC,
193b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                           unsigned Op0, unsigned Op1);
194bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman
195d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// FastEmitInst_ri - Emit a MachineInstr with two register operands
196d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// and a result register in the given register class.
197d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  ///
198d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  unsigned FastEmitInst_ri(unsigned MachineInstOpcode,
199d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman                           const TargetRegisterClass *RC,
200d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman                           unsigned Op0, uint64_t Imm);
201d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman
20210df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// FastEmitInst_rf - Emit a MachineInstr with two register operands
20310df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// and a result register in the given register class.
20410df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  ///
20510df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  unsigned FastEmitInst_rf(unsigned MachineInstOpcode,
20610df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                           const TargetRegisterClass *RC,
20710df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                           unsigned Op0, ConstantFP *FPImm);
20810df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman
209d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// FastEmitInst_rri - Emit a MachineInstr with two register operands,
210d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// an immediate, and a result register in the given register class.
211d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  ///
212d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  unsigned FastEmitInst_rri(unsigned MachineInstOpcode,
213d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman                            const TargetRegisterClass *RC,
214d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman                            unsigned Op0, unsigned Op1, uint64_t Imm);
2156d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson
2166d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson  /// FastEmitInst_i - Emit a MachineInstr with a single immediate
2176d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson  /// operand, and a result register in the given register class.
2186d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson  unsigned FastEmitInst_i(unsigned MachineInstrOpcode,
2196d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson                          const TargetRegisterClass *RC,
2206d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson                          uint64_t Imm);
221d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman
2228970f00deff00ffce1f35cf00883357e1582daa1Owen Anderson  /// FastEmitInst_extractsubreg - Emit a MachineInstr for an extract_subreg
2238970f00deff00ffce1f35cf00883357e1582daa1Owen Anderson  /// from a specified index of a superregister.
22440a468f24909792f000e3ccc1dda7a27b9c34b69Owen Anderson  unsigned FastEmitInst_extractsubreg(unsigned Op0, uint32_t Idx);
2258970f00deff00ffce1f35cf00883357e1582daa1Owen Anderson
22695267a1e671efc3c14e916b6978bbb15973b4cdcOwen Anderson  void UpdateValueMap(Value* I, unsigned Reg);
227ea09f4f4691a0db65772b54fe8163a48c9dce01dEvan Cheng
228c7f72de3b4ef21828ea4780f0693bf0acd04e1c5Dan Gohman  unsigned createResultReg(const TargetRegisterClass *RC);
22995267a1e671efc3c14e916b6978bbb15973b4cdcOwen Anderson
23095267a1e671efc3c14e916b6978bbb15973b4cdcOwen Anderson  virtual unsigned TargetSelectConstantPoolLoad(Constant* C,
23195267a1e671efc3c14e916b6978bbb15973b4cdcOwen Anderson                                                MachineConstantPool* MCP) {
23295267a1e671efc3c14e916b6978bbb15973b4cdcOwen Anderson    return 0;
23395267a1e671efc3c14e916b6978bbb15973b4cdcOwen Anderson  }
234c7f72de3b4ef21828ea4780f0693bf0acd04e1c5Dan Gohman
235ea09f4f4691a0db65772b54fe8163a48c9dce01dEvan Chengprivate:
23640b189e4e257924d90aaf63bf2e12bc7bbca961aDan Gohman  bool SelectBinaryOp(User *I, ISD::NodeType ISDOpcode);
237bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman
23840b189e4e257924d90aaf63bf2e12bc7bbca961aDan Gohman  bool SelectGetElementPtr(User *I);
239763d89343be210eb62a13318ca0cc9321ce46bfbDan Gohman
24040b189e4e257924d90aaf63bf2e12bc7bbca961aDan Gohman  bool SelectBitCast(User *I);
241d0533c9998d3baf41848ba559a9b2f2c65296d14Owen Anderson
24240b189e4e257924d90aaf63bf2e12bc7bbca961aDan Gohman  bool SelectCast(User *I, ISD::NodeType Opcode);
243b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman};
244b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman
245b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman}
246b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman
247b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman#endif
248