From 67a71b3184ce20a901e874d0ee25e01397dd87ef Mon Sep 17 00:00:00 2001
From: Roman Divacky
Date: Wed, 3 Mar 2010 17:27:15 +0000
Subject: [PATCH] Update LLVM to 97654.
---
CREDITS.TXT | 5 +
Makefile | 13 +-
Makefile.config.in | 26 +-
Makefile.rules | 81 +-
README.txt | 3 +
autoconf/ExportMap.map | 3 +
autoconf/configure.ac | 110 +-
autoconf/m4/cxx_flag_check.m4 | 2 +
autoconf/m4/huge_val.m4 | 2 +
bindings/ocaml/bitreader/bitreader_ocaml.c | 9 +-
bindings/ocaml/bitreader/llvm_bitreader.ml | 5 +-
bindings/ocaml/bitreader/llvm_bitreader.mli | 14 +-
.../executionengine/executionengine_ocaml.c | 43 +-
.../executionengine/llvm_executionengine.ml | 12 +-
.../executionengine/llvm_executionengine.mli | 56 +-
bindings/ocaml/llvm/llvm.ml | 135 +-
bindings/ocaml/llvm/llvm.mli | 347 +-
bindings/ocaml/llvm/llvm_ocaml.c | 294 +-
configure | 176 +-
docs/AdvancedGetElementPtr.html | 362 ++
docs/AliasAnalysis.html | 25 +-
docs/CodeGenerator.html | 8 +-
docs/CodingStandards.html | 6 +-
docs/CommandGuide/FileCheck.pod | 2 +-
docs/CommandGuide/bugpoint.pod | 6 +-
docs/CommandGuide/index.html | 4 +-
docs/CommandGuide/llc.pod | 4 +-
docs/CommandGuide/lli.pod | 6 +-
docs/CommandGuide/llvm-as.pod | 2 +-
docs/CommandGuide/llvm-bcanalyzer.pod | 2 +-
docs/CommandGuide/llvm-config.pod | 2 +-
docs/CommandGuide/llvm-dis.pod | 2 +-
docs/CommandGuide/llvm-extract.pod | 2 +-
docs/CommandGuide/llvm-link.pod | 2 +-
docs/CommandGuide/llvm-nm.pod | 2 +-
docs/CommandGuide/llvm-prof.pod | 2 +-
docs/CommandGuide/llvm-ranlib.pod | 4 +-
docs/CommandGuide/llvmc.pod | 4 +-
docs/CommandGuide/tblgen.pod | 2 +-
docs/CommandLine.html | 72 +-
docs/CompilerDriver.html | 8 +-
docs/DeveloperPolicy.html | 4 +-
docs/FAQ.html | 4 +-
docs/GetElementPtr.html | 407 +-
docs/GettingStarted.html | 16 +-
docs/LangRef.html | 93 +-
docs/MakefileGuide.html | 6 +-
docs/Packaging.html | 118 +
docs/Passes.html | 77 +-
docs/ProgrammersManual.html | 6 +-
docs/ReleaseNotes.html | 9 +-
docs/TableGenFundamentals.html | 5 +-
docs/TestingGuide.html | 27 +-
docs/WritingAnLLVMPass.html | 16 +-
docs/index.html | 6 +-
docs/tutorial/LangImpl3.html | 44 +-
docs/tutorial/LangImpl4.html | 28 +-
docs/tutorial/LangImpl5.html | 4 +-
docs/tutorial/LangImpl7.html | 20 +-
docs/tutorial/OCamlLangImpl3.html | 34 +-
docs/tutorial/OCamlLangImpl4.html | 28 +-
docs/tutorial/OCamlLangImpl5.html | 4 +-
docs/tutorial/OCamlLangImpl7.html | 20 +-
examples/Makefile | 7 +-
include/llvm-c/BitReader.h | 22 +-
include/llvm-c/Core.h | 80 +-
include/llvm-c/ExecutionEngine.h | 23 +
include/llvm/ADT/APFloat.h | 32 +-
include/llvm/ADT/APInt.h | 28 +
include/llvm/ADT/DeltaAlgorithm.h | 2 +-
include/llvm/ADT/ScopedHashTable.h | 69 +-
include/llvm/ADT/StringRef.h | 16 +-
include/llvm/ADT/Triple.h | 1 +
include/llvm/Analysis/DebugInfo.h | 11 +-
include/llvm/Analysis/Dominators.h | 48 +-
include/llvm/Analysis/IVUsers.h | 4 +-
include/llvm/Analysis/LoopInfo.h | 2 +-
.../llvm/Analysis/MemoryDependenceAnalysis.h | 7 +-
include/llvm/Analysis/PHITransAddr.h | 18 +-
include/llvm/Analysis/Passes.h | 7 -
include/llvm/Analysis/ScalarEvolution.h | 23 +-
include/llvm/Attributes.h | 12 +-
include/llvm/CodeGen/AsmPrinter.h | 7 +-
include/llvm/CodeGen/DAGISelHeader.h | 414 --
include/llvm/CodeGen/LiveInterval.h | 10 +
include/llvm/CodeGen/LiveIntervalAnalysis.h | 14 +-
include/llvm/CodeGen/LiveVariables.h | 11 +
include/llvm/CodeGen/MachineBasicBlock.h | 5 -
include/llvm/CodeGen/MachineInstr.h | 25 +-
include/llvm/CodeGen/MachineInstrBuilder.h | 2 +-
include/llvm/CodeGen/MachineOperand.h | 10 +-
include/llvm/CodeGen/Passes.h | 6 +-
include/llvm/CodeGen/SelectionDAG.h | 30 +-
include/llvm/CodeGen/SelectionDAGISel.h | 170 +-
include/llvm/CodeGen/SelectionDAGNodes.h | 17 +-
.../CodeGen/TargetLoweringObjectFileImpl.h | 5 +
include/llvm/CompilerDriver/Common.td | 7 +-
include/llvm/CompilerDriver/Main.inc | 2 +-
include/llvm/CompilerDriver/Tool.h | 9 +-
include/llvm/Constants.h | 11 +-
include/llvm/Instructions.h | 8 +-
include/llvm/LinkAllPasses.h | 1 -
include/llvm/MC/MCAssembler.h | 10 +-
include/llvm/MC/MCContext.h | 10 +-
include/llvm/MC/MCStreamer.h | 48 +-
include/llvm/Metadata.h | 7 +-
include/llvm/Pass.h | 2 +-
include/llvm/Support/CommandLine.h | 16 +-
include/llvm/Support/Regex.h | 13 +
include/llvm/Support/TargetFolder.h | 4 +-
include/llvm/System/Path.h | 2 +-
include/llvm/Target/Target.td | 7 -
include/llvm/Target/TargetAsmBackend.h | 35 +
include/llvm/Target/TargetAsmParser.h | 4 +-
include/llvm/Target/TargetInstrInfo.h | 28 +-
include/llvm/Target/TargetLowering.h | 2 +-
include/llvm/Target/TargetMachine.h | 20 +-
include/llvm/Target/TargetOpcodes.h | 4 +-
include/llvm/Target/TargetRegisterInfo.h | 11 +
include/llvm/Target/TargetRegistry.h | 247 +-
include/llvm/Target/TargetSelectionDAG.td | 3 +-
include/llvm/Transforms/Scalar.h | 2 +-
.../llvm/Transforms/Utils/BasicBlockUtils.h | 6 +
include/llvm/Type.h | 34 +-
lib/Analysis/AliasAnalysisCounter.cpp | 2 +-
lib/Analysis/AliasAnalysisEvaluator.cpp | 6 +-
lib/Analysis/BasicAliasAnalysis.cpp | 4 +-
lib/Analysis/CaptureTracking.cpp | 2 +-
lib/Analysis/ConstantFolding.cpp | 53 +-
lib/Analysis/DebugInfo.cpp | 9 +-
lib/Analysis/IPA/Andersens.cpp | 2868 ------------
lib/Analysis/IPA/CMakeLists.txt | 1 -
lib/Analysis/IPA/GlobalsModRef.cpp | 4 +-
lib/Analysis/IVUsers.cpp | 9 +-
lib/Analysis/InlineCost.cpp | 4 +-
lib/Analysis/InstructionSimplify.cpp | 26 +
lib/Analysis/MemoryDependenceAnalysis.cpp | 15 +-
lib/Analysis/PHITransAddr.cpp | 60 +-
lib/Analysis/PointerTracking.cpp | 2 +-
lib/Analysis/ScalarEvolution.cpp | 214 +-
lib/Analysis/ScalarEvolutionAliasAnalysis.cpp | 8 +-
lib/Analysis/ScalarEvolutionExpander.cpp | 296 +-
lib/Analysis/ValueTracking.cpp | 12 +-
lib/AsmParser/LLParser.cpp | 48 +-
lib/Bitcode/Reader/BitReader.cpp | 46 +-
lib/Bitcode/Reader/BitcodeReader.cpp | 13 +-
lib/Bitcode/Writer/ValueEnumerator.cpp | 5 +-
lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 42 +-
lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 17 +-
lib/CodeGen/AsmPrinter/DwarfException.cpp | 93 +-
lib/CodeGen/AsmPrinter/DwarfPrinter.cpp | 16 +-
lib/CodeGen/AsmPrinter/DwarfPrinter.h | 3 +-
lib/CodeGen/CMakeLists.txt | 1 +
lib/CodeGen/CalcSpillWeights.cpp | 5 +-
lib/CodeGen/CodePlacementOpt.cpp | 15 +-
lib/CodeGen/DeadMachineInstructionElim.cpp | 2 +-
lib/CodeGen/LLVMTargetMachine.cpp | 33 +-
lib/CodeGen/LiveIntervalAnalysis.cpp | 139 +-
lib/CodeGen/LiveVariables.cpp | 1 +
lib/CodeGen/MachineBasicBlock.cpp | 30 -
lib/CodeGen/MachineCSE.cpp | 208 +
lib/CodeGen/MachineFunction.cpp | 3 +
lib/CodeGen/MachineInstr.cpp | 33 +-
lib/CodeGen/MachineLICM.cpp | 45 +-
lib/CodeGen/MachineSink.cpp | 2 +-
lib/CodeGen/PBQP/HeuristicSolver.h | 4 +-
lib/CodeGen/PHIElimination.cpp | 10 +-
lib/CodeGen/PHIElimination.h | 43 -
lib/CodeGen/Passes.cpp | 2 +-
lib/CodeGen/PrologEpilogInserter.cpp | 7 +-
lib/CodeGen/RegAllocLinearScan.cpp | 4 -
lib/CodeGen/RegAllocPBQP.cpp | 6 +-
lib/CodeGen/ScheduleDAGInstrs.cpp | 4 +-
lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 73 +-
lib/CodeGen/SelectionDAG/FastISel.cpp | 28 +
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 11 +-
.../SelectionDAG/LegalizeIntegerTypes.cpp | 4 +-
lib/CodeGen/SelectionDAG/LegalizeTypes.cpp | 3 +-
.../SelectionDAG/ScheduleDAGSDNodes.cpp | 16 +-
lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 220 +-
.../SelectionDAG/SelectionDAGBuilder.cpp | 125 +-
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 1294 +++++-
lib/CodeGen/SelectionDAG/TargetLowering.cpp | 51 +-
lib/CodeGen/SimpleRegisterCoalescing.cpp | 23 +-
lib/CodeGen/TargetInstrInfoImpl.cpp | 36 +-
lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 34 +-
lib/CodeGen/TwoAddressInstructionPass.cpp | 4 +-
lib/CodeGen/VirtRegMap.cpp | 6 +-
lib/CodeGen/VirtRegRewriter.cpp | 2 +-
lib/CompilerDriver/CompilationGraph.cpp | 5 +-
lib/CompilerDriver/Main.cpp | 7 +-
lib/CompilerDriver/Tool.cpp | 21 +
lib/ExecutionEngine/ExecutionEngine.cpp | 4 +-
.../ExecutionEngineBindings.cpp | 77 +-
lib/ExecutionEngine/Interpreter/Execution.cpp | 10 +-
lib/ExecutionEngine/JIT/JIT.cpp | 6 +-
lib/Linker/LinkModules.cpp | 2 +-
lib/MC/CMakeLists.txt | 1 +
lib/MC/MCAsmStreamer.cpp | 10 +
lib/MC/MCAssembler.cpp | 82 +-
lib/MC/MCMachOStreamer.cpp | 21 +-
lib/MC/MCNullStreamer.cpp | 3 +
lib/MC/MCParser/AsmParser.cpp | 26 +-
lib/MC/TargetAsmBackend.cpp | 19 +
lib/Support/APFloat.cpp | 86 +-
lib/Support/APInt.cpp | 10 +-
lib/Support/CommandLine.cpp | 14 +-
lib/Support/FormattedStream.cpp | 2 -
lib/Support/GraphWriter.cpp | 2 +-
lib/Support/MemoryBuffer.cpp | 3 +-
lib/Support/Regex.cpp | 76 +
lib/Support/StringRef.cpp | 105 +-
lib/Support/Triple.cpp | 9 +
lib/Target/ARM/ARMBaseInstrInfo.cpp | 24 +-
lib/Target/ARM/ARMBaseInstrInfo.h | 4 +-
lib/Target/ARM/ARMBaseRegisterInfo.cpp | 107 +-
lib/Target/ARM/ARMBaseRegisterInfo.h | 1 +
lib/Target/ARM/ARMISelDAGToDAG.cpp | 7 -
lib/Target/ARM/ARMISelLowering.cpp | 111 +-
lib/Target/ARM/ARMISelLowering.h | 6 +-
lib/Target/ARM/ARMInstrFormats.td | 74 +-
lib/Target/ARM/ARMInstrInfo.td | 708 ++-
lib/Target/ARM/ARMInstrNEON.td | 803 ++--
lib/Target/ARM/ARMInstrThumb.td | 118 +-
lib/Target/ARM/ARMInstrThumb2.td | 675 ++-
lib/Target/ARM/ARMInstrVFP.td | 2 +-
lib/Target/ARM/ARMJITInfo.cpp | 4 +-
lib/Target/ARM/ARMLoadStoreOptimizer.cpp | 10 +-
lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp | 7 +
lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp | 6 +
lib/Target/ARM/AsmPrinter/ARMInstPrinter.h | 1 +
lib/Target/ARM/README.txt | 2 +
lib/Target/ARM/Thumb1RegisterInfo.cpp | 6 +-
lib/Target/Alpha/AlphaISelDAGToDAG.cpp | 15 +-
lib/Target/Alpha/AlphaInstrInfo.td | 6 +-
lib/Target/Blackfin/BlackfinISelDAGToDAG.cpp | 10 +-
lib/Target/CBackend/CBackend.cpp | 247 +-
lib/Target/CBackend/CTargetMachine.h | 3 +-
lib/Target/CellSPU/SPU64InstrInfo.td | 8 +-
lib/Target/CellSPU/SPUISelDAGToDAG.cpp | 129 +-
lib/Target/CellSPU/SPUISelLowering.cpp | 3 +-
lib/Target/CppBackend/CPPBackend.cpp | 35 +-
lib/Target/CppBackend/CPPTargetMachine.h | 3 +-
lib/Target/MBlaze/AsmPrinter/CMakeLists.txt | 9 +
.../MBlaze/AsmPrinter/MBlazeAsmPrinter.cpp | 302 ++
lib/Target/MBlaze/AsmPrinter/Makefile | 17 +
lib/Target/MBlaze/CMakeLists.txt | 27 +
lib/Target/MBlaze/MBlaze.h | 39 +
lib/Target/MBlaze/MBlaze.td | 85 +
lib/Target/MBlaze/MBlazeCallingConv.td | 41 +
lib/Target/MBlaze/MBlazeDelaySlotFiller.cpp | 75 +
lib/Target/MBlaze/MBlazeISelDAGToDAG.cpp | 339 ++
lib/Target/MBlaze/MBlazeISelLowering.cpp | 881 ++++
lib/Target/MBlaze/MBlazeISelLowering.h | 146 +
lib/Target/MBlaze/MBlazeInstrFPU.td | 223 +
lib/Target/MBlaze/MBlazeInstrFSL.td | 153 +
lib/Target/MBlaze/MBlazeInstrFormats.td | 246 +
lib/Target/MBlaze/MBlazeInstrInfo.cpp | 222 +
lib/Target/MBlaze/MBlazeInstrInfo.h | 242 +
lib/Target/MBlaze/MBlazeInstrInfo.td | 672 +++
lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp | 109 +
lib/Target/MBlaze/MBlazeIntrinsicInfo.h | 33 +
lib/Target/MBlaze/MBlazeIntrinsics.td | 137 +
lib/Target/MBlaze/MBlazeMCAsmInfo.cpp | 27 +
lib/Target/MBlaze/MBlazeMCAsmInfo.h | 30 +
lib/Target/MBlaze/MBlazeMachineFunction.h | 136 +
lib/Target/MBlaze/MBlazeRegisterInfo.cpp | 378 ++
lib/Target/MBlaze/MBlazeRegisterInfo.h | 90 +
lib/Target/MBlaze/MBlazeRegisterInfo.td | 186 +
lib/Target/MBlaze/MBlazeSchedule.td | 63 +
lib/Target/MBlaze/MBlazeSubtarget.cpp | 31 +
lib/Target/MBlaze/MBlazeSubtarget.h | 79 +
lib/Target/MBlaze/MBlazeTargetMachine.cpp | 66 +
lib/Target/MBlaze/MBlazeTargetMachine.h | 69 +
lib/Target/MBlaze/MBlazeTargetObjectFile.cpp | 88 +
lib/Target/MBlaze/MBlazeTargetObjectFile.h | 41 +
lib/Target/MBlaze/Makefile | 23 +
lib/Target/MBlaze/TargetInfo/CMakeLists.txt | 7 +
.../MBlaze/TargetInfo/MBlazeTargetInfo.cpp | 19 +
lib/Target/MBlaze/TargetInfo/Makefile | 15 +
lib/Target/MSIL/MSILWriter.cpp | 10 +-
lib/Target/MSP430/MSP430ISelDAGToDAG.cpp | 327 +-
lib/Target/MSP430/MSP430ISelLowering.cpp | 13 +-
lib/Target/MSP430/MSP430InstrInfo.td | 2 +-
lib/Target/Mips/MipsISelDAGToDAG.cpp | 35 +-
lib/Target/Mips/MipsInstrInfo.td | 9 +-
.../PIC16/AsmPrinter/PIC16AsmPrinter.cpp | 22 +-
lib/Target/PIC16/PIC16ABINames.h | 55 +
lib/Target/PIC16/PIC16DebugInfo.cpp | 2 +-
lib/Target/PIC16/PIC16ISelDAGToDAG.cpp | 10 -
lib/Target/PIC16/PIC16ISelDAGToDAG.h | 4 +-
lib/Target/PIC16/PIC16ISelLowering.cpp | 25 +-
lib/Target/PIC16/PIC16Passes/PIC16Cloner.cpp | 299 ++
lib/Target/PIC16/PIC16Passes/PIC16Cloner.h | 83 +
lib/Target/PIC16/PIC16Passes/PIC16Overlay.cpp | 26 +-
lib/Target/PIC16/PIC16Passes/PIC16Overlay.h | 23 +-
lib/Target/PowerPC/PPCHazardRecognizers.cpp | 2 +-
lib/Target/PowerPC/PPCISelDAGToDAG.cpp | 12 -
lib/Target/PowerPC/PPCISelLowering.cpp | 2 +-
lib/Target/PowerPC/PPCInstr64Bit.td | 11 +-
lib/Target/PowerPC/PPCInstrInfo.cpp | 50 +-
lib/Target/PowerPC/PPCInstrInfo.td | 28 +-
lib/Target/PowerPC/PPCRegisterInfo.td | 12 +-
lib/Target/PowerPC/README.txt | 2 +-
.../Sparc/AsmPrinter/SparcAsmPrinter.cpp | 46 +-
lib/Target/Sparc/README.txt | 1 +
lib/Target/Sparc/SparcISelDAGToDAG.cpp | 16 +-
lib/Target/Sparc/SparcMachineFunctionInfo.h | 2 +-
lib/Target/SystemZ/SystemZISelDAGToDAG.cpp | 56 +-
lib/Target/SystemZ/SystemZInstrFP.td | 2 +-
lib/Target/SystemZ/SystemZInstrInfo.td | 2 +-
.../SystemZ/SystemZMachineFunctionInfo.h | 3 +-
lib/Target/TargetData.cpp | 2 +-
lib/Target/TargetLoweringObjectFile.cpp | 2 +-
.../X86/AsmPrinter/X86ATTInstPrinter.cpp | 2 +-
lib/Target/X86/CMakeLists.txt | 1 +
lib/Target/X86/README-SSE.txt | 8 +-
lib/Target/X86/README.txt | 5 -
lib/Target/X86/X86.h | 11 +-
lib/Target/X86/X86AsmBackend.cpp | 34 +
lib/Target/X86/X86FastISel.cpp | 2 +
lib/Target/X86/X86ISelDAGToDAG.cpp | 383 +-
lib/Target/X86/X86ISelLowering.cpp | 286 +-
lib/Target/X86/X86ISelLowering.h | 2 +-
lib/Target/X86/X86Instr64bit.td | 36 +-
lib/Target/X86/X86InstrFPStack.td | 2 +-
lib/Target/X86/X86InstrInfo.cpp | 22 +-
lib/Target/X86/X86InstrInfo.td | 173 +-
lib/Target/X86/X86InstrMMX.td | 17 +-
lib/Target/X86/X86InstrSSE.td | 416 +-
lib/Target/X86/X86MCAsmInfo.cpp | 11 +-
lib/Target/X86/X86RegisterInfo.cpp | 10 +-
lib/Target/X86/X86RegisterInfo.h | 3 +-
lib/Target/X86/X86RegisterInfo.td | 63 +-
lib/Target/X86/X86Subtarget.h | 23 +-
lib/Target/X86/X86TargetMachine.cpp | 6 +
lib/Target/X86/X86TargetObjectFile.cpp | 64 -
lib/Target/X86/X86TargetObjectFile.h | 22 +-
.../XCore/AsmPrinter/XCoreAsmPrinter.cpp | 23 +
lib/Target/XCore/XCoreISelDAGToDAG.cpp | 17 +-
lib/Target/XCore/XCoreISelLowering.cpp | 43 +-
lib/Target/XCore/XCoreISelLowering.h | 10 +-
lib/Target/XCore/XCoreInstrInfo.cpp | 13 +
lib/Target/XCore/XCoreInstrInfo.td | 38 +-
lib/Transforms/Hello/Hello.cpp | 1 -
lib/Transforms/IPO/ArgumentPromotion.cpp | 6 +-
.../IPO/DeadArgumentElimination.cpp | 4 +-
lib/Transforms/IPO/FunctionAttrs.cpp | 8 +-
lib/Transforms/IPO/GlobalOpt.cpp | 174 +-
.../InstCombine/InstCombineAddSub.cpp | 6 +-
.../InstCombine/InstCombineAndOrXor.cpp | 10 +-
.../InstCombine/InstCombineCalls.cpp | 23 +-
.../InstCombine/InstCombineCasts.cpp | 22 +-
.../InstCombine/InstCombineCompares.cpp | 22 +-
.../InstCombineLoadStoreAlloca.cpp | 28 +-
.../InstCombine/InstCombineMulDivRem.cpp | 8 +-
lib/Transforms/InstCombine/InstCombinePHI.cpp | 4 +-
.../InstCombine/InstCombineSelect.cpp | 28 +-
.../InstCombineSimplifyDemanded.cpp | 4 +-
.../InstCombine/InstCombineVectorOps.cpp | 4 +-
.../InstCombine/InstructionCombining.cpp | 8 +-
lib/Transforms/Scalar/ABCD.cpp | 4 +-
lib/Transforms/Scalar/CodeGenPrepare.cpp | 4 +-
lib/Transforms/Scalar/GVN.cpp | 135 +-
lib/Transforms/Scalar/IndVarSimplify.cpp | 74 +-
lib/Transforms/Scalar/JumpThreading.cpp | 4 +-
lib/Transforms/Scalar/LICM.cpp | 4 +-
lib/Transforms/Scalar/LoopStrengthReduce.cpp | 364 +-
lib/Transforms/Scalar/LoopUnswitch.cpp | 2 +-
lib/Transforms/Scalar/Reassociate.cpp | 2 +-
lib/Transforms/Scalar/SCCP.cpp | 58 +-
.../Scalar/ScalarReplAggregates.cpp | 36 +-
lib/Transforms/Scalar/SimplifyLibCalls.cpp | 318 +-
lib/Transforms/Utils/AddrModeMatcher.cpp | 8 +-
lib/Transforms/Utils/BasicBlockUtils.cpp | 29 +-
lib/Transforms/Utils/Local.cpp | 4 +-
lib/Transforms/Utils/LoopSimplify.cpp | 48 +-
.../Utils/PromoteMemoryToRegister.cpp | 12 +-
lib/Transforms/Utils/SimplifyCFG.cpp | 10 +-
lib/VMCore/AsmWriter.cpp | 38 +-
lib/VMCore/Attributes.cpp | 2 +-
lib/VMCore/ConstantFold.cpp | 97 +-
lib/VMCore/Constants.cpp | 67 +-
lib/VMCore/Core.cpp | 196 +-
lib/VMCore/Function.cpp | 12 +-
lib/VMCore/InlineAsm.cpp | 2 +-
lib/VMCore/Instructions.cpp | 62 +-
lib/VMCore/LLVMContextImpl.h | 12 +-
lib/VMCore/Metadata.cpp | 7 +
lib/VMCore/PassManager.cpp | 25 +-
lib/VMCore/Type.cpp | 30 +-
lib/VMCore/Value.cpp | 12 +-
lib/VMCore/ValueTypes.cpp | 3 +-
lib/VMCore/Verifier.cpp | 48 +-
projects/sample/configure | 1 +
runtime/libprofile/Makefile | 2 +-
.../Andersens/2007-11-19-InlineAsm.ll | 8 -
.../Analysis/Andersens/2008-03-19-External.ll | 12 -
test/Analysis/Andersens/2008-04-07-Memcpy.ll | 14 -
.../Andersens/2008-12-27-BuiltinWrongType.ll | 19 -
test/Analysis/Andersens/basictest.ll | 28 -
test/Analysis/Andersens/dg.exp | 4 -
test/Analysis/Andersens/external.ll | 20 -
test/Analysis/Andersens/modreftest.ll | 15 -
test/Analysis/Andersens/modreftest2.ll | 14 -
test/Analysis/Andersens/trivialtest.ll | 3 -
test/Analysis/ScalarEvolution/trip-count10.ll | 76 +
test/Bindings/Ocaml/bitreader.ml | 16 +-
test/Bindings/Ocaml/executionengine.ml | 9 +-
test/Bindings/Ocaml/scalar_opts.ml | 5 +-
test/Bindings/Ocaml/vmcore.ml | 730 +--
test/CodeGen/ARM/call.ll | 14 +
test/CodeGen/ARM/neon_minmax.ll | 81 +
test/CodeGen/Alpha/add.ll | 3 +-
test/CodeGen/Blackfin/promote-logic.ll | 3 +-
test/CodeGen/Generic/GC/argpromotion.ll | 2 +-
test/CodeGen/Generic/debug-info.ll | 19 -
test/CodeGen/MBlaze/brind.ll | 73 +
test/CodeGen/MBlaze/callind.ll | 80 +
test/CodeGen/MBlaze/cc.ll | 315 ++
test/CodeGen/MBlaze/dg.exp | 5 +
test/CodeGen/MBlaze/div.ll | 75 +
test/CodeGen/MBlaze/fpu.ll | 66 +
test/CodeGen/MBlaze/fsl.ll | 323 ++
test/CodeGen/MBlaze/imm.ll | 70 +
test/CodeGen/MBlaze/jumptable.ll | 79 +
test/CodeGen/MBlaze/loop.ll | 47 +
test/CodeGen/MBlaze/mul.ll | 51 +
test/CodeGen/MBlaze/mul64.ll | 23 +
test/CodeGen/MBlaze/select.ll | 15 +
test/CodeGen/MBlaze/shift.ll | 117 +
test/CodeGen/MSP430/AddrMode-bis-rx.ll | 2 +-
test/CodeGen/MSP430/AddrMode-bis-xr.ll | 2 +-
test/CodeGen/MSP430/AddrMode-mov-rx.ll | 2 +-
test/CodeGen/MSP430/AddrMode-mov-xr.ll | 2 +-
test/CodeGen/MSP430/Inst16mm.ll | 17 +-
test/CodeGen/MSP430/Inst8rr.ll | 2 +-
test/CodeGen/MSP430/bit.ll | 2 +-
test/CodeGen/MSP430/setcc.ll | 44 +-
test/CodeGen/PIC16/C16-11.ll | 5 +-
test/CodeGen/PIC16/C16-15.ll | 2 +-
.../2007-04-30-InlineAsmEarlyClobber.ll | 4 +-
...009-08-17-inline-asm-addr-mode-breakage.ll | 6 +-
test/CodeGen/PowerPC/2010-02-26-FoldFloats.ll | 433 ++
test/CodeGen/PowerPC/Frames-alloca.ll | 2 +-
test/CodeGen/PowerPC/LargeAbsoluteAddr.ll | 6 +-
test/CodeGen/PowerPC/addc.ll | 25 +-
test/CodeGen/PowerPC/indirectbr.ll | 14 +-
test/CodeGen/PowerPC/lsr-postinc-pos.ll | 32 +
test/CodeGen/PowerPC/mem_update.ll | 54 +-
test/CodeGen/PowerPC/retaddr.ll | 2 +-
test/CodeGen/Thumb2/2010-02-24-BigStack.ll | 15 +
test/CodeGen/Thumb2/ldr-str-imm12.ll | 2 +-
test/CodeGen/X86/2005-01-17-CycleInDAG.ll | 2 +-
.../X86/2006-10-07-ScalarSSEMiscompile.ll | 2 +-
test/CodeGen/X86/2008-02-22-ReMatBug.ll | 2 +-
test/CodeGen/X86/2009-02-12-DebugInfoVLA.ll | 133 +-
test/CodeGen/X86/2009-07-16-LoadFoldingBug.ll | 102 -
test/CodeGen/X86/2009-09-07-CoalescerBug.ll | 3 +-
test/CodeGen/X86/2010-02-11-NonTemporal.ll | 22 +
.../X86/2010-02-19-TailCallRetAddrBug.ll | 55 +
test/CodeGen/X86/2010-02-23-DAGCombineBug.ll | 18 +
test/CodeGen/X86/2010-02-23-DIV8rDefinesAX.ll | 20 +
.../X86/2010-02-23-RematImplicitSubreg.ll | 49 +
.../X86/2010-02-23-SingleDefPhiJoin.ll | 146 +
test/CodeGen/X86/and-or-fold.ll | 28 +-
test/CodeGen/X86/code_placement_eh.ll | 45 +
test/CodeGen/X86/critical-edge-split.ll | 2 +-
test/CodeGen/X86/ins_subreg_coalesce-3.ll | 2 +-
test/CodeGen/X86/licm-symbol.ll | 39 +
test/CodeGen/X86/lsr-overflow.ll | 26 +
test/CodeGen/X86/lsr-reuse-trunc.ll | 15 +-
test/CodeGen/X86/lsr-reuse.ll | 58 +-
test/CodeGen/X86/lsr-wrap.ll | 37 +
test/CodeGen/X86/omit-label.ll | 57 -
test/CodeGen/X86/pr3495-2.ll | 6 +-
test/CodeGen/X86/ptrtoint-constexpr.ll | 2 +-
test/CodeGen/X86/sink-hoist.ll | 1 -
test/CodeGen/X86/sse-minmax.ll | 610 ++-
test/CodeGen/X86/sse3.ll | 7 +-
test/CodeGen/X86/stack-align.ll | 19 +-
test/CodeGen/X86/store_op_load_fold.ll | 2 +-
test/CodeGen/X86/store_op_load_fold2.ll | 24 +-
test/CodeGen/X86/trunc-to-bool.ll | 21 +-
test/CodeGen/X86/vec_cast.ll | 18 +-
test/CodeGen/X86/vec_insert.ll | 4 +-
test/CodeGen/X86/vec_shuffle-36.ll | 17 +-
test/CodeGen/X86/vec_ss_load_fold.ll | 37 +-
test/CodeGen/X86/xor-icmp.ll | 31 +
test/CodeGen/XCore/2010-02-25-LSR-Crash.ll | 26 +
test/CodeGen/XCore/switch.ll | 24 +
test/CodeGen/XCore/switch_long.ll | 132 +
test/DebugInfo/2009-02-27-licm.ll | 83 -
test/DebugInfo/2009-03-03-cheapdse.ll | 80 -
test/DebugInfo/2009-03-05-gvn.ll | 125 -
test/DebugInfo/deaddebuglabel.ll | 62 -
test/DebugInfo/funccall.ll | 147 -
test/DebugInfo/globalGetElementPtr.ll | 264 --
test/DebugInfo/inheritance.ll | 151 +
test/ExecutionEngine/2010-01-15-UndefValue.ll | 4 +-
test/FrontendC++/2010-02-08-NamespaceVar.cpp | 16 -
.../2010-02-17-DbgArtificialArg.cpp | 14 +
.../2003-12-14-ExternInlineSupport.c | 2 +-
test/FrontendC/2007-09-17-WeakRef.c | 2 +-
test/FrontendC/2010-02-15-DbgStaticVar.c | 13 +
test/FrontendC/2010-02-16-DbgVarScope.c | 30 +
test/FrontendC/2010-02-18-Dbg-VectorType.c | 9 +
test/FrontendObjC/2010-02-23-DbgInheritance.m | 9 +
test/LLVMC/AppendCmdHook.td | 8 +-
test/LLVMC/EnvParentheses.td | 4 +-
test/LLVMC/ExternOptions.td | 2 +-
test/LLVMC/ForwardAs.td | 4 +-
test/LLVMC/ForwardTransformedValue.td | 2 +-
test/LLVMC/ForwardValue.td | 6 +-
test/LLVMC/HookWithArguments.td | 4 +-
test/LLVMC/HookWithInFile.td | 2 +-
test/LLVMC/Init.td | 2 +-
test/LLVMC/MultiValuedOption.td | 2 +-
test/LLVMC/MultiplePluginPriorities.td | 4 +
test/LLVMC/NoActions.td | 2 +-
test/LLVMC/OneOrMore.td | 2 +-
test/LLVMC/OptionPreprocessor.td | 2 +-
test/MC/MachO/Darwin/optimal_nop.s | 156 +
test/Makefile | 4 +-
test/Makefile.tests | 6 +-
test/Other/2008-03-19-PassManager.ll | 58 -
test/Other/constant-fold-gep.ll | 54 +-
test/Transforms/GVN/2008-02-13-NewPHI.ll | 2 +-
test/Transforms/GVN/2009-03-05-dbg.ll | 66 -
test/Transforms/GVN/pre-load.ll | 27 +
test/Transforms/GlobalOpt/2009-03-03-dbg.ll | 54 -
test/Transforms/GlobalOpt/2009-03-05-dbg.ll | 119 +-
.../GlobalOpt/2010-02-25-MallocPromote.ll | 18 +
.../GlobalOpt/2010-02-26-MallocSROA.ll | 27 +
.../Transforms/GlobalOpt/ctor-list-opt-dbg.ll | 98 -
.../IndVarSimplify/2003-09-12-MultiplePred.ll | 2 +-
.../2003-12-10-RemoveInstrCrash.ll | 2 +-
.../IndVarSimplify/2003-12-15-Crash.ll | 4 +-
.../IndVarSimplify/2005-11-18-Crash.ll | 2 +-
.../IndVarSimplify/2006-12-10-BitCast.ll | 2 +-
.../IndVarSimplify/2009-05-24-useafterfree.ll | 4 +-
test/Transforms/IndVarSimplify/avoid-i0.ll | 4 +-
test/Transforms/IndVarSimplify/max-pointer.ll | 4 +-
...2009-01-19-fmod-constant-float-specials.ll | 3 +-
test/Transforms/InstCombine/bswap-fold.ll | 6 +
.../InstCombine/constant-fold-ptr-casts.ll | 18 -
test/Transforms/InstCombine/fcmp-select.ll | 53 +
test/Transforms/InstCombine/fcmp-special.ll | 155 +
test/Transforms/InstCombine/multi-use-or.ll | 2 +-
test/Transforms/InstCombine/objsize.ll | 42 +-
test/Transforms/InstCombine/ptr-int-cast.ll | 18 +-
test/Transforms/InstCombine/vec_narrow.ll | 2 +-
test/Transforms/InstCombine/xor2.ll | 8 +-
.../LoopDeletion/simplify-then-delete.ll | 65 +
.../SplitValue-2007-08-24-dbg.ll | 71 -
.../LoopStrengthReduce/nonlinear-postinc.ll | 44 +
test/Transforms/SCCP/retvalue-undef.ll | 32 +
.../ScalarRepl/2009-03-17-CleanUp.ll | 3961 -----------------
.../SimplifyCFG/2009-06-15-InvokeCrash.ll | 14 +-
test/Unit/lit.cfg | 9 +-
test/Unit/lit.site.cfg.in | 2 +
test/lib/llvm.exp | 15 +-
test/lit.cfg | 5 +-
test/site.exp.in | 2 -
tools/Makefile | 5 +
tools/bugpoint/CrashDebugger.cpp | 2 +-
tools/bugpoint/ExtractFunction.cpp | 2 +-
tools/llc/llc.cpp | 14 +-
tools/llvm-config/CMakeLists.txt | 2 -
tools/llvm-shlib/Makefile | 60 +
.../mcc16/plugins/PIC16Base/PIC16Base.td | 42 +-
tools/llvmc/plugins/Base/Base.td.in | 106 +-
tools/llvmc/plugins/Clang/Clang.td | 37 +-
tools/opt/opt.cpp | 3 +-
unittests/ADT/APFloatTest.cpp | 36 +
unittests/Makefile.unittest | 11 +-
unittests/Support/AllocatorTest.cpp | 2 +-
unittests/Support/RegexTest.cpp | 29 +
utils/GenLibDeps.pl | 2 +
utils/TableGen/CMakeLists.txt | 1 +
utils/TableGen/CodeGenDAGPatterns.cpp | 291 +-
utils/TableGen/CodeGenDAGPatterns.h | 18 +-
utils/TableGen/CodeGenInstruction.cpp | 3 +-
utils/TableGen/CodeGenInstruction.h | 1 -
utils/TableGen/DAGISelEmitter.cpp | 1918 +-------
utils/TableGen/DAGISelEmitter.h | 16 -
utils/TableGen/DAGISelMatcher.cpp | 329 +-
utils/TableGen/DAGISelMatcher.h | 1013 ++++-
utils/TableGen/DAGISelMatcherEmitter.cpp | 798 +++-
utils/TableGen/DAGISelMatcherGen.cpp | 686 ++-
utils/TableGen/DAGISelMatcherOpt.cpp | 435 ++
utils/TableGen/InstrEnumEmitter.cpp | 2 +-
utils/TableGen/LLVMCConfigurationEmitter.cpp | 370 +-
utils/TableGen/Record.h | 4 +
utils/TableGen/X86RecognizableInstr.cpp | 7 +-
utils/buildit/GNUmakefile | 4 +-
utils/git/find-rev | 50 +
.../ExampleTests/LLVM.InTree/test/site.exp | 2 -
.../LLVM.OutOfTree/obj/test/site.exp | 2 -
utils/llvm.grm | 1 +
utils/vim/llvm.vim | 5 +-
utils/vim/tablegen.vim | 2 +-
utils/vim/vimrc | 31 +-
603 files changed, 25327 insertions(+), 17318 deletions(-)
create mode 100644 autoconf/m4/cxx_flag_check.m4
create mode 100644 docs/AdvancedGetElementPtr.html
create mode 100644 docs/Packaging.html
delete mode 100644 include/llvm/CodeGen/DAGISelHeader.h
create mode 100644 include/llvm/Target/TargetAsmBackend.h
delete mode 100644 lib/Analysis/IPA/Andersens.cpp
create mode 100644 lib/CodeGen/MachineCSE.cpp
create mode 100644 lib/MC/TargetAsmBackend.cpp
create mode 100644 lib/Target/MBlaze/AsmPrinter/CMakeLists.txt
create mode 100644 lib/Target/MBlaze/AsmPrinter/MBlazeAsmPrinter.cpp
create mode 100644 lib/Target/MBlaze/AsmPrinter/Makefile
create mode 100644 lib/Target/MBlaze/CMakeLists.txt
create mode 100644 lib/Target/MBlaze/MBlaze.h
create mode 100644 lib/Target/MBlaze/MBlaze.td
create mode 100644 lib/Target/MBlaze/MBlazeCallingConv.td
create mode 100644 lib/Target/MBlaze/MBlazeDelaySlotFiller.cpp
create mode 100644 lib/Target/MBlaze/MBlazeISelDAGToDAG.cpp
create mode 100644 lib/Target/MBlaze/MBlazeISelLowering.cpp
create mode 100644 lib/Target/MBlaze/MBlazeISelLowering.h
create mode 100644 lib/Target/MBlaze/MBlazeInstrFPU.td
create mode 100644 lib/Target/MBlaze/MBlazeInstrFSL.td
create mode 100644 lib/Target/MBlaze/MBlazeInstrFormats.td
create mode 100644 lib/Target/MBlaze/MBlazeInstrInfo.cpp
create mode 100644 lib/Target/MBlaze/MBlazeInstrInfo.h
create mode 100644 lib/Target/MBlaze/MBlazeInstrInfo.td
create mode 100644 lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp
create mode 100644 lib/Target/MBlaze/MBlazeIntrinsicInfo.h
create mode 100644 lib/Target/MBlaze/MBlazeIntrinsics.td
create mode 100644 lib/Target/MBlaze/MBlazeMCAsmInfo.cpp
create mode 100644 lib/Target/MBlaze/MBlazeMCAsmInfo.h
create mode 100644 lib/Target/MBlaze/MBlazeMachineFunction.h
create mode 100644 lib/Target/MBlaze/MBlazeRegisterInfo.cpp
create mode 100644 lib/Target/MBlaze/MBlazeRegisterInfo.h
create mode 100644 lib/Target/MBlaze/MBlazeRegisterInfo.td
create mode 100644 lib/Target/MBlaze/MBlazeSchedule.td
create mode 100644 lib/Target/MBlaze/MBlazeSubtarget.cpp
create mode 100644 lib/Target/MBlaze/MBlazeSubtarget.h
create mode 100644 lib/Target/MBlaze/MBlazeTargetMachine.cpp
create mode 100644 lib/Target/MBlaze/MBlazeTargetMachine.h
create mode 100644 lib/Target/MBlaze/MBlazeTargetObjectFile.cpp
create mode 100644 lib/Target/MBlaze/MBlazeTargetObjectFile.h
create mode 100644 lib/Target/MBlaze/Makefile
create mode 100644 lib/Target/MBlaze/TargetInfo/CMakeLists.txt
create mode 100644 lib/Target/MBlaze/TargetInfo/MBlazeTargetInfo.cpp
create mode 100644 lib/Target/MBlaze/TargetInfo/Makefile
create mode 100644 lib/Target/PIC16/PIC16Passes/PIC16Cloner.cpp
create mode 100644 lib/Target/PIC16/PIC16Passes/PIC16Cloner.h
create mode 100644 lib/Target/X86/X86AsmBackend.cpp
delete mode 100644 test/Analysis/Andersens/2007-11-19-InlineAsm.ll
delete mode 100644 test/Analysis/Andersens/2008-03-19-External.ll
delete mode 100644 test/Analysis/Andersens/2008-04-07-Memcpy.ll
delete mode 100644 test/Analysis/Andersens/2008-12-27-BuiltinWrongType.ll
delete mode 100644 test/Analysis/Andersens/basictest.ll
delete mode 100644 test/Analysis/Andersens/dg.exp
delete mode 100644 test/Analysis/Andersens/external.ll
delete mode 100644 test/Analysis/Andersens/modreftest.ll
delete mode 100644 test/Analysis/Andersens/modreftest2.ll
delete mode 100644 test/Analysis/Andersens/trivialtest.ll
create mode 100644 test/Analysis/ScalarEvolution/trip-count10.ll
create mode 100644 test/CodeGen/ARM/neon_minmax.ll
delete mode 100644 test/CodeGen/Generic/debug-info.ll
create mode 100644 test/CodeGen/MBlaze/brind.ll
create mode 100644 test/CodeGen/MBlaze/callind.ll
create mode 100644 test/CodeGen/MBlaze/cc.ll
create mode 100644 test/CodeGen/MBlaze/dg.exp
create mode 100644 test/CodeGen/MBlaze/div.ll
create mode 100644 test/CodeGen/MBlaze/fpu.ll
create mode 100644 test/CodeGen/MBlaze/fsl.ll
create mode 100644 test/CodeGen/MBlaze/imm.ll
create mode 100644 test/CodeGen/MBlaze/jumptable.ll
create mode 100644 test/CodeGen/MBlaze/loop.ll
create mode 100644 test/CodeGen/MBlaze/mul.ll
create mode 100644 test/CodeGen/MBlaze/mul64.ll
create mode 100644 test/CodeGen/MBlaze/select.ll
create mode 100644 test/CodeGen/MBlaze/shift.ll
create mode 100644 test/CodeGen/PowerPC/2010-02-26-FoldFloats.ll
create mode 100644 test/CodeGen/PowerPC/lsr-postinc-pos.ll
create mode 100644 test/CodeGen/Thumb2/2010-02-24-BigStack.ll
delete mode 100644 test/CodeGen/X86/2009-07-16-LoadFoldingBug.ll
create mode 100644 test/CodeGen/X86/2010-02-11-NonTemporal.ll
create mode 100644 test/CodeGen/X86/2010-02-19-TailCallRetAddrBug.ll
create mode 100644 test/CodeGen/X86/2010-02-23-DAGCombineBug.ll
create mode 100644 test/CodeGen/X86/2010-02-23-DIV8rDefinesAX.ll
create mode 100644 test/CodeGen/X86/2010-02-23-RematImplicitSubreg.ll
create mode 100644 test/CodeGen/X86/2010-02-23-SingleDefPhiJoin.ll
create mode 100644 test/CodeGen/X86/code_placement_eh.ll
create mode 100644 test/CodeGen/X86/licm-symbol.ll
create mode 100644 test/CodeGen/X86/lsr-overflow.ll
create mode 100644 test/CodeGen/X86/lsr-wrap.ll
delete mode 100644 test/CodeGen/X86/omit-label.ll
create mode 100644 test/CodeGen/XCore/2010-02-25-LSR-Crash.ll
create mode 100644 test/CodeGen/XCore/switch.ll
create mode 100644 test/CodeGen/XCore/switch_long.ll
delete mode 100644 test/DebugInfo/2009-02-27-licm.ll
delete mode 100644 test/DebugInfo/2009-03-03-cheapdse.ll
delete mode 100644 test/DebugInfo/2009-03-05-gvn.ll
delete mode 100644 test/DebugInfo/deaddebuglabel.ll
delete mode 100644 test/DebugInfo/funccall.ll
delete mode 100644 test/DebugInfo/globalGetElementPtr.ll
create mode 100644 test/DebugInfo/inheritance.ll
delete mode 100644 test/FrontendC++/2010-02-08-NamespaceVar.cpp
create mode 100644 test/FrontendC++/2010-02-17-DbgArtificialArg.cpp
create mode 100644 test/FrontendC/2010-02-15-DbgStaticVar.c
create mode 100644 test/FrontendC/2010-02-16-DbgVarScope.c
create mode 100644 test/FrontendC/2010-02-18-Dbg-VectorType.c
create mode 100644 test/FrontendObjC/2010-02-23-DbgInheritance.m
create mode 100644 test/MC/MachO/Darwin/optimal_nop.s
delete mode 100644 test/Other/2008-03-19-PassManager.ll
delete mode 100644 test/Transforms/GVN/2009-03-05-dbg.ll
delete mode 100644 test/Transforms/GlobalOpt/2009-03-03-dbg.ll
create mode 100644 test/Transforms/GlobalOpt/2010-02-25-MallocPromote.ll
create mode 100644 test/Transforms/GlobalOpt/2010-02-26-MallocSROA.ll
delete mode 100644 test/Transforms/GlobalOpt/ctor-list-opt-dbg.ll
delete mode 100644 test/Transforms/InstCombine/constant-fold-ptr-casts.ll
create mode 100644 test/Transforms/InstCombine/fcmp-select.ll
create mode 100644 test/Transforms/InstCombine/fcmp-special.ll
create mode 100644 test/Transforms/LoopDeletion/simplify-then-delete.ll
delete mode 100644 test/Transforms/LoopIndexSplit/SplitValue-2007-08-24-dbg.ll
create mode 100644 test/Transforms/LoopStrengthReduce/nonlinear-postinc.ll
create mode 100644 test/Transforms/SCCP/retvalue-undef.ll
delete mode 100644 test/Transforms/ScalarRepl/2009-03-17-CleanUp.ll
create mode 100644 tools/llvm-shlib/Makefile
create mode 100644 utils/TableGen/DAGISelMatcherOpt.cpp
create mode 100755 utils/git/find-rev
diff --git a/CREDITS.TXT b/CREDITS.TXT
index f6467abfc03..e58b85fdbd9 100644
--- a/CREDITS.TXT
+++ b/CREDITS.TXT
@@ -335,3 +335,8 @@ D: Bunches of stuff
N: Bob Wilson
E: bob.wilson@acm.org
D: Advanced SIMD (NEON) support in the ARM backend
+
+N: Wesley Peck
+E: peckw@wesleypeck.com
+W: http://wesleypeck.com/
+D: MicroBlaze backend
diff --git a/Makefile b/Makefile
index 319bdcd0fba..f5a9b336e37 100644
--- a/Makefile
+++ b/Makefile
@@ -30,8 +30,8 @@ ifeq ($(BUILD_DIRS_ONLY),1)
DIRS := lib/System lib/Support utils
OPTIONAL_DIRS :=
else
- DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \
- tools runtime docs unittests
+ DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-shlib \
+ tools/llvm-config tools runtime docs unittests
OPTIONAL_DIRS := projects bindings
endif
@@ -43,12 +43,9 @@ EXTRA_DIST := test unittests llvm.spec include win32 Xcode
include $(LEVEL)/Makefile.config
-# llvm-gcc4 doesn't need runtime libs. llvm-gcc4 is the only supported one.
-# FIXME: Remove runtime entirely once we have an understanding of where
-# libprofile etc should go.
-#ifeq ($(LLVMGCC_MAJVERS),4)
-# DIRS := $(filter-out runtime, $(DIRS))
-#endif
+ifneq ($(ENABLE_SHARED),1)
+ DIRS := $(filter-out tools/llvm-shlib, $(DIRS))
+endif
ifeq ($(MAKECMDGOALS),libs-only)
DIRS := $(filter-out tools runtime docs, $(DIRS))
diff --git a/Makefile.config.in b/Makefile.config.in
index 2cc69dcf4cf..aca21e5b7d1 100644
--- a/Makefile.config.in
+++ b/Makefile.config.in
@@ -183,25 +183,21 @@ TARGETS_TO_BUILD=@TARGETS_TO_BUILD@
# want to override the value set by configure.
LLVMGCCDIR := @LLVMGCCDIR@
-# Determine the target for which LLVM should generate code.
-ifeq (@LLVMGCC_MAJVERS@,3)
-LLVMGCCARCH := @target@/3.4-llvm
-else
-LLVMGCCARCH := @target@/@LLVMGCC_VERSION@
-endif
-
-# Determine the path where the library executables are
-LLVMGCCLIBEXEC := @LLVMGCCLIBEXEC@
-
# Full pathnames of LLVM C/C++ front-end 'cc1' and 'cc1plus' binaries:
LLVMGCC := @LLVMGCC@
LLVMGXX := @LLVMGXX@
LLVMCC1 := @LLVMCC1@
LLVMCC1PLUS := @LLVMCC1PLUS@
-LLVMGCC_VERSION := @LLVMGCC_VERSION@
-LLVMGCC_MAJVERS := @LLVMGCC_MAJVERS@
LLVMGCC_LANGS := @LLVMGCC_LANGS@
+# Information on Clang, if configured.
+CLANGPATH := @CLANGPATH@
+CLANGXXPATH := @CLANGXXPATH@
+ENABLE_BUILT_CLANG := @ENABLE_BUILT_CLANG@
+
+# The LLVM capable compiler to use.
+LLVMCC_OPTION := @LLVMCC_OPTION@
+
# Path to directory where object files should be stored during a build.
# Set OBJ_ROOT to "." if you do not want to use a separate place for
# object files.
@@ -266,6 +262,9 @@ ENABLE_THREADS := @ENABLE_THREADS@
# Do we want to build with position independent code?
ENABLE_PIC := @ENABLE_PIC@
+# Do we want to build a shared library and link the tools with it?
+ENABLE_SHARED := @ENABLE_SHARED@
+
# Use -fvisibility-inlines-hidden?
ENABLE_VISIBILITY_INLINES_HIDDEN := @ENABLE_VISIBILITY_INLINES_HIDDEN@
@@ -276,6 +275,9 @@ ENABLE_VISIBILITY_INLINES_HIDDEN := @ENABLE_VISIBILITY_INLINES_HIDDEN@
# Enable JIT for this platform
TARGET_HAS_JIT = @TARGET_HAS_JIT@
+# Environment variable to set to change the runtime shared library search path.
+SHLIBPATH_VAR = @SHLIBPATH_VAR@
+
# Shared library extension for host platform.
SHLIBEXT = @SHLIBEXT@
diff --git a/Makefile.rules b/Makefile.rules
index 761cc812bee..b5b35256b79 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -493,7 +493,27 @@ ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
-CFERuntimeLibDir := $(LLVMGCCDIR)/lib
+
+#--------------------------------------------------------------------
+# LLVM Capable Compiler
+#--------------------------------------------------------------------
+
+ifeq ($(LLVMCC_OPTION),llvm-gcc)
+ LLVMCC := $(LLVMGCC)
+ LLVMCXX := $(LLVMGXX)
+else
+ ifeq ($(LLVMCC_OPTION),clang)
+ ifneq ($(CLANGPATH),)
+ LLVMCC := $(CLANGPATH)
+ LLVMCXX := $(CLANGXXPATH)
+ else
+ ifeq ($(ENABLE_BUILT_CLANG),1)
+ LLVMCC := $(LLVMToolDir)/clang
+ LLVMCXX := $(LLVMToolDir)/clang++
+ endif
+ endif
+ endif
+endif
#--------------------------------------------------------------------
# Full Paths To Compiled Tools and Utilities
@@ -529,16 +549,6 @@ endif
ifndef LBUGPOINT
LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
endif
-ifndef LUPGRADE
-LUPGRADE := $(LLVMToolDir)/llvm-upgrade$(EXEEXT)
-endif
-ifeq ($(LLVMGCC_MAJVERS),3)
-LLVMGCCWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGCC)
-LLVMGXXWITHPATH := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGXX)
-else
-LLVMGCCWITHPATH := $(LLVMGCC)
-LLVMGXXWITHPATH := $(LLVMGXX)
-endif
#--------------------------------------------------------------------
# Adjust to user's request
@@ -613,11 +623,12 @@ endif
ifneq ($(HOST_OS),Darwin)
ifneq ($(DARWIN_MAJVERS),4)
ifdef TOOLNAME
-ifdef EXAMPLE_TOOL
- LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(RDYNAMIC)
-else
- LD.Flags += $(RPATH) -Wl,$(ToolDir) $(RDYNAMIC)
-endif
+ LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
+ ifdef EXAMPLE_TOOL
+ LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(RDYNAMIC)
+ else
+ LD.Flags += $(RPATH) -Wl,$(ToolDir) $(RDYNAMIC)
+ endif
endif
endif
endif
@@ -710,14 +721,12 @@ else
$(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip)
endif
-BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(C.Flags) $(CFLAGS) \
- $(CPPFLAGS) \
+BCCompile.C = $(LLVMCC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
$(TargetCommonOpts) $(CompileCommonOpts)
Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
$(TargetCommonOpts) $(CompileCommonOpts) -E
-BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
- $(CPPFLAGS) \
+BCCompile.CXX = $(LLVMCXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
$(TargetCommonOpts) $(CompileCommonOpts)
ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
@@ -952,11 +961,16 @@ $(LLVM_CONFIG):
$(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
+ifeq ($(ENABLE_SHARED), 1)
+LLVMLibsOptions += -lLLVM-$(LLVMVersion)
+LLVMLibsPaths += $(LibDir)/libLLVM-$(LLVMVersion)$(SHLIBEXT)
+else
LLVMLibsOptions += $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS))
LLVMLibsPaths += $(LLVM_CONFIG) \
$(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS))
endif
endif
+endif
###############################################################################
# Library Build Rules: Four ways to build a library
@@ -971,12 +985,12 @@ endif
#---------------------------------------------------------
ifdef MODULE_NAME
-ifeq ($(strip $(LLVMGCC)),)
-$(warning Modules require llvm-gcc but no llvm-gcc is available ****)
+ifeq ($(strip $(LLVMCC)),)
+$(warning Modules require LLVM capable compiler but none is available ****)
else
Module := $(LibDir)/$(MODULE_NAME).bc
-LinkModule := $(LLVMLD) -L$(CFERuntimeLibDir) -r
+LinkModule := $(LLVMLD) -r
ifdef EXPORTED_SYMBOL_FILE
@@ -1097,15 +1111,14 @@ endif
# targets for building them.
#---------------------------------------------------------
ifdef BYTECODE_LIBRARY
-ifeq ($(strip $(LLVMGCC)),)
-$(warning Bytecode libraries require llvm-gcc which could not be found ****)
+ifeq ($(strip $(LLVMCC)),)
+$(warning Bytecode libraries require LLVM capable compiler but none is available ****)
else
all-local:: $(LibName.BCA)
ifdef EXPORTED_SYMBOL_FILE
-BCLinkLib = $(LLVMLD) -L$(CFERuntimeLibDir) \
- -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
+BCLinkLib = $(LLVMLD) -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
$(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLD) \
$(LLVMToolDir)/llvm-ar
@@ -1162,11 +1175,13 @@ endif
# If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
# building an archive.
#---------------------------------------------------------
+ifndef NO_BUILD_ARCHIVE
ifndef BUILD_ARCHIVE
ifndef LOADABLE_MODULE
BUILD_ARCHIVE = 1
endif
endif
+endif
#---------------------------------------------------------
# Archive Library Targets:
@@ -1382,19 +1397,19 @@ BC_DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.bc.d.tmp" \
BC_DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.bc.d.tmp" "$(ObjDir)/$*.bc.d"; \
else $(RM) "$(ObjDir)/$*.bc.d.tmp"; exit 1; fi
-$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
+$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
$(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
$< -o $(ObjDir)/$*.ll -S -emit-llvm ; \
$(BC_DEPEND_MOVEFILE)
-$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
+$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
$(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
$< -o $(ObjDir)/$*.ll -S -emit-llvm ; \
$(BC_DEPEND_MOVEFILE)
-$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGCC)
+$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
$(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
$< -o $(ObjDir)/$*.ll -S -emit-llvm ; \
@@ -1415,15 +1430,15 @@ $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
$(Compile.C) $< -o $@
-$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
+$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
$(BCCompile.CXX) $< -o $@ -S -emit-llvm
-$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
+$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
$(BCCompile.CXX) $< -o $@ -S -emit-llvm
-$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGCC)
+$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
$(BCCompile.C) $< -o $@ -S -emit-llvm
diff --git a/README.txt b/README.txt
index 7388752fb1c..2ebe271b8e5 100644
--- a/README.txt
+++ b/README.txt
@@ -10,3 +10,6 @@ the license agreement found in LICENSE.txt.
Please see the HTML documentation provided in docs/index.html for further
assistance with LLVM.
+
+If you're writing a package for LLVM, see docs/Packaging.html for our
+suggestions.
diff --git a/autoconf/ExportMap.map b/autoconf/ExportMap.map
index 43e310e053e..17b185fed91 100644
--- a/autoconf/ExportMap.map
+++ b/autoconf/ExportMap.map
@@ -1,4 +1,7 @@
{
global: main;
+ __progname;
+ environ;
+
local: *;
};
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 40f77d828e2..a5cb788b2a9 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -80,6 +80,7 @@ do
llvm-tv) AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;;
llvm-poolalloc) AC_CONFIG_SUBDIRS([projects/llvm-poolalloc]) ;;
poolalloc) AC_CONFIG_SUBDIRS([projects/poolalloc]) ;;
+ safecode) AC_CONFIG_SUBDIRS([projects/safecode]) ;;
llvm-kernel) AC_CONFIG_SUBDIRS([projects/llvm-kernel]) ;;
*)
AC_MSG_WARN([Unknown project (${i}) won't be configured automatically])
@@ -184,7 +185,7 @@ AC_CACHE_CHECK([type of operating system we're going to host on],
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="Haiku"
- llvm_cv_platform_type="Unix" ;;
+ llvm_cv_platform_type="Unix" ;;
*-unknown-eabi*)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
@@ -236,7 +237,7 @@ AC_CACHE_CHECK([type of operating system we're going to target],
*-*-mingw*)
llvm_cv_target_os_type="MingW" ;;
*-*-haiku*)
- llvm_cv_target_os_type="Haiku" ;;
+ llvm_cv_target_os_type="Haiku" ;;
*-unknown-eabi*)
llvm_cv_target_os_type="Freestanding" ;;
*)
@@ -291,6 +292,7 @@ AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch],
msp430-*) llvm_cv_target_arch="MSP430" ;;
s390x-*) llvm_cv_target_arch="SystemZ" ;;
bfin-*) llvm_cv_target_arch="Blackfin" ;;
+ mblaze-*) llvm_cv_target_arch="MBlaze" ;;
*) llvm_cv_target_arch="Unknown" ;;
esac])
@@ -427,6 +429,7 @@ else
MSP430) AC_SUBST(TARGET_HAS_JIT,0) ;;
SystemZ) AC_SUBST(TARGET_HAS_JIT,0) ;;
Blackfin) AC_SUBST(TARGET_HAS_JIT,0) ;;
+ MBlaze) AC_SUBST(TARGET_HAS_JIT,0) ;;
*) AC_SUBST(TARGET_HAS_JIT,0) ;;
esac
fi
@@ -470,6 +473,18 @@ esac
AC_DEFINE_UNQUOTED([ENABLE_PIC],$ENABLE_PIC,
[Define if position independent code is enabled])
+dnl Allow building a shared library and linking tools against it.
+AC_ARG_ENABLE(shared,
+ AS_HELP_STRING([--enable-shared],
+ [Build a shared library and link tools against it (default is NO)]),,
+ enableval=default)
+case "$enableval" in
+ yes) AC_SUBST(ENABLE_SHARED,[1]) ;;
+ no) AC_SUBST(ENABLE_SHARED,[0]) ;;
+ default) AC_SUBST(ENABLE_SHARED,[0]) ;;
+ *) AC_MSG_ERROR([Invalid setting for --enable-shared. Use "yes" or "no"]) ;;
+esac
+
dnl Allow specific targets to be specified for building (or not)
TARGETS_TO_BUILD=""
AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],
@@ -481,7 +496,7 @@ if test "$enableval" = host-only ; then
enableval=host
fi
case "$enableval" in
- all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha ARM Mips CellSPU PIC16 XCore MSP430 SystemZ Blackfin CBackend MSIL CppBackend" ;;
+ all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha ARM Mips CellSPU PIC16 XCore MSP430 SystemZ Blackfin CBackend MSIL CppBackend MBlaze" ;;
*)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do
case "$a_target" in
x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
@@ -500,6 +515,7 @@ case "$enableval" in
cbe) TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD" ;;
msil) TARGETS_TO_BUILD="MSIL $TARGETS_TO_BUILD" ;;
cpp) TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;;
+ mblaze) TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;;
host) case "$llvm_cv_target_arch" in
x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
@@ -508,6 +524,7 @@ case "$enableval" in
Alpha) TARGETS_TO_BUILD="Alpha $TARGETS_TO_BUILD" ;;
ARM) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
Mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
+ MBlaze) TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;;
CellSPU|SPU) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;;
PIC16) TARGETS_TO_BUILD="PIC16 $TARGETS_TO_BUILD" ;;
XCore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;;
@@ -612,6 +629,56 @@ if test -n "$LLVMGXX" && test -z "$LLVMGCC"; then
AC_MSG_ERROR([Invalid llvm-gcc. Use --with-llvmgcc when --with-llvmgxx is used]);
fi
+dnl Allow a specific Clang compiler to be used with this LLVM config.
+AC_ARG_WITH(clang,
+ AS_HELP_STRING([--with-clang],
+ [Specify location of clang compiler (default is --with-built-clang)]),
+ [],[with_clang=default])
+
+dnl Enable use of the built Clang.
+AC_ARG_WITH(built-clang,
+ AS_HELP_STRING([--with-built-clang],
+ [Use the compiled Clang as the LLVM compiler (default=check)]),
+ [],[with_built_clang=check])
+
+dnl Select the Clang compiler option.
+dnl
+dnl If --with-clang is given, always honor that; otherwise honor
+dnl --with-built-clang, or check if we have the clang sources.
+AC_MSG_CHECKING([clang compiler])
+WITH_CLANGPATH=""
+WITH_BUILT_CLANG=0
+if test "$with_clang" != "default"; then
+ WITH_CLANGPATH="$with_clang"
+ if ! test -x "$WITH_CLANGPATH"; then
+ AC_MSG_ERROR([invalid --with-clang, path does not specify an executable])
+ fi
+elif test "$with_built_clang" = "yes"; then
+ WITH_BUILT_CLANG=1
+elif test "$with_built_clang" = "no"; then
+ WITH_BUILT_CLANG=0
+else
+ if test "$with_built_clang" != "check"; then
+ AC_MSG_ERROR([invalid value for --with-built-clang.])
+ fi
+
+ if test -f ${srcdir}/tools/clang/README.txt; then
+ WITH_BUILT_CLANG=1
+ fi
+fi
+
+if ! test -z "$WITH_CLANGPATH"; then
+ AC_MSG_RESULT([$WITH_CLANGPATH])
+ WITH_CLANGXXPATH=`"$WITH_CLANGPATH" --print-prog-name=clang++`
+elif test "$WITH_BUILT_CLANG" = "1"; then
+ AC_MSG_RESULT([built])
+else
+ AC_MSG_RESULT([none])
+fi
+AC_SUBST(CLANGPATH,$WITH_CLANGPATH)
+AC_SUBST(CLANGXXPATH,$WITH_CLANGXXPATH)
+AC_SUBST(ENABLE_BUILT_CLANG,$WITH_BUILT_CLANG)
+
dnl Override the option to use for optimized builds.
AC_ARG_WITH(optimize-option,
AS_HELP_STRING([--with-optimize-option],
@@ -946,6 +1013,29 @@ else
AC_SUBST(LLVMGXXCOMMAND,$LLVMGXXCOMMAND)
fi
+dnl Select the LLVM capable compiler to use, we default to using llvm-gcc if
+dnl found, otherwise clang if available.
+AC_ARG_WITH(llvmcc,
+ AS_HELP_STRING([--with-llvmcc=],
+ [Choose the LLVM capable compiler to use (llvm-gcc, clang, or none; default=check)]),
+ [],[with_llvmcc=check])
+AC_MSG_CHECKING([LLVM capable compiler])
+if test "$with_llvmcc" != "check"; then
+ if (test "$with_llvmcc" != "llvm-gcc" &&
+ test "$with_llvmcc" != "clang" &&
+ test "$with_llvmcc" != "none"); then
+ AC_MSG_ERROR([invalid value for --with-llvmcc, expected 'llvm-gcc', 'clang', or 'none'.])
+ fi
+ WITH_LLVMCC="$with_llvmcc"
+elif test -n "$LLVMGCC"; then
+ WITH_LLVMCC=llvm-gcc
+elif test -n "$WITH_CLANGPATH" || test "$WITH_BUILT_CLANG" -ne "0"; then
+ WITH_LLVMCC=clang
+else
+ WITH_LLVMCC=none
+fi
+AC_MSG_RESULT([$WITH_LLVMCC])
+AC_SUBST(LLVMCC_OPTION,$WITH_LLVMCC)
AC_MSG_CHECKING([tool compatibility])
@@ -994,7 +1084,7 @@ fi
dnl Tool compatibility is okay if we make it here.
AC_MSG_RESULT([ok])
-dnl Check optional compiler flags.
+dnl Check optional compiler flags.
AC_MSG_CHECKING([optional compiler flags])
CXX_FLAG_CHECK(NO_VARIADIC_MACROS, [-Wno-variadic-macros])
CXX_FLAG_CHECK(NO_MISSING_FIELD_INITIALIZERS, [-Wno-missing-field-initializers])
@@ -1250,12 +1340,6 @@ if test "$llvm_cv_llvmgcc_sanity" = "yes" ; then
AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath)
llvmgccdir=`echo "$llvmcc1path" | sed 's,/libexec/.*,,'`
AC_SUBST(LLVMGCCDIR,$llvmgccdir)
- llvmgcclibexec=`echo "$llvmcc1path" | sed 's,/cc1,,'`
- AC_SUBST(LLVMGCCLIBEXEC,$llvmgcclibexec)
- llvmgccversion=[`"$LLVMGCC" -dumpversion 2>&1 | sed 's/^\([0-9.]*\).*/\1/'`]
- llvmgccmajvers=[`echo $llvmgccversion | sed 's/^\([0-9]\).*/\1/'`]
- AC_SUBST(LLVMGCC_VERSION,$llvmgccversion)
- AC_SUBST(LLVMGCC_MAJVERS,$llvmgccmajvers)
llvmgcclangs=[`"$LLVMGCC" -v --help 2>&1 | grep '^Configured with:' | sed 's/^.*--enable-languages=\([^ ]*\).*/\1/'`]
AC_SUBST(LLVMGCC_LANGS,$llvmgcclangs)
AC_MSG_RESULT([ok])
@@ -1265,6 +1349,10 @@ dnl Propagate the shared library extension that the libltdl checks did to
dnl the Makefiles so we can use it there too
AC_SUBST(SHLIBEXT,$libltdl_cv_shlibext)
+dnl Propagate the run-time library path variable that the libltdl
+dnl checks found to the Makefiles so we can use it there too
+AC_SUBST(SHLIBPATH_VAR,$libltdl_cv_shlibpath_var)
+
# Translate the various configuration directories and other basic
# information into substitutions that will end up in Makefile.config.in
# that these configured values can be used by the makefiles
@@ -1275,7 +1363,7 @@ eval LLVM_PREFIX="${prefix}";
eval LLVM_BINDIR="${prefix}/bin";
eval LLVM_LIBDIR="${prefix}/lib";
eval LLVM_DATADIR="${prefix}/share/llvm";
-eval LLVM_DOCSDIR="${prefix}/docs/llvm";
+eval LLVM_DOCSDIR="${prefix}/share/doc/llvm";
eval LLVM_ETCDIR="${prefix}/etc/llvm";
eval LLVM_INCLUDEDIR="${prefix}/include";
eval LLVM_INFODIR="${prefix}/info";
diff --git a/autoconf/m4/cxx_flag_check.m4 b/autoconf/m4/cxx_flag_check.m4
new file mode 100644
index 00000000000..ab09f2af5cf
--- /dev/null
+++ b/autoconf/m4/cxx_flag_check.m4
@@ -0,0 +1,2 @@
+AC_DEFUN([CXX_FLAG_CHECK],
+ [AC_SUBST($1, `$CXX $2 -fsyntax-only -xc /dev/null 2>/dev/null && echo $2`)])
diff --git a/autoconf/m4/huge_val.m4 b/autoconf/m4/huge_val.m4
index fd94c11c86e..5fffbfc8d37 100644
--- a/autoconf/m4/huge_val.m4
+++ b/autoconf/m4/huge_val.m4
@@ -5,6 +5,7 @@
AC_DEFUN([AC_HUGE_VAL_CHECK],[
AC_CACHE_CHECK([for HUGE_VAL sanity], [ac_cv_huge_val_sanity],[
AC_LANG_PUSH([C++])
+ ac_save_CXXFLAGS=$CXXFLAGS
CXXFLAGS=-pedantic
AC_RUN_IFELSE(
AC_LANG_PROGRAM(
@@ -12,6 +13,7 @@ AC_DEFUN([AC_HUGE_VAL_CHECK],[
[double x = HUGE_VAL; return x != x; ]),
[ac_cv_huge_val_sanity=yes],[ac_cv_huge_val_sanity=no],
[ac_cv_huge_val_sanity=yes])
+ CXXFLAGS=$ac_save_CXXFLAGS
AC_LANG_POP([C++])
])
AC_SUBST(HUGE_VAL_SANITY,$ac_cv_huge_val_sanity)
diff --git a/bindings/ocaml/bitreader/bitreader_ocaml.c b/bindings/ocaml/bitreader/bitreader_ocaml.c
index 5fd9f854d9d..ef72ce213d8 100644
--- a/bindings/ocaml/bitreader/bitreader_ocaml.c
+++ b/bindings/ocaml/bitreader/bitreader_ocaml.c
@@ -46,17 +46,16 @@ static void llvm_raise(value Prototype, char *Message) {
/*===-- Modules -----------------------------------------------------------===*/
/* Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule */
-CAMLprim value llvm_get_module_provider(LLVMContextRef C,
- LLVMMemoryBufferRef MemBuf) {
+CAMLprim value llvm_get_module(LLVMContextRef C, LLVMMemoryBufferRef MemBuf) {
CAMLparam0();
CAMLlocal2(Variant, MessageVal);
char *Message;
- LLVMModuleProviderRef MP;
- if (LLVMGetBitcodeModuleProviderInContext(C, MemBuf, &MP, &Message))
+ LLVMModuleRef M;
+ if (LLVMGetBitcodeModuleInContext(C, MemBuf, &M, &Message))
llvm_raise(llvm_bitreader_error_exn, Message);
- CAMLreturn((value) MemBuf);
+ CAMLreturn((value) M);
}
/* Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule */
diff --git a/bindings/ocaml/bitreader/llvm_bitreader.ml b/bindings/ocaml/bitreader/llvm_bitreader.ml
index 88587cbe1ef..8b9d01d8fb0 100644
--- a/bindings/ocaml/bitreader/llvm_bitreader.ml
+++ b/bindings/ocaml/bitreader/llvm_bitreader.ml
@@ -13,9 +13,8 @@ exception Error of string
external register_exns : exn -> unit = "llvm_register_bitreader_exns"
let _ = register_exns (Error "")
-external get_module_provider : Llvm.llcontext -> Llvm.llmemorybuffer ->
- Llvm.llmoduleprovider
- = "llvm_get_module_provider"
+external get_module : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
+ = "llvm_get_module"
external parse_bitcode : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
= "llvm_parse_bitcode"
diff --git a/bindings/ocaml/bitreader/llvm_bitreader.mli b/bindings/ocaml/bitreader/llvm_bitreader.mli
index 5648b35fee2..5e2240974af 100644
--- a/bindings/ocaml/bitreader/llvm_bitreader.mli
+++ b/bindings/ocaml/bitreader/llvm_bitreader.mli
@@ -14,14 +14,12 @@
exception Error of string
-(** [get_module_provider context mb] reads the bitcode for a new
- module provider [m] from the memory buffer [mb] in the context [context].
- Returns [m] if successful, or raises [Error msg] otherwise, where [msg] is a
- description of the error encountered. See the function
- [llvm::getBitcodeModuleProvider]. *)
-external get_module_provider : Llvm.llcontext -> Llvm.llmemorybuffer ->
- Llvm.llmoduleprovider
- = "llvm_get_module_provider"
+(** [get_module context mb] reads the bitcode for a new module [m] from the
+ memory buffer [mb] in the context [context]. Returns [m] if successful, or
+ raises [Error msg] otherwise, where [msg] is a description of the error
+ encountered. See the function [llvm::getBitcodeModule]. *)
+external get_module : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
+ = "llvm_get_module"
(** [parse_bitcode context mb] parses the bitcode for a new module [m] from the
memory buffer [mb] in the context [context]. Returns [m] if successful, or
diff --git a/bindings/ocaml/executionengine/executionengine_ocaml.c b/bindings/ocaml/executionengine/executionengine_ocaml.c
index 072d583bf8f..1d3e57a705b 100644
--- a/bindings/ocaml/executionengine/executionengine_ocaml.c
+++ b/bindings/ocaml/executionengine/executionengine_ocaml.c
@@ -168,41 +168,31 @@ CAMLprim value llvm_genericvalue_as_nativeint(value GenVal) {
/*--... Operations on execution engines ....................................--*/
-/* llmoduleprovider -> ExecutionEngine.t */
-CAMLprim LLVMExecutionEngineRef llvm_ee_create(LLVMModuleProviderRef MP) {
+/* llmodule -> ExecutionEngine.t */
+CAMLprim LLVMExecutionEngineRef llvm_ee_create(LLVMModuleRef M) {
LLVMExecutionEngineRef Interp;
char *Error;
- if (LLVMCreateExecutionEngine(&Interp, MP, &Error))
+ if (LLVMCreateExecutionEngineForModule(&Interp, M, &Error))
llvm_raise(llvm_ee_error_exn, Error);
return Interp;
}
-/* llmoduleprovider -> ExecutionEngine.t */
+/* llmodule -> ExecutionEngine.t */
CAMLprim LLVMExecutionEngineRef
-llvm_ee_create_interpreter(LLVMModuleProviderRef MP) {
+llvm_ee_create_interpreter(LLVMModuleRef M) {
LLVMExecutionEngineRef Interp;
char *Error;
- if (LLVMCreateInterpreter(&Interp, MP, &Error))
+ if (LLVMCreateInterpreterForModule(&Interp, M, &Error))
llvm_raise(llvm_ee_error_exn, Error);
return Interp;
}
-/* llmoduleprovider -> ExecutionEngine.t */
+/* llmodule -> int -> ExecutionEngine.t */
CAMLprim LLVMExecutionEngineRef
-llvm_ee_create_jit(LLVMModuleProviderRef MP) {
+llvm_ee_create_jit(LLVMModuleRef M, value OptLevel) {
LLVMExecutionEngineRef JIT;
char *Error;
- if (LLVMCreateJITCompiler(&JIT, MP, 3, &Error))
- llvm_raise(llvm_ee_error_exn, Error);
- return JIT;
-}
-
-/* llmoduleprovider -> ExecutionEngine.t */
-CAMLprim LLVMExecutionEngineRef
-llvm_ee_create_fast_jit(LLVMModuleProviderRef MP) {
- LLVMExecutionEngineRef JIT;
- char *Error;
- if (LLVMCreateJITCompiler(&JIT, MP, 0, &Error))
+ if (LLVMCreateJITCompilerForModule(&JIT, M, Int_val(OptLevel), &Error))
llvm_raise(llvm_ee_error_exn, Error);
return JIT;
}
@@ -213,19 +203,18 @@ CAMLprim value llvm_ee_dispose(LLVMExecutionEngineRef EE) {
return Val_unit;
}
-/* llmoduleprovider -> ExecutionEngine.t -> unit */
-CAMLprim value llvm_ee_add_mp(LLVMModuleProviderRef MP,
- LLVMExecutionEngineRef EE) {
- LLVMAddModuleProvider(EE, MP);
+/* llmodule -> ExecutionEngine.t -> unit */
+CAMLprim value llvm_ee_add_mp(LLVMModuleRef M, LLVMExecutionEngineRef EE) {
+ LLVMAddModule(EE, M);
return Val_unit;
}
-/* llmoduleprovider -> ExecutionEngine.t -> llmodule */
-CAMLprim LLVMModuleRef llvm_ee_remove_mp(LLVMModuleProviderRef MP,
+/* llmodule -> ExecutionEngine.t -> llmodule */
+CAMLprim LLVMModuleRef llvm_ee_remove_mp(LLVMModuleRef M,
LLVMExecutionEngineRef EE) {
LLVMModuleRef RemovedModule;
char *Error;
- if (LLVMRemoveModuleProvider(EE, MP, &RemovedModule, &Error))
+ if (LLVMRemoveModule(EE, M, &RemovedModule, &Error))
llvm_raise(llvm_ee_error_exn, Error);
return RemovedModule;
}
@@ -237,7 +226,7 @@ CAMLprim value llvm_ee_find_function(value Name, LLVMExecutionEngineRef EE) {
LLVMValueRef Found;
if (LLVMFindFunction(EE, String_val(Name), &Found))
CAMLreturn(Val_unit);
- Option = alloc(1, 1);
+ Option = alloc(1, 0);
Field(Option, 0) = Val_op(Found);
CAMLreturn(Option);
}
diff --git a/bindings/ocaml/executionengine/llvm_executionengine.ml b/bindings/ocaml/executionengine/llvm_executionengine.ml
index c9e8f18b224..95faa58cc54 100644
--- a/bindings/ocaml/executionengine/llvm_executionengine.ml
+++ b/bindings/ocaml/executionengine/llvm_executionengine.ml
@@ -56,19 +56,17 @@ module ExecutionEngine = struct
call into LLVM. *)
let _ = register_exns (Error "")
- external create: Llvm.llmoduleprovider -> t
+ external create: Llvm.llmodule -> t
= "llvm_ee_create"
- external create_interpreter: Llvm.llmoduleprovider -> t
+ external create_interpreter: Llvm.llmodule -> t
= "llvm_ee_create_interpreter"
- external create_jit: Llvm.llmoduleprovider -> t
+ external create_jit: Llvm.llmodule -> int -> t
= "llvm_ee_create_jit"
- external create_fast_jit: Llvm.llmoduleprovider -> t
- = "llvm_ee_create_fast_jit"
external dispose: t -> unit
= "llvm_ee_dispose"
- external add_module_provider: Llvm.llmoduleprovider -> t -> unit
+ external add_module: Llvm.llmodule -> t -> unit
= "llvm_ee_add_mp"
- external remove_module_provider: Llvm.llmoduleprovider -> t -> Llvm.llmodule
+ external remove_module: Llvm.llmodule -> t -> Llvm.llmodule
= "llvm_ee_remove_mp"
external find_function: string -> t -> Llvm.llvalue option
= "llvm_ee_find_function"
diff --git a/bindings/ocaml/executionengine/llvm_executionengine.mli b/bindings/ocaml/executionengine/llvm_executionengine.mli
index 6c2fdfb7868..ac6665b2bc8 100644
--- a/bindings/ocaml/executionengine/llvm_executionengine.mli
+++ b/bindings/ocaml/executionengine/llvm_executionengine.mli
@@ -85,48 +85,38 @@ module ExecutionEngine: sig
invoking a static compiler and generating a native executable. *)
type t
- (** [create mp] creates a new execution engine, taking ownership of the
- module provider [mp] if successful. Creates a JIT if possible, else falls
- back to an interpreter. Raises [Error msg] if an error occurrs. The
+ (** [create m] creates a new execution engine, taking ownership of the
+ module [m] if successful. Creates a JIT if possible, else falls back to an
+ interpreter. Raises [Error msg] if an error occurrs. The execution engine
+ is not garbage collected and must be destroyed with [dispose ee].
+ See the function [llvm::EngineBuilder::create]. *)
+ val create: Llvm.llmodule -> t
+
+ (** [create_interpreter m] creates a new interpreter, taking ownership of the
+ module [m] if successful. Raises [Error msg] if an error occurrs. The
execution engine is not garbage collected and must be destroyed with
- [dispose ee]. See the function [llvm::EngineBuilder::create]. *)
- val create: Llvm.llmoduleprovider -> t
-
- (** [create_interpreter mp] creates a new interpreter, taking ownership of the
- module provider [mp] if successful. Raises [Error msg] if an error
- occurrs. The execution engine is not garbage collected and must be
- destroyed with [dispose ee].
+ [dispose ee].
See the function [llvm::EngineBuilder::create]. *)
- val create_interpreter: Llvm.llmoduleprovider -> t
+ val create_interpreter: Llvm.llmodule -> t
- (** [create_jit mp] creates a new JIT (just-in-time compiler), taking
- ownership of the module provider [mp] if successful. This function creates
- a JIT which favors code quality over compilation speed. Raises [Error msg]
- if an error occurrs. The execution engine is not garbage collected and
- must be destroyed with [dispose ee].
+ (** [create_jit m optlevel] creates a new JIT (just-in-time compiler), taking
+ ownership of the module [m] if successful with the desired optimization
+ level [optlevel]. Raises [Error msg] if an error occurrs. The execution
+ engine is not garbage collected and must be destroyed with [dispose ee].
See the function [llvm::EngineBuilder::create]. *)
- val create_jit: Llvm.llmoduleprovider -> t
-
- (** [create_fast_jit mp] creates a new JIT (just-in-time compiler) which
- favors compilation speed over code quality. It takes ownership of the
- module provider [mp] if successful. Raises [Error msg] if an error
- occurrs. The execution engine is not garbage collected and must be
- destroyed with [dispose ee].
- See the function [llvm::EngineBuilder::create]. *)
- val create_fast_jit: Llvm.llmoduleprovider -> t
-
+ val create_jit : Llvm.llmodule -> int -> t
+
(** [dispose ee] releases the memory used by the execution engine and must be
invoked to avoid memory leaks. *)
val dispose: t -> unit
- (** [add_module_provider mp ee] adds the module provider [mp] to the execution
- engine [ee]. *)
- val add_module_provider: Llvm.llmoduleprovider -> t -> unit
+ (** [add_module m ee] adds the module [m] to the execution engine [ee]. *)
+ val add_module: Llvm.llmodule -> t -> unit
- (** [remove_module_provider mp ee] removes the module provider [mp] from the
- execution engine [ee], disposing of [mp] and the module referenced by
- [mp]. Raises [Error msg] if an error occurs. *)
- val remove_module_provider: Llvm.llmoduleprovider -> t -> Llvm.llmodule
+ (** [remove_module m ee] removes the module [m] from the execution engine
+ [ee], disposing of [m] and the module referenced by [mp]. Raises
+ [Error msg] if an error occurs. *)
+ val remove_module: Llvm.llmodule -> t -> Llvm.llmodule
(** [find_function n ee] finds the function named [n] defined in any of the
modules owned by the execution engine [ee]. Returns [None] if the function
diff --git a/bindings/ocaml/llvm/llvm.ml b/bindings/ocaml/llvm/llvm.ml
index 7e4acbff476..407c1fc6c63 100644
--- a/bindings/ocaml/llvm/llvm.ml
+++ b/bindings/ocaml/llvm/llvm.ml
@@ -13,9 +13,9 @@ type llmodule
type lltype
type lltypehandle
type llvalue
+type lluse
type llbasicblock
type llbuilder
-type llmoduleprovider
type llmemorybuffer
module TypeKind = struct
@@ -35,6 +35,7 @@ module TypeKind = struct
| Opaque
| Vector
| Metadata
+ | Union
end
module Linkage = struct
@@ -147,6 +148,7 @@ type ('a, 'b) llrev_pos =
external create_context : unit -> llcontext = "llvm_create_context"
external dispose_context : llcontext -> unit = "llvm_dispose_context"
external global_context : unit -> llcontext = "llvm_global_context"
+external mdkind_id : llcontext -> string -> int = "llvm_mdkind_id"
(*===-- Modules -----------------------------------------------------------===*)
external create_module : llcontext -> string -> llmodule = "llvm_create_module"
@@ -163,6 +165,8 @@ external define_type_name : string -> lltype -> llmodule -> bool
= "llvm_add_type_name"
external delete_type_name : string -> llmodule -> unit
= "llvm_delete_type_name"
+external type_by_name : llmodule -> string -> lltype option
+ = "llvm_type_by_name"
external dump_module : llmodule -> unit = "llvm_dump_module"
(*===-- Types -------------------------------------------------------------===*)
@@ -198,9 +202,15 @@ external param_types : lltype -> lltype array = "llvm_param_types"
external struct_type : llcontext -> lltype array -> lltype = "llvm_struct_type"
external packed_struct_type : llcontext -> lltype array -> lltype
= "llvm_packed_struct_type"
-external element_types : lltype -> lltype array = "llvm_element_types"
+external struct_element_types : lltype -> lltype array
+ = "llvm_struct_element_types"
external is_packed : lltype -> bool = "llvm_is_packed"
+(*--... Operations on union types ..........................................--*)
+external union_type : llcontext -> lltype array -> lltype = "llvm_union_type"
+external union_element_types : lltype -> lltype array
+ = "llvm_union_element_types"
+
(*--... Operations on pointer, vector, and array types .....................--*)
external array_type : lltype -> int -> lltype = "llvm_array_type"
external pointer_type : lltype -> lltype = "llvm_pointer_type"
@@ -229,15 +239,63 @@ external type_of : llvalue -> lltype = "llvm_type_of"
external value_name : llvalue -> string = "llvm_value_name"
external set_value_name : string -> llvalue -> unit = "llvm_set_value_name"
external dump_value : llvalue -> unit = "llvm_dump_value"
+external replace_all_uses_with : llvalue -> llvalue -> unit
+ = "LLVMReplaceAllUsesWith"
+
+(*--... Operations on uses .................................................--*)
+external use_begin : llvalue -> lluse option = "llvm_use_begin"
+external use_succ : lluse -> lluse option = "llvm_use_succ"
+external user : lluse -> llvalue = "llvm_user"
+external used_value : lluse -> llvalue = "llvm_used_value"
+
+let iter_uses f v =
+ let rec aux = function
+ | None -> ()
+ | Some u ->
+ f u;
+ aux (use_succ u)
+ in
+ aux (use_begin v)
+
+let fold_left_uses f init v =
+ let rec aux init u =
+ match u with
+ | None -> init
+ | Some u -> aux (f init u) (use_succ u)
+ in
+ aux init (use_begin v)
+
+let fold_right_uses f v init =
+ let rec aux u init =
+ match u with
+ | None -> init
+ | Some u -> f u (aux (use_succ u) init)
+ in
+ aux (use_begin v) init
+
+
+(*--... Operations on users ................................................--*)
+external operand : llvalue -> int -> llvalue = "llvm_operand"
(*--... Operations on constants of (mostly) any type .......................--*)
external is_constant : llvalue -> bool = "llvm_is_constant"
external const_null : lltype -> llvalue = "LLVMConstNull"
external const_all_ones : (*int|vec*)lltype -> llvalue = "LLVMConstAllOnes"
+external const_pointer_null : lltype -> llvalue = "LLVMConstPointerNull"
external undef : lltype -> llvalue = "LLVMGetUndef"
external is_null : llvalue -> bool = "llvm_is_null"
external is_undef : llvalue -> bool = "llvm_is_undef"
+(*--... Operations on instructions .........................................--*)
+external has_metadata : llvalue -> bool = "llvm_has_metadata"
+external metadata : llvalue -> int -> llvalue option = "llvm_metadata"
+external set_metadata : llvalue -> int -> llvalue -> unit = "llvm_set_metadata"
+external clear_metadata : llvalue -> int -> unit = "llvm_clear_metadata"
+
+(*--... Operations on metadata .......,.....................................--*)
+external mdstring : llcontext -> string -> llvalue = "llvm_mdstring"
+external mdnode : llcontext -> llvalue array -> llvalue = "llvm_mdnode"
+
(*--... Operations on scalar constants .....................................--*)
external const_int : lltype -> int -> llvalue = "llvm_const_int"
external const_of_int64 : lltype -> Int64.t -> bool -> llvalue
@@ -257,19 +315,27 @@ external const_struct : llcontext -> llvalue array -> llvalue
external const_packed_struct : llcontext -> llvalue array -> llvalue
= "llvm_const_packed_struct"
external const_vector : llvalue array -> llvalue = "llvm_const_vector"
+external const_union : lltype -> llvalue -> llvalue = "LLVMConstUnion"
(*--... Constant expressions ...............................................--*)
external align_of : lltype -> llvalue = "LLVMAlignOf"
external size_of : lltype -> llvalue = "LLVMSizeOf"
external const_neg : llvalue -> llvalue = "LLVMConstNeg"
+external const_nsw_neg : llvalue -> llvalue = "LLVMConstNSWNeg"
+external const_nuw_neg : llvalue -> llvalue = "LLVMConstNUWNeg"
external const_fneg : llvalue -> llvalue = "LLVMConstFNeg"
external const_not : llvalue -> llvalue = "LLVMConstNot"
external const_add : llvalue -> llvalue -> llvalue = "LLVMConstAdd"
external const_nsw_add : llvalue -> llvalue -> llvalue = "LLVMConstNSWAdd"
+external const_nuw_add : llvalue -> llvalue -> llvalue = "LLVMConstNUWAdd"
external const_fadd : llvalue -> llvalue -> llvalue = "LLVMConstFAdd"
external const_sub : llvalue -> llvalue -> llvalue = "LLVMConstSub"
+external const_nsw_sub : llvalue -> llvalue -> llvalue = "LLVMConstNSWSub"
+external const_nuw_sub : llvalue -> llvalue -> llvalue = "LLVMConstNUWSub"
external const_fsub : llvalue -> llvalue -> llvalue = "LLVMConstFSub"
external const_mul : llvalue -> llvalue -> llvalue = "LLVMConstMul"
+external const_nsw_mul : llvalue -> llvalue -> llvalue = "LLVMConstNSWMul"
+external const_nuw_mul : llvalue -> llvalue -> llvalue = "LLVMConstNUWMul"
external const_fmul : llvalue -> llvalue -> llvalue = "LLVMConstFMul"
external const_udiv : llvalue -> llvalue -> llvalue = "LLVMConstUDiv"
external const_sdiv : llvalue -> llvalue -> llvalue = "LLVMConstSDiv"
@@ -325,6 +391,10 @@ external const_extractvalue : llvalue -> int array -> llvalue
= "llvm_const_extractvalue"
external const_insertvalue : llvalue -> llvalue -> int array -> llvalue
= "llvm_const_insertvalue"
+external const_inline_asm : lltype -> string -> string -> bool -> bool ->
+ llvalue
+ = "llvm_const_inline_asm"
+external block_address : llvalue -> llbasicblock -> llvalue = "LLVMBlockAddress"
(*--... Operations on global variables, functions, and aliases (globals) ...--*)
external global_parent : llvalue -> llmodule = "LLVMGetGlobalParent"
@@ -344,8 +414,14 @@ external set_global_constant : bool -> llvalue -> unit
(*--... Operations on global variables .....................................--*)
external declare_global : lltype -> string -> llmodule -> llvalue
= "llvm_declare_global"
+external declare_qualified_global : lltype -> string -> int -> llmodule ->
+ llvalue
+ = "llvm_declare_qualified_global"
external define_global : string -> llvalue -> llmodule -> llvalue
= "llvm_define_global"
+external define_qualified_global : string -> llvalue -> int -> llmodule ->
+ llvalue
+ = "llvm_define_qualified_global"
external lookup_global : string -> llmodule -> llvalue option
= "llvm_lookup_global"
external delete_global : llvalue -> unit = "llvm_delete_global"
@@ -403,6 +479,10 @@ let rec fold_right_global_range f i e init =
let fold_right_globals f m init =
fold_right_global_range f (global_end m) (At_start m) init
+(*--... Operations on aliases ..............................................--*)
+external add_alias : llmodule -> lltype -> llvalue -> string -> llvalue
+ = "llvm_add_alias"
+
(*--... Operations on functions ............................................--*)
external declare_function : string -> lltype -> llmodule -> llvalue
= "llvm_declare_function"
@@ -680,6 +760,17 @@ let position_before i = position_builder (Before i)
let position_at_end bb = position_builder (At_end bb)
+(*--... Metadata ...........................................................--*)
+external set_current_debug_location : llbuilder -> llvalue -> unit
+ = "llvm_set_current_debug_location"
+external clear_current_debug_location : llbuilder -> unit
+ = "llvm_clear_current_debug_location"
+external current_debug_location : llbuilder -> llvalue option
+ = "llvm_current_debug_location"
+external set_inst_debug_location : llbuilder -> llvalue -> unit
+ = "llvm_set_inst_debug_location"
+
+
(*--... Terminators ........................................................--*)
external build_ret_void : llbuilder -> llvalue = "llvm_build_ret_void"
external build_ret : llvalue -> llbuilder -> llvalue = "llvm_build_ret"
@@ -692,6 +783,10 @@ external build_switch : llvalue -> llbasicblock -> int -> llbuilder -> llvalue
= "llvm_build_switch"
external add_case : llvalue -> llvalue -> llbasicblock -> unit
= "llvm_add_case"
+external build_indirect_br : llvalue -> int -> llbuilder -> llvalue
+ = "llvm_build_indirect_br"
+external add_destination : llvalue -> llbasicblock -> unit
+ = "llvm_add_destination"
external build_invoke : llvalue -> llvalue array -> llbasicblock ->
llbasicblock -> string -> llbuilder -> llvalue
= "llvm_build_invoke_bc" "llvm_build_invoke_nat"
@@ -703,14 +798,24 @@ external build_add : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_add"
external build_nsw_add : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_nsw_add"
+external build_nuw_add : llvalue -> llvalue -> string -> llbuilder -> llvalue
+ = "llvm_build_nuw_add"
external build_fadd : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_fadd"
external build_sub : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_sub"
+external build_nsw_sub : llvalue -> llvalue -> string -> llbuilder -> llvalue
+ = "llvm_build_nsw_sub"
+external build_nuw_sub : llvalue -> llvalue -> string -> llbuilder -> llvalue
+ = "llvm_build_nuw_sub"
external build_fsub : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_fsub"
external build_mul : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_mul"
+external build_nsw_mul : llvalue -> llvalue -> string -> llbuilder -> llvalue
+ = "llvm_build_nsw_mul"
+external build_nuw_mul : llvalue -> llvalue -> string -> llbuilder -> llvalue
+ = "llvm_build_nuw_mul"
external build_fmul : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_fmul"
external build_udiv : llvalue -> llvalue -> string -> llbuilder -> llvalue
@@ -741,19 +846,20 @@ external build_xor : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_xor"
external build_neg : llvalue -> string -> llbuilder -> llvalue
= "llvm_build_neg"
+external build_nsw_neg : llvalue -> string -> llbuilder -> llvalue
+ = "llvm_build_nsw_neg"
+external build_nuw_neg : llvalue -> string -> llbuilder -> llvalue
+ = "llvm_build_nuw_neg"
+external build_fneg : llvalue -> string -> llbuilder -> llvalue
+ = "llvm_build_fneg"
external build_not : llvalue -> string -> llbuilder -> llvalue
= "llvm_build_not"
(*--... Memory .............................................................--*)
-external build_malloc : lltype -> string -> llbuilder -> llvalue
- = "llvm_build_malloc"
-external build_array_malloc : lltype -> llvalue -> string -> llbuilder ->
- llvalue = "llvm_build_array_malloc"
external build_alloca : lltype -> string -> llbuilder -> llvalue
= "llvm_build_alloca"
external build_array_alloca : lltype -> llvalue -> string -> llbuilder ->
llvalue = "llvm_build_array_alloca"
-external build_free : llvalue -> llbuilder -> llvalue = "llvm_build_free"
external build_load : llvalue -> string -> llbuilder -> llvalue
= "llvm_build_load"
external build_store : llvalue -> llvalue -> llbuilder -> llvalue
@@ -841,14 +947,6 @@ external build_is_not_null : llvalue -> string -> llbuilder -> llvalue
external build_ptrdiff : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_ptrdiff"
-(*===-- Module providers --------------------------------------------------===*)
-
-module ModuleProvider = struct
- external create : llmodule -> llmoduleprovider
- = "LLVMCreateModuleProviderForExistingModule"
- external dispose : llmoduleprovider -> unit = "llvm_dispose_module_provider"
-end
-
(*===-- Memory buffers ----------------------------------------------------===*)
@@ -865,7 +963,7 @@ module PassManager = struct
type 'a t
type any = [ `Module | `Function ]
external create : unit -> [ `Module ] t = "llvm_passmanager_create"
- external create_function : llmoduleprovider -> [ `Function ] t
+ external create_function : llmodule -> [ `Function ] t
= "LLVMCreateFunctionPassManager"
external run_module : llmodule -> [ `Module ] t -> bool
= "llvm_passmanager_run_module"
@@ -897,11 +995,14 @@ let rec string_of_lltype ty =
| TypeKind.Pointer -> (string_of_lltype (element_type ty)) ^ "*"
| TypeKind.Struct ->
let s = "{ " ^ (concat2 ", " (
- Array.map string_of_lltype (element_types ty)
+ Array.map string_of_lltype (struct_element_types ty)
)) ^ " }" in
if is_packed ty
then "<" ^ s ^ ">"
else s
+ | TypeKind.Union -> "union { " ^ (concat2 ", " (
+ Array.map string_of_lltype (union_element_types ty)
+ )) ^ " }"
| TypeKind.Array -> "[" ^ (string_of_int (array_length ty)) ^
" x " ^ (string_of_lltype (element_type ty)) ^ "]"
| TypeKind.Vector -> "<" ^ (string_of_int (vector_size ty)) ^
diff --git a/bindings/ocaml/llvm/llvm.mli b/bindings/ocaml/llvm/llvm.mli
index 4f28ae68756..aa5ea760c46 100644
--- a/bindings/ocaml/llvm/llvm.mli
+++ b/bindings/ocaml/llvm/llvm.mli
@@ -39,6 +39,9 @@ type lltypehandle
This type covers a wide range of subclasses. *)
type llvalue
+(** Used to store users and usees of values. See the [llvm::Use] class. *)
+type lluse
+
(** A basic block in LLVM IR. See the [llvm::BasicBlock] class. *)
type llbasicblock
@@ -46,10 +49,6 @@ type llbasicblock
class. *)
type llbuilder
-(** Used to provide a module to JIT or interpreter.
- See the [llvm::ModuleProvider] class. *)
-type llmoduleprovider
-
(** Used to efficiently handle large buffers of read-only binary data.
See the [llvm::MemoryBuffer] class. *)
type llmemorybuffer
@@ -73,6 +72,7 @@ module TypeKind : sig
| Opaque
| Vector
| Metadata
+ | Union
end
(** The linkage of a global value, accessed with {!linkage} and
@@ -220,6 +220,11 @@ external dispose_context : llcontext -> unit = "llvm_dispose_context"
(** See the function [llvm::getGlobalContext]. *)
external global_context : unit -> llcontext = "llvm_global_context"
+(** [mdkind_id context name] returns the MDKind ID that corresponds to the
+ name [name] in the context [context]. See the function
+ [llvm::LLVMContext::getMDKindID]. *)
+external mdkind_id : llcontext -> string -> int = "llvm_mdkind_id"
+
(** {6 Modules} *)
@@ -268,6 +273,11 @@ external define_type_name : string -> lltype -> llmodule -> bool
external delete_type_name : string -> llmodule -> unit
= "llvm_delete_type_name"
+(** [type_by_name m n] returns the type in the module [m] named [n], or [None]
+ if it does not exist. See the method [llvm::Module::getTypeByName]. *)
+external type_by_name : llmodule -> string -> lltype option
+ = "llvm_type_by_name"
+
(** [dump_module m] prints the .ll representation of the module [m] to standard
error. See the method [llvm::Module::dump]. *)
external dump_module : llmodule -> unit = "llvm_dump_module"
@@ -381,15 +391,29 @@ external struct_type : llcontext -> lltype array -> lltype
external packed_struct_type : llcontext -> lltype array -> lltype
= "llvm_packed_struct_type"
-(** [element_types sty] returns the constituent types of the struct type [sty].
- See the method [llvm::StructType::getElementType]. *)
-external element_types : lltype -> lltype array = "llvm_element_types"
+(** [struct_element_types sty] returns the constituent types of the struct type
+ [sty]. See the method [llvm::StructType::getElementType]. *)
+external struct_element_types : lltype -> lltype array
+ = "llvm_struct_element_types"
(** [is_packed sty] returns [true] if the structure type [sty] is packed,
[false] otherwise. See the method [llvm::StructType::isPacked]. *)
external is_packed : lltype -> bool = "llvm_is_packed"
+(** {7 Operations on union types} *)
+
+(** [union_type context tys] returns the union type in the context [context]
+ containing the types in the array [tys]. See the method
+ [llvm::UnionType::get] *)
+external union_type : llcontext -> lltype array -> lltype = "llvm_union_type"
+
+(** [union_element_types uty] returns the constituent types of the union type
+ [uty]. See the method [llvm::UnionType::getElementType]. *)
+external union_element_types : lltype -> lltype array
+ = "llvm_union_element_types"
+
+
(** {7 Operations on pointer, vector, and array types} *)
(** [array_type ty n] returns the array type containing [n] elements of type
@@ -482,6 +506,50 @@ external set_value_name : string -> llvalue -> unit = "llvm_set_value_name"
error. See the method [llvm::Value::dump]. *)
external dump_value : llvalue -> unit = "llvm_dump_value"
+(** [replace_all_uses_with old new] replaces all uses of the value [old]
+ * with the value [new]. See the method [llvm::Value::replaceAllUsesWith]. *)
+external replace_all_uses_with : llvalue -> llvalue -> unit
+ = "LLVMReplaceAllUsesWith"
+
+
+(* {6 Uses} *)
+
+(** [use_begin v] returns the first position in the use list for the value [v].
+ [use_begin] and [use_succ] can e used to iterate over the use list in order.
+ See the method [llvm::Value::use_begin]. *)
+external use_begin : llvalue -> lluse option = "llvm_use_begin"
+
+(** [use_succ u] returns the use list position succeeding [u].
+ See the method [llvm::use_value_iterator::operator++]. *)
+external use_succ : lluse -> lluse option = "llvm_use_succ"
+
+(** [user u] returns the user of the use [u].
+ See the method [llvm::Use::getUser]. *)
+external user : lluse -> llvalue = "llvm_user"
+
+(** [used_value u] returns the usee of the use [u].
+ See the method [llvm::Use::getUsedValue]. *)
+external used_value : lluse -> llvalue = "llvm_used_value"
+
+(** [iter_uses f v] applies function [f] to each of the users of the value [v]
+ in order. Tail recursive. *)
+val iter_uses : (lluse -> unit) -> llvalue -> unit
+
+(** [fold_left_uses f init v] is [f (... (f init u1) ...) uN] where
+ [u1,...,uN] are the users of the value [v]. Tail recursive. *)
+val fold_left_uses : ('a -> lluse -> 'a) -> 'a -> llvalue -> 'a
+
+(** [fold_right_uses f v init] is [f u1 (... (f uN init) ...)] where
+ [u1,...,uN] are the users of the value [v]. Not tail recursive. *)
+val fold_right_uses : (lluse -> 'a -> 'a) -> llvalue -> 'a -> 'a
+
+
+(* {6 Users} *)
+
+(** [operand v i] returns the operand at index [i] for the value [v]. See the
+ method [llvm::User::getOperand]. *)
+external operand : llvalue -> int -> llvalue = "llvm_operand"
+
(** {7 Operations on constants of (mostly) any type} *)
@@ -497,6 +565,10 @@ external const_null : lltype -> llvalue = "LLVMConstNull"
[ty]. See the method [llvm::Constant::getAllOnesValue]. *)
external const_all_ones : (*int|vec*)lltype -> llvalue = "LLVMConstAllOnes"
+(** [const_pointer_null ty] returns the constant null (zero) pointer of the type
+ [ty]. See the method [llvm::ConstantPointerNull::get]. *)
+external const_pointer_null : lltype -> llvalue = "LLVMConstPointerNull"
+
(** [undef ty] returns the undefined value of the type [ty].
See the method [llvm::UndefValue::get]. *)
external undef : lltype -> llvalue = "LLVMGetUndef"
@@ -510,6 +582,39 @@ external is_null : llvalue -> bool = "llvm_is_null"
external is_undef : llvalue -> bool = "llvm_is_undef"
+(** {7 Operations on instructions} *)
+
+(** [has_metadata i] returns whether or not the instruction [i] has any
+ metadata attached to it. See the function
+ [llvm::Instruction::hasMetadata]. *)
+external has_metadata : llvalue -> bool = "llvm_has_metadata"
+
+(** [metadata i kind] optionally returns the metadata associated with the
+ kind [kind] in the instruction [i] See the function
+ [llvm::Instruction::getMetadata]. *)
+external metadata : llvalue -> int -> llvalue option = "llvm_metadata"
+
+(** [set_metadata i kind md] sets the metadata [md] of kind [kind] in the
+ instruction [i]. See the function [llvm::Instruction::setMetadata]. *)
+external set_metadata : llvalue -> int -> llvalue -> unit = "llvm_set_metadata"
+
+(** [clear_metadata i kind] clears the metadata of kind [kind] in the
+ instruction [i]. See the function [llvm::Instruction::setMetadata]. *)
+external clear_metadata : llvalue -> int -> unit = "llvm_clear_metadata"
+
+
+(** {7 Operations on metadata} *)
+
+(** [mdstring c s] returns the MDString of the string [s] in the context [c].
+ See the method [llvm::MDNode::get]. *)
+external mdstring : llcontext -> string -> llvalue = "llvm_mdstring"
+
+(** [mdnode c elts] returns the MDNode containing the values [elts] in the
+ context [c].
+ See the method [llvm::MDNode::get]. *)
+external mdnode : llcontext -> llvalue array -> llvalue = "llvm_mdnode"
+
+
(** {7 Operations on scalar constants} *)
(** [const_int ty i] returns the integer constant of type [ty] and value [i].
@@ -577,6 +682,10 @@ external const_packed_struct : llcontext -> llvalue array -> llvalue
values [elts]. See the method [llvm::ConstantVector::get]. *)
external const_vector : llvalue array -> llvalue = "llvm_const_vector"
+(** [const_union ty v] returns the union constant of type [union_type tys] and
+ containing the value [v]. See the method [llvm::ConstantUnion::get]. *)
+external const_union : lltype -> llvalue -> llvalue = "LLVMConstUnion"
+
(** {7 Constant expressions} *)
@@ -596,6 +705,16 @@ external size_of : lltype -> llvalue = "LLVMSizeOf"
See the method [llvm::ConstantExpr::getNeg]. *)
external const_neg : llvalue -> llvalue = "LLVMConstNeg"
+(** [const_nsw_neg c] returns the arithmetic negation of the constant [c] with
+ no signed wrapping. The result is undefined if the negation overflows.
+ See the method [llvm::ConstantExpr::getNSWNeg]. *)
+external const_nsw_neg : llvalue -> llvalue = "LLVMConstNSWNeg"
+
+(** [const_nuw_neg c] returns the arithmetic negation of the constant [c] with
+ no unsigned wrapping. The result is undefined if the negation overflows.
+ See the method [llvm::ConstantExpr::getNUWNeg]. *)
+external const_nuw_neg : llvalue -> llvalue = "LLVMConstNUWNeg"
+
(** [const_fneg c] returns the arithmetic negation of the constant float [c].
See the method [llvm::ConstantExpr::getFNeg]. *)
external const_fneg : llvalue -> llvalue = "LLVMConstFNeg"
@@ -613,6 +732,11 @@ external const_add : llvalue -> llvalue -> llvalue = "LLVMConstAdd"
See the method [llvm::ConstantExpr::getNSWAdd]. *)
external const_nsw_add : llvalue -> llvalue -> llvalue = "LLVMConstNSWAdd"
+(** [const_nuw_add c1 c2] returns the constant sum of two constants with no
+ unsigned wrapping. The result is undefined if the sum overflows.
+ See the method [llvm::ConstantExpr::getNSWAdd]. *)
+external const_nuw_add : llvalue -> llvalue -> llvalue = "LLVMConstNUWAdd"
+
(** [const_fadd c1 c2] returns the constant sum of two constant floats.
See the method [llvm::ConstantExpr::getFAdd]. *)
external const_fadd : llvalue -> llvalue -> llvalue = "LLVMConstFAdd"
@@ -621,6 +745,16 @@ external const_fadd : llvalue -> llvalue -> llvalue = "LLVMConstFAdd"
constants. See the method [llvm::ConstantExpr::getSub]. *)
external const_sub : llvalue -> llvalue -> llvalue = "LLVMConstSub"
+(** [const_nsw_sub c1 c2] returns the constant difference of two constants with
+ no signed wrapping. The result is undefined if the sum overflows.
+ See the method [llvm::ConstantExpr::getNSWSub]. *)
+external const_nsw_sub : llvalue -> llvalue -> llvalue = "LLVMConstNSWSub"
+
+(** [const_nuw_sub c1 c2] returns the constant difference of two constants with
+ no unsigned wrapping. The result is undefined if the sum overflows.
+ See the method [llvm::ConstantExpr::getNSWSub]. *)
+external const_nuw_sub : llvalue -> llvalue -> llvalue = "LLVMConstNUWSub"
+
(** [const_fsub c1 c2] returns the constant difference, [c1 - c2], of two
constant floats. See the method [llvm::ConstantExpr::getFSub]. *)
external const_fsub : llvalue -> llvalue -> llvalue = "LLVMConstFSub"
@@ -629,6 +763,16 @@ external const_fsub : llvalue -> llvalue -> llvalue = "LLVMConstFSub"
See the method [llvm::ConstantExpr::getMul]. *)
external const_mul : llvalue -> llvalue -> llvalue = "LLVMConstMul"
+(** [const_nsw_mul c1 c2] returns the constant product of two constants with
+ no signed wrapping. The result is undefined if the sum overflows.
+ See the method [llvm::ConstantExpr::getNSWMul]. *)
+external const_nsw_mul : llvalue -> llvalue -> llvalue = "LLVMConstNSWMul"
+
+(** [const_nuw_mul c1 c2] returns the constant product of two constants with
+ no unsigned wrapping. The result is undefined if the sum overflows.
+ See the method [llvm::ConstantExpr::getNSWMul]. *)
+external const_nuw_mul : llvalue -> llvalue -> llvalue = "LLVMConstNUWMul"
+
(** [const_fmul c1 c2] returns the constant product of two constants floats.
See the method [llvm::ConstantExpr::getFMul]. *)
external const_fmul : llvalue -> llvalue -> llvalue = "LLVMConstFMul"
@@ -858,6 +1002,16 @@ external const_extractvalue : llvalue -> int array -> llvalue
external const_insertvalue : llvalue -> llvalue -> int array -> llvalue
= "llvm_const_insertvalue"
+(** [const_inline_asm ty asm con side align] inserts a inline assembly string.
+ See the method [llvm::InlineAsm::get]. *)
+external const_inline_asm : lltype -> string -> string -> bool -> bool ->
+ llvalue
+ = "llvm_const_inline_asm"
+
+(** [block_address f bb] returns the address of the basic block [bb] in the
+ function [f]. See the method [llvm::BasicBlock::get]. *)
+external block_address : llvalue -> llbasicblock -> llvalue = "LLVMBlockAddress"
+
(** {7 Operations on global variables, functions, and aliases (globals)} *)
@@ -907,19 +1061,36 @@ external set_alignment : int -> llvalue -> unit = "llvm_set_alignment"
(** {7 Operations on global variables} *)
(** [declare_global ty name m] returns a new global variable of type [ty] and
- with name [name] in module [m]. If such a global variable already exists,
- it is returned. If the type of the existing global differs, then a bitcast
- to [ty] is returned. *)
+ with name [name] in module [m] in the default address space (0). If such a
+ global variable already exists, it is returned. If the type of the existing
+ global differs, then a bitcast to [ty] is returned. *)
external declare_global : lltype -> string -> llmodule -> llvalue
= "llvm_declare_global"
+(** [declare_qualified_global ty name addrspace m] returns a new global variable
+ of type [ty] and with name [name] in module [m] in the address space
+ [addrspace]. If such a global variable already exists, it is returned. If
+ the type of the existing global differs, then a bitcast to [ty] is
+ returned. *)
+external declare_qualified_global : lltype -> string -> int -> llmodule ->
+ llvalue
+ = "llvm_declare_qualified_global"
+
(** [define_global name init m] returns a new global with name [name] and
- initializer [init] in module [m]. If the named global already exists, it is
- renamed.
+ initializer [init] in module [m] in the default address space (0). If the
+ named global already exists, it is renamed.
See the constructor of [llvm::GlobalVariable]. *)
external define_global : string -> llvalue -> llmodule -> llvalue
= "llvm_define_global"
+(** [define_qualified_global name init addrspace m] returns a new global with
+ name [name] and initializer [init] in module [m] in the address space
+ [addrspace]. If the named global already exists, it is renamed.
+ See the constructor of [llvm::GlobalVariable]. *)
+external define_qualified_global : string -> llvalue -> int -> llmodule ->
+ llvalue
+ = "llvm_define_qualified_global"
+
(** [lookup_global name m] returns [Some g] if a global variable with name
[name] exists in module [m]. If no such global exists, returns [None].
See the [llvm::GlobalVariable] constructor. *)
@@ -1008,6 +1179,15 @@ external is_thread_local : llvalue -> bool = "llvm_is_thread_local"
external set_thread_local : bool -> llvalue -> unit = "llvm_set_thread_local"
+(** {7 Operations on aliases} *)
+
+(** [add_alias m t a n] inserts an alias in the module [m] with the type [t] and
+ the aliasee [a] with the name [n].
+ See the constructor for [llvm::GlobalAlias]. *)
+external add_alias : llmodule -> lltype -> llvalue -> string -> llvalue
+ = "llvm_add_alias"
+
+
(** {7 Operations on functions} *)
(** [declare_function name ty m] returns a new function of type [ty] and
@@ -1397,6 +1577,30 @@ external insertion_block : llbuilder -> llbasicblock = "llvm_insertion_block"
external insert_into_builder : llvalue -> string -> llbuilder -> unit
= "llvm_insert_into_builder"
+(** {7 Metadata} *)
+
+(** [set_current_debug_location b md] sets the current debug location [md] in
+ the builder [b].
+ See the method [llvm::IRBuilder::SetDebugLocation]. *)
+external set_current_debug_location : llbuilder -> llvalue -> unit
+ = "llvm_set_current_debug_location"
+
+(** [clear_current_debug_location b] clears the current debug location in the
+ builder [b]. *)
+external clear_current_debug_location : llbuilder -> unit
+ = "llvm_clear_current_debug_location"
+
+(** [current_debug_location b] returns the current debug location, or None
+ if none is currently set.
+ See the method [llvm::IRBuilder::GetDebugLocation]. *)
+external current_debug_location : llbuilder -> llvalue option
+ = "llvm_current_debug_location"
+
+(** [set_inst_debug_location b i] sets the current debug location of the builder
+ [b] to the instruction [i].
+ See the method [llvm::IRBuilder::SetInstDebugLocation]. *)
+external set_inst_debug_location : llbuilder -> llvalue -> unit
+ = "llvm_set_inst_debug_location"
(** {7 Terminators} *)
@@ -1446,6 +1650,20 @@ external build_switch : llvalue -> llbasicblock -> int -> llbuilder -> llvalue
external add_case : llvalue -> llvalue -> llbasicblock -> unit
= "llvm_add_case"
+(** [build_indirect_br addr count b] creates a
+ [indirectbr %addr]
+ instruction at the position specified by the instruction builder [b] with
+ space reserved for [count] destinations.
+ See the method [llvm::LLVMBuilder::CreateIndirectBr]. *)
+external build_indirect_br : llvalue -> int -> llbuilder -> llvalue
+ = "llvm_build_indirect_br"
+
+(** [add_destination br bb] adds the basic block [bb] as a possible branch
+ location for the indirectbr instruction [br].
+ See the method [llvm::IndirectBrInst::addDestination]. **)
+external add_destination : llvalue -> llbasicblock -> unit
+ = "llvm_add_destination"
+
(** [build_invoke fn args tobb unwindbb name b] creates an
[%name = invoke %fn(args) to %tobb unwind %unwindbb]
instruction at the position specified by the instruction builder [b].
@@ -1483,6 +1701,13 @@ external build_add : llvalue -> llvalue -> string -> llbuilder -> llvalue
external build_nsw_add : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_nsw_add"
+(** [build_nuw_add x y name b] creates a
+ [%name = nuw add %x, %y]
+ instruction at the position specified by the instruction builder [b].
+ See the method [llvm::LLVMBuilder::CreateNUWAdd]. *)
+external build_nuw_add : llvalue -> llvalue -> string -> llbuilder -> llvalue
+ = "llvm_build_nuw_add"
+
(** [build_fadd x y name b] creates a
[%name = fadd %x, %y]
instruction at the position specified by the instruction builder [b].
@@ -1497,6 +1722,20 @@ external build_fadd : llvalue -> llvalue -> string -> llbuilder -> llvalue
external build_sub : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_sub"
+(** [build_nsw_sub x y name b] creates a
+ [%name = nsw sub %x, %y]
+ instruction at the position specified by the instruction builder [b].
+ See the method [llvm::LLVMBuilder::CreateNSWSub]. *)
+external build_nsw_sub : llvalue -> llvalue -> string -> llbuilder -> llvalue
+ = "llvm_build_nsw_sub"
+
+(** [build_nuw_sub x y name b] creates a
+ [%name = nuw sub %x, %y]
+ instruction at the position specified by the instruction builder [b].
+ See the method [llvm::LLVMBuilder::CreateNUWSub]. *)
+external build_nuw_sub : llvalue -> llvalue -> string -> llbuilder -> llvalue
+ = "llvm_build_nuw_sub"
+
(** [build_fsub x y name b] creates a
[%name = fsub %x, %y]
instruction at the position specified by the instruction builder [b].
@@ -1511,6 +1750,20 @@ external build_fsub : llvalue -> llvalue -> string -> llbuilder -> llvalue
external build_mul : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_mul"
+(** [build_nsw_mul x y name b] creates a
+ [%name = nsw mul %x, %y]
+ instruction at the position specified by the instruction builder [b].
+ See the method [llvm::LLVMBuilder::CreateNSWMul]. *)
+external build_nsw_mul : llvalue -> llvalue -> string -> llbuilder -> llvalue
+ = "llvm_build_nsw_mul"
+
+(** [build_nuw_mul x y name b] creates a
+ [%name = nuw mul %x, %y]
+ instruction at the position specified by the instruction builder [b].
+ See the method [llvm::LLVMBuilder::CreateNUWMul]. *)
+external build_nuw_mul : llvalue -> llvalue -> string -> llbuilder -> llvalue
+ = "llvm_build_nuw_mul"
+
(** [build_fmul x y name b] creates a
[%name = fmul %x, %y]
instruction at the position specified by the instruction builder [b].
@@ -1617,6 +1870,30 @@ external build_xor : llvalue -> llvalue -> string -> llbuilder -> llvalue
external build_neg : llvalue -> string -> llbuilder -> llvalue
= "llvm_build_neg"
+(** [build_nsw_neg x name b] creates a
+ [%name = nsw sub 0, %x]
+ instruction at the position specified by the instruction builder [b].
+ [-0.0] is used for floating point types to compute the correct sign.
+ See the method [llvm::LLVMBuilder::CreateNeg]. *)
+external build_nsw_neg : llvalue -> string -> llbuilder -> llvalue
+ = "llvm_build_nsw_neg"
+
+(** [build_nuw_neg x name b] creates a
+ [%name = nuw sub 0, %x]
+ instruction at the position specified by the instruction builder [b].
+ [-0.0] is used for floating point types to compute the correct sign.
+ See the method [llvm::LLVMBuilder::CreateNeg]. *)
+external build_nuw_neg : llvalue -> string -> llbuilder -> llvalue
+ = "llvm_build_nuw_neg"
+
+(** [build_fneg x name b] creates a
+ [%name = fsub 0, %x]
+ instruction at the position specified by the instruction builder [b].
+ [-0.0] is used for floating point types to compute the correct sign.
+ See the method [llvm::LLVMBuilder::CreateFNeg]. *)
+external build_fneg : llvalue -> string -> llbuilder -> llvalue
+ = "llvm_build_fneg"
+
(** [build_xor x name b] creates a
[%name = xor %x, -1]
instruction at the position specified by the instruction builder [b].
@@ -1628,20 +1905,6 @@ external build_not : llvalue -> string -> llbuilder -> llvalue
(** {7 Memory} *)
-(** [build_malloc ty name b] creates a
- [%name = malloc %ty]
- instruction at the position specified by the instruction builder [b].
- See the method [llvm::LLVMBuilder::CreateAlloca]. *)
-external build_malloc : lltype -> string -> llbuilder -> llvalue
- = "llvm_build_malloc"
-
-(** [build_array_malloc ty n name b] creates a
- [%name = malloc %ty, %n]
- instruction at the position specified by the instruction builder [b].
- See the method [llvm::LLVMBuilder::CreateMalloc]. *)
-external build_array_malloc : lltype -> llvalue -> string -> llbuilder ->
- llvalue = "llvm_build_array_malloc"
-
(** [build_alloca ty name b] creates a
[%name = alloca %ty]
instruction at the position specified by the instruction builder [b].
@@ -1656,12 +1919,6 @@ external build_alloca : lltype -> string -> llbuilder -> llvalue
external build_array_alloca : lltype -> llvalue -> string -> llbuilder ->
llvalue = "llvm_build_array_alloca"
-(** [build_free v b] creates a
- [free %v]
- instruction at the position specified by the instruction builder [b].
- See the method [llvm::LLVMBuilder::CreateFree]. *)
-external build_free : llvalue -> llbuilder -> llvalue = "llvm_build_free"
-
(** [build_load v name b] creates a
[%name = load %v]
instruction at the position specified by the instruction builder [b].
@@ -1938,20 +2195,6 @@ external build_is_not_null : llvalue -> string -> llbuilder -> llvalue
external build_ptrdiff : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_ptrdiff"
-(** {6 Module providers} *)
-
-module ModuleProvider : sig
- (** [create_module_provider m] encapsulates [m] in a module provider and takes
- ownership of the module. See the constructor
- [llvm::ExistingModuleProvider::ExistingModuleProvider]. *)
- external create : llmodule -> llmoduleprovider
- = "LLVMCreateModuleProviderForExistingModule"
-
- (** [dispose_module_provider mp] destroys the module provider [mp] as well as
- the contained module. *)
- external dispose : llmoduleprovider -> unit = "llvm_dispose_module_provider"
-end
-
(** {6 Memory buffers} *)
@@ -1983,12 +2226,12 @@ module PassManager : sig
See the constructor of [llvm::PassManager]. *)
external create : unit -> [ `Module ] t = "llvm_passmanager_create"
- (** [PassManager.create_function mp] constructs a new function-by-function
- pass pipeline over the module provider [mp]. It does not take ownership of
- [mp]. This type of pipeline is suitable for code generation and JIT
- compilation tasks.
+ (** [PassManager.create_function m] constructs a new function-by-function
+ pass pipeline over the module [m]. It does not take ownership of [m].
+ This type of pipeline is suitable for code generation and JIT compilation
+ tasks.
See the constructor of [llvm::FunctionPassManager]. *)
- external create_function : llmoduleprovider -> [ `Function ] t
+ external create_function : llmodule -> [ `Function ] t
= "LLVMCreateFunctionPassManager"
(** [run_module m pm] initializes, executes on the module [m], and finalizes
@@ -2018,7 +2261,7 @@ module PassManager : sig
external finalize : [ `Function ] t -> bool = "llvm_passmanager_finalize"
(** Frees the memory of a pass pipeline. For function pipelines, does not free
- the module provider.
+ the module.
See the destructor of [llvm::BasePassManager]. *)
external dispose : [< any ] t -> unit = "llvm_passmanager_dispose"
end
diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c
index 86492d7fbbe..d526a05a510 100644
--- a/bindings/ocaml/llvm/llvm_ocaml.c
+++ b/bindings/ocaml/llvm/llvm_ocaml.c
@@ -110,6 +110,13 @@ CAMLprim LLVMContextRef llvm_global_context(value Unit) {
return LLVMGetGlobalContext();
}
+/* llcontext -> string -> int */
+CAMLprim value llvm_mdkind_id(LLVMContextRef C, value Name) {
+ unsigned MDKindID = LLVMGetMDKindIDInContext(C, String_val(Name),
+ caml_string_length(Name));
+ return Val_int(MDKindID);
+}
+
/*===-- Modules -----------------------------------------------------------===*/
/* llcontext -> string -> llmodule */
@@ -157,6 +164,18 @@ CAMLprim value llvm_delete_type_name(value Name, LLVMModuleRef M) {
return Val_unit;
}
+/* llmodule -> string -> lltype option */
+CAMLprim value llvm_type_by_name(LLVMModuleRef M, value Name) {
+ CAMLparam1(Name);
+ LLVMTypeRef T;
+ if ((T = LLVMGetTypeByName(M, String_val(Name)))) {
+ value Option = alloc(1, 0);
+ Field(Option, 0) = (value) T;
+ CAMLreturn(Option);
+ }
+ CAMLreturn(Val_int(0));
+}
+
/* llmodule -> unit */
CAMLprim value llvm_dump_module(LLVMModuleRef M) {
LLVMDumpModule(M);
@@ -283,7 +302,7 @@ CAMLprim LLVMTypeRef llvm_packed_struct_type(LLVMContextRef C,
}
/* lltype -> lltype array */
-CAMLprim value llvm_element_types(LLVMTypeRef StructTy) {
+CAMLprim value llvm_struct_element_types(LLVMTypeRef StructTy) {
value Tys = alloc(LLVMCountStructElementTypes(StructTy), 0);
LLVMGetStructElementTypes(StructTy, (LLVMTypeRef *) Tys);
return Tys;
@@ -294,6 +313,21 @@ CAMLprim value llvm_is_packed(LLVMTypeRef StructTy) {
return Val_bool(LLVMIsPackedStruct(StructTy));
}
+/*--... Operations on union types ..........................................--*/
+
+/* llcontext -> lltype array -> lltype */
+CAMLprim LLVMTypeRef llvm_union_type(LLVMContextRef C, value ElementTypes) {
+ return LLVMUnionTypeInContext(C, (LLVMTypeRef *) ElementTypes,
+ Wosize_val(ElementTypes));
+}
+
+/* lltype -> lltype array */
+CAMLprim value llvm_union_element_types(LLVMTypeRef UnionTy) {
+ value Tys = alloc(LLVMCountUnionElementTypes(UnionTy), 0);
+ LLVMGetUnionElementTypes(UnionTy, (LLVMTypeRef *) Tys);
+ return Tys;
+}
+
/*--... Operations on array, pointer, and vector types .....................--*/
/* lltype -> int -> lltype */
@@ -406,6 +440,13 @@ CAMLprim value llvm_dump_value(LLVMValueRef Val) {
return Val_unit;
}
+/*--... Operations on users ................................................--*/
+
+/* llvalue -> int -> llvalue */
+CAMLprim LLVMValueRef llvm_operand(LLVMValueRef V, value I) {
+ return LLVMGetOperand(V, Int_val(I));
+}
+
/*--... Operations on constants of (mostly) any type .......................--*/
/* llvalue -> bool */
@@ -423,6 +464,52 @@ CAMLprim value llvm_is_undef(LLVMValueRef Val) {
return Val_bool(LLVMIsUndef(Val));
}
+/*--... Operations on instructions .........................................--*/
+
+/* llvalue -> bool */
+CAMLprim value llvm_has_metadata(LLVMValueRef Val) {
+ return Val_bool(LLVMHasMetadata(Val));
+}
+
+/* llvalue -> int -> llvalue option */
+CAMLprim value llvm_metadata(LLVMValueRef Val, value MDKindID) {
+ CAMLparam1(MDKindID);
+ LLVMValueRef MD;
+ if ((MD = LLVMGetMetadata(Val, Int_val(MDKindID)))) {
+ value Option = alloc(1, 0);
+ Field(Option, 0) = (value) MD;
+ CAMLreturn(Option);
+ }
+ CAMLreturn(Val_int(0));
+}
+
+/* llvalue -> int -> llvalue -> unit */
+CAMLprim value llvm_set_metadata(LLVMValueRef Val, value MDKindID,
+ LLVMValueRef MD) {
+ LLVMSetMetadata(Val, Int_val(MDKindID), MD);
+ return Val_unit;
+}
+
+/* llvalue -> int -> unit */
+CAMLprim value llvm_clear_metadata(LLVMValueRef Val, value MDKindID) {
+ LLVMSetMetadata(Val, Int_val(MDKindID), NULL);
+ return Val_unit;
+}
+
+
+/*--... Operations on metadata .............................................--*/
+
+/* llcontext -> string -> llvalue */
+CAMLprim LLVMValueRef llvm_mdstring(LLVMContextRef C, value S) {
+ return LLVMMDStringInContext(C, String_val(S), caml_string_length(S));
+}
+
+/* llcontext -> llvalue array -> llvalue */
+CAMLprim LLVMValueRef llvm_mdnode(LLVMContextRef C, value ElementVals) {
+ return LLVMMDNodeInContext(C, (LLVMValueRef*) Op_val(ElementVals),
+ Wosize_val(ElementVals));
+}
+
/*--... Operations on scalar constants .....................................--*/
/* lltype -> int -> llvalue */
@@ -561,6 +648,14 @@ CAMLprim LLVMValueRef llvm_const_insertvalue(LLVMValueRef Aggregate,
CAMLreturnT(LLVMValueRef, result);
}
+/* lltype -> string -> string -> bool -> bool -> llvalue */
+CAMLprim LLVMValueRef llvm_const_inline_asm(LLVMTypeRef Ty, value Asm,
+ value Constraints, value HasSideEffects,
+ value IsAlignStack) {
+ return LLVMConstInlineAsm(Ty, String_val(Asm), String_val(Constraints),
+ Bool_val(HasSideEffects), Bool_val(IsAlignStack));
+}
+
/*--... Operations on global variables, functions, and aliases (globals) ...--*/
/* llvalue -> bool */
@@ -612,6 +707,42 @@ CAMLprim value llvm_set_alignment(value Bytes, LLVMValueRef Global) {
return Val_unit;
}
+/*--... Operations on uses .................................................--*/
+
+/* llvalue -> lluse option */
+CAMLprim value llvm_use_begin(LLVMValueRef Val) {
+ CAMLparam0();
+ LLVMUseRef First;
+ if ((First = LLVMGetFirstUse(Val))) {
+ value Option = alloc(1, 0);
+ Field(Option, 0) = (value) First;
+ CAMLreturn(Option);
+ }
+ CAMLreturn(Val_int(0));
+}
+
+/* lluse -> lluse option */
+CAMLprim value llvm_use_succ(LLVMUseRef U) {
+ CAMLparam0();
+ LLVMUseRef Next;
+ if ((Next = LLVMGetNextUse(U))) {
+ value Option = alloc(1, 0);
+ Field(Option, 0) = (value) Next;
+ CAMLreturn(Option);
+ }
+ CAMLreturn(Val_int(0));
+}
+
+/* lluse -> llvalue */
+CAMLprim LLVMValueRef llvm_user(LLVMUseRef UR) {
+ return LLVMGetUser(UR);
+}
+
+/* lluse -> llvalue */
+CAMLprim LLVMValueRef llvm_used_value(LLVMUseRef UR) {
+ return LLVMGetUsedValue(UR);
+}
+
/*--... Operations on global variables .....................................--*/
DEFINE_ITERATORS(global, Global, LLVMModuleRef, LLVMValueRef,
@@ -629,6 +760,20 @@ CAMLprim LLVMValueRef llvm_declare_global(LLVMTypeRef Ty, value Name,
return LLVMAddGlobal(M, Ty, String_val(Name));
}
+/* lltype -> string -> int -> llmodule -> llvalue */
+CAMLprim LLVMValueRef llvm_declare_qualified_global(LLVMTypeRef Ty, value Name,
+ value AddressSpace,
+ LLVMModuleRef M) {
+ LLVMValueRef GlobalVar;
+ if ((GlobalVar = LLVMGetNamedGlobal(M, String_val(Name)))) {
+ if (LLVMGetElementType(LLVMTypeOf(GlobalVar)) != Ty)
+ return LLVMConstBitCast(GlobalVar,
+ LLVMPointerType(Ty, Int_val(AddressSpace)));
+ return GlobalVar;
+ }
+ return LLVMAddGlobal(M, Ty, String_val(Name));
+}
+
/* string -> llmodule -> llvalue option */
CAMLprim value llvm_lookup_global(value Name, LLVMModuleRef M) {
CAMLparam1(Name);
@@ -650,6 +795,19 @@ CAMLprim LLVMValueRef llvm_define_global(value Name, LLVMValueRef Initializer,
return GlobalVar;
}
+/* string -> llvalue -> int -> llmodule -> llvalue */
+CAMLprim LLVMValueRef llvm_define_qualified_global(value Name,
+ LLVMValueRef Initializer,
+ value AddressSpace,
+ LLVMModuleRef M) {
+ LLVMValueRef GlobalVar = LLVMAddGlobalInAddressSpace(M,
+ LLVMTypeOf(Initializer),
+ String_val(Name),
+ Int_val(AddressSpace));
+ LLVMSetInitializer(GlobalVar, Initializer);
+ return GlobalVar;
+}
+
/* llvalue -> unit */
CAMLprim value llvm_delete_global(LLVMValueRef GlobalVar) {
LLVMDeleteGlobal(GlobalVar);
@@ -692,6 +850,13 @@ CAMLprim value llvm_set_global_constant(value Flag, LLVMValueRef GlobalVar) {
return Val_unit;
}
+/*--... Operations on aliases ..............................................--*/
+
+CAMLprim LLVMValueRef llvm_add_alias(LLVMModuleRef M, LLVMTypeRef Ty,
+ LLVMValueRef Aliasee, value Name) {
+ return LLVMAddAlias(M, Ty, Aliasee, String_val(Name));
+}
+
/*--... Operations on functions ............................................--*/
DEFINE_ITERATORS(function, Function, LLVMModuleRef, LLVMValueRef,
@@ -978,7 +1143,7 @@ CAMLprim value llvm_position_builder(value Pos, value B) {
}
/* llbuilder -> llbasicblock */
-CAMLprim LLVMBasicBlockRef llvm_insertion_block(LLVMBuilderRef B) {
+CAMLprim LLVMBasicBlockRef llvm_insertion_block(value B) {
LLVMBasicBlockRef InsertBlock = LLVMGetInsertBlock(Builder_val(B));
if (!InsertBlock)
raise_not_found();
@@ -986,12 +1151,44 @@ CAMLprim LLVMBasicBlockRef llvm_insertion_block(LLVMBuilderRef B) {
}
/* llvalue -> string -> llbuilder -> unit */
-CAMLprim value llvm_insert_into_builder(LLVMValueRef I, value Name,
- LLVMBuilderRef B) {
- LLVMInsertIntoBuilderWithName(B, I, String_val(Name));
+CAMLprim value llvm_insert_into_builder(LLVMValueRef I, value Name, value B) {
+ LLVMInsertIntoBuilderWithName(Builder_val(B), I, String_val(Name));
return Val_unit;
}
+/*--... Metadata ...........................................................--*/
+
+/* llbuilder -> llvalue -> unit */
+CAMLprim value llvm_set_current_debug_location(value B, LLVMValueRef V) {
+ LLVMSetCurrentDebugLocation(Builder_val(B), V);
+ return Val_unit;
+}
+
+/* llbuilder -> unit */
+CAMLprim value llvm_clear_current_debug_location(value B) {
+ LLVMSetCurrentDebugLocation(Builder_val(B), NULL);
+ return Val_unit;
+}
+
+/* llbuilder -> llvalue option */
+CAMLprim value llvm_current_debug_location(value B) {
+ CAMLparam0();
+ LLVMValueRef L;
+ if ((L = LLVMGetCurrentDebugLocation(Builder_val(B)))) {
+ value Option = alloc(1, 0);
+ Field(Option, 0) = (value) L;
+ CAMLreturn(Option);
+ }
+ CAMLreturn(Val_int(0));
+}
+
+/* llbuilder -> llvalue -> unit */
+CAMLprim value llvm_set_inst_debug_location(value B, LLVMValueRef V) {
+ LLVMSetInstDebugLocation(Builder_val(B), V);
+ return Val_unit;
+}
+
+
/*--... Terminators ........................................................--*/
/* llbuilder -> llvalue */
@@ -1038,6 +1235,20 @@ CAMLprim value llvm_add_case(LLVMValueRef Switch, LLVMValueRef OnVal,
return Val_unit;
}
+/* llvalue -> llbasicblock -> llbuilder -> llvalue */
+CAMLprim LLVMValueRef llvm_build_indirect_br(LLVMValueRef Addr,
+ value EstimatedDests,
+ value B) {
+ return LLVMBuildIndirectBr(Builder_val(B), Addr, EstimatedDests);
+}
+
+/* llvalue -> llvalue -> llbasicblock -> unit */
+CAMLprim value llvm_add_destination(LLVMValueRef IndirectBr,
+ LLVMBasicBlockRef Dest) {
+ LLVMAddDestination(IndirectBr, Dest);
+ return Val_unit;
+}
+
/* llvalue -> llvalue array -> llbasicblock -> llbasicblock -> string ->
llbuilder -> llvalue */
CAMLprim LLVMValueRef llvm_build_invoke_nat(LLVMValueRef Fn, value Args,
@@ -1081,6 +1292,12 @@ CAMLprim LLVMValueRef llvm_build_nsw_add(LLVMValueRef LHS, LLVMValueRef RHS,
return LLVMBuildNSWAdd(Builder_val(B), LHS, RHS, String_val(Name));
}
+/* llvalue -> llvalue -> string -> llbuilder -> llvalue */
+CAMLprim LLVMValueRef llvm_build_nuw_add(LLVMValueRef LHS, LLVMValueRef RHS,
+ value Name, value B) {
+ return LLVMBuildNUWAdd(Builder_val(B), LHS, RHS, String_val(Name));
+}
+
/* llvalue -> llvalue -> string -> llbuilder -> llvalue */
CAMLprim LLVMValueRef llvm_build_fadd(LLVMValueRef LHS, LLVMValueRef RHS,
value Name, value B) {
@@ -1093,6 +1310,18 @@ CAMLprim LLVMValueRef llvm_build_sub(LLVMValueRef LHS, LLVMValueRef RHS,
return LLVMBuildSub(Builder_val(B), LHS, RHS, String_val(Name));
}
+/* llvalue -> llvalue -> string -> llbuilder -> llvalue */
+CAMLprim LLVMValueRef llvm_build_nsw_sub(LLVMValueRef LHS, LLVMValueRef RHS,
+ value Name, value B) {
+ return LLVMBuildNSWSub(Builder_val(B), LHS, RHS, String_val(Name));
+}
+
+/* llvalue -> llvalue -> string -> llbuilder -> llvalue */
+CAMLprim LLVMValueRef llvm_build_nuw_sub(LLVMValueRef LHS, LLVMValueRef RHS,
+ value Name, value B) {
+ return LLVMBuildNUWSub(Builder_val(B), LHS, RHS, String_val(Name));
+}
+
/* llvalue -> llvalue -> string -> llbuilder -> llvalue */
CAMLprim LLVMValueRef llvm_build_fsub(LLVMValueRef LHS, LLVMValueRef RHS,
value Name, value B) {
@@ -1105,6 +1334,18 @@ CAMLprim LLVMValueRef llvm_build_mul(LLVMValueRef LHS, LLVMValueRef RHS,
return LLVMBuildMul(Builder_val(B), LHS, RHS, String_val(Name));
}
+/* llvalue -> llvalue -> string -> llbuilder -> llvalue */
+CAMLprim LLVMValueRef llvm_build_nsw_mul(LLVMValueRef LHS, LLVMValueRef RHS,
+ value Name, value B) {
+ return LLVMBuildNSWMul(Builder_val(B), LHS, RHS, String_val(Name));
+}
+
+/* llvalue -> llvalue -> string -> llbuilder -> llvalue */
+CAMLprim LLVMValueRef llvm_build_nuw_mul(LLVMValueRef LHS, LLVMValueRef RHS,
+ value Name, value B) {
+ return LLVMBuildNUWMul(Builder_val(B), LHS, RHS, String_val(Name));
+}
+
/* llvalue -> llvalue -> string -> llbuilder -> llvalue */
CAMLprim LLVMValueRef llvm_build_fmul(LLVMValueRef LHS, LLVMValueRef RHS,
value Name, value B) {
@@ -1195,6 +1436,24 @@ CAMLprim LLVMValueRef llvm_build_neg(LLVMValueRef X,
return LLVMBuildNeg(Builder_val(B), X, String_val(Name));
}
+/* llvalue -> string -> llbuilder -> llvalue */
+CAMLprim LLVMValueRef llvm_build_nsw_neg(LLVMValueRef X,
+ value Name, value B) {
+ return LLVMBuildNSWNeg(Builder_val(B), X, String_val(Name));
+}
+
+/* llvalue -> string -> llbuilder -> llvalue */
+CAMLprim LLVMValueRef llvm_build_nuw_neg(LLVMValueRef X,
+ value Name, value B) {
+ return LLVMBuildNUWNeg(Builder_val(B), X, String_val(Name));
+}
+
+/* llvalue -> string -> llbuilder -> llvalue */
+CAMLprim LLVMValueRef llvm_build_fneg(LLVMValueRef X,
+ value Name, value B) {
+ return LLVMBuildFNeg(Builder_val(B), X, String_val(Name));
+}
+
/* llvalue -> string -> llbuilder -> llvalue */
CAMLprim LLVMValueRef llvm_build_not(LLVMValueRef X,
value Name, value B) {
@@ -1203,18 +1462,6 @@ CAMLprim LLVMValueRef llvm_build_not(LLVMValueRef X,
/*--... Memory .............................................................--*/
-/* lltype -> string -> llbuilder -> llvalue */
-CAMLprim LLVMValueRef llvm_build_malloc(LLVMTypeRef Ty,
- value Name, value B) {
- return LLVMBuildMalloc(Builder_val(B), Ty, String_val(Name));
-}
-
-/* lltype -> llvalue -> string -> llbuilder -> llvalue */
-CAMLprim LLVMValueRef llvm_build_array_malloc(LLVMTypeRef Ty, LLVMValueRef Size,
- value Name, value B) {
- return LLVMBuildArrayMalloc(Builder_val(B), Ty, Size, String_val(Name));
-}
-
/* lltype -> string -> llbuilder -> llvalue */
CAMLprim LLVMValueRef llvm_build_alloca(LLVMTypeRef Ty,
value Name, value B) {
@@ -1227,11 +1474,6 @@ CAMLprim LLVMValueRef llvm_build_array_alloca(LLVMTypeRef Ty, LLVMValueRef Size,
return LLVMBuildArrayAlloca(Builder_val(B), Ty, Size, String_val(Name));
}
-/* llvalue -> llbuilder -> llvalue */
-CAMLprim LLVMValueRef llvm_build_free(LLVMValueRef Pointer, value B) {
- return LLVMBuildFree(Builder_val(B), Pointer);
-}
-
/* llvalue -> string -> llbuilder -> llvalue */
CAMLprim LLVMValueRef llvm_build_load(LLVMValueRef Pointer,
value Name, value B) {
@@ -1510,14 +1752,6 @@ CAMLprim LLVMValueRef llvm_build_ptrdiff(LLVMValueRef LHS, LLVMValueRef RHS,
return LLVMBuildPtrDiff(Builder_val(B), LHS, RHS, String_val(Name));
}
-/*===-- Module Providers --------------------------------------------------===*/
-
-/* llmoduleprovider -> unit */
-CAMLprim value llvm_dispose_module_provider(LLVMModuleProviderRef MP) {
- LLVMDisposeModuleProvider(MP);
- return Val_unit;
-}
-
/*===-- Memory buffers ----------------------------------------------------===*/
diff --git a/configure b/configure
index 88050f310ca..2b597a12dbb 100755
--- a/configure
+++ b/configure
@@ -689,12 +689,16 @@ TARGET_HAS_JIT
ENABLE_DOXYGEN
ENABLE_THREADS
ENABLE_PIC
+ENABLE_SHARED
TARGETS_TO_BUILD
LLVM_ENUM_TARGETS
LLVM_ENUM_ASM_PRINTERS
LLVM_ENUM_ASM_PARSERS
LLVM_ENUM_DISASSEMBLERS
ENABLE_CBE_PRINTF_A
+CLANGPATH
+CLANGXXPATH
+ENABLE_BUILT_CLANG
OPTIMIZE_OPTION
EXTRA_OPTIONS
BINUTILS_INCDIR
@@ -754,6 +758,7 @@ LLVMGCCCOMMAND
LLVMGXXCOMMAND
LLVMGCC
LLVMGXX
+LLVMCC_OPTION
NO_VARIADIC_MACROS
NO_MISSING_FIELD_INITIALIZERS
USE_UDIS86
@@ -764,11 +769,9 @@ MMAP_FILE
LLVMCC1
LLVMCC1PLUS
LLVMGCCDIR
-LLVMGCCLIBEXEC
-LLVMGCC_VERSION
-LLVMGCC_MAJVERS
LLVMGCC_LANGS
SHLIBEXT
+SHLIBPATH_VAR
LLVM_PREFIX
LLVM_BINDIR
LLVM_LIBDIR
@@ -810,6 +813,7 @@ projects/llvm-java
projects/llvm-tv
projects/llvm-poolalloc
projects/poolalloc
+projects/safecode
projects/llvm-kernel'
# Initialize some variables set by options.
@@ -1401,6 +1405,8 @@ Optional Features:
--enable-threads Use threads if available (default is YES)
--enable-pic Build LLVM with Position Independent Code (default
is YES)
+ --enable-shared Build a shared library and link tools against it
+ (default is NO)
--enable-targets Build specific host targets: all or
target1,target2,... Valid targets are: host, x86,
x86_64, sparc, powerpc, alpha, arm, mips, spu,
@@ -1426,6 +1432,10 @@ Optional Packages:
searches PATH)
--with-llvmgxx Specify location of llvm-g++ driver (default
searches PATH)
+ --with-clang Specify location of clang compiler (default is
+ --with-built-clang)
+ --with-built-clang Use the compiled Clang as the LLVM compiler
+ (default=check)
--with-optimize-option Select the compiler options to use for optimized
builds
--with-extra-options Specify additional options to compile LLVM with
@@ -1442,6 +1452,8 @@ Optional Packages:
--with-binutils-include Specify path to binutils/include/ containing
plugin-api.h file for gold plugin.
--with-tclinclude directory where tcl headers are
+ --with-llvmcc= Choose the LLVM capable compiler to use (llvm-gcc,
+ clang, or none; default=check)
--with-udis86= Use udis86 external x86 disassembler library
--with-oprofile=
Tell OProfile >= 0.9.4 how to symbolize JIT output
@@ -1967,6 +1979,8 @@ do
llvm-poolalloc) subdirs="$subdirs projects/llvm-poolalloc"
;;
poolalloc) subdirs="$subdirs projects/poolalloc"
+ ;;
+ safecode) subdirs="$subdirs projects/safecode"
;;
llvm-kernel) subdirs="$subdirs projects/llvm-kernel"
;;
@@ -2320,6 +2334,7 @@ else
msp430-*) llvm_cv_target_arch="MSP430" ;;
s390x-*) llvm_cv_target_arch="SystemZ" ;;
bfin-*) llvm_cv_target_arch="Blackfin" ;;
+ mblaze-*) llvm_cv_target_arch="MBlaze" ;;
*) llvm_cv_target_arch="Unknown" ;;
esac
fi
@@ -4784,6 +4799,8 @@ else
SystemZ) TARGET_HAS_JIT=0
;;
Blackfin) TARGET_HAS_JIT=0
+ ;;
+ MBlaze) TARGET_HAS_JIT=0
;;
*) TARGET_HAS_JIT=0
;;
@@ -4857,6 +4874,25 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+# Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval=$enable_shared;
+else
+ enableval=default
+fi
+
+case "$enableval" in
+ yes) ENABLE_SHARED=1
+ ;;
+ no) ENABLE_SHARED=0
+ ;;
+ default) ENABLE_SHARED=0
+ ;;
+ *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-shared. Use \"yes\" or \"no\"" >&5
+echo "$as_me: error: Invalid setting for --enable-shared. Use \"yes\" or \"no\"" >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+
TARGETS_TO_BUILD=""
# Check whether --enable-targets was given.
if test "${enable_targets+set}" = set; then
@@ -4869,7 +4905,7 @@ if test "$enableval" = host-only ; then
enableval=host
fi
case "$enableval" in
- all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha ARM Mips CellSPU PIC16 XCore MSP430 SystemZ Blackfin CBackend MSIL CppBackend" ;;
+ all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha ARM Mips CellSPU PIC16 XCore MSP430 SystemZ Blackfin CBackend MSIL CppBackend MBlaze" ;;
*)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do
case "$a_target" in
x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
@@ -4888,6 +4924,7 @@ case "$enableval" in
cbe) TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD" ;;
msil) TARGETS_TO_BUILD="MSIL $TARGETS_TO_BUILD" ;;
cpp) TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;;
+ mblaze) TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;;
host) case "$llvm_cv_target_arch" in
x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
@@ -4896,6 +4933,7 @@ case "$enableval" in
Alpha) TARGETS_TO_BUILD="Alpha $TARGETS_TO_BUILD" ;;
ARM) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
Mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
+ MBlaze) TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;;
CellSPU|SPU) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;;
PIC16) TARGETS_TO_BUILD="PIC16 $TARGETS_TO_BUILD" ;;
XCore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;;
@@ -5029,6 +5067,69 @@ echo "$as_me: error: Invalid llvm-gcc. Use --with-llvmgcc when --with-llvmgxx is
fi
+# Check whether --with-clang was given.
+if test "${with_clang+set}" = set; then
+ withval=$with_clang;
+else
+ with_clang=default
+fi
+
+
+
+# Check whether --with-built-clang was given.
+if test "${with_built_clang+set}" = set; then
+ withval=$with_built_clang;
+else
+ with_built_clang=check
+fi
+
+
+{ echo "$as_me:$LINENO: checking clang compiler" >&5
+echo $ECHO_N "checking clang compiler... $ECHO_C" >&6; }
+WITH_CLANGPATH=""
+WITH_BUILT_CLANG=0
+if test "$with_clang" != "default"; then
+ WITH_CLANGPATH="$with_clang"
+ if ! test -x "$WITH_CLANGPATH"; then
+ { { echo "$as_me:$LINENO: error: invalid --with-clang, path does not specify an executable" >&5
+echo "$as_me: error: invalid --with-clang, path does not specify an executable" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+elif test "$with_built_clang" = "yes"; then
+ WITH_BUILT_CLANG=1
+elif test "$with_built_clang" = "no"; then
+ WITH_BUILT_CLANG=0
+else
+ if test "$with_built_clang" != "check"; then
+ { { echo "$as_me:$LINENO: error: invalid value for --with-built-clang." >&5
+echo "$as_me: error: invalid value for --with-built-clang." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ if test -f ${srcdir}/tools/clang/README.txt; then
+ WITH_BUILT_CLANG=1
+ fi
+fi
+
+if ! test -z "$WITH_CLANGPATH"; then
+ { echo "$as_me:$LINENO: result: $WITH_CLANGPATH" >&5
+echo "${ECHO_T}$WITH_CLANGPATH" >&6; }
+ WITH_CLANGXXPATH=`"$WITH_CLANGPATH" --print-prog-name=clang++`
+elif test "$WITH_BUILT_CLANG" = "1"; then
+ { echo "$as_me:$LINENO: result: built" >&5
+echo "${ECHO_T}built" >&6; }
+else
+ { echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6; }
+fi
+CLANGPATH=$WITH_CLANGPATH
+
+CLANGXXPATH=$WITH_CLANGXXPATH
+
+ENABLE_BUILT_CLANG=$WITH_BUILT_CLANG
+
+
+
# Check whether --with-optimize-option was given.
if test "${with_optimize_option+set}" = set; then
withval=$with_optimize_option;
@@ -11035,7 +11136,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <&5
+echo $ECHO_N "checking LLVM capable compiler... $ECHO_C" >&6; }
+if test "$with_llvmcc" != "check"; then
+ if (test "$with_llvmcc" != "llvm-gcc" &&
+ test "$with_llvmcc" != "clang" &&
+ test "$with_llvmcc" != "none"); then
+ { { echo "$as_me:$LINENO: error: invalid value for --with-llvmcc, expected 'llvm-gcc', 'clang', or 'none'." >&5
+echo "$as_me: error: invalid value for --with-llvmcc, expected 'llvm-gcc', 'clang', or 'none'." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ WITH_LLVMCC="$with_llvmcc"
+elif test -n "$LLVMGCC"; then
+ WITH_LLVMCC=llvm-gcc
+elif test -n "$WITH_CLANGPATH" || test "$WITH_BUILT_CLANG" -ne "0"; then
+ WITH_LLVMCC=clang
+else
+ WITH_LLVMCC=none
+fi
+{ echo "$as_me:$LINENO: result: $WITH_LLVMCC" >&5
+echo "${ECHO_T}$WITH_LLVMCC" >&6; }
+LLVMCC_OPTION=$WITH_LLVMCC
+
+
{ echo "$as_me:$LINENO: checking tool compatibility" >&5
echo $ECHO_N "checking tool compatibility... $ECHO_C" >&6; }
@@ -16413,6 +16544,7 @@ ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+ ac_save_CXXFLAGS=$CXXFLAGS
CXXFLAGS=-pedantic
if test "$cross_compiling" = yes; then
ac_cv_huge_val_sanity=yes
@@ -16465,6 +16597,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$a
fi
+ CXXFLAGS=$ac_save_CXXFLAGS
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -19576,15 +19709,6 @@ echo $ECHO_N "checking llvm-gcc component support... $ECHO_C" >&6; }
llvmgccdir=`echo "$llvmcc1path" | sed 's,/libexec/.*,,'`
LLVMGCCDIR=$llvmgccdir
- llvmgcclibexec=`echo "$llvmcc1path" | sed 's,/cc1,,'`
- LLVMGCCLIBEXEC=$llvmgcclibexec
-
- llvmgccversion=`"$LLVMGCC" -dumpversion 2>&1 | sed 's/^\([0-9.]*\).*/\1/'`
- llvmgccmajvers=`echo $llvmgccversion | sed 's/^\([0-9]\).*/\1/'`
- LLVMGCC_VERSION=$llvmgccversion
-
- LLVMGCC_MAJVERS=$llvmgccmajvers
-
llvmgcclangs=`"$LLVMGCC" -v --help 2>&1 | grep '^Configured with:' | sed 's/^.*--enable-languages=\([^ ]*\).*/\1/'`
LLVMGCC_LANGS=$llvmgcclangs
@@ -19595,6 +19719,9 @@ fi
SHLIBEXT=$libltdl_cv_shlibext
+SHLIBPATH_VAR=$libltdl_cv_shlibpath_var
+
+
# Translate the various configuration directories and other basic
# information into substitutions that will end up in Makefile.config.in
# that these configured values can be used by the makefiles
@@ -19605,7 +19732,7 @@ eval LLVM_PREFIX="${prefix}";
eval LLVM_BINDIR="${prefix}/bin";
eval LLVM_LIBDIR="${prefix}/lib";
eval LLVM_DATADIR="${prefix}/share/llvm";
-eval LLVM_DOCSDIR="${prefix}/docs/llvm";
+eval LLVM_DOCSDIR="${prefix}/share/doc/llvm";
eval LLVM_ETCDIR="${prefix}/etc/llvm";
eval LLVM_INCLUDEDIR="${prefix}/include";
eval LLVM_INFODIR="${prefix}/info";
@@ -20652,16 +20779,16 @@ TARGET_HAS_JIT!$TARGET_HAS_JIT$ac_delim
ENABLE_DOXYGEN!$ENABLE_DOXYGEN$ac_delim
ENABLE_THREADS!$ENABLE_THREADS$ac_delim
ENABLE_PIC!$ENABLE_PIC$ac_delim
+ENABLE_SHARED!$ENABLE_SHARED$ac_delim
TARGETS_TO_BUILD!$TARGETS_TO_BUILD$ac_delim
LLVM_ENUM_TARGETS!$LLVM_ENUM_TARGETS$ac_delim
LLVM_ENUM_ASM_PRINTERS!$LLVM_ENUM_ASM_PRINTERS$ac_delim
LLVM_ENUM_ASM_PARSERS!$LLVM_ENUM_ASM_PARSERS$ac_delim
LLVM_ENUM_DISASSEMBLERS!$LLVM_ENUM_DISASSEMBLERS$ac_delim
ENABLE_CBE_PRINTF_A!$ENABLE_CBE_PRINTF_A$ac_delim
-OPTIMIZE_OPTION!$OPTIMIZE_OPTION$ac_delim
-EXTRA_OPTIONS!$EXTRA_OPTIONS$ac_delim
-BINUTILS_INCDIR!$BINUTILS_INCDIR$ac_delim
-ENABLE_LLVMC_DYNAMIC!$ENABLE_LLVMC_DYNAMIC$ac_delim
+CLANGPATH!$CLANGPATH$ac_delim
+CLANGXXPATH!$CLANGXXPATH$ac_delim
+ENABLE_BUILT_CLANG!$ENABLE_BUILT_CLANG$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -20703,6 +20830,10 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
+OPTIMIZE_OPTION!$OPTIMIZE_OPTION$ac_delim
+EXTRA_OPTIONS!$EXTRA_OPTIONS$ac_delim
+BINUTILS_INCDIR!$BINUTILS_INCDIR$ac_delim
+ENABLE_LLVMC_DYNAMIC!$ENABLE_LLVMC_DYNAMIC$ac_delim
ENABLE_LLVMC_DYNAMIC_PLUGINS!$ENABLE_LLVMC_DYNAMIC_PLUGINS$ac_delim
CXX!$CXX$ac_delim
CXXFLAGS!$CXXFLAGS$ac_delim
@@ -20758,6 +20889,7 @@ LLVMGCCCOMMAND!$LLVMGCCCOMMAND$ac_delim
LLVMGXXCOMMAND!$LLVMGXXCOMMAND$ac_delim
LLVMGCC!$LLVMGCC$ac_delim
LLVMGXX!$LLVMGXX$ac_delim
+LLVMCC_OPTION!$LLVMCC_OPTION$ac_delim
NO_VARIADIC_MACROS!$NO_VARIADIC_MACROS$ac_delim
NO_MISSING_FIELD_INITIALIZERS!$NO_MISSING_FIELD_INITIALIZERS$ac_delim
USE_UDIS86!$USE_UDIS86$ac_delim
@@ -20768,11 +20900,9 @@ MMAP_FILE!$MMAP_FILE$ac_delim
LLVMCC1!$LLVMCC1$ac_delim
LLVMCC1PLUS!$LLVMCC1PLUS$ac_delim
LLVMGCCDIR!$LLVMGCCDIR$ac_delim
-LLVMGCCLIBEXEC!$LLVMGCCLIBEXEC$ac_delim
-LLVMGCC_VERSION!$LLVMGCC_VERSION$ac_delim
-LLVMGCC_MAJVERS!$LLVMGCC_MAJVERS$ac_delim
LLVMGCC_LANGS!$LLVMGCC_LANGS$ac_delim
SHLIBEXT!$SHLIBEXT$ac_delim
+SHLIBPATH_VAR!$SHLIBPATH_VAR$ac_delim
LLVM_PREFIX!$LLVM_PREFIX$ac_delim
LLVM_BINDIR!$LLVM_BINDIR$ac_delim
LLVM_LIBDIR!$LLVM_LIBDIR$ac_delim
@@ -20793,7 +20923,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 88; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 91; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/docs/AdvancedGetElementPtr.html b/docs/AdvancedGetElementPtr.html
new file mode 100644
index 00000000000..1d372786927
--- /dev/null
+++ b/docs/AdvancedGetElementPtr.html
@@ -0,0 +1,362 @@
+
+
+
+
+ The Revenge Of The Often Misunderstood GEP Instruction
+
+
+
+
+
+
+ The Revenge Of The Often Misunderstood GEP Instruction
+
+
+
+
+
+
+
GEP was mysterious and wily at first, but it turned out that the basic
+ workings were fairly comprehensible. However the dragon was merely subdued;
+ now it's back, and it has more fundamental complexity to confront. This
+ document seeks to uncover misunderstandings of the GEP operator that tend
+ to persist past initial confusion about the funky "extra 0" thing. Here we
+ show that the GEP instruction is really not quite as simple as it seems,
+ even after the initial confusion is overcome.
+
+
+
+
+
+
It's very similar; there are only subtle differences.
+
+
With ptrtoint, you have to pick an integer type. One approach is to pick i64;
+ this is safe on everything LLVM supports (LLVM internally assumes pointers
+ are never wider than 64 bits in many places), and the optimizer will actually
+ narrow the i64 arithmetic down to the actual pointer size on targets which
+ don't support 64-bit arithmetic in most cases. However, there are some cases
+ where it doesn't do this. With GEP you can avoid this problem.
+
+
Also, GEP carries additional pointer aliasing rules. It's invalid to take a
+ GEP from one object, address into a different separately allocated
+ object, and dereference it. IR producers (front-ends) must follow this rule,
+ and consumers (optimizers, specifically alias analysis) benefit from being
+ able to rely on it.
+
+
And, GEP is more concise in common cases.
+
+
However, for the underlying integer computation implied, there
+ is no difference.
+
+
+
+
+
+
+
You don't. The integer computation implied by a GEP is target-independent.
+ Typically what you'll need to do is make your backend pattern-match
+ expressions trees involving ADD, MUL, etc., which are what GEP is lowered
+ into. This has the advantage of letting your code work correctly in more
+ cases.
+
+
GEP does use target-dependent parameters for the size and layout of data
+ types, which targets can customize.
+
+
If you require support for addressing units which are not 8 bits, you'll
+ need to fix a lot of code in the backend, with GEP lowering being only a
+ small piece of the overall picture.
+
+
+
+
+
+
+
The specific type i32 is probably just a historical artifact, however it's
+ wide enough for all practical purposes, so there's been no need to change it.
+ It doesn't necessarily imply i32 address arithmetic; it's just an identifier
+ which identifies a field in a struct. Requiring that all struct indices be
+ the same reduces the range of possibilities for cases where two GEPs are
+ effectively the same but have distinct operand types.
+
+
+
+
+
+
+
GEPs don't natively support VLAs. LLVM's type system is entirely static,
+ and GEP address computations are guided by an LLVM type.
+
+
VLA indices can be implemented as linearized indices. For example, an
+ expression like X[a][b][c], must be effectively lowered into a form
+ like X[a*m+b*n+c], so that it appears to the GEP as a single-dimensional
+ array reference.
+
+
This means if you want to write an analysis which understands array
+ indices and you want to support VLAs, your code will have to be
+ prepared to reverse-engineer the linearization. One way to solve this
+ problem is to use the ScalarEvolution library, which always presents
+ VLA and non-VLA indexing in the same manner.
+
+
+
+
+
+
+
There are two senses in which an array index can be out of bounds.
+
+
First, there's the array type which comes from the (static) type of
+ the first operand to the GEP. Indices greater than the number of elements
+ in the corresponding static array type are valid. There is no problem with
+ out of bounds indices in this sense. Indexing into an array only depends
+ on the size of the array element, not the number of elements.
+
+
A common example of how this is used is arrays where the size is not known.
+ It's common to use array types with zero length to represent these. The
+ fact that the static type says there are zero elements is irrelevant; it's
+ perfectly valid to compute arbitrary element indices, as the computation
+ only depends on the size of the array element, not the number of
+ elements. Note that zero-sized arrays are not a special case here.
+
+
This sense is unconnected with inbounds keyword. The
+ inbounds keyword is designed to describe low-level pointer
+ arithmetic overflow conditions, rather than high-level array
+ indexing rules.
+
+
Analysis passes which wish to understand array indexing should not
+ assume that the static array type bounds are respected.
+
+
The second sense of being out of bounds is computing an address that's
+ beyond the actual underlying allocated object.
+
+
With the inbounds keyword, the result value of the GEP is
+ undefined if the address is outside the actual underlying allocated
+ object and not the address one-past-the-end.
+
+
Without the inbounds keyword, there are no restrictions
+ on computing out-of-bounds addresses. Obviously, performing a load or
+ a store requires an address of allocated and sufficiently aligned
+ memory. But the GEP itself is only concerned with computing addresses.
+
+
+
+
+
+
+
Yes. This is basically a special case of array indices being out
+ of bounds.
+
+
+
+
+
+
+
Yes. If both addresses are within the same allocated object, or
+ one-past-the-end, you'll get the comparison result you expect. If either
+ is outside of it, integer arithmetic wrapping may occur, so the
+ comparison may not be meaningful.
+
+
+
+
+
+
+
Yes. There are no restrictions on bitcasting a pointer value to an arbitrary
+ pointer type. The types in a GEP serve only to define the parameters for the
+ underlying integer computation. They need not correspond with the actual
+ type of the underlying object.
+
+
Furthermore, loads and stores don't have to use the same types as the type
+ of the underlying object. Types in this context serve only to specify
+ memory size and alignment. Beyond that there are merely a hint to the
+ optimizer indicating how the value will likely be used.
+
+
+
+
+
+
+
You can compute an address that way, but if you use GEP to do the add,
+ you can't use that pointer to actually access the object, unless the
+ object is managed outside of LLVM.
+
+
The underlying integer computation is sufficiently defined; null has a
+ defined value -- zero -- and you can add whatever value you want to it.
+
+
However, it's invalid to access (load from or store to) an LLVM-aware
+ object with such a pointer. This includes GlobalVariables, Allocas, and
+ objects pointed to by noalias pointers.
+
+
If you really need this functionality, you can do the arithmetic with
+ explicit integer instructions, and use inttoptr to convert the result to
+ an address. Most of GEP's special aliasing rules do not apply to pointers
+ computed from ptrtoint, arithmetic, and inttoptr sequences.
+
+
+
+
+
+
+
As with arithmetic on null, You can use GEP to compute an address that
+ way, but you can't use that pointer to actually access the object if you
+ do, unless the object is managed outside of LLVM.
+
+
Also as above, ptrtoint and inttoptr provide an alternative way to do this
+ which do not have this restriction.
+
+
+
+
+
+
+
You can't do type-based alias analysis using LLVM's built-in type system,
+ because LLVM has no restrictions on mixing types in addressing, loads or
+ stores.
+
+
It would be possible to add special annotations to the IR, probably using
+ metadata, to describe a different type system (such as the C type system),
+ and do type-based aliasing on top of that. This is a much bigger
+ undertaking though.
+
+
+
+
+
+
+
+
Some LLVM optimizers operate on GEPs by internally lowering them into
+ more primitive integer expressions, which allows them to be combined
+ with other integer expressions and/or split into multiple separate
+ integer expressions. If they've made non-trivial changes, translating
+ back into LLVM IR can involve reverse-engineering the structure of
+ the addressing in order to fit it into the static type of the original
+ first operand. It isn't always possibly to fully reconstruct this
+ structure; sometimes the underlying addressing doesn't correspond with
+ the static type at all. In such cases the optimizer instead will emit
+ a GEP with the base pointer casted to a simple address-unit pointer,
+ using the name "uglygep". This isn't pretty, but it's just as
+ valid, and it's sufficient to preserve the pointer aliasing guarantees
+ that GEP provides.
+
+
+
+
+
+
+
+
Sort of. This hasn't always been forcefully disallowed, though it's
+ not recommended. It leads to awkward special cases in the optimizers.
+ In the future, it may be outright disallowed.
+
+
Instead, you should cast your pointer types and use arrays instead of
+ vectors for addressing. Arrays have the same in-memory representation
+ as vectors, so the addressing is interchangeable.
+
+
+
+
+
+
+
+
+
+
+
+
+
If the GEP has the inbounds keyword, the result value is
+ undefined.
+
+
Otherwise, the result value is the result from evaluating the implied
+ two's complement integer computation. However, since there's no
+ guarantee of where an object will be allocated in the address space,
+ such values have limited meaning.
+
+
+
+
+
+
+
+
None, except that the address space qualifier on the first operand pointer
+ type always matches the address space qualifier on the result type.
+
+
+
+
+
+
+
+
The design of GEP has the following goals, in rough unofficial
+ order of priority:
+
+ Support C, C-like languages, and languages which can be
+ conceptually lowered into C (this covers a lot).
+ Support optimizations such as those that are common in
+ C compilers.
+ Provide a consistent method for computing addresses so that
+ address computations don't need to be a part of load and
+ store instructions in the IR.
+ Support non-C-like languages, to the extent that it doesn't
+ interfere with other goals.
+ Minimize target-specific information in the IR.
+
+
+
+
+
+
+
+
+
+ The LLVM Compiler Infrastructure
+ Last modified: $Date: 2010-02-18 19:40:29 +0100 (Thu, 18 Feb 2010) $
+
+
+
+
diff --git a/docs/AliasAnalysis.html b/docs/AliasAnalysis.html
index 6903ede08b4..ef0f4141593 100644
--- a/docs/AliasAnalysis.html
+++ b/docs/AliasAnalysis.html
@@ -403,7 +403,7 @@ implementing, you just override the interfaces you can improve.
href="#basic-aa">basicaa and no-aa
passes) every alias analysis pass chains to another alias analysis
implementation (for example, the user can specify "-basicaa -ds-aa
--anders-aa -licm " to get the maximum benefit from the three alias
+-licm" to get the maximum benefit from both alias
analyses). The alias analysis class automatically takes care of most of this
for methods that you don't override. For methods that you do override, in code
paths that return a conservative MayAlias or Mod/Ref result, simply return
@@ -703,25 +703,6 @@ loads and stores to be eliminated.
non-address taken globals), but is very quick analysis.
-
-
-
-
-
-
The -anders-aa pass implements the well-known "Andersen's algorithm"
-for interprocedural alias analysis. This algorithm is a subset-based,
-flow-insensitive, context-insensitive, and field-insensitive alias analysis that
-is widely believed to be fairly precise. Unfortunately, this algorithm is also
-O(N3 ). The LLVM implementation currently does not implement any of
-the refinements (such as "online cycle elimination" or "offline variable
-substitution") to improve its efficiency, so it can be quite slow in common
-cases.
-
-
-
-
The -steens-aa pass
@@ -855,7 +836,7 @@ pointer.
These passes are useful for evaluating the various alias analysis
-implementations. You can use them with commands like 'opt -anders-aa -ds-aa
+implementations. You can use them with commands like 'opt -ds-aa
-aa-eval foo.bc -disable-output -stats '.
@@ -949,7 +930,7 @@ analysis directly.
Chris Lattner
LLVM Compiler Infrastructure
- Last modified: $Date: 2009-11-22 17:01:44 +0100 (Sun, 22 Nov 2009) $
+ Last modified: $Date: 2010-03-01 20:24:17 +0100 (Mon, 01 Mar 2010) $