File indexing completed on 2026-05-10 08:43:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef LLVM_EXECUTIONENGINE_ORC_IRPARTITIONLAYER_H
0015 #define LLVM_EXECUTIONENGINE_ORC_IRPARTITIONLAYER_H
0016
0017 #include "llvm/ExecutionEngine/Orc/IndirectionUtils.h"
0018 #include "llvm/ExecutionEngine/Orc/Layer.h"
0019 #include "llvm/IR/Attributes.h"
0020 #include "llvm/IR/Constant.h"
0021 #include "llvm/IR/Constants.h"
0022 #include "llvm/IR/DataLayout.h"
0023 #include "llvm/IR/Function.h"
0024 #include "llvm/IR/GlobalAlias.h"
0025 #include "llvm/IR/GlobalValue.h"
0026 #include "llvm/IR/GlobalVariable.h"
0027 #include "llvm/IR/Instruction.h"
0028 #include "llvm/IR/Mangler.h"
0029 #include "llvm/IR/Module.h"
0030 #include "llvm/IR/Type.h"
0031
0032 namespace llvm {
0033 namespace orc {
0034
0035
0036
0037 class IRPartitionLayer : public IRLayer {
0038 friend class PartitioningIRMaterializationUnit;
0039
0040 public:
0041 using GlobalValueSet = std::set<const GlobalValue *>;
0042
0043
0044 using PartitionFunction =
0045 std::function<std::optional<GlobalValueSet>(GlobalValueSet Requested)>;
0046
0047
0048 IRPartitionLayer(ExecutionSession &ES, IRLayer &BaseLayer);
0049
0050
0051
0052 static std::optional<GlobalValueSet>
0053 compileRequested(GlobalValueSet Requested);
0054
0055
0056
0057 static std::optional<GlobalValueSet>
0058 compileWholeModule(GlobalValueSet Requested);
0059
0060
0061 void setPartitionFunction(PartitionFunction Partition);
0062
0063
0064
0065 void emit(std::unique_ptr<MaterializationResponsibility> R,
0066 ThreadSafeModule TSM) override;
0067
0068 private:
0069 void cleanUpModule(Module &M);
0070
0071 void expandPartition(GlobalValueSet &Partition);
0072
0073 void emitPartition(std::unique_ptr<MaterializationResponsibility> R,
0074 ThreadSafeModule TSM,
0075 IRMaterializationUnit::SymbolNameToDefinitionMap Defs);
0076
0077 IRLayer &BaseLayer;
0078 PartitionFunction Partition = compileRequested;
0079 SymbolLinkagePromoter PromoteSymbols;
0080 };
0081
0082 }
0083 }
0084
0085 #endif