1LOCAL_PATH:= $(call my-dir)
2include $(CLEAR_VARS)
3
4LOCAL_CLANG := true
5
6LOCAL_MODULE := libLLVM_swiftshader
7LOCAL_MODULE_TAGS := optional
8LOCAL_VENDOR_MODULE := true
9
10LOCAL_SRC_FILES := \
11	lib/Analysis/AliasAnalysis.cpp \
12	lib/Analysis/AliasSetTracker.cpp \
13	lib/Analysis/BasicAliasAnalysis.cpp \
14	lib/Analysis/BranchProbabilityInfo.cpp \
15	lib/Analysis/CaptureTracking.cpp \
16	lib/Analysis/ConstantFolding.cpp \
17	lib/Analysis/DebugInfo.cpp \
18	lib/Analysis/DIBuilder.cpp \
19	lib/Analysis/InstructionSimplify.cpp \
20	lib/Analysis/IVUsers.cpp \
21	lib/Analysis/Loads.cpp \
22	lib/Analysis/LoopInfo.cpp \
23	lib/Analysis/LoopPass.cpp \
24	lib/Analysis/MemoryBuiltins.cpp \
25	lib/Analysis/MemoryDependenceAnalysis.cpp \
26	lib/Analysis/NoAliasAnalysis.cpp \
27	lib/Analysis/PathNumbering.cpp \
28	lib/Analysis/PHITransAddr.cpp \
29	lib/Analysis/ProfileInfo.cpp \
30	lib/Analysis/ScalarEvolution.cpp \
31	lib/Analysis/ScalarEvolutionExpander.cpp \
32	lib/Analysis/ScalarEvolutionNormalization.cpp \
33	lib/Analysis/TypeBasedAliasAnalysis.cpp \
34	lib/Analysis/ValueTracking.cpp \
35
36LOCAL_SRC_FILES += \
37	lib/CodeGen/SelectionDAG/DAGCombiner.cpp \
38	lib/CodeGen/SelectionDAG/FastISel.cpp \
39	lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp \
40	lib/CodeGen/SelectionDAG/InstrEmitter.cpp \
41	lib/CodeGen/SelectionDAG/LegalizeDAG.cpp \
42	lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp \
43	lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp \
44	lib/CodeGen/SelectionDAG/LegalizeTypes.cpp \
45	lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp \
46	lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp \
47	lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp \
48	lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp \
49	lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp \
50	lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp \
51	lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp \
52	lib/CodeGen/SelectionDAG/SelectionDAG.cpp \
53	lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp \
54	lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp \
55	lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp \
56	lib/CodeGen/SelectionDAG/TargetLowering.cpp \
57	lib/CodeGen/SelectionDAG/TargetSelectionDAGInfo.cpp \
58	lib/CodeGen/AggressiveAntiDepBreaker.cpp \
59	lib/CodeGen/AllocationOrder.cpp \
60	lib/CodeGen/Analysis.cpp \
61	lib/CodeGen/BranchFolding.cpp \
62	lib/CodeGen/CalcSpillWeights.cpp \
63	lib/CodeGen/CallingConvLower.cpp \
64	lib/CodeGen/CodeGen.cpp \
65	lib/CodeGen/CodePlacementOpt.cpp \
66	lib/CodeGen/CriticalAntiDepBreaker.cpp \
67	lib/CodeGen/DeadMachineInstructionElim.cpp \
68	lib/CodeGen/DwarfEHPrepare.cpp \
69	lib/CodeGen/EdgeBundles.cpp \
70	lib/CodeGen/ELFCodeEmitter.cpp \
71	lib/CodeGen/ELFWriter.cpp \
72	lib/CodeGen/ExecutionDepsFix.cpp \
73	lib/CodeGen/ExpandISelPseudos.cpp \
74	lib/CodeGen/ExpandPostRAPseudos.cpp \
75	lib/CodeGen/GCMetadata.cpp \
76	lib/CodeGen/GCStrategy.cpp \
77	lib/CodeGen/IfConversion.cpp \
78	lib/CodeGen/InlineSpiller.cpp \
79	lib/CodeGen/InterferenceCache.cpp \
80	lib/CodeGen/IntrinsicLowering.cpp \
81	lib/CodeGen/LatencyPriorityQueue.cpp \
82	lib/CodeGen/LexicalScopes.cpp \
83	lib/CodeGen/LiveDebugVariables.cpp \
84	lib/CodeGen/LiveIntervalAnalysis.cpp \
85	lib/CodeGen/LiveInterval.cpp \
86	lib/CodeGen/LiveIntervalUnion.cpp \
87	lib/CodeGen/LiveRangeCalc.cpp \
88	lib/CodeGen/LiveRangeEdit.cpp \
89	lib/CodeGen/LiveStackAnalysis.cpp \
90	lib/CodeGen/LiveVariables.cpp \
91	lib/CodeGen/LLVMTargetMachine.cpp \
92	lib/CodeGen/LocalStackSlotAllocation.cpp \
93	lib/CodeGen/MachineBasicBlock.cpp \
94	lib/CodeGen/MachineBlockFrequencyInfo.cpp \
95	lib/CodeGen/MachineBranchProbabilityInfo.cpp \
96	lib/CodeGen/MachineCSE.cpp \
97	lib/CodeGen/MachineDominators.cpp \
98	lib/CodeGen/MachineFunctionAnalysis.cpp \
99	lib/CodeGen/MachineFunction.cpp \
100	lib/CodeGen/MachineFunctionPass.cpp \
101	lib/CodeGen/MachineFunctionPrinterPass.cpp \
102	lib/CodeGen/MachineInstr.cpp \
103	lib/CodeGen/MachineLICM.cpp \
104	lib/CodeGen/MachineLoopInfo.cpp \
105	lib/CodeGen/MachineLoopRanges.cpp \
106	lib/CodeGen/MachineModuleInfo.cpp \
107	lib/CodeGen/MachineModuleInfoImpls.cpp \
108	lib/CodeGen/MachinePassRegistry.cpp \
109	lib/CodeGen/MachineRegisterInfo.cpp \
110	lib/CodeGen/MachineSink.cpp \
111	lib/CodeGen/MachineSSAUpdater.cpp \
112	lib/CodeGen/MachineVerifier.cpp \
113	lib/CodeGen/ObjectCodeEmitter.cpp \
114	lib/CodeGen/OcamlGC.cpp \
115	lib/CodeGen/OptimizePHIs.cpp \
116	lib/CodeGen/Passes.cpp \
117	lib/CodeGen/PeepholeOptimizer.cpp \
118	lib/CodeGen/PHIElimination.cpp \
119	lib/CodeGen/PHIEliminationUtils.cpp \
120	lib/CodeGen/PostRASchedulerList.cpp \
121	lib/CodeGen/ProcessImplicitDefs.cpp \
122	lib/CodeGen/PrologEpilogInserter.cpp \
123	lib/CodeGen/PseudoSourceValue.cpp \
124	lib/CodeGen/RegAllocBasic.cpp \
125	lib/CodeGen/RegAllocFast.cpp \
126	lib/CodeGen/RegAllocGreedy.cpp \
127	lib/CodeGen/RegAllocLinearScan.cpp \
128	lib/CodeGen/RegAllocPBQP.cpp \
129	lib/CodeGen/RegisterClassInfo.cpp \
130	lib/CodeGen/RegisterCoalescer.cpp \
131	lib/CodeGen/RegisterScavenging.cpp \
132	lib/CodeGen/RenderMachineFunction.cpp \
133	lib/CodeGen/ScheduleDAG.cpp \
134	lib/CodeGen/ScheduleDAGEmit.cpp \
135	lib/CodeGen/ScheduleDAGInstrs.cpp \
136	lib/CodeGen/ScheduleDAGPrinter.cpp \
137	lib/CodeGen/ScoreboardHazardRecognizer.cpp \
138	lib/CodeGen/ShadowStackGC.cpp \
139	lib/CodeGen/ShrinkWrapping.cpp \
140	lib/CodeGen/SjLjEHPrepare.cpp \
141	lib/CodeGen/SlotIndexes.cpp \
142	lib/CodeGen/Spiller.cpp \
143	lib/CodeGen/SpillPlacement.cpp \
144	lib/CodeGen/SplitKit.cpp \
145	lib/CodeGen/Splitter.cpp \
146	lib/CodeGen/StackProtector.cpp \
147	lib/CodeGen/StackSlotColoring.cpp \
148	lib/CodeGen/StrongPHIElimination.cpp \
149	lib/CodeGen/TailDuplication.cpp \
150	lib/CodeGen/TargetInstrInfoImpl.cpp \
151	lib/CodeGen/TargetLoweringObjectFileImpl.cpp \
152	lib/CodeGen/TwoAddressInstructionPass.cpp \
153	lib/CodeGen/UnreachableBlockElim.cpp \
154	lib/CodeGen/VirtRegMap.cpp \
155	lib/CodeGen/VirtRegRewriter.cpp \
156
157LOCAL_SRC_FILES += \
158	lib/ExecutionEngine/JIT/Intercept.cpp \
159	lib/ExecutionEngine/JIT/JIT.cpp \
160	lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp \
161	lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp \
162	lib/ExecutionEngine/JIT/JITEmitter.cpp \
163	lib/ExecutionEngine/JIT/JITMemoryManager.cpp \
164	lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp \
165	lib/ExecutionEngine/ExecutionEngine.cpp \
166	lib/ExecutionEngine/TargetSelect.cpp \
167
168LOCAL_SRC_FILES += \
169	lib/MC/ELFObjectWriter.cpp \
170	lib/MC/MachObjectWriter.cpp \
171	lib/MC/MCAsmBackend.cpp \
172	lib/MC/MCAsmInfoCOFF.cpp \
173	lib/MC/MCAsmInfo.cpp \
174	lib/MC/MCAsmInfoDarwin.cpp \
175	lib/MC/MCAsmStreamer.cpp \
176	lib/MC/MCAssembler.cpp \
177	lib/MC/MCAtom.cpp \
178	lib/MC/MCCodeEmitter.cpp \
179	lib/MC/MCCodeGenInfo.cpp \
180	lib/MC/MCContext.cpp \
181	lib/MC/MCDisassembler.cpp \
182	lib/MC/MCDwarf.cpp \
183	lib/MC/MCELF.cpp \
184	lib/MC/MCELFObjectTargetWriter.cpp \
185	lib/MC/MCELFStreamer.cpp \
186	lib/MC/MCExpr.cpp \
187	lib/MC/MCInst.cpp \
188	lib/MC/MCInstPrinter.cpp \
189	lib/MC/MCInstrAnalysis.cpp \
190	lib/MC/MCLabel.cpp \
191	lib/MC/MCLoggingStreamer.cpp \
192	lib/MC/MCMachObjectTargetWriter.cpp \
193	lib/MC/MCMachOStreamer.cpp \
194	lib/MC/MCModule.cpp \
195	lib/MC/MCNullStreamer.cpp \
196	lib/MC/MCObjectFileInfo.cpp \
197	lib/MC/MCObjectStreamer.cpp \
198	lib/MC/MCObjectWriter.cpp \
199	lib/MC/MCPureStreamer.cpp \
200	lib/MC/MCSectionCOFF.cpp \
201	lib/MC/MCSection.cpp \
202	lib/MC/MCSectionELF.cpp \
203	lib/MC/MCSectionMachO.cpp \
204	lib/MC/MCStreamer.cpp \
205	lib/MC/MCSubtargetInfo.cpp \
206	lib/MC/MCSymbol.cpp \
207	lib/MC/MCTargetAsmLexer.cpp \
208	lib/MC/MCValue.cpp \
209	lib/MC/MCWin64EH.cpp \
210	lib/MC/SubtargetFeature.cpp \
211	lib/MC/WinCOFFObjectWriter.cpp \
212	lib/MC/WinCOFFStreamer.cpp \
213
214LOCAL_SRC_FILES += \
215	lib/Support/Allocator.cpp \
216	lib/Support/APFloat.cpp \
217	lib/Support/APInt.cpp \
218	lib/Support/APSInt.cpp \
219	lib/Support/Atomic.cpp \
220	lib/Support/BlockFrequency.cpp \
221	lib/Support/BranchProbability.cpp \
222	lib/Support/circular_raw_ostream.cpp \
223	lib/Support/CommandLine.cpp \
224	lib/Support/ConstantRange.cpp \
225	lib/Support/CrashRecoveryContext.cpp \
226	lib/Support/DAGDeltaAlgorithm.cpp \
227	lib/Support/DataExtractor.cpp \
228	lib/Support/Debug.cpp \
229	lib/Support/DeltaAlgorithm.cpp \
230	lib/Support/Disassembler.cpp \
231	lib/Support/Dwarf.cpp \
232	lib/Support/DynamicLibrary.cpp \
233	lib/Support/Errno.cpp \
234	lib/Support/ErrorHandling.cpp \
235	lib/Support/FileUtilities.cpp \
236	lib/Support/FoldingSet.cpp \
237	lib/Support/FormattedStream.cpp \
238	lib/Support/GraphWriter.cpp \
239	lib/Support/Host.cpp \
240	lib/Support/IncludeFile.cpp \
241	lib/Support/IntEqClasses.cpp \
242	lib/Support/IntervalMap.cpp \
243	lib/Support/IsInf.cpp \
244	lib/Support/IsNAN.cpp \
245	lib/Support/ManagedStatic.cpp \
246	lib/Support/MemoryBuffer.cpp \
247	lib/Support/Memory.cpp \
248	lib/Support/MemoryObject.cpp \
249	lib/Support/Mutex.cpp \
250	lib/Support/Path.cpp \
251	lib/Support/PathV2.cpp \
252	lib/Support/PluginLoader.cpp \
253	lib/Support/PrettyStackTrace.cpp \
254	lib/Support/Process.cpp \
255	lib/Support/Program.cpp \
256	lib/Support/raw_os_ostream.cpp \
257	lib/Support/raw_ostream.cpp \
258	lib/Support/Regex.cpp \
259	lib/Support/RWMutex.cpp \
260	lib/Support/SearchForAddressOfSpecialSymbol.cpp \
261	lib/Support/Signals.cpp \
262	lib/Support/SmallPtrSet.cpp \
263	lib/Support/SmallVector.cpp \
264	lib/Support/SourceMgr.cpp \
265	lib/Support/Statistic.cpp \
266	lib/Support/StringExtras.cpp \
267	lib/Support/StringMap.cpp \
268	lib/Support/StringPool.cpp \
269	lib/Support/StringRef.cpp \
270	lib/Support/system_error.cpp \
271	lib/Support/SystemUtils.cpp \
272	lib/Support/TargetRegistry.cpp \
273	lib/Support/Threading.cpp \
274	lib/Support/ThreadLocal.cpp \
275	lib/Support/Timer.cpp \
276	lib/Support/TimeValue.cpp \
277	lib/Support/ToolOutputFile.cpp \
278	lib/Support/Triple.cpp \
279	lib/Support/Twine.cpp \
280	lib/Support/Valgrind.cpp \
281
282LOCAL_SRC_FILES += \
283	lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp \
284	lib/Target/X86/InstPrinter/X86InstComments.cpp \
285	lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp \
286	lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp \
287	lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp \
288	lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp \
289	lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp \
290	lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp \
291	lib/Target/X86/TargetInfo/X86TargetInfo.cpp \
292	lib/Target/X86/Utils/X86ShuffleDecode.cpp \
293	lib/Target/X86/X86CodeEmitter.cpp \
294	lib/Target/X86/X86ELFWriterInfo.cpp \
295	lib/Target/X86/X86FastISel.cpp \
296	lib/Target/X86/X86FloatingPoint.cpp \
297	lib/Target/X86/X86FrameLowering.cpp \
298	lib/Target/X86/X86InstrInfo.cpp \
299	lib/Target/X86/X86ISelDAGToDAG.cpp \
300	lib/Target/X86/X86ISelLowering.cpp \
301	lib/Target/X86/X86JITInfo.cpp \
302	lib/Target/X86/X86RegisterInfo.cpp \
303	lib/Target/X86/X86SelectionDAGInfo.cpp \
304	lib/Target/X86/X86Subtarget.cpp \
305	lib/Target/X86/X86TargetMachine.cpp \
306	lib/Target/X86/X86TargetObjectFile.cpp \
307	lib/Target/X86/X86VZeroUpper.cpp \
308	lib/Target/Mangler.cpp \
309	lib/Target/Target.cpp \
310	lib/Target/TargetData.cpp \
311	lib/Target/TargetELFWriterInfo.cpp \
312	lib/Target/TargetFrameLowering.cpp \
313	lib/Target/TargetInstrInfo.cpp \
314	lib/Target/TargetLibraryInfo.cpp \
315	lib/Target/TargetLoweringObjectFile.cpp \
316	lib/Target/TargetMachine.cpp \
317	lib/Target/TargetRegisterInfo.cpp \
318	lib/Target/TargetSubtargetInfo.cpp \
319
320LOCAL_SRC_FILES += \
321	lib/Transforms/InstCombine/InstCombineAddSub.cpp \
322	lib/Transforms/InstCombine/InstCombineAndOrXor.cpp \
323	lib/Transforms/InstCombine/InstCombineCalls.cpp \
324	lib/Transforms/InstCombine/InstCombineCasts.cpp \
325	lib/Transforms/InstCombine/InstCombineCompares.cpp \
326	lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp \
327	lib/Transforms/InstCombine/InstCombineMulDivRem.cpp \
328	lib/Transforms/InstCombine/InstCombinePHI.cpp \
329	lib/Transforms/InstCombine/InstCombineSelect.cpp \
330	lib/Transforms/InstCombine/InstCombineShifts.cpp \
331	lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp \
332	lib/Transforms/InstCombine/InstCombineVectorOps.cpp \
333	lib/Transforms/InstCombine/InstructionCombining.cpp \
334	lib/Transforms/Scalar/ADCE.cpp \
335	lib/Transforms/Scalar/CodeGenPrepare.cpp \
336	lib/Transforms/Scalar/DeadStoreElimination.cpp \
337	lib/Transforms/Scalar/GVN.cpp \
338	lib/Transforms/Scalar/LICM.cpp \
339	lib/Transforms/Scalar/LoopStrengthReduce.cpp \
340	lib/Transforms/Scalar/Reassociate.cpp \
341	lib/Transforms/Scalar/Reg2Mem.cpp \
342	lib/Transforms/Scalar/ScalarReplAggregates.cpp \
343	lib/Transforms/Scalar/SCCP.cpp \
344	lib/Transforms/Scalar/SimplifyCFGPass.cpp \
345	lib/Transforms/Utils/AddrModeMatcher.cpp \
346	lib/Transforms/Utils/BasicBlockUtils.cpp \
347	lib/Transforms/Utils/BreakCriticalEdges.cpp \
348	lib/Transforms/Utils/BuildLibCalls.cpp \
349	lib/Transforms/Utils/DemoteRegToStack.cpp \
350	lib/Transforms/Utils/InstructionNamer.cpp \
351	lib/Transforms/Utils/LCSSA.cpp \
352	lib/Transforms/Utils/Local.cpp \
353	lib/Transforms/Utils/LoopSimplify.cpp \
354	lib/Transforms/Utils/LowerInvoke.cpp \
355	lib/Transforms/Utils/LowerSwitch.cpp \
356	lib/Transforms/Utils/Mem2Reg.cpp \
357	lib/Transforms/Utils/PromoteMemoryToRegister.cpp \
358	lib/Transforms/Utils/SimplifyCFG.cpp \
359	lib/Transforms/Utils/SSAUpdater.cpp \
360	lib/Transforms/Utils/UnifyFunctionExitNodes.cpp \
361
362LOCAL_SRC_FILES += \
363	lib/VMCore/AsmWriter.cpp \
364	lib/VMCore/Attributes.cpp \
365	lib/VMCore/AutoUpgrade.cpp \
366	lib/VMCore/BasicBlock.cpp \
367	lib/VMCore/ConstantFold.cpp \
368	lib/VMCore/Constants.cpp \
369	lib/VMCore/Core.cpp \
370	lib/VMCore/DebugInfoProbe.cpp \
371	lib/VMCore/DebugLoc.cpp \
372	lib/VMCore/Dominators.cpp \
373	lib/VMCore/Function.cpp \
374	lib/VMCore/GCOV.cpp \
375	lib/VMCore/Globals.cpp \
376	lib/VMCore/GVMaterializer.cpp \
377	lib/VMCore/InlineAsm.cpp \
378	lib/VMCore/Instruction.cpp \
379	lib/VMCore/Instructions.cpp \
380	lib/VMCore/IntrinsicInst.cpp \
381	lib/VMCore/IRBuilder.cpp \
382	lib/VMCore/LeakDetector.cpp \
383	lib/VMCore/LLVMContext.cpp \
384	lib/VMCore/LLVMContextImpl.cpp \
385	lib/VMCore/Metadata.cpp \
386	lib/VMCore/Module.cpp \
387	lib/VMCore/Pass.cpp \
388	lib/VMCore/PassManager.cpp \
389	lib/VMCore/PassRegistry.cpp \
390	lib/VMCore/PrintModulePass.cpp \
391	lib/VMCore/Type.cpp \
392	lib/VMCore/Use.cpp \
393	lib/VMCore/User.cpp \
394	lib/VMCore/Value.cpp \
395	lib/VMCore/ValueSymbolTable.cpp \
396	lib/VMCore/ValueTypes.cpp \
397	lib/VMCore/Verifier.cpp \
398
399
400LOCAL_CFLAGS += -DLOG_TAG=\"libLLVM_swiftshader\" \
401	-Wno-unused-parameter \
402	-Wno-implicit-exception-spec-mismatch \
403	-Wno-overloaded-virtual
404
405ifneq (16,${PLATFORM_SDK_VERSION})
406LOCAL_CFLAGS += -Xclang -fuse-init-array
407else
408LOCAL_CFLAGS += -D__STDC_INT64__
409endif
410
411LOCAL_CFLAGS += -fomit-frame-pointer -Os -ffunction-sections -fdata-sections
412LOCAL_CFLAGS += -fno-operator-names -msse2 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
413LOCAL_CFLAGS += -std=c++11
414LOCAL_CFLAGS += -DANDROID_PLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
415
416# Android's make system also uses NDEBUG, so we need to set/unset it forcefully
417# Uncomment for debug ON:
418# LOCAL_CFLAGS += -UNDEBUG -g -O0
419
420LOCAL_C_INCLUDES += \
421	bionic \
422	$(LOCAL_PATH)/include-android \
423	$(LOCAL_PATH)/include \
424	$(LOCAL_PATH)/lib/Target/X86 \
425
426# Marshmallow does not have stlport, but comes with libc++ by default
427ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23 && echo PreMarshmallow),PreMarshmallow)
428LOCAL_C_INCLUDES += external/stlport/stlport
429endif
430
431include $(BUILD_STATIC_LIBRARY)
432