FastISel.h revision 59fbc80f6b3b5c71dfb84149f589625f7ed510e3
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 8359fbc80f6b3b5c71dfb84149f589625f7ed510e3Evan Cheng /// lookUpRegForValue - Look up the value to see if its value is already 8459fbc80f6b3b5c71dfb84149f589625f7ed510e3Evan Cheng /// cached in a register. It may be defined by instructions across blocks or 8559fbc80f6b3b5c71dfb84149f589625f7ed510e3Evan Cheng /// defined locally. 8659fbc80f6b3b5c71dfb84149f589625f7ed510e3Evan Cheng unsigned lookUpRegForValue(Value *V); 8759fbc80f6b3b5c71dfb84149f589625f7ed510e3Evan Cheng 88cc8430f742b0f1e567292c8a776e94fc1c930b2aDan Gohman virtual ~FastISel(); 89cc8430f742b0f1e567292c8a776e94fc1c930b2aDan Gohman 90b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohmanprotected: 913df24e667f04a7003342b534310919abc9c87418Dan Gohman FastISel(MachineFunction &mf, 923df24e667f04a7003342b534310919abc9c87418Dan Gohman DenseMap<const Value *, unsigned> &vm, 933df24e667f04a7003342b534310919abc9c87418Dan Gohman DenseMap<const BasicBlock *, MachineBasicBlock *> &bm); 94e285a74f7cf9dd3ccf4fe758576cf83301f8a43eDan Gohman 95bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// FastEmit_r - This method is called by target-independent code 96bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// to request that an instruction with the given type and opcode 97bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// be emitted. 98b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman virtual unsigned FastEmit_(MVT::SimpleValueType VT, 990f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson MVT::SimpleValueType RetVT, 100b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman ISD::NodeType Opcode); 101bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman 102bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// FastEmit_r - This method is called by target-independent code 103bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// to request that an instruction with the given type, opcode, and 104bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// register operand be emitted. 105bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// 106b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman virtual unsigned FastEmit_r(MVT::SimpleValueType VT, 1070f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson MVT::SimpleValueType RetVT, 108b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman ISD::NodeType Opcode, unsigned Op0); 109bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman 110bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// FastEmit_rr - This method is called by target-independent code 111bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// to request that an instruction with the given type, opcode, and 112bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// register operands be emitted. 113bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// 114b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman virtual unsigned FastEmit_rr(MVT::SimpleValueType VT, 1150f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson MVT::SimpleValueType RetVT, 116b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman ISD::NodeType Opcode, 117b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman unsigned Op0, unsigned Op1); 118b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman 11983785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng /// FastEmit_ri - This method is called by target-independent code 12083785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng /// to request that an instruction with the given type, opcode, and 12183785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng /// register and immediate operands be emitted. 12283785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng /// 12383785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng virtual unsigned FastEmit_ri(MVT::SimpleValueType VT, 1240f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson MVT::SimpleValueType RetVT, 12583785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng ISD::NodeType Opcode, 126d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman unsigned Op0, uint64_t Imm); 127d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman 12810df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman /// FastEmit_rf - This method is called by target-independent code 12910df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman /// to request that an instruction with the given type, opcode, and 13010df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman /// register and floating-point immediate operands be emitted. 13110df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman /// 13210df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman virtual unsigned FastEmit_rf(MVT::SimpleValueType VT, 13310df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman MVT::SimpleValueType RetVT, 13410df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman ISD::NodeType Opcode, 13510df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman unsigned Op0, ConstantFP *FPImm); 13610df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman 137d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman /// FastEmit_rri - This method is called by target-independent code 138d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman /// to request that an instruction with the given type, opcode, and 139d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman /// register and immediate operands be emitted. 140d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman /// 141d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman virtual unsigned FastEmit_rri(MVT::SimpleValueType VT, 1420f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson MVT::SimpleValueType RetVT, 143d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman ISD::NodeType Opcode, 144d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman unsigned Op0, unsigned Op1, uint64_t Imm); 14583785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng 14683785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng /// FastEmit_ri_ - This method is a wrapper of FastEmit_ri. It first tries 14783785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng /// to emit an instruction with an immediate operand using FastEmit_ri. 14883785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng /// If that fails, it materializes the immediate into a register and try 14983785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng /// FastEmit_rr instead. 15083785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng unsigned FastEmit_ri_(MVT::SimpleValueType VT, 15183785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng ISD::NodeType Opcode, 15283785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng unsigned Op0, uint64_t Imm, 15383785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng MVT::SimpleValueType ImmType); 1546d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson 15510df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman /// FastEmit_rf_ - This method is a wrapper of FastEmit_rf. It first tries 15610df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman /// to emit an instruction with an immediate operand using FastEmit_rf. 15710df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman /// If that fails, it materializes the immediate into a register and try 15810df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman /// FastEmit_rr instead. 15910df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman unsigned FastEmit_rf_(MVT::SimpleValueType VT, 16010df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman ISD::NodeType Opcode, 16110df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman unsigned Op0, ConstantFP *FPImm, 16210df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman MVT::SimpleValueType ImmType); 16310df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman 1646d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson /// FastEmit_i - This method is called by target-independent code 1656d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson /// to request that an instruction with the given type, opcode, and 1666d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson /// immediate operand be emitted. 1676d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson virtual unsigned FastEmit_i(MVT::SimpleValueType VT, 1680f84e4e31009eecf2dfcbe6113b65d0919f30254Owen Anderson MVT::SimpleValueType RetVT, 1696d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson ISD::NodeType Opcode, 1706d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson uint64_t Imm); 17183785c80968165b30fcdd111ceb2c28d38bcff86Evan Cheng 17210df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman /// FastEmit_f - This method is called by target-independent code 17310df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman /// to request that an instruction with the given type, opcode, and 17410df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman /// floating-point immediate operand be emitted. 17510df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman virtual unsigned FastEmit_f(MVT::SimpleValueType VT, 17610df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman MVT::SimpleValueType RetVT, 17710df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman ISD::NodeType Opcode, 17810df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman ConstantFP *FPImm); 17910df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman 180bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// FastEmitInst_ - Emit a MachineInstr with no operands and a 181bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// result register in the given register class. 182bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// 183b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman unsigned FastEmitInst_(unsigned MachineInstOpcode, 184b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman const TargetRegisterClass *RC); 185bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman 186d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman /// FastEmitInst_r - Emit a MachineInstr with one register operand 187bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// and a result register in the given register class. 188bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// 189b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman unsigned FastEmitInst_r(unsigned MachineInstOpcode, 190b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman const TargetRegisterClass *RC, 191b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman unsigned Op0); 192bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman 193d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman /// FastEmitInst_rr - Emit a MachineInstr with two register operands 194bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// and a result register in the given register class. 195bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman /// 196b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman unsigned FastEmitInst_rr(unsigned MachineInstOpcode, 197b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman const TargetRegisterClass *RC, 198b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman unsigned Op0, unsigned Op1); 199bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman 200d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman /// FastEmitInst_ri - Emit a MachineInstr with two register operands 201d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman /// and a result register in the given register class. 202d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman /// 203d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman unsigned FastEmitInst_ri(unsigned MachineInstOpcode, 204d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman const TargetRegisterClass *RC, 205d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman unsigned Op0, uint64_t Imm); 206d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman 20710df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman /// FastEmitInst_rf - Emit a MachineInstr with two register operands 20810df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman /// and a result register in the given register class. 20910df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman /// 21010df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman unsigned FastEmitInst_rf(unsigned MachineInstOpcode, 21110df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman const TargetRegisterClass *RC, 21210df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman unsigned Op0, ConstantFP *FPImm); 21310df0fa73e396bbc93a8940e8b53827390c54d10Dan Gohman 214d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman /// FastEmitInst_rri - Emit a MachineInstr with two register operands, 215d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman /// an immediate, and a result register in the given register class. 216d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman /// 217d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman unsigned FastEmitInst_rri(unsigned MachineInstOpcode, 218d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman const TargetRegisterClass *RC, 219d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman unsigned Op0, unsigned Op1, uint64_t Imm); 2206d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson 2216d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson /// FastEmitInst_i - Emit a MachineInstr with a single immediate 2226d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson /// operand, and a result register in the given register class. 2236d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson unsigned FastEmitInst_i(unsigned MachineInstrOpcode, 2246d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson const TargetRegisterClass *RC, 2256d0c25ec3a7ca822e68f73a4481eee43eb5c9485Owen Anderson uint64_t Imm); 226d5fe57d2f980c6bd1a61450f99c254a76d0f1683Dan Gohman 2278970f00deff00ffce1f35cf00883357e1582daa1Owen Anderson /// FastEmitInst_extractsubreg - Emit a MachineInstr for an extract_subreg 2288970f00deff00ffce1f35cf00883357e1582daa1Owen Anderson /// from a specified index of a superregister. 22940a468f24909792f000e3ccc1dda7a27b9c34b69Owen Anderson unsigned FastEmitInst_extractsubreg(unsigned Op0, uint32_t Idx); 2308970f00deff00ffce1f35cf00883357e1582daa1Owen Anderson 23195267a1e671efc3c14e916b6978bbb15973b4cdcOwen Anderson void UpdateValueMap(Value* I, unsigned Reg); 232ea09f4f4691a0db65772b54fe8163a48c9dce01dEvan Cheng 233c7f72de3b4ef21828ea4780f0693bf0acd04e1c5Dan Gohman unsigned createResultReg(const TargetRegisterClass *RC); 23495267a1e671efc3c14e916b6978bbb15973b4cdcOwen Anderson 2359c7216f984111eb8f1716741bc9039ed86ec4a9bOwen Anderson /// TargetMaterializeConstant - Emit a constant in a register using 2369c7216f984111eb8f1716741bc9039ed86ec4a9bOwen Anderson /// target-specific logic, such as constant pool loads. 2379c7216f984111eb8f1716741bc9039ed86ec4a9bOwen Anderson virtual unsigned TargetMaterializeConstant(Constant* C, 2389c7216f984111eb8f1716741bc9039ed86ec4a9bOwen Anderson MachineConstantPool* MCP) { 23995267a1e671efc3c14e916b6978bbb15973b4cdcOwen Anderson return 0; 24095267a1e671efc3c14e916b6978bbb15973b4cdcOwen Anderson } 241c7f72de3b4ef21828ea4780f0693bf0acd04e1c5Dan Gohman 242ea09f4f4691a0db65772b54fe8163a48c9dce01dEvan Chengprivate: 24340b189e4e257924d90aaf63bf2e12bc7bbca961aDan Gohman bool SelectBinaryOp(User *I, ISD::NodeType ISDOpcode); 244bdedd4477331b3b0d28d74658baf05f675f2d195Dan Gohman 24540b189e4e257924d90aaf63bf2e12bc7bbca961aDan Gohman bool SelectGetElementPtr(User *I); 246763d89343be210eb62a13318ca0cc9321ce46bfbDan Gohman 24740b189e4e257924d90aaf63bf2e12bc7bbca961aDan Gohman bool SelectBitCast(User *I); 248d0533c9998d3baf41848ba559a9b2f2c65296d14Owen Anderson 24940b189e4e257924d90aaf63bf2e12bc7bbca961aDan Gohman bool SelectCast(User *I, ISD::NodeType Opcode); 250b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman}; 251b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman 252b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman} 253b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman 254b0cf29c5cfff797284b3660dc233e135feb65d9aDan Gohman#endif 255