1 //===-- X86CodeGenPassBuilder.cpp ---------------------------------*- C++ -*-=// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 /// \file 9 /// This file contains X86 CodeGen pipeline builder. 10 /// TODO: Port CodeGen passes to new pass manager. 11 //===----------------------------------------------------------------------===// 12 13 #include "X86TargetMachine.h" 14 15 #include "llvm/CodeGen/CodeGenPassBuilder.h" 16 #include "llvm/MC/MCStreamer.h" 17 18 using namespace llvm; 19 20 namespace { 21 22 class X86CodeGenPassBuilder : public CodeGenPassBuilder<X86CodeGenPassBuilder> { 23 public: 24 explicit X86CodeGenPassBuilder(LLVMTargetMachine &TM, 25 CGPassBuilderOption Opts, 26 PassInstrumentationCallbacks *PIC) 27 : CodeGenPassBuilder(TM, Opts, PIC) {} 28 void addPreISel(AddIRPass &addPass) const; 29 void addAsmPrinter(AddMachinePass &, CreateMCStreamer) const; 30 Error addInstSelector(AddMachinePass &) const; 31 }; 32 33 void X86CodeGenPassBuilder::addPreISel(AddIRPass &addPass) const { 34 // TODO: Add passes pre instruction selection. 35 } 36 37 void X86CodeGenPassBuilder::addAsmPrinter(AddMachinePass &addPass, 38 CreateMCStreamer) const { 39 // TODO: Add AsmPrinter. 40 } 41 42 Error X86CodeGenPassBuilder::addInstSelector(AddMachinePass &) const { 43 // TODO: Add instruction selector. 44 return Error::success(); 45 } 46 47 } // namespace 48 49 Error X86TargetMachine::buildCodeGenPipeline( 50 ModulePassManager &MPM, MachineFunctionPassManager &MFPM, 51 MachineFunctionAnalysisManager &, raw_pwrite_stream &Out, 52 raw_pwrite_stream *DwoOut, CodeGenFileType FileType, 53 CGPassBuilderOption Opt, PassInstrumentationCallbacks *PIC) { 54 auto CGPB = X86CodeGenPassBuilder(*this, Opt, PIC); 55 return CGPB.buildPipeline(MPM, MFPM, Out, DwoOut, FileType); 56 } 57