FastISel.h revision 95267a1e671efc3c14e916b6978bbb15973b4cdc
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
6499b218218c0ca3ebfdd568ddfeafa07842e9d69dDan Gohman  /// TargetSelectInstruction - This method is called by target-independent
6599b218218c0ca3ebfdd568ddfeafa07842e9d69dDan Gohman  /// code when the normal FastISel process fails to select an instruction.
6699b218218c0ca3ebfdd568ddfeafa07842e9d69dDan Gohman  /// This gives targets a chance to emit code for anything that doesn't
6799b218218c0ca3ebfdd568ddfeafa07842e9d69dDan Gohman  /// fit into FastISel's framework. It returns true if it was successful.
6899b218218c0ca3ebfdd568ddfeafa07842e9d69dDan Gohman  ///
6999b218218c0ca3ebfdd568ddfeafa07842e9d69dDan Gohman  virtual bool
703df24e667f04a7003342b534310919abc9c87418Dan Gohman  TargetSelectInstruction(Instruction *I) = 0;
713df24e667f04a7003342b534310919abc9c87418Dan Gohman
723df24e667f04a7003342b534310919abc9c87418Dan Gohman  /// getRegForValue - Create a virtual register and arrange for it to
733df24e667f04a7003342b534310919abc9c87418Dan Gohman  /// be assigned the value for the given LLVM value.
743df24e667f04a7003342b534310919abc9c87418Dan Gohman  unsigned getRegForValue(Value *V);
7599b218218c0ca3ebfdd568ddfeafa07842e9d69dDan Gohman
76cc8430f742b0f1e567292c8a776e94fc1c930b2aDan Gohman  virtual ~FastISel();
77cc8430f742b0f1e567292c8a776e94fc1c930b2aDan Gohman
78b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohmanprotected:
793df24e667f04a7003342b534310919abc9c87418Dan Gohman  FastISel(MachineFunction &mf,
803df24e667f04a7003342b534310919abc9c87418Dan Gohman           DenseMap<const Value *, unsigned> &vm,
813df24e667f04a7003342b534310919abc9c87418Dan Gohman           DenseMap<const BasicBlock *, MachineBasicBlock *> &bm);
82e285a74f7cf9dd3ccf4fe758576cf83301f8a43eDan Gohman
83bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// FastEmit_r - This method is called by target-independent code
84bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// to request that an instruction with the given type and opcode
85bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// be emitted.
86b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman  virtual unsigned FastEmit_(MVT::SimpleValueType VT,
870f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson                             MVT::SimpleValueType RetVT,
88b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                             ISD::NodeType Opcode);
89bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman
90bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// FastEmit_r - This method is called by target-independent code
91bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// to request that an instruction with the given type, opcode, and
92bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// register operand be emitted.
93bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  ///
94b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman  virtual unsigned FastEmit_r(MVT::SimpleValueType VT,
950f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson                              MVT::SimpleValueType RetVT,
96b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                              ISD::NodeType Opcode, unsigned Op0);
97bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman
98bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// FastEmit_rr - This method is called by target-independent code
99bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// to request that an instruction with the given type, opcode, and
100bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// register operands be emitted.
101bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  ///
102b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman  virtual unsigned FastEmit_rr(MVT::SimpleValueType VT,
1030f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson                               MVT::SimpleValueType RetVT,
104b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                               ISD::NodeType Opcode,
105b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                               unsigned Op0, unsigned Op1);
106b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman
10783785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  /// FastEmit_ri - This method is called by target-independent code
10883785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  /// to request that an instruction with the given type, opcode, and
10983785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  /// register and immediate operands be emitted.
11083785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  ///
11183785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  virtual unsigned FastEmit_ri(MVT::SimpleValueType VT,
1120f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson                               MVT::SimpleValueType RetVT,
11383785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng                               ISD::NodeType Opcode,
114d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman                               unsigned Op0, uint64_t Imm);
115d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman
11610df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// FastEmit_rf - This method is called by target-independent code
11710df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// to request that an instruction with the given type, opcode, and
11810df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// register and floating-point immediate operands be emitted.
11910df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  ///
12010df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  virtual unsigned FastEmit_rf(MVT::SimpleValueType VT,
12110df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                               MVT::SimpleValueType RetVT,
12210df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                               ISD::NodeType Opcode,
12310df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                               unsigned Op0, ConstantFP *FPImm);
12410df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman
125d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// FastEmit_rri - This method is called by target-independent code
126d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// to request that an instruction with the given type, opcode, and
127d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// register and immediate operands be emitted.
128d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  ///
129d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  virtual unsigned FastEmit_rri(MVT::SimpleValueType VT,
1300f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson                                MVT::SimpleValueType RetVT,
131d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman                                ISD::NodeType Opcode,
132d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman                                unsigned Op0, unsigned Op1, uint64_t Imm);
13383785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng
13483785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  /// FastEmit_ri_ - This method is a wrapper of FastEmit_ri. It first tries
13583785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  /// to emit an instruction with an immediate operand using FastEmit_ri.
13683785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  /// If that fails, it materializes the immediate into a register and try
13783785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  /// FastEmit_rr instead.
13883785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng  unsigned FastEmit_ri_(MVT::SimpleValueType VT,
13983785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng                        ISD::NodeType Opcode,
14083785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng                        unsigned Op0, uint64_t Imm,
14183785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng                        MVT::SimpleValueType ImmType);
1426d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson
14310df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// FastEmit_rf_ - This method is a wrapper of FastEmit_rf. It first tries
14410df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// to emit an instruction with an immediate operand using FastEmit_rf.
14510df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// If that fails, it materializes the immediate into a register and try
14610df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// FastEmit_rr instead.
14710df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  unsigned FastEmit_rf_(MVT::SimpleValueType VT,
14810df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                        ISD::NodeType Opcode,
14910df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                        unsigned Op0, ConstantFP *FPImm,
15010df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                        MVT::SimpleValueType ImmType);
15110df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman
1526d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson  /// FastEmit_i - This method is called by target-independent code
1536d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson  /// to request that an instruction with the given type, opcode, and
1546d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson  /// immediate operand be emitted.
1556d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson  virtual unsigned FastEmit_i(MVT::SimpleValueType VT,
1560f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson                              MVT::SimpleValueType RetVT,
1576d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson                              ISD::NodeType Opcode,
1586d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson                              uint64_t Imm);
15983785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng
16010df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// FastEmit_f - This method is called by target-independent code
16110df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// to request that an instruction with the given type, opcode, and
16210df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// floating-point immediate operand be emitted.
16310df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  virtual unsigned FastEmit_f(MVT::SimpleValueType VT,
16410df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                              MVT::SimpleValueType RetVT,
16510df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                              ISD::NodeType Opcode,
16610df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                              ConstantFP *FPImm);
16710df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman
168bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// FastEmitInst_ - Emit a MachineInstr with no operands and a
169bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// result register in the given register class.
170bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  ///
171b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman  unsigned FastEmitInst_(unsigned MachineInstOpcode,
172b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                         const TargetRegisterClass *RC);
173bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman
174d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// FastEmitInst_r - Emit a MachineInstr with one register operand
175bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// and a result register in the given register class.
176bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  ///
177b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman  unsigned FastEmitInst_r(unsigned MachineInstOpcode,
178b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                          const TargetRegisterClass *RC,
179b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                          unsigned Op0);
180bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman
181d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// FastEmitInst_rr - Emit a MachineInstr with two register operands
182bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  /// and a result register in the given register class.
183bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman  ///
184b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman  unsigned FastEmitInst_rr(unsigned MachineInstOpcode,
185b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                           const TargetRegisterClass *RC,
186b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman                           unsigned Op0, unsigned Op1);
187bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman
188d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// FastEmitInst_ri - Emit a MachineInstr with two register operands
189d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// and a result register in the given register class.
190d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  ///
191d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  unsigned FastEmitInst_ri(unsigned MachineInstOpcode,
192d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman                           const TargetRegisterClass *RC,
193d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman                           unsigned Op0, uint64_t Imm);
194d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman
19510df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// FastEmitInst_rf - Emit a MachineInstr with two register operands
19610df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  /// and a result register in the given register class.
19710df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  ///
19810df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman  unsigned FastEmitInst_rf(unsigned MachineInstOpcode,
19910df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                           const TargetRegisterClass *RC,
20010df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman                           unsigned Op0, ConstantFP *FPImm);
20110df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman
202d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// FastEmitInst_rri - Emit a MachineInstr with two register operands,
203d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  /// an immediate, and a result register in the given register class.
204d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  ///
205d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman  unsigned FastEmitInst_rri(unsigned MachineInstOpcode,
206d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman                            const TargetRegisterClass *RC,
207d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman                            unsigned Op0, unsigned Op1, uint64_t Imm);
2086d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson
2096d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson  /// FastEmitInst_i - Emit a MachineInstr with a single immediate
2106d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson  /// operand, and a result register in the given register class.
2116d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson  unsigned FastEmitInst_i(unsigned MachineInstrOpcode,
2126d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson                          const TargetRegisterClass *RC,
2136d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson                          uint64_t Imm);
214d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman
2158970f00deff00ffce1f35cf00883357e1582daa1Owen Anderson  /// FastEmitInst_extractsubreg - Emit a MachineInstr for an extract_subreg
2168970f00deff00ffce1f35cf00883357e1582daa1Owen Anderson  /// from a specified index of a superregister.
21740a468f24909792f000e3ccc1dda7a27b9c34b69Owen Anderson  unsigned FastEmitInst_extractsubreg(unsigned Op0, uint32_t Idx);
2188970f00deff00ffce1f35cf00883357e1582daa1Owen Anderson
21995267a1e671efc3c14e916b6978bbb15973b4cdcOwen Anderson  void UpdateValueMap(Value* I, unsigned Reg);
220ea09f4f4691a0db65772b54fe8163a48c9dce01dEvan Cheng
221c7f72de3b4ef21828ea4780f0693bf0acd04e1c5Dan Gohman  unsigned createResultReg(const TargetRegisterClass *RC);
22295267a1e671efc3c14e916b6978bbb15973b4cdcOwen Anderson
22395267a1e671efc3c14e916b6978bbb15973b4cdcOwen Anderson  virtual unsigned TargetSelectConstantPoolLoad(Constant* C,
22495267a1e671efc3c14e916b6978bbb15973b4cdcOwen Anderson                                                MachineConstantPool* MCP) {
22595267a1e671efc3c14e916b6978bbb15973b4cdcOwen Anderson    return 0;
22695267a1e671efc3c14e916b6978bbb15973b4cdcOwen Anderson  }
227c7f72de3b4ef21828ea4780f0693bf0acd04e1c5Dan Gohman
228ea09f4f4691a0db65772b54fe8163a48c9dce01dEvan Chengprivate:
2293df24e667f04a7003342b534310919abc9c87418Dan Gohman  bool SelectBinaryOp(Instruction *I, ISD::NodeType ISDOpcode);
230bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman
2313df24e667f04a7003342b534310919abc9c87418Dan Gohman  bool SelectGetElementPtr(Instruction *I);
232763d89343be210eb62a13318ca0cc9321ce46bfbDan Gohman
2333df24e667f04a7003342b534310919abc9c87418Dan Gohman  bool SelectBitCast(Instruction *I);
234d0533c9998d3baf41848ba559a9b2f2c65296d14Owen Anderson
2353df24e667f04a7003342b534310919abc9c87418Dan Gohman  bool SelectCast(Instruction *I, ISD::NodeType Opcode);
236b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman};
237b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman
238b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman}
239b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman
240b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman#endif
241