LLVM 22.0.0git
X86CodeGenPassBuilder.cpp
Go to the documentation of this file.
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 "X86ISelDAGToDAG.h"
14#include "X86TargetMachine.h"
15
16#include "llvm/MC/MCStreamer.h"
19
20using namespace llvm;
21
22namespace {
23
24class X86CodeGenPassBuilder
25 : public CodeGenPassBuilder<X86CodeGenPassBuilder, X86TargetMachine> {
26public:
27 explicit X86CodeGenPassBuilder(X86TargetMachine &TM,
28 const CGPassBuilderOption &Opts,
29 PassInstrumentationCallbacks *PIC)
30 : CodeGenPassBuilder(TM, Opts, PIC) {}
31 void addPreISel(AddIRPass &addPass) const;
32 void addAsmPrinter(AddMachinePass &, CreateMCStreamer) const;
33 Error addInstSelector(AddMachinePass &) const;
34};
35
36void X86CodeGenPassBuilder::addPreISel(AddIRPass &addPass) const {
37 // TODO: Add passes pre instruction selection.
38}
39
40void X86CodeGenPassBuilder::addAsmPrinter(AddMachinePass &addPass,
41 CreateMCStreamer) const {
42 // TODO: Add AsmPrinter.
43}
44
45Error X86CodeGenPassBuilder::addInstSelector(AddMachinePass &addPass) const {
46 // TODO: Add instruction selector related passes.
47 addPass(X86ISelDAGToDAGPass(TM));
48 return Error::success();
49}
50
51} // namespace
52
54#define GET_PASS_REGISTRY "X86PassRegistry.def"
56}
57
60 CodeGenFileType FileType, const CGPassBuilderOption &Opt,
62 auto CGPB = X86CodeGenPassBuilder(*this, Opt, PIC);
63 return CGPB.buildPipeline(MPM, Out, DwoOut, FileType);
64}
Interfaces for producing common pass manager configurations.
PassInstrumentationCallbacks PIC
PassBuilder PB(Machine, PassOpts->PTO, std::nullopt, &PIC)
This class provides access to building LLVM's passes.
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
static ErrorSuccess success()
Create a success value.
Definition Error.h:336
This class provides access to building LLVM's passes.
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
void registerPassBuilderCallbacks(PassBuilder &PB) override
Allow the target to modify the pass pipeline.
Error buildCodeGenPipeline(ModulePassManager &, raw_pwrite_stream &, raw_pwrite_stream *, CodeGenFileType, const CGPassBuilderOption &, PassInstrumentationCallbacks *) override
An abstract base class for streams implementations that also support a pwrite operation.
Interfaces for registering analysis passes, producing common pass manager configurations,...
This is an optimization pass for GlobalISel generic memory operations.
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit,...
Definition CodeGen.h:111
PassManager< Module > ModulePassManager
Convenience typedef for a pass manager over modules.