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