1if (DEFINED LLVM_HAVE_TF_AOT OR DEFINED LLVM_HAVE_TF_API)
2  include(TensorFlowCompile)
3  set(LLVM_RAEVICT_MODEL_PATH_DEFAULT "models/regalloc-eviction")
4
5  # This url points to the most recent most which is known to be compatible with
6  # LLVM. When better models are published, this url should be updated to aid
7  # discoverability.
8  set(LLVM_RAEVICT_MODEL_CURRENT_URL "https://github.com/google/ml-compiler-opt/releases/download/regalloc-evict-v1.0/regalloc-evict-e67430c-v1.0.tar.gz")
9
10  if (DEFINED LLVM_HAVE_TF_AOT)
11    tf_find_and_compile(
12      ${LLVM_RAEVICT_MODEL_PATH}
13      ${LLVM_RAEVICT_MODEL_CURRENT_URL}
14      ${LLVM_RAEVICT_MODEL_PATH_DEFAULT}
15      "../Analysis/models/gen-regalloc-eviction-test-model.py"
16      serve
17      action
18      RegallocEvictModel
19      llvm::RegallocEvictModel
20    )
21  endif()
22
23  if (DEFINED LLVM_HAVE_TF_API)
24    list(APPEND MLLinkDeps ${tensorflow_c_api} ${tensorflow_fx})
25  endif()
26endif()
27
28add_llvm_component_library(LLVMCodeGen
29  AggressiveAntiDepBreaker.cpp
30  AllocationOrder.cpp
31  Analysis.cpp
32  AtomicExpandPass.cpp
33  BasicTargetTransformInfo.cpp
34  BranchFolding.cpp
35  BranchRelaxation.cpp
36  BreakFalseDeps.cpp
37  BasicBlockSections.cpp
38  CalcSpillWeights.cpp
39  CallingConvLower.cpp
40  CFGuardLongjmp.cpp
41  CFIInstrInserter.cpp
42  CodeGen.cpp
43  CodeGenCommonISel.cpp
44  CodeGenPassBuilder.cpp
45  CodeGenPrepare.cpp
46  CommandFlags.cpp
47  CriticalAntiDepBreaker.cpp
48  DeadMachineInstructionElim.cpp
49  DetectDeadLanes.cpp
50  DFAPacketizer.cpp
51  DwarfEHPrepare.cpp
52  EarlyIfConversion.cpp
53  EdgeBundles.cpp
54  EHContGuardCatchret.cpp
55  ExecutionDomainFix.cpp
56  ExpandMemCmp.cpp
57  ExpandPostRAPseudos.cpp
58  ExpandReductions.cpp
59  ExpandVectorPredication.cpp
60  FaultMaps.cpp
61  FEntryInserter.cpp
62  FinalizeISel.cpp
63  FixupStatepointCallerSaved.cpp
64  FuncletLayout.cpp
65  GCMetadata.cpp
66  GCMetadataPrinter.cpp
67  GCRootLowering.cpp
68  GlobalMerge.cpp
69  HardwareLoops.cpp
70  IfConversion.cpp
71  ImplicitNullChecks.cpp
72  IndirectBrExpandPass.cpp
73  InlineSpiller.cpp
74  InterferenceCache.cpp
75  InterleavedAccessPass.cpp
76  InterleavedLoadCombinePass.cpp
77  IntrinsicLowering.cpp
78  JMCInstrumenter.cpp
79  LatencyPriorityQueue.cpp
80  LazyMachineBlockFrequencyInfo.cpp
81  LexicalScopes.cpp
82  LiveDebugVariables.cpp
83  LiveIntervals.cpp
84  LiveInterval.cpp
85  LiveIntervalUnion.cpp
86  LivePhysRegs.cpp
87  LiveRangeCalc.cpp
88  LiveIntervalCalc.cpp
89  LiveRangeEdit.cpp
90  LiveRangeShrink.cpp
91  LiveRegMatrix.cpp
92  LiveRegUnits.cpp
93  LiveStacks.cpp
94  LiveVariables.cpp
95  LLVMTargetMachine.cpp
96  LocalStackSlotAllocation.cpp
97  LoopTraversal.cpp
98  LowLevelType.cpp
99  LowerEmuTLS.cpp
100  MachineBasicBlock.cpp
101  MachineBlockFrequencyInfo.cpp
102  MachineBlockPlacement.cpp
103  MachineBranchProbabilityInfo.cpp
104  MachineCombiner.cpp
105  MachineCopyPropagation.cpp
106  MachineCSE.cpp
107  MachineCheckDebugify.cpp
108  MachineCycleAnalysis.cpp
109  MachineDebugify.cpp
110  MachineDominanceFrontier.cpp
111  MachineDominators.cpp
112  MachineFrameInfo.cpp
113  MachineFunction.cpp
114  MachineFunctionPass.cpp
115  MachineFunctionPrinterPass.cpp
116  MachineFunctionSplitter.cpp
117  MachineInstrBundle.cpp
118  MachineInstr.cpp
119  MachineLICM.cpp
120  MachineLoopInfo.cpp
121  MachineLoopUtils.cpp
122  MachineModuleInfo.cpp
123  MachineModuleInfoImpls.cpp
124  MachineModuleSlotTracker.cpp
125  MachineOperand.cpp
126  MachineOptimizationRemarkEmitter.cpp
127  MachineOutliner.cpp
128  MachinePassManager.cpp
129  MachinePipeliner.cpp
130  MachinePostDominators.cpp
131  MachineRegionInfo.cpp
132  MachineRegisterInfo.cpp
133  MachineScheduler.cpp
134  MachineSink.cpp
135  MachineSizeOpts.cpp
136  MachineSSAContext.cpp
137  MachineSSAUpdater.cpp
138  MachineStripDebug.cpp
139  MachineTraceMetrics.cpp
140  MachineVerifier.cpp
141  MIRFSDiscriminator.cpp
142  MIRSampleProfile.cpp
143  MIRYamlMapping.cpp
144  MLRegallocEvictAdvisor.cpp
145  ModuloSchedule.cpp
146  MultiHazardRecognizer.cpp
147  PatchableFunction.cpp
148  MBFIWrapper.cpp
149  MIRPrinter.cpp
150  MIRPrintingPass.cpp
151  MacroFusion.cpp
152  NonRelocatableStringpool.cpp
153  OptimizePHIs.cpp
154  ParallelCG.cpp
155  PeepholeOptimizer.cpp
156  PHIElimination.cpp
157  PHIEliminationUtils.cpp
158  PostRAHazardRecognizer.cpp
159  PostRASchedulerList.cpp
160  PreISelIntrinsicLowering.cpp
161  ProcessImplicitDefs.cpp
162  PrologEpilogInserter.cpp
163  PseudoProbeInserter.cpp
164  PseudoSourceValue.cpp
165  RDFGraph.cpp
166  RDFLiveness.cpp
167  RDFRegisters.cpp
168  ReachingDefAnalysis.cpp
169  RegAllocBase.cpp
170  RegAllocBasic.cpp
171  RegAllocEvictionAdvisor.cpp
172  RegAllocFast.cpp
173  RegAllocGreedy.cpp
174  RegAllocPBQP.cpp
175  RegAllocScore.cpp
176  RegisterClassInfo.cpp
177  RegisterCoalescer.cpp
178  RegisterPressure.cpp
179  RegisterScavenging.cpp
180  RemoveRedundantDebugValues.cpp
181  RenameIndependentSubregs.cpp
182  MachineStableHash.cpp
183  MIRVRegNamerUtils.cpp
184  MIRNamerPass.cpp
185  MIRCanonicalizerPass.cpp
186  RegisterUsageInfo.cpp
187  RegUsageInfoCollector.cpp
188  RegUsageInfoPropagate.cpp
189  ReplaceWithVeclib.cpp
190  ResetMachineFunctionPass.cpp
191  RegisterBank.cpp
192  RegisterBankInfo.cpp
193  SafeStack.cpp
194  SafeStackLayout.cpp
195  ScheduleDAG.cpp
196  ScheduleDAGInstrs.cpp
197  ScheduleDAGPrinter.cpp
198  ScoreboardHazardRecognizer.cpp
199  ShadowStackGCLowering.cpp
200  ShrinkWrap.cpp
201  SjLjEHPrepare.cpp
202  SlotIndexes.cpp
203  SpillPlacement.cpp
204  SplitKit.cpp
205  StackColoring.cpp
206  StackMapLivenessAnalysis.cpp
207  StackMaps.cpp
208  StackProtector.cpp
209  StackSlotColoring.cpp
210  SwiftErrorValueTracking.cpp
211  SwitchLoweringUtils.cpp
212  TailDuplication.cpp
213  TailDuplicator.cpp
214  TargetFrameLoweringImpl.cpp
215  TargetInstrInfo.cpp
216  TargetLoweringBase.cpp
217  TargetLoweringObjectFileImpl.cpp
218  TargetOptionsImpl.cpp
219  TargetPassConfig.cpp
220  TargetRegisterInfo.cpp
221  TargetSchedule.cpp
222  TargetSubtargetInfo.cpp
223  TypePromotion.cpp
224  TwoAddressInstructionPass.cpp
225  UnreachableBlockElim.cpp
226  ValueTypes.cpp
227  VLIWMachineScheduler.cpp
228  VirtRegMap.cpp
229  WasmEHPrepare.cpp
230  WinEHPrepare.cpp
231  XRayInstrumentation.cpp
232  ${GeneratedMLSources}
233
234  LiveDebugValues/LiveDebugValues.cpp
235  LiveDebugValues/VarLocBasedImpl.cpp
236  LiveDebugValues/InstrRefBasedImpl.cpp
237
238  ADDITIONAL_HEADER_DIRS
239  ${LLVM_MAIN_INCLUDE_DIR}/llvm/CodeGen
240  ${LLVM_MAIN_INCLUDE_DIR}/llvm/CodeGen/PBQP
241
242  LINK_LIBS ${LLVM_PTHREAD_LIB} ${MLLinkDeps}
243
244  DEPENDS
245  intrinsics_gen
246  ${MLDeps}
247
248  LINK_COMPONENTS
249  Analysis
250  BitReader
251  BitWriter
252  Core
253  MC
254  ProfileData
255  Scalar
256  Support
257  Target
258  TransformUtils
259  )
260
261add_subdirectory(SelectionDAG)
262add_subdirectory(AsmPrinter)
263add_subdirectory(MIRParser)
264add_subdirectory(GlobalISel)
265