1 //== llvm/CodeGen/GlobalISel/InstructionSelect.h -----------------*- C++ -*-==// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 /// \file This file describes the interface of the MachineFunctionPass 10 /// responsible for selecting (possibly generic) machine instructions to 11 /// target-specific instructions. 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_CODEGEN_GLOBALISEL_INSTRUCTIONSELECT_H 15 #define LLVM_CODEGEN_GLOBALISEL_INSTRUCTIONSELECT_H 16 17 #include "llvm/CodeGen/GlobalISel/InstructionSelector.h" 18 #include "llvm/CodeGen/MachineFunctionPass.h" 19 20 namespace llvm { 21 /// This pass is responsible for selecting generic machine instructions to 22 /// target-specific instructions. It relies on the InstructionSelector provided 23 /// by the target. 24 /// Selection is done by examining blocks in post-order, and instructions in 25 /// reverse order. 26 /// 27 /// \post for all inst in MF: not isPreISelGenericOpcode(inst.opcode) 28 class InstructionSelect : public MachineFunctionPass { 29 public: 30 static char ID; getPassName()31 StringRef getPassName() const override { return "InstructionSelect"; } 32 33 void getAnalysisUsage(AnalysisUsage &AU) const override; 34 getRequiredProperties()35 MachineFunctionProperties getRequiredProperties() const override { 36 return MachineFunctionProperties() 37 .set(MachineFunctionProperties::Property::IsSSA) 38 .set(MachineFunctionProperties::Property::Legalized) 39 .set(MachineFunctionProperties::Property::RegBankSelected); 40 } 41 getSetProperties()42 MachineFunctionProperties getSetProperties() const override { 43 return MachineFunctionProperties().set( 44 MachineFunctionProperties::Property::Selected); 45 } 46 47 InstructionSelect(); 48 49 bool runOnMachineFunction(MachineFunction &MF) override; 50 }; 51 } // End namespace llvm. 52 53 #endif 54