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