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  BasicBlockSectionsProfileReader.cpp
39  CalcSpillWeights.cpp
40  CallingConvLower.cpp
41  CFGuardLongjmp.cpp
42  CFIFixup.cpp
43  CFIInstrInserter.cpp
44  CodeGen.cpp
45  CodeGenCommonISel.cpp
46  CodeGenPassBuilder.cpp
47  CodeGenPrepare.cpp
48  CommandFlags.cpp
49  CriticalAntiDepBreaker.cpp
50  DeadMachineInstructionElim.cpp
51  DetectDeadLanes.cpp
52  DFAPacketizer.cpp
53  DwarfEHPrepare.cpp
54  EarlyIfConversion.cpp
55  EdgeBundles.cpp
56  EHContGuardCatchret.cpp
57  ExecutionDomainFix.cpp
58  ExpandMemCmp.cpp
59  ExpandPostRAPseudos.cpp
60  ExpandReductions.cpp
61  ExpandVectorPredication.cpp
62  FaultMaps.cpp
63  FEntryInserter.cpp
64  FinalizeISel.cpp
65  FixupStatepointCallerSaved.cpp
66  FuncletLayout.cpp
67  GCMetadata.cpp
68  GCMetadataPrinter.cpp
69  GCRootLowering.cpp
70  GlobalMerge.cpp
71  HardwareLoops.cpp
72  IfConversion.cpp
73  ImplicitNullChecks.cpp
74  IndirectBrExpandPass.cpp
75  InlineSpiller.cpp
76  InterferenceCache.cpp
77  InterleavedAccessPass.cpp
78  InterleavedLoadCombinePass.cpp
79  IntrinsicLowering.cpp
80  JMCInstrumenter.cpp
81  LatencyPriorityQueue.cpp
82  LazyMachineBlockFrequencyInfo.cpp
83  LexicalScopes.cpp
84  LiveDebugVariables.cpp
85  LiveIntervals.cpp
86  LiveInterval.cpp
87  LiveIntervalUnion.cpp
88  LivePhysRegs.cpp
89  LiveRangeCalc.cpp
90  LiveIntervalCalc.cpp
91  LiveRangeEdit.cpp
92  LiveRangeShrink.cpp
93  LiveRegMatrix.cpp
94  LiveRegUnits.cpp
95  LiveStacks.cpp
96  LiveVariables.cpp
97  LLVMTargetMachine.cpp
98  LocalStackSlotAllocation.cpp
99  LoopTraversal.cpp
100  LowLevelType.cpp
101  LowerEmuTLS.cpp
102  MachineBasicBlock.cpp
103  MachineBlockFrequencyInfo.cpp
104  MachineBlockPlacement.cpp
105  MachineBranchProbabilityInfo.cpp
106  MachineCombiner.cpp
107  MachineCopyPropagation.cpp
108  MachineCSE.cpp
109  MachineCheckDebugify.cpp
110  MachineCycleAnalysis.cpp
111  MachineDebugify.cpp
112  MachineDominanceFrontier.cpp
113  MachineDominators.cpp
114  MachineFrameInfo.cpp
115  MachineFunction.cpp
116  MachineFunctionPass.cpp
117  MachineFunctionPrinterPass.cpp
118  MachineFunctionSplitter.cpp
119  MachineInstrBundle.cpp
120  MachineInstr.cpp
121  MachineLICM.cpp
122  MachineLoopInfo.cpp
123  MachineLoopUtils.cpp
124  MachineModuleInfo.cpp
125  MachineModuleInfoImpls.cpp
126  MachineModuleSlotTracker.cpp
127  MachineOperand.cpp
128  MachineOptimizationRemarkEmitter.cpp
129  MachineOutliner.cpp
130  MachinePassManager.cpp
131  MachinePipeliner.cpp
132  MachinePostDominators.cpp
133  MachineRegionInfo.cpp
134  MachineRegisterInfo.cpp
135  MachineScheduler.cpp
136  MachineSink.cpp
137  MachineSizeOpts.cpp
138  MachineSSAContext.cpp
139  MachineSSAUpdater.cpp
140  MachineStripDebug.cpp
141  MachineTraceMetrics.cpp
142  MachineVerifier.cpp
143  MIRFSDiscriminator.cpp
144  MIRSampleProfile.cpp
145  MIRYamlMapping.cpp
146  MLRegallocEvictAdvisor.cpp
147  ModuloSchedule.cpp
148  MultiHazardRecognizer.cpp
149  PatchableFunction.cpp
150  MBFIWrapper.cpp
151  MIRPrinter.cpp
152  MIRPrintingPass.cpp
153  MacroFusion.cpp
154  NonRelocatableStringpool.cpp
155  OptimizePHIs.cpp
156  ParallelCG.cpp
157  PeepholeOptimizer.cpp
158  PHIElimination.cpp
159  PHIEliminationUtils.cpp
160  PostRAHazardRecognizer.cpp
161  PostRASchedulerList.cpp
162  PreISelIntrinsicLowering.cpp
163  ProcessImplicitDefs.cpp
164  PrologEpilogInserter.cpp
165  PseudoProbeInserter.cpp
166  PseudoSourceValue.cpp
167  RDFGraph.cpp
168  RDFLiveness.cpp
169  RDFRegisters.cpp
170  ReachingDefAnalysis.cpp
171  RegAllocBase.cpp
172  RegAllocBasic.cpp
173  RegAllocEvictionAdvisor.cpp
174  RegAllocFast.cpp
175  RegAllocGreedy.cpp
176  RegAllocPBQP.cpp
177  RegAllocScore.cpp
178  RegisterClassInfo.cpp
179  RegisterCoalescer.cpp
180  RegisterPressure.cpp
181  RegisterScavenging.cpp
182  RemoveRedundantDebugValues.cpp
183  RenameIndependentSubregs.cpp
184  MachineStableHash.cpp
185  MIRVRegNamerUtils.cpp
186  MIRNamerPass.cpp
187  MIRCanonicalizerPass.cpp
188  RegisterUsageInfo.cpp
189  RegUsageInfoCollector.cpp
190  RegUsageInfoPropagate.cpp
191  ReplaceWithVeclib.cpp
192  ResetMachineFunctionPass.cpp
193  RegisterBank.cpp
194  RegisterBankInfo.cpp
195  SafeStack.cpp
196  SafeStackLayout.cpp
197  ScheduleDAG.cpp
198  ScheduleDAGInstrs.cpp
199  ScheduleDAGPrinter.cpp
200  ScoreboardHazardRecognizer.cpp
201  SelectOptimize.cpp
202  ShadowStackGCLowering.cpp
203  ShrinkWrap.cpp
204  SjLjEHPrepare.cpp
205  SlotIndexes.cpp
206  SpillPlacement.cpp
207  SplitKit.cpp
208  StackColoring.cpp
209  StackMapLivenessAnalysis.cpp
210  StackMaps.cpp
211  StackProtector.cpp
212  StackSlotColoring.cpp
213  SwiftErrorValueTracking.cpp
214  SwitchLoweringUtils.cpp
215  TailDuplication.cpp
216  TailDuplicator.cpp
217  TargetFrameLoweringImpl.cpp
218  TargetInstrInfo.cpp
219  TargetLoweringBase.cpp
220  TargetLoweringObjectFileImpl.cpp
221  TargetOptionsImpl.cpp
222  TargetPassConfig.cpp
223  TargetRegisterInfo.cpp
224  TargetSchedule.cpp
225  TargetSubtargetInfo.cpp
226  TypePromotion.cpp
227  TwoAddressInstructionPass.cpp
228  UnreachableBlockElim.cpp
229  ValueTypes.cpp
230  VLIWMachineScheduler.cpp
231  VirtRegMap.cpp
232  WasmEHPrepare.cpp
233  WinEHPrepare.cpp
234  XRayInstrumentation.cpp
235  ${GeneratedMLSources}
236
237  LiveDebugValues/LiveDebugValues.cpp
238  LiveDebugValues/VarLocBasedImpl.cpp
239  LiveDebugValues/InstrRefBasedImpl.cpp
240
241  ADDITIONAL_HEADER_DIRS
242  ${LLVM_MAIN_INCLUDE_DIR}/llvm/CodeGen
243  ${LLVM_MAIN_INCLUDE_DIR}/llvm/CodeGen/PBQP
244
245  LINK_LIBS ${LLVM_PTHREAD_LIB} ${MLLinkDeps}
246
247  DEPENDS
248  intrinsics_gen
249  ${MLDeps}
250
251  LINK_COMPONENTS
252  Analysis
253  BitReader
254  BitWriter
255  Core
256  MC
257  ProfileData
258  Scalar
259  Support
260  Target
261  TransformUtils
262  )
263
264add_subdirectory(SelectionDAG)
265add_subdirectory(AsmPrinter)
266add_subdirectory(MIRParser)
267add_subdirectory(GlobalISel)
268