Initial support for the CMake build system.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56419 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/CMakeLists.txt b/lib/Analysis/CMakeLists.txt
new file mode 100644
index 0000000..6dabaf9
--- /dev/null
+++ b/lib/Analysis/CMakeLists.txt
@@ -0,0 +1,29 @@
+add_llvm_library(LLVMAnalysis
+  AliasAnalysis.cpp
+  AliasAnalysisCounter.cpp
+  AliasAnalysisEvaluator.cpp
+  AliasDebugger.cpp
+  AliasSetTracker.cpp
+  Analysis.cpp
+  BasicAliasAnalysis.cpp
+  CFGPrinter.cpp
+  ConstantFolding.cpp
+  InstCount.cpp
+  Interval.cpp
+  IntervalPartition.cpp
+  LibCallAliasAnalysis.cpp
+  LibCallSemantics.cpp
+  LoopInfo.cpp
+  LoopPass.cpp
+  LoopVR.cpp
+  MemoryDependenceAnalysis.cpp
+  PostDominators.cpp
+  ProfileInfo.cpp
+  ProfileInfoLoader.cpp
+  ProfileInfoLoaderPass.cpp
+  ScalarEvolution.cpp
+  ScalarEvolutionExpander.cpp
+  SparsePropagation.cpp
+  Trace.cpp
+  ValueTracking.cpp
+  )
diff --git a/lib/Analysis/IPA/CMakeLists.txt b/lib/Analysis/IPA/CMakeLists.txt
new file mode 100644
index 0000000..1ebb0be
--- /dev/null
+++ b/lib/Analysis/IPA/CMakeLists.txt
@@ -0,0 +1,7 @@
+add_llvm_library(LLVMipa
+  Andersens.cpp
+  CallGraph.cpp
+  CallGraphSCCPass.cpp
+  FindUsedTypes.cpp
+  GlobalsModRef.cpp
+  )
diff --git a/lib/Archive/CMakeLists.txt b/lib/Archive/CMakeLists.txt
new file mode 100644
index 0000000..27698cb
--- /dev/null
+++ b/lib/Archive/CMakeLists.txt
@@ -0,0 +1,5 @@
+add_llvm_library(LLVMArchive
+  Archive.cpp
+  ArchiveReader.cpp
+  ArchiveWriter.cpp
+  )
\ No newline at end of file
diff --git a/lib/AsmParser/CMakeLists.txt b/lib/AsmParser/CMakeLists.txt
new file mode 100644
index 0000000..c12f414
--- /dev/null
+++ b/lib/AsmParser/CMakeLists.txt
@@ -0,0 +1,15 @@
+# AsmParser, with a Bison generated parser:
+include(FindBison)
+find_bison()
+bison_generator(
+  "llvmAsm"
+  "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.y"
+  "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.h"
+  "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.cpp"
+  )
+
+add_llvm_library(LLVMAsmParser
+  llvmAsmParser.cpp  # Generated from llvmAsmParser.y
+  LLLexer.cpp
+  Parser.cpp
+  )
diff --git a/lib/Bitcode/Reader/CMakeLists.txt b/lib/Bitcode/Reader/CMakeLists.txt
new file mode 100644
index 0000000..a19c79a
--- /dev/null
+++ b/lib/Bitcode/Reader/CMakeLists.txt
@@ -0,0 +1,7 @@
+add_llvm_library(LLVMBitReader
+  BitReader.cpp
+  BitcodeReader.cpp
+  Deserialize.cpp
+  DeserializeAPFloat.cpp
+  DeserializeAPInt.cpp
+  )
\ No newline at end of file
diff --git a/lib/Bitcode/Writer/CMakeLists.txt b/lib/Bitcode/Writer/CMakeLists.txt
new file mode 100644
index 0000000..ac5bb99
--- /dev/null
+++ b/lib/Bitcode/Writer/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_llvm_library(LLVMBitWriter
+  BitWriter.cpp
+  BitcodeWriter.cpp
+  BitcodeWriterPass.cpp
+  Serialize.cpp
+  SerializeAPFloat.cpp
+  SerializeAPInt.cpp
+  ValueEnumerator.cpp
+  )
diff --git a/lib/CodeGen/AsmPrinter/CMakeLists.txt b/lib/CodeGen/AsmPrinter/CMakeLists.txt
new file mode 100644
index 0000000..7ed5f97
--- /dev/null
+++ b/lib/CodeGen/AsmPrinter/CMakeLists.txt
@@ -0,0 +1,5 @@
+add_llvm_library(LLVMAsmPrinter
+  AsmPrinter.cpp
+  DwarfWriter.cpp
+  OcamlGCPrinter.cpp
+  )
diff --git a/lib/CodeGen/CMakeLists.txt b/lib/CodeGen/CMakeLists.txt
new file mode 100644
index 0000000..5d15746
--- /dev/null
+++ b/lib/CodeGen/CMakeLists.txt
@@ -0,0 +1,48 @@
+add_llvm_library(LLVMCodeGen
+  BranchFolding.cpp
+  DeadMachineInstructionElim.cpp
+  ELFWriter.cpp
+  GCMetadata.cpp
+  GCMetadataPrinter.cpp
+  GCStrategy.cpp
+  IfConversion.cpp
+  IntrinsicLowering.cpp
+  LLVMTargetMachine.cpp
+  LiveInterval.cpp
+  LiveIntervalAnalysis.cpp
+  LiveStackAnalysis.cpp
+  LiveVariables.cpp
+  LoopAligner.cpp
+  LowerSubregs.cpp
+  MachOWriter.cpp
+  MachineBasicBlock.cpp
+  MachineDominators.cpp
+  MachineFunction.cpp
+  MachineInstr.cpp
+  MachineLICM.cpp
+  MachineLoopInfo.cpp
+  MachineModuleInfo.cpp
+  MachinePassRegistry.cpp
+  MachineRegisterInfo.cpp
+  MachineSink.cpp
+  OcamlGC.cpp
+  PHIElimination.cpp
+  Passes.cpp
+  PostRASchedulerList.cpp
+  PrologEpilogInserter.cpp
+  PseudoSourceValue.cpp
+  RegAllocBigBlock.cpp
+  RegAllocLinearScan.cpp
+  RegAllocLocal.cpp
+  RegAllocSimple.cpp
+  RegisterCoalescer.cpp
+  RegisterScavenging.cpp
+  ShadowStackGC.cpp
+  SimpleRegisterCoalescing.cpp
+  StackSlotColoring.cpp
+  StrongPHIElimination.cpp
+  TargetInstrInfoImpl.cpp
+  TwoAddressInstructionPass.cpp
+  UnreachableBlockElim.cpp
+  VirtRegMap.cpp
+  )
diff --git a/lib/CodeGen/SelectionDAG/CMakeLists.txt b/lib/CodeGen/SelectionDAG/CMakeLists.txt
new file mode 100644
index 0000000..dad932b
--- /dev/null
+++ b/lib/CodeGen/SelectionDAG/CMakeLists.txt
@@ -0,0 +1,21 @@
+add_llvm_library(LLVMSelectionDAG
+  CallingConvLower.cpp
+  DAGCombiner.cpp
+  FastISel.cpp
+  LegalizeDAG.cpp
+  LegalizeFloatTypes.cpp
+  LegalizeIntegerTypes.cpp
+  LegalizeTypes.cpp
+  LegalizeTypesGeneric.cpp
+  LegalizeVectorTypes.cpp
+  ScheduleDAG.cpp
+  ScheduleDAGEmit.cpp
+  ScheduleDAGFast.cpp
+  ScheduleDAGList.cpp
+  ScheduleDAGRRList.cpp
+  SelectionDAGBuild.cpp
+  SelectionDAG.cpp
+  SelectionDAGISel.cpp
+  SelectionDAGPrinter.cpp
+  TargetLowering.cpp
+  )
diff --git a/lib/Debugger/CMakeLists.txt b/lib/Debugger/CMakeLists.txt
new file mode 100644
index 0000000..d2508cf
--- /dev/null
+++ b/lib/Debugger/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_llvm_library(LLVMDebugger
+  Debugger.cpp
+  ProgramInfo.cpp
+  RuntimeInfo.cpp
+  SourceFile.cpp
+  SourceLanguage-CFamily.cpp
+  SourceLanguage-CPlusPlus.cpp
+  SourceLanguage-Unknown.cpp
+  SourceLanguage.cpp
+  )
diff --git a/lib/ExecutionEngine/CMakeLists.txt b/lib/ExecutionEngine/CMakeLists.txt
new file mode 100644
index 0000000..0e118cc
--- /dev/null
+++ b/lib/ExecutionEngine/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_llvm_library(LLVMExecutionEngine
+  ExecutionEngine.cpp
+  ExecutionEngineBindings.cpp
+  )
diff --git a/lib/ExecutionEngine/Interpreter/CMakeLists.txt b/lib/ExecutionEngine/Interpreter/CMakeLists.txt
new file mode 100644
index 0000000..626e804
--- /dev/null
+++ b/lib/ExecutionEngine/Interpreter/CMakeLists.txt
@@ -0,0 +1,5 @@
+add_partially_linked_object(LLVMInterpreter
+  Execution.cpp
+  ExternalFunctions.cpp
+  Interpreter.cpp
+  )
diff --git a/lib/ExecutionEngine/JIT/CMakeLists.txt b/lib/ExecutionEngine/JIT/CMakeLists.txt
new file mode 100644
index 0000000..d7980d0
--- /dev/null
+++ b/lib/ExecutionEngine/JIT/CMakeLists.txt
@@ -0,0 +1,11 @@
+# TODO: Support other architectures. See Makefile.
+add_definitions(-DENABLE_X86_JIT)
+
+add_partially_linked_object(LLVMJIT
+  Intercept.cpp
+  JIT.cpp
+  JITDwarfEmitter.cpp
+  JITEmitter.cpp
+  JITMemoryManager.cpp
+  TargetSelect.cpp
+  )
diff --git a/lib/Linker/CMakeLists.txt b/lib/Linker/CMakeLists.txt
new file mode 100644
index 0000000..0b6d2f4
--- /dev/null
+++ b/lib/Linker/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_llvm_library(LLVMLinker
+  LinkArchives.cpp
+  LinkItems.cpp
+  LinkModules.cpp
+  Linker.cpp
+  )
diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt
new file mode 100644
index 0000000..e27a651
--- /dev/null
+++ b/lib/Support/CMakeLists.txt
@@ -0,0 +1,29 @@
+add_llvm_library(LLVMSupport
+  APFloat.cpp
+  APInt.cpp
+  APSInt.cpp
+  Allocator.cpp
+  Annotation.cpp
+  CommandLine.cpp
+  ConstantRange.cpp
+  Debug.cpp
+  Dwarf.cpp
+  FileUtilities.cpp
+  FoldingSet.cpp
+  GraphWriter.cpp
+  IsInf.cpp
+  IsNAN.cpp
+  ManagedStatic.cpp
+  MemoryBuffer.cpp
+  PluginLoader.cpp
+  SlowOperationInformer.cpp
+  SmallPtrSet.cpp
+  Statistic.cpp
+  Streams.cpp
+  StringExtras.cpp
+  StringMap.cpp
+  StringPool.cpp
+  SystemUtils.cpp
+  Timer.cpp
+  raw_ostream.cpp
+  )
diff --git a/lib/System/CMakeLists.txt b/lib/System/CMakeLists.txt
new file mode 100644
index 0000000..9ac663e
--- /dev/null
+++ b/lib/System/CMakeLists.txt
@@ -0,0 +1,13 @@
+add_llvm_library(LLVMSystem
+  Alarm.cpp
+  Disassembler.cpp
+  DynamicLibrary.cpp
+  IncludeFile.cpp
+  Memory.cpp
+  Mutex.cpp
+  Path.cpp
+  Process.cpp
+  Program.cpp
+  Signals.cpp
+  TimeValue.cpp
+  )
diff --git a/lib/Target/CMakeLists.txt b/lib/Target/CMakeLists.txt
new file mode 100644
index 0000000..1cf0a91
--- /dev/null
+++ b/lib/Target/CMakeLists.txt
@@ -0,0 +1,17 @@
+add_llvm_library(LLVMTarget
+  DarwinTargetAsmInfo.cpp
+  ELFTargetAsmInfo.cpp
+  SubtargetFeature.cpp
+  Target.cpp
+  TargetAsmInfo.cpp
+  TargetData.cpp
+  TargetFrameInfo.cpp
+  TargetInstrInfo.cpp
+  TargetMachOWriterInfo.cpp
+  TargetMachine.cpp
+  TargetMachineRegistry.cpp
+  TargetRegisterInfo.cpp
+  TargetSubtarget.cpp
+  )
+
+# TODO: Support other targets besides X86. See Makefile.
\ No newline at end of file
diff --git a/lib/Target/X86/AsmPrinter/CMakeLists.txt b/lib/Target/X86/AsmPrinter/CMakeLists.txt
new file mode 100644
index 0000000..ca4acb2
--- /dev/null
+++ b/lib/Target/X86/AsmPrinter/CMakeLists.txt
@@ -0,0 +1,7 @@
+include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
+
+add_llvm_library(LLVMX86AsmPrinter
+  X86ATTAsmPrinter.cpp
+  X86AsmPrinter.cpp
+  X86IntelAsmPrinter.cpp
+  )
diff --git a/lib/Target/X86/CMakeLists.txt b/lib/Target/X86/CMakeLists.txt
new file mode 100644
index 0000000..de8ff2c
--- /dev/null
+++ b/lib/Target/X86/CMakeLists.txt
@@ -0,0 +1,56 @@
+macro(x86tgen ofn)
+  add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
+    COMMAND tblgen ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_SOURCE_DIR}/lib/Target -I ${llvm_include_path} ${CMAKE_CURRENT_SOURCE_DIR}/X86.td -o ${ofn}
+    DEPENDS tblgen ${CMAKE_CURRENT_SOURCE_DIR}/X86.td
+    COMMENT "Building ${ofn}..."
+    )
+endmacro(x86tgen)
+
+x86tgen(X86GenRegisterInfo.h.inc -gen-register-desc-header)
+x86tgen(X86GenRegisterNames.inc -gen-register-enums)
+x86tgen(X86GenRegisterInfo.inc -gen-register-desc)
+x86tgen(X86GenInstrNames.inc -gen-instr-enums)
+x86tgen(X86GenInstrInfo.inc -gen-instr-desc)
+x86tgen(X86GenAsmWriter.inc -gen-asm-writer)
+x86tgen(X86GenAsmWriter1.inc -gen-asm-writer -asmwriternum=1)
+x86tgen(X86GenDAGISel.inc -gen-dag-isel)
+x86tgen(X86GenFastISel.inc -gen-fast-isel)
+x86tgen(X86GenCallingConv.inc -gen-callingconv)
+x86tgen(X86GenSubtarget.inc -gen-subtarget)
+
+add_custom_target(X86Table_gen echo Tablegenning
+  DEPENDS
+  ${llvm_builded_incs_dir}/Intrinsics.gen
+  ${CMAKE_CURRENT_BINARY_DIR}/X86GenRegisterInfo.h.inc
+  ${CMAKE_CURRENT_BINARY_DIR}/X86GenRegisterNames.inc
+  ${CMAKE_CURRENT_BINARY_DIR}/X86GenRegisterInfo.inc
+  ${CMAKE_CURRENT_BINARY_DIR}/X86GenInstrNames.inc
+  ${CMAKE_CURRENT_BINARY_DIR}/X86GenInstrInfo.inc
+  ${CMAKE_CURRENT_BINARY_DIR}/X86GenAsmWriter.inc
+  ${CMAKE_CURRENT_BINARY_DIR}/X86GenAsmWriter1.inc
+  ${CMAKE_CURRENT_BINARY_DIR}/X86GenDAGISel.inc
+  ${CMAKE_CURRENT_BINARY_DIR}/X86GenFastISel.inc
+  ${CMAKE_CURRENT_BINARY_DIR}/X86GenCallingConv.inc
+  ${CMAKE_CURRENT_BINARY_DIR}/X86GenSubtarget.inc
+  )
+
+include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
+
+add_partially_linked_object(LLVMX86CodeGen
+  X86CodeEmitter.cpp
+  X86ELFWriterInfo.cpp
+  X86FloatingPoint.cpp
+  X86ISelDAGToDAG.cpp
+  X86ISelLowering.cpp
+  X86InstrInfo.cpp
+  X86JITInfo.cpp
+  X86RegisterInfo.cpp
+  X86Subtarget.cpp
+  X86TargetAsmInfo.cpp
+  X86TargetMachine.cpp
+  X86FastISel.cpp
+  )
+
+add_dependencies(LLVMX86CodeGen
+  X86Table_gen
+)
diff --git a/lib/Transforms/Hello/CMakeLists.txt b/lib/Transforms/Hello/CMakeLists.txt
new file mode 100644
index 0000000..b80d15b
--- /dev/null
+++ b/lib/Transforms/Hello/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_llvm_library( LLVMHello
+  Hello.cpp
+  )
diff --git a/lib/Transforms/IPO/CMakeLists.txt b/lib/Transforms/IPO/CMakeLists.txt
new file mode 100644
index 0000000..c8d4ec6
--- /dev/null
+++ b/lib/Transforms/IPO/CMakeLists.txt
@@ -0,0 +1,24 @@
+add_llvm_library(LLVMipo
+  AddReadAttrs.cpp
+  ArgumentPromotion.cpp
+  ConstantMerge.cpp
+  DeadArgumentElimination.cpp
+  DeadTypeElimination.cpp
+  ExtractGV.cpp
+  GlobalDCE.cpp
+  GlobalOpt.cpp
+  IndMemRemoval.cpp
+  InlineAlways.cpp
+  Inliner.cpp
+  InlineSimple.cpp
+  Internalize.cpp
+  IPConstantPropagation.cpp
+  LoopExtractor.cpp
+  LowerSetJmp.cpp
+  PartialSpecialization.cpp
+  PruneEH.cpp
+  RaiseAllocations.cpp
+  StripDeadPrototypes.cpp
+  StripSymbols.cpp
+  StructRetPromotion.cpp
+  )
diff --git a/lib/Transforms/Instrumentation/CMakeLists.txt b/lib/Transforms/Instrumentation/CMakeLists.txt
new file mode 100644
index 0000000..d7c518d
--- /dev/null
+++ b/lib/Transforms/Instrumentation/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_llvm_library(LLVMInstrumentation
+  BlockProfiling.cpp
+  EdgeProfiling.cpp
+  ProfilingUtils.cpp
+  RSProfiling.cpp
+  )
diff --git a/lib/Transforms/Scalar/CMakeLists.txt b/lib/Transforms/Scalar/CMakeLists.txt
new file mode 100644
index 0000000..ff9193a
--- /dev/null
+++ b/lib/Transforms/Scalar/CMakeLists.txt
@@ -0,0 +1,32 @@
+add_llvm_library(LLVMScalarOpts
+  ADCE.cpp
+  BasicBlockPlacement.cpp
+  CodeGenPrepare.cpp
+  CondPropagate.cpp
+  ConstantProp.cpp
+  DCE.cpp
+  DeadStoreElimination.cpp
+  GVN.cpp
+  GVNPRE.cpp
+  IndVarSimplify.cpp
+  InstructionCombining.cpp
+  JumpThreading.cpp
+  LICM.cpp
+  LoopDeletion.cpp
+  LoopIndexSplit.cpp
+  LoopRotation.cpp
+  LoopStrengthReduce.cpp
+  LoopUnroll.cpp
+  LoopUnswitch.cpp
+  MemCpyOptimizer.cpp
+  PredicateSimplifier.cpp
+  Reassociate.cpp
+  Reg2Mem.cpp
+  SCCP.cpp
+  Scalar.cpp
+  ScalarReplAggregates.cpp
+  SimplifyCFGPass.cpp
+  SimplifyLibCalls.cpp
+  TailDuplication.cpp
+  TailRecursionElimination.cpp
+  )
diff --git a/lib/Transforms/Utils/CMakeLists.txt b/lib/Transforms/Utils/CMakeLists.txt
new file mode 100644
index 0000000..b678b2e
--- /dev/null
+++ b/lib/Transforms/Utils/CMakeLists.txt
@@ -0,0 +1,26 @@
+add_llvm_library(LLVMTransformUtils
+  BasicBlockUtils.cpp
+  BasicInliner.cpp
+  BreakCriticalEdges.cpp
+  CloneFunction.cpp
+  CloneLoop.cpp
+  CloneModule.cpp
+  CloneTrace.cpp
+  CodeExtractor.cpp
+  DemoteRegToStack.cpp
+  InlineCost.cpp
+  InlineFunction.cpp
+  LCSSA.cpp
+  Local.cpp
+  LoopSimplify.cpp
+  LowerAllocations.cpp
+  LowerInvoke.cpp
+  LowerSwitch.cpp
+  Mem2Reg.cpp
+  PromoteMemoryToRegister.cpp
+  SimplifyCFG.cpp
+  UnifyFunctionExitNodes.cpp
+  UnrollLoop.cpp
+  ValueMapper.cpp
+  InstructionNamer.cpp
+  )
diff --git a/lib/VMCore/CMakeLists.txt b/lib/VMCore/CMakeLists.txt
new file mode 100644
index 0000000..a7243c3
--- /dev/null
+++ b/lib/VMCore/CMakeLists.txt
@@ -0,0 +1,32 @@
+add_llvm_library(LLVMVMCore
+  AsmWriter.cpp
+  AutoUpgrade.cpp
+  BasicBlock.cpp
+  ConstantFold.cpp
+  Constants.cpp
+  Core.cpp
+  DebugInfoBuilder.cpp
+  Dominators.cpp
+  Function.cpp
+  Globals.cpp
+  InlineAsm.cpp
+  Instruction.cpp
+  Instructions.cpp
+  IntrinsicInst.cpp
+  LeakDetector.cpp
+  Mangler.cpp
+  Module.cpp
+  ModuleProvider.cpp
+  ParameterAttributes.cpp
+  Pass.cpp
+  PassManager.cpp
+  Type.cpp
+  TypeSymbolTable.cpp
+  Use.cpp
+  Value.cpp
+  ValueSymbolTable.cpp
+  ValueTypes.cpp
+  Verifier.cpp
+  )
+
+add_dependencies( LLVMVMCore ${llvm_builded_incs_dir}/Intrinsics.gen )
\ No newline at end of file