Files
revng-revng/include/revng/Pipes/CompileModulePipe.h
Massimo Fioravanti 7eeb9f50c0 pipeline --verbose: print list of commands
`revng pipeline --verbose` will now print a list of equivalent commands
for the current invocation.
2022-03-28 12:17:05 +02:00

79 lines
2.5 KiB
C++

#pragma once
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
#include <string>
#include "llvm/ADT/ArrayRef.h"
#include "revng/Pipeline/ContainerSet.h"
#include "revng/Pipeline/Context.h"
#include "revng/Pipeline/Contract.h"
#include "revng/Pipeline/GenericLLVMPipe.h"
#include "revng/Pipeline/LLVMContainer.h"
#include "revng/Pipeline/LLVMGlobalKindBase.h"
#include "revng/Pipeline/Target.h"
#include "revng/Pipes/FileContainer.h"
#include "revng/Pipes/Kinds.h"
#include "revng/Pipes/RootKind.h"
#include "revng/Pipes/TaggedFunctionKind.h"
namespace revng::pipes {
class CompileModulePipe {
public:
static constexpr auto Name = "Compile";
std::array<pipeline::ContractGroup, 1> getContract() const {
return { pipeline::ContractGroup(Root,
pipeline::Exactness::DerivedFrom,
0,
Object,
1) };
}
void run(const pipeline::Context &,
pipeline::LLVMContainer &TargetsList,
FileContainer &TargetBinary);
void print(const pipeline::Context &Ctx,
llvm::raw_ostream &OS,
llvm::ArrayRef<std::string> ContainerNames) const {
OS << "llc " << ContainerNames[0] << " -o " << ContainerNames[1]
<< " --filetype=obj"
<< "\n";
};
};
class CompileIsolatedModulePipe {
public:
static constexpr auto Name = "CompileIsolated";
std::array<pipeline::ContractGroup, 1> getContract() const {
pipeline::Contract RootPart(IsolatedRoot,
pipeline::Exactness::Exact,
0,
Object,
1,
pipeline::InputPreservation::Preserve);
pipeline::Contract IsolatedPart(Isolated,
pipeline::Exactness::Exact,
0,
Object,
1);
return { pipeline::ContractGroup({ RootPart, IsolatedPart }) };
}
void run(const pipeline::Context &,
pipeline::LLVMContainer &TargetsList,
FileContainer &TargetBinary);
void print(const pipeline::Context &Ctx,
llvm::raw_ostream &OS,
llvm::ArrayRef<std::string> ContainerNames) const {
OS << "llc " << ContainerNames[0] << " -o " << ContainerNames[1]
<< " --filetype=obj"
<< "\n";
};
};
} // namespace revng::pipes