[llvm-branch-commits] [llvm-branch] r165748 [1/2] - in /llvm/branches/R600: ./ bindings/ocaml/executionengine/ bindings/ocaml/llvm/ bindings/ocaml/target/ cmake/modules/ docs/ docs/tutorial/ examples/ExceptionDemo/ examples/Kaleidoscope/Chapter4/ examples/Kaleidoscope/Chapter5/ examples/Kaleidoscope/Chapter6/ examples/Kaleidoscope/Chapter7/ examples/OCaml-Kaleidoscope/Chapter4/ examples/OCaml-Kaleidoscope/Chapter5/ examples/OCaml-Kaleidoscope/Chapter6/ examples/OCaml-Kaleidoscope/Chapter7/ include/llvm-c/ include/llvm/ includ...
Tom Stellard
thomas.stellard at amd.com
Thu Oct 11 14:28:03 PDT 2012
Author: tstellar
Date: Thu Oct 11 16:28:00 2012
New Revision: 165748
URL: http://llvm.org/viewvc/llvm-project?rev=165748&view=rev
Log:
Merge master branch
Added:
llvm/branches/R600/docs/CompilerWriterInfo.rst
llvm/branches/R600/docs/ExtendingLLVM.rst
llvm/branches/R600/docs/GettingStarted.rst
llvm/branches/R600/docs/GoldPlugin.rst
llvm/branches/R600/docs/HowToSetUpLLVMStyleRTTI.rst
llvm/branches/R600/include/llvm/AddressingMode.h
llvm/branches/R600/include/llvm/AttributesImpl.h
- copied, changed from r165622, llvm/branches/R600/lib/VMCore/AttributesImpl.h
llvm/branches/R600/include/llvm/DataLayout.h
- copied, changed from r165622, llvm/branches/R600/include/llvm/Target/TargetData.h
llvm/branches/R600/include/llvm/ExecutionEngine/ObjectBuffer.h
llvm/branches/R600/include/llvm/ExecutionEngine/ObjectImage.h
- copied, changed from r165622, llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImage.h
llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h
- copied, changed from r165622, llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImage.h
llvm/branches/R600/lib/Target/Mips/MCTargetDesc/MipsDirectObjLower.cpp
- copied, changed from r165622, llvm/branches/R600/lib/Target/Mips/MipsDirectObjLower.cpp
llvm/branches/R600/lib/Target/Mips/MCTargetDesc/MipsDirectObjLower.h
- copied, changed from r165622, llvm/branches/R600/lib/Target/Mips/MipsDirectObjLower.h
llvm/branches/R600/lib/VMCore/DataLayout.cpp
- copied, changed from r165622, llvm/branches/R600/lib/Target/TargetData.cpp
llvm/branches/R600/test/CodeGen/ARM/2012-10-04-FixedFrame-vs-byval.ll
llvm/branches/R600/test/CodeGen/ARM/2012-10-04-LDRB_POST_IMM-Crash.ll
llvm/branches/R600/test/CodeGen/ARM/darwin-section-order.ll
llvm/branches/R600/test/CodeGen/ARM/deps-fix.ll
llvm/branches/R600/test/CodeGen/Mips/mul.ll
llvm/branches/R600/test/CodeGen/Mips/mulll.ll
llvm/branches/R600/test/CodeGen/Mips/mulull.ll
llvm/branches/R600/test/CodeGen/Mips/return-vector.ll
llvm/branches/R600/test/CodeGen/PowerPC/vec_cmp.ll
llvm/branches/R600/test/CodeGen/PowerPC/vec_conv.ll
llvm/branches/R600/test/CodeGen/X86/2012-10-02-DAGCycle.ll
llvm/branches/R600/test/CodeGen/X86/2012-10-03-DAGCycle.ll
llvm/branches/R600/test/CodeGen/X86/MergeConsecutiveStores.ll
llvm/branches/R600/test/CodeGen/X86/cmov-fp.ll
llvm/branches/R600/test/DebugInfo/X86/prologue-stack.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-ptr-reloc.ll
llvm/branches/R600/test/MC/Mips/mips-expansions.s
llvm/branches/R600/test/Other/ResponseFile.ll
llvm/branches/R600/test/Transforms/DeadArgElim/dbginfo.ll
llvm/branches/R600/test/Transforms/EarlyCSE/commute.ll
llvm/branches/R600/test/Transforms/SROA/big-endian.ll
llvm/branches/R600/unittests/ExecutionEngine/MCJIT/
llvm/branches/R600/unittests/ExecutionEngine/MCJIT/CMakeLists.txt
llvm/branches/R600/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp
llvm/branches/R600/unittests/ExecutionEngine/MCJIT/MCJITTestBase.h
llvm/branches/R600/unittests/ExecutionEngine/MCJIT/MCJITTests.def
llvm/branches/R600/unittests/ExecutionEngine/MCJIT/Makefile
- copied, changed from r165622, llvm/branches/R600/unittests/ExecutionEngine/Makefile
llvm/branches/R600/unittests/ExecutionEngine/MCJIT/SectionMemoryManager.cpp
llvm/branches/R600/unittests/ExecutionEngine/MCJIT/SectionMemoryManager.h
llvm/branches/R600/unittests/Support/MemoryBufferTest.cpp
Removed:
llvm/branches/R600/docs/CompilerWriterInfo.html
llvm/branches/R600/docs/ExtendingLLVM.html
llvm/branches/R600/docs/GettingStarted.html
llvm/branches/R600/docs/GoldPlugin.html
llvm/branches/R600/include/llvm/TableGen/TableGenAction.h
llvm/branches/R600/include/llvm/Target/TargetData.h
llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImage.h
llvm/branches/R600/lib/TableGen/TableGenAction.cpp
llvm/branches/R600/lib/Target/Mips/MipsDirectObjLower.cpp
llvm/branches/R600/lib/Target/Mips/MipsDirectObjLower.h
llvm/branches/R600/lib/Target/TargetData.cpp
llvm/branches/R600/lib/VMCore/AttributesImpl.h
Modified:
llvm/branches/R600/.gitignore
llvm/branches/R600/CREDITS.TXT
llvm/branches/R600/Makefile
llvm/branches/R600/Makefile.rules
llvm/branches/R600/bindings/ocaml/executionengine/llvm_executionengine.ml
llvm/branches/R600/bindings/ocaml/executionengine/llvm_executionengine.mli
llvm/branches/R600/bindings/ocaml/llvm/llvm.mli
llvm/branches/R600/bindings/ocaml/target/llvm_target.ml
llvm/branches/R600/bindings/ocaml/target/llvm_target.mli
llvm/branches/R600/bindings/ocaml/target/target_ocaml.c
llvm/branches/R600/cmake/modules/AddLLVM.cmake
llvm/branches/R600/docs/CodeGenerator.rst
llvm/branches/R600/docs/GarbageCollection.html
llvm/branches/R600/docs/LangRef.html
llvm/branches/R600/docs/LinkTimeOptimization.rst
llvm/branches/R600/docs/ProgrammersManual.html
llvm/branches/R600/docs/SourceLevelDebugging.html
llvm/branches/R600/docs/WritingAnLLVMBackend.html
llvm/branches/R600/docs/index.rst
llvm/branches/R600/docs/programming.rst
llvm/branches/R600/docs/subsystems.rst
llvm/branches/R600/docs/tutorial/LangImpl4.html
llvm/branches/R600/docs/tutorial/LangImpl5.html
llvm/branches/R600/docs/tutorial/LangImpl6.html
llvm/branches/R600/docs/tutorial/LangImpl7.html
llvm/branches/R600/docs/tutorial/OCamlLangImpl4.html
llvm/branches/R600/docs/tutorial/OCamlLangImpl5.html
llvm/branches/R600/docs/tutorial/OCamlLangImpl6.html
llvm/branches/R600/docs/tutorial/OCamlLangImpl7.html
llvm/branches/R600/docs/userguides.rst
llvm/branches/R600/examples/ExceptionDemo/ExceptionDemo.cpp
llvm/branches/R600/examples/Kaleidoscope/Chapter4/toy.cpp
llvm/branches/R600/examples/Kaleidoscope/Chapter5/toy.cpp
llvm/branches/R600/examples/Kaleidoscope/Chapter6/toy.cpp
llvm/branches/R600/examples/Kaleidoscope/Chapter7/toy.cpp
llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter4/toy.ml
llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter5/toy.ml
llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter6/toy.ml
llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter7/toy.ml
llvm/branches/R600/include/llvm-c/Core.h
llvm/branches/R600/include/llvm-c/Target.h
llvm/branches/R600/include/llvm-c/TargetMachine.h
llvm/branches/R600/include/llvm/ADT/MapVector.h
llvm/branches/R600/include/llvm/ADT/SetVector.h
llvm/branches/R600/include/llvm/ADT/Triple.h
llvm/branches/R600/include/llvm/Analysis/AliasAnalysis.h
llvm/branches/R600/include/llvm/Analysis/CaptureTracking.h
llvm/branches/R600/include/llvm/Analysis/CodeMetrics.h
llvm/branches/R600/include/llvm/Analysis/ConstantFolding.h
llvm/branches/R600/include/llvm/Analysis/Dominators.h
llvm/branches/R600/include/llvm/Analysis/IVUsers.h
llvm/branches/R600/include/llvm/Analysis/InlineCost.h
llvm/branches/R600/include/llvm/Analysis/InstructionSimplify.h
llvm/branches/R600/include/llvm/Analysis/LazyValueInfo.h
llvm/branches/R600/include/llvm/Analysis/Loads.h
llvm/branches/R600/include/llvm/Analysis/MemoryBuiltins.h
llvm/branches/R600/include/llvm/Analysis/MemoryDependenceAnalysis.h
llvm/branches/R600/include/llvm/Analysis/PHITransAddr.h
llvm/branches/R600/include/llvm/Analysis/ScalarEvolution.h
llvm/branches/R600/include/llvm/Analysis/ValueTracking.h
llvm/branches/R600/include/llvm/Argument.h
llvm/branches/R600/include/llvm/Attributes.h
llvm/branches/R600/include/llvm/CodeGen/AsmPrinter.h
llvm/branches/R600/include/llvm/CodeGen/FastISel.h
llvm/branches/R600/include/llvm/CodeGen/IntrinsicLowering.h
llvm/branches/R600/include/llvm/CodeGen/MachineConstantPool.h
llvm/branches/R600/include/llvm/CodeGen/MachineFrameInfo.h
llvm/branches/R600/include/llvm/CodeGen/MachineInstr.h
llvm/branches/R600/include/llvm/CodeGen/MachineJumpTableInfo.h
llvm/branches/R600/include/llvm/CodeGen/MachineScheduler.h
llvm/branches/R600/include/llvm/CodeGen/ScheduleDAG.h
llvm/branches/R600/include/llvm/CodeGen/ScheduleDAGInstrs.h
llvm/branches/R600/include/llvm/CodeGen/SelectionDAGNodes.h
llvm/branches/R600/include/llvm/CodeGen/TargetSchedule.h
llvm/branches/R600/include/llvm/DIBuilder.h
llvm/branches/R600/include/llvm/DebugInfo.h
llvm/branches/R600/include/llvm/DerivedTypes.h
llvm/branches/R600/include/llvm/ExecutionEngine/ExecutionEngine.h
llvm/branches/R600/include/llvm/ExecutionEngine/RuntimeDyld.h
llvm/branches/R600/include/llvm/Function.h
llvm/branches/R600/include/llvm/InitializePasses.h
llvm/branches/R600/include/llvm/InstrTypes.h
llvm/branches/R600/include/llvm/Instructions.h
llvm/branches/R600/include/llvm/MC/MCObjectFileInfo.h
llvm/branches/R600/include/llvm/MC/MCObjectStreamer.h
llvm/branches/R600/include/llvm/MC/MCSchedule.h
llvm/branches/R600/include/llvm/MC/MCSubtargetInfo.h
llvm/branches/R600/include/llvm/MC/MCTargetAsmParser.h
llvm/branches/R600/include/llvm/MC/SubtargetFeature.h
llvm/branches/R600/include/llvm/Object/COFF.h
llvm/branches/R600/include/llvm/Object/ELF.h
llvm/branches/R600/include/llvm/Object/MachO.h
llvm/branches/R600/include/llvm/Object/ObjectFile.h
llvm/branches/R600/include/llvm/Operator.h
llvm/branches/R600/include/llvm/Support/CallSite.h
llvm/branches/R600/include/llvm/Support/CommandLine.h
llvm/branches/R600/include/llvm/Support/TargetFolder.h
llvm/branches/R600/include/llvm/TableGen/Main.h
llvm/branches/R600/include/llvm/TableGen/Record.h
llvm/branches/R600/include/llvm/Target/Mangler.h
llvm/branches/R600/include/llvm/Target/TargetCallingConv.h
llvm/branches/R600/include/llvm/Target/TargetInstrInfo.h
llvm/branches/R600/include/llvm/Target/TargetLowering.h
llvm/branches/R600/include/llvm/Target/TargetMachine.h
llvm/branches/R600/include/llvm/Target/TargetSchedule.td
llvm/branches/R600/include/llvm/Target/TargetSelectionDAGInfo.h
llvm/branches/R600/include/llvm/Target/TargetSubtargetInfo.h
llvm/branches/R600/include/llvm/Transforms/IPO/InlinerPass.h
llvm/branches/R600/include/llvm/Transforms/Utils/AddrModeMatcher.h
llvm/branches/R600/include/llvm/Transforms/Utils/BuildLibCalls.h
llvm/branches/R600/include/llvm/Transforms/Utils/BypassSlowDivision.h
llvm/branches/R600/include/llvm/Transforms/Utils/Cloning.h
llvm/branches/R600/include/llvm/Transforms/Utils/Local.h
llvm/branches/R600/include/llvm/Type.h
llvm/branches/R600/include/llvm/User.h
llvm/branches/R600/lib/Analysis/AliasAnalysis.cpp
llvm/branches/R600/lib/Analysis/AliasSetTracker.cpp
llvm/branches/R600/lib/Analysis/BasicAliasAnalysis.cpp
llvm/branches/R600/lib/Analysis/CaptureTracking.cpp
llvm/branches/R600/lib/Analysis/CodeMetrics.cpp
llvm/branches/R600/lib/Analysis/ConstantFolding.cpp
llvm/branches/R600/lib/Analysis/IVUsers.cpp
llvm/branches/R600/lib/Analysis/InlineCost.cpp
llvm/branches/R600/lib/Analysis/InstructionSimplify.cpp
llvm/branches/R600/lib/Analysis/LazyValueInfo.cpp
llvm/branches/R600/lib/Analysis/Lint.cpp
llvm/branches/R600/lib/Analysis/Loads.cpp
llvm/branches/R600/lib/Analysis/LoopDependenceAnalysis.cpp
llvm/branches/R600/lib/Analysis/MemoryBuiltins.cpp
llvm/branches/R600/lib/Analysis/MemoryDependenceAnalysis.cpp
llvm/branches/R600/lib/Analysis/NoAliasAnalysis.cpp
llvm/branches/R600/lib/Analysis/ScalarEvolution.cpp
llvm/branches/R600/lib/Analysis/ScalarEvolutionExpander.cpp
llvm/branches/R600/lib/Analysis/ValueTracking.cpp
llvm/branches/R600/lib/AsmParser/LLParser.cpp
llvm/branches/R600/lib/AsmParser/LLParser.h
llvm/branches/R600/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/branches/R600/lib/CodeGen/Analysis.cpp
llvm/branches/R600/lib/CodeGen/AsmPrinter/ARMException.cpp
llvm/branches/R600/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/branches/R600/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
llvm/branches/R600/lib/CodeGen/AsmPrinter/DIE.cpp
llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfException.cpp
llvm/branches/R600/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
llvm/branches/R600/lib/CodeGen/AsmPrinter/Win64Exception.cpp
llvm/branches/R600/lib/CodeGen/BranchFolding.cpp
llvm/branches/R600/lib/CodeGen/CallingConvLower.cpp
llvm/branches/R600/lib/CodeGen/CodePlacementOpt.cpp
llvm/branches/R600/lib/CodeGen/EarlyIfConversion.cpp
llvm/branches/R600/lib/CodeGen/ExecutionDepsFix.cpp
llvm/branches/R600/lib/CodeGen/IntrinsicLowering.cpp
llvm/branches/R600/lib/CodeGen/LiveIntervalAnalysis.cpp
llvm/branches/R600/lib/CodeGen/MachineBasicBlock.cpp
llvm/branches/R600/lib/CodeGen/MachineBlockPlacement.cpp
llvm/branches/R600/lib/CodeGen/MachineFunction.cpp
llvm/branches/R600/lib/CodeGen/MachineInstr.cpp
llvm/branches/R600/lib/CodeGen/MachineModuleInfo.cpp
llvm/branches/R600/lib/CodeGen/MachineScheduler.cpp
llvm/branches/R600/lib/CodeGen/MachineTraceMetrics.cpp
llvm/branches/R600/lib/CodeGen/MachineTraceMetrics.h
llvm/branches/R600/lib/CodeGen/Passes.cpp
llvm/branches/R600/lib/CodeGen/PrologEpilogInserter.cpp
llvm/branches/R600/lib/CodeGen/RegAllocPBQP.cpp
llvm/branches/R600/lib/CodeGen/RegisterCoalescer.cpp
llvm/branches/R600/lib/CodeGen/ScheduleDAGInstrs.cpp
llvm/branches/R600/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/branches/R600/lib/CodeGen/SelectionDAG/FastISel.cpp
llvm/branches/R600/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
llvm/branches/R600/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp
llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h
llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGVLIW.cpp
llvm/branches/R600/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/branches/R600/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/branches/R600/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
llvm/branches/R600/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/branches/R600/lib/CodeGen/SelectionDAG/TargetSelectionDAGInfo.cpp
llvm/branches/R600/lib/CodeGen/SjLjEHPrepare.cpp
llvm/branches/R600/lib/CodeGen/StackProtector.cpp
llvm/branches/R600/lib/CodeGen/TailDuplication.cpp
llvm/branches/R600/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/branches/R600/lib/CodeGen/TargetSchedule.cpp
llvm/branches/R600/lib/ExecutionEngine/ExecutionEngine.cpp
llvm/branches/R600/lib/ExecutionEngine/ExecutionEngineBindings.cpp
llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/ittnotify_config.h
llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/ittnotify_types.h
llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/jitprofiling.c
llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/jitprofiling.h
llvm/branches/R600/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
llvm/branches/R600/lib/ExecutionEngine/Interpreter/Interpreter.cpp
llvm/branches/R600/lib/ExecutionEngine/Interpreter/Interpreter.h
llvm/branches/R600/lib/ExecutionEngine/JIT/JIT.cpp
llvm/branches/R600/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp
llvm/branches/R600/lib/ExecutionEngine/JIT/JITDwarfEmitter.h
llvm/branches/R600/lib/ExecutionEngine/JIT/JITEmitter.cpp
llvm/branches/R600/lib/ExecutionEngine/MCJIT/MCJIT.cpp
llvm/branches/R600/lib/ExecutionEngine/MCJIT/MCJIT.h
llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/GDBRegistrar.cpp
llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/JITRegistrar.h
llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h
llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h
llvm/branches/R600/lib/ExecutionEngine/TargetSelect.cpp
llvm/branches/R600/lib/MC/MCELFStreamer.cpp
llvm/branches/R600/lib/MC/MCMachOStreamer.cpp
llvm/branches/R600/lib/MC/MCObjectFileInfo.cpp
llvm/branches/R600/lib/MC/MCObjectStreamer.cpp
llvm/branches/R600/lib/MC/MCParser/AsmParser.cpp
llvm/branches/R600/lib/MC/MCSubtargetInfo.cpp
llvm/branches/R600/lib/MC/SubtargetFeature.cpp
llvm/branches/R600/lib/MC/WinCOFFStreamer.cpp
llvm/branches/R600/lib/Object/COFFObjectFile.cpp
llvm/branches/R600/lib/Object/MachOObjectFile.cpp
llvm/branches/R600/lib/Support/CommandLine.cpp
llvm/branches/R600/lib/Support/StringRef.cpp
llvm/branches/R600/lib/Support/Triple.cpp
llvm/branches/R600/lib/TableGen/CMakeLists.txt
llvm/branches/R600/lib/TableGen/Main.cpp
llvm/branches/R600/lib/TableGen/Record.cpp
llvm/branches/R600/lib/TableGen/TGParser.cpp
llvm/branches/R600/lib/TableGen/TGParser.h
llvm/branches/R600/lib/Target/ARM/ARMAsmPrinter.cpp
llvm/branches/R600/lib/Target/ARM/ARMAsmPrinter.h
llvm/branches/R600/lib/Target/ARM/ARMBaseInstrInfo.cpp
llvm/branches/R600/lib/Target/ARM/ARMBaseInstrInfo.h
llvm/branches/R600/lib/Target/ARM/ARMBaseRegisterInfo.cpp
llvm/branches/R600/lib/Target/ARM/ARMCodeEmitter.cpp
llvm/branches/R600/lib/Target/ARM/ARMConstantIslandPass.cpp
llvm/branches/R600/lib/Target/ARM/ARMELFWriterInfo.cpp
llvm/branches/R600/lib/Target/ARM/ARMFastISel.cpp
llvm/branches/R600/lib/Target/ARM/ARMFrameLowering.cpp
llvm/branches/R600/lib/Target/ARM/ARMISelLowering.cpp
llvm/branches/R600/lib/Target/ARM/ARMISelLowering.h
llvm/branches/R600/lib/Target/ARM/ARMInstrInfo.cpp
llvm/branches/R600/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
llvm/branches/R600/lib/Target/ARM/ARMSelectionDAGInfo.cpp
llvm/branches/R600/lib/Target/ARM/ARMTargetMachine.cpp
llvm/branches/R600/lib/Target/ARM/ARMTargetMachine.h
llvm/branches/R600/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/branches/R600/lib/Target/CMakeLists.txt
llvm/branches/R600/lib/Target/CellSPU/SPUFrameLowering.cpp
llvm/branches/R600/lib/Target/CellSPU/SPUSubtarget.h
llvm/branches/R600/lib/Target/CellSPU/SPUTargetMachine.cpp
llvm/branches/R600/lib/Target/CellSPU/SPUTargetMachine.h
llvm/branches/R600/lib/Target/CppBackend/CPPBackend.cpp
llvm/branches/R600/lib/Target/CppBackend/CPPTargetMachine.h
llvm/branches/R600/lib/Target/Hexagon/HexagonAsmPrinter.cpp
llvm/branches/R600/lib/Target/Hexagon/HexagonCallingConvLower.cpp
llvm/branches/R600/lib/Target/Hexagon/HexagonMachineScheduler.cpp
llvm/branches/R600/lib/Target/Hexagon/HexagonMachineScheduler.h
llvm/branches/R600/lib/Target/Hexagon/HexagonRemoveSZExtArgs.cpp
llvm/branches/R600/lib/Target/Hexagon/HexagonTargetMachine.cpp
llvm/branches/R600/lib/Target/Hexagon/HexagonTargetMachine.h
llvm/branches/R600/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
llvm/branches/R600/lib/Target/Hexagon/HexagonVarargsCallingConvention.h
llvm/branches/R600/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp
llvm/branches/R600/lib/Target/MBlaze/MBlazeAsmPrinter.cpp
llvm/branches/R600/lib/Target/MBlaze/MBlazeELFWriterInfo.cpp
llvm/branches/R600/lib/Target/MBlaze/MBlazeFrameLowering.cpp
llvm/branches/R600/lib/Target/MBlaze/MBlazeTargetMachine.cpp
llvm/branches/R600/lib/Target/MBlaze/MBlazeTargetMachine.h
llvm/branches/R600/lib/Target/MBlaze/MBlazeTargetObjectFile.cpp
llvm/branches/R600/lib/Target/MSP430/MSP430FrameLowering.cpp
llvm/branches/R600/lib/Target/MSP430/MSP430ISelLowering.cpp
llvm/branches/R600/lib/Target/MSP430/MSP430ISelLowering.h
llvm/branches/R600/lib/Target/MSP430/MSP430TargetMachine.cpp
llvm/branches/R600/lib/Target/MSP430/MSP430TargetMachine.h
llvm/branches/R600/lib/Target/Mangler.cpp
llvm/branches/R600/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
llvm/branches/R600/lib/Target/Mips/CMakeLists.txt
llvm/branches/R600/lib/Target/Mips/MCTargetDesc/CMakeLists.txt
llvm/branches/R600/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
llvm/branches/R600/lib/Target/Mips/Mips16FrameLowering.cpp
llvm/branches/R600/lib/Target/Mips/Mips16InstrInfo.td
llvm/branches/R600/lib/Target/Mips/Mips64InstrInfo.td
llvm/branches/R600/lib/Target/Mips/MipsAsmPrinter.cpp
llvm/branches/R600/lib/Target/Mips/MipsCodeEmitter.cpp
llvm/branches/R600/lib/Target/Mips/MipsELFWriterInfo.cpp
llvm/branches/R600/lib/Target/Mips/MipsFrameLowering.cpp
llvm/branches/R600/lib/Target/Mips/MipsISelDAGToDAG.cpp
llvm/branches/R600/lib/Target/Mips/MipsISelLowering.cpp
llvm/branches/R600/lib/Target/Mips/MipsISelLowering.h
llvm/branches/R600/lib/Target/Mips/MipsInstrFormats.td
llvm/branches/R600/lib/Target/Mips/MipsInstrInfo.td
llvm/branches/R600/lib/Target/Mips/MipsSEFrameLowering.cpp
llvm/branches/R600/lib/Target/Mips/MipsTargetMachine.cpp
llvm/branches/R600/lib/Target/Mips/MipsTargetMachine.h
llvm/branches/R600/lib/Target/Mips/MipsTargetObjectFile.cpp
llvm/branches/R600/lib/Target/NVPTX/NVPTXAllocaHoisting.h
llvm/branches/R600/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
llvm/branches/R600/lib/Target/NVPTX/NVPTXISelLowering.cpp
llvm/branches/R600/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp
llvm/branches/R600/lib/Target/NVPTX/NVPTXLowerAggrCopies.h
llvm/branches/R600/lib/Target/NVPTX/NVPTXTargetMachine.cpp
llvm/branches/R600/lib/Target/NVPTX/NVPTXTargetMachine.h
llvm/branches/R600/lib/Target/PowerPC/InstPrinter/PPCInstPrinter.cpp
llvm/branches/R600/lib/Target/PowerPC/MCTargetDesc/PPCMCCodeEmitter.cpp
llvm/branches/R600/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/branches/R600/lib/Target/PowerPC/PPCFrameLowering.cpp
llvm/branches/R600/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
llvm/branches/R600/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/branches/R600/lib/Target/PowerPC/PPCISelLowering.h
llvm/branches/R600/lib/Target/PowerPC/PPCInstr64Bit.td
llvm/branches/R600/lib/Target/PowerPC/PPCInstrAltivec.td
llvm/branches/R600/lib/Target/PowerPC/PPCInstrInfo.td
llvm/branches/R600/lib/Target/PowerPC/PPCRegisterInfo.cpp
llvm/branches/R600/lib/Target/PowerPC/PPCSubtarget.cpp
llvm/branches/R600/lib/Target/PowerPC/PPCSubtarget.h
llvm/branches/R600/lib/Target/PowerPC/PPCTargetMachine.cpp
llvm/branches/R600/lib/Target/PowerPC/PPCTargetMachine.h
llvm/branches/R600/lib/Target/README.txt
llvm/branches/R600/lib/Target/Sparc/SparcFrameLowering.cpp
llvm/branches/R600/lib/Target/Sparc/SparcISelLowering.cpp
llvm/branches/R600/lib/Target/Sparc/SparcTargetMachine.cpp
llvm/branches/R600/lib/Target/Sparc/SparcTargetMachine.h
llvm/branches/R600/lib/Target/Target.cpp
llvm/branches/R600/lib/Target/TargetELFWriterInfo.cpp
llvm/branches/R600/lib/Target/TargetLoweringObjectFile.cpp
llvm/branches/R600/lib/Target/TargetMachineC.cpp
llvm/branches/R600/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/branches/R600/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp
llvm/branches/R600/lib/Target/X86/InstPrinter/X86ATTInstPrinter.h
llvm/branches/R600/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp
llvm/branches/R600/lib/Target/X86/InstPrinter/X86IntelInstPrinter.h
llvm/branches/R600/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
llvm/branches/R600/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
llvm/branches/R600/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
llvm/branches/R600/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h
llvm/branches/R600/lib/Target/X86/X86.td
llvm/branches/R600/lib/Target/X86/X86AsmPrinter.cpp
llvm/branches/R600/lib/Target/X86/X86AsmPrinter.h
llvm/branches/R600/lib/Target/X86/X86COFFMachineModuleInfo.h
llvm/branches/R600/lib/Target/X86/X86CodeEmitter.cpp
llvm/branches/R600/lib/Target/X86/X86ELFWriterInfo.cpp
llvm/branches/R600/lib/Target/X86/X86FastISel.cpp
llvm/branches/R600/lib/Target/X86/X86FrameLowering.cpp
llvm/branches/R600/lib/Target/X86/X86ISelDAGToDAG.cpp
llvm/branches/R600/lib/Target/X86/X86ISelLowering.cpp
llvm/branches/R600/lib/Target/X86/X86ISelLowering.h
llvm/branches/R600/lib/Target/X86/X86InstrCompiler.td
llvm/branches/R600/lib/Target/X86/X86InstrInfo.cpp
llvm/branches/R600/lib/Target/X86/X86InstrInfo.td
llvm/branches/R600/lib/Target/X86/X86MCInstLower.cpp
llvm/branches/R600/lib/Target/X86/X86RegisterInfo.cpp
llvm/branches/R600/lib/Target/X86/X86RegisterInfo.h
llvm/branches/R600/lib/Target/X86/X86RegisterInfo.td
llvm/branches/R600/lib/Target/X86/X86SelectionDAGInfo.cpp
llvm/branches/R600/lib/Target/X86/X86Subtarget.cpp
llvm/branches/R600/lib/Target/X86/X86Subtarget.h
llvm/branches/R600/lib/Target/X86/X86TargetMachine.cpp
llvm/branches/R600/lib/Target/X86/X86TargetMachine.h
llvm/branches/R600/lib/Target/XCore/XCoreAsmPrinter.cpp
llvm/branches/R600/lib/Target/XCore/XCoreFrameLowering.cpp
llvm/branches/R600/lib/Target/XCore/XCoreISelLowering.cpp
llvm/branches/R600/lib/Target/XCore/XCoreTargetMachine.cpp
llvm/branches/R600/lib/Target/XCore/XCoreTargetMachine.h
llvm/branches/R600/lib/Transforms/IPO/ArgumentPromotion.cpp
llvm/branches/R600/lib/Transforms/IPO/ConstantMerge.cpp
llvm/branches/R600/lib/Transforms/IPO/DeadArgumentElimination.cpp
llvm/branches/R600/lib/Transforms/IPO/FunctionAttrs.cpp
llvm/branches/R600/lib/Transforms/IPO/GlobalOpt.cpp
llvm/branches/R600/lib/Transforms/IPO/InlineAlways.cpp
llvm/branches/R600/lib/Transforms/IPO/InlineSimple.cpp
llvm/branches/R600/lib/Transforms/IPO/Inliner.cpp
llvm/branches/R600/lib/Transforms/IPO/MergeFunctions.cpp
llvm/branches/R600/lib/Transforms/IPO/PruneEH.cpp
llvm/branches/R600/lib/Transforms/InstCombine/InstCombine.h
llvm/branches/R600/lib/Transforms/InstCombine/InstCombineAddSub.cpp
llvm/branches/R600/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/branches/R600/lib/Transforms/InstCombine/InstCombineCasts.cpp
llvm/branches/R600/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/branches/R600/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
llvm/branches/R600/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
llvm/branches/R600/lib/Transforms/InstCombine/InstCombinePHI.cpp
llvm/branches/R600/lib/Transforms/InstCombine/InstCombineSelect.cpp
llvm/branches/R600/lib/Transforms/InstCombine/InstCombineShifts.cpp
llvm/branches/R600/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
llvm/branches/R600/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/branches/R600/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/branches/R600/lib/Transforms/Instrumentation/BoundsChecking.cpp
llvm/branches/R600/lib/Transforms/Instrumentation/GCOVProfiling.cpp
llvm/branches/R600/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
llvm/branches/R600/lib/Transforms/Scalar/CodeGenPrepare.cpp
llvm/branches/R600/lib/Transforms/Scalar/ConstantProp.cpp
llvm/branches/R600/lib/Transforms/Scalar/DeadStoreElimination.cpp
llvm/branches/R600/lib/Transforms/Scalar/EarlyCSE.cpp
llvm/branches/R600/lib/Transforms/Scalar/GVN.cpp
llvm/branches/R600/lib/Transforms/Scalar/GlobalMerge.cpp
llvm/branches/R600/lib/Transforms/Scalar/IndVarSimplify.cpp
llvm/branches/R600/lib/Transforms/Scalar/JumpThreading.cpp
llvm/branches/R600/lib/Transforms/Scalar/LICM.cpp
llvm/branches/R600/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
llvm/branches/R600/lib/Transforms/Scalar/LoopInstSimplify.cpp
llvm/branches/R600/lib/Transforms/Scalar/LoopStrengthReduce.cpp
llvm/branches/R600/lib/Transforms/Scalar/LoopUnrollPass.cpp
llvm/branches/R600/lib/Transforms/Scalar/LoopUnswitch.cpp
llvm/branches/R600/lib/Transforms/Scalar/MemCpyOptimizer.cpp
llvm/branches/R600/lib/Transforms/Scalar/ObjCARC.cpp
llvm/branches/R600/lib/Transforms/Scalar/SCCP.cpp
llvm/branches/R600/lib/Transforms/Scalar/SROA.cpp
llvm/branches/R600/lib/Transforms/Scalar/Scalar.cpp
llvm/branches/R600/lib/Transforms/Scalar/ScalarReplAggregates.cpp
llvm/branches/R600/lib/Transforms/Scalar/SimplifyCFGPass.cpp
llvm/branches/R600/lib/Transforms/Scalar/SimplifyLibCalls.cpp
llvm/branches/R600/lib/Transforms/Utils/AddrModeMatcher.cpp
llvm/branches/R600/lib/Transforms/Utils/BasicBlockUtils.cpp
llvm/branches/R600/lib/Transforms/Utils/BuildLibCalls.cpp
llvm/branches/R600/lib/Transforms/Utils/BypassSlowDivision.cpp
llvm/branches/R600/lib/Transforms/Utils/CloneFunction.cpp
llvm/branches/R600/lib/Transforms/Utils/CodeExtractor.cpp
llvm/branches/R600/lib/Transforms/Utils/InlineFunction.cpp
llvm/branches/R600/lib/Transforms/Utils/Local.cpp
llvm/branches/R600/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/branches/R600/lib/Transforms/Utils/SimplifyIndVar.cpp
llvm/branches/R600/lib/Transforms/Utils/SimplifyInstructions.cpp
llvm/branches/R600/lib/Transforms/Vectorize/BBVectorize.cpp
llvm/branches/R600/lib/VMCore/AsmWriter.cpp
llvm/branches/R600/lib/VMCore/Attributes.cpp
llvm/branches/R600/lib/VMCore/CMakeLists.txt
llvm/branches/R600/lib/VMCore/ConstantFold.cpp
llvm/branches/R600/lib/VMCore/DIBuilder.cpp
llvm/branches/R600/lib/VMCore/DebugInfo.cpp
llvm/branches/R600/lib/VMCore/Function.cpp
llvm/branches/R600/lib/VMCore/Instructions.cpp
llvm/branches/R600/lib/VMCore/LLVMContextImpl.h
llvm/branches/R600/lib/VMCore/Value.cpp
llvm/branches/R600/lib/VMCore/Verifier.cpp
llvm/branches/R600/runtime/libprofile/Makefile
llvm/branches/R600/test/Assembler/2008-09-02-FunctionNotes2.ll
llvm/branches/R600/test/Bindings/Ocaml/ipo_opts.ml
llvm/branches/R600/test/Bindings/Ocaml/scalar_opts.ml
llvm/branches/R600/test/Bindings/Ocaml/target.ml
llvm/branches/R600/test/CMakeLists.txt
llvm/branches/R600/test/CodeGen/ARM/coalesce-subregs.ll
llvm/branches/R600/test/CodeGen/CellSPU/icmp16.ll
llvm/branches/R600/test/CodeGen/PowerPC/ppc64-toc.ll
llvm/branches/R600/test/CodeGen/SPARC/2011-01-11-CC.ll
llvm/branches/R600/test/CodeGen/X86/atomic-minmax-i6432.ll
llvm/branches/R600/test/CodeGen/X86/early-ifcvt.ll
llvm/branches/R600/test/CodeGen/X86/fast-isel-x86-64.ll
llvm/branches/R600/test/CodeGen/X86/ms-inline-asm.ll
llvm/branches/R600/test/CodeGen/X86/smul-with-overflow.ll
llvm/branches/R600/test/DebugInfo/X86/DW_AT_byte_size.ll
llvm/branches/R600/test/DebugInfo/X86/enum-fwd-decl.ll
llvm/branches/R600/test/ExecutionEngine/2002-12-16-ArgTest.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2002-12-16-ArgTest.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2003-01-04-ArgumentBug.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2003-01-04-LoopTest.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2003-01-04-PhiTest.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2003-01-09-SARTest.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2003-01-10-FUCOM.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2003-01-15-AlignmentTest.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2003-05-06-LivenessClobber.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2003-05-07-ArgumentTest.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2003-05-11-PHIRegAllocBug.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2003-06-04-bzip2-bug.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2003-06-05-PHIBug.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2003-08-15-AllocaAssertion.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2003-08-21-EnvironmentTest.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2003-08-23-RegisterAllocatePhysReg.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2005-12-02-TailCallBug.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2007-12-10-APIntLoadStore.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2008-06-05-APInt-OverAShr.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/2010-01-15-UndefValue.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/fpbitcast.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/hello.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/hello2.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/lit.local.cfg
llvm/branches/R600/test/ExecutionEngine/MCJIT/pr13727.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/simplesttest.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/simpletest.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/stubs.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-arith.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-branch.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-call-no-external-funcs.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-call.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-cast.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-common-symbols.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-constantexpr.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-fp-no-external-funcs.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-fp.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-global-init-nonzero.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-global.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-loadstore.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-local.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-logical.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-loop.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-phi.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-ret.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-return.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-setcond-fp.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-setcond-int.ll
llvm/branches/R600/test/ExecutionEngine/MCJIT/test-shift.ll
llvm/branches/R600/test/ExecutionEngine/test-fp-no-external-funcs.ll
llvm/branches/R600/test/ExecutionEngine/test-fp.ll
llvm/branches/R600/test/Instrumentation/ThreadSanitizer/atomic.ll
llvm/branches/R600/test/MC/ARM/diagnostics.s
llvm/branches/R600/test/MC/Mips/mips-fpu-instructions.s
llvm/branches/R600/test/MC/Mips/mips_directives.s
llvm/branches/R600/test/Makefile
llvm/branches/R600/test/Transforms/IndVarSimplify/2004-04-05-InvokeCastCrash.ll
llvm/branches/R600/test/Transforms/IndVarSimplify/crash.ll
llvm/branches/R600/test/Transforms/InstCombine/align-addr.ll
llvm/branches/R600/test/Transforms/InstCombine/and-fcmp.ll
llvm/branches/R600/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll
llvm/branches/R600/test/Transforms/MemCpyOpt/align.ll
llvm/branches/R600/test/Transforms/SROA/alignment.ll
llvm/branches/R600/test/Transforms/SROA/basictest.ll
llvm/branches/R600/test/Transforms/SROA/fca.ll
llvm/branches/R600/test/Transforms/SROA/phi-and-select.ll
llvm/branches/R600/test/Transforms/SROA/vector-promotion.ll
llvm/branches/R600/test/Transforms/SimplifyCFG/phi-undef-loadstore.ll
llvm/branches/R600/test/lit.cfg
llvm/branches/R600/tools/bugpoint/ExtractFunction.cpp
llvm/branches/R600/tools/bugpoint/OptimizerDriver.cpp
llvm/branches/R600/tools/llc/llc.cpp
llvm/branches/R600/tools/lli/lli.cpp
llvm/branches/R600/tools/llvm-extract/llvm-extract.cpp
llvm/branches/R600/tools/llvm-rtdyld/llvm-rtdyld.cpp
llvm/branches/R600/tools/lto/LTOCodeGenerator.cpp
llvm/branches/R600/tools/lto/LTOModule.cpp
llvm/branches/R600/tools/lto/Makefile
llvm/branches/R600/tools/opt/opt.cpp
llvm/branches/R600/unittests/ADT/StringRefTest.cpp
llvm/branches/R600/unittests/ExecutionEngine/CMakeLists.txt
llvm/branches/R600/unittests/ExecutionEngine/JIT/JITTest.cpp
llvm/branches/R600/unittests/ExecutionEngine/Makefile
llvm/branches/R600/unittests/Support/CMakeLists.txt
llvm/branches/R600/unittests/VMCore/InstructionsTest.cpp
llvm/branches/R600/unittests/VMCore/PassManagerTest.cpp
llvm/branches/R600/utils/TableGen/AsmMatcherEmitter.cpp
llvm/branches/R600/utils/TableGen/CallingConvEmitter.cpp
llvm/branches/R600/utils/TableGen/CodeGenSchedule.cpp
llvm/branches/R600/utils/TableGen/CodeGenSchedule.h
llvm/branches/R600/utils/TableGen/FixedLenDecoderEmitter.cpp
llvm/branches/R600/utils/TableGen/IntrinsicEmitter.cpp
llvm/branches/R600/utils/TableGen/SetTheory.cpp
llvm/branches/R600/utils/TableGen/SubtargetEmitter.cpp
llvm/branches/R600/utils/TableGen/TableGen.cpp
Modified: llvm/branches/R600/.gitignore
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/.gitignore?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/.gitignore (original)
+++ llvm/branches/R600/.gitignore Thu Oct 11 16:28:00 2012
@@ -17,6 +17,7 @@
*.pyc
# vim swap files
.*.swp
+.sw?
#==============================================================================#
# Explicit files to ignore (only matches one).
Modified: llvm/branches/R600/CREDITS.TXT
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/CREDITS.TXT?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/CREDITS.TXT (original)
+++ llvm/branches/R600/CREDITS.TXT Thu Oct 11 16:28:00 2012
@@ -17,7 +17,7 @@
N: Owen Anderson
E: resistor at mac.com
D: LCSSA pass and related LoopUnswitch work
-D: GVNPRE pass, TargetData refactoring, random improvements
+D: GVNPRE pass, DataLayout refactoring, random improvements
N: Henrik Bach
D: MingW Win32 API portability layer
Modified: llvm/branches/R600/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/Makefile?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/Makefile (original)
+++ llvm/branches/R600/Makefile Thu Oct 11 16:28:00 2012
@@ -77,6 +77,7 @@
endif
ifeq ($(MAKECMDGOALS),clang-only)
+ BUILD_CLANG_ONLY := YES
DIRS := $(filter-out tools docs unittests, $(DIRS)) \
tools/clang tools/lto
OPTIONAL_DIRS :=
Modified: llvm/branches/R600/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/Makefile.rules?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/Makefile.rules (original)
+++ llvm/branches/R600/Makefile.rules Thu Oct 11 16:28:00 2012
@@ -631,19 +631,23 @@
# Adjust linker flags for building an executable
ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
-ifneq ($(HOST_OS), Darwin)
-ifdef TOOLNAME
- LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
- ifdef EXAMPLE_TOOL
- LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
- else
- LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag)
+ ifneq ($(HOST_OS), Darwin)
+ ifdef TOOLNAME
+ LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
+ ifdef EXAMPLE_TOOL
+ LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag)
+ else
+ LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag)
+ endif
endif
-endif
else
-ifneq ($(DARWIN_MAJVERS),4)
- LD.Flags += $(RPATH) -Wl, at executable_path/../lib
-endif
+ ifneq ($(DARWIN_MAJVERS),4)
+ LD.Flags += $(RPATH) -Wl, at executable_path/../lib
+ endif
+ ifeq ($(RC_BUILDIT),YES)
+ TempFile := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX)
+ LD.Flags += -Wl,-object_path_lto -Wl,$(TempFile)
+ endif
endif
endif
@@ -1524,7 +1528,7 @@
$(ToolAliasBuildPath): $(ToolBuildPath)
$(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg)
$(Verb) $(RM) -f $(ToolAliasBuildPath)
- $(Verb) $(AliasTool) $(TOOLEXENAME) $(ToolAliasBuildPath)
+ $(Verb) $(AliasTool) $(notdir $(ToolBuildPath)) $(ToolAliasBuildPath)
$(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \
$(StripWarnMsg)
endif
@@ -1563,7 +1567,7 @@
$(DestToolAlias): $(DestTool)
$(Echo) Installing $(BuildMode) $(DestToolAlias)
$(Verb) $(RM) -f $(DestToolAlias)
- $(Verb) $(AliasTool) $(TOOLEXENAME) $(DestToolAlias)
+ $(Verb) $(AliasTool) $(notdir $(DestTool)) $(DestToolAlias)
uninstall-local::
$(Echo) Uninstalling $(BuildMode) $(DestToolAlias)
Modified: llvm/branches/R600/bindings/ocaml/executionengine/llvm_executionengine.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/bindings/ocaml/executionengine/llvm_executionengine.ml?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/bindings/ocaml/executionengine/llvm_executionengine.ml (original)
+++ llvm/branches/R600/bindings/ocaml/executionengine/llvm_executionengine.ml Thu Oct 11 16:28:00 2012
@@ -83,8 +83,8 @@
external free_machine_code: Llvm.llvalue -> t -> unit
= "llvm_ee_free_machine_code"
- external target_data: t -> Llvm_target.TargetData.t
- = "LLVMGetExecutionEngineTargetData"
+ external target_data: t -> Llvm_target.DataLayout.t
+ = "LLVMGetExecutionEngineDataLayout"
(* The following are not bound. Patches are welcome.
Modified: llvm/branches/R600/bindings/ocaml/executionengine/llvm_executionengine.mli
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/bindings/ocaml/executionengine/llvm_executionengine.mli?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/bindings/ocaml/executionengine/llvm_executionengine.mli (original)
+++ llvm/branches/R600/bindings/ocaml/executionengine/llvm_executionengine.mli Thu Oct 11 16:28:00 2012
@@ -155,7 +155,7 @@
(** [target_data ee] is the target data owned by the execution engine
[ee]. *)
- val target_data : t -> Llvm_target.TargetData.t
+ val target_data : t -> Llvm_target.DataLayout.t
end
Modified: llvm/branches/R600/bindings/ocaml/llvm/llvm.mli
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/bindings/ocaml/llvm/llvm.mli?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/bindings/ocaml/llvm/llvm.mli (original)
+++ llvm/branches/R600/bindings/ocaml/llvm/llvm.mli Thu Oct 11 16:28:00 2012
@@ -375,7 +375,7 @@
val classify_type : lltype -> TypeKind.t
(** [type_is_sized ty] returns whether the type has a size or not.
- * If it doesn't then it is not safe to call the [TargetData::] methods on it.
+ * If it doesn't then it is not safe to call the [DataLayout::] methods on it.
* *)
val type_is_sized : lltype -> bool
Modified: llvm/branches/R600/bindings/ocaml/target/llvm_target.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/bindings/ocaml/target/llvm_target.ml?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/bindings/ocaml/target/llvm_target.ml (original)
+++ llvm/branches/R600/bindings/ocaml/target/llvm_target.ml Thu Oct 11 16:28:00 2012
@@ -13,7 +13,7 @@
| Little
end
-module TargetData = struct
+module DataLayout = struct
type t
external create : string -> t = "llvm_targetdata_create"
@@ -23,20 +23,20 @@
external dispose : t -> unit = "llvm_targetdata_dispose"
end
-external byte_order : TargetData.t -> Endian.t = "llvm_byte_order"
-external pointer_size : TargetData.t -> int = "llvm_pointer_size"
-external intptr_type : TargetData.t -> Llvm.lltype = "LLVMIntPtrType"
-external size_in_bits : TargetData.t -> Llvm.lltype -> Int64.t
+external byte_order : DataLayout.t -> Endian.t = "llvm_byte_order"
+external pointer_size : DataLayout.t -> int = "llvm_pointer_size"
+external intptr_type : DataLayout.t -> Llvm.lltype = "LLVMIntPtrType"
+external size_in_bits : DataLayout.t -> Llvm.lltype -> Int64.t
= "llvm_size_in_bits"
-external store_size : TargetData.t -> Llvm.lltype -> Int64.t = "llvm_store_size"
-external abi_size : TargetData.t -> Llvm.lltype -> Int64.t = "llvm_abi_size"
-external abi_align : TargetData.t -> Llvm.lltype -> int = "llvm_abi_align"
-external stack_align : TargetData.t -> Llvm.lltype -> int = "llvm_stack_align"
-external preferred_align : TargetData.t -> Llvm.lltype -> int
+external store_size : DataLayout.t -> Llvm.lltype -> Int64.t = "llvm_store_size"
+external abi_size : DataLayout.t -> Llvm.lltype -> Int64.t = "llvm_abi_size"
+external abi_align : DataLayout.t -> Llvm.lltype -> int = "llvm_abi_align"
+external stack_align : DataLayout.t -> Llvm.lltype -> int = "llvm_stack_align"
+external preferred_align : DataLayout.t -> Llvm.lltype -> int
= "llvm_preferred_align"
-external preferred_align_of_global : TargetData.t -> Llvm.llvalue -> int
+external preferred_align_of_global : DataLayout.t -> Llvm.llvalue -> int
= "llvm_preferred_align_of_global"
-external element_at_offset : TargetData.t -> Llvm.lltype -> Int64.t -> int
+external element_at_offset : DataLayout.t -> Llvm.lltype -> Int64.t -> int
= "llvm_element_at_offset"
-external offset_of_element : TargetData.t -> Llvm.lltype -> int -> Int64.t
+external offset_of_element : DataLayout.t -> Llvm.lltype -> int -> Int64.t
= "llvm_offset_of_element"
Modified: llvm/branches/R600/bindings/ocaml/target/llvm_target.mli
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/bindings/ocaml/target/llvm_target.mli?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/bindings/ocaml/target/llvm_target.mli (original)
+++ llvm/branches/R600/bindings/ocaml/target/llvm_target.mli Thu Oct 11 16:28:00 2012
@@ -18,11 +18,11 @@
| Little
end
-module TargetData : sig
+module DataLayout : sig
type t
- (** [TargetData.create rep] parses the target data string representation [rep].
- See the constructor llvm::TargetData::TargetData. *)
+ (** [DataLayout.create rep] parses the target data string representation [rep].
+ See the constructor llvm::DataLayout::DataLayout. *)
external create : string -> t = "llvm_targetdata_create"
(** [add_target_data td pm] adds the target data [td] to the pass manager [pm].
@@ -32,64 +32,64 @@
= "llvm_targetdata_add"
(** [as_string td] is the string representation of the target data [td].
- See the constructor llvm::TargetData::TargetData. *)
+ See the constructor llvm::DataLayout::DataLayout. *)
external as_string : t -> string = "llvm_targetdata_as_string"
- (** Deallocates a TargetData.
- See the destructor llvm::TargetData::~TargetData. *)
+ (** Deallocates a DataLayout.
+ See the destructor llvm::DataLayout::~DataLayout. *)
external dispose : t -> unit = "llvm_targetdata_dispose"
end
(** Returns the byte order of a target, either LLVMBigEndian or
LLVMLittleEndian.
- See the method llvm::TargetData::isLittleEndian. *)
-external byte_order : TargetData.t -> Endian.t = "llvm_byte_order"
+ See the method llvm::DataLayout::isLittleEndian. *)
+external byte_order : DataLayout.t -> Endian.t = "llvm_byte_order"
(** Returns the pointer size in bytes for a target.
- See the method llvm::TargetData::getPointerSize. *)
-external pointer_size : TargetData.t -> int = "llvm_pointer_size"
+ See the method llvm::DataLayout::getPointerSize. *)
+external pointer_size : DataLayout.t -> int = "llvm_pointer_size"
(** Returns the integer type that is the same size as a pointer on a target.
- See the method llvm::TargetData::getIntPtrType. *)
-external intptr_type : TargetData.t -> Llvm.lltype = "LLVMIntPtrType"
+ See the method llvm::DataLayout::getIntPtrType. *)
+external intptr_type : DataLayout.t -> Llvm.lltype = "LLVMIntPtrType"
(** Computes the size of a type in bytes for a target.
- See the method llvm::TargetData::getTypeSizeInBits. *)
-external size_in_bits : TargetData.t -> Llvm.lltype -> Int64.t
+ See the method llvm::DataLayout::getTypeSizeInBits. *)
+external size_in_bits : DataLayout.t -> Llvm.lltype -> Int64.t
= "llvm_size_in_bits"
(** Computes the storage size of a type in bytes for a target.
- See the method llvm::TargetData::getTypeStoreSize. *)
-external store_size : TargetData.t -> Llvm.lltype -> Int64.t = "llvm_store_size"
+ See the method llvm::DataLayout::getTypeStoreSize. *)
+external store_size : DataLayout.t -> Llvm.lltype -> Int64.t = "llvm_store_size"
(** Computes the ABI size of a type in bytes for a target.
- See the method llvm::TargetData::getTypeAllocSize. *)
-external abi_size : TargetData.t -> Llvm.lltype -> Int64.t = "llvm_abi_size"
+ See the method llvm::DataLayout::getTypeAllocSize. *)
+external abi_size : DataLayout.t -> Llvm.lltype -> Int64.t = "llvm_abi_size"
(** Computes the ABI alignment of a type in bytes for a target.
- See the method llvm::TargetData::getTypeABISize. *)
-external abi_align : TargetData.t -> Llvm.lltype -> int = "llvm_abi_align"
+ See the method llvm::DataLayout::getTypeABISize. *)
+external abi_align : DataLayout.t -> Llvm.lltype -> int = "llvm_abi_align"
(** Computes the call frame alignment of a type in bytes for a target.
- See the method llvm::TargetData::getTypeABISize. *)
-external stack_align : TargetData.t -> Llvm.lltype -> int = "llvm_stack_align"
+ See the method llvm::DataLayout::getTypeABISize. *)
+external stack_align : DataLayout.t -> Llvm.lltype -> int = "llvm_stack_align"
(** Computes the preferred alignment of a type in bytes for a target.
- See the method llvm::TargetData::getTypeABISize. *)
-external preferred_align : TargetData.t -> Llvm.lltype -> int
+ See the method llvm::DataLayout::getTypeABISize. *)
+external preferred_align : DataLayout.t -> Llvm.lltype -> int
= "llvm_preferred_align"
(** Computes the preferred alignment of a global variable in bytes for a target.
- See the method llvm::TargetData::getPreferredAlignment. *)
-external preferred_align_of_global : TargetData.t -> Llvm.llvalue -> int
+ See the method llvm::DataLayout::getPreferredAlignment. *)
+external preferred_align_of_global : DataLayout.t -> Llvm.llvalue -> int
= "llvm_preferred_align_of_global"
(** Computes the structure element that contains the byte offset for a target.
See the method llvm::StructLayout::getElementContainingOffset. *)
-external element_at_offset : TargetData.t -> Llvm.lltype -> Int64.t -> int
+external element_at_offset : DataLayout.t -> Llvm.lltype -> Int64.t -> int
= "llvm_element_at_offset"
(** Computes the byte offset of the indexed struct element for a target.
See the method llvm::StructLayout::getElementContainingOffset. *)
-external offset_of_element : TargetData.t -> Llvm.lltype -> int -> Int64.t
+external offset_of_element : DataLayout.t -> Llvm.lltype -> int -> Int64.t
= "llvm_offset_of_element"
Modified: llvm/branches/R600/bindings/ocaml/target/target_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/bindings/ocaml/target/target_ocaml.c?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/bindings/ocaml/target/target_ocaml.c (original)
+++ llvm/branches/R600/bindings/ocaml/target/target_ocaml.c Thu Oct 11 16:28:00 2012
@@ -18,18 +18,18 @@
#include "llvm-c/Target.h"
#include "caml/alloc.h"
-/* string -> TargetData.t */
+/* string -> DataLayout.t */
CAMLprim LLVMTargetDataRef llvm_targetdata_create(value StringRep) {
return LLVMCreateTargetData(String_val(StringRep));
}
-/* TargetData.t -> [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
+/* DataLayout.t -> [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
CAMLprim value llvm_targetdata_add(LLVMTargetDataRef TD, LLVMPassManagerRef PM){
LLVMAddTargetData(TD, PM);
return Val_unit;
}
-/* TargetData.t -> string */
+/* DataLayout.t -> string */
CAMLprim value llvm_targetdata_as_string(LLVMTargetDataRef TD) {
char *StringRep = LLVMCopyStringRepOfTargetData(TD);
value Copy = copy_string(StringRep);
@@ -37,65 +37,65 @@
return Copy;
}
-/* TargetData.t -> unit */
+/* DataLayout.t -> unit */
CAMLprim value llvm_targetdata_dispose(LLVMTargetDataRef TD) {
LLVMDisposeTargetData(TD);
return Val_unit;
}
-/* TargetData.t -> Endian.t */
+/* DataLayout.t -> Endian.t */
CAMLprim value llvm_byte_order(LLVMTargetDataRef TD) {
return Val_int(LLVMByteOrder(TD));
}
-/* TargetData.t -> int */
+/* DataLayout.t -> int */
CAMLprim value llvm_pointer_size(LLVMTargetDataRef TD) {
return Val_int(LLVMPointerSize(TD));
}
-/* TargetData.t -> Llvm.lltype -> Int64.t */
+/* DataLayout.t -> Llvm.lltype -> Int64.t */
CAMLprim value llvm_size_in_bits(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
return caml_copy_int64(LLVMSizeOfTypeInBits(TD, Ty));
}
-/* TargetData.t -> Llvm.lltype -> Int64.t */
+/* DataLayout.t -> Llvm.lltype -> Int64.t */
CAMLprim value llvm_store_size(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
return caml_copy_int64(LLVMStoreSizeOfType(TD, Ty));
}
-/* TargetData.t -> Llvm.lltype -> Int64.t */
+/* DataLayout.t -> Llvm.lltype -> Int64.t */
CAMLprim value llvm_abi_size(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
return caml_copy_int64(LLVMABISizeOfType(TD, Ty));
}
-/* TargetData.t -> Llvm.lltype -> int */
+/* DataLayout.t -> Llvm.lltype -> int */
CAMLprim value llvm_abi_align(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
return Val_int(LLVMABIAlignmentOfType(TD, Ty));
}
-/* TargetData.t -> Llvm.lltype -> int */
+/* DataLayout.t -> Llvm.lltype -> int */
CAMLprim value llvm_stack_align(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
return Val_int(LLVMCallFrameAlignmentOfType(TD, Ty));
}
-/* TargetData.t -> Llvm.lltype -> int */
+/* DataLayout.t -> Llvm.lltype -> int */
CAMLprim value llvm_preferred_align(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
return Val_int(LLVMPreferredAlignmentOfType(TD, Ty));
}
-/* TargetData.t -> Llvm.llvalue -> int */
+/* DataLayout.t -> Llvm.llvalue -> int */
CAMLprim value llvm_preferred_align_of_global(LLVMTargetDataRef TD,
LLVMValueRef GlobalVar) {
return Val_int(LLVMPreferredAlignmentOfGlobal(TD, GlobalVar));
}
-/* TargetData.t -> Llvm.lltype -> Int64.t -> int */
+/* DataLayout.t -> Llvm.lltype -> Int64.t -> int */
CAMLprim value llvm_element_at_offset(LLVMTargetDataRef TD, LLVMTypeRef Ty,
value Offset) {
return Val_int(LLVMElementAtOffset(TD, Ty, Int_val(Offset)));
}
-/* TargetData.t -> Llvm.lltype -> int -> Int64.t */
+/* DataLayout.t -> Llvm.lltype -> int -> Int64.t */
CAMLprim value llvm_offset_of_element(LLVMTargetDataRef TD, LLVMTypeRef Ty,
value Index) {
return caml_copy_int64(LLVMOffsetOfElement(TD, Ty, Int_val(Index)));
Modified: llvm/branches/R600/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/cmake/modules/AddLLVM.cmake?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/cmake/modules/AddLLVM.cmake (original)
+++ llvm/branches/R600/cmake/modules/AddLLVM.cmake Thu Oct 11 16:28:00 2012
@@ -135,16 +135,22 @@
# lld, and Polly. This adds two options. One for the source directory of the
# project, which defaults to ${CMAKE_CURRENT_SOURCE_DIR}/${name}. Another to
# enable or disable building it with everthing else.
+# Additional parameter can be specified as the name of directory.
macro(add_llvm_external_project name)
- string(TOUPPER ${name} nameUPPER)
- set(LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${name}"
+ set(add_llvm_external_dir "${ARGN}")
+ if("${add_llvm_external_dir}" STREQUAL "")
+ set(add_llvm_external_dir ${name})
+ endif()
+ string(REPLACE "-" "_" nameUNDERSCORE ${name})
+ string(TOUPPER ${nameUNDERSCORE} nameUPPER)
+ set(LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${add_llvm_external_dir}"
CACHE PATH "Path to ${name} source directory")
if (NOT ${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR} STREQUAL ""
AND EXISTS ${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR}/CMakeLists.txt)
option(LLVM_EXTERNAL_${nameUPPER}_BUILD
"Whether to build ${name} as part of LLVM" ON)
if (LLVM_EXTERNAL_${nameUPPER}_BUILD)
- add_subdirectory(${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR} ${name})
+ add_subdirectory(${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR} ${add_llvm_external_dir})
endif()
endif()
endmacro(add_llvm_external_project)
@@ -278,11 +284,14 @@
function(add_lit_testsuite target comment)
parse_arguments(ARG "PARAMS;DEPENDS;ARGS" "" ${ARGN})
- # Register the testsuites, params and depends for the global check rule.
- set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${ARG_DEFAULT_ARGS})
- set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${ARG_PARAMS})
- set_property(GLOBAL APPEND PROPERTY LLVM_LIT_DEPENDS ${ARG_DEPENDS})
- set_property(GLOBAL APPEND PROPERTY LLVM_LIT_EXTRA_ARGS ${ARG_ARGS})
+ # EXCLUDE_FROM_ALL excludes the test ${target} out of check-all.
+ if(NOT EXCLUDE_FROM_ALL)
+ # Register the testsuites, params and depends for the global check rule.
+ set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${ARG_DEFAULT_ARGS})
+ set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${ARG_PARAMS})
+ set_property(GLOBAL APPEND PROPERTY LLVM_LIT_DEPENDS ${ARG_DEPENDS})
+ set_property(GLOBAL APPEND PROPERTY LLVM_LIT_EXTRA_ARGS ${ARG_ARGS})
+ endif()
# Produce a specific suffixed check rule.
add_lit_target(${target} ${comment}
Modified: llvm/branches/R600/docs/CodeGenerator.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/CodeGenerator.rst?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/CodeGenerator.rst (original)
+++ llvm/branches/R600/docs/CodeGenerator.rst Thu Oct 11 16:28:00 2012
@@ -81,7 +81,7 @@
The two pieces of the LLVM code generator are the high-level interface to the
code generator and the set of reusable components that can be used to build
target-specific backends. The two most important interfaces (:raw-html:`<tt>`
-`TargetMachine`_ :raw-html:`</tt>` and :raw-html:`<tt>` `TargetData`_
+`TargetMachine`_ :raw-html:`</tt>` and :raw-html:`<tt>` `DataLayout`_
:raw-html:`</tt>`) are the only ones that are required to be defined for a
backend to fit into the LLVM system, but the others must be defined if the
reusable code generator components are going to be used.
@@ -197,7 +197,7 @@
properties of the target (such as the instructions and registers it has), and do
not incorporate any particular pieces of code generation algorithms.
-All of the target description classes (except the :raw-html:`<tt>` `TargetData`_
+All of the target description classes (except the :raw-html:`<tt>` `DataLayout`_
:raw-html:`</tt>` class) are designed to be subclassed by the concrete target
implementation, and have virtual methods implemented. To get to these
implementations, the :raw-html:`<tt>` `TargetMachine`_ :raw-html:`</tt>` class
@@ -214,18 +214,18 @@
``getFrameInfo``, etc.). This class is designed to be specialized by a concrete
target implementation (e.g., ``X86TargetMachine``) which implements the various
virtual methods. The only required target description class is the
-:raw-html:`<tt>` `TargetData`_ :raw-html:`</tt>` class, but if the code
+:raw-html:`<tt>` `DataLayout`_ :raw-html:`</tt>` class, but if the code
generator components are to be used, the other interfaces should be implemented
as well.
-.. _TargetData:
+.. _DataLayout:
-The ``TargetData`` class
+The ``DataLayout`` class
------------------------
-The ``TargetData`` class is the only required target description class, and it
+The ``DataLayout`` class is the only required target description class, and it
is the only class that is not extensible (you cannot derived a new class from
-it). ``TargetData`` specifies information about how the target lays out memory
+it). ``DataLayout`` specifies information about how the target lays out memory
for structures, the alignment requirements for various data types, the size of
pointers in the target, and whether the target is little-endian or
big-endian.
Removed: llvm/branches/R600/docs/CompilerWriterInfo.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/CompilerWriterInfo.html?rev=165747&view=auto
==============================================================================
--- llvm/branches/R600/docs/CompilerWriterInfo.html (original)
+++ llvm/branches/R600/docs/CompilerWriterInfo.html (removed)
@@ -1,267 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Architecture/platform information for compiler writers</title>
- <link rel="stylesheet" href="_static/llvm.css" type="text/css">
-</head>
-
-<body>
-
-<h1>
- Architecture/platform information for compiler writers
-</h1>
-
-<div class="doc_warning">
- <p>Note: This document is a work-in-progress. Additions and clarifications
- are welcome.</p>
-</div>
-
-<ol>
- <li><a href="#hw">Hardware</a>
- <ol>
- <li><a href="#arm">ARM</a></li>
- <li><a href="#ia64">Itanium</a></li>
- <li><a href="#mips">MIPS</a></li>
- <li><a href="#ppc">PowerPC</a></li>
- <li><a href="#sparc">SPARC</a></li>
- <li><a href="#x86">X86</a></li>
- <li><a href="#other">Other lists</a></li>
- </ol></li>
- <li><a href="#abi">Application Binary Interface (ABI)</a>
- <ol>
- <li><a href="#linux">Linux</a></li>
- <li><a href="#osx">OS X</a></li>
- </ol></li>
- <li><a href="#misc">Miscellaneous resources</a></li>
-</ol>
-
-<div class="doc_author">
- <p>Compiled by <a href="http://misha.brukman.net">Misha Brukman</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<h2><a name="hw">Hardware</a></h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<!-- ======================================================================= -->
-<h3><a name="arm">ARM</a></h3>
-
-<div>
-<ul>
-<li><a href="http://www.arm.com/documentation/">ARM documentation</a>
-(<a href="http://www.arm.com/documentation/ARMProcessor_Cores/">Processor
-Cores</a>)</li>
-<li><a href="http://www.arm.com/products/DevTools/ABI.html">ABI</a></li>
-</ul>
-</div>
-
-<!-- ======================================================================= -->
-<h3><a name="ia64">Itanium (ia64)</a></h3>
-
-<div>
-<ul>
-<li><a
-href="http://developer.intel.com/design/itanium2/documentation.htm">Itanium documentation</a>
-</li>
-</ul>
-</div>
-
-<!-- ======================================================================= -->
-<h3><a name="mips">MIPS</a></h3>
-
-<div>
-<ul>
-<li><a
-href="http://mips.com/content/Documentation/MIPSDocumentation/ProcessorArchitecture/doclibrary">MIPS
-Processor Architecture</a></li>
-</ul>
-</div>
-
-<!-- ======================================================================= -->
-<h3><a name="ppc">PowerPC</a></h3>
-
-<div>
-
-<!-- _______________________________________________________________________ -->
-<h4>IBM - Official manuals and docs</h4>
-
-<div>
-
-<ul>
-<li><a
-href="http://www-106.ibm.com/developerworks/eserver/articles/archguide.html">PowerPC
-Architecture Book</a>
-<ul>
- <li>Book I: <a
- href="http://www-106.ibm.com/developerworks/eserver/pdfs/archpub1.pdf">PowerPC
- User Instruction Set Architecture</a></li>
- <li>Book II: <a
- href="http://www-106.ibm.com/developerworks/eserver/pdfs/archpub2.pdf">PowerPC
- Virtual Environment Architecture</a></li>
- <li>Book III: <a
- href="http://www-106.ibm.com/developerworks/eserver/pdfs/archpub3.pdf">PowerPC
- Operating Environment Architecture</a></li>
-</ul></li>
-<li><a
-href="http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/852569B20050FF7785256996007558C6">PowerPC
-Compiler Writer's Guide</a></li>
-<li><A
-href="http://www-3.ibm.com/chips/techlib/techlib.nsf/products/PowerPC">PowerPC
-Processor Manuals</a></li>
-<li><a
-href="http://www-106.ibm.com/developerworks/linux/library/l-powarch/">Intro to
-PowerPC architecture</a></li>
-<li><a href="http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixassem/alangref/alangreftfrm.htm">IBM AIX/5L for POWER Assembly reference</a></li>
-</ul>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<h4>Other documents, collections, notes</h4>
-
-<div>
-
-<ul>
-<li><a href="http://penguinppc.org/dev/#library">PowerPC ABI documents</a></li>
-<li><a href="http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00997.html">PowerPC64
-alignment of long doubles (from GCC)</a></li>
-<li><a href="http://sources.redhat.com/ml/binutils/2002-04/msg00573.html">Long
-branch stubs for powerpc64-linux (from binutils)</a></li>
-</ul>
-
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3><a name="sparc">SPARC</a></h3>
-
-<div>
-
-<ul>
-<li><a href="http://www.sparc.org/resource.htm">SPARC resources</a></li>
-<li><a href="http://www.sparc.org/standards.html">SPARC standards</a></li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3><a name="x86">X86</a></h3>
-
-<div>
-
-<!-- _______________________________________________________________________ -->
-<h4>AMD - Official manuals and docs</h4>
-
-<div>
-<ul>
-<li><a
-href="http://www.amd.com/us-en/Processors/TechnicalResources/0,,30_182_739,00.html">AMD processor manuals</a></li>
-<li><a href="http://www.x86-64.org/documentation">X86-64 ABI</a></li>
-</ul>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<h4>Intel - Official manuals and docs</h4>
-
-<div>
-<ul>
-<li><a
-href="http://developer.intel.com/design/pentium4/manuals/index_new.htm">IA-32
-manuals</a></li>
-<li><a
-href="http://www.intel.com/design/itanium/documentation.htm?iid=ipp_srvr_proc_itanium2+techdocs">Intel
-Itanium documentation</a></li>
-</ul>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<h4>Other x86-specific information</h4>
-
-<div>
-<ul>
-<li><a href="http://www.agner.org/assem/calling_conventions.pdf">Calling
-conventions for different C++ compilers and operating systems</a></li>
-</ul>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3><a name="other">Other relevant lists</a></h3>
-
-<div>
-
-<ul>
-<li><a href="http://gcc.gnu.org/readings.html">GCC reading list</a></li>
-</ul>
-
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2><a name="abi">ABI</a></h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<!-- ======================================================================= -->
-<h3><a name="linux">Linux</a></h3>
-
-<div>
-<ol>
-<li><a href="http://www.linuxbase.org/spec/ELF/ppc64/">PowerPC 64-bit ELF ABI
-Supplement</a></li>
-</ol>
-</div>
-
-<!-- ======================================================================= -->
-<h3><a name="osx">OS X</a></h3>
-
-<div>
-<ol>
-<li><a
-href="http://developer.apple.com/documentation/Darwin/RuntimeArchitecture-date.html">Mach-O
-Runtime Architecture</a></li>
-<li><a href="http://www.unsanity.org/archives/000044.php">Notes on Mach-O
-ABI</a></li>
-</ol>
-
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2><a name="misc">Miscellaneous resources</a></h2>
-<!-- *********************************************************************** -->
-
-<ul>
-<li><a
-href="http://www.nondot.org/sabre/os/articles/ExecutableFileFormats/">Executable
-File Format library</a></li>
-<li><a href="http://gcc.gnu.org/projects/prefetch.html">GCC prefetch project</a>
-page has a good survey of the prefetching capabilities of a variety of modern
-processors.</li>
-</ul>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
- <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
- src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
- <a href="http://validator.w3.org/check/referer"><img
- src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
- <a href="http://misha.brukman.net">Misha Brukman</a><br>
- <a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
- Last modified: $Date$
-</address>
-
-</body>
-</html>
Added: llvm/branches/R600/docs/CompilerWriterInfo.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/CompilerWriterInfo.rst?rev=165748&view=auto
==============================================================================
--- llvm/branches/R600/docs/CompilerWriterInfo.rst (added)
+++ llvm/branches/R600/docs/CompilerWriterInfo.rst Thu Oct 11 16:28:00 2012
@@ -0,0 +1,118 @@
+.. _compiler_writer_info:
+
+========================================================
+Architecture & Platform Information for Compiler Writers
+========================================================
+
+.. contents::
+ :local:
+
+.. note::
+
+ This document is a work-in-progress. Additions and clarifications are
+ welcome.
+
+ Compiled by `Misha Brukman <http://misha.brukman.net>`_.
+
+Hardware
+========
+
+ARM
+---
+
+* `ARM documentation <http://www.arm.com/documentation/>`_ (`Processor Cores <http://www.arm.com/documentation/ARMProcessor_Cores/>`_ Cores)
+
+* `ABI <http://www.arm.com/products/DevTools/ABI.html>`_
+
+Itanium (ia64)
+--------------
+
+* `Itanium documentation <http://developer.intel.com/design/itanium2/documentation.htm>`_
+
+MIPS
+----
+
+* `MIPS Processor Architecture <http://mips.com/content/Documentation/MIPSDocumentation/ProcessorArchitecture/doclibrary>`_
+
+PowerPC
+-------
+
+IBM - Official manuals and docs
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+* `PowerPC Architecture Book <http://www-106.ibm.com/developerworks/eserver/articles/archguide.html>`_
+
+ * Book I: `PowerPC User Instruction Set Architecture <http://www-106.ibm.com/developerworks/eserver/pdfs/archpub1.pdf>`_
+
+ * Book II: `PowerPC Virtual Environment Architecture <http://www-106.ibm.com/developerworks/eserver/pdfs/archpub2.pdf>`_
+
+ * Book III: `PowerPC Operating Environment Architecture <http://www-106.ibm.com/developerworks/eserver/pdfs/archpub3.pdf>`_
+
+* `PowerPC Compiler Writer's Guide <http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/852569B20050FF7785256996007558C6>`_
+
+* `PowerPC Processor Manuals <http://www-3.ibm.com/chips/techlib/techlib.nsf/products/PowerPC>`_
+
+* `Intro to PowerPC Architecture <http://www-106.ibm.com/developerworks/linux/library/l-powarch/>`_
+
+* `IBM AIX/5L for POWER Assembly Reference <http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixassem/alangref/alangreftfrm.htm>`_
+
+Other documents, collections, notes
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+* `PowerPC ABI documents <http://penguinppc.org/dev/#library>`_
+* `PowerPC64 alignment of long doubles (from GCC) <http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00997.html>`_
+* `Long branch stubs for powerpc64-linux (from binutils) <http://sources.redhat.com/ml/binutils/2002-04/msg00573.html>`_
+
+SPARC
+-----
+
+* `SPARC resources <http://www.sparc.org/resource.htm>`_
+* `SPARC standards <http://www.sparc.org/standards.html>`_
+
+X86
+---
+
+AMD - Official manuals and docs
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+* `AMD processor manuals <http://www.amd.com/us-en/Processors/TechnicalResources/0,,30_182_739,00.html>`_
+* `X86-64 ABI <http://www.x86-64.org/documentation>`_
+
+Intel - Official manuals and docs
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+* `IA-32 manuals <http://developer.intel.com/design/pentium4/manuals/index_new.htm>`_
+* `Intel Itanium documentation <http://www.intel.com/design/itanium/documentation.htm?iid=ipp_srvr_proc_itanium2+techdocs>`_
+
+Other x86-specific information
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+* `Calling conventions for different C++ compilers and operating systems <http://www.agner.org/assem/calling_conventions.pdf>`_
+
+Other relevant lists
+--------------------
+
+* `GCC reading list <http://gcc.gnu.org/readings.html>`_
+
+ABI
+===
+
+Linux
+-----
+
+* `PowerPC 64-bit ELF ABI Supplement <http://www.linuxbase.org/spec/ELF/ppc64/>`_
+
+OS X
+----
+
+* `Mach-O Runtime Architecture <http://developer.apple.com/documentation/Darwin/RuntimeArchitecture-date.html>`_
+* `Notes on Mach-O ABI <http://www.unsanity.org/archives/000044.php>`_
+
+Miscellaneous Resources
+=======================
+
+* `Executable File Format library <http://www.nondot.org/sabre/os/articles/ExecutableFileFormats/>`_
+
+* `GCC prefetch project <http://gcc.gnu.org/projects/prefetch.html>`_ page has a
+ good survey of the prefetching capabilities of a variety of modern
+ processors.
Removed: llvm/branches/R600/docs/ExtendingLLVM.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/ExtendingLLVM.html?rev=165747&view=auto
==============================================================================
--- llvm/branches/R600/docs/ExtendingLLVM.html (original)
+++ llvm/branches/R600/docs/ExtendingLLVM.html (removed)
@@ -1,379 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Extending LLVM: Adding instructions, intrinsics, types, etc.</title>
- <link rel="stylesheet" href="_static/llvm.css" type="text/css">
-</head>
-
-<body>
-
-<h1>
- Extending LLVM: Adding instructions, intrinsics, types, etc.
-</h1>
-
-<ol>
- <li><a href="#introduction">Introduction and Warning</a></li>
- <li><a href="#intrinsic">Adding a new intrinsic function</a></li>
- <li><a href="#instruction">Adding a new instruction</a></li>
- <li><a href="#sdnode">Adding a new SelectionDAG node</a></li>
- <li><a href="#type">Adding a new type</a>
- <ol>
- <li><a href="#fund_type">Adding a new fundamental type</a></li>
- <li><a href="#derived_type">Adding a new derived type</a></li>
- </ol></li>
-</ol>
-
-<div class="doc_author">
- <p>Written by <a href="http://misha.brukman.net">Misha Brukman</a>,
- Brad Jones, Nate Begeman,
- and <a href="http://nondot.org/sabre">Chris Lattner</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="introduction">Introduction and Warning</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>During the course of using LLVM, you may wish to customize it for your
-research project or for experimentation. At this point, you may realize that
-you need to add something to LLVM, whether it be a new fundamental type, a new
-intrinsic function, or a whole new instruction.</p>
-
-<p>When you come to this realization, stop and think. Do you really need to
-extend LLVM? Is it a new fundamental capability that LLVM does not support at
-its current incarnation or can it be synthesized from already pre-existing LLVM
-elements? If you are not sure, ask on the <a
-href="http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVM-dev</a> list. The
-reason is that extending LLVM will get involved as you need to update all the
-different passes that you intend to use with your extension, and there are
-<em>many</em> LLVM analyses and transformations, so it may be quite a bit of
-work.</p>
-
-<p>Adding an <a href="#intrinsic">intrinsic function</a> is far easier than
-adding an instruction, and is transparent to optimization passes. If your added
-functionality can be expressed as a
-function call, an intrinsic function is the method of choice for LLVM
-extension.</p>
-
-<p>Before you invest a significant amount of effort into a non-trivial
-extension, <span class="doc_warning">ask on the list</span> if what you are
-looking to do can be done with already-existing infrastructure, or if maybe
-someone else is already working on it. You will save yourself a lot of time and
-effort by doing so.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="intrinsic">Adding a new intrinsic function</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>Adding a new intrinsic function to LLVM is much easier than adding a new
-instruction. Almost all extensions to LLVM should start as an intrinsic
-function and then be turned into an instruction if warranted.</p>
-
-<ol>
-<li><tt>llvm/docs/LangRef.html</tt>:
- Document the intrinsic. Decide whether it is code generator specific and
- what the restrictions are. Talk to other people about it so that you are
- sure it's a good idea.</li>
-
-<li><tt>llvm/include/llvm/Intrinsics*.td</tt>:
- Add an entry for your intrinsic. Describe its memory access characteristics
- for optimization (this controls whether it will be DCE'd, CSE'd, etc). Note
- that any intrinsic using the <tt>llvm_int_ty</tt> type for an argument will
- be deemed by <tt>tblgen</tt> as overloaded and the corresponding suffix
- will be required on the intrinsic's name.</li>
-
-<li><tt>llvm/lib/Analysis/ConstantFolding.cpp</tt>: If it is possible to
- constant fold your intrinsic, add support to it in the
- <tt>canConstantFoldCallTo</tt> and <tt>ConstantFoldCall</tt> functions.</li>
-
-<li><tt>llvm/test/Regression/*</tt>: Add test cases for your test cases to the
- test suite</li>
-</ol>
-
-<p>Once the intrinsic has been added to the system, you must add code generator
-support for it. Generally you must do the following steps:</p>
-
-<dl>
-
-<dt>Add support to the .td file for the target(s) of your choice in
- <tt>lib/Target/*/*.td</tt>.</dt>
-
-<dd>This is usually a matter of adding a pattern to the .td file that matches
- the intrinsic, though it may obviously require adding the instructions you
- want to generate as well. There are lots of examples in the PowerPC and X86
- backend to follow.</dd>
-</dl>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="sdnode">Adding a new SelectionDAG node</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>As with intrinsics, adding a new SelectionDAG node to LLVM is much easier
-than adding a new instruction. New nodes are often added to help represent
-instructions common to many targets. These nodes often map to an LLVM
-instruction (add, sub) or intrinsic (byteswap, population count). In other
-cases, new nodes have been added to allow many targets to perform a common task
-(converting between floating point and integer representation) or capture more
-complicated behavior in a single node (rotate).</p>
-
-<ol>
-<li><tt>include/llvm/CodeGen/ISDOpcodes.h</tt>:
- Add an enum value for the new SelectionDAG node.</li>
-<li><tt>lib/CodeGen/SelectionDAG/SelectionDAG.cpp</tt>:
- Add code to print the node to <tt>getOperationName</tt>. If your new node
- can be evaluated at compile time when given constant arguments (such as an
- add of a constant with another constant), find the <tt>getNode</tt> method
- that takes the appropriate number of arguments, and add a case for your node
- to the switch statement that performs constant folding for nodes that take
- the same number of arguments as your new node.</li>
-<li><tt>lib/CodeGen/SelectionDAG/LegalizeDAG.cpp</tt>:
- Add code to <a href="CodeGenerator.html#selectiondag_legalize">legalize,
- promote, and expand</a> the node as necessary. At a minimum, you will need
- to add a case statement for your node in <tt>LegalizeOp</tt> which calls
- LegalizeOp on the node's operands, and returns a new node if any of the
- operands changed as a result of being legalized. It is likely that not all
- targets supported by the SelectionDAG framework will natively support the
- new node. In this case, you must also add code in your node's case
- statement in <tt>LegalizeOp</tt> to Expand your node into simpler, legal
- operations. The case for <tt>ISD::UREM</tt> for expanding a remainder into
- a divide, multiply, and a subtract is a good example.</li>
-<li><tt>lib/CodeGen/SelectionDAG/LegalizeDAG.cpp</tt>:
- If targets may support the new node being added only at certain sizes, you
- will also need to add code to your node's case statement in
- <tt>LegalizeOp</tt> to Promote your node's operands to a larger size, and
- perform the correct operation. You will also need to add code to
- <tt>PromoteOp</tt> to do this as well. For a good example, see
- <tt>ISD::BSWAP</tt>,
- which promotes its operand to a wider size, performs the byteswap, and then
- shifts the correct bytes right to emulate the narrower byteswap in the
- wider type.</li>
-<li><tt>lib/CodeGen/SelectionDAG/LegalizeDAG.cpp</tt>:
- Add a case for your node in <tt>ExpandOp</tt> to teach the legalizer how to
- perform the action represented by the new node on a value that has been
- split into high and low halves. This case will be used to support your
- node with a 64 bit operand on a 32 bit target.</li>
-<li><tt>lib/CodeGen/SelectionDAG/DAGCombiner.cpp</tt>:
- If your node can be combined with itself, or other existing nodes in a
- peephole-like fashion, add a visit function for it, and call that function
- from <tt></tt>. There are several good examples for simple combines you
- can do; <tt>visitFABS</tt> and <tt>visitSRL</tt> are good starting places.
- </li>
-<li><tt>lib/Target/PowerPC/PPCISelLowering.cpp</tt>:
- Each target has an implementation of the <tt>TargetLowering</tt> class,
- usually in its own file (although some targets include it in the same
- file as the DAGToDAGISel). The default behavior for a target is to
- assume that your new node is legal for all types that are legal for
- that target. If this target does not natively support your node, then
- tell the target to either Promote it (if it is supported at a larger
- type) or Expand it. This will cause the code you wrote in
- <tt>LegalizeOp</tt> above to decompose your new node into other legal
- nodes for this target.</li>
-<li><tt>lib/Target/TargetSelectionDAG.td</tt>:
- Most current targets supported by LLVM generate code using the DAGToDAG
- method, where SelectionDAG nodes are pattern matched to target-specific
- nodes, which represent individual instructions. In order for the targets
- to match an instruction to your new node, you must add a def for that node
- to the list in this file, with the appropriate type constraints. Look at
- <tt>add</tt>, <tt>bswap</tt>, and <tt>fadd</tt> for examples.</li>
-<li><tt>lib/Target/PowerPC/PPCInstrInfo.td</tt>:
- Each target has a tablegen file that describes the target's instruction
- set. For targets that use the DAGToDAG instruction selection framework,
- add a pattern for your new node that uses one or more target nodes.
- Documentation for this is a bit sparse right now, but there are several
- decent examples. See the patterns for <tt>rotl</tt> in
- <tt>PPCInstrInfo.td</tt>.</li>
-<li>TODO: document complex patterns.</li>
-<li><tt>llvm/test/Regression/CodeGen/*</tt>: Add test cases for your new node
- to the test suite. <tt>llvm/test/Regression/CodeGen/X86/bswap.ll</tt> is
- a good example.</li>
-</ol>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="instruction">Adding a new instruction</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p><span class="doc_warning">WARNING: adding instructions changes the bitcode
-format, and it will take some effort to maintain compatibility with
-the previous version.</span> Only add an instruction if it is absolutely
-necessary.</p>
-
-<ol>
-
-<li><tt>llvm/include/llvm/Instruction.def</tt>:
- add a number for your instruction and an enum name</li>
-
-<li><tt>llvm/include/llvm/Instructions.h</tt>:
- add a definition for the class that will represent your instruction</li>
-
-<li><tt>llvm/include/llvm/Support/InstVisitor.h</tt>:
- add a prototype for a visitor to your new instruction type</li>
-
-<li><tt>llvm/lib/AsmParser/Lexer.l</tt>:
- add a new token to parse your instruction from assembly text file</li>
-
-<li><tt>llvm/lib/AsmParser/llvmAsmParser.y</tt>:
- add the grammar on how your instruction can be read and what it will
- construct as a result</li>
-
-<li><tt>llvm/lib/Bitcode/Reader/Reader.cpp</tt>:
- add a case for your instruction and how it will be parsed from bitcode</li>
-
-<li><tt>llvm/lib/VMCore/Instruction.cpp</tt>:
- add a case for how your instruction will be printed out to assembly</li>
-
-<li><tt>llvm/lib/VMCore/Instructions.cpp</tt>:
- implement the class you defined in
- <tt>llvm/include/llvm/Instructions.h</tt></li>
-
-<li>Test your instruction</li>
-
-<li><tt>llvm/lib/Target/*</tt>:
- Add support for your instruction to code generators, or add a lowering
- pass.</li>
-
-<li><tt>llvm/test/Regression/*</tt>: add your test cases to the test suite.</li>
-
-</ol>
-
-<p>Also, you need to implement (or modify) any analyses or passes that you want
-to understand this new instruction.</p>
-
-</div>
-
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="type">Adding a new type</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p><span class="doc_warning">WARNING: adding new types changes the bitcode
-format, and will break compatibility with currently-existing LLVM
-installations.</span> Only add new types if it is absolutely necessary.</p>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="fund_type">Adding a fundamental type</a>
-</h3>
-
-<div>
-
-<ol>
-
-<li><tt>llvm/include/llvm/Type.h</tt>:
- add enum for the new type; add static <tt>Type*</tt> for this type</li>
-
-<li><tt>llvm/lib/VMCore/Type.cpp</tt>:
- add mapping from <tt>TypeID</tt> => <tt>Type*</tt>;
- initialize the static <tt>Type*</tt></li>
-
-<li><tt>llvm/lib/AsmReader/Lexer.l</tt>:
- add ability to parse in the type from text assembly</li>
-
-<li><tt>llvm/lib/AsmReader/llvmAsmParser.y</tt>:
- add a token for that type</li>
-
-</ol>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="derived_type">Adding a derived type</a>
-</h3>
-
-<div>
-
-<ol>
-<li><tt>llvm/include/llvm/Type.h</tt>:
- add enum for the new type; add a forward declaration of the type
- also</li>
-
-<li><tt>llvm/include/llvm/DerivedTypes.h</tt>:
- add new class to represent new class in the hierarchy; add forward
- declaration to the TypeMap value type</li>
-
-<li><tt>llvm/lib/VMCore/Type.cpp</tt>:
- add support for derived type to:
-<div class="doc_code">
-<pre>
-std::string getTypeDescription(const Type &Ty,
- std::vector<const Type*> &TypeStack)
-bool TypesEqual(const Type *Ty, const Type *Ty2,
- std::map<const Type*, const Type*> & EqTypes)
-</pre>
-</div>
- add necessary member functions for type, and factory methods</li>
-
-<li><tt>llvm/lib/AsmReader/Lexer.l</tt>:
- add ability to parse in the type from text assembly</li>
-
-<li><tt>llvm/lib/BitCode/Writer/Writer.cpp</tt>:
- modify <tt>void BitcodeWriter::outputType(const Type *T)</tt> to serialize
- your type</li>
-
-<li><tt>llvm/lib/BitCode/Reader/Reader.cpp</tt>:
- modify <tt>const Type *BitcodeReader::ParseType()</tt> to read your data
- type</li>
-
-<li><tt>llvm/lib/VMCore/AsmWriter.cpp</tt>:
- modify
-<div class="doc_code">
-<pre>
-void calcTypeName(const Type *Ty,
- std::vector<const Type*> &TypeStack,
- std::map<const Type*,std::string> &TypeNames,
- std::string & Result)
-</pre>
-</div>
- to output the new derived type
-</li>
-
-
-</ol>
-
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
- <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
- src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
- <a href="http://validator.w3.org/check/referer"><img
- src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
- <a href="http://llvm.org/">The LLVM Compiler Infrastructure</a>
- <br>
- Last modified: $Date$
-</address>
-
-</body>
-</html>
Added: llvm/branches/R600/docs/ExtendingLLVM.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/ExtendingLLVM.rst?rev=165748&view=auto
==============================================================================
--- llvm/branches/R600/docs/ExtendingLLVM.rst (added)
+++ llvm/branches/R600/docs/ExtendingLLVM.rst Thu Oct 11 16:28:00 2012
@@ -0,0 +1,306 @@
+.. _extending_llvm:
+
+============================================================
+Extending LLVM: Adding instructions, intrinsics, types, etc.
+============================================================
+
+Introduction and Warning
+========================
+
+
+During the course of using LLVM, you may wish to customize it for your research
+project or for experimentation. At this point, you may realize that you need to
+add something to LLVM, whether it be a new fundamental type, a new intrinsic
+function, or a whole new instruction.
+
+When you come to this realization, stop and think. Do you really need to extend
+LLVM? Is it a new fundamental capability that LLVM does not support at its
+current incarnation or can it be synthesized from already pre-existing LLVM
+elements? If you are not sure, ask on the `LLVM-dev
+<http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev>`_ list. The reason is that
+extending LLVM will get involved as you need to update all the different passes
+that you intend to use with your extension, and there are ``many`` LLVM analyses
+and transformations, so it may be quite a bit of work.
+
+Adding an `intrinsic function`_ is far easier than adding an
+instruction, and is transparent to optimization passes. If your added
+functionality can be expressed as a function call, an intrinsic function is the
+method of choice for LLVM extension.
+
+Before you invest a significant amount of effort into a non-trivial extension,
+**ask on the list** if what you are looking to do can be done with
+already-existing infrastructure, or if maybe someone else is already working on
+it. You will save yourself a lot of time and effort by doing so.
+
+.. _intrinsic function:
+
+Adding a new intrinsic function
+===============================
+
+Adding a new intrinsic function to LLVM is much easier than adding a new
+instruction. Almost all extensions to LLVM should start as an intrinsic
+function and then be turned into an instruction if warranted.
+
+#. ``llvm/docs/LangRef.html``:
+
+ Document the intrinsic. Decide whether it is code generator specific and
+ what the restrictions are. Talk to other people about it so that you are
+ sure it's a good idea.
+
+#. ``llvm/include/llvm/Intrinsics*.td``:
+
+ Add an entry for your intrinsic. Describe its memory access characteristics
+ for optimization (this controls whether it will be DCE'd, CSE'd, etc). Note
+ that any intrinsic using the ``llvm_int_ty`` type for an argument will
+ be deemed by ``tblgen`` as overloaded and the corresponding suffix will
+ be required on the intrinsic's name.
+
+#. ``llvm/lib/Analysis/ConstantFolding.cpp``:
+
+ If it is possible to constant fold your intrinsic, add support to it in the
+ ``canConstantFoldCallTo`` and ``ConstantFoldCall`` functions.
+
+#. ``llvm/test/Regression/*``:
+
+ Add test cases for your test cases to the test suite
+
+Once the intrinsic has been added to the system, you must add code generator
+support for it. Generally you must do the following steps:
+
+Add support to the .td file for the target(s) of your choice in
+``lib/Target/*/*.td``.
+
+ This is usually a matter of adding a pattern to the .td file that matches the
+ intrinsic, though it may obviously require adding the instructions you want to
+ generate as well. There are lots of examples in the PowerPC and X86 backend
+ to follow.
+
+Adding a new SelectionDAG node
+==============================
+
+As with intrinsics, adding a new SelectionDAG node to LLVM is much easier than
+adding a new instruction. New nodes are often added to help represent
+instructions common to many targets. These nodes often map to an LLVM
+instruction (add, sub) or intrinsic (byteswap, population count). In other
+cases, new nodes have been added to allow many targets to perform a common task
+(converting between floating point and integer representation) or capture more
+complicated behavior in a single node (rotate).
+
+#. ``include/llvm/CodeGen/ISDOpcodes.h``:
+
+ Add an enum value for the new SelectionDAG node.
+
+#. ``lib/CodeGen/SelectionDAG/SelectionDAG.cpp``:
+
+ Add code to print the node to ``getOperationName``. If your new node can be
+ evaluated at compile time when given constant arguments (such as an add of a
+ constant with another constant), find the ``getNode`` method that takes the
+ appropriate number of arguments, and add a case for your node to the switch
+ statement that performs constant folding for nodes that take the same number
+ of arguments as your new node.
+
+#. ``lib/CodeGen/SelectionDAG/LegalizeDAG.cpp``:
+
+ Add code to `legalize, promote, and expand
+ <CodeGenerator.html#selectiondag_legalize>`_ the node as necessary. At a
+ minimum, you will need to add a case statement for your node in
+ ``LegalizeOp`` which calls LegalizeOp on the node's operands, and returns a
+ new node if any of the operands changed as a result of being legalized. It
+ is likely that not all targets supported by the SelectionDAG framework will
+ natively support the new node. In this case, you must also add code in your
+ node's case statement in ``LegalizeOp`` to Expand your node into simpler,
+ legal operations. The case for ``ISD::UREM`` for expanding a remainder into
+ a divide, multiply, and a subtract is a good example.
+
+#. ``lib/CodeGen/SelectionDAG/LegalizeDAG.cpp``:
+
+ If targets may support the new node being added only at certain sizes, you
+ will also need to add code to your node's case statement in ``LegalizeOp``
+ to Promote your node's operands to a larger size, and perform the correct
+ operation. You will also need to add code to ``PromoteOp`` to do this as
+ well. For a good example, see ``ISD::BSWAP``, which promotes its operand to
+ a wider size, performs the byteswap, and then shifts the correct bytes right
+ to emulate the narrower byteswap in the wider type.
+
+#. ``lib/CodeGen/SelectionDAG/LegalizeDAG.cpp``:
+
+ Add a case for your node in ``ExpandOp`` to teach the legalizer how to
+ perform the action represented by the new node on a value that has been split
+ into high and low halves. This case will be used to support your node with a
+ 64 bit operand on a 32 bit target.
+
+#. ``lib/CodeGen/SelectionDAG/DAGCombiner.cpp``:
+
+ If your node can be combined with itself, or other existing nodes in a
+ peephole-like fashion, add a visit function for it, and call that function
+ from. There are several good examples for simple combines you can do;
+ ``visitFABS`` and ``visitSRL`` are good starting places.
+
+#. ``lib/Target/PowerPC/PPCISelLowering.cpp``:
+
+ Each target has an implementation of the ``TargetLowering`` class, usually in
+ its own file (although some targets include it in the same file as the
+ DAGToDAGISel). The default behavior for a target is to assume that your new
+ node is legal for all types that are legal for that target. If this target
+ does not natively support your node, then tell the target to either Promote
+ it (if it is supported at a larger type) or Expand it. This will cause the
+ code you wrote in ``LegalizeOp`` above to decompose your new node into other
+ legal nodes for this target.
+
+#. ``lib/Target/TargetSelectionDAG.td``:
+
+ Most current targets supported by LLVM generate code using the DAGToDAG
+ method, where SelectionDAG nodes are pattern matched to target-specific
+ nodes, which represent individual instructions. In order for the targets to
+ match an instruction to your new node, you must add a def for that node to
+ the list in this file, with the appropriate type constraints. Look at
+ ``add``, ``bswap``, and ``fadd`` for examples.
+
+#. ``lib/Target/PowerPC/PPCInstrInfo.td``:
+
+ Each target has a tablegen file that describes the target's instruction set.
+ For targets that use the DAGToDAG instruction selection framework, add a
+ pattern for your new node that uses one or more target nodes. Documentation
+ for this is a bit sparse right now, but there are several decent examples.
+ See the patterns for ``rotl`` in ``PPCInstrInfo.td``.
+
+#. TODO: document complex patterns.
+
+#. ``llvm/test/Regression/CodeGen/*``:
+
+ Add test cases for your new node to the test suite.
+ ``llvm/test/Regression/CodeGen/X86/bswap.ll`` is a good example.
+
+Adding a new instruction
+========================
+
+.. warning::
+
+ Adding instructions changes the bitcode format, and it will take some effort
+ to maintain compatibility with the previous version. Only add an instruction
+ if it is absolutely necessary.
+
+#. ``llvm/include/llvm/Instruction.def``:
+
+ add a number for your instruction and an enum name
+
+#. ``llvm/include/llvm/Instructions.h``:
+
+ add a definition for the class that will represent your instruction
+
+#. ``llvm/include/llvm/Support/InstVisitor.h``:
+
+ add a prototype for a visitor to your new instruction type
+
+#. ``llvm/lib/AsmParser/Lexer.l``:
+
+ add a new token to parse your instruction from assembly text file
+
+#. ``llvm/lib/AsmParser/llvmAsmParser.y``:
+
+ add the grammar on how your instruction can be read and what it will
+ construct as a result
+
+#. ``llvm/lib/Bitcode/Reader/Reader.cpp``:
+
+ add a case for your instruction and how it will be parsed from bitcode
+
+#. ``llvm/lib/VMCore/Instruction.cpp``:
+
+ add a case for how your instruction will be printed out to assembly
+
+#. ``llvm/lib/VMCore/Instructions.cpp``:
+
+ implement the class you defined in ``llvm/include/llvm/Instructions.h``
+
+#. Test your instruction
+
+#. ``llvm/lib/Target/*``:
+
+ add support for your instruction to code generators, or add a lowering pass.
+
+#. ``llvm/test/Regression/*``:
+
+ add your test cases to the test suite.
+
+Also, you need to implement (or modify) any analyses or passes that you want to
+understand this new instruction.
+
+Adding a new type
+=================
+
+.. warning::
+
+ Adding new types changes the bitcode format, and will break compatibility with
+ currently-existing LLVM installations. Only add new types if it is absolutely
+ necessary.
+
+Adding a fundamental type
+-------------------------
+
+#. ``llvm/include/llvm/Type.h``:
+
+ add enum for the new type; add static ``Type*`` for this type
+
+#. ``llvm/lib/VMCore/Type.cpp``:
+
+ add mapping from ``TypeID`` => ``Type*``; initialize the static ``Type*``
+
+#. ``llvm/lib/AsmReader/Lexer.l``:
+
+ add ability to parse in the type from text assembly
+
+#. ``llvm/lib/AsmReader/llvmAsmParser.y``:
+
+ add a token for that type
+
+Adding a derived type
+---------------------
+
+#. ``llvm/include/llvm/Type.h``:
+
+ add enum for the new type; add a forward declaration of the type also
+
+#. ``llvm/include/llvm/DerivedTypes.h``:
+
+ add new class to represent new class in the hierarchy; add forward
+ declaration to the TypeMap value type
+
+#. ``llvm/lib/VMCore/Type.cpp``:
+
+ add support for derived type to:
+
+ .. code:: c++
+
+ std::string getTypeDescription(const Type &Ty,
+ std::vector<const Type*> &TypeStack)
+ bool TypesEqual(const Type *Ty, const Type *Ty2,
+ std::map<const Type*, const Type*> &EqTypes)
+
+ add necessary member functions for type, and factory methods
+
+#. ``llvm/lib/AsmReader/Lexer.l``:
+
+ add ability to parse in the type from text assembly
+
+#. ``llvm/lib/BitCode/Writer/Writer.cpp``:
+
+ modify ``void BitcodeWriter::outputType(const Type *T)`` to serialize your
+ type
+
+#. ``llvm/lib/BitCode/Reader/Reader.cpp``:
+
+ modify ``const Type *BitcodeReader::ParseType()`` to read your data type
+
+#. ``llvm/lib/VMCore/AsmWriter.cpp``:
+
+ modify
+
+ .. code:: c++
+
+ void calcTypeName(const Type *Ty,
+ std::vector<const Type*> &TypeStack,
+ std::map<const Type*,std::string> &TypeNames,
+ std::string &Result)
+
+ to output the new derived type
Modified: llvm/branches/R600/docs/GarbageCollection.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/GarbageCollection.html?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/GarbageCollection.html (original)
+++ llvm/branches/R600/docs/GarbageCollection.html Thu Oct 11 16:28:00 2012
@@ -1253,7 +1253,7 @@
>#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/Function.h"
#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetAsmInfo.h"
void MyGCPrinter::beginAssembly(std::ostream &OS, AsmPrinter &AP,
@@ -1266,7 +1266,7 @@
// Set up for emitting addresses.
const char *AddressDirective;
int AddressAlignLog;
- if (AP.TM.getTargetData()->getPointerSize() == sizeof(int32_t)) {
+ if (AP.TM.getDataLayout()->getPointerSize() == sizeof(int32_t)) {
AddressDirective = TAI.getData32bitsDirective();
AddressAlignLog = 2;
} else {
Removed: llvm/branches/R600/docs/GettingStarted.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/GettingStarted.html?rev=165747&view=auto
==============================================================================
--- llvm/branches/R600/docs/GettingStarted.html (original)
+++ llvm/branches/R600/docs/GettingStarted.html (removed)
@@ -1,1760 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Getting Started with LLVM System</title>
- <link rel="stylesheet" href="_static/llvm.css" type="text/css">
-</head>
-<body>
-
-<h1>
- Getting Started with the LLVM System
-</h1>
-
-<ul>
- <li><a href="#overview">Overview</a>
- <li><a href="#quickstart">Getting Started Quickly (A Summary)</a>
- <li><a href="#requirements">Requirements</a>
- <ol>
- <li><a href="#hardware">Hardware</a></li>
- <li><a href="#software">Software</a></li>
- <li><a href="#brokengcc">Broken versions of GCC and other tools</a></li>
- </ol></li>
-
- <li><a href="#starting">Getting Started with LLVM</a>
- <ol>
- <li><a href="#terminology">Terminology and Notation</a></li>
- <li><a href="#environment">Setting Up Your Environment</a></li>
- <li><a href="#unpack">Unpacking the LLVM Archives</a></li>
- <li><a href="#checkout">Checkout LLVM from Subversion</a></li>
- <li><a href="#git_mirror">LLVM GIT mirror</a></li>
- <li><a href="#config">Local LLVM Configuration</a></li>
- <li><a href="#compile">Compiling the LLVM Suite Source Code</a></li>
- <li><a href="#cross-compile">Cross-Compiling LLVM</a></li>
- <li><a href="#objfiles">The Location of LLVM Object Files</a></li>
- <li><a href="#optionalconfig">Optional Configuration Items</a></li>
- </ol></li>
-
- <li><a href="#layout">Program layout</a>
- <ol>
- <li><a href="#examples"><tt>llvm/examples</tt></a></li>
- <li><a href="#include"><tt>llvm/include</tt></a></li>
- <li><a href="#lib"><tt>llvm/lib</tt></a></li>
- <li><a href="#projects"><tt>llvm/projects</tt></a></li>
- <li><a href="#runtime"><tt>llvm/runtime</tt></a></li>
- <li><a href="#test"><tt>llvm/test</tt></a></li>
- <li><a href="#test-suite"><tt>test-suite</tt></a></li>
- <li><a href="#tools"><tt>llvm/tools</tt></a></li>
- <li><a href="#utils"><tt>llvm/utils</tt></a></li>
- </ol></li>
-
- <li><a href="#tutorial">An Example Using the LLVM Tool Chain</a>
- <ol>
- <li><a href="#tutorial4">Example with Clang</a></li>
- </ol>
- <li><a href="#problems">Common Problems</a>
- <li><a href="#links">Links</a>
-</ul>
-
-<div class="doc_author">
- <p>Written by:
- <a href="mailto:criswell at uiuc.edu">John Criswell</a>,
- <a href="mailto:sabre at nondot.org">Chris Lattner</a>,
- <a href="http://misha.brukman.net/">Misha Brukman</a>,
- <a href="http://www.cs.uiuc.edu/~vadve">Vikram Adve</a>, and
- <a href="mailto:gshi1 at uiuc.edu">Guochun Shi</a>.
- </p>
-</div>
-
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="overview">Overview</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>Welcome to LLVM! In order to get started, you first need to know some
-basic information.</p>
-
-<p>First, LLVM comes in three pieces. The first piece is the LLVM
-suite. This contains all of the tools, libraries, and header files
-needed to use LLVM. It contains an assembler, disassembler, bitcode
-analyzer and bitcode optimizer. It also contains basic regression tests that
-can be used to test the LLVM tools and the Clang front end.</p>
-
-<p>The second piece is the <a href="http://clang.llvm.org/">Clang</a> front end.
-This component compiles C, C++, Objective C, and Objective C++ code into LLVM
-bitcode. Once compiled into LLVM bitcode, a program can be manipulated with the
-LLVM tools from the LLVM suite.
-</p>
-
-<p>
-There is a third, optional piece called Test Suite. It is a suite of programs
-with a testing harness that can be used to further test LLVM's functionality
-and performance.
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="quickstart">Getting Started Quickly (A Summary)</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>The LLVM Getting Started documentation may be out of date. So, the Clang
-<a href="http://clang.llvm.org/get_started.html">Getting Started</a> page might
-also be a good place to start.</p>
-
-<p>Here's the short story for getting up and running quickly with LLVM:</p>
-
-<ol>
- <li>Read the documentation.</li>
- <li>Read the documentation.</li>
- <li>Remember that you were warned twice about reading the documentation.</li>
-
- <li>Checkout LLVM:
- <ul>
- <li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
- <li><tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
- </ul>
- </li>
-
- <li>Checkout Clang:
- <ul>
- <li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
- <li><tt>cd llvm/tools</tt>
- <li><tt>svn co http://llvm.org/svn/llvm-project/cfe/trunk clang</tt></li>
- </ul>
- </li>
-
- <li>Checkout Compiler-RT:
- <ul>
- <li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
- <li><tt>cd llvm/projects</tt>
- <li><tt>svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk
- compiler-rt</tt></li>
- </ul>
- </li>
-
- <li>Get the Test Suite Source Code <b>[Optional]</b>
- <ul>
- <li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
- <li><tt>cd llvm/projects</tt>
- <li><tt>svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite</tt></li>
- </ul>
- </li>
-
- <li>Configure and build LLVM and Clang:
- <ul>
- <li><tt>cd <i>where-you-want-to-build-llvm</i></tt></li>
- <li><tt>mkdir build</tt> (for building without polluting the source dir)</li>
- <li><tt>cd build</tt></li>
- <li><tt>../llvm/configure [options]</tt>
- <br>Some common options:
-
- <ul>
- <li><tt>--prefix=<i>directory</i></tt> -
- Specify for <i>directory</i> the full pathname of where you
- want the LLVM tools and libraries to be installed (default
- <tt>/usr/local</tt>).</li>
- </ul>
-
- <ul>
- <li><tt>--enable-optimized</tt> -
- Compile with optimizations enabled (default is NO).</li>
- </ul>
-
- <ul>
- <li><tt>--enable-assertions</tt> -
- Compile with assertion checks enabled (default is YES).</li>
- </ul>
- </li>
- <li><tt>make [-j]</tt> - The -j specifies the number of jobs (commands) to
- run simultaneously. This builds both LLVM and Clang for Debug+Asserts mode.
- The --enabled-optimized configure option is used to specify a Release build.</li>
- <li><tt>make check-all</tt> -
- This run the regression tests to ensure everything is in working order.</li>
- <li><tt>make update</tt> -
- This command is used to update all the svn repositories at once, rather then
- having to <tt>cd</tt> into the individual repositories and running
- <tt>svn update</tt>.</li>
- <li>It is also possible to use CMake instead of the makefiles. With CMake
- it is also possible to generate project files for several IDEs: Eclipse
- CDT4, CodeBlocks, Qt-Creator (use the CodeBlocks generator), KDevelop3.</li>
- <li>If you get an "internal compiler error (ICE)" or test failures, see
- <a href="#brokengcc">below</a>.</li>
-
- </ul>
- </li>
-
-</ol>
-
-<p>Consult the <a href="#starting">Getting Started with LLVM</a> section for
-detailed information on configuring and compiling LLVM. See <a
-href="#environment">Setting Up Your Environment</a> for tips that simplify
-working with the Clang front end and LLVM tools. Go to <a href="#layout">Program
-Layout</a> to learn about the layout of the source code tree.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="requirements">Requirements</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>Before you begin to use the LLVM system, review the requirements given below.
-This may save you some trouble by knowing ahead of time what hardware and
-software you will need.</p>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="hardware">Hardware</a>
-</h3>
-
-<div>
-
-<p>LLVM is known to work on the following platforms:</p>
-
-<table cellpadding="3" summary="Known LLVM platforms">
-<tr>
- <th>OS</th>
- <th>Arch</th>
- <th>Compilers</th>
-</tr>
-<tr>
- <td>AuroraUX</td>
- <td>x86<sup><a href="#pf_1">1</a></sup></td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>Linux</td>
- <td>x86<sup><a href="#pf_1">1</a></sup></td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>Linux</td>
- <td>amd64</td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>Solaris</td>
- <td>V9 (Ultrasparc)</td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>FreeBSD</td>
- <td>x86<sup><a href="#pf_1">1</a></sup></td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>FreeBSD</td>
- <td>amd64</td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>MacOS X<sup><a href="#pf_2">2</a></sup></td>
- <td>PowerPC</td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>MacOS X<sup><a href="#pf_2">2</a>,<a href="#pf_9">9</a></sup></td>
- <td>x86</td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>Cygwin/Win32</td>
- <td>x86<sup><a href="#pf_1">1</a>,<a href="#pf_8">8</a>,
- <a href="#pf_11">11</a></sup></td>
- <td>GCC 3.4.X, binutils 2.20</td>
-</tr>
-<tr>
- <td>MinGW/Win32</td>
- <td>x86<sup><a href="#pf_1">1</a>,<a href="#pf_6">6</a>,
- <a href="#pf_8">8</a>, <a href="#pf_10">10</a>,
- <a href="#pf_11">11</a></sup></td>
- <td>GCC 3.4.X, binutils 2.20</td>
-</tr>
-</table>
-
-<p>LLVM has partial support for the following platforms:</p>
-
-<table summary="LLVM partial platform support">
-<tr>
- <th>OS</th>
- <th>Arch</th>
- <th>Compilers</th>
-</tr>
-<tr>
- <td>Windows</td>
- <td>x86<sup><a href="#pf_1">1</a></sup></td>
- <td>Visual Studio 2008 or higher<sup><a href="#pf_4">4</a>,<a href="#pf_5">5</a></sup></td>
-<tr>
- <td>AIX<sup><a href="#pf_3">3</a>,<a href="#pf_4">4</a></sup></td>
- <td>PowerPC</td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>Linux<sup><a href="#pf_3">3</a>,<a href="#pf_5">5</a></sup></td>
- <td>PowerPC</td>
- <td>GCC</td>
-</tr>
-
-<tr>
- <td>Linux<sup><a href="#pf_7">7</a></sup></td>
- <td>Alpha</td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>Linux<sup><a href="#pf_7">7</a></sup></td>
- <td>Itanium (IA-64)</td>
- <td>GCC</td>
-</tr>
-<tr>
- <td>HP-UX<sup><a href="#pf_7">7</a></sup></td>
- <td>Itanium (IA-64)</td>
- <td>HP aCC</td>
-</tr>
-<tr>
- <td>Windows x64</td>
- <td>x86-64</td>
- <td>mingw-w64's GCC-4.5.x<sup><a href="#pf_12">12</a></sup></td>
-</tr>
-</table>
-
-<p><b>Notes:</b></p>
-
-<div class="doc_notes">
-<ol>
-<li><a name="pf_1">Code generation supported for Pentium processors and
-up</a></li>
-<li><a name="pf_2">Code generation supported for 32-bit ABI only</a></li>
-<li><a name="pf_3">No native code generation</a></li>
-<li><a name="pf_4">Build is not complete: one or more tools do not link or function</a></li>
-<li><a name="pf_5">The GCC-based C/C++ frontend does not build</a></li>
-<li><a name="pf_6">The port is done using the MSYS shell.</a></li>
-<li><a name="pf_7">Native code generation exists but is not complete.</a></li>
-<li><a name="pf_8">Binutils 2.20 or later is required to build the assembler
- generated by LLVM properly.</a></li>
-<li><a name="pf_9">Xcode 2.5 and gcc 4.0.1</a> (Apple Build 5370) will trip
- internal LLVM assert messages when compiled for Release at optimization
- levels greater than 0 (i.e., <i>"-O1"</i> and higher).
- Add <i>OPTIMIZE_OPTION="-O0"</i> to the build command line
- if compiling for LLVM Release or bootstrapping the LLVM toolchain.</li>
-<li><a name="pf_10">For MSYS/MinGW on Windows, be sure to install the MSYS
- version of the perl package, and be sure it appears in your path
- before any Windows-based versions such as Strawberry Perl and
- ActivePerl, as these have Windows-specifics that will cause the
- build to fail.</a></li>
-<li><a name="pf_11">To use LLVM modules on Win32-based system,
- you may configure LLVM with <i>"--enable-shared"</i>.</a></li>
-<li><a name="pf_12">To compile SPU backend, you need to add
- <tt>"LDFLAGS=-Wl,--stack,16777216"</tt> to configure.</a></li>
-</ol>
-</div>
-
-<p>Note that you will need about 1-3 GB of space for a full LLVM build in Debug
-mode, depending on the system (it is so large because of all the debugging
-information and the fact that the libraries are statically linked into multiple
-tools). If you do not need many of the tools and you are space-conscious, you
-can pass <tt>ONLY_TOOLS="tools you need"</tt> to make. The Release build
-requires considerably less space.</p>
-
-<p>The LLVM suite <i>may</i> compile on other platforms, but it is not
-guaranteed to do so. If compilation is successful, the LLVM utilities should be
-able to assemble, disassemble, analyze, and optimize LLVM bitcode. Code
-generation should work as well, although the generated native code may not work
-on your platform.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="software">Software</a>
-</h3>
-<div>
- <p>Compiling LLVM requires that you have several software packages
- installed. The table below lists those required packages. The Package column
- is the usual name for the software package that LLVM depends on. The Version
- column provides "known to work" versions of the package. The Notes column
- describes how LLVM uses the package and provides other details.</p>
- <table summary="Packages required to compile LLVM">
- <tr><th>Package</th><th>Version</th><th>Notes</th></tr>
-
- <tr>
- <td><a href="http://savannah.gnu.org/projects/make">GNU Make</a></td>
- <td>3.79, 3.79.1</td>
- <td>Makefile/build processor</td>
- </tr>
-
- <tr>
- <td><a href="http://gcc.gnu.org/">GCC</a></td>
- <td>3.4.2</td>
- <td>C/C++ compiler<sup><a href="#sf1">1</a></sup></td>
- </tr>
-
- <tr>
- <td><a href="http://www.gnu.org/software/texinfo/">TeXinfo</a></td>
- <td>4.5</td>
- <td>For building the CFE</td>
- </tr>
-
- <tr>
- <td><a href="http://subversion.tigris.org/project_packages.html">SVN</a></td>
- <td>≥1.3</td>
- <td>Subversion access to LLVM<sup><a href="#sf2">2</a></sup></td>
- </tr>
-
- <!-- FIXME:
- Do we support dg?
- Are DejaGnu and expect obsolete?
- Shall we mention Python? -->
-
- <tr>
- <td><a href="http://savannah.gnu.org/projects/dejagnu">DejaGnu</a></td>
- <td>1.4.2</td>
- <td>Automated test suite<sup><a href="#sf3">3</a></sup></td>
- </tr>
-
- <tr>
- <td><a href="http://www.tcl.tk/software/tcltk/">tcl</a></td>
- <td>8.3, 8.4</td>
- <td>Automated test suite<sup><a href="#sf3">3</a></sup></td>
- </tr>
-
- <tr>
- <td><a href="http://expect.nist.gov/">expect</a></td>
- <td>5.38.0</td>
- <td>Automated test suite<sup><a href="#sf3">3</a></sup></td>
- </tr>
-
- <tr>
- <td><a href="http://www.perl.com/download.csp">perl</a></td>
- <td>≥5.6.0</td>
- <td>Utilities</td>
- </tr>
-
- <tr>
- <td><a href="http://savannah.gnu.org/projects/m4">GNU M4</a>
- <td>1.4</td>
- <td>Macro processor for configuration<sup><a href="#sf4">4</a></sup></td>
- </tr>
-
- <tr>
- <td><a href="http://www.gnu.org/software/autoconf/">GNU Autoconf</a></td>
- <td>2.60</td>
- <td>Configuration script builder<sup><a href="#sf4">4</a></sup></td>
- </tr>
-
- <tr>
- <td><a href="http://www.gnu.org/software/automake/">GNU Automake</a></td>
- <td>1.9.6</td>
- <td>aclocal macro generator<sup><a href="#sf4">4</a></sup></td>
- </tr>
-
- <tr>
- <td><a href="http://savannah.gnu.org/projects/libtool">libtool</a></td>
- <td>1.5.22</td>
- <td>Shared library manager<sup><a href="#sf4">4</a></sup></td>
- </tr>
-
- </table>
-
- <p><b>Notes:</b></p>
- <div class="doc_notes">
- <ol>
- <li><a name="sf1">Only the C and C++ languages are needed so there's no
- need to build the other languages for LLVM's purposes.</a> See
- <a href="#brokengcc">below</a> for specific version info.</li>
- <li><a name="sf2">You only need Subversion if you intend to build from the
- latest LLVM sources. If you're working from a release distribution, you
- don't need Subversion.</a></li>
- <li><a name="sf3">Only needed if you want to run the automated test
- suite in the <tt>llvm/test</tt> directory.</a></li>
- <li><a name="sf4">If you want to make changes to the configure scripts,
- you will need GNU autoconf (2.60), and consequently, GNU M4 (version 1.4
- or higher). You will also need automake (1.9.6). We only use aclocal
- from that package.</a></li>
- </ol>
- </div>
-
- <p>Additionally, your compilation host is expected to have the usual
- plethora of Unix utilities. Specifically:</p>
- <ul>
- <li><b>ar</b> - archive library builder</li>
- <li><b>bzip2*</b> - bzip2 command for distribution generation</li>
- <li><b>bunzip2*</b> - bunzip2 command for distribution checking</li>
- <li><b>chmod</b> - change permissions on a file</li>
- <li><b>cat</b> - output concatenation utility</li>
- <li><b>cp</b> - copy files</li>
- <li><b>date</b> - print the current date/time </li>
- <li><b>echo</b> - print to standard output</li>
- <li><b>egrep</b> - extended regular expression search utility</li>
- <li><b>find</b> - find files/dirs in a file system</li>
- <li><b>grep</b> - regular expression search utility</li>
- <li><b>gzip*</b> - gzip command for distribution generation</li>
- <li><b>gunzip*</b> - gunzip command for distribution checking</li>
- <li><b>install</b> - install directories/files </li>
- <li><b>mkdir</b> - create a directory</li>
- <li><b>mv</b> - move (rename) files</li>
- <li><b>ranlib</b> - symbol table builder for archive libraries</li>
- <li><b>rm</b> - remove (delete) files and directories</li>
- <li><b>sed</b> - stream editor for transforming output</li>
- <li><b>sh</b> - Bourne shell for make build scripts</li>
- <li><b>tar</b> - tape archive for distribution generation</li>
- <li><b>test</b> - test things in file system</li>
- <li><b>unzip*</b> - unzip command for distribution checking</li>
- <li><b>zip*</b> - zip command for distribution generation</li>
- </ul>
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="brokengcc">Broken versions of GCC and other tools</a>
-</h3>
-
-<div>
-
-<p>LLVM is very demanding of the host C++ compiler, and as such tends to expose
-bugs in the compiler. In particular, several versions of GCC crash when trying
-to compile LLVM. We routinely use GCC 4.2 (and higher) or Clang.
-Other versions of GCC will probably work as well. GCC versions listed
-here are known to not work. If you are using one of these versions, please try
-to upgrade your GCC to something more recent. If you run into a problem with a
-version of GCC not listed here, please <a href="mailto:llvmdev at cs.uiuc.edu">let
-us know</a>. Please use the "<tt>gcc -v</tt>" command to find out which version
-of GCC you are using.
-</p>
-
-<p><b>GCC versions prior to 3.0</b>: GCC 2.96.x and before had several
-problems in the STL that effectively prevent it from compiling LLVM.
-</p>
-
-<p><b>GCC 3.2.2 and 3.2.3</b>: These versions of GCC fails to compile LLVM with
-a bogus template error. This was fixed in later GCCs.</p>
-
-<p><b>GCC 3.3.2</b>: This version of GCC suffered from a <a
-href="http://gcc.gnu.org/PR13392">serious bug</a> which causes it to crash in
-the "<tt>convert_from_eh_region_ranges_1</tt>" GCC function.</p>
-
-<p><b>Cygwin GCC 3.3.3</b>: The version of GCC 3.3.3 commonly shipped with
- Cygwin does not work.</p>
-<p><b>SuSE GCC 3.3.3</b>: The version of GCC 3.3.3 shipped with SuSE 9.1 (and
- possibly others) does not compile LLVM correctly (it appears that exception
- handling is broken in some cases). Please download the FSF 3.3.3 or upgrade
- to a newer version of GCC.</p>
-<p><b>GCC 3.4.0 on linux/x86 (32-bit)</b>: GCC miscompiles portions of the
- code generator, causing an infinite loop in the llvm-gcc build when built
- with optimizations enabled (i.e. a release build).</p>
-<p><b>GCC 3.4.2 on linux/x86 (32-bit)</b>: GCC miscompiles portions of the
- code generator at -O3, as with 3.4.0. However gcc 3.4.2 (unlike 3.4.0)
- correctly compiles LLVM at -O2. A work around is to build release LLVM
- builds with "make ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O2 ..."</p>
-<p><b>GCC 3.4.x on X86-64/amd64</b>: GCC <a href="http://llvm.org/PR1056">
- miscompiles portions of LLVM</a>.</p>
-<p><b>GCC 3.4.4 (CodeSourcery ARM 2005q3-2)</b>: this compiler miscompiles LLVM
- when building with optimizations enabled. It appears to work with
- "<tt>make ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O1</tt>" or build a debug
- build.</p>
-<p><b>IA-64 GCC 4.0.0</b>: The IA-64 version of GCC 4.0.0 is known to
- miscompile LLVM.</p>
-<p><b>Apple Xcode 2.3</b>: GCC crashes when compiling LLVM at -O3 (which is the
- default with ENABLE_OPTIMIZED=1. To work around this, build with
- "ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O2".</p>
-<p><b>GCC 4.1.1</b>: GCC fails to build LLVM with template concept check errors
- compiling some files. At the time of this writing, GCC mainline (4.2)
- did not share the problem.</p>
-<p><b>GCC 4.1.1 on X86-64/amd64</b>: GCC <a href="http://llvm.org/PR1063">
- miscompiles portions of LLVM</a> when compiling llvm itself into 64-bit
- code. LLVM will appear to mostly work but will be buggy, e.g. failing
- portions of its testsuite.</p>
-<p><b>GCC 4.1.2 on OpenSUSE</b>: Seg faults during libstdc++ build and on x86_64
-platforms compiling md5.c gets a mangled constant.</p>
-<p><b>GCC 4.1.2 (20061115 (prerelease) (Debian 4.1.1-21)) on Debian</b>: Appears
-to miscompile parts of LLVM 2.4. One symptom is ValueSymbolTable complaining
-about symbols remaining in the table on destruction.</p>
-<p><b>GCC 4.1.2 20071124 (Red Hat 4.1.2-42)</b>: Suffers from the same symptoms
-as the previous one. It appears to work with ENABLE_OPTIMIZED=0 (the default).</p>
-<p><b>Cygwin GCC 4.3.2 20080827 (beta) 2</b>:
- Users <a href="http://llvm.org/PR4145">reported</a> various problems related
- with link errors when using this GCC version.</p>
-<p><b>Debian GCC 4.3.2 on X86</b>: Crashes building some files in LLVM 2.6.</p>
-<p><b>GCC 4.3.3 (Debian 4.3.3-10) on ARM</b>: Miscompiles parts of LLVM 2.6
-when optimizations are turned on. The symptom is an infinite loop in
-FoldingSetImpl::RemoveNode while running the code generator.</p>
-<p><b>SUSE 11 GCC 4.3.4</b>: Miscompiles LLVM, causing crashes in ValueHandle logic.</p>
-<p><b>GCC 4.3.5 and GCC 4.4.5 on ARM</b>: These can miscompile <tt>value >>
-1</tt> even at -O0. A test failure in <tt>test/Assembler/alignstack.ll</tt> is
-one symptom of the problem.
-<p><b>GNU ld 2.16.X</b>. Some 2.16.X versions of the ld linker will produce very
-long warning messages complaining that some ".gnu.linkonce.t.*" symbol was
-defined in a discarded section. You can safely ignore these messages as they are
-erroneous and the linkage is correct. These messages disappear using ld
-2.17.</p>
-
-<p><b>GNU binutils 2.17</b>: Binutils 2.17 contains <a
-href="http://sourceware.org/bugzilla/show_bug.cgi?id=3111">a bug</a> which
-causes huge link times (minutes instead of seconds) when building LLVM. We
-recommend upgrading to a newer version (2.17.50.0.4 or later).</p>
-
-<p><b>GNU Binutils 2.19.1 Gold</b>: This version of Gold contained
-<a href="http://sourceware.org/bugzilla/show_bug.cgi?id=9836">a bug</a>
-which causes intermittent failures when building LLVM with position independent
-code. The symptom is an error about cyclic dependencies. We recommend
-upgrading to a newer version of Gold.</p>
-
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="starting">Getting Started with LLVM</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>The remainder of this guide is meant to get you up and running with
-LLVM and to give you some basic information about the LLVM environment.</p>
-
-<p>The later sections of this guide describe the <a
-href="#layout">general layout</a> of the LLVM source tree, a <a
-href="#tutorial">simple example</a> using the LLVM tool chain, and <a
-href="#links">links</a> to find more information about LLVM or to get
-help via e-mail.</p>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="terminology">Terminology and Notation</a>
-</h3>
-
-<div>
-
-<p>Throughout this manual, the following names are used to denote paths
-specific to the local system and working environment. <i>These are not
-environment variables you need to set but just strings used in the rest
-of this document below</i>. In any of the examples below, simply replace
-each of these names with the appropriate pathname on your local system.
-All these paths are absolute:</p>
-
-<dl>
- <dt>SRC_ROOT
- <dd>
- This is the top level directory of the LLVM source tree.
- <br><br>
-
- <dt>OBJ_ROOT
- <dd>
- This is the top level directory of the LLVM object tree (i.e. the
- tree where object files and compiled programs will be placed. It
- can be the same as SRC_ROOT).
- <br><br>
-
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="environment">Setting Up Your Environment</a>
-</h3>
-
-<div>
-
-<p>
-In order to compile and use LLVM, you may need to set some environment
-variables.
-
-<dl>
- <dt><tt>LLVM_LIB_SEARCH_PATH</tt>=<tt>/path/to/your/bitcode/libs</tt></dt>
- <dd>[Optional] This environment variable helps LLVM linking tools find the
- locations of your bitcode libraries. It is provided only as a
- convenience since you can specify the paths using the -L options of the
- tools and the C/C++ front-end will automatically use the bitcode files
- installed in its
- <tt>lib</tt> directory.</dd>
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="unpack">Unpacking the LLVM Archives</a>
-</h3>
-
-<div>
-
-<p>
-If you have the LLVM distribution, you will need to unpack it before you
-can begin to compile it. LLVM is distributed as a set of two files: the LLVM
-suite and the LLVM GCC front end compiled for your platform. There is an
-additional test suite that is optional. Each file is a TAR archive that is
-compressed with the gzip program.
-</p>
-
-<p>The files are as follows, with <em>x.y</em> marking the version number:
-<dl>
- <dt><tt>llvm-x.y.tar.gz</tt></dt>
- <dd>Source release for the LLVM libraries and tools.<br></dd>
-
- <dt><tt>llvm-test-x.y.tar.gz</tt></dt>
- <dd>Source release for the LLVM test-suite.</dd>
-
- <dt><tt>llvm-gcc-4.2-x.y.source.tar.gz</tt></dt>
- <dd>Source release of the llvm-gcc-4.2 front end. See README.LLVM in the root
- directory for build instructions.<br></dd>
-
- <dt><tt>llvm-gcc-4.2-x.y-platform.tar.gz</tt></dt>
- <dd>Binary release of the llvm-gcc-4.2 front end for a specific platform.<br></dd>
-
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="checkout">Checkout LLVM from Subversion</a>
-</h3>
-
-<div>
-
-<p>If you have access to our Subversion repository, you can get a fresh copy of
-the entire source code. All you need to do is check it out from Subversion as
-follows:</p>
-
-<ul>
- <li><tt>cd <i>where-you-want-llvm-to-live</i></tt></li>
- <li>Read-Only: <tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
- <li>Read-Write:<tt>svn co https://user@llvm.org/svn/llvm-project/llvm/trunk
- llvm</tt></li>
-</ul>
-
-
-<p>This will create an '<tt>llvm</tt>' directory in the current
-directory and fully populate it with the LLVM source code, Makefiles,
-test directories, and local copies of documentation files.</p>
-
-<p>If you want to get a specific release (as opposed to the most recent
-revision), you can checkout it from the '<tt>tags</tt>' directory (instead of
-'<tt>trunk</tt>'). The following releases are located in the following
-subdirectories of the '<tt>tags</tt>' directory:</p>
-
-<ul>
-<li>Release 3.1: <b>RELEASE_31/final</b></li>
-<li>Release 3.0: <b>RELEASE_30/final</b></li>
-<li>Release 2.9: <b>RELEASE_29/final</b></li>
-<li>Release 2.8: <b>RELEASE_28</b></li>
-<li>Release 2.7: <b>RELEASE_27</b></li>
-<li>Release 2.6: <b>RELEASE_26</b></li>
-<li>Release 2.5: <b>RELEASE_25</b></li>
-<li>Release 2.4: <b>RELEASE_24</b></li>
-<li>Release 2.3: <b>RELEASE_23</b></li>
-<li>Release 2.2: <b>RELEASE_22</b></li>
-<li>Release 2.1: <b>RELEASE_21</b></li>
-<li>Release 2.0: <b>RELEASE_20</b></li>
-<li>Release 1.9: <b>RELEASE_19</b></li>
-<li>Release 1.8: <b>RELEASE_18</b></li>
-<li>Release 1.7: <b>RELEASE_17</b></li>
-<li>Release 1.6: <b>RELEASE_16</b></li>
-<li>Release 1.5: <b>RELEASE_15</b></li>
-<li>Release 1.4: <b>RELEASE_14</b></li>
-<li>Release 1.3: <b>RELEASE_13</b></li>
-<li>Release 1.2: <b>RELEASE_12</b></li>
-<li>Release 1.1: <b>RELEASE_11</b></li>
-<li>Release 1.0: <b>RELEASE_1</b></li>
-</ul>
-
-<p>If you would like to get the LLVM test suite (a separate package as of 1.4),
-you get it from the Subversion repository:</p>
-
-<div class="doc_code">
-<pre>
-% cd llvm/projects
-% svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
-</pre>
-</div>
-
-<p>By placing it in the <tt>llvm/projects</tt>, it will be automatically
-configured by the LLVM configure script as well as automatically updated when
-you run <tt>svn update</tt>.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="git_mirror">GIT mirror</a>
-</h3>
-
-<div>
-
-<p>GIT mirrors are available for a number of LLVM subprojects. These mirrors
- sync automatically with each Subversion commit and contain all necessary
- git-svn marks (so, you can recreate git-svn metadata locally). Note that right
- now mirrors reflect only <tt>trunk</tt> for each project. You can do the
- read-only GIT clone of LLVM via:</p>
-
-<pre class="doc_code">
-git clone http://llvm.org/git/llvm.git
-</pre>
-
-<p>If you want to check out clang too, run:</p>
-
-<pre class="doc_code">
-git clone http://llvm.org/git/llvm.git
-cd llvm/tools
-git clone http://llvm.org/git/clang.git
-</pre>
-
-<p>
-Since the upstream repository is in Subversion, you should use
-<tt>"git pull --rebase"</tt>
-instead of <tt>"git pull"</tt> to avoid generating a non-linear
-history in your clone.
-To configure <tt>"git pull"</tt> to pass <tt>--rebase</tt> by default
-on the master branch, run the following command:
-</p>
-
-<pre class="doc_code">
-git config branch.master.rebase true
-</pre>
-
-<h4>Sending patches with Git</h4>
-<div>
-<p>
-Please read <a href="DeveloperPolicy.html#patches">Developer Policy</a>, too.
-</p>
-
-<p>
-Assume <tt>master</tt> points the upstream and <tt>mybranch</tt> points your
-working branch, and <tt>mybranch</tt> is rebased onto <tt>master</tt>.
-At first you may check sanity of whitespaces:
-</p>
-
-<pre class="doc_code">
-git diff --check master..mybranch
-</pre>
-
-<p>
-The easiest way to generate a patch is as below:
-</p>
-
-<pre class="doc_code">
-git diff master..mybranch > /path/to/mybranch.diff
-</pre>
-
-<p>
-It is a little different from svn-generated diff. git-diff-generated diff has
-prefixes like <tt>a/</tt> and <tt>b/</tt>. Don't worry, most developers might
-know it could be accepted with <tt>patch -p1 -N</tt>.
-</p>
-
-<p>
-But you may generate patchset with git-format-patch. It generates
-by-each-commit patchset. To generate patch files to attach to your article:
-</p>
-
-<pre class="doc_code">
-git format-patch --no-attach master..mybranch -o /path/to/your/patchset
-</pre>
-
-<p>
-If you would like to send patches directly, you may use git-send-email or
-git-imap-send. Here is an example to generate the patchset in Gmail's [Drafts].
-</p>
-
-<pre class="doc_code">
-git format-patch --attach master..mybranch --stdout | git imap-send
-</pre>
-
-<p>
-Then, your .git/config should have [imap] sections.
-</p>
-
-<pre class="doc_code">
-[imap]
- host = imaps://imap.gmail.com
- user = <em>your.gmail.account</em>@gmail.com
- pass = <em>himitsu!</em>
- port = 993
- sslverify = false
-; in English
- folder = "[Gmail]/Drafts"
-; example for Japanese, "Modified UTF-7" encoded.
- folder = "[Gmail]/&Tgtm+DBN-"
-; example for Traditional Chinese
- folder = "[Gmail]/&g0l6Pw-"
-</pre>
-
-</div>
-
-<h4>For developers to work with git-svn</h4>
-<div>
-
-<p>To set up clone from which you can submit code using
- <tt>git-svn</tt>, run:</p>
-
-<pre class="doc_code">
-git clone http://llvm.org/git/llvm.git
-cd llvm
-git svn init https://llvm.org/svn/llvm-project/llvm/trunk --username=<username>
-git config svn-remote.svn.fetch :refs/remotes/origin/master
-git svn rebase -l # -l avoids fetching ahead of the git mirror.
-
-# If you have clang too:
-cd tools
-git clone http://llvm.org/git/clang.git
-cd clang
-git svn init https://llvm.org/svn/llvm-project/cfe/trunk --username=<username>
-git config svn-remote.svn.fetch :refs/remotes/origin/master
-git svn rebase -l
-</pre>
-
-<p>To update this clone without generating git-svn tags that conflict
-with the upstream git repo, run:</p>
-
-<pre class="doc_code">
-git fetch && (cd tools/clang && git fetch) # Get matching revisions of both trees.
-git checkout master
-git svn rebase -l
-(cd tools/clang &&
- git checkout master &&
- git svn rebase -l)
-</pre>
-
-<p>This leaves your working directories on their master branches, so
-you'll need to <tt>checkout</tt> each working branch individually and
-<tt>rebase</tt> it on top of its parent branch. (Note: This script is
-intended for relative newbies to git. If you have more experience,
-you can likely improve on it.)</p>
-
-<p>The git-svn metadata can get out of sync after you mess around with
-branches and <code>dcommit</code>. When that happens, <code>git svn
-dcommit</code> stops working, complaining about files with uncommitted
-changes. The fix is to rebuild the metadata:</p>
-
-<pre class="doc_code">
-rm -rf .git/svn
-git svn rebase -l
-</pre>
-
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="config">Local LLVM Configuration</a>
-</h3>
-
-<div>
-
- <p>Once checked out from the Subversion repository, the LLVM suite source
- code must be
-configured via the <tt>configure</tt> script. This script sets variables in the
-various <tt>*.in</tt> files, most notably <tt>llvm/Makefile.config</tt> and
-<tt>llvm/include/Config/config.h</tt>. It also populates <i>OBJ_ROOT</i> with
-the Makefiles needed to begin building LLVM.</p>
-
-<p>The following environment variables are used by the <tt>configure</tt>
-script to configure the build system:</p>
-
-<table summary="LLVM configure script environment variables">
- <tr><th>Variable</th><th>Purpose</th></tr>
- <tr>
- <td>CC</td>
- <td>Tells <tt>configure</tt> which C compiler to use. By default,
- <tt>configure</tt> will look for the first GCC C compiler in
- <tt>PATH</tt>. Use this variable to override
- <tt>configure</tt>'s default behavior.</td>
- </tr>
- <tr>
- <td>CXX</td>
- <td>Tells <tt>configure</tt> which C++ compiler to use. By default,
- <tt>configure</tt> will look for the first GCC C++ compiler in
- <tt>PATH</tt>. Use this variable to override
- <tt>configure</tt>'s default behavior.</td>
- </tr>
-</table>
-
-<p>The following options can be used to set or enable LLVM specific options:</p>
-
-<dl>
- <dt><i>--enable-optimized</i></dt>
- <dd>
- Enables optimized compilation (debugging symbols are removed
- and GCC optimization flags are enabled). Note that this is the default
- setting if you are using the LLVM distribution. The default behavior
- of an Subversion checkout is to use an unoptimized build (also known as a
- debug build).
- <br><br>
- </dd>
- <dt><i>--enable-debug-runtime</i></dt>
- <dd>
- Enables debug symbols in the runtime libraries. The default is to strip
- debug symbols from the runtime libraries.
- </dd>
- <dt><i>--enable-jit</i></dt>
- <dd>
- Compile the Just In Time (JIT) compiler functionality. This is not
- available
- on all platforms. The default is dependent on platform, so it is best
- to explicitly enable it if you want it.
- <br><br>
- </dd>
- <dt><i>--enable-targets=</i><tt>target-option</tt></dt>
- <dd>Controls which targets will be built and linked into llc. The default
- value for <tt>target_options</tt> is "all" which builds and links all
- available targets. The value "host-only" can be specified to build only a
- native compiler (no cross-compiler targets available). The "native" target is
- selected as the target of the build host. You can also specify a comma
- separated list of target names that you want available in llc. The target
- names use all lower case. The current set of targets is: <br>
- <tt>arm, cpp, hexagon, mblaze, mips, mipsel, msp430, powerpc, ptx, sparc, spu, x86, x86_64, xcore</tt>.
- <br><br></dd>
- <dt><i>--enable-doxygen</i></dt>
- <dd>Look for the doxygen program and enable construction of doxygen based
- documentation from the source code. This is disabled by default because
- generating the documentation can take a long time and producess 100s of
- megabytes of output.</dd>
- <dt><i>--with-udis86</i></dt>
- <dd>LLVM can use external disassembler library for various purposes (now it's
- used only for examining code produced by JIT). This option will enable usage
- of <a href="http://udis86.sourceforge.net/">udis86</a> x86 (both 32 and 64
- bits) disassembler library.</dd>
-</dl>
-
-<p>To configure LLVM, follow these steps:</p>
-
-<ol>
- <li><p>Change directory into the object root directory:</p>
-
- <div class="doc_code"><pre>% cd <i>OBJ_ROOT</i></pre></div></li>
-
- <li><p>Run the <tt>configure</tt> script located in the LLVM source
- tree:</p>
-
- <div class="doc_code">
- <pre>% <i>SRC_ROOT</i>/configure --prefix=/install/path [other options]</pre>
- </div></li>
-</ol>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="compile">Compiling the LLVM Suite Source Code</a>
-</h3>
-
-<div>
-
-<p>Once you have configured LLVM, you can build it. There are three types of
-builds:</p>
-
-<dl>
- <dt>Debug Builds
- <dd>
- These builds are the default when one is using an Subversion checkout and
- types <tt>gmake</tt> (unless the <tt>--enable-optimized</tt> option was
- used during configuration). The build system will compile the tools and
- libraries with debugging information. To get a Debug Build using the
- LLVM distribution the <tt>--disable-optimized</tt> option must be passed
- to <tt>configure</tt>.
- <br><br>
-
- <dt>Release (Optimized) Builds
- <dd>
- These builds are enabled with the <tt>--enable-optimized</tt> option to
- <tt>configure</tt> or by specifying <tt>ENABLE_OPTIMIZED=1</tt> on the
- <tt>gmake</tt> command line. For these builds, the build system will
- compile the tools and libraries with GCC optimizations enabled and strip
- debugging information from the libraries and executables it generates.
- Note that Release Builds are default when using an LLVM distribution.
- <br><br>
-
- <dt>Profile Builds
- <dd>
- These builds are for use with profiling. They compile profiling
- information into the code for use with programs like <tt>gprof</tt>.
- Profile builds must be started by specifying <tt>ENABLE_PROFILING=1</tt>
- on the <tt>gmake</tt> command line.
-</dl>
-
-<p>Once you have LLVM configured, you can build it by entering the
-<i>OBJ_ROOT</i> directory and issuing the following command:</p>
-
-<div class="doc_code"><pre>% gmake</pre></div>
-
-<p>If the build fails, please <a href="#brokengcc">check here</a> to see if you
-are using a version of GCC that is known not to compile LLVM.</p>
-
-<p>
-If you have multiple processors in your machine, you may wish to use some of
-the parallel build options provided by GNU Make. For example, you could use the
-command:</p>
-
-<div class="doc_code"><pre>% gmake -j2</pre></div>
-
-<p>There are several special targets which are useful when working with the LLVM
-source code:</p>
-
-<dl>
- <dt><tt>gmake clean</tt>
- <dd>
- Removes all files generated by the build. This includes object files,
- generated C/C++ files, libraries, and executables.
- <br><br>
-
- <dt><tt>gmake dist-clean</tt>
- <dd>
- Removes everything that <tt>gmake clean</tt> does, but also removes files
- generated by <tt>configure</tt>. It attempts to return the source tree to the
- original state in which it was shipped.
- <br><br>
-
- <dt><tt>gmake install</tt>
- <dd>
- Installs LLVM header files, libraries, tools, and documentation in a
- hierarchy
- under $PREFIX, specified with <tt>./configure --prefix=[dir]</tt>, which
- defaults to <tt>/usr/local</tt>.
- <br><br>
-
- <dt><tt>gmake -C runtime install-bytecode</tt>
- <dd>
- Assuming you built LLVM into $OBJDIR, when this command is run, it will
- install bitcode libraries into the GCC front end's bitcode library
- directory. If you need to update your bitcode libraries,
- this is the target to use once you've built them.
- <br><br>
-</dl>
-
-<p>Please see the <a href="MakefileGuide.html">Makefile Guide</a> for further
-details on these <tt>make</tt> targets and descriptions of other targets
-available.</p>
-
-<p>It is also possible to override default values from <tt>configure</tt> by
-declaring variables on the command line. The following are some examples:</p>
-
-<dl>
- <dt><tt>gmake ENABLE_OPTIMIZED=1</tt>
- <dd>
- Perform a Release (Optimized) build.
- <br><br>
-
- <dt><tt>gmake ENABLE_OPTIMIZED=1 DISABLE_ASSERTIONS=1</tt>
- <dd>
- Perform a Release (Optimized) build without assertions enabled.
- <br><br>
-
- <dt><tt>gmake ENABLE_OPTIMIZED=0</tt>
- <dd>
- Perform a Debug build.
- <br><br>
-
- <dt><tt>gmake ENABLE_PROFILING=1</tt>
- <dd>
- Perform a Profiling build.
- <br><br>
-
- <dt><tt>gmake VERBOSE=1</tt>
- <dd>
- Print what <tt>gmake</tt> is doing on standard output.
- <br><br>
-
- <dt><tt>gmake TOOL_VERBOSE=1</tt></dt>
- <dd>Ask each tool invoked by the makefiles to print out what it is doing on
- the standard output. This also implies <tt>VERBOSE=1</tt>.
- <br><br></dd>
-</dl>
-
-<p>Every directory in the LLVM object tree includes a <tt>Makefile</tt> to build
-it and any subdirectories that it contains. Entering any directory inside the
-LLVM object tree and typing <tt>gmake</tt> should rebuild anything in or below
-that directory that is out of date.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="cross-compile">Cross-Compiling LLVM</a>
-</h3>
-
-<div>
- <p>It is possible to cross-compile LLVM itself. That is, you can create LLVM
- executables and libraries to be hosted on a platform different from the
- platform where they are build (a Canadian Cross build). To configure a
- cross-compile, supply the configure script with <tt>--build</tt> and
- <tt>--host</tt> options that are different. The values of these options must
- be legal target triples that your GCC compiler supports.</p>
-
- <p>The result of such a build is executables that are not runnable on
- on the build host (--build option) but can be executed on the compile host
- (--host option).</p>
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="objfiles">The Location of LLVM Object Files</a>
-</h3>
-
-<div>
-
-<p>The LLVM build system is capable of sharing a single LLVM source tree among
-several LLVM builds. Hence, it is possible to build LLVM for several different
-platforms or configurations using the same source tree.</p>
-
-<p>This is accomplished in the typical autoconf manner:</p>
-
-<ul>
- <li><p>Change directory to where the LLVM object files should live:</p>
-
- <div class="doc_code"><pre>% cd <i>OBJ_ROOT</i></pre></div></li>
-
- <li><p>Run the <tt>configure</tt> script found in the LLVM source
- directory:</p>
-
- <div class="doc_code"><pre>% <i>SRC_ROOT</i>/configure</pre></div></li>
-</ul>
-
-<p>The LLVM build will place files underneath <i>OBJ_ROOT</i> in directories
-named after the build type:</p>
-
-<dl>
- <dt>Debug Builds with assertions enabled (the default)
- <dd>
- <dl>
- <dt>Tools
- <dd><tt><i>OBJ_ROOT</i>/Debug+Asserts/bin</tt>
- <dt>Libraries
- <dd><tt><i>OBJ_ROOT</i>/Debug+Asserts/lib</tt>
- </dl>
- <br><br>
-
- <dt>Release Builds
- <dd>
- <dl>
- <dt>Tools
- <dd><tt><i>OBJ_ROOT</i>/Release/bin</tt>
- <dt>Libraries
- <dd><tt><i>OBJ_ROOT</i>/Release/lib</tt>
- </dl>
- <br><br>
-
- <dt>Profile Builds
- <dd>
- <dl>
- <dt>Tools
- <dd><tt><i>OBJ_ROOT</i>/Profile/bin</tt>
- <dt>Libraries
- <dd><tt><i>OBJ_ROOT</i>/Profile/lib</tt>
- </dl>
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="optionalconfig">Optional Configuration Items</a>
-</h3>
-
-<div>
-
-<p>
-If you're running on a Linux system that supports the "<a
-href="http://www.tat.physik.uni-tuebingen.de/~rguenth/linux/binfmt_misc.html">binfmt_misc</a>"
-module, and you have root access on the system, you can set your system up to
-execute LLVM bitcode files directly. To do this, use commands like this (the
-first command may not be required if you are already using the module):</p>
-
-<div class="doc_code">
-<pre>
-$ mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
-$ echo ':llvm:M::BC::/path/to/lli:' > /proc/sys/fs/binfmt_misc/register
-$ chmod u+x hello.bc (if needed)
-$ ./hello.bc
-</pre>
-</div>
-
-<p>
-This allows you to execute LLVM bitcode files directly. On Debian, you
-can also use this command instead of the 'echo' command above:
-</p>
-
-<div class="doc_code">
-<pre>
-$ sudo update-binfmts --install llvm /path/to/lli --magic 'BC'
-</pre>
-</div>
-
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="layout">Program Layout</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>One useful source of information about the LLVM source base is the LLVM <a
-href="http://www.doxygen.org/">doxygen</a> documentation available at <tt><a
-href="http://llvm.org/doxygen/">http://llvm.org/doxygen/</a></tt>.
-The following is a brief introduction to code layout:</p>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="examples"><tt>llvm/examples</tt></a>
-</h3>
-
-<div>
- <p>This directory contains some simple examples of how to use the LLVM IR and
- JIT.</p>
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="include"><tt>llvm/include</tt></a>
-</h3>
-
-<div>
-
-<p>This directory contains public header files exported from the LLVM
-library. The three main subdirectories of this directory are:</p>
-
-<dl>
- <dt><tt><b>llvm/include/llvm</b></tt></dt>
- <dd>This directory contains all of the LLVM specific header files. This
- directory also has subdirectories for different portions of LLVM:
- <tt>Analysis</tt>, <tt>CodeGen</tt>, <tt>Target</tt>, <tt>Transforms</tt>,
- etc...</dd>
-
- <dt><tt><b>llvm/include/llvm/Support</b></tt></dt>
- <dd>This directory contains generic support libraries that are provided with
- LLVM but not necessarily specific to LLVM. For example, some C++ STL utilities
- and a Command Line option processing library store their header files here.
- </dd>
-
- <dt><tt><b>llvm/include/llvm/Config</b></tt></dt>
- <dd>This directory contains header files configured by the <tt>configure</tt>
- script. They wrap "standard" UNIX and C header files. Source code can
- include these header files which automatically take care of the conditional
- #includes that the <tt>configure</tt> script generates.</dd>
-</dl>
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="lib"><tt>llvm/lib</tt></a>
-</h3>
-
-<div>
-
-<p>This directory contains most of the source files of the LLVM system. In LLVM,
-almost all code exists in libraries, making it very easy to share code among the
-different <a href="#tools">tools</a>.</p>
-
-<dl>
- <dt><tt><b>llvm/lib/VMCore/</b></tt></dt>
- <dd> This directory holds the core LLVM source files that implement core
- classes like Instruction and BasicBlock.</dd>
-
- <dt><tt><b>llvm/lib/AsmParser/</b></tt></dt>
- <dd>This directory holds the source code for the LLVM assembly language parser
- library.</dd>
-
- <dt><tt><b>llvm/lib/BitCode/</b></tt></dt>
- <dd>This directory holds code for reading and write LLVM bitcode.</dd>
-
- <dt><tt><b>llvm/lib/Analysis/</b></tt><dd>This directory contains a variety of
- different program analyses, such as Dominator Information, Call Graphs,
- Induction Variables, Interval Identification, Natural Loop Identification,
- etc.</dd>
-
- <dt><tt><b>llvm/lib/Transforms/</b></tt></dt>
- <dd> This directory contains the source code for the LLVM to LLVM program
- transformations, such as Aggressive Dead Code Elimination, Sparse Conditional
- Constant Propagation, Inlining, Loop Invariant Code Motion, Dead Global
- Elimination, and many others.</dd>
-
- <dt><tt><b>llvm/lib/Target/</b></tt></dt>
- <dd> This directory contains files that describe various target architectures
- for code generation. For example, the <tt>llvm/lib/Target/X86</tt>
- directory holds the X86 machine description while
- <tt>llvm/lib/Target/ARM</tt> implements the ARM backend.</dd>
-
- <dt><tt><b>llvm/lib/CodeGen/</b></tt></dt>
- <dd> This directory contains the major parts of the code generator: Instruction
- Selector, Instruction Scheduling, and Register Allocation.</dd>
-
- <dt><tt><b>llvm/lib/MC/</b></tt></dt>
- <dd>(FIXME: T.B.D.)</dd>
-
- <!--FIXME: obsoleted -->
- <dt><tt><b>llvm/lib/Debugger/</b></tt></dt>
- <dd> This directory contains the source level debugger library that makes
- it possible to instrument LLVM programs so that a debugger could identify
- source code locations at which the program is executing.</dd>
-
- <dt><tt><b>llvm/lib/ExecutionEngine/</b></tt></dt>
- <dd> This directory contains libraries for executing LLVM bitcode directly
- at runtime in both interpreted and JIT compiled fashions.</dd>
-
- <dt><tt><b>llvm/lib/Support/</b></tt></dt>
- <dd> This directory contains the source code that corresponds to the header
- files located in <tt>llvm/include/ADT/</tt>
- and <tt>llvm/include/Support/</tt>.</dd>
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="projects"><tt>llvm/projects</tt></a>
-</h3>
-
-<div>
- <p>This directory contains projects that are not strictly part of LLVM but are
- shipped with LLVM. This is also the directory where you should create your own
- LLVM-based projects. See <tt>llvm/projects/sample</tt> for an example of how
- to set up your own project.</p>
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="runtime"><tt>llvm/runtime</tt></a>
-</h3>
-
-<div>
-
-<p>This directory contains libraries which are compiled into LLVM bitcode and
-used when linking programs with the Clang front end. Most of these libraries are
-skeleton versions of real libraries; for example, libc is a stripped down
-version of glibc.</p>
-
-<p>Unlike the rest of the LLVM suite, this directory needs the LLVM GCC front
-end to compile.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="test"><tt>llvm/test</tt></a>
-</h3>
-
-<div>
- <p>This directory contains feature and regression tests and other basic sanity
- checks on the LLVM infrastructure. These are intended to run quickly and cover
- a lot of territory without being exhaustive.</p>
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="test-suite"><tt>test-suite</tt></a>
-</h3>
-
-<div>
- <p>This is not a directory in the normal llvm module; it is a separate
- Subversion
- module that must be checked out (usually to <tt>projects/test-suite</tt>).
- This
- module contains a comprehensive correctness, performance, and benchmarking
- test
- suite for LLVM. It is a separate Subversion module because not every LLVM
- user is
- interested in downloading or building such a comprehensive test suite. For
- further details on this test suite, please see the
- <a href="TestingGuide.html">Testing Guide</a> document.</p>
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="tools"><tt>llvm/tools</tt></a>
-</h3>
-
-<div>
-
-<p>The <b>tools</b> directory contains the executables built out of the
-libraries above, which form the main part of the user interface. You can
-always get help for a tool by typing <tt>tool_name -help</tt>. The
-following is a brief introduction to the most important tools. More detailed
-information is in the <a href="CommandGuide/index.html">Command Guide</a>.</p>
-
-<dl>
-
- <dt><tt><b>bugpoint</b></tt></dt>
- <dd><tt>bugpoint</tt> is used to debug
- optimization passes or code generation backends by narrowing down the
- given test case to the minimum number of passes and/or instructions that
- still cause a problem, whether it is a crash or miscompilation. See <a
- href="HowToSubmitABug.html">HowToSubmitABug.html</a> for more information
- on using <tt>bugpoint</tt>.</dd>
-
- <dt><tt><b>llvm-ar</b></tt></dt>
- <dd>The archiver produces an archive containing
- the given LLVM bitcode files, optionally with an index for faster
- lookup.</dd>
-
- <dt><tt><b>llvm-as</b></tt></dt>
- <dd>The assembler transforms the human readable LLVM assembly to LLVM
- bitcode.</dd>
-
- <dt><tt><b>llvm-dis</b></tt></dt>
- <dd>The disassembler transforms the LLVM bitcode to human readable
- LLVM assembly.</dd>
-
- <dt><tt><b>llvm-link</b></tt></dt>
- <dd><tt>llvm-link</tt>, not surprisingly, links multiple LLVM modules into
- a single program.</dd>
-
- <dt><tt><b>lli</b></tt></dt>
- <dd><tt>lli</tt> is the LLVM interpreter, which
- can directly execute LLVM bitcode (although very slowly...). For architectures
- that support it (currently x86, Sparc, and PowerPC), by default, <tt>lli</tt>
- will function as a Just-In-Time compiler (if the functionality was compiled
- in), and will execute the code <i>much</i> faster than the interpreter.</dd>
-
- <dt><tt><b>llc</b></tt></dt>
- <dd> <tt>llc</tt> is the LLVM backend compiler, which
- translates LLVM bitcode to a native code assembly file or to C code (with
- the -march=c option).</dd>
-
- <dt><tt><b>llvm-gcc</b></tt></dt>
- <dd><tt>llvm-gcc</tt> is a GCC-based C frontend that has been retargeted to
- use LLVM as its backend instead of GCC's RTL backend. It can also emit LLVM
- bitcode or assembly (with the <tt>-emit-llvm</tt> option) instead of the
- usual machine code output. It works just like any other GCC compiler,
- taking the typical <tt>-c, -S, -E, -o</tt> options that are typically used.
- Additionally, the source code for <tt>llvm-gcc</tt> is available as a
- separate Subversion module.</dd>
-
- <dt><tt><b>opt</b></tt></dt>
- <dd><tt>opt</tt> reads LLVM bitcode, applies a series of LLVM to LLVM
- transformations (which are specified on the command line), and then outputs
- the resultant bitcode. The '<tt>opt -help</tt>' command is a good way to
- get a list of the program transformations available in LLVM.<br>
- <dd><tt>opt</tt> can also be used to run a specific analysis on an input
- LLVM bitcode file and print out the results. It is primarily useful for
- debugging analyses, or familiarizing yourself with what an analysis does.</dd>
-</dl>
-</div>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="utils"><tt>llvm/utils</tt></a>
-</h3>
-
-<div>
-
-<p>This directory contains utilities for working with LLVM source code, and some
-of the utilities are actually required as part of the build process because they
-are code generators for parts of LLVM infrastructure.</p>
-
-<dl>
- <dt><tt><b>codegen-diff</b></tt> <dd><tt>codegen-diff</tt> is a script
- that finds differences between code that LLC generates and code that LLI
- generates. This is a useful tool if you are debugging one of them,
- assuming that the other generates correct output. For the full user
- manual, run <tt>`perldoc codegen-diff'</tt>.<br><br>
-
- <dt><tt><b>emacs/</b></tt> <dd>The <tt>emacs</tt> directory contains
- syntax-highlighting files which will work with Emacs and XEmacs editors,
- providing syntax highlighting support for LLVM assembly files and TableGen
- description files. For information on how to use the syntax files, consult
- the <tt>README</tt> file in that directory.<br><br>
-
- <dt><tt><b>getsrcs.sh</b></tt> <dd>The <tt>getsrcs.sh</tt> script finds
- and outputs all non-generated source files, which is useful if one wishes
- to do a lot of development across directories and does not want to
- individually find each file. One way to use it is to run, for example:
- <tt>xemacs `utils/getsources.sh`</tt> from the top of your LLVM source
- tree.<br><br>
-
- <dt><tt><b>llvmgrep</b></tt></dt>
- <dd>This little tool performs an "egrep -H -n" on each source file in LLVM and
- passes to it a regular expression provided on <tt>llvmgrep</tt>'s command
- line. This is a very efficient way of searching the source base for a
- particular regular expression.</dd>
-
- <dt><tt><b>makellvm</b></tt> <dd>The <tt>makellvm</tt> script compiles all
- files in the current directory and then compiles and links the tool that
- is the first argument. For example, assuming you are in the directory
- <tt>llvm/lib/Target/Sparc</tt>, if <tt>makellvm</tt> is in your path,
- simply running <tt>makellvm llc</tt> will make a build of the current
- directory, switch to directory <tt>llvm/tools/llc</tt> and build it,
- causing a re-linking of LLC.<br><br>
-
- <dt><tt><b>TableGen/</b></tt> <dd>The <tt>TableGen</tt> directory contains
- the tool used to generate register descriptions, instruction set
- descriptions, and even assemblers from common TableGen description
- files.<br><br>
-
- <dt><tt><b>vim/</b></tt> <dd>The <tt>vim</tt> directory contains
- syntax-highlighting files which will work with the VIM editor, providing
- syntax highlighting support for LLVM assembly files and TableGen
- description files. For information on how to use the syntax files, consult
- the <tt>README</tt> file in that directory.<br><br>
-
-</dl>
-
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="tutorial">An Example Using the LLVM Tool Chain</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-<p>This section gives an example of using LLVM with the Clang front end.</p>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="tutorial4">Example with clang</a>
-</h3>
-
-<div>
-
-<ol>
- <li><p>First, create a simple C file, name it 'hello.c':</p>
-
-<div class="doc_code">
-<pre>
-#include <stdio.h>
-
-int main() {
- printf("hello world\n");
- return 0;
-}
-</pre></div></li>
-
- <li><p>Next, compile the C file into a native executable:</p>
-
- <div class="doc_code"><pre>% clang hello.c -o hello</pre></div>
-
- <p>Note that clang works just like GCC by default. The standard -S and
- -c arguments work as usual (producing a native .s or .o file,
- respectively).</p></li>
-
- <li><p>Next, compile the C file into a LLVM bitcode file:</p>
-
- <div class="doc_code">
- <pre>% clang -O3 -emit-llvm hello.c -c -o hello.bc</pre></div>
-
- <p>The -emit-llvm option can be used with the -S or -c options to emit an
- LLVM ".ll" or ".bc" file (respectively) for the code. This allows you
- to use the <a href="CommandGuide/index.html">standard LLVM tools</a> on
- the bitcode file.</p></li>
-
- <li><p>Run the program in both forms. To run the program, use:</p>
-
- <div class="doc_code"><pre>% ./hello</pre></div>
-
- <p>and</p>
-
- <div class="doc_code"><pre>% lli hello.bc</pre></div>
-
- <p>The second examples shows how to invoke the LLVM JIT, <a
- href="CommandGuide/html/lli.html">lli</a>.</p></li>
-
- <li><p>Use the <tt>llvm-dis</tt> utility to take a look at the LLVM assembly
- code:</p>
-
-<div class="doc_code">
-<pre>llvm-dis < hello.bc | less</pre>
-</div></li>
-
- <li><p>Compile the program to native assembly using the LLC code
- generator:</p>
-
- <div class="doc_code"><pre>% llc hello.bc -o hello.s</pre></div></li>
-
- <li><p>Assemble the native assembly language file into a program:</p>
-
-<div class="doc_code">
-<pre>
-<b>Solaris:</b> % /opt/SUNWspro/bin/cc -xarch=v9 hello.s -o hello.native
-
-<b>Others:</b> % gcc hello.s -o hello.native
-</pre>
-</div></li>
-
- <li><p>Execute the native code program:</p>
-
- <div class="doc_code"><pre>% ./hello.native</pre></div>
-
- <p>Note that using clang to compile directly to native code (i.e. when
- the -emit-llvm option is not present) does steps 6/7/8 for you.</p>
- </li>
-
-</ol>
-
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="problems">Common Problems</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>If you are having problems building or using LLVM, or if you have any other
-general questions about LLVM, please consult the <a href="FAQ.html">Frequently
-Asked Questions</a> page.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h2>
- <a name="links">Links</a>
-</h2>
-<!-- *********************************************************************** -->
-
-<div>
-
-<p>This document is just an <b>introduction</b> on how to use LLVM to do
-some simple things... there are many more interesting and complicated things
-that you can do that aren't documented here (but we'll gladly accept a patch
-if you want to write something up!). For more information about LLVM, check
-out:</p>
-
-<ul>
- <li><a href="http://llvm.org/">LLVM homepage</a></li>
- <li><a href="http://llvm.org/doxygen/">LLVM doxygen tree</a></li>
- <li><a href="http://llvm.org/docs/Projects.html">Starting a Project
- that Uses LLVM</a></li>
-</ul>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
- <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
- src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
- <a href="http://validator.w3.org/check/referer"><img
- src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
- <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
- <a href="http://llvm.x10sys.com/rspencer/">Reid Spencer</a><br>
- <a href="http://llvm.org/">The LLVM Compiler Infrastructure</a><br>
- Last modified: $Date$
-</address>
-</body>
-</html>
Added: llvm/branches/R600/docs/GettingStarted.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/GettingStarted.rst?rev=165748&view=auto
==============================================================================
--- llvm/branches/R600/docs/GettingStarted.rst (added)
+++ llvm/branches/R600/docs/GettingStarted.rst Thu Oct 11 16:28:00 2012
@@ -0,0 +1,1304 @@
+.. _getting_started:
+
+====================================
+Getting Started with the LLVM System
+====================================
+
+Overview
+========
+
+Welcome to LLVM! In order to get started, you first need to know some basic
+information.
+
+First, LLVM comes in three pieces. The first piece is the LLVM suite. This
+contains all of the tools, libraries, and header files needed to use LLVM. It
+contains an assembler, disassembler, bitcode analyzer and bitcode optimizer. It
+also contains basic regression tests that can be used to test the LLVM tools and
+the Clang front end.
+
+The second piece is the `Clang <http://clang.llvm.org/>`_ front end. This
+component compiles C, C++, Objective C, and Objective C++ code into LLVM
+bitcode. Once compiled into LLVM bitcode, a program can be manipulated with the
+LLVM tools from the LLVM suite.
+
+There is a third, optional piece called Test Suite. It is a suite of programs
+with a testing harness that can be used to further test LLVM's functionality
+and performance.
+
+Getting Started Quickly (A Summary)
+===================================
+
+The LLVM Getting Started documentation may be out of date. So, the `Clang
+Getting Started <http://clang.llvm.org/get_started.html>`_ page might also be a
+good place to start.
+
+Here's the short story for getting up and running quickly with LLVM:
+
+#. Read the documentation.
+#. Read the documentation.
+#. Remember that you were warned twice about reading the documentation.
+#. Checkout LLVM:
+
+ * ``cd where-you-want-llvm-to-live``
+ * ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm``
+
+#. Checkout Clang:
+
+ * ``cd where-you-want-llvm-to-live``
+ * ``cd llvm/tools``
+ * ``svn co http://llvm.org/svn/llvm-project/cfe/trunk clang``
+
+#. Checkout Compiler-RT:
+
+ * ``cd where-you-want-llvm-to-live``
+ * ``cd llvm/projects``
+ * ``svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt``
+
+#. Get the Test Suite Source Code **[Optional]**
+
+ * ``cd where-you-want-llvm-to-live``
+ * ``cd llvm/projects``
+ * ``svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite``
+
+#. Configure and build LLVM and Clang:
+
+ * ``cd where-you-want-to-build-llvm``
+ * ``mkdir build`` (for building without polluting the source dir)
+ * ``cd build``
+ * ``../llvm/configure [options]``
+ Some common options:
+
+ * ``--prefix=directory`` ---
+
+ Specify for *directory* the full pathname of where you want the LLVM
+ tools and libraries to be installed (default ``/usr/local``).
+
+ * ``--enable-optimized`` ---
+
+ Compile with optimizations enabled (default is NO).
+
+ * ``--enable-assertions`` ---
+
+ Compile with assertion checks enabled (default is YES).
+
+ * ``make [-j]`` --- The ``-j`` specifies the number of jobs (commands) to run
+ simultaneously. This builds both LLVM and Clang for Debug+Asserts mode.
+ The --enabled-optimized configure option is used to specify a Release
+ build.
+
+ * ``make check-all`` --- This run the regression tests to ensure everything
+ is in working order.
+
+ * ``make update`` --- This command is used to update all the svn repositories
+ at once, rather then having to ``cd`` into the individual repositories and
+ running ``svn update``.
+
+ * It is also possible to use CMake instead of the makefiles. With CMake it is
+ also possible to generate project files for several IDEs: Eclipse CDT4,
+ CodeBlocks, Qt-Creator (use the CodeBlocks generator), KDevelop3.
+
+ * If you get an "internal compiler error (ICE)" or test failures, see
+ `below`.
+
+Consult the `Getting Started with LLVM`_ section for detailed information on
+configuring and compiling LLVM. See `Setting Up Your Environment`_ for tips
+that simplify working with the Clang front end and LLVM tools. Go to `Program
+Layout`_ to learn about the layout of the source code tree.
+
+Requirements
+============
+
+Before you begin to use the LLVM system, review the requirements given below.
+This may save you some trouble by knowing ahead of time what hardware and
+software you will need.
+
+Hardware
+--------
+
+LLVM is known to work on the following platforms:
+
++-----------------+----------------------+-------------------------+
+|OS | Arch | Compilers |
++=================+======================+=========================+
+|AuroraUX | x86\ :sup:`1` | GCC |
++-----------------+----------------------+-------------------------+
+|Linux | x86\ :sup:`1` | GCC |
++-----------------+----------------------+-------------------------+
+|Linux | amd64 | GCC |
++-----------------+----------------------+-------------------------+
+|Solaris | V9 (Ultrasparc) | GCC |
++-----------------+----------------------+-------------------------+
+|FreeBSD | x86\ :sup:`1` | GCC |
++-----------------+----------------------+-------------------------+
+|FreeBSD | amd64 | GCC |
++-----------------+----------------------+-------------------------+
+|MacOS X\ :sup:`2`| PowerPC | GCC |
++-----------------+----------------------+-------------------------+
+|MacOS X\ :sup:`9`| x86 | GCC |
++-----------------+----------------------+-------------------------+
+|Cygwin/Win32 | x86\ :sup:`1, 8, 11` | GCC 3.4.X, binutils 2.20|
++-----------------+----------------------+-------------------------+
+
+LLVM has partial support for the following platforms:
+
++-------------------+----------------------+-------------------------------------------+
+|OS | Arch | Compilers |
++===================+======================+===========================================+
+| Windows | x86\ :sup:`1` | Visual Studio 2000 or higher\ :sup:`4,5` |
++-------------------+----------------------+-------------------------------------------+
+| AIX\ :sup:`3,4` | PowerPC | GCC |
++-------------------+----------------------+-------------------------------------------+
+| Linux\ :sup:`3,5` | PowerPC | GCC |
++-------------------+----------------------+-------------------------------------------+
+| Linux\ :sup:`7` | Alpha | GCC |
++-------------------+----------------------+-------------------------------------------+
+| Linux\ :sup:`7` | Itanium (IA-64) | GCC |
++-------------------+----------------------+-------------------------------------------+
+| HP-UX\ :sup:`7` | Itanium (IA-64) | HP aCC |
++-------------------+----------------------+-------------------------------------------+
+| Windows x64 | x86-64 | mingw-w64's GCC-4.5.x\ :sup:`12` |
++-------------------+----------------------+-------------------------------------------+
+
+.. note::
+
+ Code generation supported for Pentium processors and up
+
+ #. Code generation supported for Pentium processors and up
+ #. Code generation supported for 32-bit ABI only
+ #. No native code generation
+ #. Build is not complete: one or more tools do not link or function
+ #. The GCC-based C/C++ frontend does not build
+ #. The port is done using the MSYS shell.
+ #. Native code generation exists but is not complete.
+ #. Binutils 2.20 or later is required to build the assembler generated by LLVM properly.
+ #. Xcode 2.5 and gcc 4.0.1 (Apple Build 5370) will trip internal LLVM assert
+ messages when compiled for Release at optimization levels greater than 0
+ (i.e., ``-O1`` and higher). Add ``OPTIMIZE_OPTION="-O0"`` to the build
+ command line if compiling for LLVM Release or bootstrapping the LLVM
+ toolchain.
+ #. For MSYS/MinGW on Windows, be sure to install the MSYS version of the perl
+ package, and be sure it appears in your path before any Windows-based
+ versions such as Strawberry Perl and ActivePerl, as these have
+ Windows-specifics that will cause the build to fail.
+ #. To use LLVM modules on Win32-based system, you may configure LLVM
+ with ``--enable-shared``.
+
+ #. To compile SPU backend, you need to add ``LDFLAGS=-Wl,--stack,16777216`` to
+ configure.
+
+Note that you will need about 1-3 GB of space for a full LLVM build in Debug
+mode, depending on the system (it is so large because of all the debugging
+information and the fact that the libraries are statically linked into multiple
+tools). If you do not need many of the tools and you are space-conscious, you
+can pass ``ONLY_TOOLS="tools you need"`` to make. The Release build requires
+considerably less space.
+
+The LLVM suite *may* compile on other platforms, but it is not guaranteed to do
+so. If compilation is successful, the LLVM utilities should be able to
+assemble, disassemble, analyze, and optimize LLVM bitcode. Code generation
+should work as well, although the generated native code may not work on your
+platform.
+
+Software
+--------
+
+Compiling LLVM requires that you have several software packages installed. The
+table below lists those required packages. The Package column is the usual name
+for the software package that LLVM depends on. The Version column provides
+"known to work" versions of the package. The Notes column describes how LLVM
+uses the package and provides other details.
+
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| Package | Version | Notes |
++==============================================================+=================+=============================================+
+| `GNU Make <http://savannah.gnu.org/projects/make>`_ | 3.79, 3.79.1 | Makefile/build processor |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `GCC <http://gcc.gnu.org/>`_ | 3.4.2 | C/C++ compiler\ :sup:`1` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `TeXinfo <http://www.gnu.org/software/texinfo/>`_ | 4.5 | For building the CFE |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `SVN <http://subversion.tigris.org/project_packages.html>`_ | >=1.3 | Subversion access to LLVM\ :sup:`2` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `DejaGnu <http://savannah.gnu.org/projects/dejagnu>`_ | 1.4.2 | Automated test suite\ :sup:`3` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `tcl <http://www.tcl.tk/software/tcltk/>`_ | 8.3, 8.4 | Automated test suite\ :sup:`3` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `expect <http://expect.nist.gov/>`_ | 5.38.0 | Automated test suite\ :sup:`3` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `perl <http://www.perl.com/download.csp>`_ | >=5.6.0 | Utilities |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `GNU M4 <http://savannah.gnu.org/projects/m4>`_ | 1.4 | Macro processor for configuration\ :sup:`4` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `GNU Autoconf <http://www.gnu.org/software/autoconf/>`_ | 2.60 | Configuration script builder\ :sup:`4` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `GNU Automake <http://www.gnu.org/software/automake/>`_ | 1.9.6 | aclocal macro generator\ :sup:`4` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+| `libtool <http://savannah.gnu.org/projects/libtool>`_ | 1.5.22 | Shared library manager\ :sup:`4` |
++--------------------------------------------------------------+-----------------+---------------------------------------------+
+
+.. note::
+
+ #. Only the C and C++ languages are needed so there's no need to build the
+ other languages for LLVM's purposes. See `below` for specific version
+ info.
+ #. You only need Subversion if you intend to build from the latest LLVM
+ sources. If you're working from a release distribution, you don't need
+ Subversion.
+ #. Only needed if you want to run the automated test suite in the
+ ``llvm/test`` directory.
+ #. If you want to make changes to the configure scripts, you will need GNU
+ autoconf (2.60), and consequently, GNU M4 (version 1.4 or higher). You
+ will also need automake (1.9.6). We only use aclocal from that package.
+
+Additionally, your compilation host is expected to have the usual plethora of
+Unix utilities. Specifically:
+
+* **ar** --- archive library builder
+* **bzip2** --- bzip2 command for distribution generation
+* **bunzip2** --- bunzip2 command for distribution checking
+* **chmod** --- change permissions on a file
+* **cat** --- output concatenation utility
+* **cp** --- copy files
+* **date** --- print the current date/time
+* **echo** --- print to standard output
+* **egrep** --- extended regular expression search utility
+* **find** --- find files/dirs in a file system
+* **grep** --- regular expression search utility
+* **gzip** --- gzip command for distribution generation
+* **gunzip** --- gunzip command for distribution checking
+* **install** --- install directories/files
+* **mkdir** --- create a directory
+* **mv** --- move (rename) files
+* **ranlib** --- symbol table builder for archive libraries
+* **rm** --- remove (delete) files and directories
+* **sed** --- stream editor for transforming output
+* **sh** --- Bourne shell for make build scripts
+* **tar** --- tape archive for distribution generation
+* **test** --- test things in file system
+* **unzip** --- unzip command for distribution checking
+* **zip** --- zip command for distribution generation
+
+.. _below:
+.. _check here:
+
+Broken versions of GCC and other tools
+--------------------------------------
+
+LLVM is very demanding of the host C++ compiler, and as such tends to expose
+bugs in the compiler. In particular, several versions of GCC crash when trying
+to compile LLVM. We routinely use GCC 4.2 (and higher) or Clang. Other
+versions of GCC will probably work as well. GCC versions listed here are known
+to not work. If you are using one of these versions, please try to upgrade your
+GCC to something more recent. If you run into a problem with a version of GCC
+not listed here, please `let us know <mailto:llvmdev at cs.uiuc.edu>`_. Please use
+the "``gcc -v``" command to find out which version of GCC you are using.
+
+**GCC versions prior to 3.0**: GCC 2.96.x and before had several problems in the
+STL that effectively prevent it from compiling LLVM.
+
+**GCC 3.2.2 and 3.2.3**: These versions of GCC fails to compile LLVM with a
+bogus template error. This was fixed in later GCCs.
+
+**GCC 3.3.2**: This version of GCC suffered from a `serious bug
+<http://gcc.gnu.org/PR13392>`_ which causes it to crash in the
+"``convert_from_eh_region_ranges_1``" GCC function.
+
+**Cygwin GCC 3.3.3**: The version of GCC 3.3.3 commonly shipped with Cygwin does
+not work.
+
+**SuSE GCC 3.3.3**: The version of GCC 3.3.3 shipped with SuSE 9.1 (and possibly
+others) does not compile LLVM correctly (it appears that exception handling is
+broken in some cases). Please download the FSF 3.3.3 or upgrade to a newer
+version of GCC.
+
+**GCC 3.4.0 on linux/x86 (32-bit)**: GCC miscompiles portions of the code
+generator, causing an infinite loop in the llvm-gcc build when built with
+optimizations enabled (i.e. a release build).
+
+**GCC 3.4.2 on linux/x86 (32-bit)**: GCC miscompiles portions of the code
+generator at -O3, as with 3.4.0. However gcc 3.4.2 (unlike 3.4.0) correctly
+compiles LLVM at -O2. A work around is to build release LLVM builds with
+"``make ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O2 ...``"
+
+**GCC 3.4.x on X86-64/amd64**: GCC `miscompiles portions of LLVM
+<http://llvm.org/PR1056>`__.
+
+**GCC 3.4.4 (CodeSourcery ARM 2005q3-2)**: this compiler miscompiles LLVM when
+building with optimizations enabled. It appears to work with "``make
+ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O1``" or build a debug build.
+
+**IA-64 GCC 4.0.0**: The IA-64 version of GCC 4.0.0 is known to miscompile LLVM.
+
+**Apple Xcode 2.3**: GCC crashes when compiling LLVM at -O3 (which is the
+default with ENABLE_OPTIMIZED=1. To work around this, build with
+"``ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O2``".
+
+**GCC 4.1.1**: GCC fails to build LLVM with template concept check errors
+compiling some files. At the time of this writing, GCC mainline (4.2) did not
+share the problem.
+
+**GCC 4.1.1 on X86-64/amd64**: GCC `miscompiles portions of LLVM
+<http://llvm.org/PR1063>`__ when compiling llvm itself into 64-bit code. LLVM
+will appear to mostly work but will be buggy, e.g. failing portions of its
+testsuite.
+
+**GCC 4.1.2 on OpenSUSE**: Seg faults during libstdc++ build and on x86_64
+platforms compiling md5.c gets a mangled constant.
+
+**GCC 4.1.2 (20061115 (prerelease) (Debian 4.1.1-21)) on Debian**: Appears to
+miscompile parts of LLVM 2.4. One symptom is ValueSymbolTable complaining about
+symbols remaining in the table on destruction.
+
+**GCC 4.1.2 20071124 (Red Hat 4.1.2-42)**: Suffers from the same symptoms as the
+previous one. It appears to work with ENABLE_OPTIMIZED=0 (the default).
+
+**Cygwin GCC 4.3.2 20080827 (beta) 2**: Users `reported
+<http://llvm.org/PR4145>`_ various problems related with link errors when using
+this GCC version.
+
+**Debian GCC 4.3.2 on X86**: Crashes building some files in LLVM 2.6.
+
+**GCC 4.3.3 (Debian 4.3.3-10) on ARM**: Miscompiles parts of LLVM 2.6 when
+optimizations are turned on. The symptom is an infinite loop in
+``FoldingSetImpl::RemoveNode`` while running the code generator.
+
+**SUSE 11 GCC 4.3.4**: Miscompiles LLVM, causing crashes in ValueHandle logic.
+
+**GCC 4.3.5 and GCC 4.4.5 on ARM**: These can miscompile ``value >> 1`` even at
+``-O0``. A test failure in ``test/Assembler/alignstack.ll`` is one symptom of
+the problem.
+
+**GNU ld 2.16.X**. Some 2.16.X versions of the ld linker will produce very long
+warning messages complaining that some "``.gnu.linkonce.t.*``" symbol was
+defined in a discarded section. You can safely ignore these messages as they are
+erroneous and the linkage is correct. These messages disappear using ld 2.17.
+
+**GNU binutils 2.17**: Binutils 2.17 contains `a bug
+<http://sourceware.org/bugzilla/show_bug.cgi?id=3111>`__ which causes huge link
+times (minutes instead of seconds) when building LLVM. We recommend upgrading
+to a newer version (2.17.50.0.4 or later).
+
+**GNU Binutils 2.19.1 Gold**: This version of Gold contained `a bug
+<http://sourceware.org/bugzilla/show_bug.cgi?id=9836>`__ which causes
+intermittent failures when building LLVM with position independent code. The
+symptom is an error about cyclic dependencies. We recommend upgrading to a
+newer version of Gold.
+
+.. _Getting Started with LLVM:
+
+Getting Started with LLVM
+=========================
+
+The remainder of this guide is meant to get you up and running with LLVM and to
+give you some basic information about the LLVM environment.
+
+The later sections of this guide describe the `general layout`_ of the LLVM
+source tree, a `simple example`_ using the LLVM tool chain, and `links`_ to find
+more information about LLVM or to get help via e-mail.
+
+Terminology and Notation
+------------------------
+
+Throughout this manual, the following names are used to denote paths specific to
+the local system and working environment. *These are not environment variables
+you need to set but just strings used in the rest of this document below*. In
+any of the examples below, simply replace each of these names with the
+appropriate pathname on your local system. All these paths are absolute:
+
+``SRC_ROOT``
+
+ This is the top level directory of the LLVM source tree.
+
+``OBJ_ROOT``
+
+ This is the top level directory of the LLVM object tree (i.e. the tree where
+ object files and compiled programs will be placed. It can be the same as
+ SRC_ROOT).
+
+.. _Setting Up Your Environment:
+
+Setting Up Your Environment
+---------------------------
+
+In order to compile and use LLVM, you may need to set some environment
+variables.
+
+``LLVM_LIB_SEARCH_PATH=/path/to/your/bitcode/libs``
+
+ [Optional] This environment variable helps LLVM linking tools find the
+ locations of your bitcode libraries. It is provided only as a convenience
+ since you can specify the paths using the -L options of the tools and the
+ C/C++ front-end will automatically use the bitcode files installed in its
+ ``lib`` directory.
+
+Unpacking the LLVM Archives
+---------------------------
+
+If you have the LLVM distribution, you will need to unpack it before you can
+begin to compile it. LLVM is distributed as a set of two files: the LLVM suite
+and the LLVM GCC front end compiled for your platform. There is an additional
+test suite that is optional. Each file is a TAR archive that is compressed with
+the gzip program.
+
+The files are as follows, with *x.y* marking the version number:
+
+``llvm-x.y.tar.gz``
+
+ Source release for the LLVM libraries and tools.
+
+``llvm-test-x.y.tar.gz``
+
+ Source release for the LLVM test-suite.
+
+``llvm-gcc-4.2-x.y.source.tar.gz``
+
+ Source release of the llvm-gcc-4.2 front end. See README.LLVM in the root
+ directory for build instructions.
+
+``llvm-gcc-4.2-x.y-platform.tar.gz``
+
+ Binary release of the llvm-gcc-4.2 front end for a specific platform.
+
+Checkout LLVM from Subversion
+-----------------------------
+
+If you have access to our Subversion repository, you can get a fresh copy of the
+entire source code. All you need to do is check it out from Subversion as
+follows:
+
+* ``cd where-you-want-llvm-to-live``
+* Read-Only: ``svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm``
+* Read-Write:``svn co https://user@llvm.org/svn/llvm-project/llvm/trunk llvm``
+
+This will create an '``llvm``' directory in the current directory and fully
+populate it with the LLVM source code, Makefiles, test directories, and local
+copies of documentation files.
+
+If you want to get a specific release (as opposed to the most recent revision),
+you can checkout it from the '``tags``' directory (instead of '``trunk``'). The
+following releases are located in the following subdirectories of the '``tags``'
+directory:
+
+* Release 3.1: **RELEASE_31/final**
+* Release 3.0: **RELEASE_30/final**
+* Release 2.9: **RELEASE_29/final**
+* Release 2.8: **RELEASE_28**
+* Release 2.7: **RELEASE_27**
+* Release 2.6: **RELEASE_26**
+* Release 2.5: **RELEASE_25**
+* Release 2.4: **RELEASE_24**
+* Release 2.3: **RELEASE_23**
+* Release 2.2: **RELEASE_22**
+* Release 2.1: **RELEASE_21**
+* Release 2.0: **RELEASE_20**
+* Release 1.9: **RELEASE_19**
+* Release 1.8: **RELEASE_18**
+* Release 1.7: **RELEASE_17**
+* Release 1.6: **RELEASE_16**
+* Release 1.5: **RELEASE_15**
+* Release 1.4: **RELEASE_14**
+* Release 1.3: **RELEASE_13**
+* Release 1.2: **RELEASE_12**
+* Release 1.1: **RELEASE_11**
+* Release 1.0: **RELEASE_1**
+
+If you would like to get the LLVM test suite (a separate package as of 1.4), you
+get it from the Subversion repository:
+
+.. code:: bash
+
+ % cd llvm/projects
+ % svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
+
+By placing it in the ``llvm/projects``, it will be automatically configured by
+the LLVM configure script as well as automatically updated when you run ``svn
+update``.
+
+GIT mirror
+----------
+
+GIT mirrors are available for a number of LLVM subprojects. These mirrors sync
+automatically with each Subversion commit and contain all necessary git-svn
+marks (so, you can recreate git-svn metadata locally). Note that right now
+mirrors reflect only ``trunk`` for each project. You can do the read-only GIT
+clone of LLVM via:
+
+.. code:: bash
+
+ % git clone http://llvm.org/git/llvm.git
+
+If you want to check out clang too, run:
+
+.. code:: bash
+
+ % git clone http://llvm.org/git/llvm.git
+ % cd llvm/tools
+ % git clone http://llvm.org/git/clang.git
+
+Since the upstream repository is in Subversion, you should use ``git
+pull --rebase`` instead of ``git pull`` to avoid generating a non-linear history
+in your clone. To configure ``git pull`` to pass ``--rebase`` by default on the
+master branch, run the following command:
+
+.. code:: bash
+
+ % git config branch.master.rebase true
+
+Sending patches with Git
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+Please read `Developer Policy <DeveloperPolicy.html#patches>`_, too.
+
+Assume ``master`` points the upstream and ``mybranch`` points your working
+branch, and ``mybranch`` is rebased onto ``master``. At first you may check
+sanity of whitespaces:
+
+.. code:: bash
+
+ % git diff --check master..mybranch
+
+The easiest way to generate a patch is as below:
+
+.. code:: bash
+
+ % git diff master..mybranch > /path/to/mybranch.diff
+
+It is a little different from svn-generated diff. git-diff-generated diff has
+prefixes like ``a/`` and ``b/``. Don't worry, most developers might know it
+could be accepted with ``patch -p1 -N``.
+
+But you may generate patchset with git-format-patch. It generates by-each-commit
+patchset. To generate patch files to attach to your article:
+
+.. code:: bash
+
+ % git format-patch --no-attach master..mybranch -o /path/to/your/patchset
+
+If you would like to send patches directly, you may use git-send-email or
+git-imap-send. Here is an example to generate the patchset in Gmail's [Drafts].
+
+.. code:: bash
+
+ % git format-patch --attach master..mybranch --stdout | git imap-send
+
+Then, your .git/config should have [imap] sections.
+
+.. code:: bash
+
+ [imap]
+ host = imaps://imap.gmail.com
+ user = your.gmail.account at gmail.com
+ pass = himitsu!
+ port = 993
+ sslverify = false
+ ; in English
+ folder = "[Gmail]/Drafts"
+ ; example for Japanese, "Modified UTF-7" encoded.
+ folder = "[Gmail]/&Tgtm+DBN-"
+ ; example for Traditional Chinese
+ folder = "[Gmail]/&g0l6Pw-"
+
+For developers to work with git-svn
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+To set up clone from which you can submit code using ``git-svn``, run:
+
+.. code:: bash
+
+ % git clone http://llvm.org/git/llvm.git
+ % cd llvm
+ % git svn init https://llvm.org/svn/llvm-project/llvm/trunk --username=<username>
+ % git config svn-remote.svn.fetch :refs/remotes/origin/master
+ % git svn rebase -l # -l avoids fetching ahead of the git mirror.
+
+ # If you have clang too:
+ % cd tools
+ % git clone http://llvm.org/git/clang.git
+ % cd clang
+ % git svn init https://llvm.org/svn/llvm-project/cfe/trunk --username=<username>
+ % git config svn-remote.svn.fetch :refs/remotes/origin/master
+ % git svn rebase -l
+
+To update this clone without generating git-svn tags that conflict with the
+upstream git repo, run:
+
+.. code:: bash
+
+ % git fetch && (cd tools/clang && git fetch) # Get matching revisions of both trees.
+ % git checkout master
+ % git svn rebase -l
+ % (cd tools/clang &&
+ git checkout master &&
+ git svn rebase -l)
+
+This leaves your working directories on their master branches, so you'll need to
+``checkout`` each working branch individually and ``rebase`` it on top of its
+parent branch. (Note: This script is intended for relative newbies to git. If
+you have more experience, you can likely improve on it.)
+
+The git-svn metadata can get out of sync after you mess around with branches and
+``dcommit``. When that happens, ``git svn dcommit`` stops working, complaining
+about files with uncommitted changes. The fix is to rebuild the metadata:
+
+.. code:: bash
+
+ % rm -rf .git/svn
+ % git svn rebase -l
+
+Local LLVM Configuration
+------------------------
+
+Once checked out from the Subversion repository, the LLVM suite source code must
+be configured via the ``configure`` script. This script sets variables in the
+various ``*.in`` files, most notably ``llvm/Makefile.config`` and
+``llvm/include/Config/config.h``. It also populates *OBJ_ROOT* with the
+Makefiles needed to begin building LLVM.
+
+The following environment variables are used by the ``configure`` script to
+configure the build system:
+
++------------+-----------------------------------------------------------+
+| Variable | Purpose |
++============+===========================================================+
+| CC | Tells ``configure`` which C compiler to use. By default, |
+| | ``configure`` will look for the first GCC C compiler in |
+| | ``PATH``. Use this variable to override ``configure``\'s |
+| | default behavior. |
++------------+-----------------------------------------------------------+
+| CXX | Tells ``configure`` which C++ compiler to use. By |
+| | default, ``configure`` will look for the first GCC C++ |
+| | compiler in ``PATH``. Use this variable to override |
+| | ``configure``'s default behavior. |
++------------+-----------------------------------------------------------+
+
+The following options can be used to set or enable LLVM specific options:
+
+``--enable-optimized``
+
+ Enables optimized compilation (debugging symbols are removed and GCC
+ optimization flags are enabled). Note that this is the default setting if you
+ are using the LLVM distribution. The default behavior of an Subversion
+ checkout is to use an unoptimized build (also known as a debug build).
+
+``--enable-debug-runtime``
+
+ Enables debug symbols in the runtime libraries. The default is to strip debug
+ symbols from the runtime libraries.
+
+``--enable-jit``
+
+ Compile the Just In Time (JIT) compiler functionality. This is not available
+ on all platforms. The default is dependent on platform, so it is best to
+ explicitly enable it if you want it.
+
+``--enable-targets=target-option``
+
+ Controls which targets will be built and linked into llc. The default value
+ for ``target_options`` is "all" which builds and links all available targets.
+ The value "host-only" can be specified to build only a native compiler (no
+ cross-compiler targets available). The "native" target is selected as the
+ target of the build host. You can also specify a comma separated list of
+ target names that you want available in llc. The target names use all lower
+ case. The current set of targets is:
+
+ ``arm, cpp, hexagon, mblaze, mips, mipsel, msp430, powerpc, ptx, sparc, spu,
+ x86, x86_64, xcore``.
+
+``--enable-doxygen``
+
+ Look for the doxygen program and enable construction of doxygen based
+ documentation from the source code. This is disabled by default because
+ generating the documentation can take a long time and producess 100s of
+ megabytes of output.
+
+``--with-udis86``
+
+ LLVM can use external disassembler library for various purposes (now it's used
+ only for examining code produced by JIT). This option will enable usage of
+ `udis86 <http://udis86.sourceforge.net/>`_ x86 (both 32 and 64 bits)
+ disassembler library.
+
+To configure LLVM, follow these steps:
+
+#. Change directory into the object root directory:
+
+ .. code:: bash
+
+ % cd OBJ_ROOT
+
+#. Run the ``configure`` script located in the LLVM source tree:
+
+ .. code:: bash
+
+ % SRC_ROOT/configure --prefix=/install/path [other options]
+
+Compiling the LLVM Suite Source Code
+------------------------------------
+
+Once you have configured LLVM, you can build it. There are three types of
+builds:
+
+Debug Builds
+
+ These builds are the default when one is using an Subversion checkout and
+ types ``gmake`` (unless the ``--enable-optimized`` option was used during
+ configuration). The build system will compile the tools and libraries with
+ debugging information. To get a Debug Build using the LLVM distribution the
+ ``--disable-optimized`` option must be passed to ``configure``.
+
+Release (Optimized) Builds
+
+ These builds are enabled with the ``--enable-optimized`` option to
+ ``configure`` or by specifying ``ENABLE_OPTIMIZED=1`` on the ``gmake`` command
+ line. For these builds, the build system will compile the tools and libraries
+ with GCC optimizations enabled and strip debugging information from the
+ libraries and executables it generates. Note that Release Builds are default
+ when using an LLVM distribution.
+
+Profile Builds
+
+ These builds are for use with profiling. They compile profiling information
+ into the code for use with programs like ``gprof``. Profile builds must be
+ started by specifying ``ENABLE_PROFILING=1`` on the ``gmake`` command line.
+
+Once you have LLVM configured, you can build it by entering the *OBJ_ROOT*
+directory and issuing the following command:
+
+.. code:: bash
+
+ % gmake
+
+If the build fails, please `check here`_ to see if you are using a version of
+GCC that is known not to compile LLVM.
+
+If you have multiple processors in your machine, you may wish to use some of the
+parallel build options provided by GNU Make. For example, you could use the
+command:
+
+.. code:: bash
+
+ % gmake -j2
+
+There are several special targets which are useful when working with the LLVM
+source code:
+
+``gmake clean``
+
+ Removes all files generated by the build. This includes object files,
+ generated C/C++ files, libraries, and executables.
+
+``gmake dist-clean``
+
+ Removes everything that ``gmake clean`` does, but also removes files generated
+ by ``configure``. It attempts to return the source tree to the original state
+ in which it was shipped.
+
+``gmake install``
+
+ Installs LLVM header files, libraries, tools, and documentation in a hierarchy
+ under ``$PREFIX``, specified with ``./configure --prefix=[dir]``, which
+ defaults to ``/usr/local``.
+
+``gmake -C runtime install-bytecode``
+
+ Assuming you built LLVM into $OBJDIR, when this command is run, it will
+ install bitcode libraries into the GCC front end's bitcode library directory.
+ If you need to update your bitcode libraries, this is the target to use once
+ you've built them.
+
+Please see the `Makefile Guide <MakefileGuide.html>`_ for further details on
+these ``make`` targets and descriptions of other targets available.
+
+It is also possible to override default values from ``configure`` by declaring
+variables on the command line. The following are some examples:
+
+``gmake ENABLE_OPTIMIZED=1``
+
+ Perform a Release (Optimized) build.
+
+``gmake ENABLE_OPTIMIZED=1 DISABLE_ASSERTIONS=1``
+
+ Perform a Release (Optimized) build without assertions enabled.
+
+``gmake ENABLE_OPTIMIZED=0``
+
+ Perform a Debug build.
+
+``gmake ENABLE_PROFILING=1``
+
+ Perform a Profiling build.
+
+``gmake VERBOSE=1``
+
+ Print what ``gmake`` is doing on standard output.
+
+``gmake TOOL_VERBOSE=1``
+
+ Ask each tool invoked by the makefiles to print out what it is doing on
+ the standard output. This also implies ``VERBOSE=1``.
+
+Every directory in the LLVM object tree includes a ``Makefile`` to build it and
+any subdirectories that it contains. Entering any directory inside the LLVM
+object tree and typing ``gmake`` should rebuild anything in or below that
+directory that is out of date.
+
+Cross-Compiling LLVM
+--------------------
+
+It is possible to cross-compile LLVM itself. That is, you can create LLVM
+executables and libraries to be hosted on a platform different from the platform
+where they are build (a Canadian Cross build). To configure a cross-compile,
+supply the configure script with ``--build`` and ``--host`` options that are
+different. The values of these options must be legal target triples that your
+GCC compiler supports.
+
+The result of such a build is executables that are not runnable on on the build
+host (--build option) but can be executed on the compile host (--host option).
+
+The Location of LLVM Object Files
+---------------------------------
+
+The LLVM build system is capable of sharing a single LLVM source tree among
+several LLVM builds. Hence, it is possible to build LLVM for several different
+platforms or configurations using the same source tree.
+
+This is accomplished in the typical autoconf manner:
+
+* Change directory to where the LLVM object files should live:
+
+ .. code:: bash
+
+ % cd OBJ_ROOT
+
+* Run the ``configure`` script found in the LLVM source directory:
+
+ .. code:: bash
+
+ % SRC_ROOT/configure
+
+The LLVM build will place files underneath *OBJ_ROOT* in directories named after
+the build type:
+
+Debug Builds with assertions enabled (the default)
+
+ Tools
+
+ ``OBJ_ROOT/Debug+Asserts/bin``
+
+ Libraries
+
+ ``OBJ_ROOT/Debug+Asserts/lib``
+
+Release Builds
+
+ Tools
+
+ ``OBJ_ROOT/Release/bin``
+
+ Libraries
+
+ ``OBJ_ROOT/Release/lib``
+
+Profile Builds
+
+ Tools
+
+ ``OBJ_ROOT/Profile/bin``
+
+ Libraries
+
+ ``OBJ_ROOT/Profile/lib``
+
+Optional Configuration Items
+----------------------------
+
+If you're running on a Linux system that supports the `binfmt_misc
+<http://www.tat.physik.uni-tuebingen.de/~rguenth/linux/binfmt_misc.html>`_
+module, and you have root access on the system, you can set your system up to
+execute LLVM bitcode files directly. To do this, use commands like this (the
+first command may not be required if you are already using the module):
+
+.. code:: bash
+
+ % mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
+ % echo ':llvm:M::BC::/path/to/lli:' > /proc/sys/fs/binfmt_misc/register
+ % chmod u+x hello.bc (if needed)
+ % ./hello.bc
+
+This allows you to execute LLVM bitcode files directly. On Debian, you can also
+use this command instead of the 'echo' command above:
+
+.. code:: bash
+
+ % sudo update-binfmts --install llvm /path/to/lli --magic 'BC'
+
+.. _Program Layout:
+.. _general layout:
+
+Program Layout
+==============
+
+One useful source of information about the LLVM source base is the LLVM `doxygen
+<http://www.doxygen.org/>`_ documentation available at
+`<http://llvm.org/doxygen/>`_. The following is a brief introduction to code
+layout:
+
+``llvm/examples``
+-----------------
+
+This directory contains some simple examples of how to use the LLVM IR and JIT.
+
+``llvm/include``
+----------------
+
+This directory contains public header files exported from the LLVM library. The
+three main subdirectories of this directory are:
+
+``llvm/include/llvm``
+
+ This directory contains all of the LLVM specific header files. This directory
+ also has subdirectories for different portions of LLVM: ``Analysis``,
+ ``CodeGen``, ``Target``, ``Transforms``, etc...
+
+``llvm/include/llvm/Support``
+
+ This directory contains generic support libraries that are provided with LLVM
+ but not necessarily specific to LLVM. For example, some C++ STL utilities and
+ a Command Line option processing library store their header files here.
+
+``llvm/include/llvm/Config``
+
+ This directory contains header files configured by the ``configure`` script.
+ They wrap "standard" UNIX and C header files. Source code can include these
+ header files which automatically take care of the conditional #includes that
+ the ``configure`` script generates.
+
+``llvm/lib``
+------------
+
+This directory contains most of the source files of the LLVM system. In LLVM,
+almost all code exists in libraries, making it very easy to share code among the
+different `tools`_.
+
+``llvm/lib/VMCore/``
+
+ This directory holds the core LLVM source files that implement core classes
+ like Instruction and BasicBlock.
+
+``llvm/lib/AsmParser/``
+
+ This directory holds the source code for the LLVM assembly language parser
+ library.
+
+``llvm/lib/BitCode/``
+
+ This directory holds code for reading and write LLVM bitcode.
+
+``llvm/lib/Analysis/``
+
+ This directory contains a variety of different program analyses, such as
+ Dominator Information, Call Graphs, Induction Variables, Interval
+ Identification, Natural Loop Identification, etc.
+
+``llvm/lib/Transforms/``
+
+ This directory contains the source code for the LLVM to LLVM program
+ transformations, such as Aggressive Dead Code Elimination, Sparse Conditional
+ Constant Propagation, Inlining, Loop Invariant Code Motion, Dead Global
+ Elimination, and many others.
+
+``llvm/lib/Target/``
+
+ This directory contains files that describe various target architectures for
+ code generation. For example, the ``llvm/lib/Target/X86`` directory holds the
+ X86 machine description while ``llvm/lib/Target/ARM`` implements the ARM
+ backend.
+
+``llvm/lib/CodeGen/``
+
+ This directory contains the major parts of the code generator: Instruction
+ Selector, Instruction Scheduling, and Register Allocation.
+
+``llvm/lib/MC/``
+
+ (FIXME: T.B.D.)
+
+``llvm/lib/Debugger/``
+
+ This directory contains the source level debugger library that makes it
+ possible to instrument LLVM programs so that a debugger could identify source
+ code locations at which the program is executing.
+
+``llvm/lib/ExecutionEngine/``
+
+ This directory contains libraries for executing LLVM bitcode directly at
+ runtime in both interpreted and JIT compiled fashions.
+
+``llvm/lib/Support/``
+
+ This directory contains the source code that corresponds to the header files
+ located in ``llvm/include/ADT/`` and ``llvm/include/Support/``.
+
+``llvm/projects``
+-----------------
+
+This directory contains projects that are not strictly part of LLVM but are
+shipped with LLVM. This is also the directory where you should create your own
+LLVM-based projects. See ``llvm/projects/sample`` for an example of how to set
+up your own project.
+
+``llvm/runtime``
+----------------
+
+This directory contains libraries which are compiled into LLVM bitcode and used
+when linking programs with the Clang front end. Most of these libraries are
+skeleton versions of real libraries; for example, libc is a stripped down
+version of glibc.
+
+Unlike the rest of the LLVM suite, this directory needs the LLVM GCC front end
+to compile.
+
+``llvm/test``
+-------------
+
+This directory contains feature and regression tests and other basic sanity
+checks on the LLVM infrastructure. These are intended to run quickly and cover a
+lot of territory without being exhaustive.
+
+``test-suite``
+--------------
+
+This is not a directory in the normal llvm module; it is a separate Subversion
+module that must be checked out (usually to ``projects/test-suite``). This
+module contains a comprehensive correctness, performance, and benchmarking test
+suite for LLVM. It is a separate Subversion module because not every LLVM user
+is interested in downloading or building such a comprehensive test suite. For
+further details on this test suite, please see the `Testing
+Guide <TestingGuide.html>`_ document.
+
+.. _tools:
+
+``llvm/tools``
+--------------
+
+The **tools** directory contains the executables built out of the libraries
+above, which form the main part of the user interface. You can always get help
+for a tool by typing ``tool_name -help``. The following is a brief introduction
+to the most important tools. More detailed information is in
+the `Command Guide <CommandGuide/index.html>`_.
+
+``bugpoint``
+
+ ``bugpoint`` is used to debug optimization passes or code generation backends
+ by narrowing down the given test case to the minimum number of passes and/or
+ instructions that still cause a problem, whether it is a crash or
+ miscompilation. See `<HowToSubmitABug.html>`_ for more information on using
+ ``bugpoint``.
+
+``llvm-ar``
+
+ The archiver produces an archive containing the given LLVM bitcode files,
+ optionally with an index for faster lookup.
+
+``llvm-as``
+
+ The assembler transforms the human readable LLVM assembly to LLVM bitcode.
+
+``llvm-dis``
+
+ The disassembler transforms the LLVM bitcode to human readable LLVM assembly.
+
+``llvm-link``
+
+ ``llvm-link``, not surprisingly, links multiple LLVM modules into a single
+ program.
+
+``lli``
+
+ ``lli`` is the LLVM interpreter, which can directly execute LLVM bitcode
+ (although very slowly...). For architectures that support it (currently x86,
+ Sparc, and PowerPC), by default, ``lli`` will function as a Just-In-Time
+ compiler (if the functionality was compiled in), and will execute the code
+ *much* faster than the interpreter.
+
+``llc``
+
+ ``llc`` is the LLVM backend compiler, which translates LLVM bitcode to a
+ native code assembly file or to C code (with the ``-march=c`` option).
+
+``opt``
+
+ ``opt`` reads LLVM bitcode, applies a series of LLVM to LLVM transformations
+ (which are specified on the command line), and then outputs the resultant
+ bitcode. The '``opt -help``' command is a good way to get a list of the
+ program transformations available in LLVM.
+
+ ``opt`` can also be used to run a specific analysis on an input LLVM bitcode
+ file and print out the results. It is primarily useful for debugging
+ analyses, or familiarizing yourself with what an analysis does.
+
+``llvm/utils``
+--------------
+
+This directory contains utilities for working with LLVM source code, and some of
+the utilities are actually required as part of the build process because they
+are code generators for parts of LLVM infrastructure.
+
+
+``codegen-diff``
+
+ ``codegen-diff`` is a script that finds differences between code that LLC
+ generates and code that LLI generates. This is a useful tool if you are
+ debugging one of them, assuming that the other generates correct output. For
+ the full user manual, run ```perldoc codegen-diff'``.
+
+``emacs/``
+
+ The ``emacs`` directory contains syntax-highlighting files which will work
+ with Emacs and XEmacs editors, providing syntax highlighting support for LLVM
+ assembly files and TableGen description files. For information on how to use
+ the syntax files, consult the ``README`` file in that directory.
+
+``getsrcs.sh``
+
+ The ``getsrcs.sh`` script finds and outputs all non-generated source files,
+ which is useful if one wishes to do a lot of development across directories
+ and does not want to individually find each file. One way to use it is to run,
+ for example: ``xemacs `utils/getsources.sh``` from the top of your LLVM source
+ tree.
+
+``llvmgrep``
+
+ This little tool performs an ``egrep -H -n`` on each source file in LLVM and
+ passes to it a regular expression provided on ``llvmgrep``'s command
+ line. This is a very efficient way of searching the source base for a
+ particular regular expression.
+
+``makellvm``
+
+ The ``makellvm`` script compiles all files in the current directory and then
+ compiles and links the tool that is the first argument. For example, assuming
+ you are in the directory ``llvm/lib/Target/Sparc``, if ``makellvm`` is in your
+ path, simply running ``makellvm llc`` will make a build of the current
+ directory, switch to directory ``llvm/tools/llc`` and build it, causing a
+ re-linking of LLC.
+
+``TableGen/``
+
+ The ``TableGen`` directory contains the tool used to generate register
+ descriptions, instruction set descriptions, and even assemblers from common
+ TableGen description files.
+
+``vim/``
+
+ The ``vim`` directory contains syntax-highlighting files which will work with
+ the VIM editor, providing syntax highlighting support for LLVM assembly files
+ and TableGen description files. For information on how to use the syntax
+ files, consult the ``README`` file in that directory.
+
+.. _simple example:
+
+An Example Using the LLVM Tool Chain
+====================================
+
+This section gives an example of using LLVM with the Clang front end.
+
+Example with clang
+------------------
+
+#. First, create a simple C file, name it 'hello.c':
+
+ .. code:: c
+
+ #include <stdio.h>
+
+ int main() {
+ printf("hello world\n");
+ return 0;
+ }
+
+#. Next, compile the C file into a native executable:
+
+ .. code:: bash
+
+ % clang hello.c -o hello
+
+ .. note::
+
+ Clang works just like GCC by default. The standard -S and -c arguments
+ work as usual (producing a native .s or .o file, respectively).
+
+#. Next, compile the C file into a LLVM bitcode file:
+
+ .. code:: bash
+
+ % clang -O3 -emit-llvm hello.c -c -o hello.bc
+
+ The -emit-llvm option can be used with the -S or -c options to emit an LLVM
+ ``.ll`` or ``.bc`` file (respectively) for the code. This allows you to use
+ the `standard LLVM tools <CommandGuide/index.html>`_ on the bitcode file.
+
+#. Run the program in both forms. To run the program, use:
+
+ .. code:: bash
+
+ % ./hello
+
+ and
+
+ .. code:: bash
+
+ % lli hello.bc
+
+ The second examples shows how to invoke the LLVM JIT, `lli
+ <CommandGuide/html/lli.html>`_.
+
+#. Use the ``llvm-dis`` utility to take a look at the LLVM assembly code:
+
+ .. code:: bash
+
+ % llvm-dis < hello.bc | less
+
+#. Compile the program to native assembly using the LLC code generator:
+
+ .. code:: bash
+
+ % llc hello.bc -o hello.s
+
+#. Assemble the native assembly language file into a program:
+
+ .. code:: bash
+
+ **Solaris:** % /opt/SUNWspro/bin/cc -xarch=v9 hello.s -o hello.native
+
+ **Others:** % gcc hello.s -o hello.native
+
+#. Execute the native code program:
+
+ .. code:: bash
+
+ % ./hello.native
+
+ Note that using clang to compile directly to native code (i.e. when the
+ ``-emit-llvm`` option is not present) does steps 6/7/8 for you.
+
+Common Problems
+===============
+
+If you are having problems building or using LLVM, or if you have any other
+general questions about LLVM, please consult the `Frequently Asked
+Questions <FAQ.html>`_ page.
+
+.. _links:
+
+Links
+=====
+
+This document is just an **introduction** on how to use LLVM to do some simple
+things... there are many more interesting and complicated things that you can do
+that aren't documented here (but we'll gladly accept a patch if you want to
+write something up!). For more information about LLVM, check out:
+
+* `LLVM Homepage <http://llvm.org/>`_
+* `LLVM Doxygen Tree <http://llvm.org/doxygen/>`_
+* `Starting a Project that Uses LLVM <http://llvm.org/docs/Projects.html>`_
Removed: llvm/branches/R600/docs/GoldPlugin.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/GoldPlugin.html?rev=165747&view=auto
==============================================================================
--- llvm/branches/R600/docs/GoldPlugin.html (original)
+++ llvm/branches/R600/docs/GoldPlugin.html (removed)
@@ -1,227 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>LLVM gold plugin</title>
- <link rel="stylesheet" href="_static/llvm.css" type="text/css">
-</head>
-<body>
-
-<h1>LLVM gold plugin</h1>
-<ol>
- <li><a href="#introduction">Introduction</a></li>
- <li><a href="#build">How to build it</a></li>
- <li><a href="#usage">Usage</a>
- <ul>
- <li><a href="#example1">Example of link time optimization</a></li>
- <li><a href="#lto_autotools">Quickstart for using LTO with autotooled projects</a></li>
- </ul></li>
- <li><a href="#licensing">Licensing</a></li>
-</ol>
-<div class="doc_author">Written by Nick Lewycky</div>
-
-<!--=========================================================================-->
-<h2><a name="introduction">Introduction</a></h2>
-<!--=========================================================================-->
-<div>
- <p>Building with link time optimization requires cooperation from the
-system linker. LTO support on Linux systems requires that you use
-the <a href="http://sourceware.org/binutils">gold linker</a> which supports
-LTO via plugins. This is the same mechanism used by the
-<a href="http://gcc.gnu.org/wiki/LinkTimeOptimization">GCC LTO</a>
-project.</p>
- <p>The LLVM gold plugin implements the
-<a href="http://gcc.gnu.org/wiki/whopr/driver">gold plugin interface</a>
-on top of
-<a href="LinkTimeOptimization.html#lto">libLTO</a>.
-The same plugin can also be used by other tools such as <tt>ar</tt> and
-<tt>nm</tt>.
-</div>
-<!--=========================================================================-->
-<h2><a name="build">How to build it</a></h2>
-<!--=========================================================================-->
-<div>
- <p>You need to have gold with plugin support and build the LLVMgold
-plugin. Check whether you have gold running <tt>/usr/bin/ld -v</tt>. It will
-report “GNU gold” or else “GNU ld” if not. If you have
-gold, check for plugin support by running <tt>/usr/bin/ld -plugin</tt>. If it
-complains “missing argument” then you have plugin support. If not,
-such as an “unknown option” error then you will either need to
-build gold or install a version with plugin support.</p>
-<ul>
- <li>To build gold with plugin support:
- <pre class="doc_code">
-mkdir binutils
-cd binutils
-cvs -z 9 -d :pserver:anoncvs at sourceware.org:/cvs/src login
-<em>{enter "anoncvs" as the password}</em>
-cvs -z 9 -d :pserver:anoncvs at sourceware.org:/cvs/src co binutils
-mkdir build
-cd build
-../src/configure --enable-gold --enable-plugins
-make all-gold
-</pre>
- That should leave you with <tt>binutils/build/gold/ld-new</tt> which supports the <tt>-plugin</tt> option. It also built would have
-<tt>binutils/build/binutils/ar</tt> and <tt>nm-new</tt> which support plugins
-but don't have a visible -plugin option, instead relying on the gold plugin
-being present in <tt>../lib/bfd-plugins</tt> relative to where the binaries are
-placed.
- <li>Build the LLVMgold plugin: Configure LLVM with
- <tt>--with-binutils-include=/path/to/binutils/src/include</tt> and run
- <tt>make</tt>.
-</ul>
-</div>
-<!--=========================================================================-->
-<h2><a name="usage">Usage</a></h2>
-<!--=========================================================================-->
-<div>
-
- <p>The linker takes a <tt>-plugin</tt> option that points to the path of
- the plugin <tt>.so</tt> file. To find out what link command <tt>gcc</tt>
- would run in a given situation, run <tt>gcc -v <em>[...]</em></tt> and look
- for the line where it runs <tt>collect2</tt>. Replace that with
- <tt>ld-new -plugin /path/to/LLVMgold.so</tt> to test it out. Once you're
- ready to switch to using gold, backup your existing <tt>/usr/bin/ld</tt>
- then replace it with <tt>ld-new</tt>.</p>
-
- <p>You can produce bitcode files from <tt>clang</tt> using
- <tt>-emit-llvm</tt> or <tt>-flto</tt>, or the <tt>-O4</tt> flag which is
- synonymous with <tt>-O3 -flto</tt>.</p>
-
- <p>Any of these flags will also cause <tt>clang</tt> to look for the
- gold plugin in the <tt>lib</tt> directory under its prefix and pass the
- <tt>-plugin</tt> option to <tt>ld</tt>. It will not look for an alternate
- linker, which is why you need gold to be the installed system linker in
- your path.</p>
-
- <p>If you want <tt>ar</tt> and <tt>nm</tt> to work seamlessly as well, install
- <tt>LLVMgold.so</tt> to <tt>/usr/lib/bfd-plugins</tt>. If you built your
- own gold, be sure to install the <tt>ar</tt> and <tt>nm-new</tt> you built to
- <tt>/usr/bin</tt>.<p>
-
-<!-- ======================================================================= -->
-<h3>
- <a name="example1">Example of link time optimization</a>
-</h3>
-
-<div>
- <p>The following example shows a worked example of the gold plugin mixing
- LLVM bitcode and native code.
-<pre class="doc_code">
---- a.c ---
-#include <stdio.h>
-
-extern void foo1(void);
-extern void foo4(void);
-
-void foo2(void) {
- printf("Foo2\n");
-}
-
-void foo3(void) {
- foo4();
-}
-
-int main(void) {
- foo1();
-}
-
---- b.c ---
-#include <stdio.h>
-
-extern void foo2(void);
-
-void foo1(void) {
- foo2();
-}
-
-void foo4(void) {
- printf("Foo4");
-}
-
---- command lines ---
-$ clang -flto a.c -c -o a.o # <-- a.o is LLVM bitcode file
-$ ar q a.a a.o # <-- a.a is an archive with LLVM bitcode
-$ clang b.c -c -o b.o # <-- b.o is native object file
-$ clang -flto a.a b.o -o main # <-- link with LLVMgold plugin
-</pre>
-
- <p>Gold informs the plugin that foo3 is never referenced outside the IR,
- leading LLVM to delete that function. However, unlike in the
- <a href="LinkTimeOptimization.html#example1">libLTO
- example</a> gold does not currently eliminate foo4.</p>
-</div>
-
-</div>
-
-<!--=========================================================================-->
-<h2>
- <a name="lto_autotools">
- Quickstart for using LTO with autotooled projects
- </a>
-</h2>
-<!--=========================================================================-->
-<div>
- <p>Once your system <tt>ld</tt>, <tt>ar</tt>, and <tt>nm</tt> all support LLVM
- bitcode, everything is in place for an easy to use LTO build of autotooled
- projects:</p>
-
- <ul>
- <li>Follow the instructions <a href="#build">on how to build LLVMgold.so</a>.</li>
- <li>Install the newly built binutils to <tt>$PREFIX</tt></li>
- <li>Copy <tt>Release/lib/LLVMgold.so</tt> to
- <tt>$PREFIX/lib/bfd-plugins/</tt></li>
- <li>Set environment variables (<tt>$PREFIX</tt> is where you installed clang and
- binutils):
-<pre class="doc_code">
-export CC="$PREFIX/bin/clang -flto"
-export CXX="$PREFIX/bin/clang++ -flto"
-export AR="$PREFIX/bin/ar"
-export NM="$PREFIX/bin/nm"
-export RANLIB=/bin/true #ranlib is not needed, and doesn't support .bc files in .a
-export CFLAGS="-O4"
-</pre>
- </li>
- <li>Or you can just set your path:
-<pre class="doc_code">
-export PATH="$PREFIX/bin:$PATH"
-export CC="clang -flto"
-export CXX="clang++ -flto"
-export RANLIB=/bin/true
-export CFLAGS="-O4"
-</pre></li>
- <li>Configure & build the project as usual:
-<pre class="doc_code">
-% ./configure && make && make check
-</pre></li>
- </ul>
-
- <p>The environment variable settings may work for non-autotooled projects
- too, but you may need to set the <tt>LD</tt> environment variable as
- well.</p>
-</div>
-
-<!--=========================================================================-->
-<h2><a name="licensing">Licensing</a></h2>
-<!--=========================================================================-->
-<div>
- <p>Gold is licensed under the GPLv3. LLVMgold uses the interface file
-<tt>plugin-api.h</tt> from gold which means that the resulting LLVMgold.so
-binary is also GPLv3. This can still be used to link non-GPLv3 programs just
-as much as gold could without the plugin.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
- <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
- src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
- <a href="http://validator.w3.org/check/referer"><img
- src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
- <a href="mailto:nicholas at metrix.on.ca">Nick Lewycky</a><br>
- <a href="http://llvm.org/">The LLVM Compiler Infrastructure</a><br>
- Last modified: $Date: 2010-04-16 23:58:21 -0800 (Fri, 16 Apr 2010) $
-</address>
-</body>
-</html>
Added: llvm/branches/R600/docs/GoldPlugin.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/GoldPlugin.rst?rev=165748&view=auto
==============================================================================
--- llvm/branches/R600/docs/GoldPlugin.rst (added)
+++ llvm/branches/R600/docs/GoldPlugin.rst Thu Oct 11 16:28:00 2012
@@ -0,0 +1,186 @@
+.. _gold-plugin:
+
+====================
+The LLVM gold plugin
+====================
+
+.. sectionauthor:: Nick Lewycky
+
+Introduction
+============
+
+Building with link time optimization requires cooperation from
+the system linker. LTO support on Linux systems requires that you use the
+`gold linker`_ which supports LTO via plugins. This is the same mechanism
+used by the `GCC LTO`_ project.
+
+The LLVM gold plugin implements the gold plugin interface on top of
+:ref:`libLTO`. The same plugin can also be used by other tools such as
+``ar`` and ``nm``.
+
+.. _`gold linker`: http://sourceware.org/binutils
+.. _`GCC LTO`: http://gcc.gnu.org/wiki/LinkTimeOptimization
+.. _`gold plugin interface`: http://gcc.gnu.org/wiki/whopr/driver
+
+.. _lto-how-to-build:
+
+How to build it
+===============
+
+You need to have gold with plugin support and build the LLVMgold plugin.
+Check whether you have gold running ``/usr/bin/ld -v``. It will report "GNU
+gold" or else "GNU ld" if not. If you have gold, check for plugin support
+by running ``/usr/bin/ld -plugin``. If it complains "missing argument" then
+you have plugin support. If not, such as an "unknown option" error then you
+will either need to build gold or install a version with plugin support.
+
+* To build gold with plugin support:
+
+ .. code-block:: bash
+
+ $ mkdir binutils
+ $ cd binutils
+ $ cvs -z 9 -d :pserver:anoncvs at sourceware.org:/cvs/src login
+ {enter "anoncvs" as the password}
+ $ cvs -z 9 -d :pserver:anoncvs at sourceware.org:/cvs/src co binutils
+ $ mkdir build
+ $ cd build
+ $ ../src/configure --enable-gold --enable-plugins
+ $ make all-gold
+
+ That should leave you with ``binutils/build/gold/ld-new`` which supports
+ the ``-plugin`` option. It also built would have
+ ``binutils/build/binutils/ar`` and ``nm-new`` which support plugins but
+ don't have a visible -plugin option, instead relying on the gold plugin
+ being present in ``../lib/bfd-plugins`` relative to where the binaries
+ are placed.
+
+* Build the LLVMgold plugin: Configure LLVM with
+ ``--with-binutils-include=/path/to/binutils/src/include`` and run
+ ``make``.
+
+Usage
+=====
+
+The linker takes a ``-plugin`` option that points to the path of
+the plugin ``.so`` file. To find out what link command ``gcc``
+would run in a given situation, run ``gcc -v [...]`` and
+look for the line where it runs ``collect2``. Replace that with
+``ld-new -plugin /path/to/LLVMgold.so`` to test it out. Once you're
+ready to switch to using gold, backup your existing ``/usr/bin/ld``
+then replace it with ``ld-new``.
+
+You can produce bitcode files from ``clang`` using ``-emit-llvm`` or
+``-flto``, or the ``-O4`` flag which is synonymous with ``-O3 -flto``.
+
+Any of these flags will also cause ``clang`` to look for the gold plugin in
+the ``lib`` directory under its prefix and pass the ``-plugin`` option to
+``ld``. It will not look for an alternate linker, which is why you need
+gold to be the installed system linker in your path.
+
+If you want ``ar`` and ``nm`` to work seamlessly as well, install
+``LLVMgold.so`` to ``/usr/lib/bfd-plugins``. If you built your own gold, be
+sure to install the ``ar`` and ``nm-new`` you built to ``/usr/bin``.
+
+
+Example of link time optimization
+---------------------------------
+
+The following example shows a worked example of the gold plugin mixing LLVM
+bitcode and native code.
+
+.. code-block:: c
+
+ --- a.c ---
+ #include <stdio.h>
+
+ extern void foo1(void);
+ extern void foo4(void);
+
+ void foo2(void) {
+ printf("Foo2\n");
+ }
+
+ void foo3(void) {
+ foo4();
+ }
+
+ int main(void) {
+ foo1();
+ }
+
+ --- b.c ---
+ #include <stdio.h>
+
+ extern void foo2(void);
+
+ void foo1(void) {
+ foo2();
+ }
+
+ void foo4(void) {
+ printf("Foo4");
+ }
+
+.. code-block:: bash
+
+ --- command lines ---
+ $ clang -flto a.c -c -o a.o # <-- a.o is LLVM bitcode file
+ $ ar q a.a a.o # <-- a.a is an archive with LLVM bitcode
+ $ clang b.c -c -o b.o # <-- b.o is native object file
+ $ clang -flto a.a b.o -o main # <-- link with LLVMgold plugin
+
+Gold informs the plugin that foo3 is never referenced outside the IR,
+leading LLVM to delete that function. However, unlike in the :ref:`libLTO
+example <libLTO-example>` gold does not currently eliminate foo4.
+
+Quickstart for using LTO with autotooled projects
+=================================================
+
+Once your system ``ld``, ``ar``, and ``nm`` all support LLVM bitcode,
+everything is in place for an easy to use LTO build of autotooled projects:
+
+* Follow the instructions :ref:`on how to build LLVMgold.so
+ <lto-how-to-build>`.
+
+* Install the newly built binutils to ``$PREFIX``
+
+* Copy ``Release/lib/LLVMgold.so`` to ``$PREFIX/lib/bfd-plugins/``
+
+* Set environment variables (``$PREFIX`` is where you installed clang and
+ binutils):
+
+ .. code-block:: bash
+
+ export CC="$PREFIX/bin/clang -flto"
+ export CXX="$PREFIX/bin/clang++ -flto"
+ export AR="$PREFIX/bin/ar"
+ export NM="$PREFIX/bin/nm"
+ export RANLIB=/bin/true #ranlib is not needed, and doesn't support .bc files in .a
+ export CFLAGS="-O4"
+
+* Or you can just set your path:
+
+ .. code-block:: bash
+
+ export PATH="$PREFIX/bin:$PATH"
+ export CC="clang -flto"
+ export CXX="clang++ -flto"
+ export RANLIB=/bin/true
+ export CFLAGS="-O4"
+* Configure and build the project as usual:
+
+ .. code-block:: bash
+
+ % ./configure && make && make check
+
+The environment variable settings may work for non-autotooled projects too,
+but you may need to set the ``LD`` environment variable as well.
+
+Licensing
+=========
+
+Gold is licensed under the GPLv3. LLVMgold uses the interface file
+``plugin-api.h`` from gold which means that the resulting ``LLVMgold.so``
+binary is also GPLv3. This can still be used to link non-GPLv3 programs
+just as much as gold could without the plugin.
Added: llvm/branches/R600/docs/HowToSetUpLLVMStyleRTTI.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/HowToSetUpLLVMStyleRTTI.rst?rev=165748&view=auto
==============================================================================
--- llvm/branches/R600/docs/HowToSetUpLLVMStyleRTTI.rst (added)
+++ llvm/branches/R600/docs/HowToSetUpLLVMStyleRTTI.rst Thu Oct 11 16:28:00 2012
@@ -0,0 +1,281 @@
+.. _how-to-set-up-llvm-style-rtti:
+
+======================================================
+How to set up LLVM-style RTTI for your class hierarchy
+======================================================
+
+.. sectionauthor:: Sean Silva <silvas at purdue.edu>
+
+.. contents::
+
+Background
+==========
+
+LLVM avoids using C++'s built in RTTI. Instead, it pervasively uses its
+own hand-rolled form of RTTI which is much more efficient and flexible,
+although it requires a bit more work from you as a class author.
+
+A description of how to use LLVM-style RTTI from a client's perspective is
+given in the `Programmer's Manual <ProgrammersManual.html#isa>`_. This
+document, in contrast, discusses the steps you need to take as a class
+hierarchy author to make LLVM-style RTTI available to your clients.
+
+Before diving in, make sure that you are familiar with the Object Oriented
+Programming concept of "`is-a`_".
+
+.. _is-a: http://en.wikipedia.org/wiki/Is-a
+
+Basic Setup
+===========
+
+This section describes how to set up the most basic form of LLVM-style RTTI
+(which is sufficient for 99.9% of the cases). We will set up LLVM-style
+RTTI for this class hierarchy:
+
+.. code-block:: c++
+
+ class Shape {
+ public:
+ Shape() {}
+ virtual double computeArea() = 0;
+ };
+
+ class Square : public Shape {
+ double SideLength;
+ public:
+ Square(double S) : SideLength(S) {}
+ double computeArea() /* override */;
+ };
+
+ class Circle : public Shape {
+ double Radius;
+ public:
+ Circle(double R) : Radius(R) {}
+ double computeArea() /* override */;
+ };
+
+The most basic working setup for LLVM-style RTTI requires the following
+steps:
+
+#. In the header where you declare ``Shape``, you will want to ``#include
+ "llvm/Support/Casting.h"``, which declares LLVM's RTTI templates. That
+ way your clients don't even have to think about it.
+
+ .. code-block:: c++
+
+ #include "llvm/Support/Casting.h"
+
+
+#. In the base class, introduce an enum which discriminates all of the
+ different classes in the hierarchy, and stash the enum value somewhere in
+ the base class.
+
+ Here is the code after introducing this change:
+
+ .. code-block:: c++
+
+ class Shape {
+ public:
+ + /// Discriminator for LLVM-style RTTI (dyn_cast<> et al.)
+ + enum ShapeKind {
+ + SquareKind,
+ + CircleKind
+ + };
+ +private:
+ + const ShapeKind Kind;
+ +public:
+ + ShapeKind getKind() const { return Kind; }
+ +
+ Shape() {}
+ virtual double computeArea() = 0;
+ };
+
+ You will usually want to keep the ``Kind`` member encapsulated and
+ private, but let the enum ``ShapeKind`` be public along with providing a
+ ``getKind()`` method. This is convenient for clients so that they can do
+ a ``switch`` over the enum.
+
+ A common naming convention is that these enums are "kind"s, to avoid
+ ambiguity with the words "type" or "class" which have overloaded meanings
+ in many contexts within LLVM. Sometimes there will be a natural name for
+ it, like "opcode". Don't bikeshed over this; when in doubt use ``Kind``.
+
+ You might wonder why the ``Kind`` enum doesn't have an entry for
+ ``Shape``. The reason for this is that since ``Shape`` is abstract
+ (``computeArea() = 0;``), you will never actually have non-derived
+ instances of exactly that class (only subclasses). See `Concrete Bases
+ and Deeper Hierarchies`_ for information on how to deal with
+ non-abstract bases. It's worth mentioning here that unlike
+ ``dynamic_cast<>``, LLVM-style RTTI can be used (and is often used) for
+ classes that don't have v-tables.
+
+#. Next, you need to make sure that the ``Kind`` gets initialized to the
+ value corresponding to the dynamic type of the class. Typically, you will
+ want to have it be an argument to the constructor of the base class, and
+ then pass in the respective ``XXXKind`` from subclass constructors.
+
+ Here is the code after that change:
+
+ .. code-block:: c++
+
+ class Shape {
+ public:
+ /// Discriminator for LLVM-style RTTI (dyn_cast<> et al.)
+ enum ShapeKind {
+ SquareKind,
+ CircleKind
+ };
+ private:
+ const ShapeKind Kind;
+ public:
+ ShapeKind getKind() const { return Kind; }
+
+ - Shape() {}
+ + Shape(ShapeKind K) : Kind(K) {}
+ virtual double computeArea() = 0;
+ };
+
+ class Square : public Shape {
+ double SideLength;
+ public:
+ - Square(double S) : SideLength(S) {}
+ + Square(double S) : Shape(SquareKind), SideLength(S) {}
+ double computeArea() /* override */;
+ };
+
+ class Circle : public Shape {
+ double Radius;
+ public:
+ - Circle(double R) : Radius(R) {}
+ + Circle(double R) : Shape(CircleKind), Radius(R) {}
+ double computeArea() /* override */;
+ };
+
+#. Finally, you need to inform LLVM's RTTI templates how to dynamically
+ determine the type of a class (i.e. whether the ``isa<>``/``dyn_cast<>``
+ should succeed). The default "99.9% of use cases" way to accomplish this
+ is through a small static member function ``classof``. In order to have
+ proper context for an explanation, we will display this code first, and
+ then below describe each part:
+
+ .. code-block:: c++
+
+ class Shape {
+ public:
+ /// Discriminator for LLVM-style RTTI (dyn_cast<> et al.)
+ enum ShapeKind {
+ SquareKind,
+ CircleKind
+ };
+ private:
+ const ShapeKind Kind;
+ public:
+ ShapeKind getKind() const { return Kind; }
+
+ Shape(ShapeKind K) : Kind(K) {}
+ virtual double computeArea() = 0;
+ +
+ + static bool classof(const Shape *) { return true; }
+ };
+
+ class Square : public Shape {
+ double SideLength;
+ public:
+ Square(double S) : Shape(SquareKind), SideLength(S) {}
+ double computeArea() /* override */;
+ +
+ + static bool classof(const Square *) { return true; }
+ + static bool classof(const Shape *S) {
+ + return S->getKind() == SquareKind;
+ + }
+ };
+
+ class Circle : public Shape {
+ double Radius;
+ public:
+ Circle(double R) : Shape(CircleKind), Radius(R) {}
+ double computeArea() /* override */;
+ +
+ + static bool classof(const Circle *) { return true; }
+ + static bool classof(const Shape *S) {
+ + return S->getKind() == CircleKind;
+ + }
+ };
+
+ Basically, the job of ``classof`` is to return ``true`` if its argument
+ is of the enclosing class's type. As you can see, there are two general
+ overloads of ``classof`` in use here.
+
+ #. The first, which just returns ``true``, means that if we know that the
+ argument of the cast is of the enclosing type *at compile time*, then
+ we don't need to bother to check anything since we already know that
+ the type is convertible. This is an optimization for the case that we
+ statically know the conversion is OK.
+
+ #. The other overload takes a pointer to an object of the base of the
+ class hierarchy: this is the "general case" of the cast. We need to
+ check the ``Kind`` to dynamically decide if the argument is of (or
+ derived from) the enclosing type.
+
+ To be more precise, let ``classof`` be inside a class ``C``. Then the
+ contract for ``classof`` is "return ``true`` if the argument is-a
+ ``C``". As long as your implementation fulfills this contract, you can
+ tweak and optimize it as much as you want.
+
+Although for this small example setting up LLVM-style RTTI seems like a lot
+of "boilerplate", if your classes are doing anything interesting then this
+will end up being a tiny fraction of the code.
+
+Concrete Bases and Deeper Hierarchies
+=====================================
+
+For concrete bases (i.e. non-abstract interior nodes of the inheritance
+tree), the ``Kind`` check inside ``classof`` needs to be a bit more
+complicated. Say that ``SpecialSquare`` and ``OtherSpecialSquare`` derive
+from ``Square``, and so ``ShapeKind`` becomes:
+
+.. code-block:: c++
+
+ enum ShapeKind {
+ SquareKind,
+ + SpecialSquareKind,
+ + OtherSpecialSquareKind,
+ CircleKind
+ }
+
+Then in ``Square``, we would need to modify the ``classof`` like so:
+
+.. code-block:: c++
+
+ static bool classof(const Square *) { return true; }
+ - static bool classof(const Shape *S) {
+ - return S->getKind() == SquareKind;
+ - }
+ + static bool classof(const Shape *S) {
+ + return S->getKind() >= SquareKind &&
+ + S->getKind() <= OtherSpecialSquareKind;
+ + }
+
+The reason that we need to test a range like this instead of just equality
+is that both ``SpecialSquare`` and ``OtherSpecialSquare`` "is-a"
+``Square``, and so ``classof`` needs to return ``true`` for them.
+
+This approach can be made to scale to arbitrarily deep hierarchies. The
+trick is that you arrange the enum values so that they correspond to a
+preorder traversal of the class hierarchy tree. With that arrangement, all
+subclass tests can be done with two comparisons as shown above. If you just
+list the class hierarchy like a list of bullet points, you'll get the
+ordering right::
+
+ | Shape
+ | Square
+ | SpecialSquare
+ | OtherSpecialSquare
+ | Circle
+
+.. TODO::
+
+ Touch on some of the more advanced features, like ``isa_impl`` and
+ ``simplify_type``. However, those two need reference documentation in
+ the form of doxygen comments as well. We need the doxygen so that we can
+ say "for full details, see http://llvm.org/doxygen/..."
Modified: llvm/branches/R600/docs/LangRef.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/LangRef.html?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/LangRef.html (original)
+++ llvm/branches/R600/docs/LangRef.html Thu Oct 11 16:28:00 2012
@@ -1107,9 +1107,9 @@
<dd>This indicates that the pointer parameter specifies the address of a
structure that is the return value of the function in the source program.
This pointer must be guaranteed by the caller to be valid: loads and
- stores to the structure may be assumed by the callee to not to trap. This
- may only be applied to the first parameter. This is not a valid attribute
- for return values. </dd>
+ stores to the structure may be assumed by the callee to not to trap and
+ to be properly aligned. This may only be applied to the first parameter.
+ This is not a valid attribute for return values. </dd>
<dt><tt><b><a name="noalias">noalias</a></b></tt></dt>
<dd>This indicates that pointer values
@@ -2104,7 +2104,7 @@
<p>Structures may optionally be "packed" structures, which indicate that the
alignment of the struct is one byte, and that there is no padding between
the elements. In non-packed structs, padding between field types is inserted
- as defined by the TargetData string in the module, which is required to match
+ as defined by the DataLayout string in the module, which is required to match
what the underlying code generator expects.</p>
<p>Structures can either be "literal" or "identified". A literal structure is
Modified: llvm/branches/R600/docs/LinkTimeOptimization.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/LinkTimeOptimization.rst?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/LinkTimeOptimization.rst (original)
+++ llvm/branches/R600/docs/LinkTimeOptimization.rst Thu Oct 11 16:28:00 2012
@@ -29,6 +29,8 @@
helps to do optimizations that are not possible in other models. The linker
input allows the optimizer to avoid relying on conservative escape analysis.
+.. _libLTO-example:
+
Example of link time optimization
---------------------------------
Modified: llvm/branches/R600/docs/ProgrammersManual.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/ProgrammersManual.html?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/ProgrammersManual.html (original)
+++ llvm/branches/R600/docs/ProgrammersManual.html Thu Oct 11 16:28:00 2012
@@ -98,6 +98,7 @@
<li><a href="#dss_valuemap">"llvm/ADT/ValueMap.h"</a></li>
<li><a href="#dss_intervalmap">"llvm/ADT/IntervalMap.h"</a></li>
<li><a href="#dss_map"><map></a></li>
+ <li><a href="#dss_mapvector">"llvm/ADT/MapVector.h"</a></li>
<li><a href="#dss_inteqclasses">"llvm/ADT/IntEqClasses.h"</a></li>
<li><a href="#dss_immutablemap">"llvm/ADT/ImmutableMap.h"</a></li>
<li><a href="#dss_othermap">Other Map-Like Container Options</a></li>
@@ -432,10 +433,10 @@
</dl>
<p>These five templates can be used with any classes, whether they have a
-v-table or not. To add support for these templates, you simply need to add
-<tt>classof</tt> static methods to the class you are interested casting
-to. Describing this is currently outside the scope of this document, but there
-are lots of examples in the LLVM source base.</p>
+v-table or not. If you want to add support for these templates, see the
+document <a href="HowToSetUpLLVMStyleRTTI.html">How to set up LLVM-style
+RTTI for your class hierarchy </a>.
+</p>
</div>
@@ -1848,6 +1849,24 @@
</div>
+
+<!-- _______________________________________________________________________ -->
+<h4>
+ <a name="dss_mapvector">"llvm/ADT/MapVector.h"</a>
+</h4>
+<div>
+
+<p> MapVector<KeyT,ValueT> provides a subset of the DenseMap interface.
+ The main difference is that the iteration order is guaranteed to be
+ the insertion order, making it an easy (but somewhat expensive) solution
+ for non-deterministic iteration over maps of pointers. </p>
+
+<p> It is implemented by mapping from key to an index in a vector of key,value
+ pairs. This provides fast lookup and iteration, but has two main drawbacks:
+ The key is stored twice and it doesn't support removing elements. </p>
+
+</div>
+
<!-- _______________________________________________________________________ -->
<h4>
<a name="dss_inteqclasses">"llvm/ADT/IntEqClasses.h"</a>
Modified: llvm/branches/R600/docs/SourceLevelDebugging.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/SourceLevelDebugging.html?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/SourceLevelDebugging.html (original)
+++ llvm/branches/R600/docs/SourceLevelDebugging.html Thu Oct 11 16:28:00 2012
@@ -2367,11 +2367,11 @@
| HEADER.header_data_len | uint32_t
| HEADER_DATA | HeaderData
|-------------------------|
-| BUCKETS | uint32_t[n_buckets] // 32 bit hash indexes
+| BUCKETS | uint32_t[bucket_count] // 32 bit hash indexes
|-------------------------|
-| HASHES | uint32_t[n_buckets] // 32 bit hash values
+| HASHES | uint32_t[hashes_count] // 32 bit hash values
|-------------------------|
-| OFFSETS | uint32_t[n_buckets] // 32 bit offsets to hash value data
+| OFFSETS | uint32_t[hashes_count] // 32 bit offsets to hash value data
|-------------------------|
| ALL HASH DATA |
`-------------------------'
Modified: llvm/branches/R600/docs/WritingAnLLVMBackend.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/WritingAnLLVMBackend.html?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/WritingAnLLVMBackend.html (original)
+++ llvm/branches/R600/docs/WritingAnLLVMBackend.html Thu Oct 11 16:28:00 2012
@@ -314,14 +314,14 @@
intended to obtain the instruction set (<tt>getInstrInfo</tt>), register set
(<tt>getRegisterInfo</tt>), stack frame layout (<tt>getFrameInfo</tt>), and
similar information. <tt>XXXTargetMachine</tt> must also implement the
-<tt>getTargetData</tt> method to access an object with target-specific data
+<tt>getDataLayout</tt> method to access an object with target-specific data
characteristics, such as data type size and alignment requirements.
</p>
<p>
For instance, for the SPARC target, the header file
<tt>SparcTargetMachine.h</tt> declares prototypes for several <tt>get*Info</tt>
-and <tt>getTargetData</tt> methods that simply return a class member.
+and <tt>getDataLayout</tt> methods that simply return a class member.
</p>
<div class="doc_code">
@@ -331,7 +331,7 @@
class Module;
class SparcTargetMachine : public LLVMTargetMachine {
- const TargetData DataLayout; // Calculates type size & alignment
+ const DataLayout DataLayout; // Calculates type size & alignment
SparcSubtarget Subtarget;
SparcInstrInfo InstrInfo;
TargetFrameInfo FrameInfo;
@@ -348,7 +348,7 @@
virtual const TargetRegisterInfo *getRegisterInfo() const {
return &InstrInfo.getRegisterInfo();
}
- virtual const TargetData *getTargetData() const { return &DataLayout; }
+ virtual const DataLayout *getDataLayout() const { return &DataLayout; }
static unsigned getModuleMatchQuality(const Module &M);
// Pass Pipeline Configuration
@@ -364,7 +364,7 @@
<li><tt>getInstrInfo()</tt></li>
<li><tt>getRegisterInfo()</tt></li>
<li><tt>getFrameInfo()</tt></li>
-<li><tt>getTargetData()</tt></li>
+<li><tt>getDataLayout()</tt></li>
<li><tt>getSubtargetImpl()</tt></li>
</ul>
Modified: llvm/branches/R600/docs/index.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/index.rst?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/index.rst (original)
+++ llvm/branches/R600/docs/index.rst Thu Oct 11 16:28:00 2012
@@ -26,7 +26,7 @@
* **User Guides**
- Those new to the LLVM system should first vist the :ref:`userguides`.
+ Those new to the LLVM system should first visit the :ref:`userguides`.
NOTE: If you are a user who is only interested in using LLVM-based
compilers, you should look into `Clang <http://clang.llvm.org>`_ or
Modified: llvm/branches/R600/docs/programming.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/programming.rst?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/programming.rst (original)
+++ llvm/branches/R600/docs/programming.rst Thu Oct 11 16:28:00 2012
@@ -6,9 +6,12 @@
.. toctree::
:hidden:
+ Atomics
CodingStandards
CommandLine
- Atomics
+ CompilerWriterInfo
+ ExtendingLLVM
+ HowToSetUpLLVMStyleRTTI
* `LLVM Language Reference Manual <LangRef.html>`_
@@ -33,7 +36,12 @@
Details the LLVM coding standards and provides useful information on writing
efficient C++ code.
-* `Extending LLVM <ExtendingLLVM.html>`_
+* :doc:`HowToSetUpLLVMStyleRTTI`
+
+ How to make ``isa<>``, ``dyn_cast<>``, etc. available for clients of your
+ class hierarchy.
+
+* :ref:`extending_llvm`
Look here to see how to add instructions and intrinsics to LLVM.
@@ -43,3 +51,7 @@
(`tarball <http://llvm.org/doxygen/doxygen.tar.gz>`_)
* `ViewVC Repository Browser <http://llvm.org/viewvc/>`_
+
+* :ref:`compiler_writer_info`
+
+ A list of helpful links for compiler writers.
Modified: llvm/branches/R600/docs/subsystems.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/subsystems.rst?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/subsystems.rst (original)
+++ llvm/branches/R600/docs/subsystems.rst Thu Oct 11 16:28:00 2012
@@ -16,6 +16,7 @@
SegmentedStacks
TableGenFundamentals
DebuggingJITedCode
+ GoldPlugin
* `Writing an LLVM Pass <WritingAnLLVMPass.html>`_
@@ -75,7 +76,7 @@
This document describes the interface between LLVM intermodular optimizer
and the linker and its design
-* `The LLVM gold plugin <GoldPlugin.html>`_
+* :ref:`gold-plugin`
How to build your programs with link-time optimization on Linux.
Modified: llvm/branches/R600/docs/tutorial/LangImpl4.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/tutorial/LangImpl4.html?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/tutorial/LangImpl4.html (original)
+++ llvm/branches/R600/docs/tutorial/LangImpl4.html Thu Oct 11 16:28:00 2012
@@ -173,7 +173,7 @@
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
- OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
+ OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
// Provide basic AliasAnalysis support for GVN.
OurFPM.add(createBasicAliasAnalysisPass());
// Do simple "peephole" optimizations and bit-twiddling optzns.
@@ -523,7 +523,7 @@
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Analysis/Passes.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/TargetSelect.h"
#include <cstdio>
@@ -1103,7 +1103,7 @@
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
- OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
+ OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
// Provide basic AliasAnalysis support for GVN.
OurFPM.add(createBasicAliasAnalysisPass());
// Do simple "peephole" optimizations and bit-twiddling optzns.
Modified: llvm/branches/R600/docs/tutorial/LangImpl5.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/tutorial/LangImpl5.html?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/tutorial/LangImpl5.html (original)
+++ llvm/branches/R600/docs/tutorial/LangImpl5.html Thu Oct 11 16:28:00 2012
@@ -901,7 +901,7 @@
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Analysis/Passes.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/TargetSelect.h"
#include <cstdio>
@@ -1723,7 +1723,7 @@
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
- OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
+ OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
// Provide basic AliasAnalysis support for GVN.
OurFPM.add(createBasicAliasAnalysisPass());
// Do simple "peephole" optimizations and bit-twiddling optzns.
Modified: llvm/branches/R600/docs/tutorial/LangImpl6.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/tutorial/LangImpl6.html?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/tutorial/LangImpl6.html (original)
+++ llvm/branches/R600/docs/tutorial/LangImpl6.html Thu Oct 11 16:28:00 2012
@@ -840,7 +840,7 @@
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Analysis/Passes.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/TargetSelect.h"
#include <cstdio>
@@ -1780,7 +1780,7 @@
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
- OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
+ OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
// Provide basic AliasAnalysis support for GVN.
OurFPM.add(createBasicAliasAnalysisPass());
// Do simple "peephole" optimizations and bit-twiddling optzns.
Modified: llvm/branches/R600/docs/tutorial/LangImpl7.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/tutorial/LangImpl7.html?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/tutorial/LangImpl7.html (original)
+++ llvm/branches/R600/docs/tutorial/LangImpl7.html Thu Oct 11 16:28:00 2012
@@ -524,7 +524,7 @@
<pre>
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
- OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
+ OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
<b>// Promote allocas to registers.
OurFPM.add(createPromoteMemoryToRegisterPass());</b>
// Do simple "peephole" optimizations and bit-twiddling optzns.
@@ -1008,7 +1008,7 @@
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Analysis/Passes.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/TargetSelect.h"
#include <cstdio>
@@ -2113,7 +2113,7 @@
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
- OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
+ OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
// Provide basic AliasAnalysis support for GVN.
OurFPM.add(createBasicAliasAnalysisPass());
// Promote allocas to registers.
Modified: llvm/branches/R600/docs/tutorial/OCamlLangImpl4.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/tutorial/OCamlLangImpl4.html?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/tutorial/OCamlLangImpl4.html (original)
+++ llvm/branches/R600/docs/tutorial/OCamlLangImpl4.html Thu Oct 11 16:28:00 2012
@@ -189,7 +189,7 @@
(* Set up the optimizer pipeline. Start with registering info about how the
* target lays out data structures. *)
- TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
+ DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
add_instruction_combining the_fpm;
@@ -965,7 +965,7 @@
(* Set up the optimizer pipeline. Start with registering info about how the
* target lays out data structures. *)
- TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
+ DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
add_instruction_combination the_fpm;
Modified: llvm/branches/R600/docs/tutorial/OCamlLangImpl5.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/tutorial/OCamlLangImpl5.html?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/tutorial/OCamlLangImpl5.html (original)
+++ llvm/branches/R600/docs/tutorial/OCamlLangImpl5.html Thu Oct 11 16:28:00 2012
@@ -1498,7 +1498,7 @@
(* Set up the optimizer pipeline. Start with registering info about how the
* target lays out data structures. *)
- TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
+ DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
add_instruction_combination the_fpm;
Modified: llvm/branches/R600/docs/tutorial/OCamlLangImpl6.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/tutorial/OCamlLangImpl6.html?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/tutorial/OCamlLangImpl6.html (original)
+++ llvm/branches/R600/docs/tutorial/OCamlLangImpl6.html Thu Oct 11 16:28:00 2012
@@ -1506,7 +1506,7 @@
(* Set up the optimizer pipeline. Start with registering info about how the
* target lays out data structures. *)
- TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
+ DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
add_instruction_combination the_fpm;
Modified: llvm/branches/R600/docs/tutorial/OCamlLangImpl7.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/tutorial/OCamlLangImpl7.html?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/tutorial/OCamlLangImpl7.html (original)
+++ llvm/branches/R600/docs/tutorial/OCamlLangImpl7.html Thu Oct 11 16:28:00 2012
@@ -545,7 +545,7 @@
(* Set up the optimizer pipeline. Start with registering info about how the
* target lays out data structures. *)
- TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
+ DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
<b>(* Promote allocas to registers. *)
add_memory_to_register_promotion the_fpm;</b>
@@ -1834,7 +1834,7 @@
(* Set up the optimizer pipeline. Start with registering info about how the
* target lays out data structures. *)
- TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
+ DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
(* Promote allocas to registers. *)
add_memory_to_register_promotion the_fpm;
Modified: llvm/branches/R600/docs/userguides.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/docs/userguides.rst?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/docs/userguides.rst (original)
+++ llvm/branches/R600/docs/userguides.rst Thu Oct 11 16:28:00 2012
@@ -10,6 +10,7 @@
HowToBuildOnARM
CommandGuide/index
DeveloperPolicy
+ GettingStarted
GettingStartedVS
FAQ
Lexicon
@@ -18,7 +19,7 @@
yaml2obj
HowToSubmitABug
-* `The LLVM Getting Started Guide <GettingStarted.html>`_
+* :ref:`getting_started`
Discusses how to get up and running quickly with the LLVM infrastructure.
Everything from unpacking and compilation of the distribution to execution
Modified: llvm/branches/R600/examples/ExceptionDemo/ExceptionDemo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/examples/ExceptionDemo/ExceptionDemo.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/examples/ExceptionDemo/ExceptionDemo.cpp (original)
+++ llvm/branches/R600/examples/ExceptionDemo/ExceptionDemo.cpp Thu Oct 11 16:28:00 2012
@@ -57,7 +57,7 @@
#include "llvm/PassManager.h"
#include "llvm/Intrinsics.h"
#include "llvm/Analysis/Verifier.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/Dwarf.h"
@@ -1945,7 +1945,7 @@
// Set up the optimizer pipeline.
// Start with registering info about how the
// target lays out data structures.
- fpm.add(new llvm::TargetData(*executionEngine->getTargetData()));
+ fpm.add(new llvm::DataLayout(*executionEngine->getDataLayout()));
// Optimizations turned on
#ifdef ADD_OPT_PASSES
Modified: llvm/branches/R600/examples/Kaleidoscope/Chapter4/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/examples/Kaleidoscope/Chapter4/toy.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/examples/Kaleidoscope/Chapter4/toy.cpp (original)
+++ llvm/branches/R600/examples/Kaleidoscope/Chapter4/toy.cpp Thu Oct 11 16:28:00 2012
@@ -7,7 +7,7 @@
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Analysis/Passes.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/TargetSelect.h"
#include <cstdio>
@@ -584,7 +584,7 @@
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
- OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
+ OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
// Provide basic AliasAnalysis support for GVN.
OurFPM.add(createBasicAliasAnalysisPass());
// Do simple "peephole" optimizations and bit-twiddling optzns.
Modified: llvm/branches/R600/examples/Kaleidoscope/Chapter5/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/examples/Kaleidoscope/Chapter5/toy.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/examples/Kaleidoscope/Chapter5/toy.cpp (original)
+++ llvm/branches/R600/examples/Kaleidoscope/Chapter5/toy.cpp Thu Oct 11 16:28:00 2012
@@ -7,7 +7,7 @@
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Analysis/Passes.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/TargetSelect.h"
#include <cstdio>
@@ -829,7 +829,7 @@
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
- OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
+ OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
// Provide basic AliasAnalysis support for GVN.
OurFPM.add(createBasicAliasAnalysisPass());
// Do simple "peephole" optimizations and bit-twiddling optzns.
Modified: llvm/branches/R600/examples/Kaleidoscope/Chapter6/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/examples/Kaleidoscope/Chapter6/toy.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/examples/Kaleidoscope/Chapter6/toy.cpp (original)
+++ llvm/branches/R600/examples/Kaleidoscope/Chapter6/toy.cpp Thu Oct 11 16:28:00 2012
@@ -7,7 +7,7 @@
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Analysis/Passes.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/TargetSelect.h"
#include <cstdio>
@@ -947,7 +947,7 @@
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
- OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
+ OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
// Provide basic AliasAnalysis support for GVN.
OurFPM.add(createBasicAliasAnalysisPass());
// Do simple "peephole" optimizations and bit-twiddling optzns.
Modified: llvm/branches/R600/examples/Kaleidoscope/Chapter7/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/examples/Kaleidoscope/Chapter7/toy.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/examples/Kaleidoscope/Chapter7/toy.cpp (original)
+++ llvm/branches/R600/examples/Kaleidoscope/Chapter7/toy.cpp Thu Oct 11 16:28:00 2012
@@ -7,7 +7,7 @@
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Analysis/Passes.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Support/TargetSelect.h"
#include <cstdio>
@@ -1111,7 +1111,7 @@
// Set up the optimizer pipeline. Start with registering info about how the
// target lays out data structures.
- OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
+ OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));
// Provide basic AliasAnalysis support for GVN.
OurFPM.add(createBasicAliasAnalysisPass());
// Promote allocas to registers.
Modified: llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter4/toy.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter4/toy.ml?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter4/toy.ml (original)
+++ llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter4/toy.ml Thu Oct 11 16:28:00 2012
@@ -27,7 +27,7 @@
(* Set up the optimizer pipeline. Start with registering info about how the
* target lays out data structures. *)
- TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
+ DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
add_instruction_combination the_fpm;
Modified: llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter5/toy.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter5/toy.ml?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter5/toy.ml (original)
+++ llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter5/toy.ml Thu Oct 11 16:28:00 2012
@@ -27,7 +27,7 @@
(* Set up the optimizer pipeline. Start with registering info about how the
* target lays out data structures. *)
- TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
+ DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
add_instruction_combination the_fpm;
Modified: llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter6/toy.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter6/toy.ml?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter6/toy.ml (original)
+++ llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter6/toy.ml Thu Oct 11 16:28:00 2012
@@ -27,7 +27,7 @@
(* Set up the optimizer pipeline. Start with registering info about how the
* target lays out data structures. *)
- TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
+ DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
(* Do simple "peephole" optimizations and bit-twiddling optzn. *)
add_instruction_combination the_fpm;
Modified: llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter7/toy.ml
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter7/toy.ml?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter7/toy.ml (original)
+++ llvm/branches/R600/examples/OCaml-Kaleidoscope/Chapter7/toy.ml Thu Oct 11 16:28:00 2012
@@ -28,7 +28,7 @@
(* Set up the optimizer pipeline. Start with registering info about how the
* target lays out data structures. *)
- TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
+ DataLayout.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
(* Promote allocas to registers. *)
add_memory_to_register_promotion the_fpm;
Modified: llvm/branches/R600/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm-c/Core.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm-c/Core.h (original)
+++ llvm/branches/R600/include/llvm-c/Core.h Thu Oct 11 16:28:00 2012
@@ -1803,7 +1803,7 @@
* Set the alignment for a function parameter.
*
* @see llvm::Argument::addAttr()
- * @see llvm::Attribute::constructAlignmentFromInt()
+ * @see llvm::Attributes::constructAlignmentFromInt()
*/
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align);
Modified: llvm/branches/R600/include/llvm-c/Target.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm-c/Target.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm-c/Target.h (original)
+++ llvm/branches/R600/include/llvm-c/Target.h Thu Oct 11 16:28:00 2012
@@ -145,7 +145,7 @@
/*===-- Target Data -------------------------------------------------------===*/
/** Creates target data from a target layout string.
- See the constructor llvm::TargetData::TargetData. */
+ See the constructor llvm::DataLayout::DataLayout. */
LLVMTargetDataRef LLVMCreateTargetData(const char *StringRep);
/** Adds target data information to a pass manager. This does not take ownership
@@ -160,48 +160,48 @@
/** Converts target data to a target layout string. The string must be disposed
with LLVMDisposeMessage.
- See the constructor llvm::TargetData::TargetData. */
+ See the constructor llvm::DataLayout::DataLayout. */
char *LLVMCopyStringRepOfTargetData(LLVMTargetDataRef);
/** Returns the byte order of a target, either LLVMBigEndian or
LLVMLittleEndian.
- See the method llvm::TargetData::isLittleEndian. */
+ See the method llvm::DataLayout::isLittleEndian. */
enum LLVMByteOrdering LLVMByteOrder(LLVMTargetDataRef);
/** Returns the pointer size in bytes for a target.
- See the method llvm::TargetData::getPointerSize. */
+ See the method llvm::DataLayout::getPointerSize. */
unsigned LLVMPointerSize(LLVMTargetDataRef);
/** Returns the integer type that is the same size as a pointer on a target.
- See the method llvm::TargetData::getIntPtrType. */
+ See the method llvm::DataLayout::getIntPtrType. */
LLVMTypeRef LLVMIntPtrType(LLVMTargetDataRef);
/** Computes the size of a type in bytes for a target.
- See the method llvm::TargetData::getTypeSizeInBits. */
+ See the method llvm::DataLayout::getTypeSizeInBits. */
unsigned long long LLVMSizeOfTypeInBits(LLVMTargetDataRef, LLVMTypeRef);
/** Computes the storage size of a type in bytes for a target.
- See the method llvm::TargetData::getTypeStoreSize. */
+ See the method llvm::DataLayout::getTypeStoreSize. */
unsigned long long LLVMStoreSizeOfType(LLVMTargetDataRef, LLVMTypeRef);
/** Computes the ABI size of a type in bytes for a target.
- See the method llvm::TargetData::getTypeAllocSize. */
+ See the method llvm::DataLayout::getTypeAllocSize. */
unsigned long long LLVMABISizeOfType(LLVMTargetDataRef, LLVMTypeRef);
/** Computes the ABI alignment of a type in bytes for a target.
- See the method llvm::TargetData::getTypeABISize. */
+ See the method llvm::DataLayout::getTypeABISize. */
unsigned LLVMABIAlignmentOfType(LLVMTargetDataRef, LLVMTypeRef);
/** Computes the call frame alignment of a type in bytes for a target.
- See the method llvm::TargetData::getTypeABISize. */
+ See the method llvm::DataLayout::getTypeABISize. */
unsigned LLVMCallFrameAlignmentOfType(LLVMTargetDataRef, LLVMTypeRef);
/** Computes the preferred alignment of a type in bytes for a target.
- See the method llvm::TargetData::getTypeABISize. */
+ See the method llvm::DataLayout::getTypeABISize. */
unsigned LLVMPreferredAlignmentOfType(LLVMTargetDataRef, LLVMTypeRef);
/** Computes the preferred alignment of a global variable in bytes for a target.
- See the method llvm::TargetData::getPreferredAlignment. */
+ See the method llvm::DataLayout::getPreferredAlignment. */
unsigned LLVMPreferredAlignmentOfGlobal(LLVMTargetDataRef,
LLVMValueRef GlobalVar);
@@ -216,7 +216,7 @@
unsigned Element);
/** Deallocates a TargetData.
- See the destructor llvm::TargetData::~TargetData. */
+ See the destructor llvm::DataLayout::~DataLayout. */
void LLVMDisposeTargetData(LLVMTargetDataRef);
/**
@@ -227,15 +227,15 @@
}
namespace llvm {
- class TargetData;
+ class DataLayout;
class TargetLibraryInfo;
- inline TargetData *unwrap(LLVMTargetDataRef P) {
- return reinterpret_cast<TargetData*>(P);
+ inline DataLayout *unwrap(LLVMTargetDataRef P) {
+ return reinterpret_cast<DataLayout*>(P);
}
- inline LLVMTargetDataRef wrap(const TargetData *P) {
- return reinterpret_cast<LLVMTargetDataRef>(const_cast<TargetData*>(P));
+ inline LLVMTargetDataRef wrap(const DataLayout *P) {
+ return reinterpret_cast<LLVMTargetDataRef>(const_cast<DataLayout*>(P));
}
inline TargetLibraryInfo *unwrap(LLVMTargetLibraryInfoRef P) {
Modified: llvm/branches/R600/include/llvm-c/TargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm-c/TargetMachine.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm-c/TargetMachine.h (original)
+++ llvm/branches/R600/include/llvm-c/TargetMachine.h Thu Oct 11 16:28:00 2012
@@ -104,7 +104,7 @@
LLVMDisposeMessage. */
char *LLVMGetTargetMachineFeatureString(LLVMTargetMachineRef T);
-/** Returns the llvm::TargetData used for this llvm:TargetMachine. */
+/** Returns the llvm::DataLayout used for this llvm:TargetMachine. */
LLVMTargetDataRef LLVMGetTargetMachineData(LLVMTargetMachineRef T);
/** Emits an asm or object file for the given module to the filename. This
Modified: llvm/branches/R600/include/llvm/ADT/MapVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/ADT/MapVector.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/ADT/MapVector.h (original)
+++ llvm/branches/R600/include/llvm/ADT/MapVector.h Thu Oct 11 16:28:00 2012
@@ -26,10 +26,10 @@
/// This class implements a map that also provides access to all stored values
/// in a deterministic order. The values are kept in a std::vector and the
/// mapping is done with DenseMap from Keys to indexes in that vector.
-template<typename KeyT, typename ValueT>
+template<typename KeyT, typename ValueT,
+ typename MapType = llvm::DenseMap<KeyT, unsigned>,
+ typename VectorType = std::vector<std::pair<KeyT, ValueT> > >
class MapVector {
- typedef llvm::DenseMap<KeyT, unsigned> MapType;
- typedef std::vector<std::pair<KeyT, ValueT> > VectorType;
typedef typename VectorType::size_type SizeType;
MapType Map;
@@ -63,6 +63,11 @@
return Vector.empty();
}
+ void clear() {
+ Map.clear();
+ Vector.clear();
+ }
+
ValueT &operator[](const KeyT &Key) {
std::pair<KeyT, unsigned> Pair = std::make_pair(Key, 0);
std::pair<typename MapType::iterator, bool> Result = Map.insert(Pair);
@@ -73,6 +78,11 @@
}
return Vector[I].second;
}
+
+ unsigned count(const KeyT &Key) const {
+ typename MapType::const_iterator Pos = Map.find(Key);
+ return Pos == Map.end()? 0 : 1;
+ }
};
}
Modified: llvm/branches/R600/include/llvm/ADT/SetVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/ADT/SetVector.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/ADT/SetVector.h (original)
+++ llvm/branches/R600/include/llvm/ADT/SetVector.h Thu Oct 11 16:28:00 2012
@@ -27,10 +27,11 @@
namespace llvm {
+/// \brief A vector that has set insertion semantics.
+///
/// This adapter class provides a way to keep a set of things that also has the
/// property of a deterministic iteration order. The order of iteration is the
/// order of insertion.
-/// @brief A vector that has set insertion semantics.
template <typename T, typename Vector = std::vector<T>,
typename Set = SmallSet<T, 16> >
class SetVector {
@@ -45,59 +46,59 @@
typedef typename vector_type::const_iterator const_iterator;
typedef typename vector_type::size_type size_type;
- /// @brief Construct an empty SetVector
+ /// \brief Construct an empty SetVector
SetVector() {}
- /// @brief Initialize a SetVector with a range of elements
+ /// \brief Initialize a SetVector with a range of elements
template<typename It>
SetVector(It Start, It End) {
insert(Start, End);
}
- /// @brief Determine if the SetVector is empty or not.
+ /// \brief Determine if the SetVector is empty or not.
bool empty() const {
return vector_.empty();
}
- /// @brief Determine the number of elements in the SetVector.
+ /// \brief Determine the number of elements in the SetVector.
size_type size() const {
return vector_.size();
}
- /// @brief Get an iterator to the beginning of the SetVector.
+ /// \brief Get an iterator to the beginning of the SetVector.
iterator begin() {
return vector_.begin();
}
- /// @brief Get a const_iterator to the beginning of the SetVector.
+ /// \brief Get a const_iterator to the beginning of the SetVector.
const_iterator begin() const {
return vector_.begin();
}
- /// @brief Get an iterator to the end of the SetVector.
+ /// \brief Get an iterator to the end of the SetVector.
iterator end() {
return vector_.end();
}
- /// @brief Get a const_iterator to the end of the SetVector.
+ /// \brief Get a const_iterator to the end of the SetVector.
const_iterator end() const {
return vector_.end();
}
- /// @brief Return the last element of the SetVector.
+ /// \brief Return the last element of the SetVector.
const T &back() const {
assert(!empty() && "Cannot call back() on empty SetVector!");
return vector_.back();
}
- /// @brief Index into the SetVector.
+ /// \brief Index into the SetVector.
const_reference operator[](size_type n) const {
assert(n < vector_.size() && "SetVector access out of range!");
return vector_[n];
}
- /// @returns true iff the element was inserted into the SetVector.
- /// @brief Insert a new element into the SetVector.
+ /// \brief Insert a new element into the SetVector.
+ /// \returns true iff the element was inserted into the SetVector.
bool insert(const value_type &X) {
bool result = set_.insert(X);
if (result)
@@ -105,7 +106,7 @@
return result;
}
- /// @brief Insert a range of elements into the SetVector.
+ /// \brief Insert a range of elements into the SetVector.
template<typename It>
void insert(It Start, It End) {
for (; Start != End; ++Start)
@@ -113,7 +114,7 @@
vector_.push_back(*Start);
}
- /// @brief Remove an item from the set vector.
+ /// \brief Remove an item from the set vector.
bool remove(const value_type& X) {
if (set_.erase(X)) {
typename vector_type::iterator I =
@@ -125,20 +126,44 @@
return false;
}
+ /// \brief Remove items from the set vector based on a predicate function.
+ ///
+ /// This is intended to be equivalent to the following code, if we could
+ /// write it:
+ ///
+ /// \code
+ /// V.erase(std::remove_if(V.begin(), V.end(), P), V.end());
+ /// \endcode
+ ///
+ /// However, SetVector doesn't expose non-const iterators, making any
+ /// algorithm like remove_if impossible to use.
+ ///
+ /// \returns true if any element is removed.
+ template <typename UnaryPredicate>
+ bool remove_if(UnaryPredicate P) {
+ typename vector_type::iterator I
+ = std::remove_if(vector_.begin(), vector_.end(),
+ TestAndEraseFromSet<UnaryPredicate>(P, set_));
+ if (I == vector_.end())
+ return false;
+ vector_.erase(I, vector_.end());
+ return true;
+ }
+
- /// @returns 0 if the element is not in the SetVector, 1 if it is.
- /// @brief Count the number of elements of a given key in the SetVector.
+ /// \brief Count the number of elements of a given key in the SetVector.
+ /// \returns 0 if the element is not in the SetVector, 1 if it is.
size_type count(const key_type &key) const {
return set_.count(key);
}
- /// @brief Completely clear the SetVector
+ /// \brief Completely clear the SetVector
void clear() {
set_.clear();
vector_.clear();
}
- /// @brief Remove the last element of the SetVector.
+ /// \brief Remove the last element of the SetVector.
void pop_back() {
assert(!empty() && "Cannot remove an element from an empty SetVector!");
set_.erase(back());
@@ -160,18 +185,41 @@
}
private:
+ /// \brief A wrapper predicate designed for use with std::remove_if.
+ ///
+ /// This predicate wraps a predicate suitable for use with std::remove_if to
+ /// call set_.erase(x) on each element which is slated for removal.
+ template <typename UnaryPredicate>
+ class TestAndEraseFromSet {
+ UnaryPredicate P;
+ set_type &set_;
+
+ public:
+ typedef typename UnaryPredicate::argument_type argument_type;
+
+ TestAndEraseFromSet(UnaryPredicate P, set_type &set_) : P(P), set_(set_) {}
+
+ bool operator()(argument_type Arg) {
+ if (P(Arg)) {
+ set_.erase(Arg);
+ return true;
+ }
+ return false;
+ }
+ };
+
set_type set_; ///< The set.
vector_type vector_; ///< The vector.
};
-/// SmallSetVector - A SetVector that performs no allocations if smaller than
+/// \brief A SetVector that performs no allocations if smaller than
/// a certain size.
template <typename T, unsigned N>
class SmallSetVector : public SetVector<T, SmallVector<T, N>, SmallSet<T, N> > {
public:
SmallSetVector() {}
- /// @brief Initialize a SmallSetVector with a range of elements
+ /// \brief Initialize a SmallSetVector with a range of elements
template<typename It>
SmallSetVector(It Start, It End) {
this->insert(Start, End);
Modified: llvm/branches/R600/include/llvm/ADT/Triple.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/ADT/Triple.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/ADT/Triple.h (original)
+++ llvm/branches/R600/include/llvm/ADT/Triple.h Thu Oct 11 16:28:00 2012
@@ -111,7 +111,8 @@
GNUEABIHF,
EABI,
MachO,
- Android
+ Android,
+ ELF
};
private:
Added: llvm/branches/R600/include/llvm/AddressingMode.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/AddressingMode.h?rev=165748&view=auto
==============================================================================
--- llvm/branches/R600/include/llvm/AddressingMode.h (added)
+++ llvm/branches/R600/include/llvm/AddressingMode.h Thu Oct 11 16:28:00 2012
@@ -0,0 +1,41 @@
+//===--------- llvm/AddressingMode.h - Addressing Mode -------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// This file contains addressing mode data structures which are shared
+// between LSR and a number of places in the codegen.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_ADDRESSING_MODE_H
+#define LLVM_ADDRESSING_MODE_H
+
+#include "llvm/Support/DataTypes.h"
+
+namespace llvm {
+
+class GlobalValue;
+
+/// AddrMode - This represents an addressing mode of:
+/// BaseGV + BaseOffs + BaseReg + Scale*ScaleReg
+/// If BaseGV is null, there is no BaseGV.
+/// If BaseOffs is zero, there is no base offset.
+/// If HasBaseReg is false, there is no base register.
+/// If Scale is zero, there is no ScaleReg. Scale of 1 indicates a reg with
+/// no scale.
+///
+struct AddrMode {
+ GlobalValue *BaseGV;
+ int64_t BaseOffs;
+ bool HasBaseReg;
+ int64_t Scale;
+ AddrMode() : BaseGV(0), BaseOffs(0), HasBaseReg(false), Scale(0) {}
+};
+
+} // End llvm namespace
+
+#endif
Modified: llvm/branches/R600/include/llvm/Analysis/AliasAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Analysis/AliasAnalysis.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Analysis/AliasAnalysis.h (original)
+++ llvm/branches/R600/include/llvm/Analysis/AliasAnalysis.h Thu Oct 11 16:28:00 2012
@@ -45,7 +45,7 @@
class LoadInst;
class StoreInst;
class VAArgInst;
-class TargetData;
+class DataLayout;
class TargetLibraryInfo;
class Pass;
class AnalysisUsage;
@@ -55,7 +55,7 @@
class AliasAnalysis {
protected:
- const TargetData *TD;
+ const DataLayout *TD;
const TargetLibraryInfo *TLI;
private:
@@ -83,17 +83,17 @@
/// know the sizes of the potential memory references.
static uint64_t const UnknownSize = ~UINT64_C(0);
- /// getTargetData - Return a pointer to the current TargetData object, or
- /// null if no TargetData object is available.
+ /// getDataLayout - Return a pointer to the current DataLayout object, or
+ /// null if no DataLayout object is available.
///
- const TargetData *getTargetData() const { return TD; }
+ const DataLayout *getDataLayout() const { return TD; }
/// getTargetLibraryInfo - Return a pointer to the current TargetLibraryInfo
/// object, or null if no TargetLibraryInfo object is available.
///
const TargetLibraryInfo *getTargetLibraryInfo() const { return TLI; }
- /// getTypeStoreSize - Return the TargetData store size for the given type,
+ /// getTypeStoreSize - Return the DataLayout store size for the given type,
/// if known, or a conservative value otherwise.
///
uint64_t getTypeStoreSize(Type *Ty);
Modified: llvm/branches/R600/include/llvm/Analysis/CaptureTracking.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Analysis/CaptureTracking.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Analysis/CaptureTracking.h (original)
+++ llvm/branches/R600/include/llvm/Analysis/CaptureTracking.h Thu Oct 11 16:28:00 2012
@@ -46,7 +46,7 @@
/// capture) return false. To search it, return true.
///
/// U->getUser() is always an Instruction.
- virtual bool shouldExplore(Use *U) = 0;
+ virtual bool shouldExplore(Use *U);
/// captured - Information about the pointer was captured by the user of
/// use U. Return true to stop the traversal or false to continue looking
Modified: llvm/branches/R600/include/llvm/Analysis/CodeMetrics.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Analysis/CodeMetrics.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Analysis/CodeMetrics.h (original)
+++ llvm/branches/R600/include/llvm/Analysis/CodeMetrics.h Thu Oct 11 16:28:00 2012
@@ -22,11 +22,11 @@
class BasicBlock;
class Function;
class Instruction;
- class TargetData;
+ class DataLayout;
class Value;
/// \brief Check whether an instruction is likely to be "free" when lowered.
- bool isInstructionFree(const Instruction *I, const TargetData *TD = 0);
+ bool isInstructionFree(const Instruction *I, const DataLayout *TD = 0);
/// \brief Check whether a call will lower to something small.
///
@@ -85,10 +85,10 @@
NumRets(0) {}
/// \brief Add information about a block to the current state.
- void analyzeBasicBlock(const BasicBlock *BB, const TargetData *TD = 0);
+ void analyzeBasicBlock(const BasicBlock *BB, const DataLayout *TD = 0);
/// \brief Add information about a function to the current state.
- void analyzeFunction(Function *F, const TargetData *TD = 0);
+ void analyzeFunction(Function *F, const DataLayout *TD = 0);
};
}
Modified: llvm/branches/R600/include/llvm/Analysis/ConstantFolding.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Analysis/ConstantFolding.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Analysis/ConstantFolding.h (original)
+++ llvm/branches/R600/include/llvm/Analysis/ConstantFolding.h Thu Oct 11 16:28:00 2012
@@ -12,7 +12,7 @@
//
// Also, to supplement the basic VMCore ConstantExpr simplifications,
// this file declares some additional folding routines that can make use of
-// TargetData information. These functions cannot go in VMCore due to library
+// DataLayout information. These functions cannot go in VMCore due to library
// dependency issues.
//
//===----------------------------------------------------------------------===//
@@ -24,7 +24,7 @@
class Constant;
class ConstantExpr;
class Instruction;
- class TargetData;
+ class DataLayout;
class TargetLibraryInfo;
class Function;
class Type;
@@ -36,14 +36,14 @@
/// Note that this fails if not all of the operands are constant. Otherwise,
/// this function can only fail when attempting to fold instructions like loads
/// and stores, which have no constant expression form.
-Constant *ConstantFoldInstruction(Instruction *I, const TargetData *TD = 0,
+Constant *ConstantFoldInstruction(Instruction *I, const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0);
/// ConstantFoldConstantExpression - Attempt to fold the constant expression
-/// using the specified TargetData. If successful, the constant result is
+/// using the specified DataLayout. If successful, the constant result is
/// result is returned, if not, null is returned.
Constant *ConstantFoldConstantExpression(const ConstantExpr *CE,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0);
/// ConstantFoldInstOperands - Attempt to constant fold an instruction with the
@@ -54,7 +54,7 @@
///
Constant *ConstantFoldInstOperands(unsigned Opcode, Type *DestTy,
ArrayRef<Constant *> Ops,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0);
/// ConstantFoldCompareInstOperands - Attempt to constant fold a compare
@@ -63,7 +63,7 @@
///
Constant *ConstantFoldCompareInstOperands(unsigned Predicate,
Constant *LHS, Constant *RHS,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0);
/// ConstantFoldInsertValueInstruction - Attempt to constant fold an insertvalue
@@ -75,7 +75,7 @@
/// ConstantFoldLoadFromConstPtr - Return the value that a load from C would
/// produce if it is constant and determinable. If this is not determinable,
/// return null.
-Constant *ConstantFoldLoadFromConstPtr(Constant *C, const TargetData *TD = 0);
+Constant *ConstantFoldLoadFromConstPtr(Constant *C, const DataLayout *TD = 0);
/// ConstantFoldLoadThroughGEPConstantExpr - Given a constant and a
/// getelementptr constantexpr, return the constant value being addressed by the
Modified: llvm/branches/R600/include/llvm/Analysis/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Analysis/Dominators.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Analysis/Dominators.h (original)
+++ llvm/branches/R600/include/llvm/Analysis/Dominators.h Thu Oct 11 16:28:00 2012
@@ -346,7 +346,7 @@
DomTreeNodeBase<NodeT> *getRootNode() { return RootNode; }
const DomTreeNodeBase<NodeT> *getRootNode() const { return RootNode; }
- /// properlyDominates - Returns true iff this dominates N and this != N.
+ /// properlyDominates - Returns true iff A dominates B and A != B.
/// Note that this is not a constant time operation!
///
bool properlyDominates(const DomTreeNodeBase<NodeT> *A,
Modified: llvm/branches/R600/include/llvm/Analysis/IVUsers.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Analysis/IVUsers.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Analysis/IVUsers.h (original)
+++ llvm/branches/R600/include/llvm/Analysis/IVUsers.h Thu Oct 11 16:28:00 2012
@@ -28,7 +28,7 @@
class ScalarEvolution;
class SCEV;
class IVUsers;
-class TargetData;
+class DataLayout;
/// IVStrideUse - Keep track of one use of a strided induction variable.
/// The Expr member keeps track of the expression, User is the actual user
@@ -123,7 +123,7 @@
LoopInfo *LI;
DominatorTree *DT;
ScalarEvolution *SE;
- TargetData *TD;
+ DataLayout *TD;
SmallPtrSet<Instruction*,16> Processed;
/// IVUses - A list of all tracked IV uses of induction variable expressions
Modified: llvm/branches/R600/include/llvm/Analysis/InlineCost.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Analysis/InlineCost.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Analysis/InlineCost.h (original)
+++ llvm/branches/R600/include/llvm/Analysis/InlineCost.h Thu Oct 11 16:28:00 2012
@@ -26,7 +26,7 @@
namespace llvm {
class CallSite;
- class TargetData;
+ class DataLayout;
namespace InlineConstants {
// Various magic constants used to adjust heuristics.
@@ -104,13 +104,13 @@
/// InlineCostAnalyzer - Cost analyzer used by inliner.
class InlineCostAnalyzer {
- // TargetData if available, or null.
- const TargetData *TD;
+ // DataLayout if available, or null.
+ const DataLayout *TD;
public:
InlineCostAnalyzer(): TD(0) {}
- void setTargetData(const TargetData *TData) { TD = TData; }
+ void setDataLayout(const DataLayout *TData) { TD = TData; }
/// \brief Get an InlineCost object representing the cost of inlining this
/// callsite.
Modified: llvm/branches/R600/include/llvm/Analysis/InstructionSimplify.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Analysis/InstructionSimplify.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Analysis/InstructionSimplify.h (original)
+++ llvm/branches/R600/include/llvm/Analysis/InstructionSimplify.h Thu Oct 11 16:28:00 2012
@@ -24,7 +24,7 @@
class ArrayRef;
class DominatorTree;
class Instruction;
- class TargetData;
+ class DataLayout;
class TargetLibraryInfo;
class Type;
class Value;
@@ -32,122 +32,122 @@
/// SimplifyAddInst - Given operands for an Add, see if we can
/// fold the result. If not, this returns null.
Value *SimplifyAddInst(Value *LHS, Value *RHS, bool isNSW, bool isNUW,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifySubInst - Given operands for a Sub, see if we can
/// fold the result. If not, this returns null.
Value *SimplifySubInst(Value *LHS, Value *RHS, bool isNSW, bool isNUW,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyMulInst - Given operands for a Mul, see if we can
/// fold the result. If not, this returns null.
- Value *SimplifyMulInst(Value *LHS, Value *RHS, const TargetData *TD = 0,
+ Value *SimplifyMulInst(Value *LHS, Value *RHS, const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifySDivInst - Given operands for an SDiv, see if we can
/// fold the result. If not, this returns null.
- Value *SimplifySDivInst(Value *LHS, Value *RHS, const TargetData *TD = 0,
+ Value *SimplifySDivInst(Value *LHS, Value *RHS, const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyUDivInst - Given operands for a UDiv, see if we can
/// fold the result. If not, this returns null.
- Value *SimplifyUDivInst(Value *LHS, Value *RHS, const TargetData *TD = 0,
+ Value *SimplifyUDivInst(Value *LHS, Value *RHS, const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyFDivInst - Given operands for an FDiv, see if we can
/// fold the result. If not, this returns null.
- Value *SimplifyFDivInst(Value *LHS, Value *RHS, const TargetData *TD = 0,
+ Value *SimplifyFDivInst(Value *LHS, Value *RHS, const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifySRemInst - Given operands for an SRem, see if we can
/// fold the result. If not, this returns null.
- Value *SimplifySRemInst(Value *LHS, Value *RHS, const TargetData *TD = 0,
+ Value *SimplifySRemInst(Value *LHS, Value *RHS, const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyURemInst - Given operands for a URem, see if we can
/// fold the result. If not, this returns null.
- Value *SimplifyURemInst(Value *LHS, Value *RHS, const TargetData *TD = 0,
+ Value *SimplifyURemInst(Value *LHS, Value *RHS, const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyFRemInst - Given operands for an FRem, see if we can
/// fold the result. If not, this returns null.
- Value *SimplifyFRemInst(Value *LHS, Value *RHS, const TargetData *TD = 0,
+ Value *SimplifyFRemInst(Value *LHS, Value *RHS, const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyShlInst - Given operands for a Shl, see if we can
/// fold the result. If not, this returns null.
Value *SimplifyShlInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyLShrInst - Given operands for a LShr, see if we can
/// fold the result. If not, this returns null.
Value *SimplifyLShrInst(Value *Op0, Value *Op1, bool isExact,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyAShrInst - Given operands for a AShr, see if we can
/// fold the result. If not, this returns null.
Value *SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyAndInst - Given operands for an And, see if we can
/// fold the result. If not, this returns null.
- Value *SimplifyAndInst(Value *LHS, Value *RHS, const TargetData *TD = 0,
+ Value *SimplifyAndInst(Value *LHS, Value *RHS, const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyOrInst - Given operands for an Or, see if we can
/// fold the result. If not, this returns null.
- Value *SimplifyOrInst(Value *LHS, Value *RHS, const TargetData *TD = 0,
+ Value *SimplifyOrInst(Value *LHS, Value *RHS, const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyXorInst - Given operands for a Xor, see if we can
/// fold the result. If not, this returns null.
- Value *SimplifyXorInst(Value *LHS, Value *RHS, const TargetData *TD = 0,
+ Value *SimplifyXorInst(Value *LHS, Value *RHS, const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyICmpInst - Given operands for an ICmpInst, see if we can
/// fold the result. If not, this returns null.
Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyFCmpInst - Given operands for an FCmpInst, see if we can
/// fold the result. If not, this returns null.
Value *SimplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifySelectInst - Given operands for a SelectInst, see if we can fold
/// the result. If not, this returns null.
Value *SimplifySelectInst(Value *Cond, Value *TrueVal, Value *FalseVal,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyGEPInst - Given operands for an GetElementPtrInst, see if we can
/// fold the result. If not, this returns null.
- Value *SimplifyGEPInst(ArrayRef<Value *> Ops, const TargetData *TD = 0,
+ Value *SimplifyGEPInst(ArrayRef<Value *> Ops, const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
@@ -155,13 +155,13 @@
/// can fold the result. If not, this returns null.
Value *SimplifyInsertValueInst(Value *Agg, Value *Val,
ArrayRef<unsigned> Idxs,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyTruncInst - Given operands for an TruncInst, see if we can fold
/// the result. If not, this returns null.
- Value *SimplifyTruncInst(Value *Op, Type *Ty, const TargetData *TD = 0,
+ Value *SimplifyTruncInst(Value *Op, Type *Ty, const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
@@ -171,20 +171,20 @@
/// SimplifyCmpInst - Given operands for a CmpInst, see if we can
/// fold the result. If not, this returns null.
Value *SimplifyCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyBinOp - Given operands for a BinaryOperator, see if we can
/// fold the result. If not, this returns null.
Value *SimplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
/// SimplifyInstruction - See if we can compute a simplified version of this
/// instruction. If not, this returns null.
- Value *SimplifyInstruction(Instruction *I, const TargetData *TD = 0,
+ Value *SimplifyInstruction(Instruction *I, const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
@@ -198,7 +198,7 @@
///
/// The function returns true if any simplifications were performed.
bool replaceAndRecursivelySimplify(Instruction *I, Value *SimpleV,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
@@ -209,7 +209,7 @@
/// of the users impacted. It returns true if any simplifications were
/// performed.
bool recursivelySimplifyInstruction(Instruction *I,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0,
const DominatorTree *DT = 0);
} // end namespace llvm
Modified: llvm/branches/R600/include/llvm/Analysis/LazyValueInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Analysis/LazyValueInfo.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Analysis/LazyValueInfo.h (original)
+++ llvm/branches/R600/include/llvm/Analysis/LazyValueInfo.h Thu Oct 11 16:28:00 2012
@@ -19,14 +19,14 @@
namespace llvm {
class Constant;
- class TargetData;
+ class DataLayout;
class TargetLibraryInfo;
class Value;
/// LazyValueInfo - This pass computes, caches, and vends lazy value constraint
/// information.
class LazyValueInfo : public FunctionPass {
- class TargetData *TD;
+ class DataLayout *TD;
class TargetLibraryInfo *TLI;
void *PImpl;
LazyValueInfo(const LazyValueInfo&) LLVM_DELETED_FUNCTION;
Modified: llvm/branches/R600/include/llvm/Analysis/Loads.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Analysis/Loads.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Analysis/Loads.h (original)
+++ llvm/branches/R600/include/llvm/Analysis/Loads.h Thu Oct 11 16:28:00 2012
@@ -19,7 +19,7 @@
namespace llvm {
class AliasAnalysis;
-class TargetData;
+class DataLayout;
class MDNode;
/// isSafeToLoadUnconditionally - Return true if we know that executing a load
@@ -27,7 +27,7 @@
/// specified pointer, we do a quick local scan of the basic block containing
/// ScanFrom, to determine if the address is already accessed.
bool isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom,
- unsigned Align, const TargetData *TD = 0);
+ unsigned Align, const DataLayout *TD = 0);
/// FindAvailableLoadedValue - Scan the ScanBB block backwards (starting at
/// the instruction before ScanFrom) checking to see if we have the value at
Modified: llvm/branches/R600/include/llvm/Analysis/MemoryBuiltins.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Analysis/MemoryBuiltins.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Analysis/MemoryBuiltins.h (original)
+++ llvm/branches/R600/include/llvm/Analysis/MemoryBuiltins.h Thu Oct 11 16:28:00 2012
@@ -27,7 +27,7 @@
namespace llvm {
class CallInst;
class PointerType;
-class TargetData;
+class DataLayout;
class TargetLibraryInfo;
class Type;
class Value;
@@ -81,7 +81,7 @@
/// isArrayMalloc - Returns the corresponding CallInst if the instruction
/// is a call to malloc whose array size can be determined and the array size
/// is not constant 1. Otherwise, return NULL.
-const CallInst *isArrayMalloc(const Value *I, const TargetData *TD,
+const CallInst *isArrayMalloc(const Value *I, const DataLayout *TD,
const TargetLibraryInfo *TLI);
/// getMallocType - Returns the PointerType resulting from the malloc call.
@@ -103,7 +103,7 @@
/// then return that multiple. For non-array mallocs, the multiple is
/// constant 1. Otherwise, return NULL for mallocs whose array size cannot be
/// determined.
-Value *getMallocArraySize(CallInst *CI, const TargetData *TD,
+Value *getMallocArraySize(CallInst *CI, const DataLayout *TD,
const TargetLibraryInfo *TLI,
bool LookThroughSExt = false);
@@ -141,7 +141,7 @@
/// object size in Size if successful, and false otherwise.
/// If RoundToAlign is true, then Size is rounded up to the aligment of allocas,
/// byval arguments, and global variables.
-bool getObjectSize(const Value *Ptr, uint64_t &Size, const TargetData *TD,
+bool getObjectSize(const Value *Ptr, uint64_t &Size, const DataLayout *TD,
const TargetLibraryInfo *TLI, bool RoundToAlign = false);
@@ -153,7 +153,7 @@
class ObjectSizeOffsetVisitor
: public InstVisitor<ObjectSizeOffsetVisitor, SizeOffsetType> {
- const TargetData *TD;
+ const DataLayout *TD;
const TargetLibraryInfo *TLI;
bool RoundToAlign;
unsigned IntTyBits;
@@ -167,7 +167,7 @@
}
public:
- ObjectSizeOffsetVisitor(const TargetData *TD, const TargetLibraryInfo *TLI,
+ ObjectSizeOffsetVisitor(const DataLayout *TD, const TargetLibraryInfo *TLI,
LLVMContext &Context, bool RoundToAlign = false);
SizeOffsetType compute(Value *V);
@@ -213,7 +213,7 @@
typedef DenseMap<const Value*, WeakEvalType> CacheMapTy;
typedef SmallPtrSet<const Value*, 8> PtrSetTy;
- const TargetData *TD;
+ const DataLayout *TD;
const TargetLibraryInfo *TLI;
LLVMContext &Context;
BuilderTy Builder;
@@ -228,7 +228,7 @@
SizeOffsetEvalType compute_(Value *V);
public:
- ObjectSizeOffsetEvaluator(const TargetData *TD, const TargetLibraryInfo *TLI,
+ ObjectSizeOffsetEvaluator(const DataLayout *TD, const TargetLibraryInfo *TLI,
LLVMContext &Context);
SizeOffsetEvalType compute(Value *V);
Modified: llvm/branches/R600/include/llvm/Analysis/MemoryDependenceAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Analysis/MemoryDependenceAnalysis.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Analysis/MemoryDependenceAnalysis.h (original)
+++ llvm/branches/R600/include/llvm/Analysis/MemoryDependenceAnalysis.h Thu Oct 11 16:28:00 2012
@@ -29,7 +29,7 @@
class Instruction;
class CallSite;
class AliasAnalysis;
- class TargetData;
+ class DataLayout;
class MemoryDependenceAnalysis;
class PredIteratorCache;
class DominatorTree;
@@ -323,7 +323,7 @@
/// Current AA implementation, just a cache.
AliasAnalysis *AA;
- TargetData *TD;
+ DataLayout *TD;
DominatorTree *DT;
OwningPtr<PredIteratorCache> PredCache;
public:
@@ -412,7 +412,7 @@
int64_t MemLocOffs,
unsigned MemLocSize,
const LoadInst *LI,
- const TargetData &TD);
+ const DataLayout &TD);
private:
MemDepResult getCallSiteDependencyFrom(CallSite C, bool isReadOnlyCall,
Modified: llvm/branches/R600/include/llvm/Analysis/PHITransAddr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Analysis/PHITransAddr.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Analysis/PHITransAddr.h (original)
+++ llvm/branches/R600/include/llvm/Analysis/PHITransAddr.h Thu Oct 11 16:28:00 2012
@@ -19,7 +19,7 @@
namespace llvm {
class DominatorTree;
- class TargetData;
+ class DataLayout;
class TargetLibraryInfo;
/// PHITransAddr - An address value which tracks and handles phi translation.
@@ -37,7 +37,7 @@
Value *Addr;
/// TD - The target data we are playing with if known, otherwise null.
- const TargetData *TD;
+ const DataLayout *TD;
/// TLI - The target library info if known, otherwise null.
const TargetLibraryInfo *TLI;
@@ -45,7 +45,7 @@
/// InstInputs - The inputs for our symbolic address.
SmallVector<Instruction*, 4> InstInputs;
public:
- PHITransAddr(Value *addr, const TargetData *td) : Addr(addr), TD(td), TLI(0) {
+ PHITransAddr(Value *addr, const DataLayout *td) : Addr(addr), TD(td), TLI(0) {
// If the address is an instruction, the whole thing is considered an input.
if (Instruction *I = dyn_cast<Instruction>(Addr))
InstInputs.push_back(I);
Modified: llvm/branches/R600/include/llvm/Analysis/ScalarEvolution.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Analysis/ScalarEvolution.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Analysis/ScalarEvolution.h (original)
+++ llvm/branches/R600/include/llvm/Analysis/ScalarEvolution.h Thu Oct 11 16:28:00 2012
@@ -40,7 +40,7 @@
class DominatorTree;
class Type;
class ScalarEvolution;
- class TargetData;
+ class DataLayout;
class TargetLibraryInfo;
class LLVMContext;
class Loop;
@@ -227,7 +227,7 @@
/// TD - The target data information for the target we are targeting.
///
- TargetData *TD;
+ DataLayout *TD;
/// TLI - The target library information for the target we are targeting.
///
Modified: llvm/branches/R600/include/llvm/Analysis/ValueTracking.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Analysis/ValueTracking.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Analysis/ValueTracking.h (original)
+++ llvm/branches/R600/include/llvm/Analysis/ValueTracking.h Thu Oct 11 16:28:00 2012
@@ -22,7 +22,7 @@
class Value;
class Instruction;
class APInt;
- class TargetData;
+ class DataLayout;
class StringRef;
class MDNode;
@@ -37,27 +37,27 @@
/// same width as the vector element, and the bit is set only if it is true
/// for all of the elements in the vector.
void ComputeMaskedBits(Value *V, APInt &KnownZero, APInt &KnownOne,
- const TargetData *TD = 0, unsigned Depth = 0);
+ const DataLayout *TD = 0, unsigned Depth = 0);
void computeMaskedBitsLoad(const MDNode &Ranges, APInt &KnownZero);
/// ComputeSignBit - Determine whether the sign bit is known to be zero or
/// one. Convenience wrapper around ComputeMaskedBits.
void ComputeSignBit(Value *V, bool &KnownZero, bool &KnownOne,
- const TargetData *TD = 0, unsigned Depth = 0);
+ const DataLayout *TD = 0, unsigned Depth = 0);
/// isPowerOfTwo - Return true if the given value is known to have exactly one
/// bit set when defined. For vectors return true if every element is known to
/// be a power of two when defined. Supports values with integer or pointer
/// type and vectors of integers. If 'OrZero' is set then returns true if the
/// given value is either a power of two or zero.
- bool isPowerOfTwo(Value *V, const TargetData *TD = 0, bool OrZero = false,
+ bool isPowerOfTwo(Value *V, const DataLayout *TD = 0, bool OrZero = false,
unsigned Depth = 0);
/// isKnownNonZero - Return true if the given value is known to be non-zero
/// when defined. For vectors return true if every element is known to be
/// non-zero when defined. Supports values with integer or pointer type and
/// vectors of integers.
- bool isKnownNonZero(Value *V, const TargetData *TD = 0, unsigned Depth = 0);
+ bool isKnownNonZero(Value *V, const DataLayout *TD = 0, unsigned Depth = 0);
/// MaskedValueIsZero - Return true if 'V & Mask' is known to be zero. We use
/// this predicate to simplify operations downstream. Mask is known to be
@@ -69,7 +69,7 @@
/// same width as the vector element, and the bit is set only if it is true
/// for all of the elements in the vector.
bool MaskedValueIsZero(Value *V, const APInt &Mask,
- const TargetData *TD = 0, unsigned Depth = 0);
+ const DataLayout *TD = 0, unsigned Depth = 0);
/// ComputeNumSignBits - Return the number of times the sign bit of the
@@ -80,7 +80,7 @@
///
/// 'Op' must have a scalar integer type.
///
- unsigned ComputeNumSignBits(Value *Op, const TargetData *TD = 0,
+ unsigned ComputeNumSignBits(Value *Op, const DataLayout *TD = 0,
unsigned Depth = 0);
/// ComputeMultiple - This function computes the integer multiple of Base that
@@ -118,10 +118,10 @@
/// it can be expressed as a base pointer plus a constant offset. Return the
/// base and offset to the caller.
Value *GetPointerBaseWithConstantOffset(Value *Ptr, int64_t &Offset,
- const TargetData &TD);
+ const DataLayout &TD);
static inline const Value *
GetPointerBaseWithConstantOffset(const Value *Ptr, int64_t &Offset,
- const TargetData &TD) {
+ const DataLayout &TD) {
return GetPointerBaseWithConstantOffset(const_cast<Value*>(Ptr), Offset,TD);
}
@@ -143,10 +143,10 @@
/// being addressed. Note that the returned value has pointer type if the
/// specified value does. If the MaxLookup value is non-zero, it limits the
/// number of instructions to be stripped off.
- Value *GetUnderlyingObject(Value *V, const TargetData *TD = 0,
+ Value *GetUnderlyingObject(Value *V, const DataLayout *TD = 0,
unsigned MaxLookup = 6);
static inline const Value *
- GetUnderlyingObject(const Value *V, const TargetData *TD = 0,
+ GetUnderlyingObject(const Value *V, const DataLayout *TD = 0,
unsigned MaxLookup = 6) {
return GetUnderlyingObject(const_cast<Value *>(V), TD, MaxLookup);
}
@@ -156,7 +156,7 @@
/// multiple objects.
void GetUnderlyingObjects(Value *V,
SmallVectorImpl<Value *> &Objects,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
unsigned MaxLookup = 6);
/// onlyUsedByLifetimeMarkers - Return true if the only users of this pointer
@@ -182,7 +182,7 @@
/// However, this method can return true for instructions that read memory;
/// for such instructions, moving them may change the resulting value.
bool isSafeToSpeculativelyExecute(const Value *V,
- const TargetData *TD = 0);
+ const DataLayout *TD = 0);
} // end namespace llvm
Modified: llvm/branches/R600/include/llvm/Argument.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Argument.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Argument.h (original)
+++ llvm/branches/R600/include/llvm/Argument.h Thu Oct 11 16:28:00 2012
@@ -68,8 +68,8 @@
/// attribute on it in its containing function.
bool hasNoCaptureAttr() const;
- /// hasSRetAttr - Return true if this argument has the sret attribute on it in
- /// its containing function.
+ /// hasStructRetAttr - Return true if this argument has the sret attribute on
+ /// it in its containing function.
bool hasStructRetAttr() const;
/// addAttr - Add a Attribute to an argument
Modified: llvm/branches/R600/include/llvm/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Attributes.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Attributes.h (original)
+++ llvm/branches/R600/include/llvm/Attributes.h Thu Oct 11 16:28:00 2012
@@ -15,6 +15,7 @@
#ifndef LLVM_ATTRIBUTES_H
#define LLVM_ATTRIBUTES_H
+#include "llvm/AttributesImpl.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/ADT/ArrayRef.h"
#include <cassert>
@@ -25,387 +26,223 @@
class LLVMContext;
class Type;
-namespace Attribute {
-
-/// We use this proxy POD type to allow constructing Attributes constants using
-/// initializer lists. Do not use this class directly.
-struct AttrConst {
- uint64_t v;
- AttrConst operator | (const AttrConst Attrs) const {
- AttrConst Res = {v | Attrs.v};
- return Res;
- }
- AttrConst operator ~ () const {
- AttrConst Res = {~v};
- return Res;
- }
-};
-
-/// Function parameters and results can have attributes to indicate how they
-/// should be treated by optimizations and code generation. This enumeration
-/// lists the attributes that can be associated with parameters, function
-/// results or the function itself.
-/// @brief Function attributes.
-
-/// We declare AttrConst objects that will be used throughout the code and also
-/// raw uint64_t objects with _i suffix to be used below for other constant
-/// declarations. This is done to avoid static CTORs and at the same time to
-/// keep type-safety of Attributes.
-#define DECLARE_LLVM_ATTRIBUTE(name, value) \
- const uint64_t name##_i = value; \
- const AttrConst name = {value};
-
-DECLARE_LLVM_ATTRIBUTE(None,0) ///< No attributes have been set
-DECLARE_LLVM_ATTRIBUTE(ZExt,1<<0) ///< Zero extended before/after call
-DECLARE_LLVM_ATTRIBUTE(SExt,1<<1) ///< Sign extended before/after call
-DECLARE_LLVM_ATTRIBUTE(NoReturn,1<<2) ///< Mark the function as not returning
-DECLARE_LLVM_ATTRIBUTE(InReg,1<<3) ///< Force argument to be passed in register
-DECLARE_LLVM_ATTRIBUTE(StructRet,1<<4) ///< Hidden pointer to structure to return
-DECLARE_LLVM_ATTRIBUTE(NoUnwind,1<<5) ///< Function doesn't unwind stack
-DECLARE_LLVM_ATTRIBUTE(NoAlias,1<<6) ///< Considered to not alias after call
-DECLARE_LLVM_ATTRIBUTE(ByVal,1<<7) ///< Pass structure by value
-DECLARE_LLVM_ATTRIBUTE(Nest,1<<8) ///< Nested function static chain
-DECLARE_LLVM_ATTRIBUTE(ReadNone,1<<9) ///< Function does not access memory
-DECLARE_LLVM_ATTRIBUTE(ReadOnly,1<<10) ///< Function only reads from memory
-DECLARE_LLVM_ATTRIBUTE(NoInline,1<<11) ///< inline=never
-DECLARE_LLVM_ATTRIBUTE(AlwaysInline,1<<12) ///< inline=always
-DECLARE_LLVM_ATTRIBUTE(OptimizeForSize,1<<13) ///< opt_size
-DECLARE_LLVM_ATTRIBUTE(StackProtect,1<<14) ///< Stack protection.
-DECLARE_LLVM_ATTRIBUTE(StackProtectReq,1<<15) ///< Stack protection required.
-DECLARE_LLVM_ATTRIBUTE(Alignment,31<<16) ///< Alignment of parameter (5 bits)
- // stored as log2 of alignment with +1 bias
- // 0 means unaligned different from align 1
-DECLARE_LLVM_ATTRIBUTE(NoCapture,1<<21) ///< Function creates no aliases of pointer
-DECLARE_LLVM_ATTRIBUTE(NoRedZone,1<<22) /// disable redzone
-DECLARE_LLVM_ATTRIBUTE(NoImplicitFloat,1<<23) /// disable implicit floating point
- /// instructions.
-DECLARE_LLVM_ATTRIBUTE(Naked,1<<24) ///< Naked function
-DECLARE_LLVM_ATTRIBUTE(InlineHint,1<<25) ///< source said inlining was
- ///desirable
-DECLARE_LLVM_ATTRIBUTE(StackAlignment,7<<26) ///< Alignment of stack for
- ///function (3 bits) stored as log2
- ///of alignment with +1 bias
- ///0 means unaligned (different from
- ///alignstack= {1))
-DECLARE_LLVM_ATTRIBUTE(ReturnsTwice,1<<29) ///< Function can return twice
-DECLARE_LLVM_ATTRIBUTE(UWTable,1<<30) ///< Function must be in a unwind
- ///table
-DECLARE_LLVM_ATTRIBUTE(NonLazyBind,1U<<31) ///< Function is called early and/or
- /// often, so lazy binding isn't
- /// worthwhile.
-DECLARE_LLVM_ATTRIBUTE(AddressSafety,1ULL<<32) ///< Address safety checking is on.
-
-#undef DECLARE_LLVM_ATTRIBUTE
-
-/// Note that uwtable is about the ABI or the user mandating an entry in the
-/// unwind table. The nounwind attribute is about an exception passing by the
-/// function.
-/// In a theoretical system that uses tables for profiling and sjlj for
-/// exceptions, they would be fully independent. In a normal system that
-/// uses tables for both, the semantics are:
-/// nil = Needs an entry because an exception might pass by.
-/// nounwind = No need for an entry
-/// uwtable = Needs an entry because the ABI says so and because
-/// an exception might pass by.
-/// uwtable + nounwind = Needs an entry because the ABI says so.
-
-/// @brief Attributes that only apply to function parameters.
-const AttrConst ParameterOnly = {ByVal_i | Nest_i |
- StructRet_i | NoCapture_i};
-
-/// @brief Attributes that may be applied to the function itself. These cannot
-/// be used on return values or function parameters.
-const AttrConst FunctionOnly = {NoReturn_i | NoUnwind_i | ReadNone_i |
- ReadOnly_i | NoInline_i | AlwaysInline_i | OptimizeForSize_i |
- StackProtect_i | StackProtectReq_i | NoRedZone_i | NoImplicitFloat_i |
- Naked_i | InlineHint_i | StackAlignment_i |
- UWTable_i | NonLazyBind_i | ReturnsTwice_i | AddressSafety_i};
-
-/// @brief Parameter attributes that do not apply to vararg call arguments.
-const AttrConst VarArgsIncompatible = {StructRet_i};
-
-/// @brief Attributes that are mutually incompatible.
-const AttrConst MutuallyIncompatible[5] = {
- {ByVal_i | Nest_i | StructRet_i},
- {ByVal_i | Nest_i | InReg_i },
- {ZExt_i | SExt_i},
- {ReadNone_i | ReadOnly_i},
- {NoInline_i | AlwaysInline_i}
-};
-
-} // namespace Attribute
-
/// AttributeImpl - The internal representation of the Attributes class. This is
/// uniquified.
class AttributesImpl;
/// Attributes - A bitset of attributes.
class Attributes {
- // Currently, we need less than 64 bits.
- uint64_t Bits;
+public:
+ /// Function parameters and results can have attributes to indicate how they
+ /// should be treated by optimizations and code generation. This enumeration
+ /// lists the attributes that can be associated with parameters, function
+ /// results or the function itself.
+ ///
+ /// Note that uwtable is about the ABI or the user mandating an entry in the
+ /// unwind table. The nounwind attribute is about an exception passing by the
+ /// function.
+ ///
+ /// In a theoretical system that uses tables for profiling and sjlj for
+ /// exceptions, they would be fully independent. In a normal system that uses
+ /// tables for both, the semantics are:
+ ///
+ /// nil = Needs an entry because an exception might pass by.
+ /// nounwind = No need for an entry
+ /// uwtable = Needs an entry because the ABI says so and because
+ /// an exception might pass by.
+ /// uwtable + nounwind = Needs an entry because the ABI says so.
+
+ enum AttrVal {
+ None = 0, ///< No attributes have been set
+ AddressSafety = 1, ///< Address safety checking is on.
+ Alignment = 2, ///< Alignment of parameter (5 bits)
+ ///< stored as log2 of alignment with +1 bias
+ ///< 0 means unaligned different from align 1
+ AlwaysInline = 3, ///< inline=always
+ ByVal = 4, ///< Pass structure by value
+ InlineHint = 5, ///< Source said inlining was desirable
+ InReg = 6, ///< Force argument to be passed in register
+ Naked = 7, ///< Naked function
+ Nest = 8, ///< Nested function static chain
+ NoAlias = 9, ///< Considered to not alias after call
+ NoCapture = 10, ///< Function creates no aliases of pointer
+ NoImplicitFloat = 11, ///< Disable implicit floating point insts
+ NoInline = 12, ///< inline=never
+ NonLazyBind = 13, ///< Function is called early and/or
+ ///< often, so lazy binding isn't worthwhile
+ NoRedZone = 14, ///< Disable redzone
+ NoReturn = 15, ///< Mark the function as not returning
+ NoUnwind = 16, ///< Function doesn't unwind stack
+ OptimizeForSize = 17, ///< opt_size
+ ReadNone = 18, ///< Function does not access memory
+ ReadOnly = 19, ///< Function only reads from memory
+ ReturnsTwice = 20, ///< Function can return twice
+ SExt = 21, ///< Sign extended before/after call
+ StackAlignment = 22, ///< Alignment of stack for function (3 bits)
+ ///< stored as log2 of alignment with +1 bias 0
+ ///< means unaligned (different from
+ ///< alignstack={1))
+ StackProtect = 23, ///< Stack protection.
+ StackProtectReq = 24, ///< Stack protection required.
+ StructRet = 25, ///< Hidden pointer to structure to return
+ UWTable = 26, ///< Function must be in a unwind table
+ ZExt = 27 ///< Zero extended before/after call
+ };
+private:
+ AttributesImpl Attrs;
explicit Attributes(AttributesImpl *A);
public:
- Attributes() : Bits(0) {}
- explicit Attributes(uint64_t Val) : Bits(Val) {}
- /*implicit*/ Attributes(Attribute::AttrConst Val) : Bits(Val.v) {}
+ Attributes() : Attrs(0) {}
+ explicit Attributes(uint64_t Val);
+ Attributes(const Attributes &A);
class Builder {
friend class Attributes;
uint64_t Bits;
public:
Builder() : Bits(0) {}
- Builder(const Attributes &A) : Bits(A.Bits) {}
+ Builder(const Attributes &A) : Bits(A.Raw()) {}
- void addZExtAttr() {
- Bits |= Attribute::ZExt_i;
- }
- void addSExtAttr() {
- Bits |= Attribute::SExt_i;
- }
- void addNoReturnAttr() {
- Bits |= Attribute::NoReturn_i;
- }
- void addInRegAttr() {
- Bits |= Attribute::InReg_i;
- }
- void addStructRetAttr() {
- Bits |= Attribute::StructRet_i;
- }
- void addNoUnwindAttr() {
- Bits |= Attribute::NoUnwind_i;
- }
- void addNoAliasAttr() {
- Bits |= Attribute::NoAlias_i;
- }
- void addByValAttr() {
- Bits |= Attribute::ByVal_i;
- }
- void addNestAttr() {
- Bits |= Attribute::Nest_i;
- }
- void addReadNoneAttr() {
- Bits |= Attribute::ReadNone_i;
- }
- void addReadOnlyAttr() {
- Bits |= Attribute::ReadOnly_i;
- }
- void addNoInlineAttr() {
- Bits |= Attribute::NoInline_i;
- }
- void addAlwaysInlineAttr() {
- Bits |= Attribute::AlwaysInline_i;
- }
- void addOptimizeForSizeAttr() {
- Bits |= Attribute::OptimizeForSize_i;
- }
- void addStackProtectAttr() {
- Bits |= Attribute::StackProtect_i;
- }
- void addStackProtectReqAttr() {
- Bits |= Attribute::StackProtectReq_i;
- }
- void addNoCaptureAttr() {
- Bits |= Attribute::NoCapture_i;
- }
- void addNoRedZoneAttr() {
- Bits |= Attribute::NoRedZone_i;
- }
- void addNoImplicitFloatAttr() {
- Bits |= Attribute::NoImplicitFloat_i;
- }
- void addNakedAttr() {
- Bits |= Attribute::Naked_i;
- }
- void addInlineHintAttr() {
- Bits |= Attribute::InlineHint_i;
- }
- void addReturnsTwiceAttr() {
- Bits |= Attribute::ReturnsTwice_i;
- }
- void addUWTableAttr() {
- Bits |= Attribute::UWTable_i;
- }
- void addNonLazyBindAttr() {
- Bits |= Attribute::NonLazyBind_i;
- }
- void addAddressSafetyAttr() {
- Bits |= Attribute::AddressSafety_i;
- }
- void addAlignmentAttr(unsigned Align) {
- if (Align == 0) return;
- assert(isPowerOf2_32(Align) && "Alignment must be a power of two.");
- assert(Align <= 0x40000000 && "Alignment too large.");
- Bits |= (Log2_32(Align) + 1) << 16;
- }
- void addStackAlignmentAttr(unsigned Align) {
- // Default alignment, allow the target to define how to align it.
- if (Align == 0) return;
-
- assert(isPowerOf2_32(Align) && "Alignment must be a power of two.");
- assert(Align <= 0x100 && "Alignment too large.");
- Bits |= (Log2_32(Align) + 1) << 26;
+ void clear() { Bits = 0; }
+
+ bool hasAttribute(Attributes::AttrVal A) const;
+ bool hasAttributes() const;
+ bool hasAttributes(const Attributes &A) const;
+ bool hasAlignmentAttr() const;
+
+ uint64_t getAlignment() const;
+ uint64_t getStackAlignment() const;
+
+ Builder &addAttribute(Attributes::AttrVal Val);
+ Builder &removeAttribute(Attributes::AttrVal Val);
+
+ void addAlignmentAttr(unsigned Align);
+ void addStackAlignmentAttr(unsigned Align);
+
+ void removeAttributes(const Attributes &A);
+
+ /// @brief Remove attributes that are used on functions only.
+ void removeFunctionOnlyAttrs() {
+ removeAttribute(Attributes::NoReturn)
+ .removeAttribute(Attributes::NoUnwind)
+ .removeAttribute(Attributes::ReadNone)
+ .removeAttribute(Attributes::ReadOnly)
+ .removeAttribute(Attributes::NoInline)
+ .removeAttribute(Attributes::AlwaysInline)
+ .removeAttribute(Attributes::OptimizeForSize)
+ .removeAttribute(Attributes::StackProtect)
+ .removeAttribute(Attributes::StackProtectReq)
+ .removeAttribute(Attributes::NoRedZone)
+ .removeAttribute(Attributes::NoImplicitFloat)
+ .removeAttribute(Attributes::Naked)
+ .removeAttribute(Attributes::InlineHint)
+ .removeAttribute(Attributes::StackAlignment)
+ .removeAttribute(Attributes::UWTable)
+ .removeAttribute(Attributes::NonLazyBind)
+ .removeAttribute(Attributes::ReturnsTwice)
+ .removeAttribute(Attributes::AddressSafety);
}
};
/// get - Return a uniquified Attributes object. This takes the uniquified
/// value from the Builder and wraps it in the Attributes class.
+ static Attributes get(Builder &B);
static Attributes get(LLVMContext &Context, Builder &B);
- // Attribute query methods.
- // FIXME: StackAlignment & Alignment attributes have no predicate methods.
+ /// @brief Return true if the attribute is present.
+ bool hasAttribute(AttrVal Val) const;
+
+ /// @brief Return true if attributes exist
bool hasAttributes() const {
- return Bits != 0;
- }
- bool hasAttributes(const Attributes &A) const {
- return Bits & A.Bits;
+ return Attrs.hasAttributes();
}
- bool hasZExtAttr() const {
- return Bits & Attribute::ZExt_i;
- }
- bool hasSExtAttr() const {
- return Bits & Attribute::SExt_i;
- }
- bool hasNoReturnAttr() const {
- return Bits & Attribute::NoReturn_i;
- }
- bool hasInRegAttr() const {
- return Bits & Attribute::InReg_i;
- }
- bool hasStructRetAttr() const {
- return Bits & Attribute::StructRet_i;
- }
- bool hasNoUnwindAttr() const {
- return Bits & Attribute::NoUnwind_i;
- }
- bool hasNoAliasAttr() const {
- return Bits & Attribute::NoAlias_i;
- }
- bool hasByValAttr() const {
- return Bits & Attribute::ByVal_i;
- }
- bool hasNestAttr() const {
- return Bits & Attribute::Nest_i;
- }
- bool hasReadNoneAttr() const {
- return Bits & Attribute::ReadNone_i;
- }
- bool hasReadOnlyAttr() const {
- return Bits & Attribute::ReadOnly_i;
- }
- bool hasNoInlineAttr() const {
- return Bits & Attribute::NoInline_i;
- }
- bool hasAlwaysInlineAttr() const {
- return Bits & Attribute::AlwaysInline_i;
- }
- bool hasOptimizeForSizeAttr() const {
- return Bits & Attribute::OptimizeForSize_i;
- }
- bool hasStackProtectAttr() const {
- return Bits & Attribute::StackProtect_i;
- }
- bool hasStackProtectReqAttr() const {
- return Bits & Attribute::StackProtectReq_i;
- }
- bool hasAlignmentAttr() const {
- return Bits & Attribute::Alignment_i;
- }
- bool hasNoCaptureAttr() const {
- return Bits & Attribute::NoCapture_i;
- }
- bool hasNoRedZoneAttr() const {
- return Bits & Attribute::NoRedZone_i;
- }
- bool hasNoImplicitFloatAttr() const {
- return Bits & Attribute::NoImplicitFloat_i;
- }
- bool hasNakedAttr() const {
- return Bits & Attribute::Naked_i;
- }
- bool hasInlineHintAttr() const {
- return Bits & Attribute::InlineHint_i;
- }
- bool hasReturnsTwiceAttr() const {
- return Bits & Attribute::ReturnsTwice_i;
- }
- bool hasStackAlignmentAttr() const {
- return Bits & Attribute::StackAlignment_i;
- }
- bool hasUWTableAttr() const {
- return Bits & Attribute::UWTable_i;
- }
- bool hasNonLazyBindAttr() const {
- return Bits & Attribute::NonLazyBind_i;
- }
- bool hasAddressSafetyAttr() const {
- return Bits & Attribute::AddressSafety_i;
- }
+ /// @brief Return true if the attributes are a non-null intersection.
+ bool hasAttributes(const Attributes &A) const;
- /// This returns the alignment field of an attribute as a byte alignment
+ /// @brief Returns the alignment field of an attribute as a byte alignment
/// value.
- unsigned getAlignment() const {
- if (!hasAlignmentAttr())
- return 0;
- return 1U << (((Bits & Attribute::Alignment_i) >> 16) - 1);
- }
+ unsigned getAlignment() const;
- /// This returns the stack alignment field of an attribute as a byte alignment
- /// value.
- unsigned getStackAlignment() const {
- if (!hasStackAlignmentAttr())
- return 0;
- return 1U << (((Bits & Attribute::StackAlignment_i) >> 26) - 1);
+ /// @brief Returns the stack alignment field of an attribute as a byte
+ /// alignment value.
+ unsigned getStackAlignment() const;
+
+ /// @brief Parameter attributes that do not apply to vararg call arguments.
+ bool hasIncompatibleWithVarArgsAttrs() const {
+ return hasAttribute(Attributes::StructRet);
+ }
+
+ /// @brief Attributes that only apply to function parameters.
+ bool hasParameterOnlyAttrs() const {
+ return hasAttribute(Attributes::ByVal) ||
+ hasAttribute(Attributes::Nest) ||
+ hasAttribute(Attributes::StructRet) ||
+ hasAttribute(Attributes::NoCapture);
+ }
+
+ /// @brief Attributes that may be applied to the function itself. These cannot
+ /// be used on return values or function parameters.
+ bool hasFunctionOnlyAttrs() const {
+ return hasAttribute(Attributes::NoReturn) ||
+ hasAttribute(Attributes::NoUnwind) ||
+ hasAttribute(Attributes::ReadNone) ||
+ hasAttribute(Attributes::ReadOnly) ||
+ hasAttribute(Attributes::NoInline) ||
+ hasAttribute(Attributes::AlwaysInline) ||
+ hasAttribute(Attributes::OptimizeForSize) ||
+ hasAttribute(Attributes::StackProtect) ||
+ hasAttribute(Attributes::StackProtectReq) ||
+ hasAttribute(Attributes::NoRedZone) ||
+ hasAttribute(Attributes::NoImplicitFloat) ||
+ hasAttribute(Attributes::Naked) ||
+ hasAttribute(Attributes::InlineHint) ||
+ hasAttribute(Attributes::StackAlignment) ||
+ hasAttribute(Attributes::UWTable) ||
+ hasAttribute(Attributes::NonLazyBind) ||
+ hasAttribute(Attributes::ReturnsTwice) ||
+ hasAttribute(Attributes::AddressSafety);
}
+ bool isEmptyOrSingleton() const;
+
// This is a "safe bool() operator".
- operator const void *() const { return Bits ? this : 0; }
- bool isEmptyOrSingleton() const { return (Bits & (Bits - 1)) == 0; }
- bool operator == (const Attributes &Attrs) const {
- return Bits == Attrs.Bits;
- }
- bool operator != (const Attributes &Attrs) const {
- return Bits != Attrs.Bits;
- }
- Attributes operator | (const Attributes &Attrs) const {
- return Attributes(Bits | Attrs.Bits);
+ operator const void *() const { return Attrs.Bits ? this : 0; }
+ bool operator == (const Attributes &A) const {
+ return Attrs.Bits == A.Attrs.Bits;
}
- Attributes operator & (const Attributes &Attrs) const {
- return Attributes(Bits & Attrs.Bits);
+ bool operator != (const Attributes &A) const {
+ return Attrs.Bits != A.Attrs.Bits;
}
- Attributes operator ^ (const Attributes &Attrs) const {
- return Attributes(Bits ^ Attrs.Bits);
- }
- Attributes &operator |= (const Attributes &Attrs) {
- Bits |= Attrs.Bits;
- return *this;
- }
- Attributes &operator &= (const Attributes &Attrs) {
- Bits &= Attrs.Bits;
- return *this;
- }
- Attributes operator ~ () const { return Attributes(~Bits); }
- uint64_t Raw() const { return Bits; }
- /// This turns an int alignment (a power of 2, normally) into the form used
- /// internally in Attributes.
+ Attributes operator | (const Attributes &A) const;
+ Attributes operator & (const Attributes &A) const;
+ Attributes operator ^ (const Attributes &A) const;
+ Attributes &operator |= (const Attributes &A);
+ Attributes &operator &= (const Attributes &A);
+ Attributes operator ~ () const;
+
+ uint64_t Raw() const;
+
+ /// constructAlignmentFromInt - This turns an int alignment (a power of 2,
+ /// normally) into the form used internally in Attributes.
static Attributes constructAlignmentFromInt(unsigned i) {
// Default alignment, allow the target to define how to align it.
if (i == 0)
- return Attribute::None;
+ return Attributes();
assert(isPowerOf2_32(i) && "Alignment must be a power of two.");
assert(i <= 0x40000000 && "Alignment too large.");
return Attributes((Log2_32(i)+1) << 16);
}
- /// This turns an int stack alignment (which must be a power of 2) into the
- /// form used internally in Attributes.
+ /// constructStackAlignmentFromInt - This turns an int stack alignment (which
+ /// must be a power of 2) into the form used internally in Attributes.
static Attributes constructStackAlignmentFromInt(unsigned i) {
// Default alignment, allow the target to define how to align it.
if (i == 0)
- return Attribute::None;
+ return Attributes();
assert(isPowerOf2_32(i) && "Alignment must be a power of two.");
assert(i <= 0x100 && "Alignment too large.");
@@ -415,9 +252,9 @@
/// @brief Which attributes cannot be applied to a type.
static Attributes typeIncompatible(Type *Ty);
- /// This returns an integer containing an encoding of all the LLVM attributes
- /// found in the given attribute bitset. Any change to this encoding is a
- /// breaking change to bitcode compatibility.
+ /// encodeLLVMAttributesForBitcode - This returns an integer containing an
+ /// encoding of all the LLVM attributes found in the given attribute bitset.
+ /// Any change to this encoding is a breaking change to bitcode compatibility.
static uint64_t encodeLLVMAttributesForBitcode(Attributes Attrs) {
// FIXME: It doesn't make sense to store the alignment information as an
// expanded out value, we should store it as a log2 value. However, we
@@ -430,15 +267,15 @@
// 5-bit log2 encoded value. Shift the bits above the alignment up by 11
// bits.
uint64_t EncodedAttrs = Attrs.Raw() & 0xffff;
- if (Attrs.hasAlignmentAttr())
- EncodedAttrs |= (1ULL << 16) <<
- (((Attrs.Bits & Attribute::Alignment_i) - 1) >> 16);
+ if (Attrs.hasAttribute(Attributes::Alignment))
+ EncodedAttrs |= Attrs.getAlignment() << 16;
EncodedAttrs |= (Attrs.Raw() & (0xfffULL << 21)) << 11;
return EncodedAttrs;
}
- /// This returns an attribute bitset containing the LLVM attributes that have
- /// been decoded from the given integer. This function must stay in sync with
+ /// decodeLLVMAttributesForBitcode - This returns an attribute bitset
+ /// containing the LLVM attributes that have been decoded from the given
+ /// integer. This function must stay in sync with
/// 'encodeLLVMAttributesForBitcode'.
static Attributes decodeLLVMAttributesForBitcode(uint64_t EncodedAttrs) {
// The alignment is stored as a 16-bit raw value from bits 31--16. We shift
@@ -454,21 +291,38 @@
return Attrs;
}
- /// The set of Attributes set in Attributes is converted to a string of
- /// equivalent mnemonics. This is, presumably, for writing out the mnemonics
- /// for the assembly writer.
+ /// getAsString - The set of Attributes set in Attributes is converted to a
+ /// string of equivalent mnemonics. This is, presumably, for writing out the
+ /// mnemonics for the assembly writer.
/// @brief Convert attribute bits to text
std::string getAsString() const;
};
-/// This is just a pair of values to associate a set of attributes
-/// with an index.
+//===----------------------------------------------------------------------===//
+// AttributeWithIndex
+//===----------------------------------------------------------------------===//
+
+/// AttributeWithIndex - This is just a pair of values to associate a set of
+/// attributes with an index.
struct AttributeWithIndex {
Attributes Attrs; ///< The attributes that are set, or'd together.
unsigned Index; ///< Index of the parameter for which the attributes apply.
///< Index 0 is used for return value attributes.
///< Index ~0U is used for function attributes.
+ static AttributeWithIndex get(unsigned Idx,
+ ArrayRef<Attributes::AttrVal> Attrs) {
+ Attributes::Builder B;
+
+ for (ArrayRef<Attributes::AttrVal>::iterator I = Attrs.begin(),
+ E = Attrs.end(); I != E; ++I)
+ B.addAttribute(*I);
+
+ AttributeWithIndex P;
+ P.Index = Idx;
+ P.Attrs = Attributes::get(B);
+ return P;
+ }
static AttributeWithIndex get(unsigned Idx, Attributes Attrs) {
AttributeWithIndex P;
P.Index = Idx;
@@ -518,7 +372,6 @@
/// getParamAttributes - The attributes for the specified index are
/// returned.
Attributes getParamAttributes(unsigned Idx) const {
- assert (Idx && Idx != ~0U && "Invalid parameter index!");
return getAttributes(Idx);
}
@@ -547,7 +400,10 @@
/// hasAttrSomewhere - Return true if the specified attribute is set for at
/// least one parameter or for the return value.
- bool hasAttrSomewhere(Attributes Attr) const;
+ bool hasAttrSomewhere(Attributes::AttrVal Attr) const;
+
+ unsigned getNumAttrs() const;
+ Attributes &getAttributesAtIndex(unsigned i) const;
/// operator==/!= - Provide equality predicates.
bool operator==(const AttrListPtr &RHS) const
@@ -592,7 +448,6 @@
/// getAttributes - The attributes for the specified index are
/// returned. Attributes for the result are denoted with Idx = 0.
Attributes getAttributes(unsigned Idx) const;
-
};
} // End llvm namespace
Copied: llvm/branches/R600/include/llvm/AttributesImpl.h (from r165622, llvm/branches/R600/lib/VMCore/AttributesImpl.h)
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/AttributesImpl.h?p2=llvm/branches/R600/include/llvm/AttributesImpl.h&p1=llvm/branches/R600/lib/VMCore/AttributesImpl.h&r1=165622&r2=165748&rev=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/VMCore/AttributesImpl.h (original)
+++ llvm/branches/R600/include/llvm/AttributesImpl.h Thu Oct 11 16:28:00 2012
@@ -19,14 +19,27 @@
namespace llvm {
+class Attributes;
+
class AttributesImpl : public FoldingSetNode {
+ friend class Attributes;
uint64_t Bits; // FIXME: We will be expanding this.
- void operator=(const AttributesImpl &) LLVM_DELETED_FUNCTION;
- AttributesImpl(const AttributesImpl &) LLVM_DELETED_FUNCTION;
public:
AttributesImpl(uint64_t bits) : Bits(bits) {}
+ bool hasAttribute(uint64_t A) const;
+
+ bool hasAttributes() const;
+ bool hasAttributes(const Attributes &A) const;
+
+ uint64_t getAlignment() const;
+ uint64_t getStackAlignment() const;
+
+ bool isEmptyOrSingleton() const;
+
+ static uint64_t getAttrMask(uint64_t Val);
+
void Profile(FoldingSetNodeID &ID) const {
Profile(ID, Bits);
}
Modified: llvm/branches/R600/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/CodeGen/AsmPrinter.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/branches/R600/include/llvm/CodeGen/AsmPrinter.h Thu Oct 11 16:28:00 2012
@@ -48,7 +48,7 @@
class DwarfException;
class Mangler;
class TargetLoweringObjectFile;
- class TargetData;
+ class DataLayout;
class TargetMachine;
/// AsmPrinter - This class is intended to be used as a driving class for all
@@ -131,8 +131,8 @@
/// getObjFileLowering - Return information about object file lowering.
const TargetLoweringObjectFile &getObjFileLowering() const;
- /// getTargetData - Return information about data layout.
- const TargetData &getTargetData() const;
+ /// getDataLayout - Return information about data layout.
+ const DataLayout &getDataLayout() const;
/// getCurrentSection() - Return the current section we are emitting to.
const MCSection *getCurrentSection() const;
Modified: llvm/branches/R600/include/llvm/CodeGen/FastISel.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/CodeGen/FastISel.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/CodeGen/FastISel.h (original)
+++ llvm/branches/R600/include/llvm/CodeGen/FastISel.h Thu Oct 11 16:28:00 2012
@@ -32,7 +32,7 @@
class MachineInstr;
class MachineFrameInfo;
class MachineRegisterInfo;
-class TargetData;
+class DataLayout;
class TargetInstrInfo;
class TargetLibraryInfo;
class TargetLowering;
@@ -54,7 +54,7 @@
MachineConstantPool &MCP;
DebugLoc DL;
const TargetMachine &TM;
- const TargetData &TD;
+ const DataLayout &TD;
const TargetInstrInfo &TII;
const TargetLowering &TLI;
const TargetRegisterInfo &TRI;
Modified: llvm/branches/R600/include/llvm/CodeGen/IntrinsicLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/CodeGen/IntrinsicLowering.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/CodeGen/IntrinsicLowering.h (original)
+++ llvm/branches/R600/include/llvm/CodeGen/IntrinsicLowering.h Thu Oct 11 16:28:00 2012
@@ -21,15 +21,15 @@
namespace llvm {
class CallInst;
class Module;
- class TargetData;
+ class DataLayout;
class IntrinsicLowering {
- const TargetData& TD;
+ const DataLayout& TD;
bool Warned;
public:
- explicit IntrinsicLowering(const TargetData &td) :
+ explicit IntrinsicLowering(const DataLayout &td) :
TD(td), Warned(false) {}
/// AddPrototypes - This method, if called, causes all of the prototypes
Modified: llvm/branches/R600/include/llvm/CodeGen/MachineConstantPool.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/CodeGen/MachineConstantPool.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/CodeGen/MachineConstantPool.h (original)
+++ llvm/branches/R600/include/llvm/CodeGen/MachineConstantPool.h Thu Oct 11 16:28:00 2012
@@ -25,7 +25,7 @@
class Constant;
class FoldingSetNodeID;
-class TargetData;
+class DataLayout;
class TargetMachine;
class Type;
class MachineConstantPool;
@@ -132,14 +132,14 @@
/// address of the function constant pool values.
/// @brief The machine constant pool.
class MachineConstantPool {
- const TargetData *TD; ///< The machine's TargetData.
+ const DataLayout *TD; ///< The machine's DataLayout.
unsigned PoolAlignment; ///< The alignment for the pool.
std::vector<MachineConstantPoolEntry> Constants; ///< The pool of constants.
/// MachineConstantPoolValues that use an existing MachineConstantPoolEntry.
DenseSet<MachineConstantPoolValue*> MachineCPVsSharingEntries;
public:
/// @brief The only constructor.
- explicit MachineConstantPool(const TargetData *td)
+ explicit MachineConstantPool(const DataLayout *td)
: TD(td), PoolAlignment(1) {}
~MachineConstantPool();
Modified: llvm/branches/R600/include/llvm/CodeGen/MachineFrameInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/CodeGen/MachineFrameInfo.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/CodeGen/MachineFrameInfo.h (original)
+++ llvm/branches/R600/include/llvm/CodeGen/MachineFrameInfo.h Thu Oct 11 16:28:00 2012
@@ -21,7 +21,7 @@
namespace llvm {
class raw_ostream;
-class TargetData;
+class DataLayout;
class TargetRegisterClass;
class Type;
class MachineFunction;
Modified: llvm/branches/R600/include/llvm/CodeGen/MachineInstr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/CodeGen/MachineInstr.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/CodeGen/MachineInstr.h (original)
+++ llvm/branches/R600/include/llvm/CodeGen/MachineInstr.h Thu Oct 11 16:28:00 2012
@@ -98,25 +98,10 @@
/// MCID NULL and no operands.
MachineInstr();
- // The next two constructors have DebugLoc and non-DebugLoc versions;
- // over time, the non-DebugLoc versions should be phased out and eventually
- // removed.
-
- /// MachineInstr ctor - This constructor creates a MachineInstr and adds the
- /// implicit operands. It reserves space for the number of operands specified
- /// by the MCInstrDesc. The version with a DebugLoc should be preferred.
- explicit MachineInstr(const MCInstrDesc &MCID, bool NoImp = false);
-
- /// MachineInstr ctor - Work exactly the same as the ctor above, except that
- /// the MachineInstr is created and added to the end of the specified basic
- /// block. The version with a DebugLoc should be preferred.
- MachineInstr(MachineBasicBlock *MBB, const MCInstrDesc &MCID);
-
/// MachineInstr ctor - This constructor create a MachineInstr and add the
/// implicit operands. It reserves space for number of operands specified by
/// MCInstrDesc. An explicit DebugLoc is supplied.
- explicit MachineInstr(const MCInstrDesc &MCID, const DebugLoc dl,
- bool NoImp = false);
+ MachineInstr(const MCInstrDesc &MCID, const DebugLoc dl, bool NoImp = false);
/// MachineInstr ctor - Work exactly the same as the ctor above, except that
/// the MachineInstr is created and added to the end of the specified basic
Modified: llvm/branches/R600/include/llvm/CodeGen/MachineJumpTableInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/CodeGen/MachineJumpTableInfo.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/CodeGen/MachineJumpTableInfo.h (original)
+++ llvm/branches/R600/include/llvm/CodeGen/MachineJumpTableInfo.h Thu Oct 11 16:28:00 2012
@@ -26,7 +26,7 @@
namespace llvm {
class MachineBasicBlock;
-class TargetData;
+class DataLayout;
class raw_ostream;
/// MachineJumpTableEntry - One jump table in the jump table info.
@@ -84,9 +84,9 @@
JTEntryKind getEntryKind() const { return EntryKind; }
/// getEntrySize - Return the size of each entry in the jump table.
- unsigned getEntrySize(const TargetData &TD) const;
+ unsigned getEntrySize(const DataLayout &TD) const;
/// getEntryAlignment - Return the alignment of each entry in the jump table.
- unsigned getEntryAlignment(const TargetData &TD) const;
+ unsigned getEntryAlignment(const DataLayout &TD) const;
/// createJumpTableIndex - Create a new jump table.
///
Modified: llvm/branches/R600/include/llvm/CodeGen/MachineScheduler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/CodeGen/MachineScheduler.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/CodeGen/MachineScheduler.h (original)
+++ llvm/branches/R600/include/llvm/CodeGen/MachineScheduler.h Thu Oct 11 16:28:00 2012
@@ -31,7 +31,6 @@
#include "llvm/CodeGen/RegisterPressure.h"
#include "llvm/CodeGen/ScheduleDAGInstrs.h"
#include "llvm/Target/TargetInstrInfo.h"
-#include "llvm/MC/MCInstrItineraries.h"
namespace llvm {
@@ -278,19 +277,6 @@
return RegionCriticalPSets;
}
- /// getIssueWidth - Return the max instructions per scheduling group.
- unsigned getIssueWidth() const {
- return (InstrItins && InstrItins->SchedModel)
- ? InstrItins->SchedModel->IssueWidth : 1;
- }
-
- /// getNumMicroOps - Return the number of issue slots required for this MI.
- unsigned getNumMicroOps(MachineInstr *MI) const {
- if (!InstrItins) return 1;
- int UOps = InstrItins->getNumMicroOps(MI->getDesc().getSchedClass());
- return (UOps >= 0) ? UOps : TII->getNumMicroOps(InstrItins, MI);
- }
-
protected:
// Top-Level entry points for the schedule() driver...
Modified: llvm/branches/R600/include/llvm/CodeGen/ScheduleDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/CodeGen/ScheduleDAG.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/CodeGen/ScheduleDAG.h (original)
+++ llvm/branches/R600/include/llvm/CodeGen/ScheduleDAG.h Thu Oct 11 16:28:00 2012
@@ -570,16 +570,6 @@
unsigned VerifyScheduledDAG(bool isBottomUp);
#endif
- protected:
- /// ComputeLatency - Compute node latency.
- ///
- virtual void computeLatency(SUnit *SU) = 0;
-
- /// ForceUnitLatencies - Return true if all scheduling edges should be given
- /// a latency value of one. The default is to return false; schedulers may
- /// override this as needed.
- virtual bool forceUnitLatencies() const { return false; }
-
private:
// Return the MCInstrDesc of this SDNode or NULL.
const MCInstrDesc *getNodeDesc(const SDNode *Node) const;
Modified: llvm/branches/R600/include/llvm/CodeGen/ScheduleDAGInstrs.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/CodeGen/ScheduleDAGInstrs.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/CodeGen/ScheduleDAGInstrs.h (original)
+++ llvm/branches/R600/include/llvm/CodeGen/ScheduleDAGInstrs.h Thu Oct 11 16:28:00 2012
@@ -31,72 +31,6 @@
class LiveIntervals;
class RegPressureTracker;
- /// LoopDependencies - This class analyzes loop-oriented register
- /// dependencies, which are used to guide scheduling decisions.
- /// For example, loop induction variable increments should be
- /// scheduled as soon as possible after the variable's last use.
- ///
- class LoopDependencies {
- const MachineDominatorTree &MDT;
-
- public:
- typedef std::map<unsigned, std::pair<const MachineOperand *, unsigned> >
- LoopDeps;
- LoopDeps Deps;
-
- LoopDependencies(const MachineDominatorTree &mdt) : MDT(mdt) {}
-
- /// VisitLoop - Clear out any previous state and analyze the given loop.
- ///
- void VisitLoop(const MachineLoop *Loop) {
- assert(Deps.empty() && "stale loop dependencies");
-
- MachineBasicBlock *Header = Loop->getHeader();
- SmallSet<unsigned, 8> LoopLiveIns;
- for (MachineBasicBlock::livein_iterator LI = Header->livein_begin(),
- LE = Header->livein_end(); LI != LE; ++LI)
- LoopLiveIns.insert(*LI);
-
- const MachineDomTreeNode *Node = MDT.getNode(Header);
- const MachineBasicBlock *MBB = Node->getBlock();
- assert(Loop->contains(MBB) &&
- "Loop does not contain header!");
- VisitRegion(Node, MBB, Loop, LoopLiveIns);
- }
-
- private:
- void VisitRegion(const MachineDomTreeNode *Node,
- const MachineBasicBlock *MBB,
- const MachineLoop *Loop,
- const SmallSet<unsigned, 8> &LoopLiveIns) {
- unsigned Count = 0;
- for (MachineBasicBlock::const_iterator I = MBB->begin(), E = MBB->end();
- I != E; ++I) {
- const MachineInstr *MI = I;
- if (MI->isDebugValue())
- continue;
- for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
- const MachineOperand &MO = MI->getOperand(i);
- if (!MO.isReg() || !MO.isUse())
- continue;
- unsigned MOReg = MO.getReg();
- if (LoopLiveIns.count(MOReg))
- Deps.insert(std::make_pair(MOReg, std::make_pair(&MO, Count)));
- }
- ++Count; // Not every iteration due to dbg_value above.
- }
-
- const std::vector<MachineDomTreeNode*> &Children = Node->getChildren();
- for (std::vector<MachineDomTreeNode*>::const_iterator I =
- Children.begin(), E = Children.end(); I != E; ++I) {
- const MachineDomTreeNode *ChildNode = *I;
- MachineBasicBlock *ChildBlock = ChildNode->getBlock();
- if (Loop->contains(ChildBlock))
- VisitRegion(ChildNode, ChildBlock, Loop, LoopLiveIns);
- }
- }
- };
-
/// An individual mapping from virtual register number to SUnit.
struct VReg2SUnit {
unsigned VirtReg;
@@ -177,7 +111,6 @@
const MachineLoopInfo &MLI;
const MachineDominatorTree &MDT;
const MachineFrameInfo *MFI;
- const InstrItineraryData *InstrItins;
/// Live Intervals provides reaching defs in preRA scheduling.
LiveIntervals *LIS;
@@ -236,10 +169,6 @@
/// to minimize construction/destruction.
std::vector<SUnit *> PendingLoads;
- /// LoopRegs - Track which registers are used for loop-carried dependencies.
- ///
- LoopDependencies LoopRegs;
-
/// DbgValues - Remember instruction that precedes DBG_VALUE.
/// These are generated by buildSchedGraph but persist so they can be
/// referenced when emitting the final schedule.
@@ -257,6 +186,9 @@
virtual ~ScheduleDAGInstrs() {}
+ /// \brief Get the machine model for instruction scheduling.
+ const TargetSchedModel *getSchedModel() const { return &SchedModel; }
+
/// begin - Return an iterator to the top of the current scheduling region.
MachineBasicBlock::iterator begin() const { return RegionBegin; }
@@ -297,10 +229,6 @@
/// used by instructions in the fallthrough block.
void addSchedBarrierDeps();
- /// computeLatency - Compute node latency.
- ///
- virtual void computeLatency(SUnit *SU);
-
/// schedule - Order nodes according to selected style, filling
/// in the Sequence member.
///
Modified: llvm/branches/R600/include/llvm/CodeGen/SelectionDAGNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/CodeGen/SelectionDAGNodes.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/CodeGen/SelectionDAGNodes.h (original)
+++ llvm/branches/R600/include/llvm/CodeGen/SelectionDAGNodes.h Thu Oct 11 16:28:00 2012
@@ -956,7 +956,12 @@
const MachinePointerInfo &getPointerInfo() const {
return MMO->getPointerInfo();
}
-
+
+ /// getAddressSpace - Return the address space for the associated pointer
+ unsigned getAddressSpace() const {
+ return getPointerInfo().getAddrSpace();
+ }
+
/// refineAlignment - Update this MemSDNode's MachineMemOperand information
/// to reflect the alignment of NewMMO, if it has a greater alignment.
/// This must only be used when the new alignment applies to all users of
Modified: llvm/branches/R600/include/llvm/CodeGen/TargetSchedule.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/CodeGen/TargetSchedule.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/CodeGen/TargetSchedule.h (original)
+++ llvm/branches/R600/include/llvm/CodeGen/TargetSchedule.h Thu Oct 11 16:28:00 2012
@@ -37,23 +37,52 @@
public:
TargetSchedModel(): STI(0), TII(0) {}
+ /// \brief Initialize the machine model for instruction scheduling.
+ ///
+ /// The machine model API keeps a copy of the top-level MCSchedModel table
+ /// indices and may query TargetSubtargetInfo and TargetInstrInfo to resolve
+ /// dynamic properties.
void init(const MCSchedModel &sm, const TargetSubtargetInfo *sti,
const TargetInstrInfo *tii);
+ /// \brief TargetInstrInfo getter.
const TargetInstrInfo *getInstrInfo() const { return TII; }
- /// Return true if this machine model includes an instruction-level scheduling
- /// model. This is more detailed than the course grain IssueWidth and default
+ /// \brief Return true if this machine model includes an instruction-level
+ /// scheduling model.
+ ///
+ /// This is more detailed than the course grain IssueWidth and default
/// latency properties, but separate from the per-cycle itinerary data.
- bool hasInstrSchedModel() const { return SchedModel.hasInstrSchedModel(); }
+ bool hasInstrSchedModel() const;
+
+ const MCSchedModel *getMCSchedModel() const { return &SchedModel; }
+
+ /// \brief Return true if this machine model includes cycle-to-cycle itinerary
+ /// data.
+ ///
+ /// This models scheduling at each stage in the processor pipeline.
+ bool hasInstrItineraries() const;
+
+ const InstrItineraryData *getInstrItineraries() const {
+ if (hasInstrItineraries())
+ return &InstrItins;
+ return 0;
+ }
+
+ /// \brief Identify the processor corresponding to the current subtarget.
+ unsigned getProcessorID() const { return SchedModel.getProcessorID(); }
- /// Return true if this machine model includes cycle-to-cycle itinerary
- /// data. This models scheduling at each stage in the processor pipeline.
- bool hasInstrItineraries() const { return !InstrItins.isEmpty(); }
-
- /// computeOperandLatency - Compute and return the latency of the given data
- /// dependent def and use when the operand indices are already known. UseMI
- /// may be NULL for an unknown user.
+ /// \brief Maximum number of micro-ops that may be scheduled per cycle.
+ unsigned getIssueWidth() const { return SchedModel.IssueWidth; }
+
+ /// \brief Return the number of issue slots required for this MI.
+ unsigned getNumMicroOps(MachineInstr *MI) const;
+
+ /// \brief Compute operand latency based on the available machine model.
+ ///
+ /// Computes and return the latency of the given data dependent def and use
+ /// when the operand indices are already known. UseMI may be NULL for an
+ /// unknown user.
///
/// FindMin may be set to get the minimum vs. expected latency. Minimum
/// latency is used for scheduling groups, while expected latency is for
@@ -62,7 +91,20 @@
const MachineInstr *UseMI, unsigned UseOperIdx,
bool FindMin) const;
- unsigned getProcessorID() const { return SchedModel.getProcessorID(); }
+ /// \brief Compute the instruction latency based on the available machine
+ /// model.
+ ///
+ /// Compute and return the expected latency of this instruction independent of
+ /// a particular use. computeOperandLatency is the prefered API, but this is
+ /// occasionally useful to help estimate instruction cost.
+ unsigned computeInstrLatency(const MachineInstr *MI) const;
+
+ /// \brief Output dependency latency of a pair of defs of the same register.
+ ///
+ /// This is typically one cycle.
+ unsigned computeOutputLatency(const MachineInstr *DefMI, unsigned DefIdx,
+ const MachineInstr *DepMI) const;
+
private:
/// getDefLatency is a helper for computeOperandLatency. Return the
Modified: llvm/branches/R600/include/llvm/DIBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/DIBuilder.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/DIBuilder.h (original)
+++ llvm/branches/R600/include/llvm/DIBuilder.h Thu Oct 11 16:28:00 2012
@@ -331,12 +331,10 @@
/// @param SizeInBits Member size.
/// @param AlignInBits Member alignment.
/// @param Elements Enumeration elements.
- /// @param Flags Flags (e.g. forward decl)
DIType createEnumerationType(DIDescriptor Scope, StringRef Name,
DIFile File, unsigned LineNumber,
uint64_t SizeInBits, uint64_t AlignInBits,
- DIArray Elements, DIType ClassType,
- unsigned Flags);
+ DIArray Elements, DIType ClassType);
/// createSubroutineType - Create subroutine type.
/// @param File File in which this subroutine is defined.
@@ -357,7 +355,8 @@
/// createForwardDecl - Create a temporary forward-declared type.
DIType createForwardDecl(unsigned Tag, StringRef Name, DIDescriptor Scope,
- DIFile F, unsigned Line, unsigned RuntimeLang = 0);
+ DIFile F, unsigned Line, unsigned RuntimeLang = 0,
+ uint64_t SizeInBits = 0, uint64_t AlignInBits = 0);
/// retainType - Retain DIType in a module even if it is not referenced
/// through debug info anchors.
Copied: llvm/branches/R600/include/llvm/DataLayout.h (from r165622, llvm/branches/R600/include/llvm/Target/TargetData.h)
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/DataLayout.h?p2=llvm/branches/R600/include/llvm/DataLayout.h&p1=llvm/branches/R600/include/llvm/Target/TargetData.h&r1=165622&r2=165748&rev=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Target/TargetData.h (original)
+++ llvm/branches/R600/include/llvm/DataLayout.h Thu Oct 11 16:28:00 2012
@@ -1,4 +1,4 @@
-//===-- llvm/Target/TargetData.h - Data size & alignment info ---*- C++ -*-===//
+//===--------- llvm/DataLayout.h - Data size & alignment info ---*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// This file defines target properties related to datatype size/offset/alignment
+// This file defines layout properties related to datatype size/offset/alignment
// information. It uses lazy annotations to cache information about how
// structure types are laid out and used.
//
@@ -17,11 +17,12 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_TARGET_TARGETDATA_H
-#define LLVM_TARGET_TARGETDATA_H
+#ifndef LLVM_DATALAYOUT_H
+#define LLVM_DATALAYOUT_H
#include "llvm/Pass.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/DataTypes.h"
namespace llvm {
@@ -36,7 +37,7 @@
template<typename T>
class ArrayRef;
-/// Enum used to categorize the alignment types stored by TargetAlignElem
+/// Enum used to categorize the alignment types stored by LayoutAlignElem
enum AlignTypeEnum {
INTEGER_ALIGN = 'i', ///< Integer type alignment
VECTOR_ALIGN = 'v', ///< Vector type alignment
@@ -45,38 +46,55 @@
STACK_ALIGN = 's' ///< Stack objects alignment
};
-/// Target alignment element.
+/// Layout alignment element.
///
-/// Stores the alignment data associated with a given alignment type (pointer,
-/// integer, vector, float) and type bit width.
+/// Stores the alignment data associated with a given alignment type (integer,
+/// vector, float) and type bit width.
///
/// @note The unusual order of elements in the structure attempts to reduce
/// padding and make the structure slightly more cache friendly.
-struct TargetAlignElem {
+struct LayoutAlignElem {
unsigned AlignType : 8; ///< Alignment type (AlignTypeEnum)
unsigned TypeBitWidth : 24; ///< Type bit width
unsigned ABIAlign : 16; ///< ABI alignment for this type/bitw
unsigned PrefAlign : 16; ///< Pref. alignment for this type/bitw
/// Initializer
- static TargetAlignElem get(AlignTypeEnum align_type, unsigned abi_align,
+ static LayoutAlignElem get(AlignTypeEnum align_type, unsigned abi_align,
unsigned pref_align, uint32_t bit_width);
/// Equality predicate
- bool operator==(const TargetAlignElem &rhs) const;
+ bool operator==(const LayoutAlignElem &rhs) const;
};
-/// TargetData - This class holds a parsed version of the target data layout
+/// Layout pointer alignment element.
+///
+/// Stores the alignment data associated with a given pointer and address space.
+///
+/// @note The unusual order of elements in the structure attempts to reduce
+/// padding and make the structure slightly more cache friendly.
+struct PointerAlignElem {
+ unsigned ABIAlign; ///< ABI alignment for this type/bitw
+ unsigned PrefAlign; ///< Pref. alignment for this type/bitw
+ uint32_t TypeBitWidth; ///< Type bit width
+ uint32_t AddressSpace; ///< Address space for the pointer type
+
+ /// Initializer
+ static PointerAlignElem get(uint32_t addr_space, unsigned abi_align,
+ unsigned pref_align, uint32_t bit_width);
+ /// Equality predicate
+ bool operator==(const PointerAlignElem &rhs) const;
+};
+
+
+/// DataLayout - This class holds a parsed version of the target data layout
/// string in a module and provides methods for querying it. The target data
/// layout string is specified *by the target* - a frontend generating LLVM IR
/// is required to generate the right target data for the target being codegen'd
/// to. If some measure of portability is desired, an empty string may be
/// specified in the module.
-class TargetData : public ImmutablePass {
+class DataLayout : public ImmutablePass {
private:
bool LittleEndian; ///< Defaults to false
- unsigned PointerMemSize; ///< Pointer size in bytes
- unsigned PointerABIAlign; ///< Pointer ABI alignment
- unsigned PointerPrefAlign; ///< Pointer preferred alignment
unsigned StackNaturalAlign; ///< Stack natural alignment
SmallVector<unsigned char, 8> LegalIntWidths; ///< Legal Integers.
@@ -85,13 +103,18 @@
///
/// @sa init().
/// @note Could support multiple size pointer alignments, e.g., 32-bit
- /// pointers vs. 64-bit pointers by extending TargetAlignment, but for now,
+ /// pointers vs. 64-bit pointers by extending LayoutAlignment, but for now,
/// we don't.
- SmallVector<TargetAlignElem, 16> Alignments;
+ SmallVector<LayoutAlignElem, 16> Alignments;
+ DenseMap<unsigned, PointerAlignElem> Pointers;
/// InvalidAlignmentElem - This member is a signal that a requested alignment
/// type and bit width were not found in the SmallVector.
- static const TargetAlignElem InvalidAlignmentElem;
+ static const LayoutAlignElem InvalidAlignmentElem;
+
+ /// InvalidPointerElem - This member is a signal that a requested pointer
+ /// type and bit width were not found in the DenseSet.
+ static const PointerAlignElem InvalidPointerElem;
// The StructType -> StructLayout map.
mutable void *LayoutMap;
@@ -101,18 +124,31 @@
unsigned pref_align, uint32_t bit_width);
unsigned getAlignmentInfo(AlignTypeEnum align_type, uint32_t bit_width,
bool ABIAlign, Type *Ty) const;
+
+ //! Set/initialize pointer alignments
+ void setPointerAlignment(uint32_t addr_space, unsigned abi_align,
+ unsigned pref_align, uint32_t bit_width);
+
//! Internal helper method that returns requested alignment for type.
unsigned getAlignment(Type *Ty, bool abi_or_pref) const;
/// Valid alignment predicate.
///
- /// Predicate that tests a TargetAlignElem reference returned by get() against
+ /// Predicate that tests a LayoutAlignElem reference returned by get() against
/// InvalidAlignmentElem.
- bool validAlignment(const TargetAlignElem &align) const {
+ bool validAlignment(const LayoutAlignElem &align) const {
return &align != &InvalidAlignmentElem;
}
- /// Initialise a TargetData object with default values, ensure that the
+ /// Valid pointer predicate.
+ ///
+ /// Predicate that tests a PointerAlignElem reference returned by get() against
+ /// InvalidPointerElem.
+ bool validPointer(const PointerAlignElem &align) const {
+ return &align != &InvalidPointerElem;
+ }
+
+ /// Initialise a DataLayout object with default values, ensure that the
/// target data pass is registered.
void init();
@@ -121,43 +157,42 @@
///
/// @note This has to exist, because this is a pass, but it should never be
/// used.
- TargetData();
+ DataLayout();
- /// Constructs a TargetData from a specification string. See init().
- explicit TargetData(StringRef TargetDescription)
+ /// Constructs a DataLayout from a specification string. See init().
+ explicit DataLayout(StringRef LayoutDescription)
: ImmutablePass(ID) {
- std::string errMsg = parseSpecifier(TargetDescription, this);
+ std::string errMsg = parseSpecifier(LayoutDescription, this);
assert(errMsg == "" && "Invalid target data layout string.");
(void)errMsg;
}
/// Parses a target data specification string. Returns an error message
/// if the string is malformed, or the empty string on success. Optionally
- /// initialises a TargetData object if passed a non-null pointer.
- static std::string parseSpecifier(StringRef TargetDescription, TargetData* td = 0);
+ /// initialises a DataLayout object if passed a non-null pointer.
+ static std::string parseSpecifier(StringRef LayoutDescription,
+ DataLayout* td = 0);
/// Initialize target data from properties stored in the module.
- explicit TargetData(const Module *M);
+ explicit DataLayout(const Module *M);
- TargetData(const TargetData &TD) :
+ DataLayout(const DataLayout &TD) :
ImmutablePass(ID),
LittleEndian(TD.isLittleEndian()),
- PointerMemSize(TD.PointerMemSize),
- PointerABIAlign(TD.PointerABIAlign),
- PointerPrefAlign(TD.PointerPrefAlign),
LegalIntWidths(TD.LegalIntWidths),
Alignments(TD.Alignments),
+ Pointers(TD.Pointers),
LayoutMap(0)
{ }
- ~TargetData(); // Not virtual, do not subclass this class
+ ~DataLayout(); // Not virtual, do not subclass this class
- /// Target endianness...
+ /// Layout endianness...
bool isLittleEndian() const { return LittleEndian; }
bool isBigEndian() const { return !LittleEndian; }
/// getStringRepresentation - Return the string representation of the
- /// TargetData. This representation is in the same format accepted by the
+ /// DataLayout. This representation is in the same format accepted by the
/// string constructor above.
std::string getStringRepresentation() const;
@@ -195,15 +230,46 @@
return false;
}
- /// Target pointer alignment
- unsigned getPointerABIAlignment() const { return PointerABIAlign; }
+ /// Layout pointer alignment
+ /// FIXME: The defaults need to be removed once all of
+ /// the backends/clients are updated.
+ unsigned getPointerABIAlignment(unsigned AS = 0) const {
+ DenseMap<unsigned, PointerAlignElem>::const_iterator val = Pointers.find(AS);
+ if (val == Pointers.end()) {
+ val = Pointers.find(0);
+ }
+ return val->second.ABIAlign;
+ }
/// Return target's alignment for stack-based pointers
- unsigned getPointerPrefAlignment() const { return PointerPrefAlign; }
- /// Target pointer size
- unsigned getPointerSize() const { return PointerMemSize; }
- /// Target pointer size, in bits
- unsigned getPointerSizeInBits() const { return 8*PointerMemSize; }
-
+ /// FIXME: The defaults need to be removed once all of
+ /// the backends/clients are updated.
+ unsigned getPointerPrefAlignment(unsigned AS = 0) const {
+ DenseMap<unsigned, PointerAlignElem>::const_iterator val = Pointers.find(AS);
+ if (val == Pointers.end()) {
+ val = Pointers.find(0);
+ }
+ return val->second.PrefAlign;
+ }
+ /// Layout pointer size
+ /// FIXME: The defaults need to be removed once all of
+ /// the backends/clients are updated.
+ unsigned getPointerSize(unsigned AS = 0) const {
+ DenseMap<unsigned, PointerAlignElem>::const_iterator val = Pointers.find(AS);
+ if (val == Pointers.end()) {
+ val = Pointers.find(0);
+ }
+ return val->second.TypeBitWidth;
+ }
+ /// Layout pointer size, in bits
+ /// FIXME: The defaults need to be removed once all of
+ /// the backends/clients are updated.
+ unsigned getPointerSizeInBits(unsigned AS = 0) const {
+ DenseMap<unsigned, PointerAlignElem>::const_iterator val = Pointers.find(AS);
+ if (val == Pointers.end()) {
+ val = Pointers.find(0);
+ }
+ return 8*val->second.TypeBitWidth;
+ }
/// Size examples:
///
/// Type SizeInBits StoreSizeInBits AllocSizeInBits[*]
@@ -281,8 +347,9 @@
/// getIntPtrType - Return an unsigned integer type that is the same size or
/// greater to the host pointer size.
- ///
- IntegerType *getIntPtrType(LLVMContext &C) const;
+ /// FIXME: Need to remove the default argument when the rest of the LLVM code
+ /// base has been updated.
+ IntegerType *getIntPtrType(LLVMContext &C, unsigned AddressSpace = 0) const;
/// getIndexedOffset - return the offset from the beginning of the type for
/// the specified indices. This is used to implement getelementptr.
@@ -318,7 +385,7 @@
};
/// StructLayout - used to lazily calculate structure layout information for a
-/// target machine, based on the TargetData structure.
+/// target machine, based on the DataLayout structure.
///
class StructLayout {
uint64_t StructSize;
@@ -354,8 +421,8 @@
}
private:
- friend class TargetData; // Only TargetData can create this class
- StructLayout(StructType *ST, const TargetData &TD);
+ friend class DataLayout; // Only DataLayout can create this class
+ StructLayout(StructType *ST, const DataLayout &TD);
};
} // End llvm namespace
Modified: llvm/branches/R600/include/llvm/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/DebugInfo.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/DebugInfo.h (original)
+++ llvm/branches/R600/include/llvm/DebugInfo.h Thu Oct 11 16:28:00 2012
@@ -81,6 +81,7 @@
GlobalVariable *getGlobalVariableField(unsigned Elt) const;
Constant *getConstantField(unsigned Elt) const;
Function *getFunctionField(unsigned Elt) const;
+ void replaceFunctionField(unsigned Elt, Function *F);
public:
explicit DIDescriptor() : DbgNode(0) {}
@@ -562,6 +563,7 @@
bool describes(const Function *F);
Function *getFunction() const { return getFunctionField(16); }
+ void replaceFunction(Function *F) { replaceFunctionField(16, F); }
DIArray getTemplateParams() const { return getFieldAs<DIArray>(17); }
DISubprogram getFunctionDeclaration() const {
return getFieldAs<DISubprogram>(18);
Modified: llvm/branches/R600/include/llvm/DerivedTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/DerivedTypes.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/DerivedTypes.h (original)
+++ llvm/branches/R600/include/llvm/DerivedTypes.h Thu Oct 11 16:28:00 2012
@@ -19,8 +19,8 @@
#define LLVM_DERIVED_TYPES_H
#include "llvm/Type.h"
-#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -184,7 +184,7 @@
/// Independent of what kind of struct you have, the body of a struct type are
/// laid out in memory consequtively with the elements directly one after the
/// other (if the struct is packed) or (if not packed) with padding between the
-/// elements as defined by TargetData (which is required to match what the code
+/// elements as defined by DataLayout (which is required to match what the code
/// generator for a target expects).
///
class StructType : public CompositeType {
Modified: llvm/branches/R600/include/llvm/ExecutionEngine/ExecutionEngine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/ExecutionEngine/ExecutionEngine.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/ExecutionEngine/ExecutionEngine.h (original)
+++ llvm/branches/R600/include/llvm/ExecutionEngine/ExecutionEngine.h Thu Oct 11 16:28:00 2012
@@ -42,7 +42,7 @@
class MachineCodeInfo;
class Module;
class MutexGuard;
-class TargetData;
+class DataLayout;
class Triple;
class Type;
@@ -104,7 +104,7 @@
ExecutionEngineState EEState;
/// The target data for the platform for which execution is being performed.
- const TargetData *TD;
+ const DataLayout *TD;
/// Whether lazy JIT compilation is enabled.
bool CompilingLazily;
@@ -123,7 +123,7 @@
/// optimize for the case where there is only one module.
SmallVector<Module*, 1> Modules;
- void setTargetData(const TargetData *td) { TD = td; }
+ void setDataLayout(const DataLayout *td) { TD = td; }
/// getMemoryforGV - Allocate memory for a global variable.
virtual char *getMemoryForGV(const GlobalVariable *GV);
@@ -213,7 +213,7 @@
//===--------------------------------------------------------------------===//
- const TargetData *getTargetData() const { return TD; }
+ const DataLayout *getDataLayout() const { return TD; }
/// removeModule - Remove a Module from the list of modules. Returns true if
/// M is found.
Added: llvm/branches/R600/include/llvm/ExecutionEngine/ObjectBuffer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/ExecutionEngine/ObjectBuffer.h?rev=165748&view=auto
==============================================================================
--- llvm/branches/R600/include/llvm/ExecutionEngine/ObjectBuffer.h (added)
+++ llvm/branches/R600/include/llvm/ExecutionEngine/ObjectBuffer.h Thu Oct 11 16:28:00 2012
@@ -0,0 +1,80 @@
+//===---- ObjectBuffer.h - Utility class to wrap object image memory -----===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares a wrapper class to hold the memory into which an
+// object will be generated.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_EXECUTIONENGINE_OBJECTBUFFER_H
+#define LLVM_EXECUTIONENGINE_OBJECTBUFFER_H
+
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/OwningPtr.h"
+#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/MemoryBuffer.h"
+
+namespace llvm {
+
+/// ObjectBuffer - This class acts as a container for the memory buffer used during
+/// generation and loading of executable objects using MCJIT and RuntimeDyld. The
+/// underlying memory for the object will be owned by the ObjectBuffer instance
+/// throughout its lifetime. The getMemBuffer() method provides a way to create a
+/// MemoryBuffer wrapper object instance to be owned by other classes (such as
+/// ObjectFile) as needed, but the MemoryBuffer instance returned does not own the
+/// actual memory it points to.
+class ObjectBuffer {
+public:
+ ObjectBuffer() {}
+ ObjectBuffer(MemoryBuffer* Buf) : Buffer(Buf) {}
+ virtual ~ObjectBuffer() {}
+
+ /// getMemBuffer - Like MemoryBuffer::getMemBuffer() this function
+ /// returns a pointer to an object that is owned by the caller. However,
+ /// the caller does not take ownership of the underlying memory.
+ MemoryBuffer *getMemBuffer() const {
+ return MemoryBuffer::getMemBuffer(Buffer->getBuffer(), "", false);
+ }
+
+ const char *getBufferStart() const { return Buffer->getBufferStart(); }
+ size_t getBufferSize() const { return Buffer->getBufferSize(); }
+
+protected:
+ // The memory contained in an ObjectBuffer
+ OwningPtr<MemoryBuffer> Buffer;
+};
+
+/// ObjectBufferStream - This class encapsulates the SmallVector and
+/// raw_svector_ostream needed to generate an object using MC code emission
+/// while providing a common ObjectBuffer interface for access to the
+/// memory once the object has been generated.
+class ObjectBufferStream : public ObjectBuffer {
+public:
+ ObjectBufferStream() : OS(SV) {}
+ virtual ~ObjectBufferStream() {}
+
+ raw_ostream &getOStream() { return OS; }
+ void flush()
+ {
+ OS.flush();
+
+ // Make the data accessible via the ObjectBuffer::Buffer
+ Buffer.reset(MemoryBuffer::getMemBuffer(StringRef(SV.data(), SV.size()),
+ "",
+ false));
+ }
+
+protected:
+ SmallVector<char, 4096> SV; // Working buffer into which we JIT.
+ raw_svector_ostream OS; // streaming wrapper
+};
+
+} // namespace llvm
+
+#endif
Copied: llvm/branches/R600/include/llvm/ExecutionEngine/ObjectImage.h (from r165622, llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImage.h)
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/ExecutionEngine/ObjectImage.h?p2=llvm/branches/R600/include/llvm/ExecutionEngine/ObjectImage.h&p1=llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImage.h&r1=165622&r2=165748&rev=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImage.h (original)
+++ llvm/branches/R600/include/llvm/ExecutionEngine/ObjectImage.h Thu Oct 11 16:28:00 2012
@@ -1,59 +1,61 @@
-//===---- ObjectImage.h - Format independent executuable object image -----===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares a file format independent ObjectImage class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_RUNTIMEDYLD_OBJECT_IMAGE_H
-#define LLVM_RUNTIMEDYLD_OBJECT_IMAGE_H
-
-#include "llvm/Object/ObjectFile.h"
-
-namespace llvm {
-
-class ObjectImage {
- ObjectImage() LLVM_DELETED_FUNCTION;
- ObjectImage(const ObjectImage &other) LLVM_DELETED_FUNCTION;
-protected:
- object::ObjectFile *ObjFile;
-
-public:
- ObjectImage(object::ObjectFile *Obj) { ObjFile = Obj; }
- virtual ~ObjectImage() {}
-
- virtual object::symbol_iterator begin_symbols() const
- { return ObjFile->begin_symbols(); }
- virtual object::symbol_iterator end_symbols() const
- { return ObjFile->end_symbols(); }
-
- virtual object::section_iterator begin_sections() const
- { return ObjFile->begin_sections(); }
- virtual object::section_iterator end_sections() const
- { return ObjFile->end_sections(); }
-
- virtual /* Triple::ArchType */ unsigned getArch() const
- { return ObjFile->getArch(); }
-
- // Subclasses can override these methods to update the image with loaded
- // addresses for sections and common symbols
- virtual void updateSectionAddress(const object::SectionRef &Sec,
- uint64_t Addr) {}
- virtual void updateSymbolAddress(const object::SymbolRef &Sym, uint64_t Addr)
- {}
-
- // Subclasses can override these methods to provide JIT debugging support
- virtual void registerWithDebugger() {}
- virtual void deregisterWithDebugger() {}
-};
-
-} // end namespace llvm
-
-#endif // LLVM_RUNTIMEDYLD_OBJECT_IMAGE_H
-
+//===---- ObjectImage.h - Format independent executuable object image -----===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares a file format independent ObjectImage class.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_EXECUTIONENGINE_OBJECTIMAGE_H
+#define LLVM_EXECUTIONENGINE_OBJECTIMAGE_H
+
+#include "llvm/Object/ObjectFile.h"
+#include "llvm/ExecutionEngine/ObjectBuffer.h"
+
+namespace llvm {
+
+
+/// ObjectImage - A container class that represents an ObjectFile that has been
+/// or is in the process of being loaded into memory for execution.
+class ObjectImage {
+ ObjectImage() LLVM_DELETED_FUNCTION;
+ ObjectImage(const ObjectImage &other) LLVM_DELETED_FUNCTION;
+
+protected:
+ OwningPtr<ObjectBuffer> Buffer;
+
+public:
+ ObjectImage(ObjectBuffer *Input) : Buffer(Input) {}
+ virtual ~ObjectImage() {}
+
+ virtual object::symbol_iterator begin_symbols() const = 0;
+ virtual object::symbol_iterator end_symbols() const = 0;
+
+ virtual object::section_iterator begin_sections() const = 0;
+ virtual object::section_iterator end_sections() const = 0;
+
+ virtual /* Triple::ArchType */ unsigned getArch() const = 0;
+
+ // Subclasses can override these methods to update the image with loaded
+ // addresses for sections and common symbols
+ virtual void updateSectionAddress(const object::SectionRef &Sec,
+ uint64_t Addr) = 0;
+ virtual void updateSymbolAddress(const object::SymbolRef &Sym,
+ uint64_t Addr) = 0;
+
+ virtual StringRef getData() const = 0;
+
+ // Subclasses can override these methods to provide JIT debugging support
+ virtual void registerWithDebugger() = 0;
+ virtual void deregisterWithDebugger() = 0;
+};
+
+} // end namespace llvm
+
+#endif // LLVM_RUNTIMEDYLD_OBJECT_IMAGE_H
+
Modified: llvm/branches/R600/include/llvm/ExecutionEngine/RuntimeDyld.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/ExecutionEngine/RuntimeDyld.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/ExecutionEngine/RuntimeDyld.h (original)
+++ llvm/branches/R600/include/llvm/ExecutionEngine/RuntimeDyld.h Thu Oct 11 16:28:00 2012
@@ -15,12 +15,13 @@
#define LLVM_RUNTIME_DYLD_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/ExecutionEngine/ObjectBuffer.h"
#include "llvm/Support/Memory.h"
namespace llvm {
class RuntimeDyldImpl;
-class MemoryBuffer;
+class ObjectImage;
// RuntimeDyld clients often want to handle the memory management of
// what gets placed where. For JIT clients, this is an abstraction layer
@@ -65,8 +66,11 @@
RuntimeDyld(RTDyldMemoryManager*);
~RuntimeDyld();
- /// Load an in-memory object file into the dynamic linker.
- bool loadObject(MemoryBuffer *InputBuffer);
+ /// loadObject - prepare the object contained in the input buffer for
+ /// execution. Ownership of the input buffer is transferred to the
+ /// ObjectImage instance returned from this function if successful.
+ /// In the case of load failure, the input buffer will be deleted.
+ ObjectImage *loadObject(ObjectBuffer *InputBuffer);
/// Get the address of our local copy of the symbol. This may or may not
/// be the address used for relocation (clients can copy the data around
Modified: llvm/branches/R600/include/llvm/Function.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Function.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Function.h (original)
+++ llvm/branches/R600/include/llvm/Function.h Thu Oct 11 16:28:00 2012
@@ -176,9 +176,11 @@
/// addFnAttr - Add function attributes to this function.
///
- void addFnAttr(Attributes N) {
+ void addFnAttr(Attributes::AttrVal N) {
// Function Attributes are stored at ~0 index
- addAttribute(~0U, N);
+ Attributes::Builder B;
+ B.addAttribute(N);
+ addAttribute(~0U, Attributes::get(B));
}
/// removeFnAttr - Remove function attributes from this function.
@@ -195,16 +197,17 @@
void setGC(const char *Str);
void clearGC();
+
+ /// getRetAttributes - Return the return attributes for querying.
+ Attributes getRetAttributes() const {
+ return AttributeList.getRetAttributes();
+ }
+
/// getParamAttributes - Return the parameter attributes for querying.
Attributes getParamAttributes(unsigned Idx) const {
return AttributeList.getParamAttributes(Idx);
}
- /// @brief Determine whether the function has the given attribute.
- bool paramHasAttr(unsigned i, Attributes attr) const {
- return AttributeList.paramHasAttr(i, attr);
- }
-
/// addAttribute - adds the attribute to the list of attributes.
void addAttribute(unsigned i, Attributes attr);
@@ -218,50 +221,44 @@
/// @brief Determine if the function does not access memory.
bool doesNotAccessMemory() const {
- return getFnAttributes().hasReadNoneAttr();
+ return getFnAttributes().hasAttribute(Attributes::ReadNone);
}
- void setDoesNotAccessMemory(bool DoesNotAccessMemory = true) {
- if (DoesNotAccessMemory) addFnAttr(Attribute::ReadNone);
- else removeFnAttr(Attribute::ReadNone);
+ void setDoesNotAccessMemory() {
+ addFnAttr(Attributes::ReadNone);
}
/// @brief Determine if the function does not access or only reads memory.
bool onlyReadsMemory() const {
- return doesNotAccessMemory() || getFnAttributes().hasReadOnlyAttr();
+ return doesNotAccessMemory() ||
+ getFnAttributes().hasAttribute(Attributes::ReadOnly);
}
- void setOnlyReadsMemory(bool OnlyReadsMemory = true) {
- if (OnlyReadsMemory) addFnAttr(Attribute::ReadOnly);
- else removeFnAttr(Attribute::ReadOnly | Attribute::ReadNone);
+ void setOnlyReadsMemory() {
+ addFnAttr(Attributes::ReadOnly);
}
/// @brief Determine if the function cannot return.
bool doesNotReturn() const {
- return getFnAttributes().hasNoReturnAttr();
+ return getFnAttributes().hasAttribute(Attributes::NoReturn);
}
- void setDoesNotReturn(bool DoesNotReturn = true) {
- if (DoesNotReturn) addFnAttr(Attribute::NoReturn);
- else removeFnAttr(Attribute::NoReturn);
+ void setDoesNotReturn() {
+ addFnAttr(Attributes::NoReturn);
}
/// @brief Determine if the function cannot unwind.
bool doesNotThrow() const {
- return getFnAttributes().hasNoUnwindAttr();
+ return getFnAttributes().hasAttribute(Attributes::NoUnwind);
}
- void setDoesNotThrow(bool DoesNotThrow = true) {
- if (DoesNotThrow) addFnAttr(Attribute::NoUnwind);
- else removeFnAttr(Attribute::NoUnwind);
+ void setDoesNotThrow() {
+ addFnAttr(Attributes::NoUnwind);
}
/// @brief True if the ABI mandates (or the user requested) that this
/// function be in a unwind table.
bool hasUWTable() const {
- return getFnAttributes().hasUWTableAttr();
+ return getFnAttributes().hasAttribute(Attributes::UWTable);
}
- void setHasUWTable(bool HasUWTable = true) {
- if (HasUWTable)
- addFnAttr(Attribute::UWTable);
- else
- removeFnAttr(Attribute::UWTable);
+ void setHasUWTable() {
+ addFnAttr(Attributes::UWTable);
}
/// @brief True if this function needs an unwind table.
@@ -272,28 +269,29 @@
/// @brief Determine if the function returns a structure through first
/// pointer argument.
bool hasStructRetAttr() const {
- return getParamAttributes(1).hasStructRetAttr();
+ return getParamAttributes(1).hasAttribute(Attributes::StructRet);
}
/// @brief Determine if the parameter does not alias other parameters.
/// @param n The parameter to check. 1 is the first parameter, 0 is the return
bool doesNotAlias(unsigned n) const {
- return n != 0 ? getParamAttributes(n).hasNoAliasAttr() :
- AttributeList.getRetAttributes().hasNoAliasAttr();
+ return getParamAttributes(n).hasAttribute(Attributes::NoAlias);
}
- void setDoesNotAlias(unsigned n, bool DoesNotAlias = true) {
- if (DoesNotAlias) addAttribute(n, Attribute::NoAlias);
- else removeAttribute(n, Attribute::NoAlias);
+ void setDoesNotAlias(unsigned n) {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::NoAlias);
+ addAttribute(n, Attributes::get(B));
}
/// @brief Determine if the parameter can be captured.
/// @param n The parameter to check. 1 is the first parameter, 0 is the return
bool doesNotCapture(unsigned n) const {
- return getParamAttributes(n).hasNoCaptureAttr();
+ return getParamAttributes(n).hasAttribute(Attributes::NoCapture);
}
- void setDoesNotCapture(unsigned n, bool DoesNotCapture = true) {
- if (DoesNotCapture) addAttribute(n, Attribute::NoCapture);
- else removeAttribute(n, Attribute::NoCapture);
+ void setDoesNotCapture(unsigned n) {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::NoCapture);
+ addAttribute(n, Attributes::get(B));
}
/// copyAttributesFrom - copy all additional attributes (those not needed to
Modified: llvm/branches/R600/include/llvm/InitializePasses.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/InitializePasses.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/InitializePasses.h (original)
+++ llvm/branches/R600/include/llvm/InitializePasses.h Thu Oct 11 16:28:00 2012
@@ -246,7 +246,7 @@
void initializeTailCallElimPass(PassRegistry&);
void initializeTailDuplicatePassPass(PassRegistry&);
void initializeTargetPassConfigPass(PassRegistry&);
-void initializeTargetDataPass(PassRegistry&);
+void initializeDataLayoutPass(PassRegistry&);
void initializeTargetLibraryInfoPass(PassRegistry&);
void initializeTwoAddressInstructionPassPass(PassRegistry&);
void initializeTypeBasedAliasAnalysisPass(PassRegistry&);
Modified: llvm/branches/R600/include/llvm/InstrTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/InstrTypes.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/InstrTypes.h (original)
+++ llvm/branches/R600/include/llvm/InstrTypes.h Thu Oct 11 16:28:00 2012
@@ -563,7 +563,7 @@
/// IntPtrTy argument is used to make accurate determinations for casts
/// involving Integer and Pointer types. They are no-op casts if the integer
/// is the same size as the pointer. However, pointer size varies with
- /// platform. Generally, the result of TargetData::getIntPtrType() should be
+ /// platform. Generally, the result of DataLayout::getIntPtrType() should be
/// passed in. If that's not available, use Type::Int64Ty, which will make
/// the isNoopCast call conservative.
/// @brief Determine if the described cast is a no-op cast.
Modified: llvm/branches/R600/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Instructions.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Instructions.h (original)
+++ llvm/branches/R600/include/llvm/Instructions.h Thu Oct 11 16:28:00 2012
@@ -778,7 +778,7 @@
static Type *getIndexedType(Type *Ptr, ArrayRef<Constant *> IdxList);
static Type *getIndexedType(Type *Ptr, ArrayRef<uint64_t> IdxList);
- /// getIndexedType - Returns the address space used by the GEP pointer.
+ /// getAddressSpace - Returns the address space used by the GEP pointer.
///
static unsigned getAddressSpace(Value *Ptr);
@@ -798,7 +798,7 @@
}
unsigned getPointerAddressSpace() const {
- return cast<PointerType>(getType())->getAddressSpace();
+ return cast<PointerType>(getPointerOperandType())->getAddressSpace();
}
/// getPointerOperandType - Method to return the pointer operand as a
@@ -1267,13 +1267,11 @@
/// removeAttribute - removes the attribute from the list of attributes.
void removeAttribute(unsigned i, Attributes attr);
- /// \brief Return true if this call has the given attribute.
- bool hasFnAttr(Attributes N) const {
- return paramHasAttr(~0, N);
- }
+ /// @brief Determine whether this call has the given attribute.
+ bool hasFnAttr(Attributes::AttrVal A) const;
- /// @brief Determine whether the call or the callee has the given attribute.
- bool paramHasAttr(unsigned i, Attributes attr) const;
+ /// @brief Determine whether the call or the callee has the given attributes.
+ bool paramHasAttr(unsigned i, Attributes::AttrVal A) const;
/// @brief Extract the alignment for a call or parameter (0=unknown).
unsigned getParamAlignment(unsigned i) const {
@@ -1281,63 +1279,72 @@
}
/// @brief Return true if the call should not be inlined.
- bool isNoInline() const { return hasFnAttr(Attribute::NoInline); }
- void setIsNoInline(bool Value = true) {
- if (Value) addAttribute(~0, Attribute::NoInline);
- else removeAttribute(~0, Attribute::NoInline);
+ bool isNoInline() const { return hasFnAttr(Attributes::NoInline); }
+ void setIsNoInline() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::NoInline);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Return true if the call can return twice
bool canReturnTwice() const {
- return hasFnAttr(Attribute::ReturnsTwice);
+ return hasFnAttr(Attributes::ReturnsTwice);
}
- void setCanReturnTwice(bool Value = true) {
- if (Value) addAttribute(~0, Attribute::ReturnsTwice);
- else removeAttribute(~0, Attribute::ReturnsTwice);
+ void setCanReturnTwice() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::ReturnsTwice);
+ addAttribute(~0U, Attributes::get(B));
}
/// @brief Determine if the call does not access memory.
bool doesNotAccessMemory() const {
- return hasFnAttr(Attribute::ReadNone);
+ return hasFnAttr(Attributes::ReadNone);
}
- void setDoesNotAccessMemory(bool NotAccessMemory = true) {
- if (NotAccessMemory) addAttribute(~0, Attribute::ReadNone);
- else removeAttribute(~0, Attribute::ReadNone);
+ void setDoesNotAccessMemory() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::ReadNone);
+ addAttribute(~0U, Attributes::get(B));
}
/// @brief Determine if the call does not access or only reads memory.
bool onlyReadsMemory() const {
- return doesNotAccessMemory() || hasFnAttr(Attribute::ReadOnly);
+ return doesNotAccessMemory() || hasFnAttr(Attributes::ReadOnly);
}
- void setOnlyReadsMemory(bool OnlyReadsMemory = true) {
- if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly);
- else removeAttribute(~0, Attribute::ReadOnly | Attribute::ReadNone);
+ void setOnlyReadsMemory() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::ReadOnly);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Determine if the call cannot return.
- bool doesNotReturn() const { return hasFnAttr(Attribute::NoReturn); }
- void setDoesNotReturn(bool DoesNotReturn = true) {
- if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn);
- else removeAttribute(~0, Attribute::NoReturn);
+ bool doesNotReturn() const { return hasFnAttr(Attributes::NoReturn); }
+ void setDoesNotReturn() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::NoReturn);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Determine if the call cannot unwind.
- bool doesNotThrow() const { return hasFnAttr(Attribute::NoUnwind); }
+ bool doesNotThrow() const { return hasFnAttr(Attributes::NoUnwind); }
void setDoesNotThrow(bool DoesNotThrow = true) {
- if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind);
- else removeAttribute(~0, Attribute::NoUnwind);
+ Attributes::Builder B;
+ B.addAttribute(Attributes::NoUnwind);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Determine if the call returns a structure through first
/// pointer argument.
bool hasStructRetAttr() const {
// Be friendly and also check the callee.
- return paramHasAttr(1, Attribute::StructRet);
+ return paramHasAttr(1, Attributes::StructRet);
}
/// @brief Determine if any call argument is an aggregate passed by value.
bool hasByValArgument() const {
- return AttributeList.hasAttrSomewhere(Attribute::ByVal);
+ for (unsigned I = 0, E = AttributeList.getNumAttrs(); I != E; ++I)
+ if (AttributeList.getAttributesAtIndex(I).hasAttribute(Attributes::ByVal))
+ return true;
+ return false;
}
/// getCalledFunction - Return the function called, or null if this is an
@@ -3029,13 +3036,11 @@
/// removeAttribute - removes the attribute from the list of attributes.
void removeAttribute(unsigned i, Attributes attr);
- /// \brief Return true if this call has the given attribute.
- bool hasFnAttr(Attributes N) const {
- return paramHasAttr(~0, N);
- }
+ /// @brief Determine whether this call has the NoAlias attribute.
+ bool hasFnAttr(Attributes::AttrVal A) const;
- /// @brief Determine whether the call or the callee has the given attribute.
- bool paramHasAttr(unsigned i, Attributes attr) const;
+ /// @brief Determine whether the call or the callee has the given attributes.
+ bool paramHasAttr(unsigned i, Attributes::AttrVal A) const;
/// @brief Extract the alignment for a call or parameter (0=unknown).
unsigned getParamAlignment(unsigned i) const {
@@ -3043,54 +3048,62 @@
}
/// @brief Return true if the call should not be inlined.
- bool isNoInline() const { return hasFnAttr(Attribute::NoInline); }
- void setIsNoInline(bool Value = true) {
- if (Value) addAttribute(~0, Attribute::NoInline);
- else removeAttribute(~0, Attribute::NoInline);
+ bool isNoInline() const { return hasFnAttr(Attributes::NoInline); }
+ void setIsNoInline() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::NoInline);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Determine if the call does not access memory.
bool doesNotAccessMemory() const {
- return hasFnAttr(Attribute::ReadNone);
+ return hasFnAttr(Attributes::ReadNone);
}
- void setDoesNotAccessMemory(bool NotAccessMemory = true) {
- if (NotAccessMemory) addAttribute(~0, Attribute::ReadNone);
- else removeAttribute(~0, Attribute::ReadNone);
+ void setDoesNotAccessMemory() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::ReadNone);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Determine if the call does not access or only reads memory.
bool onlyReadsMemory() const {
- return doesNotAccessMemory() || hasFnAttr(Attribute::ReadOnly);
+ return doesNotAccessMemory() || hasFnAttr(Attributes::ReadOnly);
}
- void setOnlyReadsMemory(bool OnlyReadsMemory = true) {
- if (OnlyReadsMemory) addAttribute(~0, Attribute::ReadOnly);
- else removeAttribute(~0, Attribute::ReadOnly | Attribute::ReadNone);
+ void setOnlyReadsMemory() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::ReadOnly);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Determine if the call cannot return.
- bool doesNotReturn() const { return hasFnAttr(Attribute::NoReturn); }
- void setDoesNotReturn(bool DoesNotReturn = true) {
- if (DoesNotReturn) addAttribute(~0, Attribute::NoReturn);
- else removeAttribute(~0, Attribute::NoReturn);
+ bool doesNotReturn() const { return hasFnAttr(Attributes::NoReturn); }
+ void setDoesNotReturn() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::NoReturn);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Determine if the call cannot unwind.
- bool doesNotThrow() const { return hasFnAttr(Attribute::NoUnwind); }
- void setDoesNotThrow(bool DoesNotThrow = true) {
- if (DoesNotThrow) addAttribute(~0, Attribute::NoUnwind);
- else removeAttribute(~0, Attribute::NoUnwind);
+ bool doesNotThrow() const { return hasFnAttr(Attributes::NoUnwind); }
+ void setDoesNotThrow() {
+ Attributes::Builder B;
+ B.addAttribute(Attributes::NoUnwind);
+ addAttribute(~0, Attributes::get(B));
}
/// @brief Determine if the call returns a structure through first
/// pointer argument.
bool hasStructRetAttr() const {
// Be friendly and also check the callee.
- return paramHasAttr(1, Attribute::StructRet);
+ return paramHasAttr(1, Attributes::StructRet);
}
/// @brief Determine if any call argument is an aggregate passed by value.
bool hasByValArgument() const {
- return AttributeList.hasAttrSomewhere(Attribute::ByVal);
+ for (unsigned I = 0, E = AttributeList.getNumAttrs(); I != E; ++I)
+ if (AttributeList.getAttributesAtIndex(I).hasAttribute(Attributes::ByVal))
+ return true;
+ return false;
}
/// getCalledFunction - Return the function called, or null if this is an
@@ -3638,6 +3651,11 @@
/// @brief Clone an identical IntToPtrInst
virtual IntToPtrInst *clone_impl() const;
+ /// @brief return the address space of the pointer.
+ unsigned getAddressSpace() const {
+ return cast<PointerType>(getType())->getAddressSpace();
+ }
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const IntToPtrInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -3675,6 +3693,11 @@
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
+ /// @brief return the address space of the pointer.
+ unsigned getPointerAddressSpace() const {
+ return cast<PointerType>(getOperand(0)->getType())->getAddressSpace();
+ }
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const PtrToIntInst *) { return true; }
static inline bool classof(const Instruction *I) {
Modified: llvm/branches/R600/include/llvm/MC/MCObjectFileInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/MC/MCObjectFileInfo.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/MC/MCObjectFileInfo.h (original)
+++ llvm/branches/R600/include/llvm/MC/MCObjectFileInfo.h Thu Oct 11 16:28:00 2012
@@ -84,7 +84,8 @@
/// this is the section to emit them into.
const MCSection *CompactUnwindSection;
- /// DwarfAccelNamesSection, DwarfAccelObjCSection
+ /// DwarfAccelNamesSection, DwarfAccelObjCSection,
+ /// DwarfAccelNamespaceSection, DwarfAccelTypesSection -
/// If we use the DWARF accelerated hash tables then we want toe emit these
/// sections.
const MCSection *DwarfAccelNamesSection;
Modified: llvm/branches/R600/include/llvm/MC/MCObjectStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/MC/MCObjectStreamer.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/MC/MCObjectStreamer.h (original)
+++ llvm/branches/R600/include/llvm/MC/MCObjectStreamer.h Thu Oct 11 16:28:00 2012
@@ -72,6 +72,13 @@
virtual void ChangeSection(const MCSection *Section);
virtual void EmitInstruction(const MCInst &Inst);
virtual void EmitInstToFragment(const MCInst &Inst);
+ virtual void EmitBytes(StringRef Data, unsigned AddrSpace);
+ virtual void EmitValueToAlignment(unsigned ByteAlignment,
+ int64_t Value = 0,
+ unsigned ValueSize = 1,
+ unsigned MaxBytesToEmit = 0);
+ virtual void EmitCodeAlignment(unsigned ByteAlignment,
+ unsigned MaxBytesToEmit = 0);
virtual bool EmitValueToOffset(const MCExpr *Offset, unsigned char Value);
virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
const MCSymbol *LastLabel,
Modified: llvm/branches/R600/include/llvm/MC/MCSchedule.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/MC/MCSchedule.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/MC/MCSchedule.h (original)
+++ llvm/branches/R600/include/llvm/MC/MCSchedule.h Thu Oct 11 16:28:00 2012
@@ -27,11 +27,18 @@
#ifndef NDEBUG
const char *Name;
#endif
- unsigned Count; // Number of resource of this kind
+ unsigned NumUnits; // Number of resource of this kind
unsigned SuperIdx; // Index of the resources kind that contains this kind.
+ // Buffered resources may be consumed at some indeterminate cycle after
+ // dispatch (e.g. for instructions that may issue out-of-order). Unbuffered
+ // resources always consume their resource some fixed number of cycles after
+ // dispatch (e.g. for instruction interlocking that may stall the pipeline).
+ bool IsBuffered;
+
bool operator==(const MCProcResourceDesc &Other) const {
- return Count == Other.Count && SuperIdx == Other.SuperIdx;
+ return NumUnits == Other.NumUnits && SuperIdx == Other.SuperIdx
+ && IsBuffered == Other.IsBuffered;
}
};
Modified: llvm/branches/R600/include/llvm/MC/MCSubtargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/MC/MCSubtargetInfo.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/MC/MCSubtargetInfo.h (original)
+++ llvm/branches/R600/include/llvm/MC/MCSubtargetInfo.h Thu Oct 11 16:28:00 2012
@@ -109,6 +109,9 @@
int getReadAdvanceCycles(const MCSchedClassDesc *SC, unsigned UseIdx,
unsigned WriteResID) const {
+ // TODO: The number of read advance entries in a class can be significant
+ // (~50). Consider compressing the WriteID into a dense ID of those that are
+ // used by ReadAdvance and representing them as a bitset.
for (const MCReadAdvanceEntry *I = &ReadAdvanceTable[SC->ReadAdvanceIdx],
*E = I + SC->NumReadAdvanceEntries; I != E; ++I) {
if (I->UseIdx < UseIdx)
Modified: llvm/branches/R600/include/llvm/MC/MCTargetAsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/MC/MCTargetAsmParser.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/MC/MCTargetAsmParser.h (original)
+++ llvm/branches/R600/include/llvm/MC/MCTargetAsmParser.h Thu Oct 11 16:28:00 2012
@@ -50,6 +50,12 @@
virtual bool ParseRegister(unsigned &RegNo, SMLoc &StartLoc,
SMLoc &EndLoc) = 0;
+ /// MapAndConstraints - Map inline assembly operands to MCInst operands
+ /// and an associated constraint.
+ typedef std::pair< unsigned, std::string > MapAndConstraint;
+ typedef SmallVector<MapAndConstraint, 4> MatchInstMapAndConstraints;
+ typedef SmallVectorImpl<MapAndConstraint> MatchInstMapAndConstraintsImpl;
+
/// ParseInstruction - Parse one assembly instruction.
///
/// The parser is positioned following the instruction name. The target
@@ -92,7 +98,7 @@
MatchInstruction(SMLoc IDLoc,
SmallVectorImpl<MCParsedAsmOperand*> &Operands,
MCStreamer &Out, unsigned &Kind, unsigned &Opcode,
- SmallVectorImpl<std::pair< unsigned, std::string > > &MapAndConstraints,
+ MatchInstMapAndConstraintsImpl &MapAndConstraints,
unsigned &OrigErrorInfo, bool matchingInlineAsm = false) {
OrigErrorInfo = ~0x0;
return true;
@@ -117,7 +123,7 @@
virtual void convertToMapAndConstraints(unsigned Kind,
const SmallVectorImpl<MCParsedAsmOperand*> &Operands,
- SmallVectorImpl<std::pair< unsigned, std::string > > &MapAndConstraints) = 0;
+ MatchInstMapAndConstraintsImpl &MapAndConstraints) = 0;
};
} // End llvm namespace
Modified: llvm/branches/R600/include/llvm/MC/SubtargetFeature.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/MC/SubtargetFeature.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/MC/SubtargetFeature.h (original)
+++ llvm/branches/R600/include/llvm/MC/SubtargetFeature.h Thu Oct 11 16:28:00 2012
@@ -95,10 +95,6 @@
const SubtargetFeatureKV *FeatureTable,
size_t FeatureTableSize);
- /// Get scheduling itinerary of a CPU.
- const void *getItinerary(const StringRef CPU,
- const SubtargetInfoKV *Table, size_t TableSize);
-
/// Print feature string.
void print(raw_ostream &OS) const;
Modified: llvm/branches/R600/include/llvm/Object/COFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Object/COFF.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Object/COFF.h (original)
+++ llvm/branches/R600/include/llvm/Object/COFF.h Thu Oct 11 16:28:00 2012
@@ -128,6 +128,7 @@
virtual error_code isSectionBSS(DataRefImpl Sec, bool &Res) const;
virtual error_code isSectionVirtual(DataRefImpl Sec, bool &Res) const;
virtual error_code isSectionZeroInit(DataRefImpl Sec, bool &Res) const;
+ virtual error_code isSectionReadOnlyData(DataRefImpl Sec, bool &Res) const;
virtual error_code isSectionRequiredForExecution(DataRefImpl Sec,
bool &Res) const;
virtual error_code sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb,
Modified: llvm/branches/R600/include/llvm/Object/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Object/ELF.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Object/ELF.h (original)
+++ llvm/branches/R600/include/llvm/Object/ELF.h Thu Oct 11 16:28:00 2012
@@ -413,6 +413,35 @@
};
template<support::endianness target_endianness, bool is64Bits>
+struct Elf_Phdr;
+
+template<support::endianness target_endianness>
+struct Elf_Phdr<target_endianness, false> {
+ LLVM_ELF_IMPORT_TYPES(target_endianness, false)
+ Elf_Word p_type; // Type of segment
+ Elf_Off p_offset; // FileOffset where segment is located, in bytes
+ Elf_Addr p_vaddr; // Virtual Address of beginning of segment
+ Elf_Addr p_paddr; // Physical address of beginning of segment (OS-specific)
+ Elf_Word p_filesz; // Num. of bytes in file image of segment (may be zero)
+ Elf_Word p_memsz; // Num. of bytes in mem image of segment (may be zero)
+ Elf_Word p_flags; // Segment flags
+ Elf_Word p_align; // Segment alignment constraint
+};
+
+template<support::endianness target_endianness>
+struct Elf_Phdr<target_endianness, true> {
+ LLVM_ELF_IMPORT_TYPES(target_endianness, true)
+ Elf_Word p_type; // Type of segment
+ Elf_Word p_flags; // Segment flags
+ Elf_Off p_offset; // FileOffset where segment is located, in bytes
+ Elf_Addr p_vaddr; // Virtual Address of beginning of segment
+ Elf_Addr p_paddr; // Physical address of beginning of segment (OS-specific)
+ Elf_Word p_filesz; // Num. of bytes in file image of segment (may be zero)
+ Elf_Word p_memsz; // Num. of bytes in mem image of segment (may be zero)
+ Elf_Word p_align; // Segment alignment constraint
+};
+
+template<support::endianness target_endianness, bool is64Bits>
class ELFObjectFile : public ObjectFile {
LLVM_ELF_IMPORT_TYPES(target_endianness, is64Bits)
@@ -611,6 +640,7 @@
bool &Res) const;
virtual error_code isSectionVirtual(DataRefImpl Sec, bool &Res) const;
virtual error_code isSectionZeroInit(DataRefImpl Sec, bool &Res) const;
+ virtual error_code isSectionReadOnlyData(DataRefImpl Sec, bool &Res) const;
virtual error_code sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb,
bool &Result) const;
virtual relocation_iterator getSectionRelBegin(DataRefImpl Sec) const;
@@ -1259,7 +1289,8 @@
}
template<support::endianness target_endianness, bool is64Bits>
-error_code ELFObjectFile<target_endianness, is64Bits>::isSectionZeroInit(DataRefImpl Sec,
+error_code ELFObjectFile<target_endianness, is64Bits>
+ ::isSectionZeroInit(DataRefImpl Sec,
bool &Result) const {
const Elf_Shdr *sec = reinterpret_cast<const Elf_Shdr *>(Sec.p);
// For ELF, all zero-init sections are virtual (that is, they occupy no space
@@ -1273,6 +1304,18 @@
template<support::endianness target_endianness, bool is64Bits>
error_code ELFObjectFile<target_endianness, is64Bits>
+ ::isSectionReadOnlyData(DataRefImpl Sec,
+ bool &Result) const {
+ const Elf_Shdr *sec = reinterpret_cast<const Elf_Shdr *>(Sec.p);
+ if (sec->sh_flags & ELF::SHF_WRITE || sec->sh_flags & ELF::SHF_EXECINSTR)
+ Result = false;
+ else
+ Result = true;
+ return object_error::success;
+}
+
+template<support::endianness target_endianness, bool is64Bits>
+error_code ELFObjectFile<target_endianness, is64Bits>
::sectionContainsSymbol(DataRefImpl Sec,
DataRefImpl Symb,
bool &Result) const {
@@ -2272,6 +2315,8 @@
return "ELF64-i386";
case ELF::EM_X86_64:
return "ELF64-x86-64";
+ case ELF::EM_PPC64:
+ return "ELF64-ppc64";
default:
return "ELF64-unknown";
}
@@ -2295,6 +2340,8 @@
case ELF::EM_MIPS:
return (target_endianness == support::little) ?
Triple::mipsel : Triple::mips;
+ case ELF::EM_PPC64:
+ return Triple::ppc64;
default:
return Triple::UnknownArch;
}
Modified: llvm/branches/R600/include/llvm/Object/MachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Object/MachO.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Object/MachO.h (original)
+++ llvm/branches/R600/include/llvm/Object/MachO.h Thu Oct 11 16:28:00 2012
@@ -76,6 +76,7 @@
bool &Res) const;
virtual error_code isSectionVirtual(DataRefImpl Sec, bool &Res) const;
virtual error_code isSectionZeroInit(DataRefImpl Sec, bool &Res) const;
+ virtual error_code isSectionReadOnlyData(DataRefImpl Sec, bool &Res) const;
virtual error_code sectionContainsSymbol(DataRefImpl DRI, DataRefImpl S,
bool &Result) const;
virtual relocation_iterator getSectionRelBegin(DataRefImpl Sec) const;
Modified: llvm/branches/R600/include/llvm/Object/ObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Object/ObjectFile.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Object/ObjectFile.h (original)
+++ llvm/branches/R600/include/llvm/Object/ObjectFile.h Thu Oct 11 16:28:00 2012
@@ -163,6 +163,7 @@
error_code isRequiredForExecution(bool &Result) const;
error_code isVirtual(bool &Result) const;
error_code isZeroInit(bool &Result) const;
+ error_code isReadOnlyData(bool &Result) const;
error_code containsSymbol(SymbolRef S, bool &Result) const;
@@ -316,6 +317,7 @@
// A section is 'virtual' if its contents aren't present in the object image.
virtual error_code isSectionVirtual(DataRefImpl Sec, bool &Res) const = 0;
virtual error_code isSectionZeroInit(DataRefImpl Sec, bool &Res) const = 0;
+ virtual error_code isSectionReadOnlyData(DataRefImpl Sec, bool &Res) const = 0;
virtual error_code sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb,
bool &Result) const = 0;
virtual relocation_iterator getSectionRelBegin(DataRefImpl Sec) const = 0;
@@ -510,6 +512,10 @@
return OwningObject->isSectionZeroInit(SectionPimpl, Result);
}
+inline error_code SectionRef::isReadOnlyData(bool &Result) const {
+ return OwningObject->isSectionReadOnlyData(SectionPimpl, Result);
+}
+
inline error_code SectionRef::containsSymbol(SymbolRef S, bool &Result) const {
return OwningObject->sectionContainsSymbol(SectionPimpl, S.SymbolPimpl,
Result);
Modified: llvm/branches/R600/include/llvm/Operator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Operator.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Operator.h (original)
+++ llvm/branches/R600/include/llvm/Operator.h Thu Oct 11 16:28:00 2012
@@ -16,6 +16,7 @@
#define LLVM_OPERATOR_H
#include "llvm/Constants.h"
+#include "llvm/DerivedTypes.h"
#include "llvm/Instruction.h"
#include "llvm/Type.h"
@@ -290,6 +291,12 @@
return getPointerOperand()->getType();
}
+ /// getPointerAddressSpace - Method to return the address space of the
+ /// pointer operand.
+ unsigned getPointerAddressSpace() const {
+ return cast<PointerType>(getPointerOperandType())->getAddressSpace();
+ }
+
unsigned getNumIndices() const { // Note: always non-negative
return getNumOperands() - 1;
}
Modified: llvm/branches/R600/include/llvm/Support/CallSite.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Support/CallSite.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Support/CallSite.h (original)
+++ llvm/branches/R600/include/llvm/Support/CallSite.h Thu Oct 11 16:28:00 2012
@@ -185,13 +185,13 @@
}
/// \brief Return true if this function has the given attribute.
- bool hasFnAttr(Attributes N) const {
- CALLSITE_DELEGATE_GETTER(hasFnAttr(N));
+ bool hasFnAttr(Attributes::AttrVal A) const {
+ CALLSITE_DELEGATE_GETTER(hasFnAttr(A));
}
- /// paramHasAttr - whether the call or the callee has the given attribute.
- bool paramHasAttr(uint16_t i, Attributes attr) const {
- CALLSITE_DELEGATE_GETTER(paramHasAttr(i, attr));
+ /// \brief Return true if the call or the callee has the given attribute.
+ bool paramHasAttr(unsigned i, Attributes::AttrVal A) const {
+ CALLSITE_DELEGATE_GETTER(paramHasAttr(i, A));
}
/// @brief Extract the alignment for a call or parameter (0=unknown).
@@ -211,32 +211,32 @@
bool doesNotAccessMemory() const {
CALLSITE_DELEGATE_GETTER(doesNotAccessMemory());
}
- void setDoesNotAccessMemory(bool doesNotAccessMemory = true) {
- CALLSITE_DELEGATE_SETTER(setDoesNotAccessMemory(doesNotAccessMemory));
+ void setDoesNotAccessMemory() {
+ CALLSITE_DELEGATE_SETTER(setDoesNotAccessMemory());
}
/// @brief Determine if the call does not access or only reads memory.
bool onlyReadsMemory() const {
CALLSITE_DELEGATE_GETTER(onlyReadsMemory());
}
- void setOnlyReadsMemory(bool onlyReadsMemory = true) {
- CALLSITE_DELEGATE_SETTER(setOnlyReadsMemory(onlyReadsMemory));
+ void setOnlyReadsMemory() {
+ CALLSITE_DELEGATE_SETTER(setOnlyReadsMemory());
}
/// @brief Determine if the call cannot return.
bool doesNotReturn() const {
CALLSITE_DELEGATE_GETTER(doesNotReturn());
}
- void setDoesNotReturn(bool doesNotReturn = true) {
- CALLSITE_DELEGATE_SETTER(setDoesNotReturn(doesNotReturn));
+ void setDoesNotReturn() {
+ CALLSITE_DELEGATE_SETTER(setDoesNotReturn());
}
/// @brief Determine if the call cannot unwind.
bool doesNotThrow() const {
CALLSITE_DELEGATE_GETTER(doesNotThrow());
}
- void setDoesNotThrow(bool doesNotThrow = true) {
- CALLSITE_DELEGATE_SETTER(setDoesNotThrow(doesNotThrow));
+ void setDoesNotThrow() {
+ CALLSITE_DELEGATE_SETTER(setDoesNotThrow());
}
#undef CALLSITE_DELEGATE_GETTER
@@ -244,12 +244,12 @@
/// @brief Determine whether this argument is not captured.
bool doesNotCapture(unsigned ArgNo) const {
- return paramHasAttr(ArgNo + 1, Attribute::NoCapture);
+ return paramHasAttr(ArgNo + 1, Attributes::NoCapture);
}
/// @brief Determine whether this argument is passed by value.
bool isByValArgument(unsigned ArgNo) const {
- return paramHasAttr(ArgNo + 1, Attribute::ByVal);
+ return paramHasAttr(ArgNo + 1, Attributes::ByVal);
}
/// hasArgument - Returns true if this CallSite passes the given Value* as an
Modified: llvm/branches/R600/include/llvm/Support/CommandLine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Support/CommandLine.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Support/CommandLine.h (original)
+++ llvm/branches/R600/include/llvm/Support/CommandLine.h Thu Oct 11 16:28:00 2012
@@ -41,16 +41,14 @@
// ParseCommandLineOptions - Command line option processing entry point.
//
void ParseCommandLineOptions(int argc, const char * const *argv,
- const char *Overview = 0,
- bool ReadResponseFiles = false);
+ const char *Overview = 0);
//===----------------------------------------------------------------------===//
// ParseEnvironmentOptions - Environment variable option processing alternate
// entry point.
//
void ParseEnvironmentOptions(const char *progName, const char *envvar,
- const char *Overview = 0,
- bool ReadResponseFiles = false);
+ const char *Overview = 0);
///===---------------------------------------------------------------------===//
/// SetVersionPrinter - Override the default (LLVM specific) version printer
Modified: llvm/branches/R600/include/llvm/Support/TargetFolder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Support/TargetFolder.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Support/TargetFolder.h (original)
+++ llvm/branches/R600/include/llvm/Support/TargetFolder.h Thu Oct 11 16:28:00 2012
@@ -26,11 +26,11 @@
namespace llvm {
-class TargetData;
+class DataLayout;
/// TargetFolder - Create constants with target dependent folding.
class TargetFolder {
- const TargetData *TD;
+ const DataLayout *TD;
/// Fold - Fold the constant using target specific information.
Constant *Fold(Constant *C) const {
@@ -41,7 +41,7 @@
}
public:
- explicit TargetFolder(const TargetData *TheTD) : TD(TheTD) {}
+ explicit TargetFolder(const DataLayout *TheTD) : TD(TheTD) {}
//===--------------------------------------------------------------------===//
// Binary Operators
Modified: llvm/branches/R600/include/llvm/TableGen/Main.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/TableGen/Main.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/TableGen/Main.h (original)
+++ llvm/branches/R600/include/llvm/TableGen/Main.h Thu Oct 11 16:28:00 2012
@@ -16,10 +16,13 @@
namespace llvm {
-class TableGenAction;
+class RecordKeeper;
+class raw_ostream;
+/// \brief Perform the action using Records, and write output to OS.
+/// \returns true on error, false otherwise
+typedef bool TableGenMainFn(raw_ostream &OS, RecordKeeper &Records);
-/// Run the table generator, performing the specified Action on parsed records.
-int TableGenMain(char *argv0, TableGenAction &Action);
+int TableGenMain(char *argv0, TableGenMainFn *MainFn);
}
Modified: llvm/branches/R600/include/llvm/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/TableGen/Record.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/TableGen/Record.h (original)
+++ llvm/branches/R600/include/llvm/TableGen/Record.h Thu Oct 11 16:28:00 2012
@@ -18,6 +18,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Casting.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/ErrorHandling.h"
@@ -66,10 +67,28 @@
//===----------------------------------------------------------------------===//
class RecTy {
+public:
+ /// \brief Subclass discriminator (for dyn_cast<> et al.)
+ enum RecTyKind {
+ BitRecTyKind,
+ BitsRecTyKind,
+ IntRecTyKind,
+ StringRecTyKind,
+ ListRecTyKind,
+ DagRecTyKind,
+ RecordRecTyKind
+ };
+
+private:
+ RecTyKind Kind;
ListRecTy *ListTy;
virtual void anchor();
+
public:
- RecTy() : ListTy(0) {}
+ static bool classof(const RecTy *) { return true; }
+ RecTyKind getRecTyKind() const { return Kind; }
+
+ RecTy(RecTyKind K) : Kind(K), ListTy(0) {}
virtual ~RecTy() {}
virtual std::string getAsString() const = 0;
@@ -132,8 +151,13 @@
///
class BitRecTy : public RecTy {
static BitRecTy Shared;
- BitRecTy() {}
+ BitRecTy() : RecTy(BitRecTyKind) {}
public:
+ static bool classof(const BitRecTy *) { return true; }
+ static bool classof(const RecTy *RT) {
+ return RT->getRecTyKind() == BitRecTyKind;
+ }
+
static BitRecTy *get() { return &Shared; }
virtual Init *convertValue( UnsetInit *UI) { return (Init*)UI; }
@@ -173,8 +197,13 @@
///
class BitsRecTy : public RecTy {
unsigned Size;
- explicit BitsRecTy(unsigned Sz) : Size(Sz) {}
+ explicit BitsRecTy(unsigned Sz) : RecTy(BitsRecTyKind), Size(Sz) {}
public:
+ static bool classof(const BitsRecTy *) { return true; }
+ static bool classof(const RecTy *RT) {
+ return RT->getRecTyKind() == BitsRecTyKind;
+ }
+
static BitsRecTy *get(unsigned Sz);
unsigned getNumBits() const { return Size; }
@@ -217,8 +246,13 @@
///
class IntRecTy : public RecTy {
static IntRecTy Shared;
- IntRecTy() {}
+ IntRecTy() : RecTy(IntRecTyKind) {}
public:
+ static bool classof(const IntRecTy *) { return true; }
+ static bool classof(const RecTy *RT) {
+ return RT->getRecTyKind() == IntRecTyKind;
+ }
+
static IntRecTy *get() { return &Shared; }
virtual Init *convertValue( UnsetInit *UI) { return (Init*)UI; }
@@ -257,8 +291,13 @@
///
class StringRecTy : public RecTy {
static StringRecTy Shared;
- StringRecTy() {}
+ StringRecTy() : RecTy(StringRecTyKind) {}
public:
+ static bool classof(const StringRecTy *) { return true; }
+ static bool classof(const RecTy *RT) {
+ return RT->getRecTyKind() == StringRecTyKind;
+ }
+
static StringRecTy *get() { return &Shared; }
virtual Init *convertValue( UnsetInit *UI) { return (Init*)UI; }
@@ -300,9 +339,14 @@
///
class ListRecTy : public RecTy {
RecTy *Ty;
- explicit ListRecTy(RecTy *T) : Ty(T) {}
+ explicit ListRecTy(RecTy *T) : RecTy(ListRecTyKind), Ty(T) {}
friend ListRecTy *RecTy::getListTy();
public:
+ static bool classof(const ListRecTy *) { return true; }
+ static bool classof(const RecTy *RT) {
+ return RT->getRecTyKind() == ListRecTyKind;
+ }
+
static ListRecTy *get(RecTy *T) { return T->getListTy(); }
RecTy *getElementType() const { return Ty; }
@@ -343,8 +387,13 @@
///
class DagRecTy : public RecTy {
static DagRecTy Shared;
- DagRecTy() {}
+ DagRecTy() : RecTy(DagRecTyKind) {}
public:
+ static bool classof(const DagRecTy *) { return true; }
+ static bool classof(const RecTy *RT) {
+ return RT->getRecTyKind() == DagRecTyKind;
+ }
+
static DagRecTy *get() { return &Shared; }
virtual Init *convertValue( UnsetInit *UI) { return (Init*)UI; }
@@ -384,9 +433,14 @@
///
class RecordRecTy : public RecTy {
Record *Rec;
- explicit RecordRecTy(Record *R) : Rec(R) {}
+ explicit RecordRecTy(Record *R) : RecTy(RecordRecTyKind), Rec(R) {}
friend class Record;
public:
+ static bool classof(const RecordRecTy *) { return true; }
+ static bool classof(const RecTy *RT) {
+ return RT->getRecTyKind() == RecordRecTyKind;
+ }
+
static RecordRecTy *get(Record *R);
Record *getRecord() const { return Rec; }
@@ -1031,9 +1085,9 @@
VarBitInit(TypedInit *T, unsigned B) : TI(T), Bit(B) {
assert(T->getType() &&
- (dynamic_cast<IntRecTy*>(T->getType()) ||
- (dynamic_cast<BitsRecTy*>(T->getType()) &&
- dynamic_cast<BitsRecTy*>(T->getType())->getNumBits() > B)) &&
+ (isa<IntRecTy>(T->getType()) ||
+ (isa<BitsRecTy>(T->getType()) &&
+ cast<BitsRecTy>(T->getType())->getNumBits() > B)) &&
"Illegal VarBitInit expression!");
}
@@ -1066,9 +1120,9 @@
unsigned Element;
VarListElementInit(TypedInit *T, unsigned E)
- : TypedInit(dynamic_cast<ListRecTy*>(T->getType())->getElementType()),
+ : TypedInit(cast<ListRecTy>(T->getType())->getElementType()),
TI(T), Element(E) {
- assert(T->getType() && dynamic_cast<ListRecTy*>(T->getType()) &&
+ assert(T->getType() && isa<ListRecTy>(T->getType()) &&
"Illegal VarBitInit expression!");
}
Removed: llvm/branches/R600/include/llvm/TableGen/TableGenAction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/TableGen/TableGenAction.h?rev=165747&view=auto
==============================================================================
--- llvm/branches/R600/include/llvm/TableGen/TableGenAction.h (original)
+++ llvm/branches/R600/include/llvm/TableGen/TableGenAction.h (removed)
@@ -1,35 +0,0 @@
-//===- llvm/TableGen/TableGenAction.h - defines TableGenAction --*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the TableGenAction base class to be derived from by
-// tblgen tools.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TABLEGEN_TABLEGENACTION_H
-#define LLVM_TABLEGEN_TABLEGENACTION_H
-
-namespace llvm {
-
-class raw_ostream;
-class RecordKeeper;
-
-class TableGenAction {
- virtual void anchor();
-public:
- virtual ~TableGenAction() {}
-
- /// Perform the action using Records, and write output to OS.
- /// @returns true on error, false otherwise
- virtual bool operator()(raw_ostream &OS, RecordKeeper &Records) = 0;
-};
-
-}
-
-#endif
Modified: llvm/branches/R600/include/llvm/Target/Mangler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Target/Mangler.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Target/Mangler.h (original)
+++ llvm/branches/R600/include/llvm/Target/Mangler.h Thu Oct 11 16:28:00 2012
@@ -22,7 +22,7 @@
template <typename T> class SmallVectorImpl;
class MCContext;
class MCSymbol;
-class TargetData;
+class DataLayout;
class Mangler {
public:
@@ -34,7 +34,7 @@
private:
MCContext &Context;
- const TargetData &TD;
+ const DataLayout &TD;
/// AnonGlobalIDs - We need to give global values the same name every time
/// they are mangled. This keeps track of the number we give to anonymous
@@ -47,20 +47,19 @@
unsigned NextAnonGlobalID;
public:
- Mangler(MCContext &context, const TargetData &td)
+ Mangler(MCContext &context, const DataLayout &td)
: Context(context), TD(td), NextAnonGlobalID(1) {}
/// getSymbol - Return the MCSymbol for the specified global value. This
/// symbol is the main label that is the address of the global.
MCSymbol *getSymbol(const GlobalValue *GV);
-
/// getNameWithPrefix - Fill OutName with the name of the appropriate prefix
/// and the specified global variable's name. If the global variable doesn't
/// have a name, this fills in a unique name for the global.
void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
bool isImplicitlyPrivate);
-
+
/// getNameWithPrefix - Fill OutName with the name of the appropriate prefix
/// and the specified name as the global variable name. GVName must not be
/// empty.
Modified: llvm/branches/R600/include/llvm/Target/TargetCallingConv.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Target/TargetCallingConv.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Target/TargetCallingConv.h (original)
+++ llvm/branches/R600/include/llvm/Target/TargetCallingConv.h Thu Oct 11 16:28:00 2012
@@ -113,9 +113,18 @@
MVT VT;
bool Used;
+ /// Index original Function's argument.
+ unsigned OrigArgIndex;
+
+ /// Offset in bytes of current input value relative to the beginning of
+ /// original argument. E.g. if argument was splitted into four 32 bit
+ /// registers, we got 4 InputArgs with PartOffsets 0, 4, 8 and 12.
+ unsigned PartOffset;
+
InputArg() : VT(MVT::Other), Used(false) {}
- InputArg(ArgFlagsTy flags, EVT vt, bool used)
- : Flags(flags), Used(used) {
+ InputArg(ArgFlagsTy flags, EVT vt, bool used,
+ unsigned origIdx, unsigned partOffs)
+ : Flags(flags), Used(used), OrigArgIndex(origIdx), PartOffset(partOffs) {
VT = vt.getSimpleVT();
}
};
Removed: llvm/branches/R600/include/llvm/Target/TargetData.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Target/TargetData.h?rev=165747&view=auto
==============================================================================
--- llvm/branches/R600/include/llvm/Target/TargetData.h (original)
+++ llvm/branches/R600/include/llvm/Target/TargetData.h (removed)
@@ -1,363 +0,0 @@
-//===-- llvm/Target/TargetData.h - Data size & alignment info ---*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines target properties related to datatype size/offset/alignment
-// information. It uses lazy annotations to cache information about how
-// structure types are laid out and used.
-//
-// This structure should be created once, filled in if the defaults are not
-// correct and then passed around by const&. None of the members functions
-// require modification to the object.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TARGET_TARGETDATA_H
-#define LLVM_TARGET_TARGETDATA_H
-
-#include "llvm/Pass.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/DataTypes.h"
-
-namespace llvm {
-
-class Value;
-class Type;
-class IntegerType;
-class StructType;
-class StructLayout;
-class GlobalVariable;
-class LLVMContext;
-template<typename T>
-class ArrayRef;
-
-/// Enum used to categorize the alignment types stored by TargetAlignElem
-enum AlignTypeEnum {
- INTEGER_ALIGN = 'i', ///< Integer type alignment
- VECTOR_ALIGN = 'v', ///< Vector type alignment
- FLOAT_ALIGN = 'f', ///< Floating point type alignment
- AGGREGATE_ALIGN = 'a', ///< Aggregate alignment
- STACK_ALIGN = 's' ///< Stack objects alignment
-};
-
-/// Target alignment element.
-///
-/// Stores the alignment data associated with a given alignment type (pointer,
-/// integer, vector, float) and type bit width.
-///
-/// @note The unusual order of elements in the structure attempts to reduce
-/// padding and make the structure slightly more cache friendly.
-struct TargetAlignElem {
- unsigned AlignType : 8; ///< Alignment type (AlignTypeEnum)
- unsigned TypeBitWidth : 24; ///< Type bit width
- unsigned ABIAlign : 16; ///< ABI alignment for this type/bitw
- unsigned PrefAlign : 16; ///< Pref. alignment for this type/bitw
-
- /// Initializer
- static TargetAlignElem get(AlignTypeEnum align_type, unsigned abi_align,
- unsigned pref_align, uint32_t bit_width);
- /// Equality predicate
- bool operator==(const TargetAlignElem &rhs) const;
-};
-
-/// TargetData - This class holds a parsed version of the target data layout
-/// string in a module and provides methods for querying it. The target data
-/// layout string is specified *by the target* - a frontend generating LLVM IR
-/// is required to generate the right target data for the target being codegen'd
-/// to. If some measure of portability is desired, an empty string may be
-/// specified in the module.
-class TargetData : public ImmutablePass {
-private:
- bool LittleEndian; ///< Defaults to false
- unsigned PointerMemSize; ///< Pointer size in bytes
- unsigned PointerABIAlign; ///< Pointer ABI alignment
- unsigned PointerPrefAlign; ///< Pointer preferred alignment
- unsigned StackNaturalAlign; ///< Stack natural alignment
-
- SmallVector<unsigned char, 8> LegalIntWidths; ///< Legal Integers.
-
- /// Alignments- Where the primitive type alignment data is stored.
- ///
- /// @sa init().
- /// @note Could support multiple size pointer alignments, e.g., 32-bit
- /// pointers vs. 64-bit pointers by extending TargetAlignment, but for now,
- /// we don't.
- SmallVector<TargetAlignElem, 16> Alignments;
-
- /// InvalidAlignmentElem - This member is a signal that a requested alignment
- /// type and bit width were not found in the SmallVector.
- static const TargetAlignElem InvalidAlignmentElem;
-
- // The StructType -> StructLayout map.
- mutable void *LayoutMap;
-
- //! Set/initialize target alignments
- void setAlignment(AlignTypeEnum align_type, unsigned abi_align,
- unsigned pref_align, uint32_t bit_width);
- unsigned getAlignmentInfo(AlignTypeEnum align_type, uint32_t bit_width,
- bool ABIAlign, Type *Ty) const;
- //! Internal helper method that returns requested alignment for type.
- unsigned getAlignment(Type *Ty, bool abi_or_pref) const;
-
- /// Valid alignment predicate.
- ///
- /// Predicate that tests a TargetAlignElem reference returned by get() against
- /// InvalidAlignmentElem.
- bool validAlignment(const TargetAlignElem &align) const {
- return &align != &InvalidAlignmentElem;
- }
-
- /// Initialise a TargetData object with default values, ensure that the
- /// target data pass is registered.
- void init();
-
-public:
- /// Default ctor.
- ///
- /// @note This has to exist, because this is a pass, but it should never be
- /// used.
- TargetData();
-
- /// Constructs a TargetData from a specification string. See init().
- explicit TargetData(StringRef TargetDescription)
- : ImmutablePass(ID) {
- std::string errMsg = parseSpecifier(TargetDescription, this);
- assert(errMsg == "" && "Invalid target data layout string.");
- (void)errMsg;
- }
-
- /// Parses a target data specification string. Returns an error message
- /// if the string is malformed, or the empty string on success. Optionally
- /// initialises a TargetData object if passed a non-null pointer.
- static std::string parseSpecifier(StringRef TargetDescription, TargetData* td = 0);
-
- /// Initialize target data from properties stored in the module.
- explicit TargetData(const Module *M);
-
- TargetData(const TargetData &TD) :
- ImmutablePass(ID),
- LittleEndian(TD.isLittleEndian()),
- PointerMemSize(TD.PointerMemSize),
- PointerABIAlign(TD.PointerABIAlign),
- PointerPrefAlign(TD.PointerPrefAlign),
- LegalIntWidths(TD.LegalIntWidths),
- Alignments(TD.Alignments),
- LayoutMap(0)
- { }
-
- ~TargetData(); // Not virtual, do not subclass this class
-
- /// Target endianness...
- bool isLittleEndian() const { return LittleEndian; }
- bool isBigEndian() const { return !LittleEndian; }
-
- /// getStringRepresentation - Return the string representation of the
- /// TargetData. This representation is in the same format accepted by the
- /// string constructor above.
- std::string getStringRepresentation() const;
-
- /// isLegalInteger - This function returns true if the specified type is
- /// known to be a native integer type supported by the CPU. For example,
- /// i64 is not native on most 32-bit CPUs and i37 is not native on any known
- /// one. This returns false if the integer width is not legal.
- ///
- /// The width is specified in bits.
- ///
- bool isLegalInteger(unsigned Width) const {
- for (unsigned i = 0, e = (unsigned)LegalIntWidths.size(); i != e; ++i)
- if (LegalIntWidths[i] == Width)
- return true;
- return false;
- }
-
- bool isIllegalInteger(unsigned Width) const {
- return !isLegalInteger(Width);
- }
-
- /// Returns true if the given alignment exceeds the natural stack alignment.
- bool exceedsNaturalStackAlignment(unsigned Align) const {
- return (StackNaturalAlign != 0) && (Align > StackNaturalAlign);
- }
-
- /// fitsInLegalInteger - This function returns true if the specified type fits
- /// in a native integer type supported by the CPU. For example, if the CPU
- /// only supports i32 as a native integer type, then i27 fits in a legal
- // integer type but i45 does not.
- bool fitsInLegalInteger(unsigned Width) const {
- for (unsigned i = 0, e = (unsigned)LegalIntWidths.size(); i != e; ++i)
- if (Width <= LegalIntWidths[i])
- return true;
- return false;
- }
-
- /// Target pointer alignment
- unsigned getPointerABIAlignment() const { return PointerABIAlign; }
- /// Return target's alignment for stack-based pointers
- unsigned getPointerPrefAlignment() const { return PointerPrefAlign; }
- /// Target pointer size
- unsigned getPointerSize() const { return PointerMemSize; }
- /// Target pointer size, in bits
- unsigned getPointerSizeInBits() const { return 8*PointerMemSize; }
-
- /// Size examples:
- ///
- /// Type SizeInBits StoreSizeInBits AllocSizeInBits[*]
- /// ---- ---------- --------------- ---------------
- /// i1 1 8 8
- /// i8 8 8 8
- /// i19 19 24 32
- /// i32 32 32 32
- /// i100 100 104 128
- /// i128 128 128 128
- /// Float 32 32 32
- /// Double 64 64 64
- /// X86_FP80 80 80 96
- ///
- /// [*] The alloc size depends on the alignment, and thus on the target.
- /// These values are for x86-32 linux.
-
- /// getTypeSizeInBits - Return the number of bits necessary to hold the
- /// specified type. For example, returns 36 for i36 and 80 for x86_fp80.
- uint64_t getTypeSizeInBits(Type* Ty) const;
-
- /// getTypeStoreSize - Return the maximum number of bytes that may be
- /// overwritten by storing the specified type. For example, returns 5
- /// for i36 and 10 for x86_fp80.
- uint64_t getTypeStoreSize(Type *Ty) const {
- return (getTypeSizeInBits(Ty)+7)/8;
- }
-
- /// getTypeStoreSizeInBits - Return the maximum number of bits that may be
- /// overwritten by storing the specified type; always a multiple of 8. For
- /// example, returns 40 for i36 and 80 for x86_fp80.
- uint64_t getTypeStoreSizeInBits(Type *Ty) const {
- return 8*getTypeStoreSize(Ty);
- }
-
- /// getTypeAllocSize - Return the offset in bytes between successive objects
- /// of the specified type, including alignment padding. This is the amount
- /// that alloca reserves for this type. For example, returns 12 or 16 for
- /// x86_fp80, depending on alignment.
- uint64_t getTypeAllocSize(Type* Ty) const {
- // Round up to the next alignment boundary.
- return RoundUpAlignment(getTypeStoreSize(Ty), getABITypeAlignment(Ty));
- }
-
- /// getTypeAllocSizeInBits - Return the offset in bits between successive
- /// objects of the specified type, including alignment padding; always a
- /// multiple of 8. This is the amount that alloca reserves for this type.
- /// For example, returns 96 or 128 for x86_fp80, depending on alignment.
- uint64_t getTypeAllocSizeInBits(Type* Ty) const {
- return 8*getTypeAllocSize(Ty);
- }
-
- /// getABITypeAlignment - Return the minimum ABI-required alignment for the
- /// specified type.
- unsigned getABITypeAlignment(Type *Ty) const;
-
- /// getABIIntegerTypeAlignment - Return the minimum ABI-required alignment for
- /// an integer type of the specified bitwidth.
- unsigned getABIIntegerTypeAlignment(unsigned BitWidth) const;
-
-
- /// getCallFrameTypeAlignment - Return the minimum ABI-required alignment
- /// for the specified type when it is part of a call frame.
- unsigned getCallFrameTypeAlignment(Type *Ty) const;
-
-
- /// getPrefTypeAlignment - Return the preferred stack/global alignment for
- /// the specified type. This is always at least as good as the ABI alignment.
- unsigned getPrefTypeAlignment(Type *Ty) const;
-
- /// getPreferredTypeAlignmentShift - Return the preferred alignment for the
- /// specified type, returned as log2 of the value (a shift amount).
- ///
- unsigned getPreferredTypeAlignmentShift(Type *Ty) const;
-
- /// getIntPtrType - Return an unsigned integer type that is the same size or
- /// greater to the host pointer size.
- ///
- IntegerType *getIntPtrType(LLVMContext &C) const;
-
- /// getIndexedOffset - return the offset from the beginning of the type for
- /// the specified indices. This is used to implement getelementptr.
- ///
- uint64_t getIndexedOffset(Type *Ty, ArrayRef<Value *> Indices) const;
-
- /// getStructLayout - Return a StructLayout object, indicating the alignment
- /// of the struct, its size, and the offsets of its fields. Note that this
- /// information is lazily cached.
- const StructLayout *getStructLayout(StructType *Ty) const;
-
- /// getPreferredAlignment - Return the preferred alignment of the specified
- /// global. This includes an explicitly requested alignment (if the global
- /// has one).
- unsigned getPreferredAlignment(const GlobalVariable *GV) const;
-
- /// getPreferredAlignmentLog - Return the preferred alignment of the
- /// specified global, returned in log form. This includes an explicitly
- /// requested alignment (if the global has one).
- unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const;
-
- /// RoundUpAlignment - Round the specified value up to the next alignment
- /// boundary specified by Alignment. For example, 7 rounded up to an
- /// alignment boundary of 4 is 8. 8 rounded up to the alignment boundary of 4
- /// is 8 because it is already aligned.
- template <typename UIntTy>
- static UIntTy RoundUpAlignment(UIntTy Val, unsigned Alignment) {
- assert((Alignment & (Alignment-1)) == 0 && "Alignment must be power of 2!");
- return (Val + (Alignment-1)) & ~UIntTy(Alignment-1);
- }
-
- static char ID; // Pass identification, replacement for typeid
-};
-
-/// StructLayout - used to lazily calculate structure layout information for a
-/// target machine, based on the TargetData structure.
-///
-class StructLayout {
- uint64_t StructSize;
- unsigned StructAlignment;
- unsigned NumElements;
- uint64_t MemberOffsets[1]; // variable sized array!
-public:
-
- uint64_t getSizeInBytes() const {
- return StructSize;
- }
-
- uint64_t getSizeInBits() const {
- return 8*StructSize;
- }
-
- unsigned getAlignment() const {
- return StructAlignment;
- }
-
- /// getElementContainingOffset - Given a valid byte offset into the structure,
- /// return the structure index that contains it.
- ///
- unsigned getElementContainingOffset(uint64_t Offset) const;
-
- uint64_t getElementOffset(unsigned Idx) const {
- assert(Idx < NumElements && "Invalid element idx!");
- return MemberOffsets[Idx];
- }
-
- uint64_t getElementOffsetInBits(unsigned Idx) const {
- return getElementOffset(Idx)*8;
- }
-
-private:
- friend class TargetData; // Only TargetData can create this class
- StructLayout(StructType *ST, const TargetData &TD);
-};
-
-} // End llvm namespace
-
-#endif
Modified: llvm/branches/R600/include/llvm/Target/TargetInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Target/TargetInstrInfo.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Target/TargetInstrInfo.h (original)
+++ llvm/branches/R600/include/llvm/Target/TargetInstrInfo.h Thu Oct 11 16:28:00 2012
@@ -801,15 +801,6 @@
const MachineInstr *UseMI, unsigned UseIdx,
bool FindMin = false) const;
- /// getOutputLatency - Compute and return the output dependency latency of a
- /// a given pair of defs which both target the same register. This is usually
- /// one.
- virtual unsigned getOutputLatency(const InstrItineraryData *ItinData,
- const MachineInstr *DefMI, unsigned DefIdx,
- const MachineInstr *DepMI) const {
- return 1;
- }
-
/// getInstrLatency - Compute the instruction latency of a given instruction.
/// If the instruction has higher cost when predicated, it's returned via
/// PredCost.
Modified: llvm/branches/R600/include/llvm/Target/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Target/TargetLowering.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Target/TargetLowering.h (original)
+++ llvm/branches/R600/include/llvm/Target/TargetLowering.h Thu Oct 11 16:28:00 2012
@@ -22,6 +22,7 @@
#ifndef LLVM_TARGET_TARGETLOWERING_H
#define LLVM_TARGET_TARGETLOWERING_H
+#include "llvm/AddressingMode.h"
#include "llvm/CallingConv.h"
#include "llvm/InlineAsm.h"
#include "llvm/Attributes.h"
@@ -50,7 +51,7 @@
class MCContext;
class MCExpr;
template<typename T> class SmallVectorImpl;
- class TargetData;
+ class DataLayout;
class TargetRegisterClass;
class TargetLibraryInfo;
class TargetLoweringObjectFile;
@@ -137,12 +138,15 @@
virtual ~TargetLowering();
const TargetMachine &getTargetMachine() const { return TM; }
- const TargetData *getTargetData() const { return TD; }
+ const DataLayout *getDataLayout() const { return TD; }
const TargetLoweringObjectFile &getObjFileLowering() const { return TLOF; }
bool isBigEndian() const { return !IsLittleEndian; }
bool isLittleEndian() const { return IsLittleEndian; }
- MVT getPointerTy() const { return PointerTy; }
+ // Return the pointer type for the given address space, defaults to
+ // the pointer type from the data layout.
+ // FIXME: The default needs to be removed once all the code is updated.
+ virtual MVT getPointerTy(uint32_t addrspace = 0) const { return PointerTy; }
virtual MVT getShiftAmountTy(EVT LHSTy) const;
/// isSelectExpensive - Return true if the select operation is expensive for
@@ -157,12 +161,12 @@
/// isSlowDivBypassed - Returns true if target has indicated at least one
/// type should be bypassed.
- bool isSlowDivBypassed() const { return !BypassSlowDivTypes.empty(); }
+ bool isSlowDivBypassed() const { return !BypassSlowDivWidths.empty(); }
/// getBypassSlowDivTypes - Returns map of slow types for division or
/// remainder with corresponding fast types
- const DenseMap<Type *, Type *> &getBypassSlowDivTypes() const {
- return BypassSlowDivTypes;
+ const DenseMap<unsigned int, unsigned int> &getBypassSlowDivWidths() const {
+ return BypassSlowDivWidths;
}
/// isPow2DivCheap() - Return true if pow2 div is cheaper than a chain of
@@ -1083,9 +1087,9 @@
/// of instructions not containing an integer divide.
void setIntDivIsCheap(bool isCheap = true) { IntDivIsCheap = isCheap; }
- /// addBypassSlowDivType - Tells the code generator which types to bypass.
- void addBypassSlowDivType(Type *slow_type, Type *fast_type) {
- BypassSlowDivTypes[slow_type] = fast_type;
+ /// addBypassSlowDiv - Tells the code generator which bitwidths to bypass.
+ void addBypassSlowDiv(unsigned int SlowBitWidth, unsigned int FastBitWidth) {
+ BypassSlowDivWidths[SlowBitWidth] = FastBitWidth;
}
/// setPow2DivIsCheap - Tells the code generator that it shouldn't generate
@@ -1319,9 +1323,9 @@
FunctionType *FTy, bool isTailCall, SDValue callee,
ArgListTy &args, SelectionDAG &dag, DebugLoc dl,
ImmutableCallSite &cs)
- : Chain(chain), RetTy(retTy), RetSExt(cs.paramHasAttr(0, Attribute::SExt)),
- RetZExt(cs.paramHasAttr(0, Attribute::ZExt)), IsVarArg(FTy->isVarArg()),
- IsInReg(cs.paramHasAttr(0, Attribute::InReg)),
+ : Chain(chain), RetTy(retTy), RetSExt(cs.paramHasAttr(0, Attributes::SExt)),
+ RetZExt(cs.paramHasAttr(0, Attributes::ZExt)), IsVarArg(FTy->isVarArg()),
+ IsInReg(cs.paramHasAttr(0, Attributes::InReg)),
DoesNotReturn(cs.doesNotReturn()),
IsReturnValueUsed(!cs.getInstruction()->use_empty()),
IsTailCall(isTailCall), NumFixedArgs(FTy->getNumParams()),
@@ -1632,22 +1636,6 @@
// Addressing mode description hooks (used by LSR etc).
//
- /// AddrMode - This represents an addressing mode of:
- /// BaseGV + BaseOffs + BaseReg + Scale*ScaleReg
- /// If BaseGV is null, there is no BaseGV.
- /// If BaseOffs is zero, there is no base offset.
- /// If HasBaseReg is false, there is no base register.
- /// If Scale is zero, there is no ScaleReg. Scale of 1 indicates a reg with
- /// no scale.
- ///
- struct AddrMode {
- GlobalValue *BaseGV;
- int64_t BaseOffs;
- bool HasBaseReg;
- int64_t Scale;
- AddrMode() : BaseGV(0), BaseOffs(0), HasBaseReg(false), Scale(0) {}
- };
-
/// GetAddrModeArguments - CodeGenPrepare sinks address calculations into the
/// same BB as Load/Store instructions reading the address. This allows as
/// much computation as possible to be done in the address mode for that
@@ -1789,10 +1777,11 @@
private:
const TargetMachine &TM;
- const TargetData *TD;
+ const DataLayout *TD;
const TargetLoweringObjectFile &TLOF;
- /// PointerTy - The type to use for pointers, usually i32 or i64.
+ /// PointerTy - The type to use for pointers for the default address space,
+ /// usually i32 or i64.
///
MVT PointerTy;
@@ -1810,11 +1799,11 @@
/// set to true unconditionally.
bool IntDivIsCheap;
- /// BypassSlowDivTypes - Tells the code generator to bypass slow divide or
- /// remainder instructions. For example, SlowDivBypass[i32,u8] tells the code
- /// generator to bypass 32-bit signed integer div/rem with an 8-bit unsigned
+ /// BypassSlowDivMap - Tells the code generator to bypass slow divide or
+ /// remainder instructions. For example, BypassSlowDivWidths[32,8] tells the
+ /// code generator to bypass 32-bit integer div/rem with an 8-bit unsigned
/// integer div/rem when the operands are positive and less than 256.
- DenseMap <Type *, Type *> BypassSlowDivTypes;
+ DenseMap <unsigned int, unsigned int> BypassSlowDivWidths;
/// Pow2DivIsCheap - Tells the code generator that it shouldn't generate
/// srl/add/sra for a signed divide by power of two, and let the target handle
Modified: llvm/branches/R600/include/llvm/Target/TargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Target/TargetMachine.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Target/TargetMachine.h (original)
+++ llvm/branches/R600/include/llvm/Target/TargetMachine.h Thu Oct 11 16:28:00 2012
@@ -31,7 +31,7 @@
class MCContext;
class PassManagerBase;
class Target;
-class TargetData;
+class DataLayout;
class TargetELFWriterInfo;
class TargetFrameLowering;
class TargetInstrInfo;
@@ -106,7 +106,7 @@
virtual const TargetFrameLowering *getFrameLowering() const { return 0; }
virtual const TargetLowering *getTargetLowering() const { return 0; }
virtual const TargetSelectionDAGInfo *getSelectionDAGInfo() const{ return 0; }
- virtual const TargetData *getTargetData() const { return 0; }
+ virtual const DataLayout *getDataLayout() const { return 0; }
/// getMCAsmInfo - Return target specific asm information.
///
Modified: llvm/branches/R600/include/llvm/Target/TargetSchedule.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Target/TargetSchedule.td?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Target/TargetSchedule.td (original)
+++ llvm/branches/R600/include/llvm/Target/TargetSchedule.td Thu Oct 11 16:28:00 2012
@@ -55,6 +55,15 @@
class Instruction; // Forward def
+// DAG operator that interprets the DAG args as Instruction defs.
+def instrs;
+
+// DAG operator that interprets each DAG arg as a regex pattern for
+// matching Instruction opcode names.
+// The regex must match the beginning of the opcode (as in Python re.match).
+// To avoid matching prefixes, append '$' to the pattern.
+def instregex;
+
// Define the SchedMachineModel and provide basic properties for
// coarse grained instruction cost model. Default values for the
// properties are defined in MCSchedModel. A value of "-1" in the
@@ -325,9 +334,9 @@
// the subtarget to easily override specific operations.
//
// SchedModel ties this opcode mapping to a processor.
-class InstRW<list<SchedReadWrite> rw, list<Instruction> instrs> {
+class InstRW<list<SchedReadWrite> rw, dag instrlist> {
list<SchedReadWrite> OperandReadWrites = rw;
- list<Instruction> Instrs = instrs;
+ dag Instrs = instrlist;
SchedMachineModel SchedModel = ?;
}
Modified: llvm/branches/R600/include/llvm/Target/TargetSelectionDAGInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Target/TargetSelectionDAGInfo.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Target/TargetSelectionDAGInfo.h (original)
+++ llvm/branches/R600/include/llvm/Target/TargetSelectionDAGInfo.h Thu Oct 11 16:28:00 2012
@@ -20,7 +20,7 @@
namespace llvm {
-class TargetData;
+class DataLayout;
class TargetMachine;
//===----------------------------------------------------------------------===//
@@ -31,10 +31,10 @@
TargetSelectionDAGInfo(const TargetSelectionDAGInfo &) LLVM_DELETED_FUNCTION;
void operator=(const TargetSelectionDAGInfo &) LLVM_DELETED_FUNCTION;
- const TargetData *TD;
+ const DataLayout *TD;
protected:
- const TargetData *getTargetData() const { return TD; }
+ const DataLayout *getDataLayout() const { return TD; }
public:
explicit TargetSelectionDAGInfo(const TargetMachine &TM);
Modified: llvm/branches/R600/include/llvm/Target/TargetSubtargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Target/TargetSubtargetInfo.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Target/TargetSubtargetInfo.h (original)
+++ llvm/branches/R600/include/llvm/Target/TargetSubtargetInfo.h Thu Oct 11 16:28:00 2012
@@ -54,12 +54,6 @@
return 0;
}
- /// getSpecialAddressLatency - For targets where it is beneficial to
- /// backschedule instructions that compute addresses, return a value
- /// indicating the number of scheduling cycles of backscheduling that
- /// should be attempted.
- virtual unsigned getSpecialAddressLatency() const { return 0; }
-
// enablePostRAScheduler - If the target can benefit from post-regalloc
// scheduling and the specified optimization level meets the requirement
// return true to enable post-register-allocation scheduling. In
Modified: llvm/branches/R600/include/llvm/Transforms/IPO/InlinerPass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Transforms/IPO/InlinerPass.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Transforms/IPO/InlinerPass.h (original)
+++ llvm/branches/R600/include/llvm/Transforms/IPO/InlinerPass.h Thu Oct 11 16:28:00 2012
@@ -21,7 +21,7 @@
namespace llvm {
class CallSite;
- class TargetData;
+ class DataLayout;
class InlineCost;
template<class PtrType, unsigned SmallSize>
class SmallPtrSet;
Modified: llvm/branches/R600/include/llvm/Transforms/Utils/AddrModeMatcher.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Transforms/Utils/AddrModeMatcher.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Transforms/Utils/AddrModeMatcher.h (original)
+++ llvm/branches/R600/include/llvm/Transforms/Utils/AddrModeMatcher.h Thu Oct 11 16:28:00 2012
@@ -19,6 +19,7 @@
#ifndef LLVM_TRANSFORMS_UTILS_ADDRMODEMATCHER_H
#define LLVM_TRANSFORMS_UTILS_ADDRMODEMATCHER_H
+#include "llvm/AddressingMode.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Target/TargetLowering.h"
@@ -33,7 +34,7 @@
/// ExtAddrMode - This is an extended version of TargetLowering::AddrMode
/// which holds actual Value*'s for register values.
-struct ExtAddrMode : public TargetLowering::AddrMode {
+struct ExtAddrMode : public AddrMode {
Value *BaseReg;
Value *ScaledReg;
ExtAddrMode() : BaseReg(0), ScaledReg(0) {}
Modified: llvm/branches/R600/include/llvm/Transforms/Utils/BuildLibCalls.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Transforms/Utils/BuildLibCalls.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Transforms/Utils/BuildLibCalls.h (original)
+++ llvm/branches/R600/include/llvm/Transforms/Utils/BuildLibCalls.h Thu Oct 11 16:28:00 2012
@@ -19,7 +19,7 @@
namespace llvm {
class Value;
- class TargetData;
+ class DataLayout;
class TargetLibraryInfo;
/// CastToCStr - Return V if it is an i8*, otherwise cast it to i8*.
@@ -28,52 +28,52 @@
/// EmitStrLen - Emit a call to the strlen function to the builder, for the
/// specified pointer. Ptr is required to be some pointer type, and the
/// return value has 'intptr_t' type.
- Value *EmitStrLen(Value *Ptr, IRBuilder<> &B, const TargetData *TD,
+ Value *EmitStrLen(Value *Ptr, IRBuilder<> &B, const DataLayout *TD,
const TargetLibraryInfo *TLI);
/// EmitStrNLen - Emit a call to the strnlen function to the builder, for the
/// specified pointer. Ptr is required to be some pointer type, MaxLen must
/// be of size_t type, and the return value has 'intptr_t' type.
Value *EmitStrNLen(Value *Ptr, Value *MaxLen, IRBuilder<> &B,
- const TargetData *TD, const TargetLibraryInfo *TLI);
+ const DataLayout *TD, const TargetLibraryInfo *TLI);
/// EmitStrChr - Emit a call to the strchr function to the builder, for the
/// specified pointer and character. Ptr is required to be some pointer type,
/// and the return value has 'i8*' type.
- Value *EmitStrChr(Value *Ptr, char C, IRBuilder<> &B, const TargetData *TD,
+ Value *EmitStrChr(Value *Ptr, char C, IRBuilder<> &B, const DataLayout *TD,
const TargetLibraryInfo *TLI);
/// EmitStrNCmp - Emit a call to the strncmp function to the builder.
Value *EmitStrNCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B,
- const TargetData *TD, const TargetLibraryInfo *TLI);
+ const DataLayout *TD, const TargetLibraryInfo *TLI);
/// EmitStrCpy - Emit a call to the strcpy function to the builder, for the
/// specified pointer arguments.
Value *EmitStrCpy(Value *Dst, Value *Src, IRBuilder<> &B,
- const TargetData *TD, const TargetLibraryInfo *TLI,
+ const DataLayout *TD, const TargetLibraryInfo *TLI,
StringRef Name = "strcpy");
/// EmitStrNCpy - Emit a call to the strncpy function to the builder, for the
/// specified pointer arguments and length.
Value *EmitStrNCpy(Value *Dst, Value *Src, Value *Len, IRBuilder<> &B,
- const TargetData *TD, const TargetLibraryInfo *TLI,
+ const DataLayout *TD, const TargetLibraryInfo *TLI,
StringRef Name = "strncpy");
/// EmitMemCpyChk - Emit a call to the __memcpy_chk function to the builder.
/// This expects that the Len and ObjSize have type 'intptr_t' and Dst/Src
/// are pointers.
Value *EmitMemCpyChk(Value *Dst, Value *Src, Value *Len, Value *ObjSize,
- IRBuilder<> &B, const TargetData *TD,
+ IRBuilder<> &B, const DataLayout *TD,
const TargetLibraryInfo *TLI);
/// EmitMemChr - Emit a call to the memchr function. This assumes that Ptr is
/// a pointer, Val is an i32 value, and Len is an 'intptr_t' value.
Value *EmitMemChr(Value *Ptr, Value *Val, Value *Len, IRBuilder<> &B,
- const TargetData *TD, const TargetLibraryInfo *TLI);
+ const DataLayout *TD, const TargetLibraryInfo *TLI);
/// EmitMemCmp - Emit a call to the memcmp function.
Value *EmitMemCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B,
- const TargetData *TD, const TargetLibraryInfo *TLI);
+ const DataLayout *TD, const TargetLibraryInfo *TLI);
/// EmitUnaryFloatFnCall - Emit a call to the unary function named 'Name'
/// (e.g. 'floor'). This function is known to take a single of type matching
@@ -85,28 +85,28 @@
/// EmitPutChar - Emit a call to the putchar function. This assumes that Char
/// is an integer.
- Value *EmitPutChar(Value *Char, IRBuilder<> &B, const TargetData *TD,
+ Value *EmitPutChar(Value *Char, IRBuilder<> &B, const DataLayout *TD,
const TargetLibraryInfo *TLI);
/// EmitPutS - Emit a call to the puts function. This assumes that Str is
/// some pointer.
- Value *EmitPutS(Value *Str, IRBuilder<> &B, const TargetData *TD,
+ Value *EmitPutS(Value *Str, IRBuilder<> &B, const DataLayout *TD,
const TargetLibraryInfo *TLI);
/// EmitFPutC - Emit a call to the fputc function. This assumes that Char is
/// an i32, and File is a pointer to FILE.
Value *EmitFPutC(Value *Char, Value *File, IRBuilder<> &B,
- const TargetData *TD, const TargetLibraryInfo *TLI);
+ const DataLayout *TD, const TargetLibraryInfo *TLI);
/// EmitFPutS - Emit a call to the puts function. Str is required to be a
/// pointer and File is a pointer to FILE.
- Value *EmitFPutS(Value *Str, Value *File, IRBuilder<> &B, const TargetData *TD,
+ Value *EmitFPutS(Value *Str, Value *File, IRBuilder<> &B, const DataLayout *TD,
const TargetLibraryInfo *TLI);
/// EmitFWrite - Emit a call to the fwrite function. This assumes that Ptr is
/// a pointer, Size is an 'intptr_t', and File is a pointer to FILE.
Value *EmitFWrite(Value *Ptr, Value *Size, Value *File, IRBuilder<> &B,
- const TargetData *TD, const TargetLibraryInfo *TLI);
+ const DataLayout *TD, const TargetLibraryInfo *TLI);
/// SimplifyFortifiedLibCalls - Helper class for folding checked library
/// calls (e.g. __strcpy_chk) into their unchecked counterparts.
@@ -118,7 +118,7 @@
bool isString) const = 0;
public:
virtual ~SimplifyFortifiedLibCalls();
- bool fold(CallInst *CI, const TargetData *TD, const TargetLibraryInfo *TLI);
+ bool fold(CallInst *CI, const DataLayout *TD, const TargetLibraryInfo *TLI);
};
}
Modified: llvm/branches/R600/include/llvm/Transforms/Utils/BypassSlowDivision.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Transforms/Utils/BypassSlowDivision.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Transforms/Utils/BypassSlowDivision.h (original)
+++ llvm/branches/R600/include/llvm/Transforms/Utils/BypassSlowDivision.h Thu Oct 11 16:28:00 2012
@@ -26,7 +26,7 @@
/// profitably bypassed and carried out with a shorter, faster divide.
bool bypassSlowDivision(Function &F,
Function::iterator &I,
- const DenseMap<Type*, Type*> &BypassTypeMap);
+ const DenseMap<unsigned int, unsigned int> &BypassWidth);
} // End llvm namespace
Modified: llvm/branches/R600/include/llvm/Transforms/Utils/Cloning.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Transforms/Utils/Cloning.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Transforms/Utils/Cloning.h (original)
+++ llvm/branches/R600/include/llvm/Transforms/Utils/Cloning.h Thu Oct 11 16:28:00 2012
@@ -39,7 +39,7 @@
class CallSite;
class Trace;
class CallGraph;
-class TargetData;
+class DataLayout;
class Loop;
class LoopInfo;
class AllocaInst;
@@ -150,7 +150,7 @@
SmallVectorImpl<ReturnInst*> &Returns,
const char *NameSuffix = "",
ClonedCodeInfo *CodeInfo = 0,
- const TargetData *TD = 0,
+ const DataLayout *TD = 0,
Instruction *TheCall = 0);
@@ -158,13 +158,13 @@
/// InlineFunction call, and records the auxiliary results produced by it.
class InlineFunctionInfo {
public:
- explicit InlineFunctionInfo(CallGraph *cg = 0, const TargetData *td = 0)
+ explicit InlineFunctionInfo(CallGraph *cg = 0, const DataLayout *td = 0)
: CG(cg), TD(td) {}
/// CG - If non-null, InlineFunction will update the callgraph to reflect the
/// changes it makes.
CallGraph *CG;
- const TargetData *TD;
+ const DataLayout *TD;
/// StaticAllocas - InlineFunction fills this in with all static allocas that
/// get copied into the caller.
Modified: llvm/branches/R600/include/llvm/Transforms/Utils/Local.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Transforms/Utils/Local.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Transforms/Utils/Local.h (original)
+++ llvm/branches/R600/include/llvm/Transforms/Utils/Local.h Thu Oct 11 16:28:00 2012
@@ -18,7 +18,7 @@
#include "llvm/IRBuilder.h"
#include "llvm/Operator.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
namespace llvm {
@@ -35,7 +35,7 @@
class PHINode;
class AllocaInst;
class ConstantExpr;
-class TargetData;
+class DataLayout;
class TargetLibraryInfo;
class DIBuilder;
@@ -84,7 +84,7 @@
///
/// This returns true if it changed the code, note that it can delete
/// instructions in other blocks as well in this block.
-bool SimplifyInstructionsInBlock(BasicBlock *BB, const TargetData *TD = 0,
+bool SimplifyInstructionsInBlock(BasicBlock *BB, const DataLayout *TD = 0,
const TargetLibraryInfo *TLI = 0);
//===----------------------------------------------------------------------===//
@@ -103,7 +103,7 @@
/// .. and delete the predecessor corresponding to the '1', this will attempt to
/// recursively fold the 'and' to 0.
void RemovePredecessorAndSimplify(BasicBlock *BB, BasicBlock *Pred,
- TargetData *TD = 0);
+ DataLayout *TD = 0);
/// MergeBasicBlockIntoOnlyPred - BB is a block with one predecessor and its
@@ -134,7 +134,7 @@
/// of the CFG. It returns true if a modification was made, possibly deleting
/// the basic block that was pointed to.
///
-bool SimplifyCFG(BasicBlock *BB, const TargetData *TD = 0);
+bool SimplifyCFG(BasicBlock *BB, const DataLayout *TD = 0);
/// FoldBranchToCommonDest - If this basic block is ONLY a setcc and a branch,
/// and if a predecessor branches to us and one of our successors, fold the
@@ -162,10 +162,10 @@
/// and it is more than the alignment of the ultimate object, see if we can
/// increase the alignment of the ultimate object, making this check succeed.
unsigned getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign,
- const TargetData *TD = 0);
+ const DataLayout *TD = 0);
/// getKnownAlignment - Try to infer an alignment for the specified pointer.
-static inline unsigned getKnownAlignment(Value *V, const TargetData *TD = 0) {
+static inline unsigned getKnownAlignment(Value *V, const DataLayout *TD = 0) {
return getOrEnforceKnownAlignment(V, 0, TD);
}
@@ -175,7 +175,7 @@
/// When NoAssumptions is true, no assumptions about index computation not
/// overflowing is made.
template<typename IRBuilderTy>
-Value *EmitGEPOffset(IRBuilderTy *Builder, const TargetData &TD, User *GEP,
+Value *EmitGEPOffset(IRBuilderTy *Builder, const DataLayout &TD, User *GEP,
bool NoAssumptions = false) {
gep_type_iterator GTI = gep_type_begin(GEP);
Type *IntPtrTy = TD.getIntPtrType(GEP->getContext());
Modified: llvm/branches/R600/include/llvm/Type.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/Type.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/Type.h (original)
+++ llvm/branches/R600/include/llvm/Type.h Thu Oct 11 16:28:00 2012
@@ -252,7 +252,7 @@
/// isSized - Return true if it makes sense to take the size of this type. To
/// get the actual size for a particular target, it is reasonable to use the
- /// TargetData subsystem to do this.
+ /// DataLayout subsystem to do this.
///
bool isSized() const {
// If it's a primitive, it is always sized.
@@ -276,7 +276,7 @@
///
/// Note that this may not reflect the size of memory allocated for an
/// instance of the type or the number of bytes that are written when an
- /// instance of the type is stored to memory. The TargetData class provides
+ /// instance of the type is stored to memory. The DataLayout class provides
/// additional query functions to provide this information.
///
unsigned getPrimitiveSizeInBits() const;
Modified: llvm/branches/R600/include/llvm/User.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/User.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/User.h (original)
+++ llvm/branches/R600/include/llvm/User.h Thu Oct 11 16:28:00 2012
@@ -104,7 +104,7 @@
assert(i < NumOperands && "getOperandUse() out of range!");
return OperandList[i];
}
-
+
unsigned getNumOperands() const { return NumOperands; }
// ---------------------------------------------------------------------------
@@ -118,6 +118,45 @@
inline op_iterator op_end() { return OperandList+NumOperands; }
inline const_op_iterator op_end() const { return OperandList+NumOperands; }
+ /// Convenience iterator for directly iterating over the Values in the
+ /// OperandList
+ class value_op_iterator : public std::iterator<std::forward_iterator_tag,
+ Value*> {
+ op_iterator OI;
+ public:
+ explicit value_op_iterator(Use *U) : OI(U) {}
+
+ bool operator==(const value_op_iterator &x) const {
+ return OI == x.OI;
+ }
+ bool operator!=(const value_op_iterator &x) const {
+ return !operator==(x);
+ }
+
+ /// Iterator traversal: forward iteration only
+ value_op_iterator &operator++() { // Preincrement
+ ++OI;
+ return *this;
+ }
+ value_op_iterator operator++(int) { // Postincrement
+ value_op_iterator tmp = *this; ++*this; return tmp;
+ }
+
+ /// Retrieve a pointer to the current Value.
+ Value *operator*() const {
+ return *OI;
+ }
+
+ Value *operator->() const { return operator*(); }
+ };
+
+ inline value_op_iterator value_op_begin() {
+ return value_op_iterator(op_begin());
+ }
+ inline value_op_iterator value_op_end() {
+ return value_op_iterator(op_end());
+ }
+
// dropAllReferences() - This function is in charge of "letting go" of all
// objects that this User refers to. This allows one to
// 'delete' a whole class at a time, even though there may be circular
Modified: llvm/branches/R600/lib/Analysis/AliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/AliasAnalysis.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/AliasAnalysis.cpp (original)
+++ llvm/branches/R600/lib/Analysis/AliasAnalysis.cpp Thu Oct 11 16:28:00 2012
@@ -35,7 +35,7 @@
#include "llvm/Instructions.h"
#include "llvm/LLVMContext.h"
#include "llvm/Type.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLibraryInfo.h"
using namespace llvm;
@@ -452,7 +452,7 @@
/// AliasAnalysis interface before any other methods are called.
///
void AliasAnalysis::InitializeAliasAnalysis(Pass *P) {
- TD = P->getAnalysisIfAvailable<TargetData>();
+ TD = P->getAnalysisIfAvailable<DataLayout>();
TLI = P->getAnalysisIfAvailable<TargetLibraryInfo>();
AA = &P->getAnalysis<AliasAnalysis>();
}
@@ -463,7 +463,7 @@
AU.addRequired<AliasAnalysis>(); // All AA's chain
}
-/// getTypeStoreSize - Return the TargetData store size for the given type,
+/// getTypeStoreSize - Return the DataLayout store size for the given type,
/// if known, or a conservative value otherwise.
///
uint64_t AliasAnalysis::getTypeStoreSize(Type *Ty) {
@@ -503,7 +503,7 @@
bool llvm::isNoAliasCall(const Value *V) {
if (isa<CallInst>(V) || isa<InvokeInst>(V))
return ImmutableCallSite(cast<Instruction>(V))
- .paramHasAttr(0, Attribute::NoAlias);
+ .paramHasAttr(0, Attributes::NoAlias);
return false;
}
Modified: llvm/branches/R600/lib/Analysis/AliasSetTracker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/AliasSetTracker.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/AliasSetTracker.cpp (original)
+++ llvm/branches/R600/lib/Analysis/AliasSetTracker.cpp Thu Oct 11 16:28:00 2012
@@ -18,7 +18,7 @@
#include "llvm/LLVMContext.h"
#include "llvm/Pass.h"
#include "llvm/Type.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
Modified: llvm/branches/R600/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/BasicAliasAnalysis.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/branches/R600/lib/Analysis/BasicAliasAnalysis.cpp Thu Oct 11 16:28:00 2012
@@ -29,7 +29,7 @@
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/ValueTracking.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
@@ -84,7 +84,7 @@
/// getObjectSize - Return the size of the object specified by V, or
/// UnknownSize if unknown.
-static uint64_t getObjectSize(const Value *V, const TargetData &TD,
+static uint64_t getObjectSize(const Value *V, const DataLayout &TD,
const TargetLibraryInfo &TLI,
bool RoundToAlign = false) {
uint64_t Size;
@@ -96,7 +96,7 @@
/// isObjectSmallerThan - Return true if we can prove that the object specified
/// by V is smaller than Size.
static bool isObjectSmallerThan(const Value *V, uint64_t Size,
- const TargetData &TD,
+ const DataLayout &TD,
const TargetLibraryInfo &TLI) {
// This function needs to use the aligned object size because we allow
// reads a bit past the end given sufficient alignment.
@@ -108,7 +108,7 @@
/// isObjectSize - Return true if we can prove that the object specified
/// by V has size Size.
static bool isObjectSize(const Value *V, uint64_t Size,
- const TargetData &TD, const TargetLibraryInfo &TLI) {
+ const DataLayout &TD, const TargetLibraryInfo &TLI) {
uint64_t ObjectSize = getObjectSize(V, TD, TLI);
return ObjectSize != AliasAnalysis::UnknownSize && ObjectSize == Size;
}
@@ -151,7 +151,7 @@
/// represented in the result.
static Value *GetLinearExpression(Value *V, APInt &Scale, APInt &Offset,
ExtensionKind &Extension,
- const TargetData &TD, unsigned Depth) {
+ const DataLayout &TD, unsigned Depth) {
assert(V->getType()->isIntegerTy() && "Not an integer value");
// Limit our recursion depth.
@@ -226,14 +226,14 @@
/// specified amount, but which may have other unrepresented high bits. As such,
/// the gep cannot necessarily be reconstructed from its decomposed form.
///
-/// When TargetData is around, this function is capable of analyzing everything
+/// When DataLayout is around, this function is capable of analyzing everything
/// that GetUnderlyingObject can look through. When not, it just looks
/// through pointer casts.
///
static const Value *
DecomposeGEPExpression(const Value *V, int64_t &BaseOffs,
SmallVectorImpl<VariableGEPIndex> &VarIndices,
- const TargetData *TD) {
+ const DataLayout *TD) {
// Limit recursion depth to limit compile time in crazy cases.
unsigned MaxLookup = 6;
@@ -277,7 +277,7 @@
->getElementType()->isSized())
return V;
- // If we are lacking TargetData information, we can't compute the offets of
+ // If we are lacking DataLayout information, we can't compute the offets of
// elements computed by GEPs. However, we can handle bitcast equivalent
// GEPs.
if (TD == 0) {
@@ -868,7 +868,7 @@
const Value *GEP1BasePtr =
DecomposeGEPExpression(GEP1, GEP1BaseOffset, GEP1VariableIndices, TD);
// DecomposeGEPExpression and GetUnderlyingObject should return the
- // same result except when DecomposeGEPExpression has no TargetData.
+ // same result except when DecomposeGEPExpression has no DataLayout.
if (GEP1BasePtr != UnderlyingV1 || GEP2BasePtr != UnderlyingV2) {
assert(TD == 0 &&
"DecomposeGEPExpression and GetUnderlyingObject disagree!");
@@ -902,7 +902,7 @@
DecomposeGEPExpression(GEP2, GEP2BaseOffset, GEP2VariableIndices, TD);
// DecomposeGEPExpression and GetUnderlyingObject should return the
- // same result except when DecomposeGEPExpression has no TargetData.
+ // same result except when DecomposeGEPExpression has no DataLayout.
if (GEP1BasePtr != UnderlyingV1 || GEP2BasePtr != UnderlyingV2) {
assert(TD == 0 &&
"DecomposeGEPExpression and GetUnderlyingObject disagree!");
@@ -937,7 +937,7 @@
DecomposeGEPExpression(GEP1, GEP1BaseOffset, GEP1VariableIndices, TD);
// DecomposeGEPExpression and GetUnderlyingObject should return the
- // same result except when DecomposeGEPExpression has no TargetData.
+ // same result except when DecomposeGEPExpression has no DataLayout.
if (GEP1BasePtr != UnderlyingV1) {
assert(TD == 0 &&
"DecomposeGEPExpression and GetUnderlyingObject disagree!");
Modified: llvm/branches/R600/lib/Analysis/CaptureTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/CaptureTracking.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/CaptureTracking.cpp (original)
+++ llvm/branches/R600/lib/Analysis/CaptureTracking.cpp Thu Oct 11 16:28:00 2012
@@ -23,6 +23,8 @@
CaptureTracker::~CaptureTracker() {}
+bool CaptureTracker::shouldExplore(Use *U) { return true; }
+
namespace {
struct SimpleCaptureTracker : public CaptureTracker {
explicit SimpleCaptureTracker(bool ReturnCaptures)
@@ -30,8 +32,6 @@
void tooManyUses() { Captured = true; }
- bool shouldExplore(Use *U) { return true; }
-
bool captured(Use *U) {
if (isa<ReturnInst>(U->getUser()) && !ReturnCaptures)
return false;
Modified: llvm/branches/R600/lib/Analysis/CodeMetrics.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/CodeMetrics.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/CodeMetrics.cpp (original)
+++ llvm/branches/R600/lib/Analysis/CodeMetrics.cpp Thu Oct 11 16:28:00 2012
@@ -15,7 +15,7 @@
#include "llvm/Function.h"
#include "llvm/Support/CallSite.h"
#include "llvm/IntrinsicInst.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
using namespace llvm;
@@ -54,7 +54,7 @@
return false;
}
-bool llvm::isInstructionFree(const Instruction *I, const TargetData *TD) {
+bool llvm::isInstructionFree(const Instruction *I, const DataLayout *TD) {
if (isa<PHINode>(I))
return true;
@@ -119,7 +119,7 @@
/// analyzeBasicBlock - Fill in the current structure with information gleaned
/// from the specified block.
void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB,
- const TargetData *TD) {
+ const DataLayout *TD) {
++NumBlocks;
unsigned NumInstsBeforeThisBB = NumInsts;
for (BasicBlock::const_iterator II = BB->begin(), E = BB->end();
@@ -189,14 +189,14 @@
NumBBInsts[BB] = NumInsts - NumInstsBeforeThisBB;
}
-void CodeMetrics::analyzeFunction(Function *F, const TargetData *TD) {
+void CodeMetrics::analyzeFunction(Function *F, const DataLayout *TD) {
// If this function contains a call that "returns twice" (e.g., setjmp or
// _setjmp) and it isn't marked with "returns twice" itself, never inline it.
// This is a hack because we depend on the user marking their local variables
// as volatile if they are live across a setjmp call, and they probably
// won't do this in callers.
exposesReturnsTwice = F->callsFunctionThatReturnsTwice() &&
- !F->getFnAttributes().hasReturnsTwiceAttr();
+ !F->getFnAttributes().hasAttribute(Attributes::ReturnsTwice);
// Look at the size of the callee.
for (Function::const_iterator BB = F->begin(), E = F->end(); BB != E; ++BB)
Modified: llvm/branches/R600/lib/Analysis/ConstantFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/ConstantFolding.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/ConstantFolding.cpp (original)
+++ llvm/branches/R600/lib/Analysis/ConstantFolding.cpp Thu Oct 11 16:28:00 2012
@@ -11,7 +11,7 @@
//
// Also, to supplement the basic VMCore ConstantExpr simplifications,
// this file defines some additional folding routines that can make use of
-// TargetData information. These functions cannot go in VMCore due to library
+// DataLayout information. These functions cannot go in VMCore due to library
// dependency issues.
//
//===----------------------------------------------------------------------===//
@@ -25,7 +25,7 @@
#include "llvm/Intrinsics.h"
#include "llvm/Operator.h"
#include "llvm/Analysis/ValueTracking.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
@@ -42,10 +42,10 @@
//===----------------------------------------------------------------------===//
/// FoldBitCast - Constant fold bitcast, symbolically evaluating it with
-/// TargetData. This always returns a non-null constant, but it may be a
+/// DataLayout. This always returns a non-null constant, but it may be a
/// ConstantExpr if unfoldable.
static Constant *FoldBitCast(Constant *C, Type *DestTy,
- const TargetData &TD) {
+ const DataLayout &TD) {
// Catch the obvious splat cases.
if (C->isNullValue() && !DestTy->isX86_MMXTy())
return Constant::getNullValue(DestTy);
@@ -218,7 +218,7 @@
/// from a global, return the global and the constant. Because of
/// constantexprs, this function is recursive.
static bool IsConstantOffsetFromGlobal(Constant *C, GlobalValue *&GV,
- int64_t &Offset, const TargetData &TD) {
+ int64_t &Offset, const DataLayout &TD) {
// Trivial case, constant is the global.
if ((GV = dyn_cast<GlobalValue>(C))) {
Offset = 0;
@@ -274,7 +274,7 @@
/// the CurPtr buffer. TD is the target data.
static bool ReadDataFromGlobal(Constant *C, uint64_t ByteOffset,
unsigned char *CurPtr, unsigned BytesLeft,
- const TargetData &TD) {
+ const DataLayout &TD) {
assert(ByteOffset <= TD.getTypeAllocSize(C->getType()) &&
"Out of range access");
@@ -388,7 +388,7 @@
}
static Constant *FoldReinterpretLoadFromConstPtr(Constant *C,
- const TargetData &TD) {
+ const DataLayout &TD) {
Type *LoadTy = cast<PointerType>(C->getType())->getElementType();
IntegerType *IntType = dyn_cast<IntegerType>(LoadTy);
@@ -455,7 +455,7 @@
/// produce if it is constant and determinable. If this is not determinable,
/// return null.
Constant *llvm::ConstantFoldLoadFromConstPtr(Constant *C,
- const TargetData *TD) {
+ const DataLayout *TD) {
// First, try the easy cases:
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(C))
if (GV->isConstant() && GV->hasDefinitiveInitializer())
@@ -529,7 +529,7 @@
return 0;
}
-static Constant *ConstantFoldLoadInst(const LoadInst *LI, const TargetData *TD){
+static Constant *ConstantFoldLoadInst(const LoadInst *LI, const DataLayout *TD){
if (LI->isVolatile()) return 0;
if (Constant *C = dyn_cast<Constant>(LI->getOperand(0)))
@@ -543,7 +543,7 @@
/// these together. If target data info is available, it is provided as TD,
/// otherwise TD is null.
static Constant *SymbolicallyEvaluateBinop(unsigned Opc, Constant *Op0,
- Constant *Op1, const TargetData *TD){
+ Constant *Op1, const DataLayout *TD){
// SROA
// Fold (and 0xffffffff00000000, (shl x, 32)) -> shl.
@@ -572,7 +572,7 @@
/// explicitly cast them so that they aren't implicitly casted by the
/// getelementptr.
static Constant *CastGEPIndices(ArrayRef<Constant *> Ops,
- Type *ResultTy, const TargetData *TD,
+ Type *ResultTy, const DataLayout *TD,
const TargetLibraryInfo *TLI) {
if (!TD) return 0;
Type *IntPtrTy = TD->getIntPtrType(ResultTy->getContext());
@@ -622,7 +622,7 @@
/// SymbolicallyEvaluateGEP - If we can symbolically evaluate the specified GEP
/// constant expression, do so.
static Constant *SymbolicallyEvaluateGEP(ArrayRef<Constant *> Ops,
- Type *ResultTy, const TargetData *TD,
+ Type *ResultTy, const DataLayout *TD,
const TargetLibraryInfo *TLI) {
Constant *Ptr = Ops[0];
if (!TD || !cast<PointerType>(Ptr->getType())->getElementType()->isSized() ||
@@ -786,7 +786,7 @@
/// this function can only fail when attempting to fold instructions like loads
/// and stores, which have no constant expression form.
Constant *llvm::ConstantFoldInstruction(Instruction *I,
- const TargetData *TD,
+ const DataLayout *TD,
const TargetLibraryInfo *TLI) {
// Handle PHI nodes quickly here...
if (PHINode *PN = dyn_cast<PHINode>(I)) {
@@ -856,10 +856,10 @@
}
/// ConstantFoldConstantExpression - Attempt to fold the constant expression
-/// using the specified TargetData. If successful, the constant result is
+/// using the specified DataLayout. If successful, the constant result is
/// result is returned, if not, null is returned.
Constant *llvm::ConstantFoldConstantExpression(const ConstantExpr *CE,
- const TargetData *TD,
+ const DataLayout *TD,
const TargetLibraryInfo *TLI) {
SmallVector<Constant*, 8> Ops;
for (User::const_op_iterator i = CE->op_begin(), e = CE->op_end();
@@ -889,7 +889,7 @@
///
Constant *llvm::ConstantFoldInstOperands(unsigned Opcode, Type *DestTy,
ArrayRef<Constant *> Ops,
- const TargetData *TD,
+ const DataLayout *TD,
const TargetLibraryInfo *TLI) {
// Handle easy binops first.
if (Instruction::isBinaryOp(Opcode)) {
@@ -976,7 +976,7 @@
///
Constant *llvm::ConstantFoldCompareInstOperands(unsigned Predicate,
Constant *Ops0, Constant *Ops1,
- const TargetData *TD,
+ const DataLayout *TD,
const TargetLibraryInfo *TLI) {
// fold: icmp (inttoptr x), null -> icmp x, 0
// fold: icmp (ptrtoint x), 0 -> icmp x, null
Modified: llvm/branches/R600/lib/Analysis/IVUsers.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/IVUsers.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/IVUsers.cpp (original)
+++ llvm/branches/R600/lib/Analysis/IVUsers.cpp Thu Oct 11 16:28:00 2012
@@ -22,7 +22,7 @@
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "llvm/Analysis/ValueTracking.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Debug.h"
@@ -235,7 +235,7 @@
LI = &getAnalysis<LoopInfo>();
DT = &getAnalysis<DominatorTree>();
SE = &getAnalysis<ScalarEvolution>();
- TD = getAnalysisIfAvailable<TargetData>();
+ TD = getAnalysisIfAvailable<DataLayout>();
// Find all uses of induction variables in this loop, and categorize
// them by stride. Start by finding all of the PHI nodes in the header for
Modified: llvm/branches/R600/lib/Analysis/InlineCost.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/InlineCost.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/InlineCost.cpp (original)
+++ llvm/branches/R600/lib/Analysis/InlineCost.cpp Thu Oct 11 16:28:00 2012
@@ -24,7 +24,7 @@
#include "llvm/IntrinsicInst.h"
#include "llvm/Operator.h"
#include "llvm/GlobalAlias.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
@@ -41,8 +41,8 @@
typedef InstVisitor<CallAnalyzer, bool> Base;
friend class InstVisitor<CallAnalyzer, bool>;
- // TargetData if available, or null.
- const TargetData *const TD;
+ // DataLayout if available, or null.
+ const DataLayout *const TD;
// The called function.
Function &F;
@@ -126,9 +126,9 @@
bool visitCallSite(CallSite CS);
public:
- CallAnalyzer(const TargetData *TD, Function &Callee, int Threshold)
+ CallAnalyzer(const DataLayout *TD, Function &Callee, int Threshold)
: TD(TD), F(Callee), Threshold(Threshold), Cost(0),
- AlwaysInline(F.getFnAttributes().hasAlwaysInlineAttr()),
+ AlwaysInline(F.getFnAttributes().hasAttribute(Attributes::AlwaysInline)),
IsCallerRecursive(false), IsRecursiveCall(false),
ExposesReturnsTwice(false), HasDynamicAlloca(false), AllocatedSize(0),
NumInstructions(0), NumVectorInstructions(0),
@@ -142,6 +142,7 @@
int getThreshold() { return Threshold; }
int getCost() { return Cost; }
+ bool isAlwaysInline() { return AlwaysInline; }
// Keep a bunch of stats about the cost savings found so we can print them
// out when debugging.
@@ -613,7 +614,7 @@
bool CallAnalyzer::visitCallSite(CallSite CS) {
if (CS.isCall() && cast<CallInst>(CS.getInstruction())->canReturnTwice() &&
- !F.getFnAttributes().hasReturnsTwiceAttr()) {
+ !F.getFnAttributes().hasAttribute(Attributes::ReturnsTwice)) {
// This aborts the entire analysis.
ExposesReturnsTwice = true;
return false;
@@ -832,7 +833,7 @@
// one load and one store per word copied.
// FIXME: The maxStoresPerMemcpy setting from the target should be used
// here instead of a magic number of 8, but it's not available via
- // TargetData.
+ // DataLayout.
NumStores = std::min(NumStores, 8U);
Cost -= 2 * NumStores * InlineConstants::InstrCost;
@@ -1043,7 +1044,8 @@
// something else. Don't inline functions marked noinline or call sites
// marked noinline.
if (!Callee || Callee->mayBeOverridden() ||
- Callee->getFnAttributes().hasNoInlineAttr() || CS.isNoInline())
+ Callee->getFnAttributes().hasAttribute(Attributes::NoInline) ||
+ CS.isNoInline())
return llvm::InlineCost::getNever();
DEBUG(llvm::dbgs() << " Analyzing call of " << Callee->getName()
@@ -1057,7 +1059,8 @@
// Check if there was a reason to force inlining or no inlining.
if (!ShouldInline && CA.getCost() < CA.getThreshold())
return InlineCost::getNever();
- if (ShouldInline && CA.getCost() >= CA.getThreshold())
+ if (ShouldInline && (CA.isAlwaysInline() ||
+ CA.getCost() >= CA.getThreshold()))
return InlineCost::getAlways();
return llvm::InlineCost::get(CA.getCost(), CA.getThreshold());
Modified: llvm/branches/R600/lib/Analysis/InstructionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/InstructionSimplify.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/InstructionSimplify.cpp (original)
+++ llvm/branches/R600/lib/Analysis/InstructionSimplify.cpp Thu Oct 11 16:28:00 2012
@@ -31,7 +31,7 @@
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/Support/PatternMatch.h"
#include "llvm/Support/ValueHandle.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
using namespace llvm;
using namespace llvm::PatternMatch;
@@ -42,11 +42,11 @@
STATISTIC(NumReassoc, "Number of reassociations");
struct Query {
- const TargetData *TD;
+ const DataLayout *TD;
const TargetLibraryInfo *TLI;
const DominatorTree *DT;
- Query(const TargetData *td, const TargetLibraryInfo *tli,
+ Query(const DataLayout *td, const TargetLibraryInfo *tli,
const DominatorTree *dt) : TD(td), TLI(tli), DT(dt) {}
};
@@ -651,7 +651,7 @@
}
Value *llvm::SimplifyAddInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
- const TargetData *TD, const TargetLibraryInfo *TLI,
+ const DataLayout *TD, const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyAddInst(Op0, Op1, isNSW, isNUW, Query (TD, TLI, DT),
RecursionLimit);
@@ -664,7 +664,7 @@
/// if the GEP has all-constant indices. Returns false if any non-constant
/// index is encountered leaving the 'Offset' in an undefined state. The
/// 'Offset' APInt must be the bitwidth of the target's pointer size.
-static bool accumulateGEPOffset(const TargetData &TD, GEPOperator *GEP,
+static bool accumulateGEPOffset(const DataLayout &TD, GEPOperator *GEP,
APInt &Offset) {
unsigned IntPtrWidth = TD.getPointerSizeInBits();
assert(IntPtrWidth == Offset.getBitWidth());
@@ -696,7 +696,7 @@
/// accumulates the total constant offset applied in the returned constant. It
/// returns 0 if V is not a pointer, and returns the constant '0' if there are
/// no constant offsets applied.
-static Constant *stripAndComputeConstantOffsets(const TargetData &TD,
+static Constant *stripAndComputeConstantOffsets(const DataLayout &TD,
Value *&V) {
if (!V->getType()->isPointerTy())
return 0;
@@ -731,7 +731,7 @@
/// \brief Compute the constant difference between two pointer values.
/// If the difference is not a constant, returns zero.
-static Constant *computePointerDifference(const TargetData &TD,
+static Constant *computePointerDifference(const DataLayout &TD,
Value *LHS, Value *RHS) {
Constant *LHSOffset = stripAndComputeConstantOffsets(TD, LHS);
if (!LHSOffset)
@@ -880,7 +880,7 @@
}
Value *llvm::SimplifySubInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
- const TargetData *TD, const TargetLibraryInfo *TLI,
+ const DataLayout *TD, const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifySubInst(Op0, Op1, isNSW, isNUW, Query (TD, TLI, DT),
RecursionLimit);
@@ -951,7 +951,7 @@
return 0;
}
-Value *llvm::SimplifyMulInst(Value *Op0, Value *Op1, const TargetData *TD,
+Value *llvm::SimplifyMulInst(Value *Op0, Value *Op1, const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyMulInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
@@ -1039,7 +1039,7 @@
return 0;
}
-Value *llvm::SimplifySDivInst(Value *Op0, Value *Op1, const TargetData *TD,
+Value *llvm::SimplifySDivInst(Value *Op0, Value *Op1, const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifySDivInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
@@ -1055,7 +1055,7 @@
return 0;
}
-Value *llvm::SimplifyUDivInst(Value *Op0, Value *Op1, const TargetData *TD,
+Value *llvm::SimplifyUDivInst(Value *Op0, Value *Op1, const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyUDivInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
@@ -1074,7 +1074,7 @@
return 0;
}
-Value *llvm::SimplifyFDivInst(Value *Op0, Value *Op1, const TargetData *TD,
+Value *llvm::SimplifyFDivInst(Value *Op0, Value *Op1, const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyFDivInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
@@ -1144,7 +1144,7 @@
return 0;
}
-Value *llvm::SimplifySRemInst(Value *Op0, Value *Op1, const TargetData *TD,
+Value *llvm::SimplifySRemInst(Value *Op0, Value *Op1, const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifySRemInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
@@ -1160,7 +1160,7 @@
return 0;
}
-Value *llvm::SimplifyURemInst(Value *Op0, Value *Op1, const TargetData *TD,
+Value *llvm::SimplifyURemInst(Value *Op0, Value *Op1, const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyURemInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
@@ -1179,7 +1179,7 @@
return 0;
}
-Value *llvm::SimplifyFRemInst(Value *Op0, Value *Op1, const TargetData *TD,
+Value *llvm::SimplifyFRemInst(Value *Op0, Value *Op1, const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyFRemInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
@@ -1248,7 +1248,7 @@
}
Value *llvm::SimplifyShlInst(Value *Op0, Value *Op1, bool isNSW, bool isNUW,
- const TargetData *TD, const TargetLibraryInfo *TLI,
+ const DataLayout *TD, const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyShlInst(Op0, Op1, isNSW, isNUW, Query (TD, TLI, DT),
RecursionLimit);
@@ -1275,7 +1275,7 @@
}
Value *llvm::SimplifyLShrInst(Value *Op0, Value *Op1, bool isExact,
- const TargetData *TD,
+ const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyLShrInst(Op0, Op1, isExact, Query (TD, TLI, DT),
@@ -1307,7 +1307,7 @@
}
Value *llvm::SimplifyAShrInst(Value *Op0, Value *Op1, bool isExact,
- const TargetData *TD,
+ const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyAShrInst(Op0, Op1, isExact, Query (TD, TLI, DT),
@@ -1407,7 +1407,7 @@
return 0;
}
-Value *llvm::SimplifyAndInst(Value *Op0, Value *Op1, const TargetData *TD,
+Value *llvm::SimplifyAndInst(Value *Op0, Value *Op1, const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyAndInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
@@ -1501,7 +1501,7 @@
return 0;
}
-Value *llvm::SimplifyOrInst(Value *Op0, Value *Op1, const TargetData *TD,
+Value *llvm::SimplifyOrInst(Value *Op0, Value *Op1, const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyOrInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
@@ -1561,7 +1561,7 @@
return 0;
}
-Value *llvm::SimplifyXorInst(Value *Op0, Value *Op1, const TargetData *TD,
+Value *llvm::SimplifyXorInst(Value *Op0, Value *Op1, const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyXorInst(Op0, Op1, Query (TD, TLI, DT), RecursionLimit);
@@ -1591,7 +1591,7 @@
return 0;
}
-static Constant *computePointerICmp(const TargetData &TD,
+static Constant *computePointerICmp(const DataLayout &TD,
CmpInst::Predicate Pred,
Value *LHS, Value *RHS) {
// We can only fold certain predicates on pointer comparisons.
@@ -2399,7 +2399,7 @@
}
Value *llvm::SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
- const TargetData *TD,
+ const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyICmpInst(Predicate, LHS, RHS, Query (TD, TLI, DT),
@@ -2496,7 +2496,7 @@
}
Value *llvm::SimplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
- const TargetData *TD,
+ const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyFCmpInst(Predicate, LHS, RHS, Query (TD, TLI, DT),
@@ -2531,7 +2531,7 @@
}
Value *llvm::SimplifySelectInst(Value *Cond, Value *TrueVal, Value *FalseVal,
- const TargetData *TD,
+ const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifySelectInst(Cond, TrueVal, FalseVal, Query (TD, TLI, DT),
@@ -2579,7 +2579,7 @@
return ConstantExpr::getGetElementPtr(cast<Constant>(Ops[0]), Ops.slice(1));
}
-Value *llvm::SimplifyGEPInst(ArrayRef<Value *> Ops, const TargetData *TD,
+Value *llvm::SimplifyGEPInst(ArrayRef<Value *> Ops, const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyGEPInst(Ops, Query (TD, TLI, DT), RecursionLimit);
@@ -2616,7 +2616,7 @@
Value *llvm::SimplifyInsertValueInst(Value *Agg, Value *Val,
ArrayRef<unsigned> Idxs,
- const TargetData *TD,
+ const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyInsertValueInst(Agg, Val, Idxs, Query (TD, TLI, DT),
@@ -2664,7 +2664,7 @@
return 0;
}
-Value *llvm::SimplifyTruncInst(Value *Op, Type *Ty, const TargetData *TD,
+Value *llvm::SimplifyTruncInst(Value *Op, Type *Ty, const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyTruncInst(Op, Ty, Query (TD, TLI, DT), RecursionLimit);
@@ -2730,7 +2730,7 @@
}
Value *llvm::SimplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS,
- const TargetData *TD, const TargetLibraryInfo *TLI,
+ const DataLayout *TD, const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyBinOp(Opcode, LHS, RHS, Query (TD, TLI, DT), RecursionLimit);
}
@@ -2745,7 +2745,7 @@
}
Value *llvm::SimplifyCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
- const TargetData *TD, const TargetLibraryInfo *TLI,
+ const DataLayout *TD, const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return ::SimplifyCmpInst(Predicate, LHS, RHS, Query (TD, TLI, DT),
RecursionLimit);
@@ -2761,7 +2761,7 @@
/// SimplifyInstruction - See if we can compute a simplified version of this
/// instruction. If not, this returns null.
-Value *llvm::SimplifyInstruction(Instruction *I, const TargetData *TD,
+Value *llvm::SimplifyInstruction(Instruction *I, const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
Value *Result;
@@ -2881,7 +2881,7 @@
/// This routine returns 'true' only when *it* simplifies something. The passed
/// in simplified value does not count toward this.
static bool replaceAndRecursivelySimplifyImpl(Instruction *I, Value *SimpleV,
- const TargetData *TD,
+ const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
bool Simplified = false;
@@ -2936,14 +2936,14 @@
}
bool llvm::recursivelySimplifyInstruction(Instruction *I,
- const TargetData *TD,
+ const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
return replaceAndRecursivelySimplifyImpl(I, 0, TD, TLI, DT);
}
bool llvm::replaceAndRecursivelySimplify(Instruction *I, Value *SimpleV,
- const TargetData *TD,
+ const DataLayout *TD,
const TargetLibraryInfo *TLI,
const DominatorTree *DT) {
assert(I != SimpleV && "replaceAndRecursivelySimplify(X,X) is not valid!");
Modified: llvm/branches/R600/lib/Analysis/LazyValueInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/LazyValueInfo.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/LazyValueInfo.cpp (original)
+++ llvm/branches/R600/lib/Analysis/LazyValueInfo.cpp Thu Oct 11 16:28:00 2012
@@ -19,7 +19,7 @@
#include "llvm/Instructions.h"
#include "llvm/IntrinsicInst.h"
#include "llvm/Analysis/ConstantFolding.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/ConstantRange.h"
@@ -212,7 +212,7 @@
// Unless we can prove that the two Constants are different, we must
// move to overdefined.
- // FIXME: use TargetData/TargetLibraryInfo for smarter constant folding.
+ // FIXME: use DataLayout/TargetLibraryInfo for smarter constant folding.
if (ConstantInt *Res = dyn_cast<ConstantInt>(
ConstantFoldCompareInstOperands(CmpInst::ICMP_NE,
getConstant(),
@@ -238,7 +238,7 @@
// Unless we can prove that the two Constants are different, we must
// move to overdefined.
- // FIXME: use TargetData/TargetLibraryInfo for smarter constant folding.
+ // FIXME: use DataLayout/TargetLibraryInfo for smarter constant folding.
if (ConstantInt *Res = dyn_cast<ConstantInt>(
ConstantFoldCompareInstOperands(CmpInst::ICMP_NE,
getNotConstant(),
@@ -1009,7 +1009,7 @@
if (PImpl)
getCache(PImpl).clear();
- TD = getAnalysisIfAvailable<TargetData>();
+ TD = getAnalysisIfAvailable<DataLayout>();
TLI = &getAnalysis<TargetLibraryInfo>();
// Fully lazy.
Modified: llvm/branches/R600/lib/Analysis/Lint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/Lint.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/Lint.cpp (original)
+++ llvm/branches/R600/lib/Analysis/Lint.cpp Thu Oct 11 16:28:00 2012
@@ -43,7 +43,7 @@
#include "llvm/Analysis/Loads.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Assembly/Writer.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Pass.h"
#include "llvm/PassManager.h"
@@ -103,7 +103,7 @@
Module *Mod;
AliasAnalysis *AA;
DominatorTree *DT;
- TargetData *TD;
+ DataLayout *TD;
TargetLibraryInfo *TLI;
std::string Messages;
@@ -177,7 +177,7 @@
Mod = F.getParent();
AA = &getAnalysis<AliasAnalysis>();
DT = &getAnalysis<DominatorTree>();
- TD = getAnalysisIfAvailable<TargetData>();
+ TD = getAnalysisIfAvailable<DataLayout>();
TLI = &getAnalysis<TargetLibraryInfo>();
visit(F);
dbgs() << MessagesStr.str();
@@ -506,7 +506,7 @@
"Undefined result: Shift count out of range", &I);
}
-static bool isZero(Value *V, TargetData *TD) {
+static bool isZero(Value *V, DataLayout *TD) {
// Assume undef could be zero.
if (isa<UndefValue>(V)) return true;
Modified: llvm/branches/R600/lib/Analysis/Loads.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/Loads.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/Loads.cpp (original)
+++ llvm/branches/R600/lib/Analysis/Loads.cpp Thu Oct 11 16:28:00 2012
@@ -13,7 +13,7 @@
#include "llvm/Analysis/Loads.h"
#include "llvm/Analysis/AliasAnalysis.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/GlobalAlias.h"
#include "llvm/GlobalVariable.h"
#include "llvm/IntrinsicInst.h"
@@ -52,8 +52,8 @@
/// bitcasts to get back to the underlying object being addressed, keeping
/// track of the offset in bytes from the GEPs relative to the result.
/// This is closely related to GetUnderlyingObject but is located
-/// here to avoid making VMCore depend on TargetData.
-static Value *getUnderlyingObjectWithOffset(Value *V, const TargetData *TD,
+/// here to avoid making VMCore depend on DataLayout.
+static Value *getUnderlyingObjectWithOffset(Value *V, const DataLayout *TD,
uint64_t &ByteOffset,
unsigned MaxLookup = 6) {
if (!V->getType()->isPointerTy())
@@ -85,7 +85,7 @@
/// specified pointer, we do a quick local scan of the basic block containing
/// ScanFrom, to determine if the address is already accessed.
bool llvm::isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom,
- unsigned Align, const TargetData *TD) {
+ unsigned Align, const DataLayout *TD) {
uint64_t ByteOffset = 0;
Value *Base = V;
if (TD)
Modified: llvm/branches/R600/lib/Analysis/LoopDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/LoopDependenceAnalysis.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/LoopDependenceAnalysis.cpp (original)
+++ llvm/branches/R600/lib/Analysis/LoopDependenceAnalysis.cpp Thu Oct 11 16:28:00 2012
@@ -35,7 +35,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
using namespace llvm;
STATISTIC(NumAnswered, "Number of dependence queries answered");
Modified: llvm/branches/R600/lib/Analysis/MemoryBuiltins.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/MemoryBuiltins.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/MemoryBuiltins.cpp (original)
+++ llvm/branches/R600/lib/Analysis/MemoryBuiltins.cpp Thu Oct 11 16:28:00 2012
@@ -25,7 +25,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Transforms/Utils/Local.h"
using namespace llvm;
@@ -132,7 +132,7 @@
static bool hasNoAliasAttr(const Value *V, bool LookThroughBitCast) {
ImmutableCallSite CS(LookThroughBitCast ? V->stripPointerCasts() : V);
- return CS && CS.hasFnAttr(Attribute::NoAlias);
+ return CS && CS.hasFnAttr(Attributes::NoAlias);
}
@@ -190,7 +190,7 @@
return isMallocLikeFn(I, TLI) ? dyn_cast<CallInst>(I) : 0;
}
-static Value *computeArraySize(const CallInst *CI, const TargetData *TD,
+static Value *computeArraySize(const CallInst *CI, const DataLayout *TD,
const TargetLibraryInfo *TLI,
bool LookThroughSExt = false) {
if (!CI)
@@ -220,7 +220,7 @@
/// is a call to malloc whose array size can be determined and the array size
/// is not constant 1. Otherwise, return NULL.
const CallInst *llvm::isArrayMalloc(const Value *I,
- const TargetData *TD,
+ const DataLayout *TD,
const TargetLibraryInfo *TLI) {
const CallInst *CI = extractMallocCall(I, TLI);
Value *ArraySize = computeArraySize(CI, TD, TLI);
@@ -281,7 +281,7 @@
/// then return that multiple. For non-array mallocs, the multiple is
/// constant 1. Otherwise, return NULL for mallocs whose array size cannot be
/// determined.
-Value *llvm::getMallocArraySize(CallInst *CI, const TargetData *TD,
+Value *llvm::getMallocArraySize(CallInst *CI, const DataLayout *TD,
const TargetLibraryInfo *TLI,
bool LookThroughSExt) {
assert(isMallocLikeFn(CI, TLI) && "getMallocArraySize and not malloc call");
@@ -341,7 +341,7 @@
/// object size in Size if successful, and false otherwise.
/// If RoundToAlign is true, then Size is rounded up to the aligment of allocas,
/// byval arguments, and global variables.
-bool llvm::getObjectSize(const Value *Ptr, uint64_t &Size, const TargetData *TD,
+bool llvm::getObjectSize(const Value *Ptr, uint64_t &Size, const DataLayout *TD,
const TargetLibraryInfo *TLI, bool RoundToAlign) {
if (!TD)
return false;
@@ -373,7 +373,7 @@
return Size;
}
-ObjectSizeOffsetVisitor::ObjectSizeOffsetVisitor(const TargetData *TD,
+ObjectSizeOffsetVisitor::ObjectSizeOffsetVisitor(const DataLayout *TD,
const TargetLibraryInfo *TLI,
LLVMContext &Context,
bool RoundToAlign)
@@ -559,7 +559,7 @@
}
-ObjectSizeOffsetEvaluator::ObjectSizeOffsetEvaluator(const TargetData *TD,
+ObjectSizeOffsetEvaluator::ObjectSizeOffsetEvaluator(const DataLayout *TD,
const TargetLibraryInfo *TLI,
LLVMContext &Context)
: TD(TD), TLI(TLI), Context(Context), Builder(Context, TargetFolder(TD)) {
Modified: llvm/branches/R600/lib/Analysis/MemoryDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/MemoryDependenceAnalysis.cpp (original)
+++ llvm/branches/R600/lib/Analysis/MemoryDependenceAnalysis.cpp Thu Oct 11 16:28:00 2012
@@ -30,7 +30,7 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/PredIteratorCache.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
using namespace llvm;
STATISTIC(NumCacheNonLocal, "Number of fully cached non-local responses");
@@ -89,7 +89,7 @@
bool MemoryDependenceAnalysis::runOnFunction(Function &) {
AA = &getAnalysis<AliasAnalysis>();
- TD = getAnalysisIfAvailable<TargetData>();
+ TD = getAnalysisIfAvailable<DataLayout>();
DT = getAnalysisIfAvailable<DominatorTree>();
if (PredCache == 0)
PredCache.reset(new PredIteratorCache());
@@ -256,7 +256,7 @@
const Value *&MemLocBase,
int64_t &MemLocOffs,
const LoadInst *LI,
- const TargetData *TD) {
+ const DataLayout *TD) {
// If we have no target data, we can't do this.
if (TD == 0) return false;
@@ -280,7 +280,7 @@
unsigned MemoryDependenceAnalysis::
getLoadLoadClobberFullWidthSize(const Value *MemLocBase, int64_t MemLocOffs,
unsigned MemLocSize, const LoadInst *LI,
- const TargetData &TD) {
+ const DataLayout &TD) {
// We can only extend simple integer loads.
if (!isa<IntegerType>(LI->getType()) || !LI->isSimple()) return 0;
@@ -327,12 +327,12 @@
return 0;
if (LIOffs+NewLoadByteSize > MemLocEnd &&
- LI->getParent()->getParent()->getFnAttributes().hasAddressSafetyAttr()){
+ LI->getParent()->getParent()->getFnAttributes().
+ hasAttribute(Attributes::AddressSafety))
// We will be reading past the location accessed by the original program.
// While this is safe in a regular build, Address Safety analysis tools
// may start reporting false warnings. So, don't do widening.
return 0;
- }
// If a load of this width would include all of MemLoc, then we succeed.
if (LIOffs+NewLoadByteSize >= MemLocEnd)
Modified: llvm/branches/R600/lib/Analysis/NoAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/NoAliasAnalysis.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/NoAliasAnalysis.cpp (original)
+++ llvm/branches/R600/lib/Analysis/NoAliasAnalysis.cpp Thu Oct 11 16:28:00 2012
@@ -15,7 +15,7 @@
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/Passes.h"
#include "llvm/Pass.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
using namespace llvm;
namespace {
@@ -36,7 +36,7 @@
virtual void initializePass() {
// Note: NoAA does not call InitializeAliasAnalysis because it's
// special and does not support chaining.
- TD = getAnalysisIfAvailable<TargetData>();
+ TD = getAnalysisIfAvailable<DataLayout>();
}
virtual AliasResult alias(const Location &LocA, const Location &LocB) {
Modified: llvm/branches/R600/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/ScalarEvolution.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/branches/R600/lib/Analysis/ScalarEvolution.cpp Thu Oct 11 16:28:00 2012
@@ -73,7 +73,7 @@
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Assembly/Writer.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ConstantRange.h"
@@ -2582,7 +2582,7 @@
}
const SCEV *ScalarEvolution::getSizeOfExpr(Type *AllocTy) {
- // If we have TargetData, we can bypass creating a target-independent
+ // If we have DataLayout, we can bypass creating a target-independent
// constant expression and then folding it back into a ConstantInt.
// This is just a compile-time optimization.
if (TD)
@@ -2608,7 +2608,7 @@
const SCEV *ScalarEvolution::getOffsetOfExpr(StructType *STy,
unsigned FieldNo) {
- // If we have TargetData, we can bypass creating a target-independent
+ // If we have DataLayout, we can bypass creating a target-independent
// constant expression and then folding it back into a ConstantInt.
// This is just a compile-time optimization.
if (TD)
@@ -2673,7 +2673,7 @@
uint64_t ScalarEvolution::getTypeSizeInBits(Type *Ty) const {
assert(isSCEVable(Ty) && "Type is not SCEVable!");
- // If we have a TargetData, use it!
+ // If we have a DataLayout, use it!
if (TD)
return TD->getTypeSizeInBits(Ty);
@@ -2681,7 +2681,7 @@
if (Ty->isIntegerTy())
return Ty->getPrimitiveSizeInBits();
- // The only other support type is pointer. Without TargetData, conservatively
+ // The only other support type is pointer. Without DataLayout, conservatively
// assume pointers are 64-bit.
assert(Ty->isPointerTy() && "isSCEVable permitted a non-SCEVable type!");
return 64;
@@ -2701,7 +2701,7 @@
assert(Ty->isPointerTy() && "Unexpected non-pointer non-integer type!");
if (TD) return TD->getIntPtrType(getContext());
- // Without TargetData, conservatively assume pointers are 64-bit.
+ // Without DataLayout, conservatively assume pointers are 64-bit.
return Type::getInt64Ty(getContext());
}
@@ -4751,7 +4751,7 @@
/// reason, return null.
static Constant *EvaluateExpression(Value *V, const Loop *L,
DenseMap<Instruction *, Constant *> &Vals,
- const TargetData *TD,
+ const DataLayout *TD,
const TargetLibraryInfo *TLI) {
// Convenient constant check, but redundant for recursive calls.
if (Constant *C = dyn_cast<Constant>(V)) return C;
@@ -6590,7 +6590,7 @@
bool ScalarEvolution::runOnFunction(Function &F) {
this->F = &F;
LI = &getAnalysis<LoopInfo>();
- TD = getAnalysisIfAvailable<TargetData>();
+ TD = getAnalysisIfAvailable<DataLayout>();
TLI = &getAnalysis<TargetLibraryInfo>();
DT = &getAnalysis<DominatorTree>();
return false;
Modified: llvm/branches/R600/lib/Analysis/ScalarEvolutionExpander.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/ScalarEvolutionExpander.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/ScalarEvolutionExpander.cpp (original)
+++ llvm/branches/R600/lib/Analysis/ScalarEvolutionExpander.cpp Thu Oct 11 16:28:00 2012
@@ -18,7 +18,7 @@
#include "llvm/IntrinsicInst.h"
#include "llvm/LLVMContext.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/ADT/STLExtras.h"
@@ -212,7 +212,7 @@
const SCEV *&Remainder,
const SCEV *Factor,
ScalarEvolution &SE,
- const TargetData *TD) {
+ const DataLayout *TD) {
// Everything is divisible by one.
if (Factor->isOne())
return true;
@@ -253,7 +253,7 @@
// of the given factor.
if (const SCEVMulExpr *M = dyn_cast<SCEVMulExpr>(S)) {
if (TD) {
- // With TargetData, the size is known. Check if there is a constant
+ // With DataLayout, the size is known. Check if there is a constant
// operand which is a multiple of the given factor. If so, we can
// factor it.
const SCEVConstant *FC = cast<SCEVConstant>(Factor);
@@ -267,7 +267,7 @@
return true;
}
} else {
- // Without TargetData, check if Factor can be factored out of any of the
+ // Without DataLayout, check if Factor can be factored out of any of the
// Mul's operands. If so, we can just remove it.
for (unsigned i = 0, e = M->getNumOperands(); i != e; ++i) {
const SCEV *SOp = M->getOperand(i);
@@ -458,7 +458,7 @@
// An empty struct has no fields.
if (STy->getNumElements() == 0) break;
if (SE.TD) {
- // With TargetData, field offsets are known. See if a constant offset
+ // With DataLayout, field offsets are known. See if a constant offset
// falls within any of the struct fields.
if (Ops.empty()) break;
if (const SCEVConstant *C = dyn_cast<SCEVConstant>(Ops[0]))
@@ -477,7 +477,7 @@
}
}
} else {
- // Without TargetData, just check for an offsetof expression of the
+ // Without DataLayout, just check for an offsetof expression of the
// appropriate struct type.
for (unsigned i = 0, e = Ops.size(); i != e; ++i)
if (const SCEVUnknown *U = dyn_cast<SCEVUnknown>(Ops[i])) {
Modified: llvm/branches/R600/lib/Analysis/ValueTracking.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Analysis/ValueTracking.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Analysis/ValueTracking.cpp (original)
+++ llvm/branches/R600/lib/Analysis/ValueTracking.cpp Thu Oct 11 16:28:00 2012
@@ -22,7 +22,7 @@
#include "llvm/LLVMContext.h"
#include "llvm/Metadata.h"
#include "llvm/Operator.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Support/ConstantRange.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/Support/MathExtras.h"
@@ -36,7 +36,7 @@
/// getBitWidth - Returns the bitwidth of the given scalar or pointer type (if
/// unknown returns 0). For vector types, returns the element type's bitwidth.
-static unsigned getBitWidth(Type *Ty, const TargetData *TD) {
+static unsigned getBitWidth(Type *Ty, const DataLayout *TD) {
if (unsigned BitWidth = Ty->getScalarSizeInBits())
return BitWidth;
assert(isa<PointerType>(Ty) && "Expected a pointer type!");
@@ -46,7 +46,7 @@
static void ComputeMaskedBitsAddSub(bool Add, Value *Op0, Value *Op1, bool NSW,
APInt &KnownZero, APInt &KnownOne,
APInt &KnownZero2, APInt &KnownOne2,
- const TargetData *TD, unsigned Depth) {
+ const DataLayout *TD, unsigned Depth) {
if (!Add) {
if (ConstantInt *CLHS = dyn_cast<ConstantInt>(Op0)) {
// We know that the top bits of C-X are clear if X contains less bits
@@ -132,7 +132,7 @@
static void ComputeMaskedBitsMul(Value *Op0, Value *Op1, bool NSW,
APInt &KnownZero, APInt &KnownOne,
APInt &KnownZero2, APInt &KnownOne2,
- const TargetData *TD, unsigned Depth) {
+ const DataLayout *TD, unsigned Depth) {
unsigned BitWidth = KnownZero.getBitWidth();
ComputeMaskedBits(Op1, KnownZero, KnownOne, TD, Depth+1);
ComputeMaskedBits(Op0, KnownZero2, KnownOne2, TD, Depth+1);
@@ -226,7 +226,7 @@
/// same width as the vector element, and the bit is set only if it is true
/// for all of the elements in the vector.
void llvm::ComputeMaskedBits(Value *V, APInt &KnownZero, APInt &KnownOne,
- const TargetData *TD, unsigned Depth) {
+ const DataLayout *TD, unsigned Depth) {
assert(V && "No Value?");
assert(Depth <= MaxDepth && "Limit Search Depth");
unsigned BitWidth = KnownZero.getBitWidth();
@@ -308,11 +308,20 @@
}
if (Argument *A = dyn_cast<Argument>(V)) {
- // Get alignment information off byval arguments if specified in the IR.
- if (A->hasByValAttr())
- if (unsigned Align = A->getParamAlignment())
- KnownZero = APInt::getLowBitsSet(BitWidth,
- CountTrailingZeros_32(Align));
+ unsigned Align = 0;
+
+ if (A->hasByValAttr()) {
+ // Get alignment information off byval arguments if specified in the IR.
+ Align = A->getParamAlignment();
+ } else if (TD && A->hasStructRetAttr()) {
+ // An sret parameter has at least the ABI alignment of the return type.
+ Type *EltTy = cast<PointerType>(A->getType())->getElementType();
+ if (EltTy->isSized())
+ Align = TD->getABITypeAlignment(EltTy);
+ }
+
+ if (Align)
+ KnownZero = APInt::getLowBitsSet(BitWidth, CountTrailingZeros_32(Align));
return;
}
@@ -778,7 +787,7 @@
/// ComputeSignBit - Determine whether the sign bit is known to be zero or
/// one. Convenience wrapper around ComputeMaskedBits.
void llvm::ComputeSignBit(Value *V, bool &KnownZero, bool &KnownOne,
- const TargetData *TD, unsigned Depth) {
+ const DataLayout *TD, unsigned Depth) {
unsigned BitWidth = getBitWidth(V->getType(), TD);
if (!BitWidth) {
KnownZero = false;
@@ -796,7 +805,7 @@
/// bit set when defined. For vectors return true if every element is known to
/// be a power of two when defined. Supports values with integer or pointer
/// types and vectors of integers.
-bool llvm::isPowerOfTwo(Value *V, const TargetData *TD, bool OrZero,
+bool llvm::isPowerOfTwo(Value *V, const DataLayout *TD, bool OrZero,
unsigned Depth) {
if (Constant *C = dyn_cast<Constant>(V)) {
if (C->isNullValue())
@@ -859,7 +868,7 @@
/// when defined. For vectors return true if every element is known to be
/// non-zero when defined. Supports values with integer or pointer type and
/// vectors of integers.
-bool llvm::isKnownNonZero(Value *V, const TargetData *TD, unsigned Depth) {
+bool llvm::isKnownNonZero(Value *V, const DataLayout *TD, unsigned Depth) {
if (Constant *C = dyn_cast<Constant>(V)) {
if (C->isNullValue())
return false;
@@ -986,7 +995,7 @@
/// same width as the vector element, and the bit is set only if it is true
/// for all of the elements in the vector.
bool llvm::MaskedValueIsZero(Value *V, const APInt &Mask,
- const TargetData *TD, unsigned Depth) {
+ const DataLayout *TD, unsigned Depth) {
APInt KnownZero(Mask.getBitWidth(), 0), KnownOne(Mask.getBitWidth(), 0);
ComputeMaskedBits(V, KnownZero, KnownOne, TD, Depth);
assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?");
@@ -1003,10 +1012,10 @@
///
/// 'Op' must have a scalar integer type.
///
-unsigned llvm::ComputeNumSignBits(Value *V, const TargetData *TD,
+unsigned llvm::ComputeNumSignBits(Value *V, const DataLayout *TD,
unsigned Depth) {
assert((TD || V->getType()->isIntOrIntVectorTy()) &&
- "ComputeNumSignBits requires a TargetData object to operate "
+ "ComputeNumSignBits requires a DataLayout object to operate "
"on non-integer values!");
Type *Ty = V->getType();
unsigned TyBits = TD ? TD->getTypeSizeInBits(V->getType()->getScalarType()) :
@@ -1582,7 +1591,7 @@
/// it can be expressed as a base pointer plus a constant offset. Return the
/// base and offset to the caller.
Value *llvm::GetPointerBaseWithConstantOffset(Value *Ptr, int64_t &Offset,
- const TargetData &TD) {
+ const DataLayout &TD) {
Operator *PtrOp = dyn_cast<Operator>(Ptr);
if (PtrOp == 0 || Ptr->getType()->isVectorTy())
return Ptr;
@@ -1768,7 +1777,7 @@
}
Value *
-llvm::GetUnderlyingObject(Value *V, const TargetData *TD, unsigned MaxLookup) {
+llvm::GetUnderlyingObject(Value *V, const DataLayout *TD, unsigned MaxLookup) {
if (!V->getType()->isPointerTy())
return V;
for (unsigned Count = 0; MaxLookup == 0 || Count < MaxLookup; ++Count) {
@@ -1799,7 +1808,7 @@
void
llvm::GetUnderlyingObjects(Value *V,
SmallVectorImpl<Value *> &Objects,
- const TargetData *TD,
+ const DataLayout *TD,
unsigned MaxLookup) {
SmallPtrSet<Value *, 4> Visited;
SmallVector<Value *, 4> Worklist;
@@ -1844,7 +1853,7 @@
}
bool llvm::isSafeToSpeculativelyExecute(const Value *V,
- const TargetData *TD) {
+ const DataLayout *TD) {
const Operator *Inst = dyn_cast<Operator>(V);
if (!Inst)
return false;
Modified: llvm/branches/R600/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/AsmParser/LLParser.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/AsmParser/LLParser.cpp (original)
+++ llvm/branches/R600/lib/AsmParser/LLParser.cpp Thu Oct 11 16:28:00 2012
@@ -916,48 +916,49 @@
/// ParseOptionalAttrs - Parse a potentially empty attribute list. AttrKind
/// indicates what kind of attribute list this is: 0: function arg, 1: result,
/// 2: function attr.
-bool LLParser::ParseOptionalAttrs(Attributes &Attrs, unsigned AttrKind) {
- Attrs = Attribute::None;
+bool LLParser::ParseOptionalAttrs(Attributes::Builder &B, unsigned AttrKind) {
LocTy AttrLoc = Lex.getLoc();
bool HaveError = false;
+ B.clear();
+
while (1) {
lltok::Kind Token = Lex.getKind();
switch (Token) {
default: // End of attributes.
return HaveError;
- case lltok::kw_zeroext: Attrs |= Attribute::ZExt; break;
- case lltok::kw_signext: Attrs |= Attribute::SExt; break;
- case lltok::kw_inreg: Attrs |= Attribute::InReg; break;
- case lltok::kw_sret: Attrs |= Attribute::StructRet; break;
- case lltok::kw_noalias: Attrs |= Attribute::NoAlias; break;
- case lltok::kw_nocapture: Attrs |= Attribute::NoCapture; break;
- case lltok::kw_byval: Attrs |= Attribute::ByVal; break;
- case lltok::kw_nest: Attrs |= Attribute::Nest; break;
-
- case lltok::kw_noreturn: Attrs |= Attribute::NoReturn; break;
- case lltok::kw_nounwind: Attrs |= Attribute::NoUnwind; break;
- case lltok::kw_uwtable: Attrs |= Attribute::UWTable; break;
- case lltok::kw_returns_twice: Attrs |= Attribute::ReturnsTwice; break;
- case lltok::kw_noinline: Attrs |= Attribute::NoInline; break;
- case lltok::kw_readnone: Attrs |= Attribute::ReadNone; break;
- case lltok::kw_readonly: Attrs |= Attribute::ReadOnly; break;
- case lltok::kw_inlinehint: Attrs |= Attribute::InlineHint; break;
- case lltok::kw_alwaysinline: Attrs |= Attribute::AlwaysInline; break;
- case lltok::kw_optsize: Attrs |= Attribute::OptimizeForSize; break;
- case lltok::kw_ssp: Attrs |= Attribute::StackProtect; break;
- case lltok::kw_sspreq: Attrs |= Attribute::StackProtectReq; break;
- case lltok::kw_noredzone: Attrs |= Attribute::NoRedZone; break;
- case lltok::kw_noimplicitfloat: Attrs |= Attribute::NoImplicitFloat; break;
- case lltok::kw_naked: Attrs |= Attribute::Naked; break;
- case lltok::kw_nonlazybind: Attrs |= Attribute::NonLazyBind; break;
- case lltok::kw_address_safety: Attrs |= Attribute::AddressSafety; break;
+ case lltok::kw_zeroext: B.addAttribute(Attributes::ZExt); break;
+ case lltok::kw_signext: B.addAttribute(Attributes::SExt); break;
+ case lltok::kw_inreg: B.addAttribute(Attributes::InReg); break;
+ case lltok::kw_sret: B.addAttribute(Attributes::StructRet); break;
+ case lltok::kw_noalias: B.addAttribute(Attributes::NoAlias); break;
+ case lltok::kw_nocapture: B.addAttribute(Attributes::NoCapture); break;
+ case lltok::kw_byval: B.addAttribute(Attributes::ByVal); break;
+ case lltok::kw_nest: B.addAttribute(Attributes::Nest); break;
+
+ case lltok::kw_noreturn: B.addAttribute(Attributes::NoReturn); break;
+ case lltok::kw_nounwind: B.addAttribute(Attributes::NoUnwind); break;
+ case lltok::kw_uwtable: B.addAttribute(Attributes::UWTable); break;
+ case lltok::kw_returns_twice: B.addAttribute(Attributes::ReturnsTwice); break;
+ case lltok::kw_noinline: B.addAttribute(Attributes::NoInline); break;
+ case lltok::kw_readnone: B.addAttribute(Attributes::ReadNone); break;
+ case lltok::kw_readonly: B.addAttribute(Attributes::ReadOnly); break;
+ case lltok::kw_inlinehint: B.addAttribute(Attributes::InlineHint); break;
+ case lltok::kw_alwaysinline: B.addAttribute(Attributes::AlwaysInline); break;
+ case lltok::kw_optsize: B.addAttribute(Attributes::OptimizeForSize); break;
+ case lltok::kw_ssp: B.addAttribute(Attributes::StackProtect); break;
+ case lltok::kw_sspreq: B.addAttribute(Attributes::StackProtectReq); break;
+ case lltok::kw_noredzone: B.addAttribute(Attributes::NoRedZone); break;
+ case lltok::kw_noimplicitfloat: B.addAttribute(Attributes::NoImplicitFloat); break;
+ case lltok::kw_naked: B.addAttribute(Attributes::Naked); break;
+ case lltok::kw_nonlazybind: B.addAttribute(Attributes::NonLazyBind); break;
+ case lltok::kw_address_safety: B.addAttribute(Attributes::AddressSafety); break;
case lltok::kw_alignstack: {
unsigned Alignment;
if (ParseOptionalStackAlignment(Alignment))
return true;
- Attrs |= Attributes::constructStackAlignmentFromInt(Alignment);
+ B.addStackAlignmentAttr(Alignment);
continue;
}
@@ -965,7 +966,7 @@
unsigned Alignment;
if (ParseOptionalAlignment(Alignment))
return true;
- Attrs |= Attributes::constructAlignmentFromInt(Alignment);
+ B.addAlignmentAttr(Alignment);
continue;
}
@@ -1434,16 +1435,15 @@
// Parse the argument.
LocTy ArgLoc;
Type *ArgTy = 0;
- Attributes ArgAttrs1;
- Attributes ArgAttrs2;
+ Attributes::Builder ArgAttrs;
Value *V;
if (ParseType(ArgTy, ArgLoc))
return true;
// Otherwise, handle normal operands.
- if (ParseOptionalAttrs(ArgAttrs1, 0) || ParseValue(ArgTy, V, PFS))
+ if (ParseOptionalAttrs(ArgAttrs, 0) || ParseValue(ArgTy, V, PFS))
return true;
- ArgList.push_back(ParamInfo(ArgLoc, V, ArgAttrs1|ArgAttrs2));
+ ArgList.push_back(ParamInfo(ArgLoc, V, Attributes::get(ArgAttrs)));
}
Lex.Lex(); // Lex the ')'.
@@ -1475,7 +1475,7 @@
} else {
LocTy TypeLoc = Lex.getLoc();
Type *ArgTy = 0;
- Attributes Attrs;
+ Attributes::Builder Attrs;
std::string Name;
if (ParseType(ArgTy) ||
@@ -1492,7 +1492,7 @@
if (!FunctionType::isValidArgumentType(ArgTy))
return Error(TypeLoc, "invalid type for function argument");
- ArgList.push_back(ArgInfo(TypeLoc, ArgTy, Attrs, Name));
+ ArgList.push_back(ArgInfo(TypeLoc, ArgTy, Attributes::get(Attrs), Name));
while (EatIfPresent(lltok::comma)) {
// Handle ... at end of arg list.
@@ -1518,7 +1518,7 @@
if (!ArgTy->isFirstClassType())
return Error(TypeLoc, "invalid type for function argument");
- ArgList.push_back(ArgInfo(TypeLoc, ArgTy, Attrs, Name));
+ ArgList.push_back(ArgInfo(TypeLoc, ArgTy, Attributes::get(Attrs), Name));
}
}
@@ -2672,7 +2672,7 @@
unsigned Linkage;
unsigned Visibility;
- Attributes RetAttrs;
+ Attributes::Builder RetAttrs;
CallingConv::ID CC;
Type *RetType = 0;
LocTy RetTypeLoc = Lex.getLoc();
@@ -2736,7 +2736,7 @@
SmallVector<ArgInfo, 8> ArgList;
bool isVarArg;
- Attributes FuncAttrs;
+ Attributes::Builder FuncAttrs;
std::string Section;
unsigned Alignment;
std::string GC;
@@ -2755,9 +2755,9 @@
return true;
// If the alignment was parsed as an attribute, move to the alignment field.
- if (FuncAttrs & Attribute::Alignment) {
+ if (FuncAttrs.hasAlignmentAttr()) {
Alignment = FuncAttrs.getAlignment();
- FuncAttrs &= ~Attribute::Alignment;
+ FuncAttrs.removeAttribute(Attributes::Alignment);
}
// Okay, if we got here, the function is syntactically valid. Convert types
@@ -2766,7 +2766,7 @@
SmallVector<AttributeWithIndex, 8> Attrs;
if (RetAttrs.hasAttributes())
- Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
+ Attrs.push_back(AttributeWithIndex::get(0, Attributes::get(RetAttrs)));
for (unsigned i = 0, e = ArgList.size(); i != e; ++i) {
ParamTypeList.push_back(ArgList[i].Ty);
@@ -2775,11 +2775,12 @@
}
if (FuncAttrs.hasAttributes())
- Attrs.push_back(AttributeWithIndex::get(~0, FuncAttrs));
+ Attrs.push_back(AttributeWithIndex::get(~0, Attributes::get(FuncAttrs)));
AttrListPtr PAL = AttrListPtr::get(Attrs);
- if (PAL.paramHasAttr(1, Attribute::StructRet) && !RetType->isVoidTy())
+ if (PAL.getParamAttributes(1).hasAttribute(Attributes::StructRet) &&
+ !RetType->isVoidTy())
return Error(RetTypeLoc, "functions with 'sret' argument must return void");
FunctionType *FT =
@@ -3247,7 +3248,7 @@
/// OptionalAttrs 'to' TypeAndValue 'unwind' TypeAndValue
bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
LocTy CallLoc = Lex.getLoc();
- Attributes RetAttrs, FnAttrs;
+ Attributes::Builder RetAttrs, FnAttrs;
CallingConv::ID CC;
Type *RetType = 0;
LocTy RetTypeLoc;
@@ -3293,7 +3294,7 @@
// Set up the Attributes for the function.
SmallVector<AttributeWithIndex, 8> Attrs;
if (RetAttrs.hasAttributes())
- Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
+ Attrs.push_back(AttributeWithIndex::get(0, Attributes::get(RetAttrs)));
SmallVector<Value*, 8> Args;
@@ -3321,7 +3322,7 @@
return Error(CallLoc, "not enough parameters specified for call");
if (FnAttrs.hasAttributes())
- Attrs.push_back(AttributeWithIndex::get(~0, FnAttrs));
+ Attrs.push_back(AttributeWithIndex::get(~0, Attributes::get(FnAttrs)));
// Finish off the Attributes and check them
AttrListPtr PAL = AttrListPtr::get(Attrs);
@@ -3646,7 +3647,7 @@
/// ParameterList OptionalAttrs
bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
bool isTail) {
- Attributes RetAttrs, FnAttrs;
+ Attributes::Builder RetAttrs, FnAttrs;
CallingConv::ID CC;
Type *RetType = 0;
LocTy RetTypeLoc;
@@ -3689,7 +3690,7 @@
// Set up the Attributes for the function.
SmallVector<AttributeWithIndex, 8> Attrs;
if (RetAttrs.hasAttributes())
- Attrs.push_back(AttributeWithIndex::get(0, RetAttrs));
+ Attrs.push_back(AttributeWithIndex::get(0, Attributes::get(RetAttrs)));
SmallVector<Value*, 8> Args;
@@ -3717,7 +3718,7 @@
return Error(CallLoc, "not enough parameters specified for call");
if (FnAttrs.hasAttributes())
- Attrs.push_back(AttributeWithIndex::get(~0, FnAttrs));
+ Attrs.push_back(AttributeWithIndex::get(~0, Attributes::get(FnAttrs)));
// Finish off the Attributes and check them
AttrListPtr PAL = AttrListPtr::get(Attrs);
Modified: llvm/branches/R600/lib/AsmParser/LLParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/AsmParser/LLParser.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/AsmParser/LLParser.h (original)
+++ llvm/branches/R600/lib/AsmParser/LLParser.h Thu Oct 11 16:28:00 2012
@@ -175,7 +175,7 @@
bool ParseTLSModel(GlobalVariable::ThreadLocalMode &TLM);
bool ParseOptionalThreadLocal(GlobalVariable::ThreadLocalMode &TLM);
bool ParseOptionalAddrSpace(unsigned &AddrSpace);
- bool ParseOptionalAttrs(Attributes &Attrs, unsigned AttrKind);
+ bool ParseOptionalAttrs(Attributes::Builder &Attrs, unsigned AttrKind);
bool ParseOptionalLinkage(unsigned &Linkage, bool &HasLinkage);
bool ParseOptionalLinkage(unsigned &Linkage) {
bool HasLinkage; return ParseOptionalLinkage(Linkage, HasLinkage);
Modified: llvm/branches/R600/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Bitcode/Reader/BitcodeReader.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/branches/R600/lib/Bitcode/Reader/BitcodeReader.cpp Thu Oct 11 16:28:00 2012
@@ -482,7 +482,7 @@
}
for (unsigned i = 0, e = Record.size(); i != e; i += 2) {
- if (Attributes(Record[i+1]) != Attribute::None)
+ if (Attributes(Record[i+1]).hasAttributes())
Attrs.push_back(AttributeWithIndex::get(Record[i],
Attributes(Record[i+1])));
}
Modified: llvm/branches/R600/lib/CodeGen/Analysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/Analysis.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/Analysis.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/Analysis.cpp Thu Oct 11 16:28:00 2012
@@ -21,7 +21,7 @@
#include "llvm/Module.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/SelectionDAG.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/ErrorHandling.h"
@@ -79,7 +79,7 @@
uint64_t StartingOffset) {
// Given a struct type, recursively traverse the elements.
if (StructType *STy = dyn_cast<StructType>(Ty)) {
- const StructLayout *SL = TLI.getTargetData()->getStructLayout(STy);
+ const StructLayout *SL = TLI.getDataLayout()->getStructLayout(STy);
for (StructType::element_iterator EB = STy->element_begin(),
EI = EB,
EE = STy->element_end();
@@ -91,7 +91,7 @@
// Given an array type, recursively traverse the elements.
if (ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {
Type *EltTy = ATy->getElementType();
- uint64_t EltSize = TLI.getTargetData()->getTypeAllocSize(EltTy);
+ uint64_t EltSize = TLI.getDataLayout()->getTypeAllocSize(EltTy);
for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i)
ComputeValueVTs(TLI, EltTy, ValueVTs, Offsets,
StartingOffset + i * EltSize);
@@ -314,11 +314,13 @@
// the return. Ignore noalias because it doesn't affect the call sequence.
const Function *F = ExitBB->getParent();
Attributes CallerRetAttr = F->getAttributes().getRetAttributes();
- if ((CalleeRetAttr ^ CallerRetAttr) & ~Attribute::NoAlias)
+ if (Attributes::Builder(CalleeRetAttr ^ CallerRetAttr)
+ .removeAttribute(Attributes::NoAlias).hasAttributes())
return false;
// It's not safe to eliminate the sign / zero extension of the return value.
- if (CallerRetAttr.hasZExtAttr() || CallerRetAttr.hasSExtAttr())
+ if (CallerRetAttr.hasAttribute(Attributes::ZExt) ||
+ CallerRetAttr.hasAttribute(Attributes::SExt))
return false;
// Otherwise, make sure the unmodified return value of I is the return value.
@@ -354,11 +356,13 @@
// Conservatively require the attributes of the call to match those of
// the return. Ignore noalias because it doesn't affect the call sequence.
Attributes CallerRetAttr = F->getAttributes().getRetAttributes();
- if (CallerRetAttr & ~Attribute::NoAlias)
+ if (Attributes::Builder(CallerRetAttr)
+ .removeAttribute(Attributes::NoAlias).hasAttributes())
return false;
// It's not safe to eliminate the sign / zero extension of the return value.
- if (CallerRetAttr.hasZExtAttr() || CallerRetAttr.hasSExtAttr())
+ if (CallerRetAttr.hasAttribute(Attributes::ZExt) ||
+ CallerRetAttr.hasAttribute(Attributes::SExt))
return false;
// Check if the only use is a function return node.
Modified: llvm/branches/R600/lib/CodeGen/AsmPrinter/ARMException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/AsmPrinter/ARMException.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/AsmPrinter/ARMException.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/AsmPrinter/ARMException.cpp Thu Oct 11 16:28:00 2012
@@ -24,7 +24,7 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Target/Mangler.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
Modified: llvm/branches/R600/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Thu Oct 11 16:28:00 2012
@@ -33,7 +33,7 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Target/Mangler.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
@@ -67,7 +67,7 @@
/// getGVAlignmentLog2 - Return the alignment to use for the specified global
/// value in log2 form. This rounds up to the preferred alignment if possible
/// and legal.
-static unsigned getGVAlignmentLog2(const GlobalValue *GV, const TargetData &TD,
+static unsigned getGVAlignmentLog2(const GlobalValue *GV, const DataLayout &TD,
unsigned InBits = 0) {
unsigned NumBits = 0;
if (const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV))
@@ -131,9 +131,9 @@
}
-/// getTargetData - Return information about data layout.
-const TargetData &AsmPrinter::getTargetData() const {
- return *TM.getTargetData();
+/// getDataLayout - Return information about data layout.
+const DataLayout &AsmPrinter::getDataLayout() const {
+ return *TM.getDataLayout();
}
/// getCurrentSection() - Return the current section we are emitting to.
@@ -160,7 +160,7 @@
const_cast<TargetLoweringObjectFile&>(getObjFileLowering())
.Initialize(OutContext, TM);
- Mang = new Mangler(OutContext, *TM.getTargetData());
+ Mang = new Mangler(OutContext, *TM.getDataLayout());
// Allow the target to emit any magic that it wants at the start of the file.
EmitStartOfAsmFile(M);
@@ -280,7 +280,7 @@
SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, TM);
- const TargetData *TD = TM.getTargetData();
+ const DataLayout *TD = TM.getDataLayout();
uint64_t Size = TD->getTypeAllocSize(GV->getType()->getElementType());
// If the alignment is specified, we *must* obey it. Overaligning a global
@@ -991,7 +991,7 @@
Kind = SectionKind::getReadOnlyWithRelLocal();
break;
case 0:
- switch (TM.getTargetData()->getTypeAllocSize(CPE.getType())) {
+ switch (TM.getDataLayout()->getTypeAllocSize(CPE.getType())) {
case 4: Kind = SectionKind::getMergeableConst4(); break;
case 8: Kind = SectionKind::getMergeableConst8(); break;
case 16: Kind = SectionKind::getMergeableConst16();break;
@@ -1037,7 +1037,7 @@
OutStreamer.EmitFill(NewOffset - Offset, 0/*fillval*/, 0/*addrspace*/);
Type *Ty = CPE.getType();
- Offset = NewOffset + TM.getTargetData()->getTypeAllocSize(Ty);
+ Offset = NewOffset + TM.getDataLayout()->getTypeAllocSize(Ty);
OutStreamer.EmitLabel(GetCPISymbol(CPI));
if (CPE.isMachineConstantPoolEntry())
@@ -1080,7 +1080,7 @@
JTInDiffSection = true;
}
- EmitAlignment(Log2_32(MJTI->getEntryAlignment(*TM.getTargetData())));
+ EmitAlignment(Log2_32(MJTI->getEntryAlignment(*TM.getDataLayout())));
// Jump tables in code sections are marked with a data_region directive
// where that's supported.
@@ -1196,7 +1196,7 @@
assert(Value && "Unknown entry kind!");
- unsigned EntrySize = MJTI->getEntrySize(*TM.getTargetData());
+ unsigned EntrySize = MJTI->getEntrySize(*TM.getDataLayout());
OutStreamer.EmitValue(Value, EntrySize, /*addrspace*/0);
}
@@ -1298,7 +1298,7 @@
}
// Emit the function pointers in the target-specific order
- const TargetData *TD = TM.getTargetData();
+ const DataLayout *TD = TM.getDataLayout();
unsigned Align = Log2_32(TD->getPointerPrefAlignment());
std::stable_sort(Structors.begin(), Structors.end(), priority_order);
for (unsigned i = 0, e = Structors.size(); i != e; ++i) {
@@ -1414,7 +1414,7 @@
// if required for correctness.
//
void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV) const {
- if (GV) NumBits = getGVAlignmentLog2(GV, *TM.getTargetData(), NumBits);
+ if (GV) NumBits = getGVAlignmentLog2(GV, *TM.getDataLayout(), NumBits);
if (NumBits == 0) return; // 1-byte aligned: no need to emit alignment.
@@ -1453,10 +1453,10 @@
switch (CE->getOpcode()) {
default:
// If the code isn't optimized, there may be outstanding folding
- // opportunities. Attempt to fold the expression using TargetData as a
+ // opportunities. Attempt to fold the expression using DataLayout as a
// last resort before giving up.
if (Constant *C =
- ConstantFoldConstantExpression(CE, AP.TM.getTargetData()))
+ ConstantFoldConstantExpression(CE, AP.TM.getDataLayout()))
if (C != CE)
return lowerConstant(C, AP);
@@ -1470,7 +1470,7 @@
report_fatal_error(OS.str());
}
case Instruction::GetElementPtr: {
- const TargetData &TD = *AP.TM.getTargetData();
+ const DataLayout &TD = *AP.TM.getDataLayout();
// Generate a symbolic expression for the byte address
const Constant *PtrVal = CE->getOperand(0);
SmallVector<Value*, 8> IdxVec(CE->op_begin()+1, CE->op_end());
@@ -1499,7 +1499,7 @@
return lowerConstant(CE->getOperand(0), AP);
case Instruction::IntToPtr: {
- const TargetData &TD = *AP.TM.getTargetData();
+ const DataLayout &TD = *AP.TM.getDataLayout();
// Handle casts to pointers by changing them into casts to the appropriate
// integer type. This promotes constant folding and simplifies this code.
Constant *Op = CE->getOperand(0);
@@ -1509,7 +1509,7 @@
}
case Instruction::PtrToInt: {
- const TargetData &TD = *AP.TM.getTargetData();
+ const DataLayout &TD = *AP.TM.getDataLayout();
// Support only foldable casts to/from pointers that can be eliminated by
// changing the pointer to the appropriately sized integer type.
Constant *Op = CE->getOperand(0);
@@ -1583,7 +1583,7 @@
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
if (CI->getBitWidth() > 64) return -1;
- uint64_t Size = TM.getTargetData()->getTypeAllocSize(V->getType());
+ uint64_t Size = TM.getDataLayout()->getTypeAllocSize(V->getType());
uint64_t Value = CI->getZExtValue();
// Make sure the constant is at least 8 bits long and has a power
@@ -1627,7 +1627,7 @@
// See if we can aggregate this into a .fill, if so, emit it as such.
int Value = isRepeatedByteSequence(CDS, AP.TM);
if (Value != -1) {
- uint64_t Bytes = AP.TM.getTargetData()->getTypeAllocSize(CDS->getType());
+ uint64_t Bytes = AP.TM.getDataLayout()->getTypeAllocSize(CDS->getType());
// Don't emit a 1-byte object as a .fill.
if (Bytes > 1)
return AP.OutStreamer.EmitFill(Bytes, Value, AddrSpace);
@@ -1677,7 +1677,7 @@
}
}
- const TargetData &TD = *AP.TM.getTargetData();
+ const DataLayout &TD = *AP.TM.getDataLayout();
unsigned Size = TD.getTypeAllocSize(CDS->getType());
unsigned EmittedSize = TD.getTypeAllocSize(CDS->getType()->getElementType()) *
CDS->getNumElements();
@@ -1693,7 +1693,7 @@
int Value = isRepeatedByteSequence(CA, AP.TM);
if (Value != -1) {
- uint64_t Bytes = AP.TM.getTargetData()->getTypeAllocSize(CA->getType());
+ uint64_t Bytes = AP.TM.getDataLayout()->getTypeAllocSize(CA->getType());
AP.OutStreamer.EmitFill(Bytes, Value, AddrSpace);
}
else {
@@ -1707,7 +1707,7 @@
for (unsigned i = 0, e = CV->getType()->getNumElements(); i != e; ++i)
emitGlobalConstantImpl(CV->getOperand(i), AddrSpace, AP);
- const TargetData &TD = *AP.TM.getTargetData();
+ const DataLayout &TD = *AP.TM.getDataLayout();
unsigned Size = TD.getTypeAllocSize(CV->getType());
unsigned EmittedSize = TD.getTypeAllocSize(CV->getType()->getElementType()) *
CV->getType()->getNumElements();
@@ -1718,7 +1718,7 @@
static void emitGlobalConstantStruct(const ConstantStruct *CS,
unsigned AddrSpace, AsmPrinter &AP) {
// Print the fields in successive locations. Pad to align if needed!
- const TargetData *TD = AP.TM.getTargetData();
+ const DataLayout *TD = AP.TM.getDataLayout();
unsigned Size = TD->getTypeAllocSize(CS->getType());
const StructLayout *Layout = TD->getStructLayout(CS->getType());
uint64_t SizeSoFar = 0;
@@ -1798,7 +1798,7 @@
<< DoubleVal.convertToDouble() << '\n';
}
- if (AP.TM.getTargetData()->isBigEndian()) {
+ if (AP.TM.getDataLayout()->isBigEndian()) {
AP.OutStreamer.EmitIntValue(p[1], 2, AddrSpace);
AP.OutStreamer.EmitIntValue(p[0], 8, AddrSpace);
} else {
@@ -1807,7 +1807,7 @@
}
// Emit the tail padding for the long double.
- const TargetData &TD = *AP.TM.getTargetData();
+ const DataLayout &TD = *AP.TM.getDataLayout();
AP.OutStreamer.EmitZeros(TD.getTypeAllocSize(CFP->getType()) -
TD.getTypeStoreSize(CFP->getType()), AddrSpace);
return;
@@ -1819,7 +1819,7 @@
// API needed to prevent premature destruction.
APInt API = CFP->getValueAPF().bitcastToAPInt();
const uint64_t *p = API.getRawData();
- if (AP.TM.getTargetData()->isBigEndian()) {
+ if (AP.TM.getDataLayout()->isBigEndian()) {
AP.OutStreamer.EmitIntValue(p[0], 8, AddrSpace);
AP.OutStreamer.EmitIntValue(p[1], 8, AddrSpace);
} else {
@@ -1830,7 +1830,7 @@
static void emitGlobalConstantLargeInt(const ConstantInt *CI,
unsigned AddrSpace, AsmPrinter &AP) {
- const TargetData *TD = AP.TM.getTargetData();
+ const DataLayout *TD = AP.TM.getDataLayout();
unsigned BitWidth = CI->getBitWidth();
assert((BitWidth & 63) == 0 && "only support multiples of 64-bits");
@@ -1846,7 +1846,7 @@
static void emitGlobalConstantImpl(const Constant *CV, unsigned AddrSpace,
AsmPrinter &AP) {
- const TargetData *TD = AP.TM.getTargetData();
+ const DataLayout *TD = AP.TM.getDataLayout();
uint64_t Size = TD->getTypeAllocSize(CV->getType());
if (isa<ConstantAggregateZero>(CV) || isa<UndefValue>(CV))
return AP.OutStreamer.EmitZeros(Size, AddrSpace);
@@ -1911,7 +1911,7 @@
/// EmitGlobalConstant - Print a general LLVM constant to the .s file.
void AsmPrinter::EmitGlobalConstant(const Constant *CV, unsigned AddrSpace) {
- uint64_t Size = TM.getTargetData()->getTypeAllocSize(CV->getType());
+ uint64_t Size = TM.getDataLayout()->getTypeAllocSize(CV->getType());
if (Size)
emitGlobalConstantImpl(CV, AddrSpace, *this);
else if (MAI->hasSubsectionsViaSymbols()) {
Modified: llvm/branches/R600/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Thu Oct 11 16:28:00 2012
@@ -18,7 +18,7 @@
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
@@ -112,7 +112,7 @@
switch (Encoding & 0x07) {
default: llvm_unreachable("Invalid encoded value.");
- case dwarf::DW_EH_PE_absptr: return TM.getTargetData()->getPointerSize();
+ case dwarf::DW_EH_PE_absptr: return TM.getDataLayout()->getPointerSize();
case dwarf::DW_EH_PE_udata2: return 2;
case dwarf::DW_EH_PE_udata4: return 4;
case dwarf::DW_EH_PE_udata8: return 8;
Modified: llvm/branches/R600/lib/CodeGen/AsmPrinter/DIE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/AsmPrinter/DIE.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/AsmPrinter/DIE.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/AsmPrinter/DIE.cpp Thu Oct 11 16:28:00 2012
@@ -17,7 +17,7 @@
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
@@ -200,7 +200,7 @@
case dwarf::DW_FORM_udata: Asm->EmitULEB128(Integer); return;
case dwarf::DW_FORM_sdata: Asm->EmitSLEB128(Integer); return;
case dwarf::DW_FORM_addr:
- Size = Asm->getTargetData().getPointerSize(); break;
+ Size = Asm->getDataLayout().getPointerSize(); break;
default: llvm_unreachable("DIE Value form not supported yet");
}
Asm->OutStreamer.EmitIntValue(Integer, Size, 0/*addrspace*/);
@@ -222,7 +222,7 @@
case dwarf::DW_FORM_data8: return sizeof(int64_t);
case dwarf::DW_FORM_udata: return MCAsmInfo::getULEB128Size(Integer);
case dwarf::DW_FORM_sdata: return MCAsmInfo::getSLEB128Size(Integer);
- case dwarf::DW_FORM_addr: return AP->getTargetData().getPointerSize();
+ case dwarf::DW_FORM_addr: return AP->getDataLayout().getPointerSize();
default: llvm_unreachable("DIE Value form not supported yet");
}
}
@@ -249,7 +249,7 @@
unsigned DIELabel::SizeOf(AsmPrinter *AP, unsigned Form) const {
if (Form == dwarf::DW_FORM_data4) return 4;
if (Form == dwarf::DW_FORM_strp) return 4;
- return AP->getTargetData().getPointerSize();
+ return AP->getDataLayout().getPointerSize();
}
#ifndef NDEBUG
@@ -273,7 +273,7 @@
unsigned DIEDelta::SizeOf(AsmPrinter *AP, unsigned Form) const {
if (Form == dwarf::DW_FORM_data4) return 4;
if (Form == dwarf::DW_FORM_strp) return 4;
- return AP->getTargetData().getPointerSize();
+ return AP->getDataLayout().getPointerSize();
}
#ifndef NDEBUG
Modified: llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp Thu Oct 11 16:28:00 2012
@@ -133,8 +133,8 @@
}
}
-// Walk through and emit the buckets for the table. This will look
-// like a list of numbers of how many elements are in each bucket.
+// Walk through and emit the buckets for the table. Each index is
+// an offset into the list of hashes.
void DwarfAccelTable::EmitBuckets(AsmPrinter *Asm) {
unsigned index = 0;
for (size_t i = 0, e = Buckets.size(); i < e; ++i) {
Modified: llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp Thu Oct 11 16:28:00 2012
@@ -25,7 +25,7 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Target/Mangler.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
Modified: llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Thu Oct 11 16:28:00 2012
@@ -22,7 +22,7 @@
#include "llvm/Instructions.h"
#include "llvm/Support/Debug.h"
#include "llvm/Target/Mangler.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegisterInfo.h"
@@ -510,7 +510,7 @@
const char *FltPtr = (const char*)FltVal.getRawData();
int NumBytes = FltVal.getBitWidth() / 8; // 8 bits per byte.
- bool LittleEndian = Asm->getTargetData().isLittleEndian();
+ bool LittleEndian = Asm->getDataLayout().isLittleEndian();
int Incr = (LittleEndian ? 1 : -1);
int Start = (LittleEndian ? 0 : NumBytes - 1);
int Stop = (LittleEndian ? NumBytes : -1);
@@ -552,7 +552,7 @@
const uint64_t *Ptr64 = Val.getRawData();
int NumBytes = Val.getBitWidth() / 8; // 8 bits per byte.
- bool LittleEndian = Asm->getTargetData().isLittleEndian();
+ bool LittleEndian = Asm->getDataLayout().isLittleEndian();
// Output the constant to DWARF one byte at a time.
for (int i = 0; i < NumBytes; i++) {
@@ -1227,7 +1227,7 @@
addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);
SmallVector<Value*, 3> Idx(CE->op_begin()+1, CE->op_end());
addUInt(Block, 0, dwarf::DW_FORM_udata,
- Asm->getTargetData().getIndexedOffset(Ptr->getType(), Idx));
+ Asm->getDataLayout().getIndexedOffset(Ptr->getType(), Idx));
addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);
addBlock(VariableDIE, dwarf::DW_AT_location, 0, Block);
}
@@ -1459,7 +1459,7 @@
Offset -= FieldOffset;
// Maybe we need to work from the other end.
- if (Asm->getTargetData().isLittleEndian())
+ if (Asm->getDataLayout().isLittleEndian())
Offset = FieldSize - (Offset + Size);
addUInt(MemberDie, dwarf::DW_AT_bit_offset, 0, Offset);
Modified: llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Oct 11 16:28:00 2012
@@ -27,7 +27,7 @@
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
@@ -331,8 +331,8 @@
if (ATy.isArtificial())
SPCU->addFlag(Arg, dwarf::DW_AT_artificial);
if (ATy.isObjectPointer())
- SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer, dwarf::DW_FORM_ref4,
- Arg);
+ SPCU->addDIEEntry(SPDie, dwarf::DW_AT_object_pointer,
+ dwarf::DW_FORM_ref4, Arg);
SPDie->addChild(Arg);
}
DIE *SPDeclDie = SPDie;
@@ -384,7 +384,7 @@
// DW_AT_ranges appropriately.
TheCU->addUInt(ScopeDIE, dwarf::DW_AT_ranges, dwarf::DW_FORM_data4,
DebugRangeSymbols.size()
- * Asm->getTargetData().getPointerSize());
+ * Asm->getDataLayout().getPointerSize());
for (SmallVector<InsnRange, 4>::const_iterator RI = Ranges.begin(),
RE = Ranges.end(); RI != RE; ++RI) {
DebugRangeSymbols.push_back(getLabelBeforeInsn(RI->first));
@@ -450,7 +450,7 @@
// DW_AT_ranges appropriately.
TheCU->addUInt(ScopeDIE, dwarf::DW_AT_ranges, dwarf::DW_FORM_data4,
DebugRangeSymbols.size()
- * Asm->getTargetData().getPointerSize());
+ * Asm->getDataLayout().getPointerSize());
for (SmallVector<InsnRange, 4>::const_iterator RI = Ranges.begin(),
RE = Ranges.end(); RI != RE; ++RI) {
DebugRangeSymbols.push_back(getLabelBeforeInsn(RI->first));
@@ -1069,7 +1069,7 @@
if (AbsVar)
AbsVar->setMInsn(MInsn);
- // Simple ranges that are fully coalesced.
+ // Simplify ranges that are fully coalesced.
if (History.size() <= 1 || (History.size() == 2 &&
MInsn->isIdenticalTo(History.back()))) {
RegVar->setMInsn(MInsn);
@@ -1322,7 +1322,7 @@
// Coalesce identical entries at the end of History.
if (History.size() >= 2 &&
Prev->isIdenticalTo(History[History.size() - 2])) {
- DEBUG(dbgs() << "Coalesce identical DBG_VALUE entries:\n"
+ DEBUG(dbgs() << "Coalescing identical DBG_VALUE entries:\n"
<< "\t" << *Prev
<< "\t" << *History[History.size() - 2] << "\n");
History.pop_back();
@@ -1338,7 +1338,7 @@
PrevMBB->getLastNonDebugInstr();
if (LastMI == PrevMBB->end()) {
// Drop DBG_VALUE for empty range.
- DEBUG(dbgs() << "Drop DBG_VALUE for empty range:\n"
+ DEBUG(dbgs() << "Dropping DBG_VALUE for empty range:\n"
<< "\t" << *Prev << "\n");
History.pop_back();
}
@@ -1355,9 +1355,10 @@
if (!MI->isLabel())
AtBlockEntry = false;
- // First known non DBG_VALUE location marks beginning of function
- // body.
- if (PrologEndLoc.isUnknown() && !MI->getDebugLoc().isUnknown())
+ // First known non-DBG_VALUE and non-frame setup location marks
+ // the beginning of the function body.
+ if (!MI->getFlag(MachineInstr::FrameSetup) &&
+ (PrologEndLoc.isUnknown() && !MI->getDebugLoc().isUnknown()))
PrologEndLoc = MI->getDebugLoc();
// Check if the instruction clobbers any registers with debug vars.
@@ -1764,7 +1765,7 @@
Asm->EmitSectionOffset(Asm->GetTempSymbol("abbrev_begin"),
DwarfAbbrevSectionSym);
Asm->OutStreamer.AddComment("Address Size (in bytes)");
- Asm->EmitInt8(Asm->getTargetData().getPointerSize());
+ Asm->EmitInt8(Asm->getDataLayout().getPointerSize());
emitDIE(Die);
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("info_end", TheCU->getID()));
@@ -1810,14 +1811,14 @@
Asm->EmitInt8(0);
Asm->OutStreamer.AddComment("Op size");
- Asm->EmitInt8(Asm->getTargetData().getPointerSize() + 1);
+ Asm->EmitInt8(Asm->getDataLayout().getPointerSize() + 1);
Asm->OutStreamer.AddComment("DW_LNE_set_address");
Asm->EmitInt8(dwarf::DW_LNE_set_address);
Asm->OutStreamer.AddComment("Section end label");
Asm->OutStreamer.EmitSymbolValue(Asm->GetTempSymbol("section_end",SectionEnd),
- Asm->getTargetData().getPointerSize(),
+ Asm->getDataLayout().getPointerSize(),
0/*AddrSpace*/);
// Mark end of matrix.
@@ -2046,7 +2047,7 @@
// Start the dwarf loc section.
Asm->OutStreamer.SwitchSection(
Asm->getObjFileLowering().getDwarfLocSection());
- unsigned char Size = Asm->getTargetData().getPointerSize();
+ unsigned char Size = Asm->getDataLayout().getPointerSize();
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_loc", 0));
unsigned index = 1;
for (SmallVector<DotDebugLocEntry, 4>::iterator
@@ -2143,7 +2144,7 @@
// Start the dwarf ranges section.
Asm->OutStreamer.SwitchSection(
Asm->getObjFileLowering().getDwarfRangesSection());
- unsigned char Size = Asm->getTargetData().getPointerSize();
+ unsigned char Size = Asm->getDataLayout().getPointerSize();
for (SmallVector<const MCSymbol *, 8>::iterator
I = DebugRangeSymbols.begin(), E = DebugRangeSymbols.end();
I != E; ++I) {
@@ -2201,7 +2202,7 @@
Asm->OutStreamer.AddComment("Dwarf Version");
Asm->EmitInt16(dwarf::DWARF_VERSION);
Asm->OutStreamer.AddComment("Address Size (in bytes)");
- Asm->EmitInt8(Asm->getTargetData().getPointerSize());
+ Asm->EmitInt8(Asm->getDataLayout().getPointerSize());
for (SmallVector<const MDNode *, 4>::iterator I = InlinedSPNodes.begin(),
E = InlinedSPNodes.end(); I != E; ++I) {
@@ -2232,7 +2233,7 @@
if (Asm->isVerbose()) Asm->OutStreamer.AddComment("low_pc");
Asm->OutStreamer.EmitSymbolValue(LI->first,
- Asm->getTargetData().getPointerSize(),0);
+ Asm->getDataLayout().getPointerSize(),0);
}
}
Modified: llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfException.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/AsmPrinter/DwarfException.cpp Thu Oct 11 16:28:00 2012
@@ -24,7 +24,7 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Target/Mangler.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
@@ -417,7 +417,7 @@
// that we're omitting that bit.
TTypeEncoding = dwarf::DW_EH_PE_omit;
// dwarf::DW_EH_PE_absptr
- TypeFormatSize = Asm->getTargetData().getPointerSize();
+ TypeFormatSize = Asm->getDataLayout().getPointerSize();
} else {
// Okay, we have actual filters or typeinfos to emit. As such, we need to
// pick a type encoding for them. We're about to emit a list of pointers to
Modified: llvm/branches/R600/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp Thu Oct 11 16:28:00 2012
@@ -20,7 +20,7 @@
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/Mangler.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/ADT/SmallString.h"
@@ -91,7 +91,7 @@
/// either condition is detected in a function which uses the GC.
///
void OcamlGCMetadataPrinter::finishAssembly(AsmPrinter &AP) {
- unsigned IntPtrSize = AP.TM.getTargetData()->getPointerSize();
+ unsigned IntPtrSize = AP.TM.getDataLayout()->getPointerSize();
AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getTextSection());
EmitCamlGlobal(getModule(), AP, "code_end");
Modified: llvm/branches/R600/lib/CodeGen/AsmPrinter/Win64Exception.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/AsmPrinter/Win64Exception.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/AsmPrinter/Win64Exception.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/AsmPrinter/Win64Exception.cpp Thu Oct 11 16:28:00 2012
@@ -24,7 +24,7 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Target/Mangler.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
Modified: llvm/branches/R600/lib/CodeGen/BranchFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/BranchFolding.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/BranchFolding.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/BranchFolding.cpp Thu Oct 11 16:28:00 2012
@@ -357,9 +357,8 @@
if (I1 == MBB1->begin() && I2 != MBB2->begin()) {
--I2;
while (I2->isDebugValue()) {
- if (I2 == MBB2->begin()) {
+ if (I2 == MBB2->begin())
return TailLen;
- }
--I2;
}
++I2;
@@ -482,21 +481,19 @@
BranchFolder::MergePotentialsElt::operator<(const MergePotentialsElt &o) const {
if (getHash() < o.getHash())
return true;
- else if (getHash() > o.getHash())
+ if (getHash() > o.getHash())
return false;
- else if (getBlock()->getNumber() < o.getBlock()->getNumber())
+ if (getBlock()->getNumber() < o.getBlock()->getNumber())
return true;
- else if (getBlock()->getNumber() > o.getBlock()->getNumber())
+ if (getBlock()->getNumber() > o.getBlock()->getNumber())
return false;
- else {
- // _GLIBCXX_DEBUG checks strict weak ordering, which involves comparing
- // an object with itself.
+ // _GLIBCXX_DEBUG checks strict weak ordering, which involves comparing
+ // an object with itself.
#ifndef _GLIBCXX_DEBUG
- llvm_unreachable("Predecessor appears twice");
+ llvm_unreachable("Predecessor appears twice");
#else
- return false;
+ return false;
#endif
- }
}
/// CountTerminators - Count the number of terminators in the given
@@ -574,7 +571,8 @@
// instructions that would be deleted in the merge.
MachineFunction *MF = MBB1->getParent();
if (EffectiveTailLen >= 2 &&
- MF->getFunction()->getFnAttributes().hasOptimizeForSizeAttr() &&
+ MF->getFunction()->getFnAttributes().
+ hasAttribute(Attributes::OptimizeForSize) &&
(I1 == MBB1->begin() || I2 == MBB2->begin()))
return true;
Modified: llvm/branches/R600/lib/CodeGen/CallingConvLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/CallingConvLower.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/CallingConvLower.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/CallingConvLower.cpp Thu Oct 11 16:28:00 2012
@@ -18,7 +18,7 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetRegisterInfo.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetLowering.h"
using namespace llvm;
Modified: llvm/branches/R600/lib/CodeGen/CodePlacementOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/CodePlacementOpt.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/CodePlacementOpt.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/CodePlacementOpt.cpp Thu Oct 11 16:28:00 2012
@@ -373,7 +373,7 @@
///
bool CodePlacementOpt::AlignLoops(MachineFunction &MF) {
const Function *F = MF.getFunction();
- if (F->getFnAttributes().hasOptimizeForSizeAttr())
+ if (F->getFnAttributes().hasAttribute(Attributes::OptimizeForSize))
return false;
unsigned Align = TLI->getPrefLoopAlignment();
Modified: llvm/branches/R600/lib/CodeGen/EarlyIfConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/EarlyIfConversion.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/EarlyIfConversion.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/EarlyIfConversion.cpp Thu Oct 11 16:28:00 2012
@@ -31,9 +31,9 @@
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
-#include "llvm/MC/MCInstrItineraries.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetRegisterInfo.h"
+#include "llvm/Target/TargetSubtargetInfo.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
@@ -777,7 +777,8 @@
<< "********** Function: " << MF.getName() << '\n');
TII = MF.getTarget().getInstrInfo();
TRI = MF.getTarget().getRegisterInfo();
- SchedModel = MF.getTarget().getInstrItineraryData()->SchedModel;
+ SchedModel =
+ MF.getTarget().getSubtarget<TargetSubtargetInfo>().getSchedModel();
MRI = &MF.getRegInfo();
DomTree = &getAnalysis<MachineDominatorTree>();
Loops = getAnalysisIfAvailable<MachineLoopInfo>();
Modified: llvm/branches/R600/lib/CodeGen/ExecutionDepsFix.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/ExecutionDepsFix.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/ExecutionDepsFix.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/ExecutionDepsFix.cpp Thu Oct 11 16:28:00 2012
@@ -626,9 +626,12 @@
}
dv->Instrs.push_back(mi);
- // Finally set all defs and non-collapsed uses to dv.
- for (unsigned i = 0, e = mi->getDesc().getNumOperands(); i != e; ++i) {
- MachineOperand &mo = mi->getOperand(i);
+ // Finally set all defs and non-collapsed uses to dv. We must iterate through
+ // all the operators, including imp-def ones.
+ for (MachineInstr::mop_iterator ii = mi->operands_begin(),
+ ee = mi->operands_end();
+ ii != ee; ++ii) {
+ MachineOperand &mo = *ii;
if (!mo.isReg()) continue;
int rx = regIndex(mo.getReg());
if (rx < 0) continue;
Modified: llvm/branches/R600/lib/CodeGen/IntrinsicLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/IntrinsicLowering.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/IntrinsicLowering.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/IntrinsicLowering.cpp Thu Oct 11 16:28:00 2012
@@ -21,7 +21,7 @@
#include "llvm/Support/CallSite.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
using namespace llvm;
template <class ArgIt>
Modified: llvm/branches/R600/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/LiveIntervalAnalysis.cpp Thu Oct 11 16:28:00 2012
@@ -1164,18 +1164,17 @@
unsigned Reg = MO.getReg();
- // TODO: Currently we're skipping uses that are reserved or have no
- // interval, but we're not updating their kills. This should be
- // fixed.
- if (TargetRegisterInfo::isPhysicalRegister(Reg) && LIS.isReserved(Reg))
- continue;
+ // Don't track uses of reserved registers - they're not accurate.
+ // Reserved register live ranges look like a set of dead defs.
+ bool Resv =
+ TargetRegisterInfo::isPhysicalRegister(Reg) && LIS.isReserved(Reg);
// Collect ranges for register units. These live ranges are computed on
// demand, so just skip any that haven't been computed yet.
if (TargetRegisterInfo::isPhysicalRegister(Reg)) {
for (MCRegUnitIterator Units(Reg, &TRI); Units.isValid(); ++Units)
if (LiveInterval *LI = LIS.getCachedRegUnit(*Units))
- collectRanges(MO, LI, Entering, Internal, Exiting, OldIdx);
+ collectRanges(MO, LI, Entering, Internal, Exiting, OldIdx, Resv);
} else {
// Collect ranges for individual virtual registers.
collectRanges(MO, &LIS.getInterval(Reg),
@@ -1186,8 +1185,8 @@
void collectRanges(const MachineOperand &MO, LiveInterval *LI,
RangeSet &Entering, RangeSet &Internal, RangeSet &Exiting,
- SlotIndex OldIdx) {
- if (MO.readsReg()) {
+ SlotIndex OldIdx, bool IgnoreReads = false) {
+ if (!IgnoreReads && MO.readsReg()) {
LiveRange* LR = LI->getLiveRangeContaining(OldIdx);
if (LR != 0)
Entering.insert(std::make_pair(LI, LR));
Modified: llvm/branches/R600/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/MachineBasicBlock.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/MachineBasicBlock.cpp Thu Oct 11 16:28:00 2012
@@ -21,7 +21,7 @@
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/Target/TargetRegisterInfo.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Assembly/Writer.h"
Modified: llvm/branches/R600/lib/CodeGen/MachineBlockPlacement.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/MachineBlockPlacement.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/MachineBlockPlacement.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/MachineBlockPlacement.cpp Thu Oct 11 16:28:00 2012
@@ -1013,7 +1013,8 @@
// exclusively on the loop info here so that we can align backedges in
// unnatural CFGs and backedges that were introduced purely because of the
// loop rotations done during this layout pass.
- if (F.getFunction()->getFnAttributes().hasOptimizeForSizeAttr())
+ if (F.getFunction()->getFnAttributes().
+ hasAttribute(Attributes::OptimizeForSize))
return;
unsigned Align = TLI->getPrefLoopAlignment();
if (!Align)
Modified: llvm/branches/R600/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/MachineFunction.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/MachineFunction.cpp Thu Oct 11 16:28:00 2012
@@ -28,7 +28,7 @@
#include "llvm/MC/MCContext.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetFrameLowering.h"
@@ -59,13 +59,13 @@
RegInfo = 0;
MFInfo = 0;
FrameInfo = new (Allocator) MachineFrameInfo(*TM.getFrameLowering());
- if (Fn->getFnAttributes().hasStackAlignmentAttr())
+ if (Fn->getFnAttributes().hasAttribute(Attributes::StackAlignment))
FrameInfo->ensureMaxAlignment(Fn->getAttributes().
getFnAttributes().getStackAlignment());
- ConstantPool = new (Allocator) MachineConstantPool(TM.getTargetData());
+ ConstantPool = new (Allocator) MachineConstantPool(TM.getDataLayout());
Alignment = TM.getTargetLowering()->getMinFunctionAlignment();
// FIXME: Shouldn't use pref alignment if explicit alignment is set on Fn.
- if (!Fn->getFnAttributes().hasOptimizeForSizeAttr())
+ if (!Fn->getFnAttributes().hasAttribute(Attributes::OptimizeForSize))
Alignment = std::max(Alignment,
TM.getTargetLowering()->getPrefFunctionAlignment());
FunctionNumber = FunctionNum;
@@ -545,7 +545,7 @@
//===----------------------------------------------------------------------===//
/// getEntrySize - Return the size of each entry in the jump table.
-unsigned MachineJumpTableInfo::getEntrySize(const TargetData &TD) const {
+unsigned MachineJumpTableInfo::getEntrySize(const DataLayout &TD) const {
// The size of a jump table entry is 4 bytes unless the entry is just the
// address of a block, in which case it is the pointer size.
switch (getEntryKind()) {
@@ -564,7 +564,7 @@
}
/// getEntryAlignment - Return the alignment of each entry in the jump table.
-unsigned MachineJumpTableInfo::getEntryAlignment(const TargetData &TD) const {
+unsigned MachineJumpTableInfo::getEntryAlignment(const DataLayout &TD) const {
// The alignment of a jump table entry is the alignment of int32 unless the
// entry is just the address of a block, in which case it is the pointer
// alignment.
@@ -670,7 +670,7 @@
/// CanShareConstantPoolEntry - Test whether the given two constants
/// can be allocated the same constant pool entry.
static bool CanShareConstantPoolEntry(const Constant *A, const Constant *B,
- const TargetData *TD) {
+ const DataLayout *TD) {
// Handle the trivial case quickly.
if (A == B) return true;
@@ -694,7 +694,7 @@
// Try constant folding a bitcast of both instructions to an integer. If we
// get two identical ConstantInt's, then we are good to share them. We use
// the constant folding APIs to do this so that we get the benefit of
- // TargetData.
+ // DataLayout.
if (isa<PointerType>(A->getType()))
A = ConstantFoldInstOperands(Instruction::PtrToInt, IntTy,
const_cast<Constant*>(A), TD);
Modified: llvm/branches/R600/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/MachineInstr.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/MachineInstr.cpp Thu Oct 11 16:28:00 2012
@@ -540,20 +540,6 @@
/// MachineInstr ctor - This constructor creates a MachineInstr and adds the
/// implicit operands. It reserves space for the number of operands specified by
/// the MCInstrDesc.
-MachineInstr::MachineInstr(const MCInstrDesc &tid, bool NoImp)
- : MCID(&tid), Flags(0), AsmPrinterFlags(0),
- NumMemRefs(0), MemRefs(0), Parent(0) {
- unsigned NumImplicitOps = 0;
- if (!NoImp)
- NumImplicitOps = MCID->getNumImplicitDefs() + MCID->getNumImplicitUses();
- Operands.reserve(NumImplicitOps + MCID->getNumOperands());
- if (!NoImp)
- addImplicitDefUseOperands();
- // Make sure that we get added to a machine basicblock
- LeakDetector::addGarbageObject(this);
-}
-
-/// MachineInstr ctor - As above, but with a DebugLoc.
MachineInstr::MachineInstr(const MCInstrDesc &tid, const DebugLoc dl,
bool NoImp)
: MCID(&tid), Flags(0), AsmPrinterFlags(0),
@@ -571,21 +557,6 @@
/// MachineInstr ctor - Work exactly the same as the ctor two above, except
/// that the MachineInstr is created and added to the end of the specified
/// basic block.
-MachineInstr::MachineInstr(MachineBasicBlock *MBB, const MCInstrDesc &tid)
- : MCID(&tid), Flags(0), AsmPrinterFlags(0),
- NumMemRefs(0), MemRefs(0), Parent(0) {
- assert(MBB && "Cannot use inserting ctor with null basic block!");
- unsigned NumImplicitOps =
- MCID->getNumImplicitDefs() + MCID->getNumImplicitUses();
- Operands.reserve(NumImplicitOps + MCID->getNumOperands());
- addImplicitDefUseOperands();
- // Make sure that we get added to a machine basicblock
- LeakDetector::addGarbageObject(this);
- MBB->push_back(this); // Add instruction to end of basic block!
-}
-
-/// MachineInstr ctor - As above, but with a DebugLoc.
-///
MachineInstr::MachineInstr(MachineBasicBlock *MBB, const DebugLoc dl,
const MCInstrDesc &tid)
: MCID(&tid), Flags(0), AsmPrinterFlags(0),
Modified: llvm/branches/R600/lib/CodeGen/MachineModuleInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/MachineModuleInfo.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/MachineModuleInfo.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/MachineModuleInfo.cpp Thu Oct 11 16:28:00 2012
@@ -25,7 +25,7 @@
using namespace llvm;
using namespace llvm::dwarf;
-// Handle the Pass registration stuff necessary to use TargetData's.
+// Handle the Pass registration stuff necessary to use DataLayout's.
INITIALIZE_PASS(MachineModuleInfo, "machinemoduleinfo",
"Machine Module Information", false, false)
char MachineModuleInfo::ID = 0;
Modified: llvm/branches/R600/lib/CodeGen/MachineScheduler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/MachineScheduler.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/MachineScheduler.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/MachineScheduler.cpp Thu Oct 11 16:28:00 2012
@@ -495,6 +495,7 @@
bool IsTopNode = false;
while (SUnit *SU = SchedImpl->pickNode(IsTopNode)) {
+ assert(!SU->isScheduled && "Node already scheduled");
if (!checkSchedLimit())
break;
@@ -651,6 +652,7 @@
/// of "hazards" and other interlocks at the current cycle.
struct SchedBoundary {
ScheduleDAGMI *DAG;
+ const TargetSchedModel *SchedModel;
ReadyQueue Available;
ReadyQueue Pending;
@@ -670,13 +672,18 @@
/// Pending queues extend the ready queues with the same ID and the
/// PendingFlag set.
SchedBoundary(unsigned ID, const Twine &Name):
- DAG(0), Available(ID, Name+".A"),
+ DAG(0), SchedModel(0), Available(ID, Name+".A"),
Pending(ID << ConvergingScheduler::LogMaxQID, Name+".P"),
CheckPending(false), HazardRec(0), CurrCycle(0), IssueCount(0),
MinReadyCycle(UINT_MAX), MaxMinLatency(0) {}
~SchedBoundary() { delete HazardRec; }
+ void init(ScheduleDAGMI *dag, const TargetSchedModel *smodel) {
+ DAG = dag;
+ SchedModel = smodel;
+ }
+
bool isTop() const {
return Available.getID() == ConvergingScheduler::TopQID;
}
@@ -697,6 +704,7 @@
};
ScheduleDAGMI *DAG;
+ const TargetSchedModel *SchedModel;
const TargetRegisterInfo *TRI;
// State of the top and bottom scheduled instruction boundaries.
@@ -712,7 +720,7 @@
};
ConvergingScheduler():
- DAG(0), TRI(0), Top(TopQID, "TopQ"), Bot(BotQID, "BotQ") {}
+ DAG(0), SchedModel(0), TRI(0), Top(TopQID, "TopQ"), Bot(BotQID, "BotQ") {}
virtual void initialize(ScheduleDAGMI *dag);
@@ -739,13 +747,15 @@
void ConvergingScheduler::initialize(ScheduleDAGMI *dag) {
DAG = dag;
+ SchedModel = DAG->getSchedModel();
TRI = DAG->TRI;
- Top.DAG = dag;
- Bot.DAG = dag;
+ Top.init(DAG, SchedModel);
+ Bot.init(DAG, SchedModel);
- // Initialize the HazardRecognizers.
+ // Initialize the HazardRecognizers. If itineraries don't exist, are empty, or
+ // are disabled, then these HazardRecs will be disabled.
+ const InstrItineraryData *Itin = SchedModel->getInstrItineraries();
const TargetMachine &TM = DAG->MF.getTarget();
- const InstrItineraryData *Itin = TM.getInstrItineraryData();
Top.HazardRec = TM.getInstrInfo()->CreateTargetMIHazardRecognizer(Itin, DAG);
Bot.HazardRec = TM.getInstrInfo()->CreateTargetMIHazardRecognizer(Itin, DAG);
@@ -806,7 +816,8 @@
if (HazardRec->isEnabled())
return HazardRec->getHazardType(SU) != ScheduleHazardRecognizer::NoHazard;
- if (IssueCount + DAG->getNumMicroOps(SU->getInstr()) > DAG->getIssueWidth())
+ unsigned uops = SchedModel->getNumMicroOps(SU->getInstr());
+ if (IssueCount + uops > SchedModel->getIssueWidth())
return true;
return false;
@@ -827,7 +838,7 @@
/// Move the boundary of scheduled code by one cycle.
void ConvergingScheduler::SchedBoundary::bumpCycle() {
- unsigned Width = DAG->getIssueWidth();
+ unsigned Width = SchedModel->getIssueWidth();
IssueCount = (IssueCount <= Width) ? 0 : IssueCount - Width;
assert(MinReadyCycle < UINT_MAX && "MinReadyCycle uninitialized");
@@ -865,8 +876,8 @@
}
// Check the instruction group dispatch limit.
// TODO: Check if this SU must end a dispatch group.
- IssueCount += DAG->getNumMicroOps(SU->getInstr());
- if (IssueCount >= DAG->getIssueWidth()) {
+ IssueCount += SchedModel->getNumMicroOps(SU->getInstr());
+ if (IssueCount >= SchedModel->getIssueWidth()) {
DEBUG(dbgs() << "*** Max instrs at cycle " << CurrCycle << '\n');
bumpCycle();
}
@@ -1119,33 +1130,36 @@
return NULL;
}
SUnit *SU;
- if (ForceTopDown) {
- SU = Top.pickOnlyChoice();
- if (!SU) {
- SchedCandidate TopCand;
- CandResult TopResult =
- pickNodeFromQueue(Top.Available, DAG->getTopRPTracker(), TopCand);
- assert(TopResult != NoCand && "failed to find the first candidate");
- (void)TopResult;
- SU = TopCand.SU;
+ do {
+ if (ForceTopDown) {
+ SU = Top.pickOnlyChoice();
+ if (!SU) {
+ SchedCandidate TopCand;
+ CandResult TopResult =
+ pickNodeFromQueue(Top.Available, DAG->getTopRPTracker(), TopCand);
+ assert(TopResult != NoCand && "failed to find the first candidate");
+ (void)TopResult;
+ SU = TopCand.SU;
+ }
+ IsTopNode = true;
}
- IsTopNode = true;
- }
- else if (ForceBottomUp) {
- SU = Bot.pickOnlyChoice();
- if (!SU) {
- SchedCandidate BotCand;
- CandResult BotResult =
- pickNodeFromQueue(Bot.Available, DAG->getBotRPTracker(), BotCand);
- assert(BotResult != NoCand && "failed to find the first candidate");
- (void)BotResult;
- SU = BotCand.SU;
+ else if (ForceBottomUp) {
+ SU = Bot.pickOnlyChoice();
+ if (!SU) {
+ SchedCandidate BotCand;
+ CandResult BotResult =
+ pickNodeFromQueue(Bot.Available, DAG->getBotRPTracker(), BotCand);
+ assert(BotResult != NoCand && "failed to find the first candidate");
+ (void)BotResult;
+ SU = BotCand.SU;
+ }
+ IsTopNode = false;
}
- IsTopNode = false;
- }
- else {
- SU = pickNodeBidrectional(IsTopNode);
- }
+ else {
+ SU = pickNodeBidrectional(IsTopNode);
+ }
+ } while (SU->isScheduled);
+
if (SU->isTopReady())
Top.removeReady(SU);
if (SU->isBottomReady())
Modified: llvm/branches/R600/lib/CodeGen/MachineTraceMetrics.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/MachineTraceMetrics.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/MachineTraceMetrics.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/MachineTraceMetrics.cpp Thu Oct 11 16:28:00 2012
@@ -14,9 +14,10 @@
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
-#include "llvm/MC/MCInstrItineraries.h"
+#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetRegisterInfo.h"
+#include "llvm/Target/TargetSubtargetInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/PostOrderIterator.h"
@@ -50,9 +51,11 @@
MF = &Func;
TII = MF->getTarget().getInstrInfo();
TRI = MF->getTarget().getRegisterInfo();
- ItinData = MF->getTarget().getInstrItineraryData();
MRI = &MF->getRegInfo();
Loops = &getAnalysis<MachineLoopInfo>();
+ const TargetSubtargetInfo &ST =
+ MF->getTarget().getSubtarget<TargetSubtargetInfo>();
+ SchedModel.init(*ST.getSchedModel(), &ST, TII);
BlockInfo.resize(MF->getNumBlockIDs());
return false;
}
@@ -674,7 +677,7 @@
const MachineInstr *DefMI = MTM.MRI->getVRegDef(LIR.Reg);
// Ignore dependencies outside the current trace.
const TraceBlockInfo &DefTBI = BlockInfo[DefMI->getParent()->getNumber()];
- if (!DefTBI.hasValidDepth() || DefTBI.Head != TBI.Head)
+ if (!DefTBI.isEarlierInSameTrace(TBI))
continue;
unsigned Len = LIR.Height + Cycles[DefMI].Depth;
MaxLen = std::max(MaxLen, Len);
@@ -737,16 +740,15 @@
const TraceBlockInfo&DepTBI =
BlockInfo[Dep.DefMI->getParent()->getNumber()];
// Ignore dependencies from outside the current trace.
- if (!DepTBI.hasValidDepth() || DepTBI.Head != TBI.Head)
+ if (!DepTBI.isEarlierInSameTrace(TBI))
continue;
assert(DepTBI.HasValidInstrDepths && "Inconsistent dependency");
unsigned DepCycle = Cycles.lookup(Dep.DefMI).Depth;
// Add latency if DefMI is a real instruction. Transients get latency 0.
if (!Dep.DefMI->isTransient())
- DepCycle += MTM.TII->computeOperandLatency(MTM.ItinData,
- Dep.DefMI, Dep.DefOp,
- UseMI, Dep.UseOp,
- /* FindMin = */ false);
+ DepCycle += MTM.SchedModel
+ .computeOperandLatency(Dep.DefMI, Dep.DefOp, UseMI, Dep.UseOp,
+ /* FindMin = */ false);
Cycle = std::max(Cycle, DepCycle);
}
// Remember the instruction depth.
@@ -769,7 +771,7 @@
// Height is the issue height computed from virtual register dependencies alone.
static unsigned updatePhysDepsUpwards(const MachineInstr *MI, unsigned Height,
SparseSet<LiveRegUnit> &RegUnits,
- const InstrItineraryData *ItinData,
+ const TargetSchedModel &SchedModel,
const TargetInstrInfo *TII,
const TargetRegisterInfo *TRI) {
SmallVector<unsigned, 8> ReadOps;
@@ -792,14 +794,10 @@
unsigned DepHeight = I->Cycle;
if (!MI->isTransient()) {
// We may not know the UseMI of this dependency, if it came from the
- // live-in list.
- if (I->MI)
- DepHeight += TII->computeOperandLatency(ItinData,
- MI, MO.getOperandNo(),
- I->MI, I->Op);
- else
- // No UseMI. Just use the MI latency instead.
- DepHeight += TII->getInstrLatency(ItinData, MI);
+ // live-in list. SchedModel can handle a NULL UseMI.
+ DepHeight += SchedModel
+ .computeOperandLatency(MI, MO.getOperandNo(), I->MI, I->Op,
+ /* FindMin = */ false);
}
Height = std::max(Height, DepHeight);
// This regunit is dead above MI.
@@ -832,12 +830,12 @@
static bool pushDepHeight(const DataDep &Dep,
const MachineInstr *UseMI, unsigned UseHeight,
MIHeightMap &Heights,
- const InstrItineraryData *ItinData,
+ const TargetSchedModel &SchedModel,
const TargetInstrInfo *TII) {
// Adjust height by Dep.DefMI latency.
if (!Dep.DefMI->isTransient())
- UseHeight += TII->computeOperandLatency(ItinData, Dep.DefMI, Dep.DefOp,
- UseMI, Dep.UseOp);
+ UseHeight += SchedModel.computeOperandLatency(Dep.DefMI, Dep.DefOp,
+ UseMI, Dep.UseOp, false);
// Update Heights[DefMI] to be the maximum height seen.
MIHeightMap::iterator I;
@@ -951,7 +949,7 @@
unsigned Height = TBI.Succ ? Cycles.lookup(PHI).Height : 0;
DEBUG(dbgs() << "pred\t" << Height << '\t' << *PHI);
if (pushDepHeight(Deps.front(), PHI, Height,
- Heights, MTM.ItinData, MTM.TII))
+ Heights, MTM.SchedModel, MTM.TII))
addLiveIns(Deps.front().DefMI, Stack);
}
}
@@ -980,11 +978,11 @@
// There may also be regunit dependencies to include in the height.
if (HasPhysRegs)
Cycle = updatePhysDepsUpwards(MI, Cycle, RegUnits,
- MTM.ItinData, MTM.TII, MTM.TRI);
+ MTM.SchedModel, MTM.TII, MTM.TRI);
// Update the required height of any virtual registers read by MI.
for (unsigned i = 0, e = Deps.size(); i != e; ++i)
- if (pushDepHeight(Deps[i], MI, Cycle, Heights, MTM.ItinData, MTM.TII))
+ if (pushDepHeight(Deps[i], MI, Cycle, Heights, MTM.SchedModel, MTM.TII))
addLiveIns(Deps[i].DefMI, Stack);
InstrCycles &MICycles = Cycles[MI];
@@ -1054,10 +1052,8 @@
unsigned DepCycle = getInstrCycles(Dep.DefMI).Depth;
// Add latency if DefMI is a real instruction. Transients get latency 0.
if (!Dep.DefMI->isTransient())
- DepCycle += TE.MTM.TII->computeOperandLatency(TE.MTM.ItinData,
- Dep.DefMI, Dep.DefOp,
- PHI, Dep.UseOp,
- /* FindMin = */ false);
+ DepCycle += TE.MTM.SchedModel
+ .computeOperandLatency(Dep.DefMI, Dep.DefOp, PHI, Dep.UseOp, false);
return DepCycle;
}
@@ -1068,9 +1064,8 @@
unsigned Instrs = TBI.InstrDepth;
if (Bottom)
Instrs += TE.MTM.BlockInfo[getBlockNum()].InstrCount;
- if (const MCSchedModel *Model = TE.MTM.ItinData->SchedModel)
- if (Model->IssueWidth != 0)
- return Instrs / Model->IssueWidth;
+ if (unsigned IW = TE.MTM.SchedModel.getIssueWidth())
+ Instrs /= IW;
// Assume issue width 1 without a schedule model.
return Instrs;
}
@@ -1080,9 +1075,8 @@
unsigned Instrs = TBI.InstrDepth + TBI.InstrHeight;
for (unsigned i = 0, e = Extrablocks.size(); i != e; ++i)
Instrs += TE.MTM.getResources(Extrablocks[i])->InstrCount;
- if (const MCSchedModel *Model = TE.MTM.ItinData->SchedModel)
- if (Model->IssueWidth != 0)
- return Instrs / Model->IssueWidth;
+ if (unsigned IW = TE.MTM.SchedModel.getIssueWidth())
+ Instrs /= IW;
// Assume issue width 1 without a schedule model.
return Instrs;
}
Modified: llvm/branches/R600/lib/CodeGen/MachineTraceMetrics.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/MachineTraceMetrics.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/MachineTraceMetrics.h (original)
+++ llvm/branches/R600/lib/CodeGen/MachineTraceMetrics.h Thu Oct 11 16:28:00 2012
@@ -50,6 +50,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/CodeGen/TargetSchedule.h"
namespace llvm {
@@ -67,9 +68,9 @@
const MachineFunction *MF;
const TargetInstrInfo *TII;
const TargetRegisterInfo *TRI;
- const InstrItineraryData *ItinData;
const MachineRegisterInfo *MRI;
const MachineLoopInfo *Loops;
+ TargetSchedModel SchedModel;
public:
class Ensemble;
@@ -164,6 +165,14 @@
/// Invalidate height resources when a block below this one has changed.
void invalidateHeight() { InstrHeight = ~0u; HasValidInstrHeights = false; }
+ /// Determine if this block belongs to the same trace as TBI and comes
+ /// before it in the trace.
+ /// Also returns true when TBI == this.
+ bool isEarlierInSameTrace(const TraceBlockInfo &TBI) const {
+ return hasValidDepth() && TBI.hasValidDepth() &&
+ Head == TBI.Head && InstrDepth <= TBI.InstrDepth;
+ }
+
// Data-dependency-related information. Per-instruction depth and height
// are computed from data dependencies in the current trace, using
// itinerary data.
Modified: llvm/branches/R600/lib/CodeGen/Passes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/Passes.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/Passes.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/Passes.cpp Thu Oct 11 16:28:00 2012
@@ -49,8 +49,8 @@
cl::desc("Disable Stack Slot Coloring"));
static cl::opt<bool> DisableMachineDCE("disable-machine-dce", cl::Hidden,
cl::desc("Disable Machine Dead Code Elimination"));
-static cl::opt<bool> EnableEarlyIfConversion("enable-early-ifcvt", cl::Hidden,
- cl::desc("Enable Early If-conversion"));
+static cl::opt<bool> DisableEarlyIfConversion("disable-early-ifcvt", cl::Hidden,
+ cl::desc("Disable Early If-conversion"));
static cl::opt<bool> DisableMachineLICM("disable-machine-licm", cl::Hidden,
cl::desc("Disable Machine LICM"));
static cl::opt<bool> DisableMachineCSE("disable-machine-cse", cl::Hidden,
@@ -161,7 +161,7 @@
return applyDisable(TargetID, DisableMachineDCE);
if (StandardID == &EarlyIfConverterID)
- return applyDisable(TargetID, !EnableEarlyIfConversion);
+ return applyDisable(TargetID, DisableEarlyIfConversion);
if (StandardID == &MachineLICMID)
return applyDisable(TargetID, DisableMachineLICM);
Modified: llvm/branches/R600/lib/CodeGen/PrologEpilogInserter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/PrologEpilogInserter.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/PrologEpilogInserter.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/PrologEpilogInserter.cpp Thu Oct 11 16:28:00 2012
@@ -96,7 +96,7 @@
placeCSRSpillsAndRestores(Fn);
// Add the code to save and restore the callee saved registers
- if (!F->getFnAttributes().hasNakedAttr())
+ if (!F->getFnAttributes().hasAttribute(Attributes::Naked))
insertCSRSpillsAndRestores(Fn);
// Allow the target machine to make final modifications to the function
@@ -111,7 +111,7 @@
// called functions. Because of this, calculateCalleeSavedRegisters()
// must be called before this function in order to set the AdjustsStack
// and MaxCallFrameSize variables.
- if (!F->getFnAttributes().hasNakedAttr())
+ if (!F->getFnAttributes().hasAttribute(Attributes::Naked))
insertPrologEpilogCode(Fn);
// Replace all MO_FrameIndex operands with physical register references
@@ -221,7 +221,7 @@
return;
// In Naked functions we aren't going to save any registers.
- if (Fn.getFunction()->getFnAttributes().hasNakedAttr())
+ if (Fn.getFunction()->getFnAttributes().hasAttribute(Attributes::Naked))
return;
std::vector<CalleeSavedInfo> CSI;
Modified: llvm/branches/R600/lib/CodeGen/RegAllocPBQP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/RegAllocPBQP.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/RegAllocPBQP.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/RegAllocPBQP.cpp Thu Oct 11 16:28:00 2012
@@ -218,7 +218,7 @@
LiveInterval *vregLI = &LIS->getInterval(vreg);
// Record any overlaps with regmask operands.
- BitVector regMaskOverlaps(tri->getNumRegs());
+ BitVector regMaskOverlaps;
LIS->checkRegMaskInterference(*vregLI, regMaskOverlaps);
// Compute an initial allowed set for the current vreg.
@@ -432,6 +432,7 @@
au.addRequired<SlotIndexes>();
au.addPreserved<SlotIndexes>();
au.addRequired<LiveIntervals>();
+ au.addPreserved<LiveIntervals>();
//au.addRequiredID(SplitCriticalEdgesID);
if (customPassID)
au.addRequiredID(*customPassID);
@@ -443,6 +444,7 @@
au.addRequired<MachineLoopInfo>();
au.addPreserved<MachineLoopInfo>();
au.addRequired<VirtRegMap>();
+ au.addPreserved<VirtRegMap>();
MachineFunctionPass::getAnalysisUsage(au);
}
Modified: llvm/branches/R600/lib/CodeGen/RegisterCoalescer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/RegisterCoalescer.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/RegisterCoalescer.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/RegisterCoalescer.cpp Thu Oct 11 16:28:00 2012
@@ -68,11 +68,6 @@
cl::desc("Verify machine instrs before and after register coalescing"),
cl::Hidden);
-// Temporary option for testing new coalescer algo.
-static cl::opt<bool>
-NewCoalescer("new-coalescer", cl::Hidden, cl::init(true),
- cl::desc("Use new coalescer algorithm"));
-
namespace {
class RegisterCoalescer : public MachineFunctionPass,
private LiveRangeEdit::Delegate {
@@ -1733,11 +1728,15 @@
// This value takes precedence over the value in Other.LI.
LIS->pruneValue(&Other.LI, Def, &EndPoints);
// Remove <def,read-undef> flags. This def is now a partial redef.
- if (!Def.isBlock())
+ if (!Def.isBlock()) {
for (MIOperands MO(Indexes->getInstructionFromIndex(Def));
MO.isValid(); ++MO)
if (MO->isReg() && MO->isDef() && MO->getReg() == LI.reg)
MO->setIsUndef(false);
+ // This value will reach instructions below, but we need to make sure
+ // the live range also reaches the instruction at Def.
+ EndPoints.push_back(Def);
+ }
DEBUG(dbgs() << "\t\tpruned " << PrintReg(Other.LI.reg) << " at " << Def
<< ": " << Other.LI << '\n');
break;
@@ -1840,348 +1839,10 @@
return true;
}
-/// ComputeUltimateVN - Assuming we are going to join two live intervals,
-/// compute what the resultant value numbers for each value in the input two
-/// ranges will be. This is complicated by copies between the two which can
-/// and will commonly cause multiple value numbers to be merged into one.
-///
-/// VN is the value number that we're trying to resolve. InstDefiningValue
-/// keeps track of the new InstDefiningValue assignment for the result
-/// LiveInterval. ThisFromOther/OtherFromThis are sets that keep track of
-/// whether a value in this or other is a copy from the opposite set.
-/// ThisValNoAssignments/OtherValNoAssignments keep track of value #'s that have
-/// already been assigned.
-///
-/// ThisFromOther[x] - If x is defined as a copy from the other interval, this
-/// contains the value number the copy is from.
-///
-static unsigned ComputeUltimateVN(VNInfo *VNI,
- SmallVector<VNInfo*, 16> &NewVNInfo,
- DenseMap<VNInfo*, VNInfo*> &ThisFromOther,
- DenseMap<VNInfo*, VNInfo*> &OtherFromThis,
- SmallVector<int, 16> &ThisValNoAssignments,
- SmallVector<int, 16> &OtherValNoAssignments) {
- unsigned VN = VNI->id;
-
- // If the VN has already been computed, just return it.
- if (ThisValNoAssignments[VN] >= 0)
- return ThisValNoAssignments[VN];
- assert(ThisValNoAssignments[VN] != -2 && "Cyclic value numbers");
-
- // If this val is not a copy from the other val, then it must be a new value
- // number in the destination.
- DenseMap<VNInfo*, VNInfo*>::iterator I = ThisFromOther.find(VNI);
- if (I == ThisFromOther.end()) {
- NewVNInfo.push_back(VNI);
- return ThisValNoAssignments[VN] = NewVNInfo.size()-1;
- }
- VNInfo *OtherValNo = I->second;
-
- // Otherwise, this *is* a copy from the RHS. If the other side has already
- // been computed, return it.
- if (OtherValNoAssignments[OtherValNo->id] >= 0)
- return ThisValNoAssignments[VN] = OtherValNoAssignments[OtherValNo->id];
-
- // Mark this value number as currently being computed, then ask what the
- // ultimate value # of the other value is.
- ThisValNoAssignments[VN] = -2;
- unsigned UltimateVN =
- ComputeUltimateVN(OtherValNo, NewVNInfo, OtherFromThis, ThisFromOther,
- OtherValNoAssignments, ThisValNoAssignments);
- return ThisValNoAssignments[VN] = UltimateVN;
-}
-
-
-// Find out if we have something like
-// A = X
-// B = X
-// if so, we can pretend this is actually
-// A = X
-// B = A
-// which allows us to coalesce A and B.
-// VNI is the definition of B. LR is the life range of A that includes
-// the slot just before B. If we return true, we add "B = X" to DupCopies.
-// This implies that A dominates B.
-static bool RegistersDefinedFromSameValue(LiveIntervals &li,
- const TargetRegisterInfo &tri,
- CoalescerPair &CP,
- VNInfo *VNI,
- VNInfo *OtherVNI,
- SmallVector<MachineInstr*, 8> &DupCopies) {
- // FIXME: This is very conservative. For example, we don't handle
- // physical registers.
-
- MachineInstr *MI = li.getInstructionFromIndex(VNI->def);
-
- if (!MI || CP.isPartial() || CP.isPhys())
- return false;
-
- unsigned A = CP.getDstReg();
- if (!TargetRegisterInfo::isVirtualRegister(A))
- return false;
-
- unsigned B = CP.getSrcReg();
- if (!TargetRegisterInfo::isVirtualRegister(B))
- return false;
-
- MachineInstr *OtherMI = li.getInstructionFromIndex(OtherVNI->def);
- if (!OtherMI)
- return false;
-
- if (MI->isImplicitDef()) {
- DupCopies.push_back(MI);
- return true;
- } else {
- if (!MI->isFullCopy())
- return false;
- unsigned Src = MI->getOperand(1).getReg();
- if (!TargetRegisterInfo::isVirtualRegister(Src))
- return false;
- if (!OtherMI->isFullCopy())
- return false;
- unsigned OtherSrc = OtherMI->getOperand(1).getReg();
- if (!TargetRegisterInfo::isVirtualRegister(OtherSrc))
- return false;
-
- if (Src != OtherSrc)
- return false;
-
- // If the copies use two different value numbers of X, we cannot merge
- // A and B.
- LiveInterval &SrcInt = li.getInterval(Src);
- // getVNInfoBefore returns NULL for undef copies. In this case, the
- // optimization is still safe.
- if (SrcInt.getVNInfoBefore(OtherVNI->def) !=
- SrcInt.getVNInfoBefore(VNI->def))
- return false;
-
- DupCopies.push_back(MI);
- return true;
- }
-}
-
/// joinIntervals - Attempt to join these two intervals. On failure, this
/// returns false.
bool RegisterCoalescer::joinIntervals(CoalescerPair &CP) {
- // Handle physreg joins separately.
- if (CP.isPhys())
- return joinReservedPhysReg(CP);
-
- if (NewCoalescer)
- return joinVirtRegs(CP);
-
- LiveInterval &RHS = LIS->getInterval(CP.getSrcReg());
- DEBUG(dbgs() << "\t\tRHS = " << PrintReg(CP.getSrcReg()) << ' ' << RHS
- << '\n');
-
- // Compute the final value assignment, assuming that the live ranges can be
- // coalesced.
- SmallVector<int, 16> LHSValNoAssignments;
- SmallVector<int, 16> RHSValNoAssignments;
- DenseMap<VNInfo*, VNInfo*> LHSValsDefinedFromRHS;
- DenseMap<VNInfo*, VNInfo*> RHSValsDefinedFromLHS;
- SmallVector<VNInfo*, 16> NewVNInfo;
-
- SmallVector<MachineInstr*, 8> DupCopies;
- SmallVector<MachineInstr*, 8> DeadCopies;
-
- LiveInterval &LHS = LIS->getOrCreateInterval(CP.getDstReg());
- DEBUG(dbgs() << "\t\tLHS = " << PrintReg(CP.getDstReg(), TRI) << ' ' << LHS
- << '\n');
-
- // Loop over the value numbers of the LHS, seeing if any are defined from
- // the RHS.
- for (LiveInterval::vni_iterator i = LHS.vni_begin(), e = LHS.vni_end();
- i != e; ++i) {
- VNInfo *VNI = *i;
- if (VNI->isUnused() || VNI->isPHIDef())
- continue;
- MachineInstr *MI = LIS->getInstructionFromIndex(VNI->def);
- assert(MI && "Missing def");
- if (!MI->isCopyLike() && !MI->isImplicitDef()) // Src not defined by a copy?
- continue;
-
- // Figure out the value # from the RHS.
- VNInfo *OtherVNI = RHS.getVNInfoBefore(VNI->def);
- // The copy could be to an aliased physreg.
- if (!OtherVNI)
- continue;
-
- // DstReg is known to be a register in the LHS interval. If the src is
- // from the RHS interval, we can use its value #.
- if (CP.isCoalescable(MI))
- DeadCopies.push_back(MI);
- else if (!RegistersDefinedFromSameValue(*LIS, *TRI, CP, VNI, OtherVNI,
- DupCopies))
- continue;
-
- LHSValsDefinedFromRHS[VNI] = OtherVNI;
- }
-
- // Loop over the value numbers of the RHS, seeing if any are defined from
- // the LHS.
- for (LiveInterval::vni_iterator i = RHS.vni_begin(), e = RHS.vni_end();
- i != e; ++i) {
- VNInfo *VNI = *i;
- if (VNI->isUnused() || VNI->isPHIDef())
- continue;
- MachineInstr *MI = LIS->getInstructionFromIndex(VNI->def);
- assert(MI && "Missing def");
- if (!MI->isCopyLike() && !MI->isImplicitDef()) // Src not defined by a copy?
- continue;
-
- // Figure out the value # from the LHS.
- VNInfo *OtherVNI = LHS.getVNInfoBefore(VNI->def);
- // The copy could be to an aliased physreg.
- if (!OtherVNI)
- continue;
-
- // DstReg is known to be a register in the RHS interval. If the src is
- // from the LHS interval, we can use its value #.
- if (CP.isCoalescable(MI))
- DeadCopies.push_back(MI);
- else if (!RegistersDefinedFromSameValue(*LIS, *TRI, CP, VNI, OtherVNI,
- DupCopies))
- continue;
-
- RHSValsDefinedFromLHS[VNI] = OtherVNI;
- }
-
- LHSValNoAssignments.resize(LHS.getNumValNums(), -1);
- RHSValNoAssignments.resize(RHS.getNumValNums(), -1);
- NewVNInfo.reserve(LHS.getNumValNums() + RHS.getNumValNums());
-
- for (LiveInterval::vni_iterator i = LHS.vni_begin(), e = LHS.vni_end();
- i != e; ++i) {
- VNInfo *VNI = *i;
- unsigned VN = VNI->id;
- if (LHSValNoAssignments[VN] >= 0 || VNI->isUnused())
- continue;
- ComputeUltimateVN(VNI, NewVNInfo,
- LHSValsDefinedFromRHS, RHSValsDefinedFromLHS,
- LHSValNoAssignments, RHSValNoAssignments);
- }
- for (LiveInterval::vni_iterator i = RHS.vni_begin(), e = RHS.vni_end();
- i != e; ++i) {
- VNInfo *VNI = *i;
- unsigned VN = VNI->id;
- if (RHSValNoAssignments[VN] >= 0 || VNI->isUnused())
- continue;
- // If this value number isn't a copy from the LHS, it's a new number.
- if (RHSValsDefinedFromLHS.find(VNI) == RHSValsDefinedFromLHS.end()) {
- NewVNInfo.push_back(VNI);
- RHSValNoAssignments[VN] = NewVNInfo.size()-1;
- continue;
- }
-
- ComputeUltimateVN(VNI, NewVNInfo,
- RHSValsDefinedFromLHS, LHSValsDefinedFromRHS,
- RHSValNoAssignments, LHSValNoAssignments);
- }
-
- // Armed with the mappings of LHS/RHS values to ultimate values, walk the
- // interval lists to see if these intervals are coalescable.
- LiveInterval::const_iterator I = LHS.begin();
- LiveInterval::const_iterator IE = LHS.end();
- LiveInterval::const_iterator J = RHS.begin();
- LiveInterval::const_iterator JE = RHS.end();
-
- // Collect interval end points that will no longer be kills.
- SmallVector<MachineInstr*, 8> LHSOldKills;
- SmallVector<MachineInstr*, 8> RHSOldKills;
-
- // Skip ahead until the first place of potential sharing.
- if (I != IE && J != JE) {
- if (I->start < J->start) {
- I = std::upper_bound(I, IE, J->start);
- if (I != LHS.begin()) --I;
- } else if (J->start < I->start) {
- J = std::upper_bound(J, JE, I->start);
- if (J != RHS.begin()) --J;
- }
- }
-
- while (I != IE && J != JE) {
- // Determine if these two live ranges overlap.
- // If so, check value # info to determine if they are really different.
- if (I->end > J->start && J->end > I->start) {
- // If the live range overlap will map to the same value number in the
- // result liverange, we can still coalesce them. If not, we can't.
- if (LHSValNoAssignments[I->valno->id] !=
- RHSValNoAssignments[J->valno->id])
- return false;
-
- // Extended live ranges should no longer be killed.
- if (!I->end.isBlock() && I->end < J->end)
- if (MachineInstr *MI = LIS->getInstructionFromIndex(I->end))
- LHSOldKills.push_back(MI);
- if (!J->end.isBlock() && J->end < I->end)
- if (MachineInstr *MI = LIS->getInstructionFromIndex(J->end))
- RHSOldKills.push_back(MI);
- }
-
- if (I->end < J->end)
- ++I;
- else
- ++J;
- }
-
- // Clear kill flags where live ranges are extended.
- while (!LHSOldKills.empty())
- LHSOldKills.pop_back_val()->clearRegisterKills(LHS.reg, TRI);
- while (!RHSOldKills.empty())
- RHSOldKills.pop_back_val()->clearRegisterKills(RHS.reg, TRI);
-
- if (LHSValNoAssignments.empty())
- LHSValNoAssignments.push_back(-1);
- if (RHSValNoAssignments.empty())
- RHSValNoAssignments.push_back(-1);
-
- // Now erase all the redundant copies.
- for (unsigned i = 0, e = DeadCopies.size(); i != e; ++i) {
- MachineInstr *MI = DeadCopies[i];
- if (!ErasedInstrs.insert(MI))
- continue;
- DEBUG(dbgs() << "\t\terased:\t" << LIS->getInstructionIndex(MI)
- << '\t' << *MI);
- LIS->RemoveMachineInstrFromMaps(MI);
- MI->eraseFromParent();
- }
-
- SmallVector<unsigned, 8> SourceRegisters;
- for (SmallVector<MachineInstr*, 8>::iterator I = DupCopies.begin(),
- E = DupCopies.end(); I != E; ++I) {
- MachineInstr *MI = *I;
- if (!ErasedInstrs.insert(MI))
- continue;
-
- // If MI is a copy, then we have pretended that the assignment to B in
- // A = X
- // B = X
- // was actually a copy from A. Now that we decided to coalesce A and B,
- // transform the code into
- // A = X
- // In the case of the implicit_def, we just have to remove it.
- if (!MI->isImplicitDef()) {
- unsigned Src = MI->getOperand(1).getReg();
- SourceRegisters.push_back(Src);
- }
- LIS->RemoveMachineInstrFromMaps(MI);
- MI->eraseFromParent();
- }
-
- // If B = X was the last use of X in a liverange, we have to shrink it now
- // that B = X is gone.
- for (SmallVector<unsigned, 8>::iterator I = SourceRegisters.begin(),
- E = SourceRegisters.end(); I != E; ++I) {
- LIS->shrinkToUses(&LIS->getInterval(*I));
- }
-
- // If we get here, we know that we can coalesce the live ranges. Ask the
- // intervals to coalesce themselves now.
- LHS.join(RHS, &LHSValNoAssignments[0], &RHSValNoAssignments[0], NewVNInfo,
- MRI);
- return true;
+ return CP.isPhys() ? joinReservedPhysReg(CP) : joinVirtRegs(CP);
}
namespace {
Modified: llvm/branches/R600/lib/CodeGen/ScheduleDAGInstrs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/ScheduleDAGInstrs.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/ScheduleDAGInstrs.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/ScheduleDAGInstrs.cpp Thu Oct 11 16:28:00 2012
@@ -44,10 +44,8 @@
const MachineDominatorTree &mdt,
bool IsPostRAFlag,
LiveIntervals *lis)
- : ScheduleDAG(mf), MLI(mli), MDT(mdt), MFI(mf.getFrameInfo()),
- InstrItins(mf.getTarget().getInstrItineraryData()), LIS(lis),
- IsPostRA(IsPostRAFlag), UnitLatencies(false), CanHandleTerminators(false),
- LoopRegs(MDT), FirstDbgValue(0) {
+ : ScheduleDAG(mf), MLI(mli), MDT(mdt), MFI(mf.getFrameInfo()), LIS(lis),
+ IsPostRA(IsPostRAFlag), CanHandleTerminators(false), FirstDbgValue(0) {
assert((IsPostRA || LIS) && "PreRA scheduling requires LiveIntervals");
DbgValues.clear();
assert(!(IsPostRA && MRI.getNumVirtRegs()) &&
@@ -138,10 +136,6 @@
void ScheduleDAGInstrs::startBlock(MachineBasicBlock *bb) {
BB = bb;
- LoopRegs.Deps.clear();
- if (MachineLoop *ML = MLI.getLoopFor(BB))
- if (BB == ML->getLoopLatch())
- LoopRegs.VisitLoop(ML);
}
void ScheduleDAGInstrs::finishBlock() {
@@ -177,9 +171,6 @@
EndIndex = endcount;
MISUnitMap.clear();
- // Check to see if the scheduler cares about latencies.
- UnitLatencies = forceUnitLatencies();
-
ScheduleDAG::clearDAG();
}
@@ -241,8 +232,6 @@
// Ask the target if address-backscheduling is desirable, and if so how much.
const TargetSubtargetInfo &ST = TM.getSubtarget<TargetSubtargetInfo>();
- unsigned SpecialAddressLatency = ST.getSpecialAddressLatency();
- unsigned DataLatency = SU->Latency;
for (MCRegAliasIterator Alias(MO.getReg(), TRI, true);
Alias.isValid(); ++Alias) {
@@ -253,40 +242,21 @@
SUnit *UseSU = UseList[i].SU;
if (UseSU == SU)
continue;
- MachineInstr *UseMI = UseSU->getInstr();
+
+ SDep dep(SU, SDep::Data, 1, *Alias);
+
+ // Adjust the dependence latency using operand def/use information,
+ // then allow the target to perform its own adjustments.
int UseOp = UseList[i].OpIdx;
- unsigned LDataLatency = DataLatency;
- // Optionally add in a special extra latency for nodes that
- // feed addresses.
- // TODO: Perhaps we should get rid of
- // SpecialAddressLatency and just move this into
- // adjustSchedDependency for the targets that care about it.
- if (SpecialAddressLatency != 0 && !UnitLatencies &&
- UseSU != &ExitSU) {
- const MCInstrDesc &UseMCID = UseMI->getDesc();
- int RegUseIndex = UseMI->findRegisterUseOperandIdx(*Alias);
- assert(RegUseIndex >= 0 && "UseMI doesn't use register!");
- if (RegUseIndex >= 0 &&
- (UseMI->mayLoad() || UseMI->mayStore()) &&
- (unsigned)RegUseIndex < UseMCID.getNumOperands() &&
- UseMCID.OpInfo[RegUseIndex].isLookupPtrRegClass())
- LDataLatency += SpecialAddressLatency;
- }
- // Adjust the dependence latency using operand def/use
- // information (if any), and then allow the target to
- // perform its own adjustments.
- SDep dep(SU, SDep::Data, LDataLatency, *Alias);
- if (!UnitLatencies) {
- MachineInstr *RegUse = UseOp < 0 ? 0 : UseMI;
- dep.setLatency(
- SchedModel.computeOperandLatency(SU->getInstr(), OperIdx,
- RegUse, UseOp, /*FindMin=*/false));
- dep.setMinLatency(
- SchedModel.computeOperandLatency(SU->getInstr(), OperIdx,
- RegUse, UseOp, /*FindMin=*/true));
+ MachineInstr *RegUse = UseOp < 0 ? 0 : UseSU->getInstr();
+ dep.setLatency(
+ SchedModel.computeOperandLatency(SU->getInstr(), OperIdx,
+ RegUse, UseOp, /*FindMin=*/false));
+ dep.setMinLatency(
+ SchedModel.computeOperandLatency(SU->getInstr(), OperIdx,
+ RegUse, UseOp, /*FindMin=*/true));
- ST.adjustSchedDependency(SU, UseSU, dep);
- }
+ ST.adjustSchedDependency(SU, UseSU, dep);
UseSU->addPred(dep);
}
}
@@ -321,8 +291,8 @@
if (Kind == SDep::Anti)
DefSU->addPred(SDep(SU, Kind, 0, /*Reg=*/*Alias));
else {
- unsigned AOLat = TII->getOutputLatency(InstrItins, MI, OperIdx,
- DefSU->getInstr());
+ unsigned AOLat =
+ SchedModel.computeOutputLatency(MI, OperIdx, DefSU->getInstr());
DefSU->addPred(SDep(SU, Kind, AOLat, /*Reg=*/*Alias));
}
}
@@ -342,53 +312,6 @@
// retrieve the existing SUnits list for this register's defs.
std::vector<PhysRegSUOper> &DefList = Defs[MO.getReg()];
- // If a def is going to wrap back around to the top of the loop,
- // backschedule it.
- if (!UnitLatencies && DefList.empty()) {
- LoopDependencies::LoopDeps::iterator I = LoopRegs.Deps.find(MO.getReg());
- if (I != LoopRegs.Deps.end()) {
- const MachineOperand *UseMO = I->second.first;
- unsigned Count = I->second.second;
- const MachineInstr *UseMI = UseMO->getParent();
- unsigned UseMOIdx = UseMO - &UseMI->getOperand(0);
- const MCInstrDesc &UseMCID = UseMI->getDesc();
- const TargetSubtargetInfo &ST =
- TM.getSubtarget<TargetSubtargetInfo>();
- unsigned SpecialAddressLatency = ST.getSpecialAddressLatency();
- // TODO: If we knew the total depth of the region here, we could
- // handle the case where the whole loop is inside the region but
- // is large enough that the isScheduleHigh trick isn't needed.
- if (UseMOIdx < UseMCID.getNumOperands()) {
- // Currently, we only support scheduling regions consisting of
- // single basic blocks. Check to see if the instruction is in
- // the same region by checking to see if it has the same parent.
- if (UseMI->getParent() != MI->getParent()) {
- unsigned Latency = SU->Latency;
- if (UseMCID.OpInfo[UseMOIdx].isLookupPtrRegClass())
- Latency += SpecialAddressLatency;
- // This is a wild guess as to the portion of the latency which
- // will be overlapped by work done outside the current
- // scheduling region.
- Latency -= std::min(Latency, Count);
- // Add the artificial edge.
- ExitSU.addPred(SDep(SU, SDep::Order, Latency,
- /*Reg=*/0, /*isNormalMemory=*/false,
- /*isMustAlias=*/false,
- /*isArtificial=*/true));
- } else if (SpecialAddressLatency > 0 &&
- UseMCID.OpInfo[UseMOIdx].isLookupPtrRegClass()) {
- // The entire loop body is within the current scheduling region
- // and the latency of this operation is assumed to be greater
- // than the latency of the loop.
- // TODO: Recursively mark data-edge predecessors as
- // isScheduleHigh too.
- SU->isScheduleHigh = true;
- }
- }
- LoopRegs.Deps.erase(I);
- }
- }
-
// clear this register's use list
if (Uses.contains(MO.getReg()))
Uses[MO.getReg()].clear();
@@ -439,8 +362,8 @@
else {
SUnit *DefSU = DefI->SU;
if (DefSU != SU && DefSU != &ExitSU) {
- unsigned OutLatency = TII->getOutputLatency(InstrItins, MI, OperIdx,
- DefSU->getInstr());
+ unsigned OutLatency =
+ SchedModel.computeOutputLatency(MI, OperIdx, DefSU->getInstr());
DefSU->addPred(SDep(SU, SDep::Output, OutLatency, Reg));
}
DefI->SU = SU;
@@ -471,21 +394,17 @@
if (DefSU) {
// The reaching Def lives within this scheduling region.
// Create a data dependence.
- //
- // TODO: Handle "special" address latencies cleanly.
- SDep dep(DefSU, SDep::Data, DefSU->Latency, Reg);
- if (!UnitLatencies) {
- // Adjust the dependence latency using operand def/use information, then
- // allow the target to perform its own adjustments.
- int DefOp = Def->findRegisterDefOperandIdx(Reg);
- dep.setLatency(
- SchedModel.computeOperandLatency(Def, DefOp, MI, OperIdx, false));
- dep.setMinLatency(
- SchedModel.computeOperandLatency(Def, DefOp, MI, OperIdx, true));
+ SDep dep(DefSU, SDep::Data, 1, Reg);
+ // Adjust the dependence latency using operand def/use information, then
+ // allow the target to perform its own adjustments.
+ int DefOp = Def->findRegisterDefOperandIdx(Reg);
+ dep.setLatency(
+ SchedModel.computeOperandLatency(Def, DefOp, MI, OperIdx, false));
+ dep.setMinLatency(
+ SchedModel.computeOperandLatency(Def, DefOp, MI, OperIdx, true));
- const TargetSubtargetInfo &ST = TM.getSubtarget<TargetSubtargetInfo>();
- ST.adjustSchedDependency(DefSU, SU, const_cast<SDep &>(dep));
- }
+ const TargetSubtargetInfo &ST = TM.getSubtarget<TargetSubtargetInfo>();
+ ST.adjustSchedDependency(DefSU, SU, const_cast<SDep &>(dep));
SU->addPred(dep);
}
}
@@ -730,10 +649,7 @@
SU->isCommutable = MI->isCommutable();
// Assign the Latency field of SU using target-provided information.
- if (UnitLatencies)
- SU->Latency = 1;
- else
- computeLatency(SU);
+ SU->Latency = SchedModel.computeInstrLatency(SU->getInstr());
}
}
@@ -994,21 +910,6 @@
PendingLoads.clear();
}
-void ScheduleDAGInstrs::computeLatency(SUnit *SU) {
- // Compute the latency for the node. We only provide a default for missing
- // itineraries. Empty itineraries still have latency properties.
- if (!InstrItins) {
- SU->Latency = 1;
-
- // Simplistic target-independent heuristic: assume that loads take
- // extra time.
- if (SU->getInstr()->mayLoad())
- SU->Latency += 2;
- } else {
- SU->Latency = TII->getInstrLatency(InstrItins, SU->getInstr());
- }
-}
-
void ScheduleDAGInstrs::dumpNode(const SUnit *SU) const {
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
SU->getInstr()->dump();
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Oct 11 16:28:00 2012
@@ -23,7 +23,7 @@
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/Analysis/AliasAnalysis.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
@@ -301,6 +301,11 @@
/// looking for a better chain (aliasing node.)
SDValue FindBetterChain(SDNode *N, SDValue Chain);
+ /// Merge consecutive store operations into a wide store.
+ /// This optimization uses wide integers or vectors when possible.
+ /// \return True if some memory operations were changed.
+ bool MergeConsecutiveStores(StoreSDNode *N);
+
public:
DAGCombiner(SelectionDAG &D, AliasAnalysis &A, CodeGenOpt::Level OL)
: DAG(D), TLI(D.getTargetLoweringInfo()), Level(BeforeLegalizeTypes),
@@ -5340,7 +5345,7 @@
!LD2->isVolatile() &&
DAG.isConsecutiveLoad(LD2, LD1, LD1VT.getSizeInBits()/8, 1)) {
unsigned Align = LD1->getAlignment();
- unsigned NewAlign = TLI.getTargetData()->
+ unsigned NewAlign = TLI.getDataLayout()->
getABITypeAlignment(VT.getTypeForEVT(*DAG.getContext()));
if (NewAlign <= Align &&
@@ -5409,7 +5414,7 @@
!cast<LoadSDNode>(N0)->isVolatile() &&
(!LegalOperations || TLI.isOperationLegal(ISD::LOAD, VT))) {
LoadSDNode *LN0 = cast<LoadSDNode>(N0);
- unsigned Align = TLI.getTargetData()->
+ unsigned Align = TLI.getDataLayout()->
getABITypeAlignment(VT.getTypeForEVT(*DAG.getContext()));
unsigned OrigAlign = LN0->getAlignment();
@@ -6709,7 +6714,7 @@
} else
return false;
- TargetLowering::AddrMode AM;
+ AddrMode AM;
if (N->getOpcode() == ISD::ADD) {
ConstantSDNode *Offset = dyn_cast<ConstantSDNode>(N->getOperand(1));
if (Offset)
@@ -7336,7 +7341,7 @@
unsigned NewAlign = MinAlign(LD->getAlignment(), PtrOff);
Type *NewVTTy = NewVT.getTypeForEVT(*DAG.getContext());
- if (NewAlign < TLI.getTargetData()->getABITypeAlignment(NewVTTy))
+ if (NewAlign < TLI.getDataLayout()->getABITypeAlignment(NewVTTy))
return SDValue();
SDValue NewPtr = DAG.getNode(ISD::ADD, LD->getDebugLoc(),
@@ -7398,7 +7403,7 @@
unsigned LDAlign = LD->getAlignment();
unsigned STAlign = ST->getAlignment();
Type *IntVTTy = IntVT.getTypeForEVT(*DAG.getContext());
- unsigned ABIAlign = TLI.getTargetData()->getABITypeAlignment(IntVTTy);
+ unsigned ABIAlign = TLI.getDataLayout()->getABITypeAlignment(IntVTTy);
if (LDAlign < ABIAlign || STAlign < ABIAlign)
return SDValue();
@@ -7423,6 +7428,422 @@
return SDValue();
}
+/// Returns the base pointer and an integer offset from that object.
+static std::pair<SDValue, int64_t> GetPointerBaseAndOffset(SDValue Ptr) {
+ if (Ptr->getOpcode() == ISD::ADD && isa<ConstantSDNode>(Ptr->getOperand(1))) {
+ int64_t Offset = cast<ConstantSDNode>(Ptr->getOperand(1))->getSExtValue();
+ SDValue Base = Ptr->getOperand(0);
+ return std::make_pair(Base, Offset);
+ }
+
+ return std::make_pair(Ptr, 0);
+}
+
+/// Holds a pointer to an LSBaseSDNode as well as information on where it
+/// is located in a sequence of memory operations connected by a chain.
+struct MemOpLink {
+ MemOpLink (LSBaseSDNode *N, int64_t Offset, unsigned Seq):
+ MemNode(N), OffsetFromBase(Offset), SequenceNum(Seq) { }
+ // Ptr to the mem node.
+ LSBaseSDNode *MemNode;
+ // Offset from the base ptr.
+ int64_t OffsetFromBase;
+ // What is the sequence number of this mem node.
+ // Lowest mem operand in the DAG starts at zero.
+ unsigned SequenceNum;
+};
+
+/// Sorts store nodes in a link according to their offset from a shared
+// base ptr.
+struct ConsecutiveMemoryChainSorter {
+ bool operator()(MemOpLink LHS, MemOpLink RHS) {
+ return LHS.OffsetFromBase < RHS.OffsetFromBase;
+ }
+};
+
+bool DAGCombiner::MergeConsecutiveStores(StoreSDNode* St) {
+ EVT MemVT = St->getMemoryVT();
+ int64_t ElementSizeBytes = MemVT.getSizeInBits()/8;
+
+ // Don't merge vectors into wider inputs.
+ if (MemVT.isVector() || !MemVT.isSimple())
+ return false;
+
+ // Perform an early exit check. Do not bother looking at stored values that
+ // are not constants or loads.
+ SDValue StoredVal = St->getValue();
+ bool IsLoadSrc = isa<LoadSDNode>(StoredVal);
+ if (!isa<ConstantSDNode>(StoredVal) && !isa<ConstantFPSDNode>(StoredVal) &&
+ !IsLoadSrc)
+ return false;
+
+ // Only look at ends of store sequences.
+ SDValue Chain = SDValue(St, 1);
+ if (Chain->hasOneUse() && Chain->use_begin()->getOpcode() == ISD::STORE)
+ return false;
+
+ // This holds the base pointer and the offset in bytes from the base pointer.
+ std::pair<SDValue, int64_t> BasePtr =
+ GetPointerBaseAndOffset(St->getBasePtr());
+
+ // We must have a base and an offset.
+ if (!BasePtr.first.getNode())
+ return false;
+
+ // Do not handle stores to undef base pointers.
+ if (BasePtr.first.getOpcode() == ISD::UNDEF)
+ return false;
+
+ SmallVector<MemOpLink, 8> StoreNodes;
+ // Walk up the chain and look for nodes with offsets from the same
+ // base pointer. Stop when reaching an instruction with a different kind
+ // or instruction which has a different base pointer.
+ unsigned Seq = 0;
+ StoreSDNode *Index = St;
+ while (Index) {
+ // If the chain has more than one use, then we can't reorder the mem ops.
+ if (Index != St && !SDValue(Index, 1)->hasOneUse())
+ break;
+
+ // Find the base pointer and offset for this memory node.
+ std::pair<SDValue, int64_t> Ptr =
+ GetPointerBaseAndOffset(Index->getBasePtr());
+
+ // Check that the base pointer is the same as the original one.
+ if (Ptr.first.getNode() != BasePtr.first.getNode())
+ break;
+
+ // Check that the alignment is the same.
+ if (Index->getAlignment() != St->getAlignment())
+ break;
+
+ // The memory operands must not be volatile.
+ if (Index->isVolatile() || Index->isIndexed())
+ break;
+
+ // No truncation.
+ if (StoreSDNode *St = dyn_cast<StoreSDNode>(Index))
+ if (St->isTruncatingStore())
+ break;
+
+ // The stored memory type must be the same.
+ if (Index->getMemoryVT() != MemVT)
+ break;
+
+ // We do not allow unaligned stores because we want to prevent overriding
+ // stores.
+ if (Index->getAlignment()*8 != MemVT.getSizeInBits())
+ break;
+
+ // We found a potential memory operand to merge.
+ StoreNodes.push_back(MemOpLink(Index, Ptr.second, Seq++));
+
+ // Move up the chain to the next memory operation.
+ Index = dyn_cast<StoreSDNode>(Index->getChain().getNode());
+ }
+
+ // Check if there is anything to merge.
+ if (StoreNodes.size() < 2)
+ return false;
+
+ // Sort the memory operands according to their distance from the base pointer.
+ std::sort(StoreNodes.begin(), StoreNodes.end(),
+ ConsecutiveMemoryChainSorter());
+
+ // Scan the memory operations on the chain and find the first non-consecutive
+ // store memory address.
+ unsigned LastConsecutiveStore = 0;
+ int64_t StartAddress = StoreNodes[0].OffsetFromBase;
+ for (unsigned i=1; i<StoreNodes.size(); ++i) {
+ int64_t CurrAddress = StoreNodes[i].OffsetFromBase;
+ if (CurrAddress - StartAddress != (ElementSizeBytes * i))
+ break;
+
+ // Mark this node as useful.
+ LastConsecutiveStore = i;
+ }
+
+ // The node with the lowest store address.
+ LSBaseSDNode *FirstInChain = StoreNodes[0].MemNode;
+
+ // Store the constants into memory as one consecutive store.
+ if (!IsLoadSrc) {
+ unsigned LastLegalType = 0;
+ unsigned LastLegalVectorType = 0;
+ bool NonZero = false;
+ for (unsigned i=0; i<LastConsecutiveStore+1; ++i) {
+ StoreSDNode *St = cast<StoreSDNode>(StoreNodes[i].MemNode);
+ SDValue StoredVal = St->getValue();
+
+ if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(StoredVal)) {
+ NonZero |= !C->isNullValue();
+ } else if (ConstantFPSDNode *C = dyn_cast<ConstantFPSDNode>(StoredVal)) {
+ NonZero |= !C->getConstantFPValue()->isNullValue();
+ } else {
+ // Non constant.
+ break;
+ }
+
+ // Find a legal type for the constant store.
+ unsigned StoreBW = (i+1) * ElementSizeBytes * 8;
+ EVT StoreTy = EVT::getIntegerVT(*DAG.getContext(), StoreBW);
+ if (TLI.isTypeLegal(StoreTy))
+ LastLegalType = i+1;
+
+ // Find a legal type for the vector store.
+ EVT Ty = EVT::getVectorVT(*DAG.getContext(), MemVT, i+1);
+ if (TLI.isTypeLegal(Ty))
+ LastLegalVectorType = i + 1;
+ }
+
+ // We only use vectors if the constant is known to be zero.
+ if (NonZero)
+ LastLegalVectorType = 0;
+
+ // Check if we found a legal integer type to store.
+ if (LastLegalType == 0 && LastLegalVectorType == 0)
+ return false;
+
+ bool UseVector = LastLegalVectorType > LastLegalType;
+ unsigned NumElem = UseVector ? LastLegalVectorType : LastLegalType;
+
+ // Make sure we have something to merge.
+ if (NumElem < 2)
+ return false;
+
+ unsigned EarliestNodeUsed = 0;
+ for (unsigned i=0; i < NumElem; ++i) {
+ // Find a chain for the new wide-store operand. Notice that some
+ // of the store nodes that we found may not be selected for inclusion
+ // in the wide store. The chain we use needs to be the chain of the
+ // earliest store node which is *used* and replaced by the wide store.
+ if (StoreNodes[i].SequenceNum > StoreNodes[EarliestNodeUsed].SequenceNum)
+ EarliestNodeUsed = i;
+ }
+
+ // The earliest Node in the DAG.
+ LSBaseSDNode *EarliestOp = StoreNodes[EarliestNodeUsed].MemNode;
+ DebugLoc DL = StoreNodes[0].MemNode->getDebugLoc();
+
+ SDValue StoredVal;
+ if (UseVector) {
+ // Find a legal type for the vector store.
+ EVT Ty = EVT::getVectorVT(*DAG.getContext(), MemVT, NumElem);
+ assert(TLI.isTypeLegal(Ty) && "Illegal vector store");
+ StoredVal = DAG.getConstant(0, Ty);
+ } else {
+ unsigned StoreBW = NumElem * ElementSizeBytes * 8;
+ APInt StoreInt(StoreBW, 0);
+
+ // Construct a single integer constant which is made of the smaller
+ // constant inputs.
+ bool IsLE = TLI.isLittleEndian();
+ for (unsigned i = 0; i < NumElem ; ++i) {
+ unsigned Idx = IsLE ?(NumElem - 1 - i) : i;
+ StoreSDNode *St = cast<StoreSDNode>(StoreNodes[Idx].MemNode);
+ SDValue Val = St->getValue();
+ StoreInt<<=ElementSizeBytes*8;
+ if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Val)) {
+ StoreInt|=C->getAPIntValue().zext(StoreBW);
+ } else if (ConstantFPSDNode *C = dyn_cast<ConstantFPSDNode>(Val)) {
+ StoreInt|= C->getValueAPF().bitcastToAPInt().zext(StoreBW);
+ } else {
+ assert(false && "Invalid constant element type");
+ }
+ }
+
+ // Create the new Load and Store operations.
+ EVT StoreTy = EVT::getIntegerVT(*DAG.getContext(), StoreBW);
+ StoredVal = DAG.getConstant(StoreInt, StoreTy);
+ }
+
+ SDValue NewStore = DAG.getStore(EarliestOp->getChain(), DL, StoredVal,
+ FirstInChain->getBasePtr(),
+ FirstInChain->getPointerInfo(),
+ false, false,
+ FirstInChain->getAlignment());
+
+ // Replace the first store with the new store
+ CombineTo(EarliestOp, NewStore);
+ // Erase all other stores.
+ for (unsigned i = 0; i < NumElem ; ++i) {
+ if (StoreNodes[i].MemNode == EarliestOp)
+ continue;
+ StoreSDNode *St = cast<StoreSDNode>(StoreNodes[i].MemNode);
+ DAG.ReplaceAllUsesOfValueWith(SDValue(St, 0), St->getChain());
+ removeFromWorkList(St);
+ DAG.DeleteNode(St);
+ }
+
+ return true;
+ }
+
+ // Below we handle the case of multiple consecutive stores that
+ // come from multiple consecutive loads. We merge them into a single
+ // wide load and a single wide store.
+
+ // Look for load nodes which are used by the stored values.
+ SmallVector<MemOpLink, 8> LoadNodes;
+
+ // Find acceptable loads. Loads need to have the same chain (token factor),
+ // must not be zext, volatile, indexed, and they must be consecutive.
+ SDValue LdBasePtr;
+ for (unsigned i=0; i<LastConsecutiveStore+1; ++i) {
+ StoreSDNode *St = cast<StoreSDNode>(StoreNodes[i].MemNode);
+ LoadSDNode *Ld = dyn_cast<LoadSDNode>(St->getValue());
+ if (!Ld) break;
+
+ // Loads must only have one use.
+ if (!Ld->hasNUsesOfValue(1, 0))
+ break;
+
+ // Check that the alignment is the same as the stores.
+ if (Ld->getAlignment() != St->getAlignment())
+ break;
+
+ // The memory operands must not be volatile.
+ if (Ld->isVolatile() || Ld->isIndexed())
+ break;
+
+ // We do not accept ext loads.
+ if (Ld->getExtensionType() != ISD::NON_EXTLOAD)
+ break;
+
+ // The stored memory type must be the same.
+ if (Ld->getMemoryVT() != MemVT)
+ break;
+
+ std::pair<SDValue, int64_t> LdPtr =
+ GetPointerBaseAndOffset(Ld->getBasePtr());
+
+ // If this is not the first ptr that we check.
+ if (LdBasePtr.getNode()) {
+ // The base ptr must be the same.
+ if (LdPtr.first != LdBasePtr)
+ break;
+ } else {
+ // Check that all other base pointers are the same as this one.
+ LdBasePtr = LdPtr.first;
+ }
+
+ // We found a potential memory operand to merge.
+ LoadNodes.push_back(MemOpLink(Ld, LdPtr.second, 0));
+ }
+
+ if (LoadNodes.size() < 2)
+ return false;
+
+ // Scan the memory operations on the chain and find the first non-consecutive
+ // load memory address. These variables hold the index in the store node
+ // array.
+ unsigned LastConsecutiveLoad = 0;
+ // This variable refers to the size and not index in the array.
+ unsigned LastLegalVectorType = 0;
+ unsigned LastLegalIntegerType = 0;
+ StartAddress = LoadNodes[0].OffsetFromBase;
+ SDValue FirstChain = LoadNodes[0].MemNode->getChain();
+ for (unsigned i = 1; i < LoadNodes.size(); ++i) {
+ // All loads much share the same chain.
+ if (LoadNodes[i].MemNode->getChain() != FirstChain)
+ break;
+
+ int64_t CurrAddress = LoadNodes[i].OffsetFromBase;
+ if (CurrAddress - StartAddress != (ElementSizeBytes * i))
+ break;
+ LastConsecutiveLoad = i;
+
+ // Find a legal type for the vector store.
+ EVT StoreTy = EVT::getVectorVT(*DAG.getContext(), MemVT, i+1);
+ if (TLI.isTypeLegal(StoreTy))
+ LastLegalVectorType = i + 1;
+
+ // Find a legal type for the integer store.
+ unsigned StoreBW = (i+1) * ElementSizeBytes * 8;
+ StoreTy = EVT::getIntegerVT(*DAG.getContext(), StoreBW);
+ if (TLI.isTypeLegal(StoreTy))
+ LastLegalIntegerType = i + 1;
+ }
+
+ // Only use vector types if the vector type is larger than the integer type.
+ // If they are the same, use integers.
+ bool UseVectorTy = LastLegalVectorType > LastLegalIntegerType;
+ unsigned LastLegalType = std::max(LastLegalVectorType, LastLegalIntegerType);
+
+ // We add +1 here because the LastXXX variables refer to location while
+ // the NumElem refers to array/index size.
+ unsigned NumElem = std::min(LastConsecutiveStore, LastConsecutiveLoad) + 1;
+ NumElem = std::min(LastLegalType, NumElem);
+
+ if (NumElem < 2)
+ return false;
+
+ // The earliest Node in the DAG.
+ unsigned EarliestNodeUsed = 0;
+ LSBaseSDNode *EarliestOp = StoreNodes[EarliestNodeUsed].MemNode;
+ for (unsigned i=1; i<NumElem; ++i) {
+ // Find a chain for the new wide-store operand. Notice that some
+ // of the store nodes that we found may not be selected for inclusion
+ // in the wide store. The chain we use needs to be the chain of the
+ // earliest store node which is *used* and replaced by the wide store.
+ if (StoreNodes[i].SequenceNum > StoreNodes[EarliestNodeUsed].SequenceNum)
+ EarliestNodeUsed = i;
+ }
+
+ // Find if it is better to use vectors or integers to load and store
+ // to memory.
+ EVT JointMemOpVT;
+ if (UseVectorTy) {
+ JointMemOpVT = EVT::getVectorVT(*DAG.getContext(), MemVT, NumElem);
+ } else {
+ unsigned StoreBW = NumElem * ElementSizeBytes * 8;
+ JointMemOpVT = EVT::getIntegerVT(*DAG.getContext(), StoreBW);
+ }
+
+ DebugLoc LoadDL = LoadNodes[0].MemNode->getDebugLoc();
+ DebugLoc StoreDL = StoreNodes[0].MemNode->getDebugLoc();
+
+ LoadSDNode *FirstLoad = cast<LoadSDNode>(LoadNodes[0].MemNode);
+ SDValue NewLoad = DAG.getLoad(JointMemOpVT, LoadDL,
+ FirstLoad->getChain(),
+ FirstLoad->getBasePtr(),
+ FirstLoad->getPointerInfo(),
+ false, false, false,
+ FirstLoad->getAlignment());
+
+ SDValue NewStore = DAG.getStore(EarliestOp->getChain(), StoreDL, NewLoad,
+ FirstInChain->getBasePtr(),
+ FirstInChain->getPointerInfo(), false, false,
+ FirstInChain->getAlignment());
+
+ // Replace one of the loads with the new load.
+ LoadSDNode *Ld = cast<LoadSDNode>(LoadNodes[0].MemNode);
+ DAG.ReplaceAllUsesOfValueWith(SDValue(Ld, 1),
+ SDValue(NewLoad.getNode(), 1));
+
+ // Remove the rest of the load chains.
+ for (unsigned i = 1; i < NumElem ; ++i) {
+ // Replace all chain users of the old load nodes with the chain of the new
+ // load node.
+ LoadSDNode *Ld = cast<LoadSDNode>(LoadNodes[i].MemNode);
+ DAG.ReplaceAllUsesOfValueWith(SDValue(Ld, 1), Ld->getChain());
+ }
+
+ // Replace the first store with the new store.
+ CombineTo(EarliestOp, NewStore);
+ // Erase all other stores.
+ for (unsigned i = 0; i < NumElem ; ++i) {
+ // Remove all Store nodes.
+ if (StoreNodes[i].MemNode == EarliestOp)
+ continue;
+ StoreSDNode *St = cast<StoreSDNode>(StoreNodes[i].MemNode);
+ DAG.ReplaceAllUsesOfValueWith(SDValue(St, 0), St->getChain());
+ removeFromWorkList(St);
+ DAG.DeleteNode(St);
+ }
+
+ return true;
+}
+
SDValue DAGCombiner::visitSTORE(SDNode *N) {
StoreSDNode *ST = cast<StoreSDNode>(N);
SDValue Chain = ST->getChain();
@@ -7435,7 +7856,7 @@
ST->isUnindexed()) {
unsigned OrigAlign = ST->getAlignment();
EVT SVT = Value.getOperand(0).getValueType();
- unsigned Align = TLI.getTargetData()->
+ unsigned Align = TLI.getDataLayout()->
getABITypeAlignment(SVT.getTypeForEVT(*DAG.getContext()));
if (Align <= OrigAlign &&
((!LegalOperations && !ST->isVolatile()) ||
@@ -7624,6 +8045,11 @@
ST->getAlignment());
}
+ // Only perform this optimization before the types are legal, because we
+ // don't want to perform this optimization on every DAGCombine invocation.
+ if (!LegalTypes && MergeConsecutiveStores(ST))
+ return SDValue(N, 0);
+
return ReduceLoadOpStoreWidth(N);
}
@@ -7823,7 +8249,7 @@
// Check the resultant load doesn't need a higher alignment than the
// original load.
unsigned NewAlign =
- TLI.getTargetData()
+ TLI.getDataLayout()
->getABITypeAlignment(LVT.getTypeForEVT(*DAG.getContext()));
if (NewAlign > Align || !TLI.isOperationLegalOrCustom(ISD::LOAD, LVT))
@@ -8711,7 +9137,7 @@
const_cast<ConstantFP*>(TV->getConstantFPValue())
};
Type *FPTy = Elts[0]->getType();
- const TargetData &TD = *TLI.getTargetData();
+ const DataLayout &TD = *TLI.getDataLayout();
// Create a ConstantArray of the two constants.
Constant *CA = ConstantArray::get(ArrayType::get(FPTy, 2), Elts);
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/FastISel.cpp Thu Oct 11 16:28:00 2012
@@ -53,7 +53,7 @@
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Analysis/Loads.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Target/TargetLowering.h"
@@ -1059,7 +1059,7 @@
MFI(*FuncInfo.MF->getFrameInfo()),
MCP(*FuncInfo.MF->getConstantPool()),
TM(FuncInfo.MF->getTarget()),
- TD(*TM.getTargetData()),
+ TD(*TM.getDataLayout()),
TII(*TM.getInstrInfo()),
TLI(*TM.getTargetLowering()),
TRI(*TM.getRegisterInfo()),
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Thu Oct 11 16:28:00 2012
@@ -29,7 +29,7 @@
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Target/TargetRegisterInfo.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetOptions.h"
@@ -80,9 +80,9 @@
if (const AllocaInst *AI = dyn_cast<AllocaInst>(I))
if (const ConstantInt *CUI = dyn_cast<ConstantInt>(AI->getArraySize())) {
Type *Ty = AI->getAllocatedType();
- uint64_t TySize = TLI.getTargetData()->getTypeAllocSize(Ty);
+ uint64_t TySize = TLI.getDataLayout()->getTypeAllocSize(Ty);
unsigned Align =
- std::max((unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty),
+ std::max((unsigned)TLI.getDataLayout()->getPrefTypeAlignment(Ty),
AI->getAlignment());
TySize *= CUI->getZExtValue(); // Get total allocated size.
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/InstrEmitter.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/InstrEmitter.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/InstrEmitter.cpp Thu Oct 11 16:28:00 2012
@@ -20,7 +20,7 @@
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetLowering.h"
@@ -390,10 +390,10 @@
Type *Type = CP->getType();
// MachineConstantPool wants an explicit alignment.
if (Align == 0) {
- Align = TM->getTargetData()->getPrefTypeAlignment(Type);
+ Align = TM->getDataLayout()->getPrefTypeAlignment(Type);
if (Align == 0) {
// Alignment of vector types. FIXME!
- Align = TM->getTargetData()->getTypeAllocSize(Type);
+ Align = TM->getDataLayout()->getTypeAllocSize(Type);
}
}
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Oct 11 16:28:00 2012
@@ -22,7 +22,7 @@
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetLowering.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
@@ -718,7 +718,7 @@
// expand it.
if (!TLI.allowsUnalignedMemoryAccesses(ST->getMemoryVT())) {
Type *Ty = ST->getMemoryVT().getTypeForEVT(*DAG.getContext());
- unsigned ABIAlignment= TLI.getTargetData()->getABITypeAlignment(Ty);
+ unsigned ABIAlignment= TLI.getDataLayout()->getABITypeAlignment(Ty);
if (ST->getAlignment() < ABIAlignment)
ExpandUnalignedStore(cast<StoreSDNode>(Node),
DAG, TLI, this);
@@ -824,7 +824,7 @@
// expand it.
if (!TLI.allowsUnalignedMemoryAccesses(ST->getMemoryVT())) {
Type *Ty = ST->getMemoryVT().getTypeForEVT(*DAG.getContext());
- unsigned ABIAlignment= TLI.getTargetData()->getABITypeAlignment(Ty);
+ unsigned ABIAlignment= TLI.getDataLayout()->getABITypeAlignment(Ty);
if (ST->getAlignment() < ABIAlignment)
ExpandUnalignedStore(cast<StoreSDNode>(Node), DAG, TLI, this);
}
@@ -874,7 +874,7 @@
if (!TLI.allowsUnalignedMemoryAccesses(LD->getMemoryVT())) {
Type *Ty = LD->getMemoryVT().getTypeForEVT(*DAG.getContext());
unsigned ABIAlignment =
- TLI.getTargetData()->getABITypeAlignment(Ty);
+ TLI.getDataLayout()->getABITypeAlignment(Ty);
if (LD->getAlignment() < ABIAlignment){
ExpandUnalignedLoad(cast<LoadSDNode>(Node), DAG, TLI, RVal, RChain);
}
@@ -1059,7 +1059,7 @@
Type *Ty =
LD->getMemoryVT().getTypeForEVT(*DAG.getContext());
unsigned ABIAlignment =
- TLI.getTargetData()->getABITypeAlignment(Ty);
+ TLI.getDataLayout()->getABITypeAlignment(Ty);
if (LD->getAlignment() < ABIAlignment){
ExpandUnalignedLoad(cast<LoadSDNode>(Node),
DAG, TLI, Value, Chain);
@@ -1625,7 +1625,7 @@
DebugLoc dl) {
// Create the stack frame object.
unsigned SrcAlign =
- TLI.getTargetData()->getPrefTypeAlignment(SrcOp.getValueType().
+ TLI.getDataLayout()->getPrefTypeAlignment(SrcOp.getValueType().
getTypeForEVT(*DAG.getContext()));
SDValue FIPtr = DAG.CreateStackTemporary(SlotVT, SrcAlign);
@@ -1637,7 +1637,7 @@
unsigned SlotSize = SlotVT.getSizeInBits();
unsigned DestSize = DestVT.getSizeInBits();
Type *DestType = DestVT.getTypeForEVT(*DAG.getContext());
- unsigned DestAlign = TLI.getTargetData()->getPrefTypeAlignment(DestType);
+ unsigned DestAlign = TLI.getDataLayout()->getPrefTypeAlignment(DestType);
// Emit a store to the stack slot. Use a truncstore if the input value is
// later than DestVT.
@@ -2786,7 +2786,7 @@
// Increment the pointer, VAList, to the next vaarg
Tmp3 = DAG.getNode(ISD::ADD, dl, TLI.getPointerTy(), VAList,
- DAG.getConstant(TLI.getTargetData()->
+ DAG.getConstant(TLI.getDataLayout()->
getTypeAllocSize(VT.getTypeForEVT(*DAG.getContext())),
TLI.getPointerTy()));
// Store the incremented VAList to the legalized pointer
@@ -3365,7 +3365,7 @@
EVT PTy = TLI.getPointerTy();
- const TargetData &TD = *TLI.getTargetData();
+ const DataLayout &TD = *TLI.getDataLayout();
unsigned EntrySize =
DAG.getMachineFunction().getJumpTableInfo()->getEntrySize(TD);
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Thu Oct 11 16:28:00 2012
@@ -644,8 +644,9 @@
EVT SmallVT = LHS.getValueType();
// To determine if the result overflowed in a larger type, we extend the
- // input to the larger type, do the multiply, then check the high bits of
- // the result to see if the overflow happened.
+ // input to the larger type, do the multiply (checking if it overflows),
+ // then also check the high bits of the result to see if overflow happened
+ // there.
if (N->getOpcode() == ISD::SMULO) {
LHS = SExtPromotedInteger(LHS);
RHS = SExtPromotedInteger(RHS);
@@ -653,24 +654,31 @@
LHS = ZExtPromotedInteger(LHS);
RHS = ZExtPromotedInteger(RHS);
}
- SDValue Mul = DAG.getNode(ISD::MUL, DL, LHS.getValueType(), LHS, RHS);
+ SDVTList VTs = DAG.getVTList(LHS.getValueType(), N->getValueType(1));
+ SDValue Mul = DAG.getNode(N->getOpcode(), DL, VTs, LHS, RHS);
- // Overflow occurred iff the high part of the result does not
- // zero/sign-extend the low part.
+ // Overflow occurred if it occurred in the larger type, or if the high part
+ // of the result does not zero/sign-extend the low part. Check this second
+ // possibility first.
SDValue Overflow;
if (N->getOpcode() == ISD::UMULO) {
- // Unsigned overflow occurred iff the high part is non-zero.
+ // Unsigned overflow occurred if the high part is non-zero.
SDValue Hi = DAG.getNode(ISD::SRL, DL, Mul.getValueType(), Mul,
DAG.getIntPtrConstant(SmallVT.getSizeInBits()));
Overflow = DAG.getSetCC(DL, N->getValueType(1), Hi,
DAG.getConstant(0, Hi.getValueType()), ISD::SETNE);
} else {
- // Signed overflow occurred iff the high part does not sign extend the low.
+ // Signed overflow occurred if the high part does not sign extend the low.
SDValue SExt = DAG.getNode(ISD::SIGN_EXTEND_INREG, DL, Mul.getValueType(),
Mul, DAG.getValueType(SmallVT));
Overflow = DAG.getSetCC(DL, N->getValueType(1), SExt, Mul, ISD::SETNE);
}
+ // The only other way for overflow to occur is if the multiplication in the
+ // larger type itself overflowed.
+ Overflow = DAG.getNode(ISD::OR, DL, N->getValueType(1), Overflow,
+ SDValue(Mul.getNode(), 1));
+
// Use the calculated overflow everywhere.
ReplaceValueWith(SDValue(N, 1), Overflow);
return Mul;
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Thu Oct 11 16:28:00 2012
@@ -15,7 +15,7 @@
#include "LegalizeTypes.h"
#include "llvm/CallingConv.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp Thu Oct 11 16:28:00 2012
@@ -20,7 +20,7 @@
//===----------------------------------------------------------------------===//
#include "LegalizeTypes.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
using namespace llvm;
//===----------------------------------------------------------------------===//
@@ -146,7 +146,7 @@
// Create the stack frame object. Make sure it is aligned for both
// the source and expanded destination types.
unsigned Alignment =
- TLI.getTargetData()->getPrefTypeAlignment(NOutVT.
+ TLI.getDataLayout()->getPrefTypeAlignment(NOutVT.
getTypeForEVT(*DAG.getContext()));
SDValue StackPtr = DAG.CreateStackTemporary(InVT, Alignment);
int SPFI = cast<FrameIndexSDNode>(StackPtr.getNode())->getIndex();
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Thu Oct 11 16:28:00 2012
@@ -21,7 +21,7 @@
//===----------------------------------------------------------------------===//
#include "LegalizeTypes.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -749,7 +749,7 @@
SDValue EltPtr = GetVectorElementPointer(StackPtr, EltVT, Idx);
Type *VecType = VecVT.getTypeForEVT(*DAG.getContext());
unsigned Alignment =
- TLI.getTargetData()->getPrefTypeAlignment(VecType);
+ TLI.getDataLayout()->getPrefTypeAlignment(VecType);
Store = DAG.getTruncStore(Store, dl, Elt, EltPtr, MachinePointerInfo(), EltVT,
false, false, 0);
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp Thu Oct 11 16:28:00 2012
@@ -17,7 +17,7 @@
#include "llvm/CodeGen/SchedulerRegistry.h"
#include "llvm/CodeGen/SelectionDAGISel.h"
#include "llvm/Target/TargetRegisterInfo.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/ADT/SmallSet.h"
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Thu Oct 11 16:28:00 2012
@@ -22,7 +22,7 @@
#include "llvm/CodeGen/SelectionDAGISel.h"
#include "llvm/CodeGen/ScheduleHazardRecognizer.h"
#include "llvm/Target/TargetRegisterInfo.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetLowering.h"
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h Thu Oct 11 16:28:00 2012
@@ -158,6 +158,12 @@
void InitNodeNumDefs();
};
+ protected:
+ /// ForceUnitLatencies - Return true if all scheduling edges should be given
+ /// a latency value of one. The default is to return false; schedulers may
+ /// override this as needed.
+ virtual bool forceUnitLatencies() const { return false; }
+
private:
/// ClusterNeighboringLoads - Cluster loads from "near" addresses into
/// combined SUnits.
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGVLIW.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGVLIW.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGVLIW.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/ScheduleDAGVLIW.cpp Thu Oct 11 16:28:00 2012
@@ -25,7 +25,7 @@
#include "llvm/CodeGen/SchedulerRegistry.h"
#include "llvm/CodeGen/SelectionDAGISel.h"
#include "llvm/Target/TargetRegisterInfo.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Oct 11 16:28:00 2012
@@ -29,7 +29,7 @@
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/Target/TargetRegisterInfo.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetSelectionDAGInfo.h"
#include "llvm/Target/TargetOptions.h"
@@ -883,7 +883,7 @@
PointerType::get(Type::getInt8Ty(*getContext()), 0) :
VT.getTypeForEVT(*getContext());
- return TLI.getTargetData()->getABITypeAlignment(Ty);
+ return TLI.getDataLayout()->getABITypeAlignment(Ty);
}
// EntryNode could meaningfully have debug info if we can find it...
@@ -1173,7 +1173,7 @@
assert((TargetFlags == 0 || isTarget) &&
"Cannot set target flags on target-independent globals");
if (Alignment == 0)
- Alignment = TLI.getTargetData()->getPrefTypeAlignment(C->getType());
+ Alignment = TLI.getDataLayout()->getPrefTypeAlignment(C->getType());
unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
FoldingSetNodeID ID;
AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
@@ -1200,7 +1200,7 @@
assert((TargetFlags == 0 || isTarget) &&
"Cannot set target flags on target-independent globals");
if (Alignment == 0)
- Alignment = TLI.getTargetData()->getPrefTypeAlignment(C->getType());
+ Alignment = TLI.getDataLayout()->getPrefTypeAlignment(C->getType());
unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
FoldingSetNodeID ID;
AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
@@ -1544,7 +1544,7 @@
unsigned ByteSize = VT.getStoreSize();
Type *Ty = VT.getTypeForEVT(*getContext());
unsigned StackAlign =
- std::max((unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty), minAlign);
+ std::max((unsigned)TLI.getDataLayout()->getPrefTypeAlignment(Ty), minAlign);
int FrameIdx = FrameInfo->CreateStackObject(ByteSize, StackAlign, false);
return getFrameIndex(FrameIdx, TLI.getPointerTy());
@@ -1557,7 +1557,7 @@
VT2.getStoreSizeInBits())/8;
Type *Ty1 = VT1.getTypeForEVT(*getContext());
Type *Ty2 = VT2.getTypeForEVT(*getContext());
- const TargetData *TD = TLI.getTargetData();
+ const DataLayout *TD = TLI.getDataLayout();
unsigned Align = std::max(TD->getPrefTypeAlignment(Ty1),
TD->getPrefTypeAlignment(Ty2));
@@ -3451,7 +3451,7 @@
DAG.getMachineFunction());
if (VT == MVT::Other) {
- if (DstAlign >= TLI.getTargetData()->getPointerPrefAlignment() ||
+ if (DstAlign >= TLI.getDataLayout()->getPointerPrefAlignment() ||
TLI.allowsUnalignedMemoryAccesses(VT)) {
VT = TLI.getPointerTy();
} else {
@@ -3519,7 +3519,9 @@
bool DstAlignCanChange = false;
MachineFunction &MF = DAG.getMachineFunction();
MachineFrameInfo *MFI = MF.getFrameInfo();
- bool OptSize = MF.getFunction()->getFnAttributes().hasOptimizeForSizeAttr();
+ bool OptSize =
+ MF.getFunction()->getFnAttributes().
+ hasAttribute(Attributes::OptimizeForSize);
FrameIndexSDNode *FI = dyn_cast<FrameIndexSDNode>(Dst);
if (FI && !MFI->isFixedObjectIndex(FI->getIndex()))
DstAlignCanChange = true;
@@ -3539,7 +3541,7 @@
if (DstAlignCanChange) {
Type *Ty = MemOps[0].getTypeForEVT(*DAG.getContext());
- unsigned NewAlign = (unsigned) TLI.getTargetData()->getABITypeAlignment(Ty);
+ unsigned NewAlign = (unsigned) TLI.getDataLayout()->getABITypeAlignment(Ty);
if (NewAlign > Align) {
// Give the stack frame object a larger alignment if needed.
if (MFI->getObjectAlignment(FI->getIndex()) < NewAlign)
@@ -3612,7 +3614,8 @@
bool DstAlignCanChange = false;
MachineFunction &MF = DAG.getMachineFunction();
MachineFrameInfo *MFI = MF.getFrameInfo();
- bool OptSize = MF.getFunction()->getFnAttributes().hasOptimizeForSizeAttr();
+ bool OptSize = MF.getFunction()->getFnAttributes().
+ hasAttribute(Attributes::OptimizeForSize);
FrameIndexSDNode *FI = dyn_cast<FrameIndexSDNode>(Dst);
if (FI && !MFI->isFixedObjectIndex(FI->getIndex()))
DstAlignCanChange = true;
@@ -3628,7 +3631,7 @@
if (DstAlignCanChange) {
Type *Ty = MemOps[0].getTypeForEVT(*DAG.getContext());
- unsigned NewAlign = (unsigned) TLI.getTargetData()->getABITypeAlignment(Ty);
+ unsigned NewAlign = (unsigned) TLI.getDataLayout()->getABITypeAlignment(Ty);
if (NewAlign > Align) {
// Give the stack frame object a larger alignment if needed.
if (MFI->getObjectAlignment(FI->getIndex()) < NewAlign)
@@ -3690,7 +3693,8 @@
bool DstAlignCanChange = false;
MachineFunction &MF = DAG.getMachineFunction();
MachineFrameInfo *MFI = MF.getFrameInfo();
- bool OptSize = MF.getFunction()->getFnAttributes().hasOptimizeForSizeAttr();
+ bool OptSize = MF.getFunction()->getFnAttributes().
+ hasAttribute(Attributes::OptimizeForSize);
FrameIndexSDNode *FI = dyn_cast<FrameIndexSDNode>(Dst);
if (FI && !MFI->isFixedObjectIndex(FI->getIndex()))
DstAlignCanChange = true;
@@ -3703,7 +3707,7 @@
if (DstAlignCanChange) {
Type *Ty = MemOps[0].getTypeForEVT(*DAG.getContext());
- unsigned NewAlign = (unsigned) TLI.getTargetData()->getABITypeAlignment(Ty);
+ unsigned NewAlign = (unsigned) TLI.getDataLayout()->getABITypeAlignment(Ty);
if (NewAlign > Align) {
// Give the stack frame object a larger alignment if needed.
if (MFI->getObjectAlignment(FI->getIndex()) < NewAlign)
@@ -3797,7 +3801,7 @@
// Emit a library call.
TargetLowering::ArgListTy Args;
TargetLowering::ArgListEntry Entry;
- Entry.Ty = TLI.getTargetData()->getIntPtrType(*getContext());
+ Entry.Ty = TLI.getDataLayout()->getIntPtrType(*getContext());
Entry.Node = Dst; Args.push_back(Entry);
Entry.Node = Src; Args.push_back(Entry);
Entry.Node = Size; Args.push_back(Entry);
@@ -3852,7 +3856,7 @@
// Emit a library call.
TargetLowering::ArgListTy Args;
TargetLowering::ArgListEntry Entry;
- Entry.Ty = TLI.getTargetData()->getIntPtrType(*getContext());
+ Entry.Ty = TLI.getDataLayout()->getIntPtrType(*getContext());
Entry.Node = Dst; Args.push_back(Entry);
Entry.Node = Src; Args.push_back(Entry);
Entry.Node = Size; Args.push_back(Entry);
@@ -3901,7 +3905,7 @@
return Result;
// Emit a library call.
- Type *IntPtrTy = TLI.getTargetData()->getIntPtrType(*getContext());
+ Type *IntPtrTy = TLI.getDataLayout()->getIntPtrType(*getContext());
TargetLowering::ArgListTy Args;
TargetLowering::ArgListEntry Entry;
Entry.Node = Dst; Entry.Ty = IntPtrTy;
@@ -6097,7 +6101,7 @@
unsigned PtrWidth = TLI.getPointerTy().getSizeInBits();
APInt KnownZero(PtrWidth, 0), KnownOne(PtrWidth, 0);
llvm::ComputeMaskedBits(const_cast<GlobalValue*>(GV), KnownZero, KnownOne,
- TLI.getTargetData());
+ TLI.getDataLayout());
unsigned AlignBits = KnownZero.countTrailingOnes();
unsigned Align = AlignBits ? 1 << std::min(31U, AlignBits) : 0;
if (Align)
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Thu Oct 11 16:28:00 2012
@@ -44,7 +44,7 @@
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/SelectionDAG.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetIntrinsicInfo.h"
@@ -847,7 +847,7 @@
AA = &aa;
GFI = gfi;
LibInfo = li;
- TD = DAG.getTarget().getTargetData();
+ TD = DAG.getTarget().getDataLayout();
Context = DAG.getContext();
LPadToCallSiteMap.clear();
}
@@ -1227,9 +1227,9 @@
ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
const Function *F = I.getParent()->getParent();
- if (F->paramHasAttr(0, Attribute::SExt))
+ if (F->getRetAttributes().hasAttribute(Attributes::SExt))
ExtendKind = ISD::SIGN_EXTEND;
- else if (F->paramHasAttr(0, Attribute::ZExt))
+ else if (F->getRetAttributes().hasAttribute(Attributes::ZExt))
ExtendKind = ISD::ZERO_EXTEND;
if (ExtendKind != ISD::ANY_EXTEND && VT.isInteger())
@@ -1244,7 +1244,7 @@
// 'inreg' on function refers to return value
ISD::ArgFlagsTy Flags = ISD::ArgFlagsTy();
- if (F->paramHasAttr(0, Attribute::InReg))
+ if (F->getRetAttributes().hasAttribute(Attributes::InReg))
Flags.setInReg();
// Propagate extension type if any
@@ -3208,9 +3208,9 @@
return; // getValue will auto-populate this.
Type *Ty = I.getAllocatedType();
- uint64_t TySize = TLI.getTargetData()->getTypeAllocSize(Ty);
+ uint64_t TySize = TLI.getDataLayout()->getTypeAllocSize(Ty);
unsigned Align =
- std::max((unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty),
+ std::max((unsigned)TLI.getDataLayout()->getPrefTypeAlignment(Ty),
I.getAlignment());
SDValue AllocSize = getValue(I.getArraySize());
@@ -4400,7 +4400,7 @@
return DAG.getConstantFP(1.0, LHS.getValueType());
const Function *F = DAG.getMachineFunction().getFunction();
- if (!F->getFnAttributes().hasOptimizeForSizeAttr() ||
+ if (!F->getFnAttributes().hasAttribute(Attributes::OptimizeForSize) ||
// If optimizing for size, don't insert too many multiplies. This
// inserts up to 5 multiplies.
CountPopulation_32(Val)+Log2_32(Val) < 7) {
@@ -5308,9 +5308,9 @@
int DemoteStackIdx = -100;
if (!CanLowerReturn) {
- uint64_t TySize = TLI.getTargetData()->getTypeAllocSize(
+ uint64_t TySize = TLI.getDataLayout()->getTypeAllocSize(
FTy->getReturnType());
- unsigned Align = TLI.getTargetData()->getPrefTypeAlignment(
+ unsigned Align = TLI.getDataLayout()->getPrefTypeAlignment(
FTy->getReturnType());
MachineFunction &MF = DAG.getMachineFunction();
DemoteStackIdx = MF.getFrameInfo()->CreateStackObject(TySize, Align, false);
@@ -5342,12 +5342,12 @@
Entry.Node = ArgNode; Entry.Ty = V->getType();
unsigned attrInd = i - CS.arg_begin() + 1;
- Entry.isSExt = CS.paramHasAttr(attrInd, Attribute::SExt);
- Entry.isZExt = CS.paramHasAttr(attrInd, Attribute::ZExt);
- Entry.isInReg = CS.paramHasAttr(attrInd, Attribute::InReg);
- Entry.isSRet = CS.paramHasAttr(attrInd, Attribute::StructRet);
- Entry.isNest = CS.paramHasAttr(attrInd, Attribute::Nest);
- Entry.isByVal = CS.paramHasAttr(attrInd, Attribute::ByVal);
+ Entry.isSExt = CS.paramHasAttr(attrInd, Attributes::SExt);
+ Entry.isZExt = CS.paramHasAttr(attrInd, Attributes::ZExt);
+ Entry.isInReg = CS.paramHasAttr(attrInd, Attributes::InReg);
+ Entry.isSRet = CS.paramHasAttr(attrInd, Attributes::StructRet);
+ Entry.isNest = CS.paramHasAttr(attrInd, Attributes::Nest);
+ Entry.isByVal = CS.paramHasAttr(attrInd, Attributes::ByVal);
Entry.Alignment = CS.getParamAlignment(attrInd);
Args.push_back(Entry);
}
@@ -5775,7 +5775,7 @@
/// MVT::Other.
EVT getCallOperandValEVT(LLVMContext &Context,
const TargetLowering &TLI,
- const TargetData *TD) const {
+ const DataLayout *TD) const {
if (CallOperandVal == 0) return MVT::Other;
if (isa<BasicBlock>(CallOperandVal))
@@ -6079,8 +6079,8 @@
// Otherwise, create a stack slot and emit a store to it before the
// asm.
Type *Ty = OpVal->getType();
- uint64_t TySize = TLI.getTargetData()->getTypeAllocSize(Ty);
- unsigned Align = TLI.getTargetData()->getPrefTypeAlignment(Ty);
+ uint64_t TySize = TLI.getDataLayout()->getTypeAllocSize(Ty);
+ unsigned Align = TLI.getDataLayout()->getPrefTypeAlignment(Ty);
MachineFunction &MF = DAG.getMachineFunction();
int SSFI = MF.getFrameInfo()->CreateStackObject(TySize, Align, false);
SDValue StackSlot = DAG.getFrameIndex(SSFI, TLI.getPointerTy());
@@ -6428,7 +6428,7 @@
}
void SelectionDAGBuilder::visitVAArg(const VAArgInst &I) {
- const TargetData &TD = *TLI.getTargetData();
+ const DataLayout &TD = *TLI.getDataLayout();
SDValue V = DAG.getVAArg(TLI.getValueType(I.getType()), getCurDebugLoc(),
getRoot(), getValue(I.getOperand(0)),
DAG.getSrcValue(I.getOperand(0)),
@@ -6474,7 +6474,7 @@
Args[i].Node.getResNo() + Value);
ISD::ArgFlagsTy Flags;
unsigned OriginalAlignment =
- getTargetData()->getABITypeAlignment(ArgTy);
+ getDataLayout()->getABITypeAlignment(ArgTy);
if (Args[i].isZExt)
Flags.setZExt();
@@ -6488,7 +6488,7 @@
Flags.setByVal();
PointerType *Ty = cast<PointerType>(Args[i].Ty);
Type *ElementTy = Ty->getElementType();
- Flags.setByValSize(getTargetData()->getTypeAllocSize(ElementTy));
+ Flags.setByValSize(getDataLayout()->getTypeAllocSize(ElementTy));
// For ByVal, alignment should come from FE. BE will guess if this
// info is not there but there are cases it cannot get right.
unsigned FrameAlign;
@@ -6663,7 +6663,7 @@
const Function &F = *LLVMBB->getParent();
SelectionDAG &DAG = SDB->DAG;
DebugLoc dl = SDB->getCurDebugLoc();
- const TargetData *TD = TLI.getTargetData();
+ const DataLayout *TD = TLI.getDataLayout();
SmallVector<ISD::InputArg, 16> Ins;
// Check whether the function can return without sret-demotion.
@@ -6681,7 +6681,7 @@
ISD::ArgFlagsTy Flags;
Flags.setSRet();
EVT RegisterVT = TLI.getRegisterType(*DAG.getContext(), ValueVTs[0]);
- ISD::InputArg RetArg(Flags, RegisterVT, true);
+ ISD::InputArg RetArg(Flags, RegisterVT, true, 0, 0);
Ins.push_back(RetArg);
}
@@ -6700,15 +6700,15 @@
unsigned OriginalAlignment =
TD->getABITypeAlignment(ArgTy);
- if (F.paramHasAttr(Idx, Attribute::ZExt))
+ if (F.getParamAttributes(Idx).hasAttribute(Attributes::ZExt))
Flags.setZExt();
- if (F.paramHasAttr(Idx, Attribute::SExt))
+ if (F.getParamAttributes(Idx).hasAttribute(Attributes::SExt))
Flags.setSExt();
- if (F.paramHasAttr(Idx, Attribute::InReg))
+ if (F.getParamAttributes(Idx).hasAttribute(Attributes::InReg))
Flags.setInReg();
- if (F.paramHasAttr(Idx, Attribute::StructRet))
+ if (F.getParamAttributes(Idx).hasAttribute(Attributes::StructRet))
Flags.setSRet();
- if (F.paramHasAttr(Idx, Attribute::ByVal)) {
+ if (F.getParamAttributes(Idx).hasAttribute(Attributes::ByVal)) {
Flags.setByVal();
PointerType *Ty = cast<PointerType>(I->getType());
Type *ElementTy = Ty->getElementType();
@@ -6722,14 +6722,15 @@
FrameAlign = TLI.getByValTypeAlignment(ElementTy);
Flags.setByValAlign(FrameAlign);
}
- if (F.paramHasAttr(Idx, Attribute::Nest))
+ if (F.getParamAttributes(Idx).hasAttribute(Attributes::Nest))
Flags.setNest();
Flags.setOrigAlign(OriginalAlignment);
EVT RegisterVT = TLI.getRegisterType(*CurDAG->getContext(), VT);
unsigned NumRegs = TLI.getNumRegisters(*CurDAG->getContext(), VT);
for (unsigned i = 0; i != NumRegs; ++i) {
- ISD::InputArg MyFlags(Flags, RegisterVT, isArgValueUsed);
+ ISD::InputArg MyFlags(Flags, RegisterVT, isArgValueUsed,
+ Idx-1, i*RegisterVT.getStoreSize());
if (NumRegs > 1 && i == 0)
MyFlags.Flags.setSplit();
// if it isn't first piece, alignment must be 1
@@ -6809,9 +6810,9 @@
if (!I->use_empty()) {
ISD::NodeType AssertOp = ISD::DELETED_NODE;
- if (F.paramHasAttr(Idx, Attribute::SExt))
+ if (F.getParamAttributes(Idx).hasAttribute(Attributes::SExt))
AssertOp = ISD::AssertSext;
- else if (F.paramHasAttr(Idx, Attribute::ZExt))
+ else if (F.getParamAttributes(Idx).hasAttribute(Attributes::ZExt))
AssertOp = ISD::AssertZext;
ArgValues.push_back(getCopyFromParts(DAG, dl, &InVals[i],
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h Thu Oct 11 16:28:00 2012
@@ -66,7 +66,7 @@
class SIToFPInst;
class StoreInst;
class SwitchInst;
-class TargetData;
+class DataLayout;
class TargetLibraryInfo;
class TargetLowering;
class TruncInst;
@@ -285,7 +285,7 @@
const TargetMachine &TM;
const TargetLowering &TLI;
SelectionDAG &DAG;
- const TargetData *TD;
+ const DataLayout *TD;
AliasAnalysis *AA;
const TargetLibraryInfo *LibInfo;
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/TargetLowering.cpp Thu Oct 11 16:28:00 2012
@@ -14,7 +14,7 @@
#include "llvm/Target/TargetLowering.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCExpr.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegisterInfo.h"
@@ -515,7 +515,7 @@
/// NOTE: The constructor takes ownership of TLOF.
TargetLowering::TargetLowering(const TargetMachine &tm,
const TargetLoweringObjectFile *tlof)
- : TM(tm), TD(TM.getTargetData()), TLOF(*tlof) {
+ : TM(tm), TD(TM.getDataLayout()), TLOF(*tlof) {
// All operations default to being supported.
memset(OpActions, 0, sizeof(OpActions));
memset(LoadExtActions, 0, sizeof(LoadExtActions));
@@ -584,7 +584,7 @@
setOperationAction(ISD::TRAP, MVT::Other, Expand);
IsLittleEndian = TD->isLittleEndian();
- PointerTy = MVT::getIntegerVT(8*TD->getPointerSize());
+ PointerTy = MVT::getIntegerVT(8*TD->getPointerSize(0));
memset(RegClassForVT, 0,MVT::LAST_VALUETYPE*sizeof(TargetRegisterClass*));
memset(TargetDAGCombineArray, 0, array_lengthof(TargetDAGCombineArray));
maxStoresPerMemset = maxStoresPerMemcpy = maxStoresPerMemmove = 8;
@@ -625,7 +625,7 @@
}
MVT TargetLowering::getShiftAmountTy(EVT LHSTy) const {
- return MVT::getIntegerVT(8*TD->getPointerSize());
+ return MVT::getIntegerVT(8*TD->getPointerSize(0));
}
/// canOpTrap - Returns true if the operation can trap for the value type.
@@ -901,7 +901,7 @@
EVT TargetLowering::getSetCCResultType(EVT VT) const {
assert(!VT.isVector() && "No default SetCC type for vectors!");
- return PointerTy.SimpleTy;
+ return getPointerTy(0).SimpleTy;
}
MVT::SimpleValueType TargetLowering::getCmpLibcallReturnType() const {
@@ -997,9 +997,9 @@
EVT VT = ValueVTs[j];
ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
- if (attr.hasSExtAttr())
+ if (attr.hasAttribute(Attributes::SExt))
ExtendKind = ISD::SIGN_EXTEND;
- else if (attr.hasZExtAttr())
+ else if (attr.hasAttribute(Attributes::ZExt))
ExtendKind = ISD::ZERO_EXTEND;
// FIXME: C calling convention requires the return type to be promoted to
@@ -1017,13 +1017,13 @@
// 'inreg' on function refers to return value
ISD::ArgFlagsTy Flags = ISD::ArgFlagsTy();
- if (attr.hasInRegAttr())
+ if (attr.hasAttribute(Attributes::InReg))
Flags.setInReg();
// Propagate extension type if any
- if (attr.hasSExtAttr())
+ if (attr.hasAttribute(Attributes::SExt))
Flags.setSExt();
- else if (attr.hasZExtAttr())
+ else if (attr.hasAttribute(Attributes::ZExt))
Flags.setZExt();
for (unsigned i = 0; i < NumParts; ++i)
@@ -1061,7 +1061,7 @@
if ((JTEncoding == MachineJumpTableInfo::EK_GPRel64BlockAddress) ||
(JTEncoding == MachineJumpTableInfo::EK_GPRel32BlockAddress))
- return DAG.getGLOBAL_OFFSET_TABLE(getPointerTy());
+ return DAG.getGLOBAL_OFFSET_TABLE(getPointerTy(0));
return Table;
}
@@ -2953,8 +2953,9 @@
EVT::getEVT(IntegerType::get(OpTy->getContext(), BitSize), true);
break;
}
- } else if (dyn_cast<PointerType>(OpTy)) {
- OpInfo.ConstraintVT = MVT::getIntegerVT(8*TD->getPointerSize());
+ } else if (PointerType *PT = dyn_cast<PointerType>(OpTy)) {
+ OpInfo.ConstraintVT = MVT::getIntegerVT(
+ 8*TD->getPointerSize(PT->getAddressSpace()));
} else {
OpInfo.ConstraintVT = EVT::getEVT(OpTy, true);
}
Modified: llvm/branches/R600/lib/CodeGen/SelectionDAG/TargetSelectionDAGInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SelectionDAG/TargetSelectionDAGInfo.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SelectionDAG/TargetSelectionDAGInfo.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/SelectionDAG/TargetSelectionDAGInfo.cpp Thu Oct 11 16:28:00 2012
@@ -16,7 +16,7 @@
using namespace llvm;
TargetSelectionDAGInfo::TargetSelectionDAGInfo(const TargetMachine &TM)
- : TD(TM.getTargetData()) {
+ : TD(TM.getDataLayout()) {
}
TargetSelectionDAGInfo::~TargetSelectionDAGInfo() {
Modified: llvm/branches/R600/lib/CodeGen/SjLjEHPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/SjLjEHPrepare.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/SjLjEHPrepare.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/SjLjEHPrepare.cpp Thu Oct 11 16:28:00 2012
@@ -30,7 +30,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
@@ -191,7 +191,7 @@
// that needs to be restored on all exits from the function. This is an alloca
// because the value needs to be added to the global context list.
unsigned Align =
- TLI->getTargetData()->getPrefTypeAlignment(FunctionContextTy);
+ TLI->getDataLayout()->getPrefTypeAlignment(FunctionContextTy);
FuncCtx =
new AllocaInst(FunctionContextTy, 0, Align, "fn_context", EntryBB->begin());
Modified: llvm/branches/R600/lib/CodeGen/StackProtector.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/StackProtector.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/StackProtector.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/StackProtector.cpp Thu Oct 11 16:28:00 2012
@@ -26,7 +26,7 @@
#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/ADT/Triple.h"
@@ -117,7 +117,7 @@
// If an array has more than SSPBufferSize bytes of allocated space, then we
// emit stack protectors.
- if (TM.Options.SSPBufferSize <= TLI->getTargetData()->getTypeAllocSize(AT))
+ if (TM.Options.SSPBufferSize <= TLI->getDataLayout()->getTypeAllocSize(AT))
return true;
}
@@ -137,10 +137,10 @@
/// add a guard variable to functions that call alloca, and functions with
/// buffers larger than SSPBufferSize bytes.
bool StackProtector::RequiresStackProtector() const {
- if (F->getFnAttributes().hasStackProtectReqAttr())
+ if (F->getFnAttributes().hasAttribute(Attributes::StackProtectReq))
return true;
- if (!F->getFnAttributes().hasStackProtectAttr())
+ if (!F->getFnAttributes().hasAttribute(Attributes::StackProtect))
return false;
for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) {
Modified: llvm/branches/R600/lib/CodeGen/TailDuplication.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/TailDuplication.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/TailDuplication.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/TailDuplication.cpp Thu Oct 11 16:28:00 2012
@@ -552,7 +552,8 @@
// compensate for the duplication.
unsigned MaxDuplicateCount;
if (TailDuplicateSize.getNumOccurrences() == 0 &&
- MF.getFunction()->getFnAttributes().hasOptimizeForSizeAttr())
+ MF.getFunction()->getFnAttributes().
+ hasAttribute(Attributes::OptimizeForSize))
MaxDuplicateCount = 1;
else
MaxDuplicateCount = TailDuplicateSize;
Modified: llvm/branches/R600/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Thu Oct 11 16:28:00 2012
@@ -27,7 +27,7 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Target/Mangler.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/Dwarf.h"
@@ -77,9 +77,9 @@
Flags,
SectionKind::getDataRel(),
0, Label->getName());
- unsigned Size = TM.getTargetData()->getPointerSize();
+ unsigned Size = TM.getDataLayout()->getPointerSize();
Streamer.SwitchSection(Sec);
- Streamer.EmitValueToAlignment(TM.getTargetData()->getPointerABIAlignment());
+ Streamer.EmitValueToAlignment(TM.getDataLayout()->getPointerABIAlignment());
Streamer.EmitSymbolAttribute(Label, MCSA_ELF_TypeObject);
const MCExpr *E = MCConstantExpr::Create(Size, getContext());
Streamer.EmitELFSize(Label, E);
@@ -247,7 +247,7 @@
// FIXME: this is getting the alignment of the character, not the
// alignment of the global!
unsigned Align =
- TM.getTargetData()->getPreferredAlignment(cast<GlobalVariable>(GV));
+ TM.getDataLayout()->getPreferredAlignment(cast<GlobalVariable>(GV));
const char *SizeSpec = ".rodata.str1.";
if (Kind.isMergeable2ByteCString())
@@ -522,14 +522,14 @@
// FIXME: Alignment check should be handled by section classifier.
if (Kind.isMergeable1ByteCString() &&
- TM.getTargetData()->getPreferredAlignment(cast<GlobalVariable>(GV)) < 32)
+ TM.getDataLayout()->getPreferredAlignment(cast<GlobalVariable>(GV)) < 32)
return CStringSection;
// Do not put 16-bit arrays in the UString section if they have an
// externally visible label, this runs into issues with certain linker
// versions.
if (Kind.isMergeable2ByteCString() && !GV->hasExternalLinkage() &&
- TM.getTargetData()->getPreferredAlignment(cast<GlobalVariable>(GV)) < 32)
+ TM.getDataLayout()->getPreferredAlignment(cast<GlobalVariable>(GV)) < 32)
return UStringSection;
if (Kind.isMergeableConst()) {
Modified: llvm/branches/R600/lib/CodeGen/TargetSchedule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/CodeGen/TargetSchedule.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/CodeGen/TargetSchedule.cpp (original)
+++ llvm/branches/R600/lib/CodeGen/TargetSchedule.cpp Thu Oct 11 16:28:00 2012
@@ -14,6 +14,7 @@
#include "llvm/CodeGen/TargetSchedule.h"
#include "llvm/Target/TargetInstrInfo.h"
+#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include "llvm/Support/CommandLine.h"
@@ -21,12 +22,20 @@
using namespace llvm;
-static cl::opt<bool> EnableSchedModel("schedmodel", cl::Hidden, cl::init(false),
+static cl::opt<bool> EnableSchedModel("schedmodel", cl::Hidden, cl::init(true),
cl::desc("Use TargetSchedModel for latency lookup"));
static cl::opt<bool> EnableSchedItins("scheditins", cl::Hidden, cl::init(true),
cl::desc("Use InstrItineraryData for latency lookup"));
+bool TargetSchedModel::hasInstrSchedModel() const {
+ return EnableSchedModel && SchedModel.hasInstrSchedModel();
+}
+
+bool TargetSchedModel::hasInstrItineraries() const {
+ return EnableSchedItins && !InstrItins.isEmpty();
+}
+
void TargetSchedModel::init(const MCSchedModel &sm,
const TargetSubtargetInfo *sti,
const TargetInstrInfo *tii) {
@@ -36,6 +45,17 @@
STI->initInstrItins(InstrItins);
}
+unsigned TargetSchedModel::getNumMicroOps(MachineInstr *MI) const {
+ if (hasInstrItineraries()) {
+ int UOps = InstrItins.getNumMicroOps(MI->getDesc().getSchedClass());
+ return (UOps >= 0) ? UOps : TII->getNumMicroOps(&InstrItins, MI);
+ }
+ if (hasInstrSchedModel())
+ return resolveSchedClass(MI)->NumMicroOps;
+
+ return 1;
+}
+
/// If we can determine the operand latency from the def only, without machine
/// model or itinerary lookup, do so. Otherwise return -1.
int TargetSchedModel::getDefLatency(const MachineInstr *DefMI,
@@ -47,14 +67,12 @@
if (FindMin) {
// If MinLatency is invalid, then use the itinerary for MinLatency. If no
// itinerary exists either, then use single cycle latency.
- if (SchedModel.MinLatency < 0
- && !(EnableSchedItins && hasInstrItineraries())) {
+ if (SchedModel.MinLatency < 0 && !hasInstrItineraries()) {
return 1;
}
return SchedModel.MinLatency;
}
- else if (!(EnableSchedModel && hasInstrSchedModel())
- && !(EnableSchedItins && hasInstrItineraries())) {
+ else if (!hasInstrSchedModel() && !hasInstrItineraries()) {
return TII->defaultDefLatency(&SchedModel, DefMI);
}
// ...operand lookup required
@@ -123,60 +141,121 @@
if (DefLatency >= 0)
return DefLatency;
- if (!FindMin && EnableSchedModel && hasInstrSchedModel()) {
- const MCSchedClassDesc *SCDesc = resolveSchedClass(DefMI);
- unsigned DefIdx = findDefIdx(DefMI, DefOperIdx);
- if (DefIdx < SCDesc->NumWriteLatencyEntries) {
+ if (hasInstrItineraries()) {
+ int OperLatency = 0;
+ if (UseMI) {
+ OperLatency =
+ TII->getOperandLatency(&InstrItins, DefMI, DefOperIdx, UseMI, UseOperIdx);
+ }
+ else {
+ unsigned DefClass = DefMI->getDesc().getSchedClass();
+ OperLatency = InstrItins.getOperandCycle(DefClass, DefOperIdx);
+ }
+ if (OperLatency >= 0)
+ return OperLatency;
+
+ // No operand latency was found.
+ unsigned InstrLatency = TII->getInstrLatency(&InstrItins, DefMI);
+
+ // Expected latency is the max of the stage latency and itinerary props.
+ // Rather than directly querying InstrItins stage latency, we call a TII
+ // hook to allow subtargets to specialize latency. This hook is only
+ // applicable to the InstrItins model. InstrSchedModel should model all
+ // special cases without TII hooks.
+ if (!FindMin)
+ InstrLatency = std::max(InstrLatency,
+ TII->defaultDefLatency(&SchedModel, DefMI));
+ return InstrLatency;
+ }
+ assert(!FindMin && hasInstrSchedModel() &&
+ "Expected a SchedModel for this cpu");
+ const MCSchedClassDesc *SCDesc = resolveSchedClass(DefMI);
+ unsigned DefIdx = findDefIdx(DefMI, DefOperIdx);
+ if (DefIdx < SCDesc->NumWriteLatencyEntries) {
+ // Lookup the definition's write latency in SubtargetInfo.
+ const MCWriteLatencyEntry *WLEntry =
+ STI->getWriteLatencyEntry(SCDesc, DefIdx);
+ unsigned WriteID = WLEntry->WriteResourceID;
+ unsigned Latency = WLEntry->Cycles;
+ if (!UseMI)
+ return Latency;
+
+ // Lookup the use's latency adjustment in SubtargetInfo.
+ const MCSchedClassDesc *UseDesc = resolveSchedClass(UseMI);
+ if (UseDesc->NumReadAdvanceEntries == 0)
+ return Latency;
+ unsigned UseIdx = findUseIdx(UseMI, UseOperIdx);
+ return Latency - STI->getReadAdvanceCycles(UseDesc, UseIdx, WriteID);
+ }
+ // If DefIdx does not exist in the model (e.g. implicit defs), then return
+ // unit latency (defaultDefLatency may be too conservative).
+#ifndef NDEBUG
+ if (SCDesc->isValid() && !DefMI->getOperand(DefOperIdx).isImplicit()
+ && !DefMI->getDesc().OpInfo[DefOperIdx].isOptionalDef()) {
+ std::string Err;
+ raw_string_ostream ss(Err);
+ ss << "DefIdx " << DefIdx << " exceeds machine model writes for "
+ << *DefMI;
+ report_fatal_error(ss.str());
+ }
+#endif
+ return 1;
+}
+
+unsigned TargetSchedModel::computeInstrLatency(const MachineInstr *MI) const {
+ // For the itinerary model, fall back to the old subtarget hook.
+ // Allow subtargets to compute Bundle latencies outside the machine model.
+ if (hasInstrItineraries() || MI->isBundle())
+ return TII->getInstrLatency(&InstrItins, MI);
+
+ if (hasInstrSchedModel()) {
+ unsigned Latency = 0;
+ const MCSchedClassDesc *SCDesc = resolveSchedClass(MI);
+ for (unsigned DefIdx = 0, DefEnd = SCDesc->NumWriteLatencyEntries;
+ DefIdx != DefEnd; ++DefIdx) {
// Lookup the definition's write latency in SubtargetInfo.
const MCWriteLatencyEntry *WLEntry =
STI->getWriteLatencyEntry(SCDesc, DefIdx);
- unsigned WriteID = WLEntry->WriteResourceID;
- unsigned Latency = WLEntry->Cycles;
- if (!UseMI)
- return Latency;
-
- // Lookup the use's latency adjustment in SubtargetInfo.
- const MCSchedClassDesc *UseDesc = resolveSchedClass(UseMI);
- if (UseDesc->NumReadAdvanceEntries == 0)
- return Latency;
- unsigned UseIdx = findUseIdx(UseMI, UseOperIdx);
- return Latency - STI->getReadAdvanceCycles(UseDesc, UseIdx, WriteID);
+ Latency = std::max(Latency, WLEntry->Cycles);
}
- // If DefIdx does not exist in the model (e.g. implicit defs), then return
- // unit latency (defaultDefLatency may be too conservative).
-#ifndef NDEBUG
- if (SCDesc->isValid() && !DefMI->getOperand(DefOperIdx).isImplicit()
- && !DefMI->getDesc().OpInfo[DefOperIdx].isOptionalDef()) {
- std::string Err;
- raw_string_ostream ss(Err);
- ss << "DefIdx " << DefIdx << " exceeds machine model writes for "
- << *DefMI;
- report_fatal_error(ss.str());
- }
-#endif
- return 1;
+ return Latency;
}
- assert(EnableSchedItins && hasInstrItineraries() &&
- "operand latency requires itinerary");
+ return TII->defaultDefLatency(&SchedModel, MI);
+}
+
+unsigned TargetSchedModel::
+computeOutputLatency(const MachineInstr *DefMI, unsigned DefOperIdx,
+ const MachineInstr *DepMI) const {
+ // MinLatency == -1 is for in-order processors that always have unit
+ // MinLatency. MinLatency > 0 is for in-order processors with varying min
+ // latencies, but since this is not a RAW dep, we always use unit latency.
+ if (SchedModel.MinLatency != 0)
+ return 1;
+
+ // MinLatency == 0 indicates an out-of-order processor that can dispatch
+ // WAW dependencies in the same cycle.
- int OperLatency = 0;
- if (UseMI) {
- OperLatency =
- TII->getOperandLatency(&InstrItins, DefMI, DefOperIdx, UseMI, UseOperIdx);
- }
- else {
- unsigned DefClass = DefMI->getDesc().getSchedClass();
- OperLatency = InstrItins.getOperandCycle(DefClass, DefOperIdx);
- }
- if (OperLatency >= 0)
- return OperLatency;
-
- // No operand latency was found.
- unsigned InstrLatency = TII->getInstrLatency(&InstrItins, DefMI);
-
- // Expected latency is the max of the stage latency and itinerary props.
- if (!FindMin)
- InstrLatency = std::max(InstrLatency,
- TII->defaultDefLatency(&SchedModel, DefMI));
- return InstrLatency;
+ // Treat predication as a data dependency for out-of-order cpus. In-order
+ // cpus do not need to treat predicated writes specially.
+ //
+ // TODO: The following hack exists because predication passes do not
+ // correctly append imp-use operands, and readsReg() strangely returns false
+ // for predicated defs.
+ unsigned Reg = DefMI->getOperand(DefOperIdx).getReg();
+ const MachineFunction &MF = *DefMI->getParent()->getParent();
+ const TargetRegisterInfo *TRI = MF.getTarget().getRegisterInfo();
+ if (!DepMI->readsRegister(Reg, TRI) && TII->isPredicated(DepMI))
+ return computeInstrLatency(DefMI);
+
+ // If we have a per operand scheduling model, check if this def is writing
+ // an unbuffered resource. If so, it treated like an in-order cpu.
+ if (hasInstrSchedModel()) {
+ const MCSchedClassDesc *SCDesc = resolveSchedClass(DefMI);
+ for (const MCWriteProcResEntry *PRI = STI->getWriteProcResBegin(SCDesc),
+ *PRE = STI->getWriteProcResEnd(SCDesc); PRI != PRE; ++PRI) {
+ if (!SchedModel.getProcResource(PRI->ProcResourceIdx)->IsBuffered)
+ return 1;
+ }
+ }
+ return 0;
}
Modified: llvm/branches/R600/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/ExecutionEngine.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/branches/R600/lib/ExecutionEngine/ExecutionEngine.cpp Thu Oct 11 16:28:00 2012
@@ -29,7 +29,7 @@
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/TargetRegistry.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
#include <cmath>
#include <cstring>
@@ -91,11 +91,11 @@
public:
/// \brief Returns the address the GlobalVariable should be written into. The
/// GVMemoryBlock object prefixes that.
- static char *Create(const GlobalVariable *GV, const TargetData& TD) {
+ static char *Create(const GlobalVariable *GV, const DataLayout& TD) {
Type *ElTy = GV->getType()->getElementType();
size_t GVSize = (size_t)TD.getTypeAllocSize(ElTy);
void *RawMemory = ::operator new(
- TargetData::RoundUpAlignment(sizeof(GVMemoryBlock),
+ DataLayout::RoundUpAlignment(sizeof(GVMemoryBlock),
TD.getPreferredAlignment(GV))
+ GVSize);
new(RawMemory) GVMemoryBlock(GV);
@@ -113,7 +113,7 @@
} // anonymous namespace
char *ExecutionEngine::getMemoryForGV(const GlobalVariable *GV) {
- return GVMemoryBlock::Create(GV, *getTargetData());
+ return GVMemoryBlock::Create(GV, *getDataLayout());
}
bool ExecutionEngine::removeModule(Module *M) {
@@ -267,7 +267,7 @@
void *ArgvArray::reset(LLVMContext &C, ExecutionEngine *EE,
const std::vector<std::string> &InputArgv) {
clear(); // Free the old contents.
- unsigned PtrSize = EE->getTargetData()->getPointerSize();
+ unsigned PtrSize = EE->getDataLayout()->getPointerSize();
Array = new char[(InputArgv.size()+1)*PtrSize];
DEBUG(dbgs() << "JIT: ARGV = " << (void*)Array << "\n");
@@ -342,7 +342,7 @@
#ifndef NDEBUG
/// isTargetNullPtr - Return whether the target pointer stored at Loc is null.
static bool isTargetNullPtr(ExecutionEngine *EE, void *Loc) {
- unsigned PtrSize = EE->getTargetData()->getPointerSize();
+ unsigned PtrSize = EE->getDataLayout()->getPointerSize();
for (unsigned i = 0; i < PtrSize; ++i)
if (*(i + (uint8_t*)Loc))
return false;
@@ -856,7 +856,7 @@
void ExecutionEngine::StoreValueToMemory(const GenericValue &Val,
GenericValue *Ptr, Type *Ty) {
- const unsigned StoreBytes = getTargetData()->getTypeStoreSize(Ty);
+ const unsigned StoreBytes = getDataLayout()->getTypeStoreSize(Ty);
switch (Ty->getTypeID()) {
case Type::IntegerTyID:
@@ -882,7 +882,7 @@
dbgs() << "Cannot store value of type " << *Ty << "!\n";
}
- if (sys::isLittleEndianHost() != getTargetData()->isLittleEndian())
+ if (sys::isLittleEndianHost() != getDataLayout()->isLittleEndian())
// Host and target are different endian - reverse the stored bytes.
std::reverse((uint8_t*)Ptr, StoreBytes + (uint8_t*)Ptr);
}
@@ -918,7 +918,7 @@
void ExecutionEngine::LoadValueFromMemory(GenericValue &Result,
GenericValue *Ptr,
Type *Ty) {
- const unsigned LoadBytes = getTargetData()->getTypeStoreSize(Ty);
+ const unsigned LoadBytes = getDataLayout()->getTypeStoreSize(Ty);
switch (Ty->getTypeID()) {
case Type::IntegerTyID:
@@ -959,20 +959,20 @@
if (const ConstantVector *CP = dyn_cast<ConstantVector>(Init)) {
unsigned ElementSize =
- getTargetData()->getTypeAllocSize(CP->getType()->getElementType());
+ getDataLayout()->getTypeAllocSize(CP->getType()->getElementType());
for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)
InitializeMemory(CP->getOperand(i), (char*)Addr+i*ElementSize);
return;
}
if (isa<ConstantAggregateZero>(Init)) {
- memset(Addr, 0, (size_t)getTargetData()->getTypeAllocSize(Init->getType()));
+ memset(Addr, 0, (size_t)getDataLayout()->getTypeAllocSize(Init->getType()));
return;
}
if (const ConstantArray *CPA = dyn_cast<ConstantArray>(Init)) {
unsigned ElementSize =
- getTargetData()->getTypeAllocSize(CPA->getType()->getElementType());
+ getDataLayout()->getTypeAllocSize(CPA->getType()->getElementType());
for (unsigned i = 0, e = CPA->getNumOperands(); i != e; ++i)
InitializeMemory(CPA->getOperand(i), (char*)Addr+i*ElementSize);
return;
@@ -980,7 +980,7 @@
if (const ConstantStruct *CPS = dyn_cast<ConstantStruct>(Init)) {
const StructLayout *SL =
- getTargetData()->getStructLayout(cast<StructType>(CPS->getType()));
+ getDataLayout()->getStructLayout(cast<StructType>(CPS->getType()));
for (unsigned i = 0, e = CPS->getNumOperands(); i != e; ++i)
InitializeMemory(CPS->getOperand(i), (char*)Addr+SL->getElementOffset(i));
return;
@@ -1127,7 +1127,7 @@
InitializeMemory(GV->getInitializer(), GA);
Type *ElTy = GV->getType()->getElementType();
- size_t GVSize = (size_t)getTargetData()->getTypeAllocSize(ElTy);
+ size_t GVSize = (size_t)getDataLayout()->getTypeAllocSize(ElTy);
NumInitBytes += (unsigned)GVSize;
++NumGlobals;
}
Modified: llvm/branches/R600/lib/ExecutionEngine/ExecutionEngineBindings.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/ExecutionEngineBindings.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/ExecutionEngineBindings.cpp (original)
+++ llvm/branches/R600/lib/ExecutionEngine/ExecutionEngineBindings.cpp Thu Oct 11 16:28:00 2012
@@ -239,7 +239,7 @@
}
LLVMTargetDataRef LLVMGetExecutionEngineTargetData(LLVMExecutionEngineRef EE) {
- return wrap(unwrap(EE)->getTargetData());
+ return wrap(unwrap(EE)->getDataLayout());
}
void LLVMAddGlobalMapping(LLVMExecutionEngineRef EE, LLVMValueRef Global,
Modified: llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/ittnotify_config.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/ittnotify_config.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/ittnotify_config.h (original)
+++ llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/ittnotify_config.h Thu Oct 11 16:28:00 2012
@@ -10,6 +10,11 @@
* This file provides Intel(R) Performance Analyzer JIT (Just-In-Time)
* Profiling API internal config.
*
+ * NOTE: This file comes in a style different from the rest of LLVM
+ * source base since this is a piece of code shared from Intel(R)
+ * products. Please do not reformat / re-style this code to make
+ * subsequent merges and contributions from the original source base eaiser.
+ *
*===----------------------------------------------------------------------===*/
#ifndef _ITTNOTIFY_CONFIG_H_
#define _ITTNOTIFY_CONFIG_H_
Modified: llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/ittnotify_types.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/ittnotify_types.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/ittnotify_types.h (original)
+++ llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/ittnotify_types.h Thu Oct 11 16:28:00 2012
@@ -1,11 +1,18 @@
-//===-- ittnotify_types.h - Intel(R) Performance Analyzer JIT (Just-In-Time) Profiling API internal types. ---------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
+/*===-- ittnotify_types.h - JIT Profiling API internal types--------*- C -*-===*
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===*
+ *
+ * NOTE: This file comes in a style different from the rest of LLVM
+ * source base since this is a piece of code shared from Intel(R)
+ * products. Please do not reformat / re-style this code to make
+ * subsequent merges and contributions from the original source base eaiser.
+ *
+ *===----------------------------------------------------------------------===*/
#ifndef _ITTNOTIFY_TYPES_H_
#define _ITTNOTIFY_TYPES_H_
Modified: llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/jitprofiling.c
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/jitprofiling.c?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/jitprofiling.c (original)
+++ llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/jitprofiling.c Thu Oct 11 16:28:00 2012
@@ -10,6 +10,11 @@
* This file provides Intel(R) Performance Analyzer JIT (Just-In-Time)
* Profiling API implementation.
*
+ * NOTE: This file comes in a style different from the rest of LLVM
+ * source base since this is a piece of code shared from Intel(R)
+ * products. Please do not reformat / re-style this code to make
+ * subsequent merges and contributions from the original source base eaiser.
+ *
*===----------------------------------------------------------------------===*/
#include "ittnotify_config.h"
Modified: llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/jitprofiling.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/jitprofiling.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/jitprofiling.h (original)
+++ llvm/branches/R600/lib/ExecutionEngine/IntelJITEvents/jitprofiling.h Thu Oct 11 16:28:00 2012
@@ -10,6 +10,11 @@
* This file provides Intel(R) Performance Analyzer JIT (Just-In-Time)
* Profiling API declaration.
*
+ * NOTE: This file comes in a style different from the rest of LLVM
+ * source base since this is a piece of code shared from Intel(R)
+ * products. Please do not reformat / re-style this code to make
+ * subsequent merges and contributions from the original source base eaiser.
+ *
*===----------------------------------------------------------------------===*/
#ifndef __JITPROFILING_H__
#define __JITPROFILING_H__
Modified: llvm/branches/R600/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp (original)
+++ llvm/branches/R600/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Thu Oct 11 16:28:00 2012
@@ -25,7 +25,7 @@
#include "llvm/Config/config.h" // Detect libffi
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/DynamicLibrary.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Mutex.h"
#include <csignal>
@@ -180,7 +180,7 @@
static bool ffiInvoke(RawFunc Fn, Function *F,
const std::vector<GenericValue> &ArgVals,
- const TargetData *TD, GenericValue &Result) {
+ const DataLayout *TD, GenericValue &Result) {
ffi_cif cif;
FunctionType *FTy = F->getFunctionType();
const unsigned NumArgs = F->arg_size();
@@ -276,7 +276,7 @@
FunctionsLock->release();
GenericValue Result;
- if (RawFn != 0 && ffiInvoke(RawFn, F, ArgVals, getTargetData(), Result))
+ if (RawFn != 0 && ffiInvoke(RawFn, F, ArgVals, getDataLayout(), Result))
return Result;
#endif // USE_LIBFFI
@@ -376,7 +376,7 @@
case 'x': case 'X':
if (HowLong >= 1) {
if (HowLong == 1 &&
- TheInterpreter->getTargetData()->getPointerSizeInBits() == 64 &&
+ TheInterpreter->getDataLayout()->getPointerSizeInBits() == 64 &&
sizeof(long) < sizeof(int64_t)) {
// Make sure we use %lld with a 64 bit argument because we might be
// compiling LLI on a 32 bit compiler.
Modified: llvm/branches/R600/lib/ExecutionEngine/Interpreter/Interpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/Interpreter/Interpreter.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/Interpreter/Interpreter.cpp (original)
+++ llvm/branches/R600/lib/ExecutionEngine/Interpreter/Interpreter.cpp Thu Oct 11 16:28:00 2012
@@ -48,7 +48,7 @@
: ExecutionEngine(M), TD(M) {
memset(&ExitValue.Untyped, 0, sizeof(ExitValue.Untyped));
- setTargetData(&TD);
+ setDataLayout(&TD);
// Initialize the "backend"
initializeExecutionEngine();
initializeExternalFunctions();
Modified: llvm/branches/R600/lib/ExecutionEngine/Interpreter/Interpreter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/Interpreter/Interpreter.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/Interpreter/Interpreter.h (original)
+++ llvm/branches/R600/lib/ExecutionEngine/Interpreter/Interpreter.h Thu Oct 11 16:28:00 2012
@@ -17,7 +17,7 @@
#include "llvm/Function.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/ExecutionEngine/GenericValue.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/ErrorHandling.h"
@@ -82,7 +82,7 @@
//
class Interpreter : public ExecutionEngine, public InstVisitor<Interpreter> {
GenericValue ExitValue; // The return value of the called function
- TargetData TD;
+ DataLayout TD;
IntrinsicLowering *IL;
// The runtime stack of executing code. The top of the stack is the current
Modified: llvm/branches/R600/lib/ExecutionEngine/JIT/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/JIT/JIT.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/JIT/JIT.cpp (original)
+++ llvm/branches/R600/lib/ExecutionEngine/JIT/JIT.cpp Thu Oct 11 16:28:00 2012
@@ -24,7 +24,7 @@
#include "llvm/ExecutionEngine/GenericValue.h"
#include "llvm/ExecutionEngine/JITEventListener.h"
#include "llvm/ExecutionEngine/JITMemoryManager.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetJITInfo.h"
#include "llvm/Support/Dwarf.h"
@@ -272,7 +272,7 @@
: ExecutionEngine(M), TM(tm), TJI(tji),
JMM(jmm ? jmm : JITMemoryManager::CreateDefaultMemManager()),
AllocateGVsWithCode(GVsWithCode), isAlreadyCodeGenerating(false) {
- setTargetData(TM.getTargetData());
+ setDataLayout(TM.getDataLayout());
jitstate = new JITState(M);
@@ -285,7 +285,7 @@
// Add target data
MutexGuard locked(lock);
FunctionPassManager &PM = jitstate->getPM(locked);
- PM.add(new TargetData(*TM.getTargetData()));
+ PM.add(new DataLayout(*TM.getDataLayout()));
// Turn the machine code intermediate representation into bytes in memory that
// may be executed.
@@ -339,7 +339,7 @@
jitstate = new JITState(M);
FunctionPassManager &PM = jitstate->getPM(locked);
- PM.add(new TargetData(*TM.getTargetData()));
+ PM.add(new DataLayout(*TM.getDataLayout()));
// Turn the machine code intermediate representation into bytes in memory
// that may be executed.
@@ -370,7 +370,7 @@
jitstate = new JITState(Modules[0]);
FunctionPassManager &PM = jitstate->getPM(locked);
- PM.add(new TargetData(*TM.getTargetData()));
+ PM.add(new DataLayout(*TM.getDataLayout()));
// Turn the machine code intermediate representation into bytes in memory
// that may be executed.
@@ -815,8 +815,8 @@
// through the memory manager which puts them near the code but not in the
// same buffer.
Type *GlobalType = GV->getType()->getElementType();
- size_t S = getTargetData()->getTypeAllocSize(GlobalType);
- size_t A = getTargetData()->getPreferredAlignment(GV);
+ size_t S = getDataLayout()->getTypeAllocSize(GlobalType);
+ size_t A = getDataLayout()->getPreferredAlignment(GV);
if (GV->isThreadLocal()) {
MutexGuard locked(lock);
Ptr = TJI.allocateThreadLocalMemory(S);
Modified: llvm/branches/R600/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp (original)
+++ llvm/branches/R600/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp Thu Oct 11 16:28:00 2012
@@ -24,7 +24,7 @@
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetMachine.h"
@@ -42,7 +42,7 @@
assert(MMI && "MachineModuleInfo not registered!");
const TargetMachine& TM = F.getTarget();
- TD = TM.getTargetData();
+ TD = TM.getDataLayout();
stackGrowthDirection = TM.getFrameLowering()->getStackGrowthDirection();
RI = TM.getRegisterInfo();
MAI = TM.getMCAsmInfo();
Modified: llvm/branches/R600/lib/ExecutionEngine/JIT/JITDwarfEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/JIT/JITDwarfEmitter.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/JIT/JITDwarfEmitter.h (original)
+++ llvm/branches/R600/lib/ExecutionEngine/JIT/JITDwarfEmitter.h Thu Oct 11 16:28:00 2012
@@ -23,12 +23,12 @@
class MachineModuleInfo;
class MachineMove;
class MCAsmInfo;
-class TargetData;
+class DataLayout;
class TargetMachine;
class TargetRegisterInfo;
class JITDwarfEmitter {
- const TargetData* TD;
+ const DataLayout* TD;
JITCodeEmitter* JCE;
const TargetRegisterInfo* RI;
const MCAsmInfo *MAI;
Modified: llvm/branches/R600/lib/ExecutionEngine/JIT/JITEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/JIT/JITEmitter.cpp (original)
+++ llvm/branches/R600/lib/ExecutionEngine/JIT/JITEmitter.cpp Thu Oct 11 16:28:00 2012
@@ -30,7 +30,7 @@
#include "llvm/ExecutionEngine/GenericValue.h"
#include "llvm/ExecutionEngine/JITEventListener.h"
#include "llvm/ExecutionEngine/JITMemoryManager.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetJITInfo.h"
#include "llvm/Target/TargetMachine.h"
@@ -763,7 +763,7 @@
}
static unsigned GetConstantPoolSizeInBytes(MachineConstantPool *MCP,
- const TargetData *TD) {
+ const DataLayout *TD) {
const std::vector<MachineConstantPoolEntry> &Constants = MCP->getConstants();
if (Constants.empty()) return 0;
@@ -1058,7 +1058,7 @@
const std::vector<MachineConstantPoolEntry> &Constants = MCP->getConstants();
if (Constants.empty()) return;
- unsigned Size = GetConstantPoolSizeInBytes(MCP, TheJIT->getTargetData());
+ unsigned Size = GetConstantPoolSizeInBytes(MCP, TheJIT->getDataLayout());
unsigned Align = MCP->getConstantPoolAlignment();
ConstantPoolBase = allocateSpace(Size, Align);
ConstantPool = MCP;
@@ -1087,7 +1087,7 @@
dbgs().write_hex(CAddr) << "]\n");
Type *Ty = CPE.Val.ConstVal->getType();
- Offset += TheJIT->getTargetData()->getTypeAllocSize(Ty);
+ Offset += TheJIT->getDataLayout()->getTypeAllocSize(Ty);
}
}
@@ -1104,14 +1104,14 @@
for (unsigned i = 0, e = JT.size(); i != e; ++i)
NumEntries += JT[i].MBBs.size();
- unsigned EntrySize = MJTI->getEntrySize(*TheJIT->getTargetData());
+ unsigned EntrySize = MJTI->getEntrySize(*TheJIT->getDataLayout());
// Just allocate space for all the jump tables now. We will fix up the actual
// MBB entries in the tables after we emit the code for each block, since then
// we will know the final locations of the MBBs in memory.
JumpTable = MJTI;
JumpTableBase = allocateSpace(NumEntries * EntrySize,
- MJTI->getEntryAlignment(*TheJIT->getTargetData()));
+ MJTI->getEntryAlignment(*TheJIT->getDataLayout()));
}
void JITEmitter::emitJumpTableInfo(MachineJumpTableInfo *MJTI) {
@@ -1128,7 +1128,7 @@
case MachineJumpTableInfo::EK_BlockAddress: {
// EK_BlockAddress - Each entry is a plain address of block, e.g.:
// .word LBB123
- assert(MJTI->getEntrySize(*TheJIT->getTargetData()) == sizeof(void*) &&
+ assert(MJTI->getEntrySize(*TheJIT->getDataLayout()) == sizeof(void*) &&
"Cross JIT'ing?");
// For each jump table, map each target in the jump table to the address of
@@ -1148,7 +1148,7 @@
case MachineJumpTableInfo::EK_Custom32:
case MachineJumpTableInfo::EK_GPRel32BlockAddress:
case MachineJumpTableInfo::EK_LabelDifference32: {
- assert(MJTI->getEntrySize(*TheJIT->getTargetData()) == 4&&"Cross JIT'ing?");
+ assert(MJTI->getEntrySize(*TheJIT->getDataLayout()) == 4&&"Cross JIT'ing?");
// For each jump table, place the offset from the beginning of the table
// to the target address.
int *SlotPtr = (int*)JumpTableBase;
@@ -1224,7 +1224,7 @@
const std::vector<MachineJumpTableEntry> &JT = JumpTable->getJumpTables();
assert(Index < JT.size() && "Invalid jump table index!");
- unsigned EntrySize = JumpTable->getEntrySize(*TheJIT->getTargetData());
+ unsigned EntrySize = JumpTable->getEntrySize(*TheJIT->getDataLayout());
unsigned Offset = 0;
for (unsigned i = 0; i < Index; ++i)
Modified: llvm/branches/R600/lib/ExecutionEngine/MCJIT/MCJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/MCJIT/MCJIT.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/MCJIT/MCJIT.cpp (original)
+++ llvm/branches/R600/lib/ExecutionEngine/MCJIT/MCJIT.cpp Thu Oct 11 16:28:00 2012
@@ -12,14 +12,16 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
#include "llvm/ExecutionEngine/GenericValue.h"
-#include "llvm/ExecutionEngine/MCJIT.h"
#include "llvm/ExecutionEngine/JITMemoryManager.h"
+#include "llvm/ExecutionEngine/MCJIT.h"
+#include "llvm/ExecutionEngine/ObjectBuffer.h"
+#include "llvm/ExecutionEngine/ObjectImage.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/MutexGuard.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
using namespace llvm;
@@ -50,9 +52,9 @@
MCJIT::MCJIT(Module *m, TargetMachine *tm, RTDyldMemoryManager *MM,
bool AllocateGVsWithCode)
: ExecutionEngine(m), TM(tm), Ctx(0), MemMgr(MM), Dyld(MM),
- isCompiled(false), M(m), OS(Buffer) {
+ isCompiled(false), M(m) {
- setTargetData(TM->getTargetData());
+ setDataLayout(TM->getDataLayout());
}
MCJIT::~MCJIT() {
@@ -63,7 +65,7 @@
void MCJIT::emitObject(Module *m) {
/// Currently, MCJIT only supports a single module and the module passed to
/// this function call is expected to be the contained module. The module
- /// is passed as a parameter here to prepare for multiple module support in
+ /// is passed as a parameter here to prepare for multiple module support in
/// the future.
assert(M == m);
@@ -78,32 +80,34 @@
PassManager PM;
- PM.add(new TargetData(*TM->getTargetData()));
+ PM.add(new DataLayout(*TM->getDataLayout()));
+
+ // The RuntimeDyld will take ownership of this shortly
+ OwningPtr<ObjectBufferStream> Buffer(new ObjectBufferStream());
// Turn the machine code intermediate representation into bytes in memory
// that may be executed.
- if (TM->addPassesToEmitMC(PM, Ctx, OS, false)) {
+ if (TM->addPassesToEmitMC(PM, Ctx, Buffer->getOStream(), false)) {
report_fatal_error("Target does not support MC emission!");
}
// Initialize passes.
- // FIXME: When we support multiple modules, we'll want to move the code
- // gen and finalization out of the constructor here and do it more
- // on-demand as part of getPointerToFunction().
PM.run(*m);
- // Flush the output buffer so the SmallVector gets its data.
- OS.flush();
+ // Flush the output buffer to get the generated code into memory
+ Buffer->flush();
// Load the object into the dynamic linker.
- MemoryBuffer* MB = MemoryBuffer::getMemBuffer(StringRef(Buffer.data(),
- Buffer.size()),
- "", false);
- if (Dyld.loadObject(MB))
+ // handing off ownership of the buffer
+ LoadedObject.reset(Dyld.loadObject(Buffer.take()));
+ if (!LoadedObject)
report_fatal_error(Dyld.getErrorString());
// Resolve any relocations.
Dyld.resolveRelocations();
+ // FIXME: Make this optional, maybe even move it to a JIT event listener
+ LoadedObject->registerWithDebugger();
+
// FIXME: Add support for per-module compilation state
isCompiled = true;
}
Modified: llvm/branches/R600/lib/ExecutionEngine/MCJIT/MCJIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/MCJIT/MCJIT.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/MCJIT/MCJIT.h (original)
+++ llvm/branches/R600/lib/ExecutionEngine/MCJIT/MCJIT.h Thu Oct 11 16:28:00 2012
@@ -13,11 +13,11 @@
#include "llvm/PassManager.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
#include "llvm/ExecutionEngine/RuntimeDyld.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/raw_ostream.h"
namespace llvm {
+class ObjectImage;
+
// FIXME: This makes all kinds of horrible assumptions for the time being,
// like only having one module, not needing to worry about multi-threading,
// blah blah. Purely in get-it-up-and-limping mode for now.
@@ -34,10 +34,7 @@
// FIXME: Add support for multiple modules
bool isCompiled;
Module *M;
-
- // FIXME: Move these to a single container which manages JITed objects
- SmallVector<char, 4096> Buffer; // Working buffer into which we JIT.
- raw_svector_ostream OS;
+ OwningPtr<ObjectImage> LoadedObject;
public:
~MCJIT();
Modified: llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/GDBRegistrar.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/GDBRegistrar.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/GDBRegistrar.cpp (original)
+++ llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/GDBRegistrar.cpp Thu Oct 11 16:28:00 2012
@@ -78,12 +78,12 @@
/// Creates an entry in the JIT registry for the buffer @p Object,
/// which must contain an object file in executable memory with any
/// debug information for the debugger.
- void registerObject(const MemoryBuffer &Object);
+ void registerObject(const ObjectBuffer &Object);
/// Removes the internal registration of @p Object, and
/// frees associated resources.
/// Returns true if @p Object was found in ObjectBufferMap.
- bool deregisterObject(const MemoryBuffer &Object);
+ bool deregisterObject(const ObjectBuffer &Object);
private:
/// Deregister the debug info for the given object file from the debugger
@@ -124,7 +124,7 @@
ObjectBufferMap.clear();
}
-void GDBJITRegistrar::registerObject(const MemoryBuffer &Object) {
+void GDBJITRegistrar::registerObject(const ObjectBuffer &Object) {
const char *Buffer = Object.getBufferStart();
size_t Size = Object.getBufferSize();
@@ -147,7 +147,7 @@
}
}
-bool GDBJITRegistrar::deregisterObject(const MemoryBuffer& Object) {
+bool GDBJITRegistrar::deregisterObject(const ObjectBuffer& Object) {
const char *Buffer = Object.getBufferStart();
RegisteredObjectBufferMap::iterator I = ObjectBufferMap.find(Buffer);
Modified: llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/JITRegistrar.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/JITRegistrar.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/JITRegistrar.h (original)
+++ llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/JITRegistrar.h Thu Oct 11 16:28:00 2012
@@ -10,7 +10,7 @@
#ifndef LLVM_EXECUTION_ENGINE_JIT_REGISTRAR_H
#define LLVM_EXECUTION_ENGINE_JIT_REGISTRAR_H
-#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/ExecutionEngine/ObjectBuffer.h"
namespace llvm {
@@ -27,12 +27,12 @@
/// Creates an entry in the JIT registry for the buffer @p Object,
/// which must contain an object file in executable memory with any
/// debug information for the debugger.
- virtual void registerObject(const MemoryBuffer &Object) = 0;
+ virtual void registerObject(const ObjectBuffer &Object) = 0;
/// Removes the internal registration of @p Object, and
/// frees associated resources.
/// Returns true if @p Object was previously registered.
- virtual bool deregisterObject(const MemoryBuffer &Object) = 0;
+ virtual bool deregisterObject(const ObjectBuffer &Object) = 0;
/// Returns a reference to a GDB JIT registrar singleton
static JITRegistrar& getGDBRegistrar();
Removed: llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImage.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImage.h?rev=165747&view=auto
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImage.h (original)
+++ llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImage.h (removed)
@@ -1,59 +0,0 @@
-//===---- ObjectImage.h - Format independent executuable object image -----===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares a file format independent ObjectImage class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_RUNTIMEDYLD_OBJECT_IMAGE_H
-#define LLVM_RUNTIMEDYLD_OBJECT_IMAGE_H
-
-#include "llvm/Object/ObjectFile.h"
-
-namespace llvm {
-
-class ObjectImage {
- ObjectImage() LLVM_DELETED_FUNCTION;
- ObjectImage(const ObjectImage &other) LLVM_DELETED_FUNCTION;
-protected:
- object::ObjectFile *ObjFile;
-
-public:
- ObjectImage(object::ObjectFile *Obj) { ObjFile = Obj; }
- virtual ~ObjectImage() {}
-
- virtual object::symbol_iterator begin_symbols() const
- { return ObjFile->begin_symbols(); }
- virtual object::symbol_iterator end_symbols() const
- { return ObjFile->end_symbols(); }
-
- virtual object::section_iterator begin_sections() const
- { return ObjFile->begin_sections(); }
- virtual object::section_iterator end_sections() const
- { return ObjFile->end_sections(); }
-
- virtual /* Triple::ArchType */ unsigned getArch() const
- { return ObjFile->getArch(); }
-
- // Subclasses can override these methods to update the image with loaded
- // addresses for sections and common symbols
- virtual void updateSectionAddress(const object::SectionRef &Sec,
- uint64_t Addr) {}
- virtual void updateSymbolAddress(const object::SymbolRef &Sym, uint64_t Addr)
- {}
-
- // Subclasses can override these methods to provide JIT debugging support
- virtual void registerWithDebugger() {}
- virtual void deregisterWithDebugger() {}
-};
-
-} // end namespace llvm
-
-#endif // LLVM_RUNTIMEDYLD_OBJECT_IMAGE_H
-
Copied: llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h (from r165622, llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImage.h)
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h?p2=llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h&p1=llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImage.h&r1=165622&r2=165748&rev=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImage.h (original)
+++ llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h Thu Oct 11 16:28:00 2012
@@ -1,59 +1,76 @@
-//===---- ObjectImage.h - Format independent executuable object image -----===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares a file format independent ObjectImage class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_RUNTIMEDYLD_OBJECT_IMAGE_H
-#define LLVM_RUNTIMEDYLD_OBJECT_IMAGE_H
-
-#include "llvm/Object/ObjectFile.h"
-
-namespace llvm {
-
-class ObjectImage {
- ObjectImage() LLVM_DELETED_FUNCTION;
- ObjectImage(const ObjectImage &other) LLVM_DELETED_FUNCTION;
-protected:
- object::ObjectFile *ObjFile;
-
-public:
- ObjectImage(object::ObjectFile *Obj) { ObjFile = Obj; }
- virtual ~ObjectImage() {}
-
- virtual object::symbol_iterator begin_symbols() const
- { return ObjFile->begin_symbols(); }
- virtual object::symbol_iterator end_symbols() const
- { return ObjFile->end_symbols(); }
-
- virtual object::section_iterator begin_sections() const
- { return ObjFile->begin_sections(); }
- virtual object::section_iterator end_sections() const
- { return ObjFile->end_sections(); }
-
- virtual /* Triple::ArchType */ unsigned getArch() const
- { return ObjFile->getArch(); }
-
- // Subclasses can override these methods to update the image with loaded
- // addresses for sections and common symbols
- virtual void updateSectionAddress(const object::SectionRef &Sec,
- uint64_t Addr) {}
- virtual void updateSymbolAddress(const object::SymbolRef &Sym, uint64_t Addr)
- {}
-
- // Subclasses can override these methods to provide JIT debugging support
- virtual void registerWithDebugger() {}
- virtual void deregisterWithDebugger() {}
-};
-
-} // end namespace llvm
-
-#endif // LLVM_RUNTIMEDYLD_OBJECT_IMAGE_H
-
+//===-- ObjectImageCommon.h - Format independent executuable object image -===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares a file format independent ObjectImage class.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_RUNTIMEDYLD_OBJECTIMAGECOMMON_H
+#define LLVM_RUNTIMEDYLD_OBJECTIMAGECOMMON_H
+
+#include "llvm/Object/ObjectFile.h"
+#include "llvm/ExecutionEngine/ObjectImage.h"
+#include "llvm/ExecutionEngine/ObjectBuffer.h"
+
+namespace llvm {
+
+class ObjectImageCommon : public ObjectImage {
+ ObjectImageCommon(); // = delete
+ ObjectImageCommon(const ObjectImageCommon &other); // = delete
+
+protected:
+ object::ObjectFile *ObjFile;
+
+ // This form of the constructor allows subclasses to use
+ // format-specific subclasses of ObjectFile directly
+ ObjectImageCommon(ObjectBuffer *Input, object::ObjectFile *Obj)
+ : ObjectImage(Input), // saves Input as Buffer and takes ownership
+ ObjFile(Obj)
+ {
+ }
+
+public:
+ ObjectImageCommon(ObjectBuffer* Input)
+ : ObjectImage(Input) // saves Input as Buffer and takes ownership
+ {
+ ObjFile = object::ObjectFile::createObjectFile(Buffer->getMemBuffer());
+ }
+ virtual ~ObjectImageCommon() { delete ObjFile; }
+
+ virtual object::symbol_iterator begin_symbols() const
+ { return ObjFile->begin_symbols(); }
+ virtual object::symbol_iterator end_symbols() const
+ { return ObjFile->end_symbols(); }
+
+ virtual object::section_iterator begin_sections() const
+ { return ObjFile->begin_sections(); }
+ virtual object::section_iterator end_sections() const
+ { return ObjFile->end_sections(); }
+
+ virtual /* Triple::ArchType */ unsigned getArch() const
+ { return ObjFile->getArch(); }
+
+ virtual StringRef getData() const { return ObjFile->getData(); }
+
+ // Subclasses can override these methods to update the image with loaded
+ // addresses for sections and common symbols
+ virtual void updateSectionAddress(const object::SectionRef &Sec,
+ uint64_t Addr) {}
+ virtual void updateSymbolAddress(const object::SymbolRef &Sym, uint64_t Addr)
+ {}
+
+ // Subclasses can override these methods to provide JIT debugging support
+ virtual void registerWithDebugger() {}
+ virtual void deregisterWithDebugger() {}
+};
+
+} // end namespace llvm
+
+#endif // LLVM_RUNTIMEDYLD_OBJECT_IMAGE_H
+
Modified: llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp (original)
+++ llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp Thu Oct 11 16:28:00 2012
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "dyld"
+#include "ObjectImageCommon.h"
#include "RuntimeDyldImpl.h"
#include "RuntimeDyldELF.h"
#include "RuntimeDyldMachO.h"
@@ -61,14 +62,11 @@
// Subclasses can implement this method to create specialized image instances.
// The caller owns the pointer that is returned.
-ObjectImage *RuntimeDyldImpl::createObjectImage(const MemoryBuffer *InputBuffer) {
- ObjectFile *ObjFile = ObjectFile::createObjectFile(const_cast<MemoryBuffer*>
- (InputBuffer));
- ObjectImage *Obj = new ObjectImage(ObjFile);
- return Obj;
+ObjectImage *RuntimeDyldImpl::createObjectImage(ObjectBuffer *InputBuffer) {
+ return new ObjectImageCommon(InputBuffer);
}
-bool RuntimeDyldImpl::loadObject(const MemoryBuffer *InputBuffer) {
+ObjectImage *RuntimeDyldImpl::loadObject(ObjectBuffer *InputBuffer) {
OwningPtr<ObjectImage> obj(createObjectImage(InputBuffer));
if (!obj)
report_fatal_error("Unable to create object image from memory buffer!");
@@ -178,9 +176,7 @@
}
}
- handleObjectLoaded(obj.take());
-
- return false;
+ return obj.take();
}
void RuntimeDyldImpl::emitCommonSymbols(ObjectImage &Obj,
@@ -437,7 +433,7 @@
delete Dyld;
}
-bool RuntimeDyld::loadObject(MemoryBuffer *InputBuffer) {
+ObjectImage *RuntimeDyld::loadObject(ObjectBuffer *InputBuffer) {
if (!Dyld) {
sys::LLVMFileType type = sys::IdentifyFileType(
InputBuffer->getBufferStart(),
Modified: llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp (original)
+++ llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp Thu Oct 11 16:28:00 2012
@@ -12,16 +12,19 @@
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "dyld"
+#include "RuntimeDyldELF.h"
+#include "JITRegistrar.h"
+#include "ObjectImageCommon.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/IntervalMap.h"
-#include "RuntimeDyldELF.h"
#include "llvm/Object/ObjectFile.h"
+#include "llvm/ExecutionEngine/ObjectImage.h"
+#include "llvm/ExecutionEngine/ObjectBuffer.h"
#include "llvm/Support/ELF.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Object/ELF.h"
-#include "JITRegistrar.h"
using namespace llvm;
using namespace llvm::object;
@@ -41,19 +44,12 @@
typedef typename ELFDataTypeTypedefHelper<
target_endianness, is64Bits>::value_type addr_type;
-protected:
- // This duplicates the 'Data' member in the 'Binary' base class
- // but it is necessary to workaround a bug in gcc 4.2
- MemoryBuffer *InputData;
-
public:
- DyldELFObject(MemoryBuffer *Object, error_code &ec);
+ DyldELFObject(MemoryBuffer *Wrapper, error_code &ec);
void updateSectionAddress(const SectionRef &Sec, uint64_t Addr);
void updateSymbolAddress(const SymbolRef &Sym, uint64_t Addr);
- const MemoryBuffer& getBuffer() const { return *InputData; }
-
// Methods for type inquiry through isa, cast and dyn_cast
static inline bool classof(const Binary *v) {
return (isa<ELFObjectFile<target_endianness, is64Bits> >(v)
@@ -69,14 +65,15 @@
};
template<support::endianness target_endianness, bool is64Bits>
-class ELFObjectImage : public ObjectImage {
+class ELFObjectImage : public ObjectImageCommon {
protected:
DyldELFObject<target_endianness, is64Bits> *DyldObj;
bool Registered;
public:
- ELFObjectImage(DyldELFObject<target_endianness, is64Bits> *Obj)
- : ObjectImage(Obj),
+ ELFObjectImage(ObjectBuffer *Input,
+ DyldELFObject<target_endianness, is64Bits> *Obj)
+ : ObjectImageCommon(Input, Obj),
DyldObj(Obj),
Registered(false) {}
@@ -99,20 +96,22 @@
virtual void registerWithDebugger()
{
- JITRegistrar::getGDBRegistrar().registerObject(DyldObj->getBuffer());
+ JITRegistrar::getGDBRegistrar().registerObject(*Buffer);
Registered = true;
}
virtual void deregisterWithDebugger()
{
- JITRegistrar::getGDBRegistrar().deregisterObject(DyldObj->getBuffer());
+ JITRegistrar::getGDBRegistrar().deregisterObject(*Buffer);
}
};
+// The MemoryBuffer passed into this constructor is just a wrapper around the
+// actual memory. Ultimately, the Binary parent class will take ownership of
+// this MemoryBuffer object but not the underlying memory.
template<support::endianness target_endianness, bool is64Bits>
-DyldELFObject<target_endianness, is64Bits>::DyldELFObject(MemoryBuffer *Object,
+DyldELFObject<target_endianness, is64Bits>::DyldELFObject(MemoryBuffer *Wrapper,
error_code &ec)
- : ELFObjectFile<target_endianness, is64Bits>(Object, ec),
- InputData(Object) {
+ : ELFObjectFile<target_endianness, is64Bits>(Wrapper, ec) {
this->isDyldELFObject = true;
}
@@ -148,46 +147,39 @@
namespace llvm {
-ObjectImage *RuntimeDyldELF::createObjectImage(
- const MemoryBuffer *ConstInputBuffer) {
- MemoryBuffer *InputBuffer = const_cast<MemoryBuffer*>(ConstInputBuffer);
- std::pair<unsigned char, unsigned char> Ident = getElfArchType(InputBuffer);
+ObjectImage *RuntimeDyldELF::createObjectImage(ObjectBuffer *Buffer) {
+ if (Buffer->getBufferSize() < ELF::EI_NIDENT)
+ llvm_unreachable("Unexpected ELF object size");
+ std::pair<unsigned char, unsigned char> Ident = std::make_pair(
+ (uint8_t)Buffer->getBufferStart()[ELF::EI_CLASS],
+ (uint8_t)Buffer->getBufferStart()[ELF::EI_DATA]);
error_code ec;
if (Ident.first == ELF::ELFCLASS32 && Ident.second == ELF::ELFDATA2LSB) {
DyldELFObject<support::little, false> *Obj =
- new DyldELFObject<support::little, false>(InputBuffer, ec);
- return new ELFObjectImage<support::little, false>(Obj);
+ new DyldELFObject<support::little, false>(Buffer->getMemBuffer(), ec);
+ return new ELFObjectImage<support::little, false>(Buffer, Obj);
}
else if (Ident.first == ELF::ELFCLASS32 && Ident.second == ELF::ELFDATA2MSB) {
DyldELFObject<support::big, false> *Obj =
- new DyldELFObject<support::big, false>(InputBuffer, ec);
- return new ELFObjectImage<support::big, false>(Obj);
+ new DyldELFObject<support::big, false>(Buffer->getMemBuffer(), ec);
+ return new ELFObjectImage<support::big, false>(Buffer, Obj);
}
else if (Ident.first == ELF::ELFCLASS64 && Ident.second == ELF::ELFDATA2MSB) {
DyldELFObject<support::big, true> *Obj =
- new DyldELFObject<support::big, true>(InputBuffer, ec);
- return new ELFObjectImage<support::big, true>(Obj);
+ new DyldELFObject<support::big, true>(Buffer->getMemBuffer(), ec);
+ return new ELFObjectImage<support::big, true>(Buffer, Obj);
}
else if (Ident.first == ELF::ELFCLASS64 && Ident.second == ELF::ELFDATA2LSB) {
DyldELFObject<support::little, true> *Obj =
- new DyldELFObject<support::little, true>(InputBuffer, ec);
- return new ELFObjectImage<support::little, true>(Obj);
+ new DyldELFObject<support::little, true>(Buffer->getMemBuffer(), ec);
+ return new ELFObjectImage<support::little, true>(Buffer, Obj);
}
else
llvm_unreachable("Unexpected ELF format");
}
-void RuntimeDyldELF::handleObjectLoaded(ObjectImage *Obj)
-{
- Obj->registerWithDebugger();
- // Save the loaded object. It will deregister itself when deleted
- LoadedObject = Obj;
-}
-
RuntimeDyldELF::~RuntimeDyldELF() {
- if (LoadedObject)
- delete LoadedObject;
}
void RuntimeDyldELF::resolveX86_64Relocation(uint8_t *LocalAddress,
@@ -272,14 +264,19 @@
default:
llvm_unreachable("Not implemented relocation type!");
- // Just write 32bit value to relocation address
+ // Write a 32bit value to relocation address, taking into account the
+ // implicit addend encoded in the target.
case ELF::R_ARM_ABS32 :
- *TargetPtr = Value;
+ *TargetPtr += Value;
break;
// Write first 16 bit of 32 bit value to the mov instruction.
// Last 4 bit should be shifted.
case ELF::R_ARM_MOVW_ABS_NC :
+ // We are not expecting any other addend in the relocation address.
+ // Using 0x000F0FFF because MOVW has its 16 bit immediate split into 2
+ // non-contiguous fields.
+ assert((*TargetPtr & 0x000F0FFF) == 0);
Value = Value & 0xFFFF;
*TargetPtr |= Value & 0xFFF;
*TargetPtr |= ((Value >> 12) & 0xF) << 16;
@@ -288,6 +285,9 @@
// Write last 16 bit of 32 bit value to the mov instruction.
// Last 4 bit should be shifted.
case ELF::R_ARM_MOVT_ABS :
+ // We are not expecting any other addend in the relocation address.
+ // Use 0x000F0FFF for the same reason as R_ARM_MOVW_ABS_NC.
+ assert((*TargetPtr & 0x000F0FFF) == 0);
Value = (Value >> 16) & 0xFFFF;
*TargetPtr |= Value & 0xFFF;
*TargetPtr |= ((Value >> 12) & 0xF) << 16;
@@ -522,8 +522,9 @@
}
}
-bool RuntimeDyldELF::isCompatibleFormat(const MemoryBuffer *InputBuffer) const {
- StringRef Magic = InputBuffer->getBuffer().slice(0, ELF::EI_NIDENT);
- return (memcmp(Magic.data(), ELF::ElfMagic, strlen(ELF::ElfMagic))) == 0;
+bool RuntimeDyldELF::isCompatibleFormat(const ObjectBuffer *Buffer) const {
+ if (Buffer->getBufferSize() < strlen(ELF::ElfMagic))
+ return false;
+ return (memcmp(Buffer->getBufferStart(), ELF::ElfMagic, strlen(ELF::ElfMagic))) == 0;
}
} // namespace llvm
Modified: llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h (original)
+++ llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h Thu Oct 11 16:28:00 2012
@@ -22,8 +22,6 @@
namespace llvm {
class RuntimeDyldELF : public RuntimeDyldImpl {
protected:
- ObjectImage *LoadedObject;
-
void resolveX86_64Relocation(uint8_t *LocalAddress,
uint64_t FinalAddress,
uint64_t Value,
@@ -60,16 +58,15 @@
const SymbolTableMap &Symbols,
StubMap &Stubs);
- virtual ObjectImage *createObjectImage(const MemoryBuffer *InputBuffer);
- virtual void handleObjectLoaded(ObjectImage *Obj);
+ virtual ObjectImage *createObjectImage(ObjectBuffer *InputBuffer);
public:
RuntimeDyldELF(RTDyldMemoryManager *mm)
- : RuntimeDyldImpl(mm), LoadedObject(0) {}
+ : RuntimeDyldImpl(mm) {}
virtual ~RuntimeDyldELF();
- bool isCompatibleFormat(const MemoryBuffer *InputBuffer) const;
+ bool isCompatibleFormat(const ObjectBuffer *Buffer) const;
};
} // end namespace llvm
Modified: llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h (original)
+++ llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h Thu Oct 11 16:28:00 2012
@@ -14,8 +14,8 @@
#ifndef LLVM_RUNTIME_DYLD_IMPL_H
#define LLVM_RUNTIME_DYLD_IMPL_H
-#include "ObjectImage.h"
#include "llvm/ExecutionEngine/RuntimeDyld.h"
+#include "llvm/ExecutionEngine/ObjectImage.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
@@ -33,7 +33,7 @@
namespace llvm {
-class MemoryBuffer;
+class ObjectBuffer;
class Twine;
@@ -251,19 +251,13 @@
/// \brief Resolve relocations to external symbols.
void resolveExternalSymbols();
- virtual ObjectImage *createObjectImage(const MemoryBuffer *InputBuffer);
- virtual void handleObjectLoaded(ObjectImage *Obj)
- {
- // Subclasses may choose to retain this image if they have a use for it
- delete Obj;
- }
-
+ virtual ObjectImage *createObjectImage(ObjectBuffer *InputBuffer);
public:
RuntimeDyldImpl(RTDyldMemoryManager *mm) : MemMgr(mm), HasError(false) {}
virtual ~RuntimeDyldImpl();
- bool loadObject(const MemoryBuffer *InputBuffer);
+ ObjectImage *loadObject(ObjectBuffer *InputBuffer);
void *getSymbolAddress(StringRef Name) {
// FIXME: Just look up as a function for now. Overly simple of course.
@@ -298,8 +292,7 @@
// Get the error message.
StringRef getErrorString() { return ErrorStr; }
- virtual bool isCompatibleFormat(const MemoryBuffer *InputBuffer) const = 0;
-
+ virtual bool isCompatibleFormat(const ObjectBuffer *Buffer) const = 0;
};
} // end namespace llvm
Modified: llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp (original)
+++ llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp Thu Oct 11 16:28:00 2012
@@ -295,8 +295,10 @@
bool RuntimeDyldMachO::isCompatibleFormat(
- const MemoryBuffer *InputBuffer) const {
- StringRef Magic = InputBuffer->getBuffer().slice(0, 4);
+ const ObjectBuffer *InputBuffer) const {
+ if (InputBuffer->getBufferSize() < 4)
+ return false;
+ StringRef Magic(InputBuffer->getBufferStart(), 4);
if (Magic == "\xFE\xED\xFA\xCE") return true;
if (Magic == "\xCE\xFA\xED\xFE") return true;
if (Magic == "\xFE\xED\xFA\xCF") return true;
Modified: llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h (original)
+++ llvm/branches/R600/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h Thu Oct 11 16:28:00 2012
@@ -63,7 +63,7 @@
RuntimeDyldMachO(RTDyldMemoryManager *mm) : RuntimeDyldImpl(mm) {}
- bool isCompatibleFormat(const MemoryBuffer *InputBuffer) const;
+ bool isCompatibleFormat(const ObjectBuffer *Buffer) const;
};
} // end namespace llvm
Modified: llvm/branches/R600/lib/ExecutionEngine/TargetSelect.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/ExecutionEngine/TargetSelect.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/ExecutionEngine/TargetSelect.cpp (original)
+++ llvm/branches/R600/lib/ExecutionEngine/TargetSelect.cpp Thu Oct 11 16:28:00 2012
@@ -26,7 +26,14 @@
using namespace llvm;
TargetMachine *EngineBuilder::selectTarget() {
- Triple TT(LLVM_HOSTTRIPLE);
+ Triple TT;
+
+ // MCJIT can generate code for remote targets, but the old JIT and Interpreter
+ // must use the host architecture.
+ if (UseMCJIT && WhichEngine != EngineKind::Interpreter && M)
+ TT.setTriple(M->getTargetTriple());
+ else
+ TT.setTriple(LLVM_HOSTTRIPLE);
return selectTarget(TT, MArch, MCPU, MAttrs);
}
Modified: llvm/branches/R600/lib/MC/MCELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/MC/MCELFStreamer.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/MC/MCELFStreamer.cpp (original)
+++ llvm/branches/R600/lib/MC/MCELFStreamer.cpp Thu Oct 11 16:28:00 2012
@@ -98,12 +98,6 @@
uint64_t Size, unsigned ByteAlignment = 0) {
llvm_unreachable("ELF doesn't support this directive");
}
- virtual void EmitBytes(StringRef Data, unsigned AddrSpace);
- virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
- unsigned ValueSize = 1,
- unsigned MaxBytesToEmit = 0);
- virtual void EmitCodeAlignment(unsigned ByteAlignment,
- unsigned MaxBytesToEmit = 0);
virtual void EmitValueImpl(const MCExpr *Value, unsigned Size,
unsigned AddrSpace);
@@ -355,42 +349,6 @@
EmitCommonSymbol(Symbol, Size, ByteAlignment);
}
-void MCELFStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) {
- // TODO: This is exactly the same as WinCOFFStreamer. Consider merging into
- // MCObjectStreamer.
- getOrCreateDataFragment()->getContents().append(Data.begin(), Data.end());
-}
-
-void MCELFStreamer::EmitValueToAlignment(unsigned ByteAlignment,
- int64_t Value, unsigned ValueSize,
- unsigned MaxBytesToEmit) {
- // TODO: This is exactly the same as WinCOFFStreamer. Consider merging into
- // MCObjectStreamer.
- if (MaxBytesToEmit == 0)
- MaxBytesToEmit = ByteAlignment;
- new MCAlignFragment(ByteAlignment, Value, ValueSize, MaxBytesToEmit,
- getCurrentSectionData());
-
- // Update the maximum alignment on the current section if necessary.
- if (ByteAlignment > getCurrentSectionData()->getAlignment())
- getCurrentSectionData()->setAlignment(ByteAlignment);
-}
-
-void MCELFStreamer::EmitCodeAlignment(unsigned ByteAlignment,
- unsigned MaxBytesToEmit) {
- // TODO: This is exactly the same as WinCOFFStreamer. Consider merging into
- // MCObjectStreamer.
- if (MaxBytesToEmit == 0)
- MaxBytesToEmit = ByteAlignment;
- MCAlignFragment *F = new MCAlignFragment(ByteAlignment, 0, 1, MaxBytesToEmit,
- getCurrentSectionData());
- F->setEmitNops(true);
-
- // Update the maximum alignment on the current section if necessary.
- if (ByteAlignment > getCurrentSectionData()->getAlignment())
- getCurrentSectionData()->setAlignment(ByteAlignment);
-}
-
void MCELFStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
unsigned AddrSpace) {
fixSymbolsInTLSFixups(Value);
Modified: llvm/branches/R600/lib/MC/MCMachOStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/MC/MCMachOStreamer.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/MC/MCMachOStreamer.cpp (original)
+++ llvm/branches/R600/lib/MC/MCMachOStreamer.cpp Thu Oct 11 16:28:00 2012
@@ -75,12 +75,6 @@
uint64_t Size = 0, unsigned ByteAlignment = 0);
virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment = 0);
- virtual void EmitBytes(StringRef Data, unsigned AddrSpace);
- virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
- unsigned ValueSize = 1,
- unsigned MaxBytesToEmit = 0);
- virtual void EmitCodeAlignment(unsigned ByteAlignment,
- unsigned MaxBytesToEmit = 0);
virtual void EmitFileDirective(StringRef Filename) {
// FIXME: Just ignore the .file; it isn't important enough to fail the
@@ -372,42 +366,6 @@
return;
}
-void MCMachOStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) {
- // TODO: This is exactly the same as WinCOFFStreamer. Consider merging into
- // MCObjectStreamer.
- getOrCreateDataFragment()->getContents().append(Data.begin(), Data.end());
-}
-
-void MCMachOStreamer::EmitValueToAlignment(unsigned ByteAlignment,
- int64_t Value, unsigned ValueSize,
- unsigned MaxBytesToEmit) {
- // TODO: This is exactly the same as WinCOFFStreamer. Consider merging into
- // MCObjectStreamer.
- if (MaxBytesToEmit == 0)
- MaxBytesToEmit = ByteAlignment;
- new MCAlignFragment(ByteAlignment, Value, ValueSize, MaxBytesToEmit,
- getCurrentSectionData());
-
- // Update the maximum alignment on the current section if necessary.
- if (ByteAlignment > getCurrentSectionData()->getAlignment())
- getCurrentSectionData()->setAlignment(ByteAlignment);
-}
-
-void MCMachOStreamer::EmitCodeAlignment(unsigned ByteAlignment,
- unsigned MaxBytesToEmit) {
- // TODO: This is exactly the same as WinCOFFStreamer. Consider merging into
- // MCObjectStreamer.
- if (MaxBytesToEmit == 0)
- MaxBytesToEmit = ByteAlignment;
- MCAlignFragment *F = new MCAlignFragment(ByteAlignment, 0, 1, MaxBytesToEmit,
- getCurrentSectionData());
- F->setEmitNops(true);
-
- // Update the maximum alignment on the current section if necessary.
- if (ByteAlignment > getCurrentSectionData()->getAlignment())
- getCurrentSectionData()->setAlignment(ByteAlignment);
-}
-
void MCMachOStreamer::EmitInstToData(const MCInst &Inst) {
MCDataFragment *DF = getOrCreateDataFragment();
Modified: llvm/branches/R600/lib/MC/MCObjectFileInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/MC/MCObjectFileInfo.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/MC/MCObjectFileInfo.cpp (original)
+++ llvm/branches/R600/lib/MC/MCObjectFileInfo.cpp Thu Oct 11 16:28:00 2012
@@ -392,6 +392,18 @@
DwarfMacroInfoSection =
Ctx->getELFSection(".debug_macinfo", ELF::SHT_PROGBITS, 0,
SectionKind::getMetadata());
+ DwarfAccelNamesSection =
+ Ctx->getELFSection(".apple_names", ELF::SHT_PROGBITS, 0,
+ SectionKind::getMetadata());
+ DwarfAccelObjCSection =
+ Ctx->getELFSection(".apple_objc", ELF::SHT_PROGBITS, 0,
+ SectionKind::getMetadata());
+ DwarfAccelNamespaceSection =
+ Ctx->getELFSection(".apple_namespaces", ELF::SHT_PROGBITS, 0,
+ SectionKind::getMetadata());
+ DwarfAccelTypesSection =
+ Ctx->getELFSection(".apple_types", ELF::SHT_PROGBITS, 0,
+ SectionKind::getMetadata());
}
@@ -565,6 +577,7 @@
Env = IsMachO;
InitMachOMCObjectFileInfo(T);
} else if ((Arch == Triple::x86 || Arch == Triple::x86_64) &&
+ (T.getEnvironment() != Triple::ELF) &&
(T.getOS() == Triple::MinGW32 || T.getOS() == Triple::Cygwin ||
T.getOS() == Triple::Win32)) {
Env = IsCOFF;
Modified: llvm/branches/R600/lib/MC/MCObjectStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/MC/MCObjectStreamer.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/MC/MCObjectStreamer.cpp (original)
+++ llvm/branches/R600/lib/MC/MCObjectStreamer.cpp Thu Oct 11 16:28:00 2012
@@ -232,6 +232,31 @@
new MCDwarfCallFrameFragment(*AddrDelta, getCurrentSectionData());
}
+void MCObjectStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) {
+ assert(AddrSpace == 0 && "Address space must be 0!");
+ getOrCreateDataFragment()->getContents().append(Data.begin(), Data.end());
+}
+
+void MCObjectStreamer::EmitValueToAlignment(unsigned ByteAlignment,
+ int64_t Value,
+ unsigned ValueSize,
+ unsigned MaxBytesToEmit) {
+ if (MaxBytesToEmit == 0)
+ MaxBytesToEmit = ByteAlignment;
+ new MCAlignFragment(ByteAlignment, Value, ValueSize, MaxBytesToEmit,
+ getCurrentSectionData());
+
+ // Update the maximum alignment on the current section if necessary.
+ if (ByteAlignment > getCurrentSectionData()->getAlignment())
+ getCurrentSectionData()->setAlignment(ByteAlignment);
+}
+
+void MCObjectStreamer::EmitCodeAlignment(unsigned ByteAlignment,
+ unsigned MaxBytesToEmit) {
+ EmitValueToAlignment(ByteAlignment, 0, 1, MaxBytesToEmit);
+ cast<MCAlignFragment>(getCurrentFragment())->setEmitNops(true);
+}
+
bool MCObjectStreamer::EmitValueToOffset(const MCExpr *Offset,
unsigned char Value) {
int64_t Res;
Modified: llvm/branches/R600/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/MC/MCParser/AsmParser.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/branches/R600/lib/MC/MCParser/AsmParser.cpp Thu Oct 11 16:28:00 2012
@@ -1030,9 +1030,6 @@
}
}
-
-
-
/// ParseStatement:
/// ::= EndOfStatement
/// ::= Label* Directive ...Operands... EndOfStatement
Modified: llvm/branches/R600/lib/MC/MCSubtargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/MC/MCSubtargetInfo.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/MC/MCSubtargetInfo.cpp (original)
+++ llvm/branches/R600/lib/MC/MCSubtargetInfo.cpp Thu Oct 11 16:28:00 2012
@@ -19,7 +19,7 @@
MCSchedModel MCSchedModel::DefaultSchedModel; // For unknown processors.
-/// ReInitMCSubtargetInfo - Set or change the CPU (optionally supplemented
+/// InitMCProcessorInfo - Set or change the CPU (optionally supplemented
/// with feature string). Recompute feature bits and scheduling model.
void
MCSubtargetInfo::InitMCProcessorInfo(StringRef CPU, StringRef FS) {
Modified: llvm/branches/R600/lib/MC/SubtargetFeature.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/MC/SubtargetFeature.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/MC/SubtargetFeature.cpp (original)
+++ llvm/branches/R600/lib/MC/SubtargetFeature.cpp Thu Oct 11 16:28:00 2012
@@ -119,14 +119,15 @@
}
/// Find KV in array using binary search.
-template<typename T> const T *Find(const StringRef S, const T *A, size_t L) {
+const SubtargetFeatureKV *Find(const StringRef S, const SubtargetFeatureKV *A,
+ size_t L) {
// Make the lower bound element we're looking for
- T KV;
+ SubtargetFeatureKV KV;
KV.Key = S.data();
// Determine the end of the array
- const T *Hi = A + L;
+ const SubtargetFeatureKV *Hi = A + L;
// Binary search the array
- const T *F = std::lower_bound(A, Hi, KV);
+ const SubtargetFeatureKV *F = std::lower_bound(A, Hi, KV);
// If not found then return NULL
if (F == Hi || StringRef(F->Key) != S) return NULL;
// Return the found array item
@@ -336,30 +337,6 @@
return Bits;
}
-/// Get scheduling itinerary of a CPU.
-const void *SubtargetFeatures::getItinerary(const StringRef CPU,
- const SubtargetInfoKV *Table,
- size_t TableSize) {
- assert(Table && "missing table");
-#ifndef NDEBUG
- for (size_t i = 1; i < TableSize; i++) {
- assert(strcmp(Table[i - 1].Key, Table[i].Key) < 0 && "Table is not sorted");
- }
-#endif
-
- // Find entry
- const SubtargetInfoKV *Entry = Find(CPU, Table, TableSize);
-
- if (Entry) {
- return Entry->Value;
- } else {
- errs() << "'" << CPU
- << "' is not a recognized processor for this target"
- << " (ignoring processor)\n";
- return NULL;
- }
-}
-
/// print - Print feature string.
///
void SubtargetFeatures::print(raw_ostream &OS) const {
Modified: llvm/branches/R600/lib/MC/WinCOFFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/MC/WinCOFFStreamer.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/MC/WinCOFFStreamer.cpp (original)
+++ llvm/branches/R600/lib/MC/WinCOFFStreamer.cpp Thu Oct 11 16:28:00 2012
@@ -70,11 +70,6 @@
uint64_t Size,unsigned ByteAlignment);
virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment);
- virtual void EmitBytes(StringRef Data, unsigned AddrSpace);
- virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
- unsigned ValueSize, unsigned MaxBytesToEmit);
- virtual void EmitCodeAlignment(unsigned ByteAlignment,
- unsigned MaxBytesToEmit);
virtual void EmitFileDirective(StringRef Filename);
virtual void EmitInstruction(const MCInst &Instruction);
virtual void EmitWin64EHHandlerData();
@@ -333,43 +328,6 @@
llvm_unreachable("not implemented");
}
-void WinCOFFStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) {
- // TODO: This is copied exactly from the MachOStreamer. Consider merging into
- // MCObjectStreamer?
- getOrCreateDataFragment()->getContents().append(Data.begin(), Data.end());
-}
-
-void WinCOFFStreamer::EmitValueToAlignment(unsigned ByteAlignment,
- int64_t Value,
- unsigned ValueSize,
- unsigned MaxBytesToEmit) {
- // TODO: This is copied exactly from the MachOStreamer. Consider merging into
- // MCObjectStreamer?
- if (MaxBytesToEmit == 0)
- MaxBytesToEmit = ByteAlignment;
- new MCAlignFragment(ByteAlignment, Value, ValueSize, MaxBytesToEmit,
- getCurrentSectionData());
-
- // Update the maximum alignment on the current section if necessary.
- if (ByteAlignment > getCurrentSectionData()->getAlignment())
- getCurrentSectionData()->setAlignment(ByteAlignment);
-}
-
-void WinCOFFStreamer::EmitCodeAlignment(unsigned ByteAlignment,
- unsigned MaxBytesToEmit) {
- // TODO: This is copied exactly from the MachOStreamer. Consider merging into
- // MCObjectStreamer?
- if (MaxBytesToEmit == 0)
- MaxBytesToEmit = ByteAlignment;
- MCAlignFragment *F = new MCAlignFragment(ByteAlignment, 0, 1, MaxBytesToEmit,
- getCurrentSectionData());
- F->setEmitNops(true);
-
- // Update the maximum alignment on the current section if necessary.
- if (ByteAlignment > getCurrentSectionData()->getAlignment())
- getCurrentSectionData()->setAlignment(ByteAlignment);
-}
-
void WinCOFFStreamer::EmitFileDirective(StringRef Filename) {
// Ignore for now, linkers don't care, and proper debug
// info will be a much large effort.
Modified: llvm/branches/R600/lib/Object/COFFObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Object/COFFObjectFile.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Object/COFFObjectFile.cpp (original)
+++ llvm/branches/R600/lib/Object/COFFObjectFile.cpp Thu Oct 11 16:28:00 2012
@@ -372,7 +372,14 @@
error_code COFFObjectFile::isSectionZeroInit(DataRefImpl Sec,
bool &Result) const {
- // FIXME: Unimplemented
+ // FIXME: Unimplemented.
+ Result = false;
+ return object_error::success;
+}
+
+error_code COFFObjectFile::isSectionReadOnlyData(DataRefImpl Sec,
+ bool &Result) const {
+ // FIXME: Unimplemented.
Result = false;
return object_error::success;
}
Modified: llvm/branches/R600/lib/Object/MachOObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Object/MachOObjectFile.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Object/MachOObjectFile.cpp (original)
+++ llvm/branches/R600/lib/Object/MachOObjectFile.cpp Thu Oct 11 16:28:00 2012
@@ -581,14 +581,14 @@
error_code MachOObjectFile::isSectionRequiredForExecution(DataRefImpl Sec,
bool &Result) const {
- // FIXME: Unimplemented
+ // FIXME: Unimplemented.
Result = true;
return object_error::success;
}
error_code MachOObjectFile::isSectionVirtual(DataRefImpl Sec,
- bool &Result) const {
- // FIXME: Unimplemented
+ bool &Result) const {
+ // FIXME: Unimplemented.
Result = false;
return object_error::success;
}
@@ -612,6 +612,17 @@
return object_error::success;
}
+error_code MachOObjectFile::isSectionReadOnlyData(DataRefImpl Sec,
+ bool &Result) const {
+ // Consider using the code from isSectionText to look for __const sections.
+ // Alternately, emit S_ATTR_PURE_INSTRUCTIONS and/or S_ATTR_SOME_INSTRUCTIONS
+ // to use section attributes to distinguish code from data.
+
+ // FIXME: Unimplemented.
+ Result = false;
+ return object_error::success;
+}
+
error_code MachOObjectFile::sectionContainsSymbol(DataRefImpl Sec,
DataRefImpl Symb,
bool &Result) const {
Modified: llvm/branches/R600/lib/Support/CommandLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Support/CommandLine.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Support/CommandLine.cpp (original)
+++ llvm/branches/R600/lib/Support/CommandLine.cpp Thu Oct 11 16:28:00 2012
@@ -464,7 +464,7 @@
/// an environment variable (whose name is given in ENVVAR).
///
void cl::ParseEnvironmentOptions(const char *progName, const char *envVar,
- const char *Overview, bool ReadResponseFiles) {
+ const char *Overview) {
// Check args.
assert(progName && "Program name not specified");
assert(envVar && "Environment variable name missing");
@@ -483,7 +483,7 @@
// and hand it off to ParseCommandLineOptions().
ParseCStringVector(newArgv, envValue);
int newArgc = static_cast<int>(newArgv.size());
- ParseCommandLineOptions(newArgc, &newArgv[0], Overview, ReadResponseFiles);
+ ParseCommandLineOptions(newArgc, &newArgv[0], Overview);
// Free all the strdup()ed strings.
for (std::vector<char*>::iterator i = newArgv.begin(), e = newArgv.end();
@@ -529,7 +529,7 @@
}
void cl::ParseCommandLineOptions(int argc, const char * const *argv,
- const char *Overview, bool ReadResponseFiles) {
+ const char *Overview) {
// Process all registered options.
SmallVector<Option*, 4> PositionalOpts;
SmallVector<Option*, 4> SinkOpts;
@@ -541,12 +541,10 @@
// Expand response files.
std::vector<char*> newArgv;
- if (ReadResponseFiles) {
- newArgv.push_back(strdup(argv[0]));
- ExpandResponseFiles(argc, argv, newArgv);
- argv = &newArgv[0];
- argc = static_cast<int>(newArgv.size());
- }
+ newArgv.push_back(strdup(argv[0]));
+ ExpandResponseFiles(argc, argv, newArgv);
+ argv = &newArgv[0];
+ argc = static_cast<int>(newArgv.size());
// Copy the program name into ProgName, making sure not to overflow it.
std::string ProgName = sys::path::filename(argv[0]);
@@ -839,12 +837,10 @@
MoreHelp->clear();
// Free the memory allocated by ExpandResponseFiles.
- if (ReadResponseFiles) {
- // Free all the strdup()ed strings.
- for (std::vector<char*>::iterator i = newArgv.begin(), e = newArgv.end();
- i != e; ++i)
- free(*i);
- }
+ // Free all the strdup()ed strings.
+ for (std::vector<char*>::iterator i = newArgv.begin(), e = newArgv.end();
+ i != e; ++i)
+ free(*i);
// If we had an error processing our arguments, don't let the program execute
if (ErrorParsing) exit(1);
Modified: llvm/branches/R600/lib/Support/StringRef.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Support/StringRef.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Support/StringRef.cpp (original)
+++ llvm/branches/R600/lib/Support/StringRef.cpp Thu Oct 11 16:28:00 2012
@@ -350,8 +350,8 @@
unsigned long long PrevResult = Result;
Result = Result*Radix+CharVal;
- // Check for overflow.
- if (Result < PrevResult)
+ // Check for overflow by shifting back and seeing if bits were lost.
+ if (Result/Radix < PrevResult)
return true;
Str = Str.substr(1);
Modified: llvm/branches/R600/lib/Support/Triple.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Support/Triple.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Support/Triple.cpp (original)
+++ llvm/branches/R600/lib/Support/Triple.cpp Thu Oct 11 16:28:00 2012
@@ -142,6 +142,7 @@
case EABI: return "eabi";
case MachO: return "macho";
case Android: return "android";
+ case ELF: return "elf";
}
llvm_unreachable("Invalid EnvironmentType!");
@@ -314,6 +315,7 @@
.StartsWith("gnu", Triple::GNU)
.StartsWith("macho", Triple::MachO)
.StartsWith("android", Triple::Android)
+ .StartsWith("elf", Triple::ELF)
.Default(Triple::UnknownEnvironment);
}
Modified: llvm/branches/R600/lib/TableGen/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/TableGen/CMakeLists.txt?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/TableGen/CMakeLists.txt (original)
+++ llvm/branches/R600/lib/TableGen/CMakeLists.txt Thu Oct 11 16:28:00 2012
@@ -7,7 +7,6 @@
Main.cpp
Record.cpp
StringMatcher.cpp
- TableGenAction.cpp
TableGenBackend.cpp
TGLexer.cpp
TGParser.cpp
Modified: llvm/branches/R600/lib/TableGen/Main.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/TableGen/Main.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/TableGen/Main.cpp (original)
+++ llvm/branches/R600/lib/TableGen/Main.cpp Thu Oct 11 16:28:00 2012
@@ -22,8 +22,8 @@
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Support/system_error.h"
#include "llvm/TableGen/Error.h"
+#include "llvm/TableGen/Main.h"
#include "llvm/TableGen/Record.h"
-#include "llvm/TableGen/TableGenAction.h"
#include <algorithm>
#include <cstdio>
using namespace llvm;
@@ -47,9 +47,37 @@
cl::value_desc("directory"), cl::Prefix);
}
+/// \brief Create a dependency file for `-d` option.
+///
+/// This functionality is really only for the benefit of the build system.
+/// It is similar to GCC's `-M*` family of options.
+static int createDependencyFile(const TGParser &Parser, const char *argv0) {
+ if (OutputFilename == "-") {
+ errs() << argv0 << ": the option -d must be used together with -o\n";
+ return 1;
+ }
+ std::string Error;
+ tool_output_file DepOut(DependFilename.c_str(), Error);
+ if (!Error.empty()) {
+ errs() << argv0 << ": error opening " << DependFilename
+ << ":" << Error << "\n";
+ return 1;
+ }
+ DepOut.os() << OutputFilename << ":";
+ const std::vector<std::string> &Dependencies = Parser.getDependencies();
+ for (std::vector<std::string>::const_iterator I = Dependencies.begin(),
+ E = Dependencies.end();
+ I != E; ++I) {
+ DepOut.os() << " " << (*I);
+ }
+ DepOut.os() << "\n";
+ DepOut.keep();
+ return 0;
+}
+
namespace llvm {
-int TableGenMain(char *argv0, TableGenAction &Action) {
+int TableGenMain(char *argv0, TableGenMainFn *MainFn) {
RecordKeeper Records;
try {
@@ -82,29 +110,11 @@
<< ":" << Error << "\n";
return 1;
}
- if (!DependFilename.empty()) {
- if (OutputFilename == "-") {
- errs() << argv0 << ": the option -d must be used together with -o\n";
- return 1;
- }
- tool_output_file DepOut(DependFilename.c_str(), Error);
- if (!Error.empty()) {
- errs() << argv0 << ": error opening " << DependFilename
- << ":" << Error << "\n";
- return 1;
- }
- DepOut.os() << OutputFilename << ":";
- const std::vector<std::string> &Dependencies = Parser.getDependencies();
- for (std::vector<std::string>::const_iterator I = Dependencies.begin(),
- E = Dependencies.end();
- I != E; ++I) {
- DepOut.os() << " " << (*I);
- }
- DepOut.os() << "\n";
- DepOut.keep();
- }
+ if (!DependFilename.empty())
+ if (int Ret = createDependencyFile(Parser, argv0))
+ return Ret;
- if (Action(Out.os(), Records))
+ if (MainFn(Out.os(), Records))
return 1;
// Declare success.
Modified: llvm/branches/R600/lib/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/TableGen/Record.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/TableGen/Record.cpp (original)
+++ llvm/branches/R600/lib/TableGen/Record.cpp Thu Oct 11 16:28:00 2012
@@ -113,9 +113,7 @@
Init *BitRecTy::convertValue(TypedInit *VI) {
RecTy *Ty = VI->getType();
- if (dynamic_cast<BitRecTy*>(Ty) ||
- dynamic_cast<BitsRecTy*>(Ty) ||
- dynamic_cast<IntRecTy*>(Ty))
+ if (isa<BitRecTy>(Ty) || isa<BitsRecTy>(Ty) || isa<IntRecTy>(Ty))
return VI; // Accept variable if it is already of bit type!
return 0;
}
@@ -181,7 +179,7 @@
}
Init *BitsRecTy::convertValue(TypedInit *VI) {
- if (Size == 1 && dynamic_cast<BitRecTy*>(VI->getType()))
+ if (Size == 1 && isa<BitRecTy>(VI->getType()))
return BitsInit::get(VI);
if (VI->getType()->typeIsConvertibleTo(this)) {
@@ -243,7 +241,7 @@
Init *StringRecTy::convertValue(TypedInit *TI) {
- if (dynamic_cast<StringRecTy*>(TI->getType()))
+ if (isa<StringRecTy>(TI->getType()))
return TI; // Accept variable if already of the right type!
return 0;
}
@@ -263,17 +261,15 @@
else
return 0;
- ListRecTy *LType = dynamic_cast<ListRecTy*>(LI->getType());
- if (LType == 0) {
+ if (!isa<ListRecTy>(LI->getType()))
return 0;
- }
return ListInit::get(Elements, this);
}
Init *ListRecTy::convertValue(TypedInit *TI) {
// Ensure that TI is compatible with our class.
- if (ListRecTy *LRT = dynamic_cast<ListRecTy*>(TI->getType()))
+ if (ListRecTy *LRT = dyn_cast<ListRecTy>(TI->getType()))
if (LRT->getElementType()->typeIsConvertibleTo(getElementType()))
return TI;
return 0;
@@ -309,7 +305,7 @@
}
RecordRecTy *RecordRecTy::get(Record *R) {
- return &dynamic_cast<RecordRecTy&>(*R->getDefInit()->getType());
+ return dyn_cast<RecordRecTy>(R->getDefInit()->getType());
}
std::string RecordRecTy::getAsString() const {
@@ -325,7 +321,7 @@
Init *RecordRecTy::convertValue(TypedInit *TI) {
// Ensure that TI is compatible with Rec.
- if (RecordRecTy *RRT = dynamic_cast<RecordRecTy*>(TI->getType()))
+ if (RecordRecTy *RRT = dyn_cast<RecordRecTy>(TI->getType()))
if (RRT->getRecord()->isSubClassOf(getRecord()) ||
RRT->getRecord() == getRecord())
return TI;
@@ -354,7 +350,7 @@
return T1;
// If one is a Record type, check superclasses
- if (RecordRecTy *RecTy1 = dynamic_cast<RecordRecTy*>(T1)) {
+ if (RecordRecTy *RecTy1 = dyn_cast<RecordRecTy>(T1)) {
// See if T2 inherits from a type T1 also inherits from
const std::vector<Record *> &T1SuperClasses =
RecTy1->getRecord()->getSuperClasses();
@@ -372,7 +368,7 @@
}
}
}
- if (RecordRecTy *RecTy2 = dynamic_cast<RecordRecTy*>(T2)) {
+ if (RecordRecTy *RecTy2 = dyn_cast<RecordRecTy>(T2)) {
// See if T1 inherits from a type T2 also inherits from
const std::vector<Record *> &T2SuperClasses =
RecTy2->getRecord()->getSuperClasses();
@@ -599,7 +595,7 @@
}
void ListInit::Profile(FoldingSetNodeID &ID) const {
- ListRecTy *ListType = dynamic_cast<ListRecTy *>(getType());
+ ListRecTy *ListType = dyn_cast<ListRecTy>(getType());
assert(ListType && "Bad type for ListInit!");
RecTy *EltTy = ListType->getElementType();
@@ -1039,9 +1035,6 @@
DagInit *MHSd = dynamic_cast<DagInit*>(MHS);
ListInit *MHSl = dynamic_cast<ListInit*>(MHS);
- DagRecTy *DagType = dynamic_cast<DagRecTy*>(Type);
- ListRecTy *ListType = dynamic_cast<ListRecTy*>(Type);
-
OpInit *RHSo = dynamic_cast<OpInit*>(RHS);
if (!RHSo) {
@@ -1054,7 +1047,7 @@
throw TGError(CurRec->getLoc(), "!foreach requires typed variable\n");
}
- if ((MHSd && DagType) || (MHSl && ListType)) {
+ if ((MHSd && isa<DagRecTy>(Type)) || (MHSl && isa<ListRecTy>(Type))) {
if (MHSd) {
Init *Val = MHSd->getOperator();
Init *Result = EvaluateOperation(RHSo, LHS, Val,
@@ -1235,19 +1228,15 @@
}
RecTy *TypedInit::getFieldType(const std::string &FieldName) const {
- RecordRecTy *RecordType = dynamic_cast<RecordRecTy *>(getType());
- if (RecordType) {
- RecordVal *Field = RecordType->getRecord()->getValue(FieldName);
- if (Field) {
+ if (RecordRecTy *RecordType = dyn_cast<RecordRecTy>(getType()))
+ if (RecordVal *Field = RecordType->getRecord()->getValue(FieldName))
return Field->getType();
- }
- }
return 0;
}
Init *
TypedInit::convertInitializerBitRange(const std::vector<unsigned> &Bits) const {
- BitsRecTy *T = dynamic_cast<BitsRecTy*>(getType());
+ BitsRecTy *T = dyn_cast<BitsRecTy>(getType());
if (T == 0) return 0; // Cannot subscript a non-bits variable.
unsigned NumBits = T->getNumBits();
@@ -1263,7 +1252,7 @@
Init *
TypedInit::convertInitListSlice(const std::vector<unsigned> &Elements) const {
- ListRecTy *T = dynamic_cast<ListRecTy*>(getType());
+ ListRecTy *T = dyn_cast<ListRecTy>(getType());
if (T == 0) return 0; // Cannot subscript a non-list variable.
if (Elements.size() == 1)
@@ -1336,7 +1325,7 @@
RecTy *VarInit::getFieldType(const std::string &FieldName) const {
- if (RecordRecTy *RTy = dynamic_cast<RecordRecTy*>(getType()))
+ if (RecordRecTy *RTy = dyn_cast<RecordRecTy>(getType()))
if (const RecordVal *RV = RTy->getRecord()->getValue(FieldName))
return RV->getType();
return 0;
@@ -1344,7 +1333,7 @@
Init *VarInit::getFieldInit(Record &R, const RecordVal *RV,
const std::string &FieldName) const {
- if (dynamic_cast<RecordRecTy*>(getType()))
+ if (isa<RecordRecTy>(getType()))
if (const RecordVal *Val = R.getValue(VarName)) {
if (RV != Val && (RV || dynamic_cast<UnsetInit*>(Val->getValue())))
return 0;
@@ -1655,9 +1644,8 @@
const TypedInit *TypedName = dynamic_cast<const TypedInit *>(Name);
assert(TypedName && "Record name is not typed!");
RecTy *Type = TypedName->getType();
- if (dynamic_cast<StringRecTy *>(Type) == 0) {
+ if (!isa<StringRecTy>(Type))
throw TGError(getLoc(), "Record name is not a string!");
- }
}
DefInit *Record::getDefInit() {
Modified: llvm/branches/R600/lib/TableGen/TGParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/TableGen/TGParser.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/TableGen/TGParser.cpp (original)
+++ llvm/branches/R600/lib/TableGen/TGParser.cpp Thu Oct 11 16:28:00 2012
@@ -110,7 +110,6 @@
// Convert the incoming value to a bits type of the appropriate size...
Init *BI = V->convertInitializerTo(BitsRecTy::get(BitList.size()));
if (BI == 0) {
- V->convertInitializerTo(BitsRecTy::get(BitList.size()));
return Error(Loc, "Initializer is not compatible with bit range");
}
@@ -864,8 +863,8 @@
return 0;
}
if (LHSt) {
- ListRecTy *LType = dynamic_cast<ListRecTy*>(LHSt->getType());
- StringRecTy *SType = dynamic_cast<StringRecTy*>(LHSt->getType());
+ ListRecTy *LType = dyn_cast<ListRecTy>(LHSt->getType());
+ StringRecTy *SType = dyn_cast<StringRecTy>(LHSt->getType());
if (LType == 0 && SType == 0) {
TokError("expected list or string type argumnet in unary operator");
return 0;
@@ -897,7 +896,7 @@
}
} else {
assert(LHSt && "expected list type argument in unary operator");
- ListRecTy *LType = dynamic_cast<ListRecTy*>(LHSt->getType());
+ ListRecTy *LType = dyn_cast<ListRecTy>(LHSt->getType());
if (LType == 0) {
TokError("expected list type argumnet in unary operator");
return 0;
@@ -1271,7 +1270,7 @@
ListRecTy *GivenListTy = 0;
if (ItemType != 0) {
- ListRecTy *ListType = dynamic_cast<ListRecTy*>(ItemType);
+ ListRecTy *ListType = dyn_cast<ListRecTy>(ItemType);
if (ListType == 0) {
std::stringstream s;
s << "Type mismatch for list, expected list type, got "
@@ -1723,7 +1722,7 @@
return 0;
}
RecTy *ValueType = ForeachListValue->getType();
- ListRecTy *ListType = dynamic_cast<ListRecTy *>(ValueType);
+ ListRecTy *ListType = dyn_cast<ListRecTy>(ValueType);
if (ListType == 0) {
TokError("Value list is not of list type");
return 0;
Modified: llvm/branches/R600/lib/TableGen/TGParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/TableGen/TGParser.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/TableGen/TGParser.h (original)
+++ llvm/branches/R600/lib/TableGen/TGParser.h Thu Oct 11 16:28:00 2012
@@ -30,7 +30,7 @@
struct MultiClass;
struct SubClassReference;
struct SubMultiClassReference;
-
+
struct LetRecord {
std::string Name;
std::vector<unsigned> Bits;
@@ -41,7 +41,7 @@
: Name(N), Bits(B), Value(V), Loc(L) {
}
};
-
+
/// ForeachLoop - Record the iteration state associated with a for loop.
/// This is used to instantiate items in the loop body.
struct ForeachLoop {
@@ -56,13 +56,13 @@
TGLexer Lex;
std::vector<std::vector<LetRecord> > LetStack;
std::map<std::string, MultiClass*> MultiClasses;
-
+
/// Loops - Keep track of any foreach loops we are within.
///
typedef std::vector<ForeachLoop> LoopVector;
LoopVector Loops;
- /// CurMultiClass - If we are parsing a 'multiclass' definition, this is the
+ /// CurMultiClass - If we are parsing a 'multiclass' definition, this is the
/// current value.
MultiClass *CurMultiClass;
@@ -82,13 +82,13 @@
};
public:
- TGParser(SourceMgr &SrcMgr, RecordKeeper &records) :
+ TGParser(SourceMgr &SrcMgr, RecordKeeper &records) :
Lex(SrcMgr), CurMultiClass(0), Records(records) {}
-
+
/// ParseFile - Main entrypoint for parsing a tblgen file. These parser
/// routines return true on error, or false on success.
bool ParseFile();
-
+
bool Error(SMLoc L, const Twine &Msg) const {
PrintError(L, Msg);
return true;
@@ -102,9 +102,9 @@
private: // Semantic analysis methods.
bool AddValue(Record *TheRec, SMLoc Loc, const RecordVal &RV);
- bool SetValue(Record *TheRec, SMLoc Loc, Init *ValName,
+ bool SetValue(Record *TheRec, SMLoc Loc, Init *ValName,
const std::vector<unsigned> &BitList, Init *V);
- bool SetValue(Record *TheRec, SMLoc Loc, const std::string &ValName,
+ bool SetValue(Record *TheRec, SMLoc Loc, const std::string &ValName,
const std::vector<unsigned> &BitList, Init *V) {
return SetValue(TheRec, Loc, StringInit::get(ValName), BitList, V);
}
@@ -170,7 +170,8 @@
IDParseMode Mode = ParseValueMode);
Init *ParseValue(Record *CurRec, RecTy *ItemType = 0,
IDParseMode Mode = ParseValueMode);
- std::vector<Init*> ParseValueList(Record *CurRec, Record *ArgsRec = 0, RecTy *EltTy = 0);
+ std::vector<Init*> ParseValueList(Record *CurRec, Record *ArgsRec = 0,
+ RecTy *EltTy = 0);
std::vector<std::pair<llvm::Init*, std::string> > ParseDagArgList(Record *);
bool ParseOptionalRangeList(std::vector<unsigned> &Ranges);
bool ParseOptionalBitList(std::vector<unsigned> &Ranges);
@@ -184,7 +185,7 @@
MultiClass *ParseMultiClassID();
Record *ParseDefmID();
};
-
+
} // end namespace llvm
#endif
Removed: llvm/branches/R600/lib/TableGen/TableGenAction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/TableGen/TableGenAction.cpp?rev=165747&view=auto
==============================================================================
--- llvm/branches/R600/lib/TableGen/TableGenAction.cpp (original)
+++ llvm/branches/R600/lib/TableGen/TableGenAction.cpp (removed)
@@ -1,15 +0,0 @@
-//===- TableGenAction.cpp - defines TableGenAction --------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/TableGen/TableGenAction.h"
-
-using namespace llvm;
-
-void TableGenAction::anchor() { }
-
Modified: llvm/branches/R600/lib/Target/ARM/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/ARMAsmPrinter.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/ARMAsmPrinter.cpp (original)
+++ llvm/branches/R600/lib/Target/ARM/ARMAsmPrinter.cpp Thu Oct 11 16:28:00 2012
@@ -23,6 +23,8 @@
#include "InstPrinter/ARMInstPrinter.h"
#include "MCTargetDesc/ARMAddressingModes.h"
#include "MCTargetDesc/ARMMCExpr.h"
+#include "llvm/ADT/SetVector.h"
+#include "llvm/ADT/SmallString.h"
#include "llvm/Constants.h"
#include "llvm/DebugInfo.h"
#include "llvm/Module.h"
@@ -40,9 +42,8 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Target/Mangler.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
-#include "llvm/ADT/SmallString.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
@@ -302,7 +303,7 @@
}
void ARMAsmPrinter::EmitXXStructor(const Constant *CV) {
- uint64_t Size = TM.getTargetData()->getTypeAllocSize(CV->getType());
+ uint64_t Size = TM.getDataLayout()->getTypeAllocSize(CV->getType());
assert(Size && "C++ constructor pointer had zero size!");
const GlobalValue *GV = dyn_cast<GlobalValue>(CV->stripPointerCasts());
@@ -389,16 +390,6 @@
//===--------------------------------------------------------------------===//
MCSymbol *ARMAsmPrinter::
-GetARMSetPICJumpTableLabel2(unsigned uid, unsigned uid2,
- const MachineBasicBlock *MBB) const {
- SmallString<60> Name;
- raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix()
- << getFunctionNumber() << '_' << uid << '_' << uid2
- << "_set_" << MBB->getNumber();
- return OutContext.GetOrCreateSymbol(Name.str());
-}
-
-MCSymbol *ARMAsmPrinter::
GetARMJTIPICJumpTableLabel2(unsigned uid, unsigned uid2) const {
SmallString<60> Name;
raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix() << "JTI"
@@ -592,9 +583,24 @@
const TargetLoweringObjectFileMachO &TLOFMacho =
static_cast<const TargetLoweringObjectFileMachO &>(
getObjFileLowering());
- OutStreamer.SwitchSection(TLOFMacho.getTextSection());
- OutStreamer.SwitchSection(TLOFMacho.getTextCoalSection());
- OutStreamer.SwitchSection(TLOFMacho.getConstTextCoalSection());
+
+ // Collect the set of sections our functions will go into.
+ SetVector<const MCSection *, SmallVector<const MCSection *, 8>,
+ SmallPtrSet<const MCSection *, 8> > TextSections;
+ // Default text section comes first.
+ TextSections.insert(TLOFMacho.getTextSection());
+ // Now any user defined text sections from function attributes.
+ for (Module::iterator F = M.begin(), e = M.end(); F != e; ++F)
+ if (!F->isDeclaration() && !F->hasAvailableExternallyLinkage())
+ TextSections.insert(TLOFMacho.SectionForGlobal(F, Mang, TM));
+ // Now the coalescable sections.
+ TextSections.insert(TLOFMacho.getTextCoalSection());
+ TextSections.insert(TLOFMacho.getConstTextCoalSection());
+
+ // Emit the sections in the .s file header to fix the order.
+ for (unsigned i = 0, e = TextSections.size(); i != e; ++i)
+ OutStreamer.SwitchSection(TextSections[i]);
+
if (RelocM == Reloc::DynamicNoPIC) {
const MCSection *sect =
OutContext.getMachOSection("__TEXT", "__symbol_stub4",
@@ -893,7 +899,7 @@
void ARMAsmPrinter::
EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) {
- int Size = TM.getTargetData()->getTypeAllocSize(MCPV->getType());
+ int Size = TM.getDataLayout()->getTypeAllocSize(MCPV->getType());
ARMConstantPoolValue *ACPV = static_cast<ARMConstantPoolValue*>(MCPV);
@@ -1091,16 +1097,6 @@
Inst.addOperand(MCOperand::CreateReg(ccreg));
}
-void ARMAsmPrinter::EmitPatchedInstruction(const MachineInstr *MI,
- unsigned Opcode) {
- MCInst TmpInst;
-
- // Emit the instruction as usual, just patch the opcode.
- LowerARMMachineInstrToMCInst(MI, TmpInst, *this);
- TmpInst.setOpcode(Opcode);
- OutStreamer.EmitInstruction(TmpInst);
-}
-
void ARMAsmPrinter::EmitUnwindingInstruction(const MachineInstr *MI) {
assert(MI->getFlag(MachineInstr::FrameSetup) &&
"Only instruction which are involved into frame setup code are allowed");
Modified: llvm/branches/R600/lib/Target/ARM/ARMAsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/ARMAsmPrinter.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/ARMAsmPrinter.h (original)
+++ llvm/branches/R600/lib/Target/ARM/ARMAsmPrinter.h Thu Oct 11 16:28:00 2012
@@ -53,7 +53,7 @@
Subtarget = &TM.getSubtarget<ARMSubtarget>();
}
- virtual const char *getPassName() const {
+ virtual const char *getPassName() const LLVM_OVERRIDE {
return "ARM Assembly Printer";
}
@@ -62,22 +62,24 @@
virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
unsigned AsmVariant, const char *ExtraCode,
- raw_ostream &O);
+ raw_ostream &O) LLVM_OVERRIDE;
virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum,
- unsigned AsmVariant,
- const char *ExtraCode, raw_ostream &O);
+ unsigned AsmVariant, const char *ExtraCode,
+ raw_ostream &O) LLVM_OVERRIDE;
void EmitJumpTable(const MachineInstr *MI);
void EmitJump2Table(const MachineInstr *MI);
- virtual void EmitInstruction(const MachineInstr *MI);
- bool runOnMachineFunction(MachineFunction &F);
+ virtual void EmitInstruction(const MachineInstr *MI) LLVM_OVERRIDE;
+ virtual bool runOnMachineFunction(MachineFunction &F) LLVM_OVERRIDE;
- virtual void EmitConstantPool() {} // we emit constant pools customly!
- virtual void EmitFunctionBodyEnd();
- virtual void EmitFunctionEntryLabel();
- void EmitStartOfAsmFile(Module &M);
- void EmitEndOfAsmFile(Module &M);
- void EmitXXStructor(const Constant *CV);
+ virtual void EmitConstantPool() LLVM_OVERRIDE {
+ // we emit constant pools customly!
+ }
+ virtual void EmitFunctionBodyEnd() LLVM_OVERRIDE;
+ virtual void EmitFunctionEntryLabel() LLVM_OVERRIDE;
+ virtual void EmitStartOfAsmFile(Module &M) LLVM_OVERRIDE;
+ virtual void EmitEndOfAsmFile(Module &M) LLVM_OVERRIDE;
+ virtual void EmitXXStructor(const Constant *CV) LLVM_OVERRIDE;
// lowerOperand - Convert a MachineOperand into the equivalent MCOperand.
bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp);
@@ -101,12 +103,13 @@
public:
void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
- MachineLocation getDebugValueLocation(const MachineInstr *MI) const;
+ virtual MachineLocation
+ getDebugValueLocation(const MachineInstr *MI) const LLVM_OVERRIDE;
/// EmitDwarfRegOp - Emit dwarf register operation.
- virtual void EmitDwarfRegOp(const MachineLocation &MLoc) const;
+ virtual void EmitDwarfRegOp(const MachineLocation &MLoc) const LLVM_OVERRIDE;
- virtual unsigned getISAEncoding() {
+ virtual unsigned getISAEncoding() LLVM_OVERRIDE {
// ARM/Darwin adds ISA to the DWARF info for each function.
if (!Subtarget->isTargetDarwin())
return 0;
@@ -114,18 +117,19 @@
ARM::DW_ISA_ARM_thumb : ARM::DW_ISA_ARM_arm;
}
+private:
MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol);
- MCSymbol *GetARMSetPICJumpTableLabel2(unsigned uid, unsigned uid2,
- const MachineBasicBlock *MBB) const;
MCSymbol *GetARMJTIPICJumpTableLabel2(unsigned uid, unsigned uid2) const;
MCSymbol *GetARMSJLJEHLabel(void) const;
MCSymbol *GetARMGVSymbol(const GlobalValue *GV);
+public:
/// EmitMachineConstantPoolValue - Print a machine constantpool value to
/// the .s file.
- virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV);
+ virtual void
+ EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) LLVM_OVERRIDE;
};
} // end namespace llvm
Modified: llvm/branches/R600/lib/Target/ARM/ARMBaseInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/ARMBaseInstrInfo.cpp (original)
+++ llvm/branches/R600/lib/Target/ARM/ARMBaseInstrInfo.cpp Thu Oct 11 16:28:00 2012
@@ -3302,7 +3302,8 @@
// instructions).
if (Latency > 0 && Subtarget.isThumb2()) {
const MachineFunction *MF = DefMI->getParent()->getParent();
- if (MF->getFunction()->getFnAttributes().hasOptimizeForSizeAttr())
+ if (MF->getFunction()->getFnAttributes().
+ hasAttribute(Attributes::OptimizeForSize))
--Latency;
}
return Latency;
@@ -3549,18 +3550,6 @@
return Latency;
}
-unsigned
-ARMBaseInstrInfo::getOutputLatency(const InstrItineraryData *ItinData,
- const MachineInstr *DefMI, unsigned DefIdx,
- const MachineInstr *DepMI) const {
- unsigned Reg = DefMI->getOperand(DefIdx).getReg();
- if (DepMI->readsRegister(Reg, &getRegisterInfo()) || !isPredicated(DepMI))
- return 1;
-
- // If the second MI is predicated, then there is an implicit use dependency.
- return getInstrLatency(ItinData, DefMI);
-}
-
unsigned ARMBaseInstrInfo::getInstrLatency(const InstrItineraryData *ItinData,
const MachineInstr *MI,
unsigned *PredCost) const {
@@ -3758,7 +3747,7 @@
return DReg;
}
-/// getImplicitSPRUseForDPRUse - Given a use of a DPR register and lane,
+/// getImplicitSPRUseForDPRUse - Given a use of a DPR register and lane,
/// set ImplicitSReg to a register number that must be marked as implicit-use or
/// zero if no register needs to be defined as implicit-use.
///
@@ -3766,13 +3755,13 @@
/// not, it returns false.
///
/// This function handles cases where an instruction is being modified from taking
-/// an SPR to a DPR[Lane]. A use of the DPR is being added, which may conflict
+/// an SPR to a DPR[Lane]. A use of the DPR is being added, which may conflict
/// with an earlier def of an SPR corresponding to DPR[Lane^1] (i.e. the other
/// lane of the DPR).
///
/// If the other SPR is defined, an implicit-use of it should be added. Else,
/// (including the case where the DPR itself is defined), it should not.
-///
+///
static bool getImplicitSPRUseForDPRUse(const TargetRegisterInfo *TRI,
MachineInstr *MI,
unsigned DReg, unsigned Lane,
Modified: llvm/branches/R600/lib/Target/ARM/ARMBaseInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/ARMBaseInstrInfo.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/ARMBaseInstrInfo.h (original)
+++ llvm/branches/R600/lib/Target/ARM/ARMBaseInstrInfo.h Thu Oct 11 16:28:00 2012
@@ -229,10 +229,6 @@
SDNode *DefNode, unsigned DefIdx,
SDNode *UseNode, unsigned UseIdx) const;
- virtual unsigned getOutputLatency(const InstrItineraryData *ItinData,
- const MachineInstr *DefMI, unsigned DefIdx,
- const MachineInstr *DepMI) const;
-
/// VFP/NEON execution domains.
std::pair<uint16_t, uint16_t>
getExecutionDomain(const MachineInstr *MI) const;
Modified: llvm/branches/R600/lib/Target/ARM/ARMBaseRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/ARMBaseRegisterInfo.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/ARMBaseRegisterInfo.cpp (original)
+++ llvm/branches/R600/lib/Target/ARM/ARMBaseRegisterInfo.cpp Thu Oct 11 16:28:00 2012
@@ -561,8 +561,9 @@
const MachineFrameInfo *MFI = MF.getFrameInfo();
const Function *F = MF.getFunction();
unsigned StackAlign = MF.getTarget().getFrameLowering()->getStackAlignment();
- bool requiresRealignment = ((MFI->getMaxAlignment() > StackAlign) ||
- F->getFnAttributes().hasStackAlignmentAttr());
+ bool requiresRealignment =
+ ((MFI->getMaxAlignment() > StackAlign) ||
+ F->getFnAttributes().hasAttribute(Attributes::StackAlignment));
return requiresRealignment && canRealignStack(MF);
}
Modified: llvm/branches/R600/lib/Target/ARM/ARMCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/ARMCodeEmitter.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/ARMCodeEmitter.cpp (original)
+++ llvm/branches/R600/lib/Target/ARM/ARMCodeEmitter.cpp Thu Oct 11 16:28:00 2012
@@ -47,7 +47,7 @@
class ARMCodeEmitter : public MachineFunctionPass {
ARMJITInfo *JTI;
const ARMBaseInstrInfo *II;
- const TargetData *TD;
+ const DataLayout *TD;
const ARMSubtarget *Subtarget;
TargetMachine &TM;
JITCodeEmitter &MCE;
@@ -67,7 +67,7 @@
ARMCodeEmitter(TargetMachine &tm, JITCodeEmitter &mce)
: MachineFunctionPass(ID), JTI(0),
II((const ARMBaseInstrInfo *)tm.getInstrInfo()),
- TD(tm.getTargetData()), TM(tm),
+ TD(tm.getDataLayout()), TM(tm),
MCE(mce), MCPEs(0), MJTEs(0),
IsPIC(TM.getRelocationModel() == Reloc::PIC_), IsThumb(false) {}
@@ -376,7 +376,7 @@
"JIT relocation model must be set to static or default!");
JTI = ((ARMBaseTargetMachine &)MF.getTarget()).getJITInfo();
II = (const ARMBaseInstrInfo *)MF.getTarget().getInstrInfo();
- TD = MF.getTarget().getTargetData();
+ TD = MF.getTarget().getDataLayout();
Subtarget = &TM.getSubtarget<ARMSubtarget>();
MCPEs = &MF.getConstantPool()->getConstants();
MJTEs = 0;
Modified: llvm/branches/R600/lib/Target/ARM/ARMConstantIslandPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/ARMConstantIslandPass.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/ARMConstantIslandPass.cpp (original)
+++ llvm/branches/R600/lib/Target/ARM/ARMConstantIslandPass.cpp Thu Oct 11 16:28:00 2012
@@ -22,7 +22,7 @@
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
@@ -528,7 +528,7 @@
// identity mapping of CPI's to CPE's.
const std::vector<MachineConstantPoolEntry> &CPs = MCP->getConstants();
- const TargetData &TD = *MF->getTarget().getTargetData();
+ const DataLayout &TD = *MF->getTarget().getDataLayout();
for (unsigned i = 0, e = CPs.size(); i != e; ++i) {
unsigned Size = TD.getTypeAllocSize(CPs[i].getType());
assert(Size >= 4 && "Too small constant pool entry");
Modified: llvm/branches/R600/lib/Target/ARM/ARMELFWriterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/ARMELFWriterInfo.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/ARMELFWriterInfo.cpp (original)
+++ llvm/branches/R600/lib/Target/ARM/ARMELFWriterInfo.cpp Thu Oct 11 16:28:00 2012
@@ -15,7 +15,7 @@
#include "ARMRelocations.h"
#include "llvm/Function.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/ELF.h"
@@ -26,8 +26,8 @@
//===----------------------------------------------------------------------===//
ARMELFWriterInfo::ARMELFWriterInfo(TargetMachine &TM)
- : TargetELFWriterInfo(TM.getTargetData()->getPointerSizeInBits() == 64,
- TM.getTargetData()->isLittleEndian()) {
+ : TargetELFWriterInfo(TM.getDataLayout()->getPointerSizeInBits() == 64,
+ TM.getDataLayout()->isLittleEndian()) {
}
ARMELFWriterInfo::~ARMELFWriterInfo() {}
Modified: llvm/branches/R600/lib/Target/ARM/ARMFastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/ARMFastISel.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/ARMFastISel.cpp (original)
+++ llvm/branches/R600/lib/Target/ARM/ARMFastISel.cpp Thu Oct 11 16:28:00 2012
@@ -40,7 +40,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetMachine.h"
@@ -2320,16 +2320,16 @@
ISD::ArgFlagsTy Flags;
unsigned AttrInd = i - CS.arg_begin() + 1;
- if (CS.paramHasAttr(AttrInd, Attribute::SExt))
+ if (CS.paramHasAttr(AttrInd, Attributes::SExt))
Flags.setSExt();
- if (CS.paramHasAttr(AttrInd, Attribute::ZExt))
+ if (CS.paramHasAttr(AttrInd, Attributes::ZExt))
Flags.setZExt();
// FIXME: Only handle *easy* calls for now.
- if (CS.paramHasAttr(AttrInd, Attribute::InReg) ||
- CS.paramHasAttr(AttrInd, Attribute::StructRet) ||
- CS.paramHasAttr(AttrInd, Attribute::Nest) ||
- CS.paramHasAttr(AttrInd, Attribute::ByVal))
+ if (CS.paramHasAttr(AttrInd, Attributes::InReg) ||
+ CS.paramHasAttr(AttrInd, Attributes::StructRet) ||
+ CS.paramHasAttr(AttrInd, Attributes::Nest) ||
+ CS.paramHasAttr(AttrInd, Attributes::ByVal))
return false;
Type *ArgTy = (*i)->getType();
Modified: llvm/branches/R600/lib/Target/ARM/ARMFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/ARMFrameLowering.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/ARMFrameLowering.cpp (original)
+++ llvm/branches/R600/lib/Target/ARM/ARMFrameLowering.cpp Thu Oct 11 16:28:00 2012
@@ -1151,7 +1151,7 @@
return;
// Naked functions don't spill callee-saved registers.
- if (MF.getFunction()->getFnAttributes().hasNakedAttr())
+ if (MF.getFunction()->getFnAttributes().hasAttribute(Attributes::Naked))
return;
// We are planning to use NEON instructions vst1 / vld1.
Modified: llvm/branches/R600/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/ARMISelLowering.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/branches/R600/lib/Target/ARM/ARMISelLowering.cpp Thu Oct 11 16:28:00 2012
@@ -2534,6 +2534,8 @@
void
ARMTargetLowering::VarArgStyleRegisters(CCState &CCInfo, SelectionDAG &DAG,
DebugLoc dl, SDValue &Chain,
+ const Value *OrigArg,
+ unsigned OffsetFromOrigArg,
unsigned ArgOffset) const {
MachineFunction &MF = DAG.getMachineFunction();
MachineFrameInfo *MFI = MF.getFrameInfo();
@@ -2561,7 +2563,7 @@
getPointerTy());
SmallVector<SDValue, 4> MemOps;
- for (; firstRegToSaveIndex < 4; ++firstRegToSaveIndex) {
+ for (unsigned i = 0; firstRegToSaveIndex < 4; ++firstRegToSaveIndex, ++i) {
const TargetRegisterClass *RC;
if (AFI->isThumb1OnlyFunction())
RC = &ARM::tGPRRegClass;
@@ -2572,7 +2574,7 @@
SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i32);
SDValue Store =
DAG.getStore(Val.getValue(1), dl, Val, FIN,
- MachinePointerInfo::getFixedStack(AFI->getVarArgsFrameIndex()),
+ MachinePointerInfo(OrigArg, OffsetFromOrigArg + 4*i),
false, false, 0);
MemOps.push_back(Store);
FIN = DAG.getNode(ISD::ADD, dl, getPointerTy(), FIN,
@@ -2606,14 +2608,16 @@
CCInfo.AnalyzeFormalArguments(Ins,
CCAssignFnForNode(CallConv, /* Return*/ false,
isVarArg));
-
+
SmallVector<SDValue, 16> ArgValues;
int lastInsIndex = -1;
-
SDValue ArgValue;
+ Function::const_arg_iterator CurOrigArg = MF.getFunction()->arg_begin();
+ unsigned CurArgIdx = 0;
for (unsigned i = 0, e = ArgLocs.size(); i != e; ++i) {
CCValAssign &VA = ArgLocs[i];
-
+ std::advance(CurOrigArg, Ins[VA.getValNo()].OrigArgIndex - CurArgIdx);
+ CurArgIdx = Ins[VA.getValNo()].OrigArgIndex;
// Arguments stored in registers.
if (VA.isRegLoc()) {
EVT RegVT = VA.getLocVT();
@@ -2709,7 +2713,8 @@
if (Flags.isByVal()) {
unsigned VARegSize, VARegSaveSize;
computeRegArea(CCInfo, MF, VARegSize, VARegSaveSize);
- VarArgStyleRegisters(CCInfo, DAG, dl, Chain, 0);
+ VarArgStyleRegisters(CCInfo, DAG,
+ dl, Chain, CurOrigArg, Ins[VA.getValNo()].PartOffset, 0);
unsigned Bytes = Flags.getByValSize() - VARegSize;
if (Bytes == 0) Bytes = 1; // Don't create zero-sized stack objects.
int FI = MFI->CreateFixedObject(Bytes,
@@ -2732,7 +2737,8 @@
// varargs
if (isVarArg)
- VarArgStyleRegisters(CCInfo, DAG, dl, Chain, CCInfo.getNextStackOffset());
+ VarArgStyleRegisters(CCInfo, DAG, dl, Chain, 0, 0,
+ CCInfo.getNextStackOffset());
return Chain;
}
@@ -6064,9 +6070,9 @@
const Constant *C = ConstantInt::get(Int32Ty, NumLPads);
// MachineConstantPool wants an explicit alignment.
- unsigned Align = getTargetData()->getPrefTypeAlignment(Int32Ty);
+ unsigned Align = getDataLayout()->getPrefTypeAlignment(Int32Ty);
if (Align == 0)
- Align = getTargetData()->getTypeAllocSize(C->getType());
+ Align = getDataLayout()->getTypeAllocSize(C->getType());
unsigned Idx = ConstantPool->getConstantPoolIndex(C, Align);
unsigned VReg1 = MRI->createVirtualRegister(TRC);
@@ -6153,9 +6159,9 @@
const Constant *C = ConstantInt::get(Int32Ty, NumLPads);
// MachineConstantPool wants an explicit alignment.
- unsigned Align = getTargetData()->getPrefTypeAlignment(Int32Ty);
+ unsigned Align = getDataLayout()->getPrefTypeAlignment(Int32Ty);
if (Align == 0)
- Align = getTargetData()->getTypeAllocSize(C->getType());
+ Align = getDataLayout()->getTypeAllocSize(C->getType());
unsigned Idx = ConstantPool->getConstantPoolIndex(C, Align);
unsigned VReg1 = MRI->createVirtualRegister(TRC);
@@ -6326,7 +6332,8 @@
UnitSize = 2;
} else {
// Check whether we can use NEON instructions.
- if (!MF->getFunction()->getFnAttributes().hasNoImplicitFloatAttr() &&
+ if (!MF->getFunction()->getFnAttributes().
+ hasAttribute(Attributes::NoImplicitFloat) &&
Subtarget->hasNEON()) {
if ((Align % 16 == 0) && SizeVal >= 16) {
ldrOpc = ARM::VLD1q32wb_fixed;
@@ -6411,7 +6418,8 @@
} else {
AddDefaultPred(BuildMI(*BB, MI, dl,
TII->get(ldrOpc),scratch)
- .addReg(srcOut, RegState::Define).addReg(srcIn).addImm(1));
+ .addReg(srcOut, RegState::Define).addReg(srcIn)
+ .addReg(0).addImm(1));
AddDefaultPred(BuildMI(*BB, MI, dl, TII->get(strOpc), destOut)
.addReg(scratch).addReg(destIn)
@@ -6474,9 +6482,9 @@
const Constant *C = ConstantInt::get(Int32Ty, LoopSize);
// MachineConstantPool wants an explicit alignment.
- unsigned Align = getTargetData()->getPrefTypeAlignment(Int32Ty);
+ unsigned Align = getDataLayout()->getPrefTypeAlignment(Int32Ty);
if (Align == 0)
- Align = getTargetData()->getTypeAllocSize(C->getType());
+ Align = getDataLayout()->getTypeAllocSize(C->getType());
unsigned Idx = ConstantPool->getConstantPoolIndex(C, Align);
AddDefaultPred(BuildMI(BB, dl, TII->get(ARM::LDRcp))
@@ -9060,7 +9068,7 @@
// See if we can use NEON instructions for this...
if (IsZeroVal &&
- !F->getFnAttributes().hasNoImplicitFloatAttr() &&
+ !F->getFnAttributes().hasAttribute(Attributes::NoImplicitFloat) &&
Subtarget->hasNEON()) {
if (memOpAlign(SrcAlign, DstAlign, 16) && Size >= 16) {
return MVT::v4i32;
@@ -9854,7 +9862,7 @@
case Intrinsic::arm_neon_vld4lane: {
Info.opc = ISD::INTRINSIC_W_CHAIN;
// Conservatively set memVT to the entire set of vectors loaded.
- uint64_t NumElts = getTargetData()->getTypeAllocSize(I.getType()) / 8;
+ uint64_t NumElts = getDataLayout()->getTypeAllocSize(I.getType()) / 8;
Info.memVT = EVT::getVectorVT(I.getType()->getContext(), MVT::i64, NumElts);
Info.ptrVal = I.getArgOperand(0);
Info.offset = 0;
@@ -9879,7 +9887,7 @@
Type *ArgTy = I.getArgOperand(ArgI)->getType();
if (!ArgTy->isVectorTy())
break;
- NumElts += getTargetData()->getTypeAllocSize(ArgTy) / 8;
+ NumElts += getDataLayout()->getTypeAllocSize(ArgTy) / 8;
}
Info.memVT = EVT::getVectorVT(I.getType()->getContext(), MVT::i64, NumElts);
Info.ptrVal = I.getArgOperand(0);
Modified: llvm/branches/R600/lib/Target/ARM/ARMISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/ARMISelLowering.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/ARMISelLowering.h (original)
+++ llvm/branches/R600/lib/Target/ARM/ARMISelLowering.h Thu Oct 11 16:28:00 2012
@@ -466,7 +466,10 @@
SmallVectorImpl<SDValue> &InVals) const;
void VarArgStyleRegisters(CCState &CCInfo, SelectionDAG &DAG,
- DebugLoc dl, SDValue &Chain, unsigned ArgOffset)
+ DebugLoc dl, SDValue &Chain,
+ const Value *OrigArg,
+ unsigned OffsetFromOrigArg,
+ unsigned ArgOffset)
const;
void computeRegArea(CCState &CCInfo, MachineFunction &MF,
Modified: llvm/branches/R600/lib/Target/ARM/ARMInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/ARMInstrInfo.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/ARMInstrInfo.cpp (original)
+++ llvm/branches/R600/lib/Target/ARM/ARMInstrInfo.cpp Thu Oct 11 16:28:00 2012
@@ -112,7 +112,7 @@
"_GLOBAL_OFFSET_TABLE_");
unsigned Id = AFI->createPICLabelUId();
ARMConstantPoolValue *CPV = ARMConstantPoolConstant::Create(GV, Id);
- unsigned Align = TM->getTargetData()->getPrefTypeAlignment(GV->getType());
+ unsigned Align = TM->getDataLayout()->getPrefTypeAlignment(GV->getType());
unsigned Idx = MF.getConstantPool()->getConstantPoolIndex(CPV, Align);
MachineBasicBlock &FirstMBB = MF.front();
Modified: llvm/branches/R600/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original)
+++ llvm/branches/R600/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Thu Oct 11 16:28:00 2012
@@ -27,7 +27,7 @@
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegisterInfo.h"
@@ -1448,7 +1448,7 @@
static char ID;
ARMPreAllocLoadStoreOpt() : MachineFunctionPass(ID) {}
- const TargetData *TD;
+ const DataLayout *TD;
const TargetInstrInfo *TII;
const TargetRegisterInfo *TRI;
const ARMSubtarget *STI;
@@ -1478,7 +1478,7 @@
}
bool ARMPreAllocLoadStoreOpt::runOnMachineFunction(MachineFunction &Fn) {
- TD = Fn.getTarget().getTargetData();
+ TD = Fn.getTarget().getDataLayout();
TII = Fn.getTarget().getInstrInfo();
TRI = Fn.getTarget().getRegisterInfo();
STI = &Fn.getTarget().getSubtarget<ARMSubtarget>();
Modified: llvm/branches/R600/lib/Target/ARM/ARMSelectionDAGInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/ARMSelectionDAGInfo.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/ARMSelectionDAGInfo.cpp (original)
+++ llvm/branches/R600/lib/Target/ARM/ARMSelectionDAGInfo.cpp Thu Oct 11 16:28:00 2012
@@ -155,7 +155,7 @@
TargetLowering::ArgListEntry Entry;
// First argument: data pointer
- Type *IntPtrTy = TLI.getTargetData()->getIntPtrType(*DAG.getContext());
+ Type *IntPtrTy = TLI.getDataLayout()->getIntPtrType(*DAG.getContext());
Entry.Node = Dst;
Entry.Ty = IntPtrTy;
Args.push_back(Entry);
Modified: llvm/branches/R600/lib/Target/ARM/ARMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/ARMTargetMachine.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/ARMTargetMachine.cpp (original)
+++ llvm/branches/R600/lib/Target/ARM/ARMTargetMachine.cpp Thu Oct 11 16:28:00 2012
@@ -60,7 +60,7 @@
CodeGenOpt::Level OL)
: ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
InstrInfo(Subtarget),
- DataLayout(Subtarget.isAPCS_ABI() ?
+ DL(Subtarget.isAPCS_ABI() ?
std::string("e-p:32:32-f64:32:64-i64:32:64-"
"v128:32:128-v64:32:64-n32-S32") :
Subtarget.isAAPCS_ABI() ?
@@ -88,7 +88,7 @@
InstrInfo(Subtarget.hasThumb2()
? ((ARMBaseInstrInfo*)new Thumb2InstrInfo(Subtarget))
: ((ARMBaseInstrInfo*)new Thumb1InstrInfo(Subtarget))),
- DataLayout(Subtarget.isAPCS_ABI() ?
+ DL(Subtarget.isAPCS_ABI() ?
std::string("e-p:32:32-f64:32:64-i64:32:64-"
"i16:16:32-i8:8:32-i1:8:32-"
"v128:32:128-v64:32:64-a:0:32-n32-S32") :
Modified: llvm/branches/R600/lib/Target/ARM/ARMTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/ARMTargetMachine.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/ARMTargetMachine.h (original)
+++ llvm/branches/R600/lib/Target/ARM/ARMTargetMachine.h Thu Oct 11 16:28:00 2012
@@ -25,7 +25,7 @@
#include "Thumb1FrameLowering.h"
#include "Thumb2InstrInfo.h"
#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/ADT/OwningPtr.h"
@@ -62,7 +62,7 @@
class ARMTargetMachine : public ARMBaseTargetMachine {
virtual void anchor();
ARMInstrInfo InstrInfo;
- const TargetData DataLayout; // Calculates type size & alignment
+ const DataLayout DL; // Calculates type size & alignment
ARMELFWriterInfo ELFWriterInfo;
ARMTargetLowering TLInfo;
ARMSelectionDAGInfo TSInfo;
@@ -90,7 +90,7 @@
}
virtual const ARMInstrInfo *getInstrInfo() const { return &InstrInfo; }
- virtual const TargetData *getTargetData() const { return &DataLayout; }
+ virtual const DataLayout *getDataLayout() const { return &DL; }
virtual const ARMELFWriterInfo *getELFWriterInfo() const {
return Subtarget.isTargetELF() ? &ELFWriterInfo : 0;
}
@@ -104,7 +104,7 @@
virtual void anchor();
// Either Thumb1InstrInfo or Thumb2InstrInfo.
OwningPtr<ARMBaseInstrInfo> InstrInfo;
- const TargetData DataLayout; // Calculates type size & alignment
+ const DataLayout DL; // Calculates type size & alignment
ARMELFWriterInfo ELFWriterInfo;
ARMTargetLowering TLInfo;
ARMSelectionDAGInfo TSInfo;
@@ -138,7 +138,7 @@
virtual const ARMFrameLowering *getFrameLowering() const {
return FrameLowering.get();
}
- virtual const TargetData *getTargetData() const { return &DataLayout; }
+ virtual const DataLayout *getDataLayout() const { return &DL; }
virtual const ARMELFWriterInfo *getELFWriterInfo() const {
return Subtarget.isTargetELF() ? &ELFWriterInfo : 0;
}
Modified: llvm/branches/R600/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/branches/R600/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Thu Oct 11 16:28:00 2012
@@ -3372,7 +3372,8 @@
parseMSRMaskOperand(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
SMLoc S = Parser.getTok().getLoc();
const AsmToken &Tok = Parser.getTok();
- assert(Tok.is(AsmToken::Identifier) && "Token is not an Identifier");
+ if (!Tok.is(AsmToken::Identifier))
+ return MatchOperand_NoMatch;
StringRef Mask = Tok.getString();
if (isMClass()) {
@@ -7480,7 +7481,7 @@
unsigned Kind;
unsigned ErrorInfo;
unsigned MatchResult;
- SmallVector<std::pair< unsigned, std::string >, 4> MapAndConstraints;
+ MatchInstMapAndConstraints MapAndConstraints;
MatchResult = MatchInstructionImpl(Operands, Kind, Inst,
MapAndConstraints, ErrorInfo,
/*matchingInlineAsm*/ false);
Modified: llvm/branches/R600/lib/Target/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/CMakeLists.txt?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/CMakeLists.txt (original)
+++ llvm/branches/R600/lib/Target/CMakeLists.txt Thu Oct 11 16:28:00 2012
@@ -1,7 +1,6 @@
add_llvm_library(LLVMTarget
Mangler.cpp
Target.cpp
- TargetData.cpp
TargetELFWriterInfo.cpp
TargetInstrInfo.cpp
TargetIntrinsicInfo.cpp
Modified: llvm/branches/R600/lib/Target/CellSPU/SPUFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/CellSPU/SPUFrameLowering.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/CellSPU/SPUFrameLowering.cpp (original)
+++ llvm/branches/R600/lib/Target/CellSPU/SPUFrameLowering.cpp Thu Oct 11 16:28:00 2012
@@ -22,7 +22,7 @@
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterScavenging.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/CommandLine.h"
using namespace llvm;
Modified: llvm/branches/R600/lib/Target/CellSPU/SPUSubtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/CellSPU/SPUSubtarget.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/CellSPU/SPUSubtarget.h (original)
+++ llvm/branches/R600/lib/Target/CellSPU/SPUSubtarget.h Thu Oct 11 16:28:00 2012
@@ -80,9 +80,9 @@
return UseLargeMem;
}
- /// getTargetDataString - Return the pointer size and type alignment
+ /// getDataLayoutString - Return the pointer size and type alignment
/// properties of this subtarget.
- const char *getTargetDataString() const {
+ const char *getDataLayoutString() const {
return "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128"
"-i16:16:128-i8:8:128-i1:8:128-a:0:128-v64:64:128-v128:128:128"
"-s:128:128-n32:64";
Modified: llvm/branches/R600/lib/Target/CellSPU/SPUTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/CellSPU/SPUTargetMachine.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/CellSPU/SPUTargetMachine.cpp (original)
+++ llvm/branches/R600/lib/Target/CellSPU/SPUTargetMachine.cpp Thu Oct 11 16:28:00 2012
@@ -38,7 +38,7 @@
CodeGenOpt::Level OL)
: LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
Subtarget(TT, CPU, FS),
- DataLayout(Subtarget.getTargetDataString()),
+ DL(Subtarget.getDataLayoutString()),
InstrInfo(*this),
FrameLowering(Subtarget),
TLInfo(*this),
Modified: llvm/branches/R600/lib/Target/CellSPU/SPUTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/CellSPU/SPUTargetMachine.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/CellSPU/SPUTargetMachine.h (original)
+++ llvm/branches/R600/lib/Target/CellSPU/SPUTargetMachine.h Thu Oct 11 16:28:00 2012
@@ -20,7 +20,7 @@
#include "SPUSelectionDAGInfo.h"
#include "SPUFrameLowering.h"
#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
namespace llvm {
@@ -28,7 +28,7 @@
///
class SPUTargetMachine : public LLVMTargetMachine {
SPUSubtarget Subtarget;
- const TargetData DataLayout;
+ const DataLayout DL;
SPUInstrInfo InstrInfo;
SPUFrameLowering FrameLowering;
SPUTargetLowering TLInfo;
@@ -70,8 +70,8 @@
return &InstrInfo.getRegisterInfo();
}
- virtual const TargetData *getTargetData() const {
- return &DataLayout;
+ virtual const DataLayout *getDataLayout() const {
+ return &DL;
}
virtual const InstrItineraryData *getInstrItineraryData() const {
Modified: llvm/branches/R600/lib/Target/CppBackend/CPPBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/CppBackend/CPPBackend.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/CppBackend/CPPBackend.cpp (original)
+++ llvm/branches/R600/lib/Target/CppBackend/CPPBackend.cpp Thu Oct 11 16:28:00 2012
@@ -474,13 +474,15 @@
Out << "AttributeWithIndex PAWI;"; nl(Out);
for (unsigned i = 0; i < PAL.getNumSlots(); ++i) {
unsigned index = PAL.getSlot(i).Index;
- Attributes attrs = PAL.getSlot(i).Attrs;
- Out << "PAWI.Index = " << index << "U; PAWI.Attrs = Attribute::None ";
-#define HANDLE_ATTR(X) \
- if (attrs & Attribute::X) \
- Out << " | Attribute::" #X; \
- attrs &= ~Attribute::X;
-
+ Attributes::Builder attrs(PAL.getSlot(i).Attrs);
+ Out << "PAWI.Index = " << index << "U;\n";
+ Out << " Attributes::Builder B;\n";
+
+#define HANDLE_ATTR(X) \
+ if (attrs.hasAttribute(Attributes::X)) \
+ Out << " B.addAttribute(Attributes::" #X ");\n"; \
+ attrs.removeAttribute(Attributes::X);
+
HANDLE_ATTR(SExt);
HANDLE_ATTR(ZExt);
HANDLE_ATTR(NoReturn);
@@ -506,13 +508,14 @@
HANDLE_ATTR(UWTable);
HANDLE_ATTR(NonLazyBind);
#undef HANDLE_ATTR
- if (attrs & Attribute::StackAlignment)
- Out << " | Attribute::constructStackAlignmentFromInt("
+ if (attrs.hasAttribute(Attributes::StackAlignment))
+ Out << "B.addStackAlignmentAttr(Attribute::constructStackAlignmentFromInt("
<< attrs.getStackAlignment()
- << ")";
- attrs &= ~Attribute::StackAlignment;
- assert(attrs == 0 && "Unhandled attribute!");
- Out << ";";
+ << "))";
+ nl(Out);
+ attrs.removeAttribute(Attributes::StackAlignment);
+ assert(!attrs.hasAttributes() && "Unhandled attribute!");
+ Out << "PAWI.Attrs = Attributes::get(B);";
nl(Out);
Out << "Attrs.push_back(PAWI);";
nl(Out);
Modified: llvm/branches/R600/lib/Target/CppBackend/CPPTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/CppBackend/CPPTargetMachine.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/CppBackend/CPPTargetMachine.h (original)
+++ llvm/branches/R600/lib/Target/CppBackend/CPPTargetMachine.h Thu Oct 11 16:28:00 2012
@@ -15,7 +15,7 @@
#define CPPTARGETMACHINE_H
#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
namespace llvm {
@@ -35,7 +35,7 @@
AnalysisID StartAfter,
AnalysisID StopAfter);
- virtual const TargetData *getTargetData() const { return 0; }
+ virtual const DataLayout *getDataLayout() const { return 0; }
};
extern Target TheCppBackendTarget;
Modified: llvm/branches/R600/lib/Target/Hexagon/HexagonAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Hexagon/HexagonAsmPrinter.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Hexagon/HexagonAsmPrinter.cpp (original)
+++ llvm/branches/R600/lib/Target/Hexagon/HexagonAsmPrinter.cpp Thu Oct 11 16:28:00 2012
@@ -46,7 +46,7 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Target/Mangler.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetInstrInfo.h"
Modified: llvm/branches/R600/lib/Target/Hexagon/HexagonCallingConvLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Hexagon/HexagonCallingConvLower.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Hexagon/HexagonCallingConvLower.cpp (original)
+++ llvm/branches/R600/lib/Target/Hexagon/HexagonCallingConvLower.cpp Thu Oct 11 16:28:00 2012
@@ -16,7 +16,7 @@
#include "HexagonCallingConvLower.h"
#include "Hexagon.h"
#include "llvm/Target/TargetRegisterInfo.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
Modified: llvm/branches/R600/lib/Target/Hexagon/HexagonMachineScheduler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Hexagon/HexagonMachineScheduler.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Hexagon/HexagonMachineScheduler.cpp (original)
+++ llvm/branches/R600/lib/Target/Hexagon/HexagonMachineScheduler.cpp Thu Oct 11 16:28:00 2012
@@ -128,7 +128,7 @@
// If packet is now full, reset the state so in the next cycle
// we start fresh.
- if (Packet.size() >= InstrItins->SchedModel->IssueWidth) {
+ if (Packet.size() >= SchedModel->getIssueWidth()) {
ResourcesModel->clearResources();
Packet.clear();
TotalPackets++;
@@ -186,18 +186,20 @@
void ConvergingVLIWScheduler::initialize(ScheduleDAGMI *dag) {
DAG = static_cast<VLIWMachineScheduler*>(dag);
+ SchedModel = DAG->getSchedModel();
TRI = DAG->TRI;
- Top.DAG = DAG;
- Bot.DAG = DAG;
+ Top.init(DAG, SchedModel);
+ Bot.init(DAG, SchedModel);
- // Initialize the HazardRecognizers.
+ // Initialize the HazardRecognizers. If itineraries don't exist, are empty, or
+ // are disabled, then these HazardRecs will be disabled.
+ const InstrItineraryData *Itin = DAG->getSchedModel()->getInstrItineraries();
const TargetMachine &TM = DAG->MF.getTarget();
- const InstrItineraryData *Itin = TM.getInstrItineraryData();
Top.HazardRec = TM.getInstrInfo()->CreateTargetMIHazardRecognizer(Itin, DAG);
Bot.HazardRec = TM.getInstrInfo()->CreateTargetMIHazardRecognizer(Itin, DAG);
- Top.ResourceModel = new VLIWResourceModel(TM);
- Bot.ResourceModel = new VLIWResourceModel(TM);
+ Top.ResourceModel = new VLIWResourceModel(TM, DAG->getSchedModel());
+ Bot.ResourceModel = new VLIWResourceModel(TM, DAG->getSchedModel());
assert((!llvm::ForceTopDown || !llvm::ForceBottomUp) &&
"-misched-topdown incompatible with -misched-bottomup");
@@ -256,7 +258,8 @@
if (HazardRec->isEnabled())
return HazardRec->getHazardType(SU) != ScheduleHazardRecognizer::NoHazard;
- if (IssueCount + DAG->getNumMicroOps(SU->getInstr()) > DAG->getIssueWidth())
+ unsigned uops = SchedModel->getNumMicroOps(SU->getInstr());
+ if (IssueCount + uops > SchedModel->getIssueWidth())
return true;
return false;
@@ -278,7 +281,7 @@
/// Move the boundary of scheduled code by one cycle.
void ConvergingVLIWScheduler::SchedBoundary::bumpCycle() {
- unsigned Width = DAG->getIssueWidth();
+ unsigned Width = SchedModel->getIssueWidth();
IssueCount = (IssueCount <= Width) ? 0 : IssueCount - Width;
assert(MinReadyCycle < UINT_MAX && "MinReadyCycle uninitialized");
@@ -321,7 +324,7 @@
// Check the instruction group dispatch limit.
// TODO: Check if this SU must end a dispatch group.
- IssueCount += DAG->getNumMicroOps(SU->getInstr());
+ IssueCount += SchedModel->getNumMicroOps(SU->getInstr());
if (startNewCycle) {
DEBUG(dbgs() << "*** Max instrs at cycle " << CurrCycle << '\n');
bumpCycle();
Modified: llvm/branches/R600/lib/Target/Hexagon/HexagonMachineScheduler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Hexagon/HexagonMachineScheduler.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Hexagon/HexagonMachineScheduler.h (original)
+++ llvm/branches/R600/lib/Target/Hexagon/HexagonMachineScheduler.h Thu Oct 11 16:28:00 2012
@@ -45,7 +45,7 @@
/// definition of DFA by a target.
DFAPacketizer *ResourcesModel;
- const InstrItineraryData *InstrItins;
+ const TargetSchedModel *SchedModel;
/// Local packet/bundle model. Purely
/// internal to the MI schedulre at the time.
@@ -55,29 +55,15 @@
unsigned TotalPackets;
public:
- VLIWResourceModel(MachineSchedContext *C, const InstrItineraryData *IID) :
- InstrItins(IID), TotalPackets(0) {
- const TargetMachine &TM = C->MF->getTarget();
+VLIWResourceModel(const TargetMachine &TM, const TargetSchedModel *SM) :
+ SchedModel(SM), TotalPackets(0) {
ResourcesModel = TM.getInstrInfo()->CreateTargetScheduleState(&TM,NULL);
// This hard requirement could be relaxed,
// but for now do not let it proceed.
assert(ResourcesModel && "Unimplemented CreateTargetScheduleState.");
- Packet.resize(InstrItins->SchedModel->IssueWidth);
- Packet.clear();
- ResourcesModel->clearResources();
- }
-
- VLIWResourceModel(const TargetMachine &TM) :
- InstrItins(TM.getInstrItineraryData()), TotalPackets(0) {
- ResourcesModel = TM.getInstrInfo()->CreateTargetScheduleState(&TM,NULL);
-
- // This hard requirement could be relaxed,
- // but for now do not let it proceed.
- assert(ResourcesModel && "Unimplemented CreateTargetScheduleState.");
-
- Packet.resize(InstrItins->SchedModel->IssueWidth);
+ Packet.resize(SchedModel->getIssueWidth());
Packet.clear();
ResourcesModel->clearResources();
}
@@ -146,6 +132,7 @@
/// of "hazards" and other interlocks at the current cycle.
struct SchedBoundary {
VLIWMachineScheduler *DAG;
+ const TargetSchedModel *SchedModel;
ReadyQueue Available;
ReadyQueue Pending;
@@ -166,7 +153,7 @@
/// Pending queues extend the ready queues with the same ID and the
/// PendingFlag set.
SchedBoundary(unsigned ID, const Twine &Name):
- DAG(0), Available(ID, Name+".A"),
+ DAG(0), SchedModel(0), Available(ID, Name+".A"),
Pending(ID << ConvergingVLIWScheduler::LogMaxQID, Name+".P"),
CheckPending(false), HazardRec(0), ResourceModel(0),
CurrCycle(0), IssueCount(0),
@@ -177,6 +164,11 @@
delete HazardRec;
}
+ void init(VLIWMachineScheduler *dag, const TargetSchedModel *smodel) {
+ DAG = dag;
+ SchedModel = smodel;
+ }
+
bool isTop() const {
return Available.getID() == ConvergingVLIWScheduler::TopQID;
}
@@ -197,6 +189,7 @@
};
VLIWMachineScheduler *DAG;
+ const TargetSchedModel *SchedModel;
const TargetRegisterInfo *TRI;
// State of the top and bottom scheduled instruction boundaries.
@@ -212,7 +205,7 @@
};
ConvergingVLIWScheduler():
- DAG(0), TRI(0), Top(TopQID, "TopQ"), Bot(BotQID, "BotQ") {}
+ DAG(0), SchedModel(0), TRI(0), Top(TopQID, "TopQ"), Bot(BotQID, "BotQ") {}
virtual void initialize(ScheduleDAGMI *dag);
Modified: llvm/branches/R600/lib/Target/Hexagon/HexagonRemoveSZExtArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Hexagon/HexagonRemoveSZExtArgs.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Hexagon/HexagonRemoveSZExtArgs.cpp (original)
+++ llvm/branches/R600/lib/Target/Hexagon/HexagonRemoveSZExtArgs.cpp Thu Oct 11 16:28:00 2012
@@ -50,7 +50,7 @@
unsigned Idx = 1;
for (Function::arg_iterator AI = F.arg_begin(), AE = F.arg_end(); AI != AE;
++AI, ++Idx) {
- if (F.paramHasAttr(Idx, Attribute::SExt)) {
+ if (F.getParamAttributes(Idx).hasAttribute(Attributes::SExt)) {
Argument* Arg = AI;
if (!isa<PointerType>(Arg->getType())) {
for (Instruction::use_iterator UI = Arg->use_begin();
Modified: llvm/branches/R600/lib/Target/Hexagon/HexagonTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Hexagon/HexagonTargetMachine.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Hexagon/HexagonTargetMachine.cpp (original)
+++ llvm/branches/R600/lib/Target/Hexagon/HexagonTargetMachine.cpp Thu Oct 11 16:28:00 2012
@@ -68,7 +68,7 @@
CodeModel::Model CM,
CodeGenOpt::Level OL)
: LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
- DataLayout("e-p:32:32:32-"
+ DL("e-p:32:32:32-"
"i64:64:64-i32:32:32-i16:16:16-i1:32:32-"
"f64:64:64-f32:32:32-a0:0-n32") ,
Subtarget(TT, CPU, FS), InstrInfo(Subtarget), TLInfo(*this),
Modified: llvm/branches/R600/lib/Target/Hexagon/HexagonTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Hexagon/HexagonTargetMachine.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Hexagon/HexagonTargetMachine.h (original)
+++ llvm/branches/R600/lib/Target/Hexagon/HexagonTargetMachine.h Thu Oct 11 16:28:00 2012
@@ -20,14 +20,14 @@
#include "HexagonSelectionDAGInfo.h"
#include "HexagonFrameLowering.h"
#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
namespace llvm {
class Module;
class HexagonTargetMachine : public LLVMTargetMachine {
- const TargetData DataLayout; // Calculates type size & alignment.
+ const DataLayout DL; // Calculates type size & alignment.
HexagonSubtarget Subtarget;
HexagonInstrInfo InstrInfo;
HexagonTargetLowering TLInfo;
@@ -68,7 +68,7 @@
return &TSInfo;
}
- virtual const TargetData *getTargetData() const { return &DataLayout; }
+ virtual const DataLayout *getDataLayout() const { return &DL; }
static unsigned getModuleMatchQuality(const Module &M);
// Pass Pipeline Configuration.
Modified: llvm/branches/R600/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Hexagon/HexagonTargetObjectFile.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Hexagon/HexagonTargetObjectFile.cpp (original)
+++ llvm/branches/R600/lib/Target/Hexagon/HexagonTargetObjectFile.cpp Thu Oct 11 16:28:00 2012
@@ -16,7 +16,7 @@
#include "HexagonTargetMachine.h"
#include "llvm/Function.h"
#include "llvm/GlobalVariable.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/DerivedTypes.h"
#include "llvm/MC/MCContext.h"
#include "llvm/Support/ELF.h"
@@ -73,7 +73,7 @@
if (Kind.isBSS() || Kind.isDataNoRel() || Kind.isCommon()) {
Type *Ty = GV->getType()->getElementType();
- return IsInSmallSection(TM.getTargetData()->getTypeAllocSize(Ty));
+ return IsInSmallSection(TM.getDataLayout()->getTypeAllocSize(Ty));
}
return false;
Modified: llvm/branches/R600/lib/Target/Hexagon/HexagonVarargsCallingConvention.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Hexagon/HexagonVarargsCallingConvention.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Hexagon/HexagonVarargsCallingConvention.h (original)
+++ llvm/branches/R600/lib/Target/Hexagon/HexagonVarargsCallingConvention.h Thu Oct 11 16:28:00 2012
@@ -75,9 +75,9 @@
const Type* ArgTy = LocVT.getTypeForEVT(State.getContext());
unsigned Alignment =
- State.getTarget().getTargetData()->getABITypeAlignment(ArgTy);
+ State.getTarget().getDataLayout()->getABITypeAlignment(ArgTy);
unsigned Size =
- State.getTarget().getTargetData()->getTypeSizeInBits(ArgTy) / 8;
+ State.getTarget().getDataLayout()->getTypeSizeInBits(ArgTy) / 8;
// If it's passed by value, then we need the size of the aggregate not of
// the pointer.
@@ -130,9 +130,9 @@
const Type* ArgTy = LocVT.getTypeForEVT(State.getContext());
unsigned Alignment =
- State.getTarget().getTargetData()->getABITypeAlignment(ArgTy);
+ State.getTarget().getDataLayout()->getABITypeAlignment(ArgTy);
unsigned Size =
- State.getTarget().getTargetData()->getTypeSizeInBits(ArgTy) / 8;
+ State.getTarget().getDataLayout()->getTypeSizeInBits(ArgTy) / 8;
unsigned Offset3 = State.AllocateStack(Size, Alignment);
State.addLoc(CCValAssign::getMem(ValNo, ValVT.getSimpleVT(), Offset3,
Modified: llvm/branches/R600/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp (original)
+++ llvm/branches/R600/lib/Target/MBlaze/AsmParser/MBlazeAsmParser.cpp Thu Oct 11 16:28:00 2012
@@ -318,7 +318,7 @@
MCInst Inst;
unsigned Kind;
unsigned ErrorInfo;
- SmallVector<std::pair< unsigned, std::string >, 4> MapAndConstraints;
+ MatchInstMapAndConstraints MapAndConstraints;
switch (MatchInstructionImpl(Operands, Kind, Inst, MapAndConstraints,
ErrorInfo, /*matchingInlineAsm*/ false)) {
default: break;
Modified: llvm/branches/R600/lib/Target/MBlaze/MBlazeAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/MBlaze/MBlazeAsmPrinter.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/MBlaze/MBlazeAsmPrinter.cpp (original)
+++ llvm/branches/R600/lib/Target/MBlaze/MBlazeAsmPrinter.cpp Thu Oct 11 16:28:00 2012
@@ -34,7 +34,7 @@
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Target/Mangler.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
Modified: llvm/branches/R600/lib/Target/MBlaze/MBlazeELFWriterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/MBlaze/MBlazeELFWriterInfo.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/MBlaze/MBlazeELFWriterInfo.cpp (original)
+++ llvm/branches/R600/lib/Target/MBlaze/MBlazeELFWriterInfo.cpp Thu Oct 11 16:28:00 2012
@@ -16,7 +16,7 @@
#include "llvm/Function.h"
#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
using namespace llvm;
@@ -26,8 +26,8 @@
//===----------------------------------------------------------------------===//
MBlazeELFWriterInfo::MBlazeELFWriterInfo(TargetMachine &TM)
- : TargetELFWriterInfo(TM.getTargetData()->getPointerSizeInBits() == 64,
- TM.getTargetData()->isLittleEndian()) {
+ : TargetELFWriterInfo(TM.getDataLayout()->getPointerSizeInBits() == 64,
+ TM.getDataLayout()->isLittleEndian()) {
}
MBlazeELFWriterInfo::~MBlazeELFWriterInfo() {}
Modified: llvm/branches/R600/lib/Target/MBlaze/MBlazeFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/MBlaze/MBlazeFrameLowering.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/MBlaze/MBlazeFrameLowering.cpp (original)
+++ llvm/branches/R600/lib/Target/MBlaze/MBlazeFrameLowering.cpp Thu Oct 11 16:28:00 2012
@@ -23,7 +23,7 @@
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
Modified: llvm/branches/R600/lib/Target/MBlaze/MBlazeTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/MBlaze/MBlazeTargetMachine.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/MBlaze/MBlazeTargetMachine.cpp (original)
+++ llvm/branches/R600/lib/Target/MBlaze/MBlazeTargetMachine.cpp Thu Oct 11 16:28:00 2012
@@ -38,7 +38,7 @@
CodeGenOpt::Level OL)
: LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
Subtarget(TT, CPU, FS),
- DataLayout("E-p:32:32:32-i8:8:8-i16:16:16"),
+ DL("E-p:32:32:32-i8:8:8-i16:16:16"),
InstrInfo(*this),
FrameLowering(Subtarget),
TLInfo(*this), TSInfo(*this), ELFWriterInfo(*this),
Modified: llvm/branches/R600/lib/Target/MBlaze/MBlazeTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/MBlaze/MBlazeTargetMachine.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/MBlaze/MBlazeTargetMachine.h (original)
+++ llvm/branches/R600/lib/Target/MBlaze/MBlazeTargetMachine.h Thu Oct 11 16:28:00 2012
@@ -23,7 +23,7 @@
#include "MBlazeELFWriterInfo.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetFrameLowering.h"
namespace llvm {
@@ -31,7 +31,7 @@
class MBlazeTargetMachine : public LLVMTargetMachine {
MBlazeSubtarget Subtarget;
- const TargetData DataLayout; // Calculates type size & alignment
+ const DataLayout DL; // Calculates type size & alignment
MBlazeInstrInfo InstrInfo;
MBlazeFrameLowering FrameLowering;
MBlazeTargetLowering TLInfo;
@@ -59,8 +59,8 @@
virtual const MBlazeSubtarget *getSubtargetImpl() const
{ return &Subtarget; }
- virtual const TargetData *getTargetData() const
- { return &DataLayout;}
+ virtual const DataLayout *getDataLayout() const
+ { return &DL;}
virtual const MBlazeRegisterInfo *getRegisterInfo() const
{ return &InstrInfo.getRegisterInfo(); }
Modified: llvm/branches/R600/lib/Target/MBlaze/MBlazeTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/MBlaze/MBlazeTargetObjectFile.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/MBlaze/MBlazeTargetObjectFile.cpp (original)
+++ llvm/branches/R600/lib/Target/MBlaze/MBlazeTargetObjectFile.cpp Thu Oct 11 16:28:00 2012
@@ -13,7 +13,7 @@
#include "llvm/GlobalVariable.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ELF.h"
@@ -70,7 +70,7 @@
return false;
Type *Ty = GV->getType()->getElementType();
- return IsInSmallSection(TM.getTargetData()->getTypeAllocSize(Ty));
+ return IsInSmallSection(TM.getDataLayout()->getTypeAllocSize(Ty));
}
const MCSection *MBlazeTargetObjectFile::
Modified: llvm/branches/R600/lib/Target/MSP430/MSP430FrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/MSP430/MSP430FrameLowering.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/MSP430/MSP430FrameLowering.cpp (original)
+++ llvm/branches/R600/lib/Target/MSP430/MSP430FrameLowering.cpp Thu Oct 11 16:28:00 2012
@@ -20,7 +20,7 @@
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/CommandLine.h"
Modified: llvm/branches/R600/lib/Target/MSP430/MSP430ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/MSP430/MSP430ISelLowering.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/MSP430/MSP430ISelLowering.cpp (original)
+++ llvm/branches/R600/lib/Target/MSP430/MSP430ISelLowering.cpp Thu Oct 11 16:28:00 2012
@@ -61,7 +61,7 @@
TargetLowering(tm, new TargetLoweringObjectFileELF()),
Subtarget(*tm.getSubtargetImpl()) {
- TD = getTargetData();
+ TD = getDataLayout();
// Set up the register classes.
addRegisterClass(MVT::i8, &MSP430::GR8RegClass);
Modified: llvm/branches/R600/lib/Target/MSP430/MSP430ISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/MSP430/MSP430ISelLowering.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/MSP430/MSP430ISelLowering.h (original)
+++ llvm/branches/R600/lib/Target/MSP430/MSP430ISelLowering.h Thu Oct 11 16:28:00 2012
@@ -169,7 +169,7 @@
SelectionDAG &DAG) const;
const MSP430Subtarget &Subtarget;
- const TargetData *TD;
+ const DataLayout *TD;
};
} // namespace llvm
Modified: llvm/branches/R600/lib/Target/MSP430/MSP430TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/MSP430/MSP430TargetMachine.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/MSP430/MSP430TargetMachine.cpp (original)
+++ llvm/branches/R600/lib/Target/MSP430/MSP430TargetMachine.cpp Thu Oct 11 16:28:00 2012
@@ -33,8 +33,8 @@
CodeGenOpt::Level OL)
: LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
Subtarget(TT, CPU, FS),
- // FIXME: Check TargetData string.
- DataLayout("e-p:16:16:16-i8:8:8-i16:16:16-i32:16:32-n8:16"),
+ // FIXME: Check DataLayout string.
+ DL("e-p:16:16:16-i8:8:8-i16:16:16-i32:16:32-n8:16"),
InstrInfo(*this), TLInfo(*this), TSInfo(*this),
FrameLowering(Subtarget) { }
Modified: llvm/branches/R600/lib/Target/MSP430/MSP430TargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/MSP430/MSP430TargetMachine.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/MSP430/MSP430TargetMachine.h (original)
+++ llvm/branches/R600/lib/Target/MSP430/MSP430TargetMachine.h Thu Oct 11 16:28:00 2012
@@ -21,7 +21,7 @@
#include "MSP430SelectionDAGInfo.h"
#include "MSP430RegisterInfo.h"
#include "MSP430Subtarget.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetMachine.h"
@@ -31,7 +31,7 @@
///
class MSP430TargetMachine : public LLVMTargetMachine {
MSP430Subtarget Subtarget;
- const TargetData DataLayout; // Calculates type size & alignment
+ const DataLayout DL; // Calculates type size & alignment
MSP430InstrInfo InstrInfo;
MSP430TargetLowering TLInfo;
MSP430SelectionDAGInfo TSInfo;
@@ -47,7 +47,7 @@
return &FrameLowering;
}
virtual const MSP430InstrInfo *getInstrInfo() const { return &InstrInfo; }
- virtual const TargetData *getTargetData() const { return &DataLayout;}
+ virtual const DataLayout *getDataLayout() const { return &DL;}
virtual const MSP430Subtarget *getSubtargetImpl() const { return &Subtarget; }
virtual const TargetRegisterInfo *getRegisterInfo() const {
Modified: llvm/branches/R600/lib/Target/Mangler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mangler.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mangler.cpp (original)
+++ llvm/branches/R600/lib/Target/Mangler.cpp Thu Oct 11 16:28:00 2012
@@ -14,7 +14,7 @@
#include "llvm/Target/Mangler.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/Support/raw_ostream.h"
@@ -157,7 +157,7 @@
/// a suffix on their name indicating the number of words of arguments they
/// take.
static void AddFastCallStdCallSuffix(SmallVectorImpl<char> &OutName,
- const Function *F, const TargetData &TD) {
+ const Function *F, const DataLayout &TD) {
// Calculate arguments size total.
unsigned ArgWords = 0;
for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end();
Modified: llvm/branches/R600/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/AsmParser/MipsAsmParser.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/AsmParser/MipsAsmParser.cpp (original)
+++ llvm/branches/R600/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Thu Oct 11 16:28:00 2012
@@ -24,7 +24,31 @@
using namespace llvm;
namespace {
+class MipsAssemblerOptions {
+public:
+ MipsAssemblerOptions():
+ aTReg(1), reorder(true), macro(true) {
+ }
+
+ unsigned getATRegNum() {return aTReg;}
+ bool setATReg(unsigned Reg);
+
+ bool isReorder() {return reorder;}
+ void setReorder() {reorder = true;}
+ void setNoreorder() {reorder = false;}
+
+ bool isMacro() {return macro;}
+ void setMacro() {macro = true;}
+ void setNomacro() {macro = false;}
+
+private:
+ unsigned aTReg;
+ bool reorder;
+ bool macro;
+};
+}
+namespace {
class MipsAsmParser : public MCTargetAsmParser {
enum FpFormatTy {
@@ -37,6 +61,8 @@
MCSubtargetInfo &STI;
MCAsmParser &Parser;
+ MipsAssemblerOptions Options;
+
#define GET_ASSEMBLER_HEADER
#include "MipsGenAsmMatcher.inc"
@@ -66,8 +92,30 @@
bool tryParseRegisterOperand(SmallVectorImpl<MCParsedAsmOperand*> &Operands,
StringRef Mnemonic);
+ bool needsExpansion(MCInst &Inst);
+
+ void expandInstruction(MCInst &Inst, SMLoc IDLoc,
+ SmallVectorImpl<MCInst> &Instructions);
+ void expandLoadImm(MCInst &Inst, SMLoc IDLoc,
+ SmallVectorImpl<MCInst> &Instructions);
+ void expandLoadAddressImm(MCInst &Inst, SMLoc IDLoc,
+ SmallVectorImpl<MCInst> &Instructions);
+ void expandLoadAddressReg(MCInst &Inst, SMLoc IDLoc,
+ SmallVectorImpl<MCInst> &Instructions);
+ bool reportParseError(StringRef ErrorMsg);
+
bool parseMemOffset(const MCExpr *&Res);
bool parseRelocOperand(const MCExpr *&Res);
+
+ bool parseDirectiveSet();
+
+ bool parseSetAtDirective();
+ bool parseSetNoAtDirective();
+ bool parseSetMacroDirective();
+ bool parseSetNoMacroDirective();
+ bool parseSetReorderDirective();
+ bool parseSetNoReorderDirective();
+
MCSymbolRefExpr::VariantKind getVariantKind(StringRef Symbol);
bool isMips64() const {
@@ -96,6 +144,7 @@
unsigned getReg(int RC,int RegNo);
+ unsigned getATReg();
public:
MipsAsmParser(MCSubtargetInfo &sti, MCAsmParser &parser)
: MCTargetAsmParser(), STI(sti), Parser(parser) {
@@ -256,6 +305,152 @@
};
}
+bool MipsAsmParser::needsExpansion(MCInst &Inst) {
+
+ switch(Inst.getOpcode()) {
+ case Mips::LoadImm32Reg:
+ case Mips::LoadAddr32Imm:
+ case Mips::LoadAddr32Reg:
+ return true;
+ default:
+ return false;
+ }
+}
+
+void MipsAsmParser::expandInstruction(MCInst &Inst, SMLoc IDLoc,
+ SmallVectorImpl<MCInst> &Instructions){
+ switch(Inst.getOpcode()) {
+ case Mips::LoadImm32Reg:
+ return expandLoadImm(Inst, IDLoc, Instructions);
+ case Mips::LoadAddr32Imm:
+ return expandLoadAddressImm(Inst,IDLoc,Instructions);
+ case Mips::LoadAddr32Reg:
+ return expandLoadAddressReg(Inst,IDLoc,Instructions);
+ }
+}
+
+void MipsAsmParser::expandLoadImm(MCInst &Inst, SMLoc IDLoc,
+ SmallVectorImpl<MCInst> &Instructions){
+ MCInst tmpInst;
+ const MCOperand &ImmOp = Inst.getOperand(1);
+ assert(ImmOp.isImm() && "expected immediate operand kind");
+ const MCOperand &RegOp = Inst.getOperand(0);
+ assert(RegOp.isReg() && "expected register operand kind");
+
+ int ImmValue = ImmOp.getImm();
+ tmpInst.setLoc(IDLoc);
+ if ( 0 <= ImmValue && ImmValue <= 65535) {
+ // for 0 <= j <= 65535.
+ // li d,j => ori d,$zero,j
+ tmpInst.setOpcode(isMips64() ? Mips::ORi64 : Mips::ORi);
+ tmpInst.addOperand(MCOperand::CreateReg(RegOp.getReg()));
+ tmpInst.addOperand(
+ MCOperand::CreateReg(isMips64() ? Mips::ZERO_64 : Mips::ZERO));
+ tmpInst.addOperand(MCOperand::CreateImm(ImmValue));
+ Instructions.push_back(tmpInst);
+ } else if ( ImmValue < 0 && ImmValue >= -32768) {
+ // for -32768 <= j < 0.
+ // li d,j => addiu d,$zero,j
+ tmpInst.setOpcode(Mips::ADDiu); //TODO:no ADDiu64 in td files?
+ tmpInst.addOperand(MCOperand::CreateReg(RegOp.getReg()));
+ tmpInst.addOperand(
+ MCOperand::CreateReg(isMips64() ? Mips::ZERO_64 : Mips::ZERO));
+ tmpInst.addOperand(MCOperand::CreateImm(ImmValue));
+ Instructions.push_back(tmpInst);
+ } else {
+ // for any other value of j that is representable as a 32-bit integer.
+ // li d,j => lui d,hi16(j)
+ // ori d,d,lo16(j)
+ tmpInst.setOpcode(isMips64() ? Mips::LUi64 : Mips::LUi);
+ tmpInst.addOperand(MCOperand::CreateReg(RegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateImm((ImmValue & 0xffff0000) >> 16));
+ Instructions.push_back(tmpInst);
+ tmpInst.clear();
+ tmpInst.setOpcode(isMips64() ? Mips::ORi64 : Mips::ORi);
+ tmpInst.addOperand(MCOperand::CreateReg(RegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateReg(RegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateImm(ImmValue & 0xffff));
+ tmpInst.setLoc(IDLoc);
+ Instructions.push_back(tmpInst);
+ }
+}
+
+void MipsAsmParser::expandLoadAddressReg(MCInst &Inst, SMLoc IDLoc,
+ SmallVectorImpl<MCInst> &Instructions){
+ MCInst tmpInst;
+ const MCOperand &ImmOp = Inst.getOperand(2);
+ assert(ImmOp.isImm() && "expected immediate operand kind");
+ const MCOperand &SrcRegOp = Inst.getOperand(1);
+ assert(SrcRegOp.isReg() && "expected register operand kind");
+ const MCOperand &DstRegOp = Inst.getOperand(0);
+ assert(DstRegOp.isReg() && "expected register operand kind");
+ int ImmValue = ImmOp.getImm();
+ if ( -32768 <= ImmValue && ImmValue <= 65535) {
+ //for -32768 <= j <= 65535.
+ //la d,j(s) => addiu d,s,j
+ tmpInst.setOpcode(Mips::ADDiu); //TODO:no ADDiu64 in td files?
+ tmpInst.addOperand(MCOperand::CreateReg(DstRegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateReg(SrcRegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateImm(ImmValue));
+ Instructions.push_back(tmpInst);
+ } else {
+ //for any other value of j that is representable as a 32-bit integer.
+ //la d,j(s) => lui d,hi16(j)
+ // ori d,d,lo16(j)
+ // addu d,d,s
+ tmpInst.setOpcode(isMips64()?Mips::LUi64:Mips::LUi);
+ tmpInst.addOperand(MCOperand::CreateReg(DstRegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateImm((ImmValue & 0xffff0000) >> 16));
+ Instructions.push_back(tmpInst);
+ tmpInst.clear();
+ tmpInst.setOpcode(isMips64()?Mips::ORi64:Mips::ORi);
+ tmpInst.addOperand(MCOperand::CreateReg(DstRegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateReg(DstRegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateImm(ImmValue & 0xffff));
+ Instructions.push_back(tmpInst);
+ tmpInst.clear();
+ tmpInst.setOpcode(Mips::ADDu);
+ tmpInst.addOperand(MCOperand::CreateReg(DstRegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateReg(DstRegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateReg(SrcRegOp.getReg()));
+ Instructions.push_back(tmpInst);
+ }
+}
+
+void MipsAsmParser::expandLoadAddressImm(MCInst &Inst, SMLoc IDLoc,
+ SmallVectorImpl<MCInst> &Instructions){
+ MCInst tmpInst;
+ const MCOperand &ImmOp = Inst.getOperand(1);
+ assert(ImmOp.isImm() && "expected immediate operand kind");
+ const MCOperand &RegOp = Inst.getOperand(0);
+ assert(RegOp.isReg() && "expected register operand kind");
+ int ImmValue = ImmOp.getImm();
+ if ( -32768 <= ImmValue && ImmValue <= 65535) {
+ //for -32768 <= j <= 65535.
+ //la d,j => addiu d,$zero,j
+ tmpInst.setOpcode(Mips::ADDiu);
+ tmpInst.addOperand(MCOperand::CreateReg(RegOp.getReg()));
+ tmpInst.addOperand(
+ MCOperand::CreateReg(isMips64()?Mips::ZERO_64:Mips::ZERO));
+ tmpInst.addOperand(MCOperand::CreateImm(ImmValue));
+ Instructions.push_back(tmpInst);
+ } else {
+ //for any other value of j that is representable as a 32-bit integer.
+ //la d,j => lui d,hi16(j)
+ // ori d,d,lo16(j)
+ tmpInst.setOpcode(isMips64()?Mips::LUi64:Mips::LUi);
+ tmpInst.addOperand(MCOperand::CreateReg(RegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateImm((ImmValue & 0xffff0000) >> 16));
+ Instructions.push_back(tmpInst);
+ tmpInst.clear();
+ tmpInst.setOpcode(isMips64()?Mips::ORi64:Mips::ORi);
+ tmpInst.addOperand(MCOperand::CreateReg(RegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateReg(RegOp.getReg()));
+ tmpInst.addOperand(MCOperand::CreateImm(ImmValue & 0xffff));
+ Instructions.push_back(tmpInst);
+ }
+}
+
bool MipsAsmParser::
MatchAndEmitInstruction(SMLoc IDLoc,
SmallVectorImpl<MCParsedAsmOperand*> &Operands,
@@ -263,7 +458,7 @@
MCInst Inst;
unsigned Kind;
unsigned ErrorInfo;
- SmallVector<std::pair< unsigned, std::string >, 4> MapAndConstraints;
+ MatchInstMapAndConstraints MapAndConstraints;
unsigned MatchResult = MatchInstructionImpl(Operands, Kind, Inst,
MapAndConstraints, ErrorInfo,
/*matchingInlineAsm*/ false);
@@ -271,8 +466,16 @@
switch (MatchResult) {
default: break;
case Match_Success: {
- Inst.setLoc(IDLoc);
- Out.EmitInstruction(Inst);
+ if (needsExpansion(Inst)) {
+ SmallVector<MCInst, 4> Instructions;
+ expandInstruction(Inst, IDLoc, Instructions);
+ for(unsigned i =0; i < Instructions.size(); i++){
+ Out.EmitInstruction(Instructions[i]);
+ }
+ } else {
+ Inst.setLoc(IDLoc);
+ Out.EmitInstruction(Inst);
+ }
return false;
}
case Match_MissingFeature:
@@ -298,54 +501,88 @@
int MipsAsmParser::matchRegisterName(StringRef Name) {
- int CC = StringSwitch<unsigned>(Name)
- .Case("zero", Mips::ZERO)
- .Case("a0", Mips::A0)
- .Case("a1", Mips::A1)
- .Case("a2", Mips::A2)
- .Case("a3", Mips::A3)
- .Case("v0", Mips::V0)
- .Case("v1", Mips::V1)
- .Case("s0", Mips::S0)
- .Case("s1", Mips::S1)
- .Case("s2", Mips::S2)
- .Case("s3", Mips::S3)
- .Case("s4", Mips::S4)
- .Case("s5", Mips::S5)
- .Case("s6", Mips::S6)
- .Case("s7", Mips::S7)
- .Case("k0", Mips::K0)
- .Case("k1", Mips::K1)
- .Case("sp", Mips::SP)
- .Case("fp", Mips::FP)
- .Case("gp", Mips::GP)
- .Case("ra", Mips::RA)
- .Case("t0", Mips::T0)
- .Case("t1", Mips::T1)
- .Case("t2", Mips::T2)
- .Case("t3", Mips::T3)
- .Case("t4", Mips::T4)
- .Case("t5", Mips::T5)
- .Case("t6", Mips::T6)
- .Case("t7", Mips::T7)
- .Case("t8", Mips::T8)
- .Case("t9", Mips::T9)
- .Case("at", Mips::AT)
- .Case("fcc0", Mips::FCC0)
- .Default(-1);
-
- if (CC != -1) {
- //64 bit register in Mips are following 32 bit definitions.
- if (isMips64())
- CC++;
+ int CC;
+ if (!isMips64())
+ CC = StringSwitch<unsigned>(Name)
+ .Case("zero", Mips::ZERO)
+ .Case("a0", Mips::A0)
+ .Case("a1", Mips::A1)
+ .Case("a2", Mips::A2)
+ .Case("a3", Mips::A3)
+ .Case("v0", Mips::V0)
+ .Case("v1", Mips::V1)
+ .Case("s0", Mips::S0)
+ .Case("s1", Mips::S1)
+ .Case("s2", Mips::S2)
+ .Case("s3", Mips::S3)
+ .Case("s4", Mips::S4)
+ .Case("s5", Mips::S5)
+ .Case("s6", Mips::S6)
+ .Case("s7", Mips::S7)
+ .Case("k0", Mips::K0)
+ .Case("k1", Mips::K1)
+ .Case("sp", Mips::SP)
+ .Case("fp", Mips::FP)
+ .Case("gp", Mips::GP)
+ .Case("ra", Mips::RA)
+ .Case("t0", Mips::T0)
+ .Case("t1", Mips::T1)
+ .Case("t2", Mips::T2)
+ .Case("t3", Mips::T3)
+ .Case("t4", Mips::T4)
+ .Case("t5", Mips::T5)
+ .Case("t6", Mips::T6)
+ .Case("t7", Mips::T7)
+ .Case("t8", Mips::T8)
+ .Case("t9", Mips::T9)
+ .Case("at", Mips::AT)
+ .Case("fcc0", Mips::FCC0)
+ .Default(-1);
+ else
+ CC = StringSwitch<unsigned>(Name)
+ .Case("zero", Mips::ZERO_64)
+ .Case("at", Mips::AT_64)
+ .Case("v0", Mips::V0_64)
+ .Case("v1", Mips::V1_64)
+ .Case("a0", Mips::A0_64)
+ .Case("a1", Mips::A1_64)
+ .Case("a2", Mips::A2_64)
+ .Case("a3", Mips::A3_64)
+ .Case("a4", Mips::T0_64)
+ .Case("a5", Mips::T1_64)
+ .Case("a6", Mips::T2_64)
+ .Case("a7", Mips::T3_64)
+ .Case("t4", Mips::T4_64)
+ .Case("t5", Mips::T5_64)
+ .Case("t6", Mips::T6_64)
+ .Case("t7", Mips::T7_64)
+ .Case("s0", Mips::S0_64)
+ .Case("s1", Mips::S1_64)
+ .Case("s2", Mips::S2_64)
+ .Case("s3", Mips::S3_64)
+ .Case("s4", Mips::S4_64)
+ .Case("s5", Mips::S5_64)
+ .Case("s6", Mips::S6_64)
+ .Case("s7", Mips::S7_64)
+ .Case("t8", Mips::T8_64)
+ .Case("t9", Mips::T9_64)
+ .Case("kt0", Mips::K0_64)
+ .Case("kt1", Mips::K1_64)
+ .Case("gp", Mips::GP_64)
+ .Case("sp", Mips::SP_64)
+ .Case("fp", Mips::FP_64)
+ .Case("s8", Mips::FP_64)
+ .Case("ra", Mips::RA_64)
+ .Default(-1);
+
+ if (CC != -1)
return CC;
- }
if (Name[0] == 'f') {
StringRef NumString = Name.substr(1);
unsigned IntVal;
if( NumString.getAsInteger(10, IntVal))
- return -1; //not integer
+ return -1; // not integer
if (IntVal > 31)
return -1;
@@ -357,7 +594,7 @@
if(isFP64()) {
return getReg(Mips::FGR64RegClassID, IntVal);
}
- //only even numbers available as register pairs
+ // only even numbers available as register pairs
if (( IntVal > 31) || (IntVal%2 != 0))
return -1;
return getReg(Mips::AFGR64RegClassID, IntVal/2);
@@ -395,14 +632,30 @@
.Default(FP_FORMAT_NONE);
}
-unsigned MipsAsmParser::getReg(int RC,int RegNo){
+bool MipsAssemblerOptions::setATReg(unsigned Reg) {
+ if (Reg > 31)
+ return false;
+
+ aTReg = Reg;
+ return true;
+}
+
+unsigned MipsAsmParser::getATReg() {
+ unsigned Reg = Options.getATRegNum();
+ if (isMips64())
+ return getReg(Mips::CPU64RegsRegClassID,Reg);
+
+ return getReg(Mips::CPURegsRegClassID,Reg);
+}
+
+unsigned MipsAsmParser::getReg(int RC,int RegNo) {
return *(getContext().getRegisterInfo().getRegClass(RC).begin() + RegNo);
}
-int MipsAsmParser::matchRegisterByNumber(unsigned RegNum,StringRef Mnemonic) {
+int MipsAsmParser::matchRegisterByNumber(unsigned RegNum, StringRef Mnemonic) {
if (Mnemonic.lower() == "rdhwr") {
- //at the moment only hwreg29 is supported
+ // at the moment only hwreg29 is supported
if (RegNum != 29)
return -1;
return Mips::HWR29;
@@ -411,7 +664,8 @@
if (RegNum > 31)
return -1;
- return getReg(Mips::CPURegsRegClassID,RegNum);
+ // MIPS64 registers are numbered 1 after the 32-bit equivalents
+ return getReg(Mips::CPURegsRegClassID, RegNum) + isMips64();
}
int MipsAsmParser::tryParseRegister(StringRef Mnemonic) {
@@ -422,11 +676,11 @@
std::string lowerCase = Tok.getString().lower();
RegNum = matchRegisterName(lowerCase);
} else if (Tok.is(AsmToken::Integer))
- RegNum = matchRegisterByNumber(static_cast<unsigned> (Tok.getIntVal()),
+ RegNum = matchRegisterByNumber(static_cast<unsigned>(Tok.getIntVal()),
Mnemonic.lower());
else
return RegNum; //error
- //64 bit div operations require Mips::ZERO instead of MIPS::ZERO_64
+ // 64 bit div operations require Mips::ZERO instead of MIPS::ZERO_64
if (isMips64() && RegNum == Mips::ZERO_64) {
if (Mnemonic.find("ddiv") != StringRef::npos)
RegNum = Mips::ZERO;
@@ -441,11 +695,11 @@
SMLoc S = Parser.getTok().getLoc();
int RegNo = -1;
- //FIXME: we should make a more generic method for CCR
+ // FIXME: we should make a more generic method for CCR
if ((Mnemonic == "cfc1" || Mnemonic == "ctc1")
&& Operands.size() == 2 && Parser.getTok().is(AsmToken::Integer)){
- RegNo = Parser.getTok().getIntVal(); //get the int value
- //at the moment only fcc0 is supported
+ RegNo = Parser.getTok().getIntVal(); // get the int value
+ // at the moment only fcc0 is supported
if (RegNo == 0)
RegNo = Mips::FCC0;
} else
@@ -461,8 +715,8 @@
bool MipsAsmParser::ParseOperand(SmallVectorImpl<MCParsedAsmOperand*>&Operands,
StringRef Mnemonic) {
- //Check if the current operand has a custom associated parser, if so, try to
- //custom parse the operand, or fallback to the general approach.
+ // Check if the current operand has a custom associated parser, if so, try to
+ // custom parse the operand, or fallback to the general approach.
OperandMatchResultTy ResTy = MatchOperandParserImpl(Operands, Mnemonic);
if (ResTy == MatchOperand_Success)
return false;
@@ -477,20 +731,20 @@
Error(Parser.getTok().getLoc(), "unexpected token in operand");
return true;
case AsmToken::Dollar: {
- //parse register
+ // parse register
SMLoc S = Parser.getTok().getLoc();
Parser.Lex(); // Eat dollar token.
- //parse register operand
- if (!tryParseRegisterOperand(Operands,Mnemonic)) {
+ // parse register operand
+ if (!tryParseRegisterOperand(Operands, Mnemonic)) {
if (getLexer().is(AsmToken::LParen)) {
- //check if it is indexed addressing operand
+ // check if it is indexed addressing operand
Operands.push_back(MipsOperand::CreateToken("(", S));
- Parser.Lex(); //eat parenthesis
+ Parser.Lex(); // eat parenthesis
if (getLexer().isNot(AsmToken::Dollar))
return true;
- Parser.Lex(); //eat dollar
- if (tryParseRegisterOperand(Operands,Mnemonic))
+ Parser.Lex(); // eat dollar
+ if (tryParseRegisterOperand(Operands, Mnemonic))
return true;
if (!getLexer().is(AsmToken::RParen))
@@ -502,7 +756,7 @@
}
return false;
}
- //maybe it is a symbol reference
+ // maybe it is a symbol reference
StringRef Identifier;
if (Parser.ParseIdentifier(Identifier))
return true;
@@ -534,9 +788,9 @@
return false;
}
case AsmToken::Percent: {
- //it is a symbol reference or constant expression
+ // it is a symbol reference or constant expression
const MCExpr *IdVal;
- SMLoc S = Parser.getTok().getLoc(); //start location of the operand
+ SMLoc S = Parser.getTok().getLoc(); // start location of the operand
if (parseRelocOperand(IdVal))
return true;
@@ -544,36 +798,36 @@
Operands.push_back(MipsOperand::CreateImm(IdVal, S, E));
return false;
- }//case AsmToken::Percent
- }//switch(getLexer().getKind())
+ } // case AsmToken::Percent
+ } // switch(getLexer().getKind())
return true;
}
bool MipsAsmParser::parseRelocOperand(const MCExpr *&Res) {
- Parser.Lex(); //eat % token
- const AsmToken &Tok = Parser.getTok(); //get next token, operation
+ Parser.Lex(); // eat % token
+ const AsmToken &Tok = Parser.getTok(); // get next token, operation
if (Tok.isNot(AsmToken::Identifier))
return true;
std::string Str = Tok.getIdentifier().str();
- Parser.Lex(); //eat identifier
- //now make expression from the rest of the operand
+ Parser.Lex(); // eat identifier
+ // now make expression from the rest of the operand
const MCExpr *IdVal;
SMLoc EndLoc;
if (getLexer().getKind() == AsmToken::LParen) {
while (1) {
- Parser.Lex(); //eat '(' token
+ Parser.Lex(); // eat '(' token
if (getLexer().getKind() == AsmToken::Percent) {
- Parser.Lex(); //eat % token
+ Parser.Lex(); // eat % token
const AsmToken &nextTok = Parser.getTok();
if (nextTok.isNot(AsmToken::Identifier))
return true;
Str += "(%";
Str += nextTok.getIdentifier();
- Parser.Lex(); //eat identifier
+ Parser.Lex(); // eat identifier
if (getLexer().getKind() != AsmToken::LParen)
return true;
} else
@@ -583,14 +837,14 @@
return true;
while (getLexer().getKind() == AsmToken::RParen)
- Parser.Lex(); //eat ')' token
+ Parser.Lex(); // eat ')' token
} else
- return true; //parenthesis must follow reloc operand
+ return true; // parenthesis must follow reloc operand
- //Check the type of the expression
+ // Check the type of the expression
if (const MCConstantExpr *MCE = dyn_cast<MCConstantExpr>(IdVal)) {
- //it's a constant, evaluate lo or hi value
+ // it's a constant, evaluate lo or hi value
int Val = MCE->getValue();
if (Str == "lo") {
Val = Val & 0xffff;
@@ -602,7 +856,7 @@
}
if (const MCSymbolRefExpr *MSRE = dyn_cast<MCSymbolRefExpr>(IdVal)) {
- //it's a symbol, create symbolic expression from symbol
+ // it's a symbol, create symbolic expression from symbol
StringRef Symbol = MSRE->getSymbol().getName();
MCSymbolRefExpr::VariantKind VK = getVariantKind(Str);
Res = MCSymbolRefExpr::Create(Symbol,VK,getContext());
@@ -634,7 +888,7 @@
case AsmToken::Percent:
return parseRelocOperand(Res);
case AsmToken::LParen:
- return false; //it's probably assuming 0
+ return false; // it's probably assuming 0
}
return true;
}
@@ -644,21 +898,27 @@
const MCExpr *IdVal = 0;
SMLoc S;
- //first operand is the offset
+ // first operand is the offset
S = Parser.getTok().getLoc();
if (parseMemOffset(IdVal))
return MatchOperand_ParseFail;
- const AsmToken &Tok = Parser.getTok(); //get next token
+ const AsmToken &Tok = Parser.getTok(); // get next token
if (Tok.isNot(AsmToken::LParen)) {
+ MipsOperand *Mnemonic = static_cast<MipsOperand*>(Operands[0]);
+ if (Mnemonic->getToken() == "la") {
+ SMLoc E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer()-1);
+ Operands.push_back(MipsOperand::CreateImm(IdVal, S, E));
+ return MatchOperand_Success;
+ }
Error(Parser.getTok().getLoc(), "'(' expected");
return MatchOperand_ParseFail;
}
Parser.Lex(); // Eat '(' token.
- const AsmToken &Tok1 = Parser.getTok(); //get next token
+ const AsmToken &Tok1 = Parser.getTok(); // get next token
if (Tok1.is(AsmToken::Dollar)) {
Parser.Lex(); // Eat '$' token.
if (tryParseRegisterOperand(Operands,"")) {
@@ -667,11 +927,11 @@
}
} else {
- Error(Parser.getTok().getLoc(),"unexpected token in operand");
+ Error(Parser.getTok().getLoc(), "unexpected token in operand");
return MatchOperand_ParseFail;
}
- const AsmToken &Tok2 = Parser.getTok(); //get next token
+ const AsmToken &Tok2 = Parser.getTok(); // get next token
if (Tok2.isNot(AsmToken::RParen)) {
Error(Parser.getTok().getLoc(), "')' expected");
return MatchOperand_ParseFail;
@@ -684,12 +944,12 @@
if (IdVal == 0)
IdVal = MCConstantExpr::Create(0, getContext());
- //now replace register operand with the mem operand
+ // now replace register operand with the mem operand
MipsOperand* op = static_cast<MipsOperand*>(Operands.back());
int RegNo = op->getReg();
- //remove register from operands
+ // remove register from operands
Operands.pop_back();
- //and add memory operand
+ // and add memory operand
Operands.push_back(MipsOperand::CreateMem(RegNo, IdVal, S, E));
delete op;
return MatchOperand_Success;
@@ -746,17 +1006,17 @@
bool MipsAsmParser::
parseMathOperation(StringRef Name, SMLoc NameLoc,
- SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
- //split the format
+ SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
+ // split the format
size_t Start = Name.find('.'), Next = Name.rfind('.');
StringRef Format1 = Name.slice(Start, Next);
- //and add the first format to the operands
+ // and add the first format to the operands
Operands.push_back(MipsOperand::CreateToken(Format1, NameLoc));
- //now for the second format
+ // now for the second format
StringRef Format2 = Name.slice(Next, StringRef::npos);
Operands.push_back(MipsOperand::CreateToken(Format2, NameLoc));
- //set the format for the first register
+ // set the format for the first register
setFpFormat(Format1);
// Read the remaining operands.
@@ -800,7 +1060,7 @@
bool MipsAsmParser::
ParseInstruction(StringRef Name, SMLoc NameLoc,
SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
- //floating point instructions: should register be treated as double?
+ // floating point instructions: should register be treated as double?
if (requestsDoubleOperand(Name)) {
setFpFormat(FP_FORMAT_D);
Operands.push_back(MipsOperand::CreateToken(Name, NameLoc));
@@ -814,8 +1074,8 @@
Operands.push_back(MipsOperand::CreateToken(Mnemonic, NameLoc));
if (Next != StringRef::npos) {
- //there is a format token in mnemonic
- //StringRef Rest = Name.slice(Next, StringRef::npos);
+ // there is a format token in mnemonic
+ // StringRef Rest = Name.slice(Next, StringRef::npos);
size_t Dot = Name.find('.', Next+1);
StringRef Format = Name.slice(Next, Dot);
if (Dot == StringRef::npos) //only one '.' in a string, it's a format
@@ -833,11 +1093,11 @@
Operands.push_back(MipsOperand::CreateImm(
MCConstantExpr::Create(Cc, getContext()), NameLoc, E));
} else {
- //trunc, ceil, floor ...
+ // trunc, ceil, floor ...
return parseMathOperation(Name, NameLoc, Operands);
}
- //the rest is a format
+ // the rest is a format
Format = Name.slice(Dot, StringRef::npos);
Operands.push_back(MipsOperand::CreateToken(Format, NameLoc));
}
@@ -877,47 +1137,184 @@
return false;
}
-bool MipsAsmParser::
-ParseDirective(AsmToken DirectiveID) {
+bool MipsAsmParser::reportParseError(StringRef ErrorMsg) {
+ SMLoc Loc = getLexer().getLoc();
+ Parser.EatToEndOfStatement();
+ return Error(Loc, ErrorMsg);
+}
+
+bool MipsAsmParser::parseSetNoAtDirective() {
+ // line should look like:
+ // .set noat
+ // set at reg to 0
+ Options.setATReg(0);
+ // eat noat
+ Parser.Lex();
+ // if this is not the end of the statement, report error
+ if (getLexer().isNot(AsmToken::EndOfStatement)) {
+ reportParseError("unexpected token in statement");
+ return false;
+ }
+ Parser.Lex(); // Consume the EndOfStatement
+ return false;
+}
+bool MipsAsmParser::parseSetAtDirective() {
+ // line can be
+ // .set at - defaults to $1
+ // or .set at=$reg
+ getParser().Lex();
+ if (getLexer().is(AsmToken::EndOfStatement)) {
+ Options.setATReg(1);
+ Parser.Lex(); // Consume the EndOfStatement
+ return false;
+ } else if (getLexer().is(AsmToken::Equal)) {
+ getParser().Lex(); //eat '='
+ if (getLexer().isNot(AsmToken::Dollar)) {
+ reportParseError("unexpected token in statement");
+ return false;
+ }
+ Parser.Lex(); // eat '$'
+ if (getLexer().isNot(AsmToken::Integer)) {
+ reportParseError("unexpected token in statement");
+ return false;
+ }
+ const AsmToken &Reg = Parser.getTok();
+ if (!Options.setATReg(Reg.getIntVal())) {
+ reportParseError("unexpected token in statement");
+ return false;
+ }
+ getParser().Lex(); //eat reg
+
+ if (getLexer().isNot(AsmToken::EndOfStatement)) {
+ reportParseError("unexpected token in statement");
+ return false;
+ }
+ Parser.Lex(); // Consume the EndOfStatement
+ return false;
+ } else {
+ reportParseError("unexpected token in statement");
+ return false;
+ }
+}
+
+bool MipsAsmParser::parseSetReorderDirective() {
+ Parser.Lex();
+ // if this is not the end of the statement, report error
+ if (getLexer().isNot(AsmToken::EndOfStatement)) {
+ reportParseError("unexpected token in statement");
+ return false;
+ }
+ Options.setReorder();
+ Parser.Lex(); // Consume the EndOfStatement
+ return false;
+}
+
+bool MipsAsmParser::parseSetNoReorderDirective() {
+ Parser.Lex();
+ // if this is not the end of the statement, report error
+ if (getLexer().isNot(AsmToken::EndOfStatement)) {
+ reportParseError("unexpected token in statement");
+ return false;
+ }
+ Options.setNoreorder();
+ Parser.Lex(); // Consume the EndOfStatement
+ return false;
+}
+
+bool MipsAsmParser::parseSetMacroDirective() {
+ Parser.Lex();
+ // if this is not the end of the statement, report error
+ if (getLexer().isNot(AsmToken::EndOfStatement)) {
+ reportParseError("unexpected token in statement");
+ return false;
+ }
+ Options.setMacro();
+ Parser.Lex(); // Consume the EndOfStatement
+ return false;
+}
+
+bool MipsAsmParser::parseSetNoMacroDirective() {
+ Parser.Lex();
+ // if this is not the end of the statement, report error
+ if (getLexer().isNot(AsmToken::EndOfStatement)) {
+ reportParseError("`noreorder' must be set before `nomacro'");
+ return false;
+ }
+ if (Options.isReorder()) {
+ reportParseError("`noreorder' must be set before `nomacro'");
+ return false;
+ }
+ Options.setNomacro();
+ Parser.Lex(); // Consume the EndOfStatement
+ return false;
+}
+bool MipsAsmParser::parseDirectiveSet() {
+
+ // get next token
+ const AsmToken &Tok = Parser.getTok();
+
+ if (Tok.getString() == "noat") {
+ return parseSetNoAtDirective();
+ } else if (Tok.getString() == "at") {
+ return parseSetAtDirective();
+ } else if (Tok.getString() == "reorder") {
+ return parseSetReorderDirective();
+ } else if (Tok.getString() == "noreorder") {
+ return parseSetNoReorderDirective();
+ } else if (Tok.getString() == "macro") {
+ return parseSetMacroDirective();
+ } else if (Tok.getString() == "nomacro") {
+ return parseSetNoMacroDirective();
+ } else if (Tok.getString() == "nomips16") {
+ // ignore this directive for now
+ Parser.EatToEndOfStatement();
+ return false;
+ } else if (Tok.getString() == "nomicromips") {
+ // ignore this directive for now
+ Parser.EatToEndOfStatement();
+ return false;
+ }
+ return true;
+}
+
+bool MipsAsmParser::ParseDirective(AsmToken DirectiveID) {
if (DirectiveID.getString() == ".ent") {
- //ignore this directive for now
+ // ignore this directive for now
Parser.Lex();
return false;
}
if (DirectiveID.getString() == ".end") {
- //ignore this directive for now
+ // ignore this directive for now
Parser.Lex();
return false;
}
if (DirectiveID.getString() == ".frame") {
- //ignore this directive for now
+ // ignore this directive for now
Parser.EatToEndOfStatement();
return false;
}
if (DirectiveID.getString() == ".set") {
- //ignore this directive for now
- Parser.EatToEndOfStatement();
- return false;
+ return parseDirectiveSet();
}
if (DirectiveID.getString() == ".fmask") {
- //ignore this directive for now
+ // ignore this directive for now
Parser.EatToEndOfStatement();
return false;
}
if (DirectiveID.getString() == ".mask") {
- //ignore this directive for now
+ // ignore this directive for now
Parser.EatToEndOfStatement();
return false;
}
if (DirectiveID.getString() == ".gpword") {
- //ignore this directive for now
+ // ignore this directive for now
Parser.EatToEndOfStatement();
return false;
}
Modified: llvm/branches/R600/lib/Target/Mips/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/CMakeLists.txt?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/CMakeLists.txt (original)
+++ llvm/branches/R600/lib/Target/Mips/CMakeLists.txt Thu Oct 11 16:28:00 2012
@@ -22,7 +22,6 @@
MipsAsmPrinter.cpp
MipsCodeEmitter.cpp
MipsDelaySlotFiller.cpp
- MipsDirectObjLower.cpp
MipsELFWriterInfo.cpp
MipsJITInfo.cpp
MipsInstrInfo.cpp
Modified: llvm/branches/R600/lib/Target/Mips/MCTargetDesc/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MCTargetDesc/CMakeLists.txt?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MCTargetDesc/CMakeLists.txt (original)
+++ llvm/branches/R600/lib/Target/Mips/MCTargetDesc/CMakeLists.txt Thu Oct 11 16:28:00 2012
@@ -1,5 +1,6 @@
add_llvm_library(LLVMMipsDesc
MipsAsmBackend.cpp
+ MipsDirectObjLower.cpp
MipsMCAsmInfo.cpp
MipsMCCodeEmitter.cpp
MipsMCTargetDesc.cpp
Copied: llvm/branches/R600/lib/Target/Mips/MCTargetDesc/MipsDirectObjLower.cpp (from r165622, llvm/branches/R600/lib/Target/Mips/MipsDirectObjLower.cpp)
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MCTargetDesc/MipsDirectObjLower.cpp?p2=llvm/branches/R600/lib/Target/Mips/MCTargetDesc/MipsDirectObjLower.cpp&p1=llvm/branches/R600/lib/Target/Mips/MipsDirectObjLower.cpp&r1=165622&r2=165748&rev=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MipsDirectObjLower.cpp (original)
+++ llvm/branches/R600/lib/Target/Mips/MCTargetDesc/MipsDirectObjLower.cpp Thu Oct 11 16:28:00 2012
@@ -11,8 +11,8 @@
// left to the assembler to lower such as large shifts.
//
//===----------------------------------------------------------------------===//
-#include "MipsDirectObjLower.h"
#include "MipsInstrInfo.h"
+#include "MCTargetDesc/MipsDirectObjLower.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCStreamer.h"
@@ -25,32 +25,28 @@
assert(Inst.getNumOperands() == 3 && "Invalid no. of operands for shift!");
assert(Inst.getOperand(2).isImm());
- bool isLarge = false;
- int64_t Shift;
- Shift = Inst.getOperand(2).getImm();
- if (Shift > 31) {
- Shift -= 32;
- isLarge = true;
- }
+ int64_t Shift = Inst.getOperand(2).getImm();
+ if (Shift <= 31)
+ return; // Do nothing
+ Shift -= 32;
// saminus32
- (Inst.getOperand(2)).setImm(Shift);
+ Inst.getOperand(2).setImm(Shift);
- if (isLarge)
- switch (Inst.getOpcode()) {
- default:
- // Calling function is not synchronized
- llvm_unreachable("Unexpected shift instruction");
- case Mips::DSLL:
- Inst.setOpcode(Mips::DSLL32);
- return;
- case Mips::DSRL:
- Inst.setOpcode(Mips::DSRL32);
- return;
- case Mips::DSRA:
- Inst.setOpcode(Mips::DSRA32);
- return;
- }
+ switch (Inst.getOpcode()) {
+ default:
+ // Calling function is not synchronized
+ llvm_unreachable("Unexpected shift instruction");
+ case Mips::DSLL:
+ Inst.setOpcode(Mips::DSLL32);
+ return;
+ case Mips::DSRL:
+ Inst.setOpcode(Mips::DSRL32);
+ return;
+ case Mips::DSRA:
+ Inst.setOpcode(Mips::DSRA32);
+ return;
+ }
}
// Pick a DEXT or DINS instruction variant based on the pos and size operands
@@ -70,17 +66,16 @@
int64_t size = InstIn.getOperand(3).getImm();
if (size <= 32) {
- if ((pos < 32)) { // DEXT/DINS, do nothing
- return;
- } else { // DEXTU/DINSU
- InstIn.getOperand(2).setImm(pos - 32);
- InstIn.setOpcode((Opcode == Mips::DEXT) ? Mips::DEXTU : Mips::DINSU);
+ if (pos < 32) // DEXT/DINS, do nothing
return;
- }
- } else { // DEXTM/DINSM
- assert(pos < 32 && "DEXT/DINS cannot have both size and pos > 32");
- InstIn.getOperand(3).setImm(size - 32);
- InstIn.setOpcode((Opcode == Mips::DEXT) ? Mips::DEXTM : Mips::DINSM);
+ // DEXTU/DINSU
+ InstIn.getOperand(2).setImm(pos - 32);
+ InstIn.setOpcode((Opcode == Mips::DEXT) ? Mips::DEXTU : Mips::DINSU);
return;
}
+ // DEXTM/DINSM
+ assert(pos < 32 && "DEXT/DINS cannot have both size and pos > 32");
+ InstIn.getOperand(3).setImm(size - 32);
+ InstIn.setOpcode((Opcode == Mips::DEXT) ? Mips::DEXTM : Mips::DINSM);
+ return;
}
Copied: llvm/branches/R600/lib/Target/Mips/MCTargetDesc/MipsDirectObjLower.h (from r165622, llvm/branches/R600/lib/Target/Mips/MipsDirectObjLower.h)
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MCTargetDesc/MipsDirectObjLower.h?p2=llvm/branches/R600/lib/Target/Mips/MCTargetDesc/MipsDirectObjLower.h&p1=llvm/branches/R600/lib/Target/Mips/MipsDirectObjLower.h&r1=165622&r2=165748&rev=165748&view=diff
==============================================================================
(empty)
Modified: llvm/branches/R600/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp (original)
+++ llvm/branches/R600/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp Thu Oct 11 16:28:00 2012
@@ -13,6 +13,7 @@
//
#define DEBUG_TYPE "mccodeemitter"
#include "MCTargetDesc/MipsBaseInfo.h"
+#include "MCTargetDesc/MipsDirectObjLower.h"
#include "MCTargetDesc/MipsFixupKinds.h"
#include "MCTargetDesc/MipsMCTargetDesc.h"
#include "llvm/ADT/APFloat.h"
@@ -109,16 +110,35 @@
EncodeInstruction(const MCInst &MI, raw_ostream &OS,
SmallVectorImpl<MCFixup> &Fixups) const
{
- uint32_t Binary = getBinaryCodeForInstr(MI, Fixups);
+
+ // Non-pseudo instructions that get changed for direct object
+ // only based on operand values.
+ // If this list of instructions get much longer we will move
+ // the check to a function call. Until then, this is more efficient.
+ MCInst TmpInst = MI;
+ switch (MI.getOpcode()) {
+ // If shift amount is >= 32 it the inst needs to be lowered further
+ case Mips::DSLL:
+ case Mips::DSRL:
+ case Mips::DSRA:
+ Mips::LowerLargeShift(TmpInst);
+ break;
+ // Double extract instruction is chosen by pos and size operands
+ case Mips::DEXT:
+ case Mips::DINS:
+ Mips::LowerDextDins(TmpInst);
+ }
+
+ uint32_t Binary = getBinaryCodeForInstr(TmpInst, Fixups);
// Check for unimplemented opcodes.
- // Unfortunately in MIPS both NOT and SLL will come in with Binary == 0
+ // Unfortunately in MIPS both NOP and SLL will come in with Binary == 0
// so we have to special check for them.
- unsigned Opcode = MI.getOpcode();
+ unsigned Opcode = TmpInst.getOpcode();
if ((Opcode != Mips::NOP) && (Opcode != Mips::SLL) && !Binary)
llvm_unreachable("unimplemented opcode in EncodeInstruction()");
- const MCInstrDesc &Desc = MCII.get(MI.getOpcode());
+ const MCInstrDesc &Desc = MCII.get(TmpInst.getOpcode());
uint64_t TSFlags = Desc.TSFlags;
// Pseudo instructions don't get encoded and shouldn't be here
@@ -126,8 +146,10 @@
if ((TSFlags & MipsII::FormMask) == MipsII::Pseudo)
llvm_unreachable("Pseudo opcode found in EncodeInstruction()");
- // For now all instructions are 4 bytes
- int Size = 4; // FIXME: Have Desc.getSize() return the correct value!
+ // Get byte count of instruction
+ unsigned Size = Desc.getSize();
+ if (!Size)
+ llvm_unreachable("Desc.getSize() returns 0");
EmitInstruction(Binary, Size, OS);
}
Modified: llvm/branches/R600/lib/Target/Mips/Mips16FrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/Mips16FrameLowering.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/Mips16FrameLowering.cpp (original)
+++ llvm/branches/R600/lib/Target/Mips/Mips16FrameLowering.cpp Thu Oct 11 16:28:00 2012
@@ -20,7 +20,7 @@
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/CommandLine.h"
Modified: llvm/branches/R600/lib/Target/Mips/Mips16InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/Mips16InstrInfo.td?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/Mips16InstrInfo.td (original)
+++ llvm/branches/R600/lib/Target/Mips/Mips16InstrInfo.td Thu Oct 11 16:28:00 2012
@@ -10,54 +10,20 @@
// This file describes Mips16 instructions.
//
//===----------------------------------------------------------------------===//
-
-//
-// RRR-type instruction format
//
-class FRRR16_ins<bits<2> _f, string asmstr, InstrItinClass itin> :
- FRRR16<_f, (outs CPU16Regs:$rz), (ins CPU16Regs:$rx, CPU16Regs:$ry),
- !strconcat(asmstr, "\t$rz, $rx, $ry"), [], itin>;
-
-//
-// I8_MOVR32 instruction format (used only by the MOVR32 instructio
//
-class FI8_MOVR3216_ins<string asmstr, InstrItinClass itin>:
- FI8_MOVR3216<(outs CPU16Regs:$rz), (ins CPURegs:$r32),
- !strconcat(asmstr, "\t$rz, $r32"), [], itin>;
-
-//
-// I8_MOV32R instruction format (used only by MOV32R instruction)
-//
-
-class FI8_MOV32R16_ins<string asmstr, InstrItinClass itin>:
- FI8_MOV32R16<(outs CPURegs:$r32), (ins CPU16Regs:$rz),
- !strconcat(asmstr, "\t$r32, $rz"), [], itin>;
-
+// Address operand
+def mem16 : Operand<i32> {
+ let PrintMethod = "printMemOperand";
+ let MIOperandInfo = (ops CPU16Regs, simm16);
+ let EncoderMethod = "getMemEncoding";
+}
//
-// RR-type instruction format
+// Assembler formats in alphabetical order.
+// Natural and pseudos are mixed together.
//
-
-class FRR16_ins<bits<5> f, string asmstr, InstrItinClass itin> :
- FRR16<f, (outs CPU16Regs:$rx), (ins CPU16Regs:$ry),
- !strconcat(asmstr, "\t$rx, $ry"), [], itin> {
-}
-
-class FRxRxRy16_ins<bits<5> f, string asmstr,
- InstrItinClass itin> :
- FRR16<f, (outs CPU16Regs:$rz), (ins CPU16Regs:$rx, CPU16Regs:$ry),
- !strconcat(asmstr, "\t$rz, $ry"),
- [], itin> {
- let Constraints = "$rx = $rz";
-}
-
-let rx=0 in
-class FRR16_JALRC_RA_only_ins<bits<1> nd_, bits<1> l_,
- string asmstr, InstrItinClass itin>:
- FRR16_JALRC<nd_, l_, 1, (outs), (ins), !strconcat(asmstr, "\t $$ra"),
- [], itin> ;
-
//
// EXT-RI instruction format
//
@@ -74,21 +40,19 @@
class FEXT_RI16_PC_ins<bits<5> _op, string asmstr, InstrItinClass itin>:
FEXT_RI16_ins_base<_op, asmstr, "\t$rx, $$pc, $imm", itin>;
-
class FEXT_2RI16_ins<bits<5> _op, string asmstr,
InstrItinClass itin>:
FEXT_RI16<_op, (outs CPU16Regs:$rx), (ins CPU16Regs:$rx_, simm16:$imm),
!strconcat(asmstr, "\t$rx, $imm"), [], itin> {
let Constraints = "$rx_ = $rx";
}
+
// this has an explicit sp argument that we ignore to work around a problem
// in the compiler
class FEXT_RI16_SP_explicit_ins<bits<5> _op, string asmstr,
InstrItinClass itin>:
FEXT_RI16<_op, (outs CPU16Regs:$rx), (ins CPUSPReg:$ry, simm16:$imm),
- !strconcat(asmstr, "\t$rx, $imm ( $ry ); "), [], itin> {
-}
-
+ !strconcat(asmstr, "\t$rx, $imm ( $ry ); "), [], itin>;
//
// EXT-RRI instruction format
@@ -111,15 +75,77 @@
FEXT_SHIFT16<_f, (outs CPU16Regs:$rx), (ins CPU16Regs:$ry, shamt:$sa),
!strconcat(asmstr, "\t$rx, $ry, $sa"), [], itin>;
+
//
-// Address operand
-def mem16 : Operand<i32> {
- let PrintMethod = "printMemOperand";
- let MIOperandInfo = (ops CPU16Regs, simm16);
- let EncoderMethod = "getMemEncoding";
+// I8_MOVR32 instruction format (used only by the MOVR32 instructio
+//
+class FI8_MOVR3216_ins<string asmstr, InstrItinClass itin>:
+ FI8_MOVR3216<(outs CPU16Regs:$rz), (ins CPURegs:$r32),
+ !strconcat(asmstr, "\t$rz, $r32"), [], itin>;
+
+//
+// I8_MOV32R instruction format (used only by MOV32R instruction)
+//
+
+class FI8_MOV32R16_ins<string asmstr, InstrItinClass itin>:
+ FI8_MOV32R16<(outs CPURegs:$r32), (ins CPU16Regs:$rz),
+ !strconcat(asmstr, "\t$r32, $rz"), [], itin>;
+
+//
+// This are pseudo formats for multiply
+// This first one can be changed to non pseudo now.
+//
+// MULT
+//
+class FMULT16_ins<string asmstr, InstrItinClass itin> :
+ MipsPseudo16<(outs), (ins CPU16Regs:$rx, CPU16Regs:$ry),
+ !strconcat(asmstr, "\t$rx, $ry"), []>;
+
+//
+// MULT-LO
+//
+class FMULT16_LO_ins<string asmstr, InstrItinClass itin> :
+ MipsPseudo16<(outs CPU16Regs:$rz), (ins CPU16Regs:$rx, CPU16Regs:$ry),
+ !strconcat(asmstr, "\t$rx, $ry\n\tmflo\t$rz"), []> {
+ let isCodeGenOnly=1;
}
//
+// RR-type instruction format
+//
+
+class FRR16_ins<bits<5> f, string asmstr, InstrItinClass itin> :
+ FRR16<f, (outs CPU16Regs:$rx), (ins CPU16Regs:$ry),
+ !strconcat(asmstr, "\t$rx, $ry"), [], itin> {
+}
+class FRR16_M_ins<bits<5> f, string asmstr,
+ InstrItinClass itin> :
+ FRR16<f, (outs CPU16Regs:$rx), (ins),
+ !strconcat(asmstr, "\t$rx"), [], itin>;
+
+class FRxRxRy16_ins<bits<5> f, string asmstr,
+ InstrItinClass itin> :
+ FRR16<f, (outs CPU16Regs:$rz), (ins CPU16Regs:$rx, CPU16Regs:$ry),
+ !strconcat(asmstr, "\t$rz, $ry"),
+ [], itin> {
+ let Constraints = "$rx = $rz";
+}
+
+let rx=0 in
+class FRR16_JALRC_RA_only_ins<bits<1> nd_, bits<1> l_,
+ string asmstr, InstrItinClass itin>:
+ FRR16_JALRC<nd_, l_, 1, (outs), (ins), !strconcat(asmstr, "\t $$ra"),
+ [], itin> ;
+
+//
+// RRR-type instruction format
+//
+
+class FRRR16_ins<bits<2> _f, string asmstr, InstrItinClass itin> :
+ FRRR16<_f, (outs CPU16Regs:$rz), (ins CPU16Regs:$rx, CPU16Regs:$ry),
+ !strconcat(asmstr, "\t$rz, $rx, $ry"), [], itin>;
+
+//
// Some general instruction class info
//
//
@@ -245,6 +271,63 @@
def MoveR3216: FI8_MOVR3216_ins<"move", IIAlu>;
//
+// Format: MFHI rx MIPS16e
+// Purpose: Move From HI Register
+// To copy the special purpose HI register to a GPR.
+//
+def Mfhi16: FRR16_M_ins<0b10000, "mfhi", IIAlu> {
+ let Uses = [HI];
+ let neverHasSideEffects = 1;
+}
+
+//
+// Format: MFLO rx MIPS16e
+// Purpose: Move From LO Register
+// To copy the special purpose LO register to a GPR.
+//
+def Mflo16: FRR16_M_ins<0b10010, "mflo", IIAlu> {
+ let Uses = [LO];
+ let neverHasSideEffects = 1;
+}
+
+//
+// Pseudo Instruction for mult
+//
+def MultRxRy16: FMULT16_ins<"mult", IIAlu> {
+ let isCommutable = 1;
+ let neverHasSideEffects = 1;
+ let Defs = [HI, LO];
+}
+
+def MultuRxRy16: FMULT16_ins<"multu", IIAlu> {
+ let isCommutable = 1;
+ let neverHasSideEffects = 1;
+ let Defs = [HI, LO];
+}
+
+//
+// Format: MULT rx, ry MIPS16e
+// Purpose: Multiply Word
+// To multiply 32-bit signed integers.
+//
+def MultRxRyRz16: FMULT16_LO_ins<"mult", IIAlu> {
+ let isCommutable = 1;
+ let neverHasSideEffects = 1;
+ let Defs = [HI, LO];
+}
+
+//
+// Format: MULTU rx, ry MIPS16e
+// Purpose: Multiply Unsigned Word
+// To multiply 32-bit unsigned integers.
+//
+def MultuRxRyRz16: FMULT16_LO_ins<"multu", IIAlu> {
+ let isCommutable = 1;
+ let neverHasSideEffects = 1;
+ let Defs = [HI, LO];
+}
+
+//
// Format: NEG rx, ry MIPS16e
// Purpose: Negate
// To negate an integer value.
@@ -413,6 +496,7 @@
def: ArithLogic16_pat<add, AdduRxRyRz16>;
def: ArithLogic16_pat<and, AndRxRxRy16>;
+def: ArithLogic16_pat<mul, MultRxRyRz16>;
def: ArithLogic16_pat<or, OrRxRxRy16>;
def: ArithLogic16_pat<sub, SubuRxRyRz16>;
def: ArithLogic16_pat<xor, XorRxRxRy16>;
Modified: llvm/branches/R600/lib/Target/Mips/Mips64InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/Mips64InstrInfo.td?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/Mips64InstrInfo.td (original)
+++ llvm/branches/R600/lib/Target/Mips/Mips64InstrInfo.td Thu Oct 11 16:28:00 2012
@@ -83,6 +83,8 @@
//===----------------------------------------------------------------------===//
let DecoderNamespace = "Mips64" in {
/// Arithmetic Instructions (ALU Immediate)
+def DADDi : ArithOverflowI<0x18, "daddi", add, simm16_64, immSExt16,
+ CPU64Regs>;
def DADDiu : ArithLogicI<0x19, "daddiu", add, simm16_64, immSExt16,
CPU64Regs>;
def DANDi : ArithLogicI<0x0c, "andi", and, uimm16_64, immZExt16, CPU64Regs>;
@@ -93,6 +95,7 @@
def LUi64 : LoadUpper<0x0f, "lui", CPU64Regs, uimm16_64>;
/// Arithmetic Instructions (3-Operand, R-Type)
+def DADD : ArithOverflowR<0x00, 0x2C, "dadd", IIAlu, CPU64Regs, 1>;
def DADDu : ArithLogicR<0x00, 0x2d, "daddu", add, IIAlu, CPU64Regs, 1>;
def DSUBu : ArithLogicR<0x00, 0x2f, "dsubu", sub, IIAlu, CPU64Regs>;
def SLT64 : SetCC_R<0x00, 0x2a, "slt", setlt, CPU64Regs>;
@@ -307,3 +310,8 @@
// bswap MipsPattern
def : MipsPat<(bswap CPU64Regs:$rt), (DSHD (DSBH CPU64Regs:$rt))>;
+
+//===----------------------------------------------------------------------===//
+// Instruction aliases
+//===----------------------------------------------------------------------===//
+def : InstAlias<"move $dst,$src", (DADD CPU64Regs:$dst,CPU64Regs:$src,ZERO_64)>;
Modified: llvm/branches/R600/lib/Target/Mips/MipsAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MipsAsmPrinter.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MipsAsmPrinter.cpp (original)
+++ llvm/branches/R600/lib/Target/Mips/MipsAsmPrinter.cpp Thu Oct 11 16:28:00 2012
@@ -15,7 +15,6 @@
#define DEBUG_TYPE "mips-asm-printer"
#include "Mips.h"
#include "MipsAsmPrinter.h"
-#include "MipsDirectObjLower.h"
#include "MipsInstrInfo.h"
#include "MipsMCInstLower.h"
#include "InstPrinter/MipsInstPrinter.h"
@@ -38,7 +37,7 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Target/Mangler.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetOptions.h"
@@ -77,22 +76,6 @@
MCInst TmpInst0;
MCInstLowering.Lower(I++, TmpInst0);
- // Direct object specific instruction lowering
- if (!OutStreamer.hasRawTextSupport()){
- switch (TmpInst0.getOpcode()) {
- // If shift amount is >= 32 it the inst needs to be lowered further
- case Mips::DSLL:
- case Mips::DSRL:
- case Mips::DSRA:
- Mips::LowerLargeShift(TmpInst0);
- break;
- // Double extract instruction is chosen by pos and size operands
- case Mips::DEXT:
- case Mips::DINS:
- Mips::LowerDextDins(TmpInst0);
- }
- }
-
OutStreamer.EmitInstruction(TmpInst0);
} while ((I != E) && I->isInsideBundle()); // Delay slot check
}
Modified: llvm/branches/R600/lib/Target/Mips/MipsCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MipsCodeEmitter.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MipsCodeEmitter.cpp (original)
+++ llvm/branches/R600/lib/Target/Mips/MipsCodeEmitter.cpp Thu Oct 11 16:28:00 2012
@@ -47,7 +47,7 @@
class MipsCodeEmitter : public MachineFunctionPass {
MipsJITInfo *JTI;
const MipsInstrInfo *II;
- const TargetData *TD;
+ const DataLayout *TD;
const MipsSubtarget *Subtarget;
TargetMachine &TM;
JITCodeEmitter &MCE;
@@ -66,7 +66,7 @@
MipsCodeEmitter(TargetMachine &tm, JITCodeEmitter &mce) :
MachineFunctionPass(ID), JTI(0),
II((const MipsInstrInfo *) tm.getInstrInfo()),
- TD(tm.getTargetData()), TM(tm), MCE(mce), MCPEs(0), MJTEs(0),
+ TD(tm.getDataLayout()), TM(tm), MCE(mce), MCPEs(0), MJTEs(0),
IsPIC(TM.getRelocationModel() == Reloc::PIC_) {
}
@@ -128,7 +128,7 @@
bool MipsCodeEmitter::runOnMachineFunction(MachineFunction &MF) {
JTI = ((MipsTargetMachine&) MF.getTarget()).getJITInfo();
II = ((const MipsTargetMachine&) MF.getTarget()).getInstrInfo();
- TD = ((const MipsTargetMachine&) MF.getTarget()).getTargetData();
+ TD = ((const MipsTargetMachine&) MF.getTarget()).getDataLayout();
Subtarget = &TM.getSubtarget<MipsSubtarget> ();
MCPEs = &MF.getConstantPool()->getConstants();
MJTEs = 0;
Removed: llvm/branches/R600/lib/Target/Mips/MipsDirectObjLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MipsDirectObjLower.cpp?rev=165747&view=auto
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MipsDirectObjLower.cpp (original)
+++ llvm/branches/R600/lib/Target/Mips/MipsDirectObjLower.cpp (removed)
@@ -1,86 +0,0 @@
-//===-- MipsDirectObjLower.cpp - Mips LLVM direct object lowering -----===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains code to lower Mips MCInst records that are normally
-// left to the assembler to lower such as large shifts.
-//
-//===----------------------------------------------------------------------===//
-#include "MipsDirectObjLower.h"
-#include "MipsInstrInfo.h"
-#include "llvm/MC/MCInst.h"
-#include "llvm/MC/MCStreamer.h"
-
-using namespace llvm;
-
-// If the D<shift> instruction has a shift amount that is greater
-// than 31 (checked in calling routine), lower it to a D<shift>32 instruction
-void Mips::LowerLargeShift(MCInst& Inst) {
-
- assert(Inst.getNumOperands() == 3 && "Invalid no. of operands for shift!");
- assert(Inst.getOperand(2).isImm());
-
- bool isLarge = false;
- int64_t Shift;
- Shift = Inst.getOperand(2).getImm();
- if (Shift > 31) {
- Shift -= 32;
- isLarge = true;
- }
-
- // saminus32
- (Inst.getOperand(2)).setImm(Shift);
-
- if (isLarge)
- switch (Inst.getOpcode()) {
- default:
- // Calling function is not synchronized
- llvm_unreachable("Unexpected shift instruction");
- case Mips::DSLL:
- Inst.setOpcode(Mips::DSLL32);
- return;
- case Mips::DSRL:
- Inst.setOpcode(Mips::DSRL32);
- return;
- case Mips::DSRA:
- Inst.setOpcode(Mips::DSRA32);
- return;
- }
-}
-
-// Pick a DEXT or DINS instruction variant based on the pos and size operands
-void Mips::LowerDextDins(MCInst& InstIn) {
- int Opcode = InstIn.getOpcode();
-
- if (Opcode == Mips::DEXT)
- assert(InstIn.getNumOperands() == 4 &&
- "Invalid no. of machine operands for DEXT!");
- else // Only DEXT and DINS are possible
- assert(InstIn.getNumOperands() == 5 &&
- "Invalid no. of machine operands for DINS!");
-
- assert(InstIn.getOperand(2).isImm());
- int64_t pos = InstIn.getOperand(2).getImm();
- assert(InstIn.getOperand(3).isImm());
- int64_t size = InstIn.getOperand(3).getImm();
-
- if (size <= 32) {
- if ((pos < 32)) { // DEXT/DINS, do nothing
- return;
- } else { // DEXTU/DINSU
- InstIn.getOperand(2).setImm(pos - 32);
- InstIn.setOpcode((Opcode == Mips::DEXT) ? Mips::DEXTU : Mips::DINSU);
- return;
- }
- } else { // DEXTM/DINSM
- assert(pos < 32 && "DEXT/DINS cannot have both size and pos > 32");
- InstIn.getOperand(3).setImm(size - 32);
- InstIn.setOpcode((Opcode == Mips::DEXT) ? Mips::DEXTM : Mips::DINSM);
- return;
- }
-}
Removed: llvm/branches/R600/lib/Target/Mips/MipsDirectObjLower.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MipsDirectObjLower.h?rev=165747&view=auto
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MipsDirectObjLower.h (original)
+++ llvm/branches/R600/lib/Target/Mips/MipsDirectObjLower.h (removed)
@@ -1,28 +0,0 @@
-//===-- MipsDirectObjLower.h - Mips LLVM direct object lowering *- C++ -*--===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef MIPSDIRECTOBJLOWER_H
-#define MIPSDIRECTOBJLOWER_H
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/Compiler.h"
-
-namespace llvm {
- class MCInst;
- class MCStreamer;
-
- namespace Mips {
- /// MipsDirectObjLower - This name space is used to lower MCInstr in cases
- // where the assembler usually finishes the lowering
- // such as large shifts.
- void LowerLargeShift(MCInst &Inst);
- void LowerDextDins(MCInst &Inst);
- }
-}
-
-#endif
Modified: llvm/branches/R600/lib/Target/Mips/MipsELFWriterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MipsELFWriterInfo.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MipsELFWriterInfo.cpp (original)
+++ llvm/branches/R600/lib/Target/Mips/MipsELFWriterInfo.cpp Thu Oct 11 16:28:00 2012
@@ -15,7 +15,7 @@
#include "MipsRelocations.h"
#include "llvm/Function.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/ELF.h"
Modified: llvm/branches/R600/lib/Target/Mips/MipsFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MipsFrameLowering.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MipsFrameLowering.cpp (original)
+++ llvm/branches/R600/lib/Target/Mips/MipsFrameLowering.cpp Thu Oct 11 16:28:00 2012
@@ -23,7 +23,7 @@
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/CommandLine.h"
Modified: llvm/branches/R600/lib/Target/Mips/MipsISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MipsISelDAGToDAG.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MipsISelDAGToDAG.cpp (original)
+++ llvm/branches/R600/lib/Target/Mips/MipsISelDAGToDAG.cpp Thu Oct 11 16:28:00 2012
@@ -372,14 +372,16 @@
SDValue InFlag = SDValue(Mul, 0);
if (HasLo) {
- Lo = CurDAG->getMachineNode(Ty == MVT::i32 ? Mips::MFLO : Mips::MFLO64, dl,
- Ty, MVT::Glue, InFlag);
+ unsigned Opcode = Subtarget.inMips16Mode() ? Mips::Mflo16 :
+ (Ty == MVT::i32 ? Mips::MFLO : Mips::MFLO64);
+ Lo = CurDAG->getMachineNode(Opcode, dl, Ty, MVT::Glue, InFlag);
InFlag = SDValue(Lo, 1);
}
- if (HasHi)
- Hi = CurDAG->getMachineNode(Ty == MVT::i32 ? Mips::MFHI : Mips::MFHI64, dl,
- Ty, InFlag);
-
+ if (HasHi) {
+ unsigned Opcode = Subtarget.inMips16Mode() ? Mips::Mfhi16 :
+ (Ty == MVT::i32 ? Mips::MFHI : Mips::MFHI64);
+ Hi = CurDAG->getMachineNode(Opcode, dl, Ty, InFlag);
+ }
return std::make_pair(Lo, Hi);
}
@@ -443,8 +445,13 @@
/// Mul with two results
case ISD::SMUL_LOHI:
case ISD::UMUL_LOHI: {
- if (NodeTy == MVT::i32)
- MultOpc = (Opcode == ISD::UMUL_LOHI ? Mips::MULTu : Mips::MULT);
+ if (NodeTy == MVT::i32) {
+ if (Subtarget.inMips16Mode())
+ MultOpc = (Opcode == ISD::UMUL_LOHI ? Mips::MultuRxRy16 :
+ Mips::MultRxRy16);
+ else
+ MultOpc = (Opcode == ISD::UMUL_LOHI ? Mips::MULTu : Mips::MULT);
+ }
else
MultOpc = (Opcode == ISD::UMUL_LOHI ? Mips::DMULTu : Mips::DMULT);
@@ -470,8 +477,13 @@
}
case ISD::MULHS:
case ISD::MULHU: {
- if (NodeTy == MVT::i32)
- MultOpc = (Opcode == ISD::MULHU ? Mips::MULTu : Mips::MULT);
+ if (NodeTy == MVT::i32) {
+ if (Subtarget.inMips16Mode())
+ MultOpc = (Opcode == ISD::MULHU ?
+ Mips::MultuRxRy16 : Mips::MultRxRy16);
+ else
+ MultOpc = (Opcode == ISD::MULHU ? Mips::MULTu : Mips::MULT);
+ }
else
MultOpc = (Opcode == ISD::MULHU ? Mips::DMULTu : Mips::DMULT);
Modified: llvm/branches/R600/lib/Target/Mips/MipsISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MipsISelLowering.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MipsISelLowering.cpp (original)
+++ llvm/branches/R600/lib/Target/Mips/MipsISelLowering.cpp Thu Oct 11 16:28:00 2012
@@ -1746,8 +1746,10 @@
if (getTargetMachine().getRelocationModel() != Reloc::PIC_ && !IsN64) {
// %hi/%lo relocation
- SDValue BAHi = DAG.getTargetBlockAddress(BA, MVT::i32, 0, MipsII::MO_ABS_HI);
- SDValue BALo = DAG.getTargetBlockAddress(BA, MVT::i32, 0, MipsII::MO_ABS_LO);
+ SDValue BAHi =
+ DAG.getTargetBlockAddress(BA, MVT::i32, 0, MipsII::MO_ABS_HI);
+ SDValue BALo =
+ DAG.getTargetBlockAddress(BA, MVT::i32, 0, MipsII::MO_ABS_LO);
SDValue Hi = DAG.getNode(MipsISD::Hi, dl, MVT::i32, BAHi);
SDValue Lo = DAG.getNode(MipsISD::Lo, dl, MVT::i32, BALo);
return DAG.getNode(ISD::ADD, dl, MVT::i32, Hi, Lo);
@@ -2595,7 +2597,11 @@
llvm_unreachable("Cannot handle this ValVT.");
unsigned SizeInBytes = ValVT.getSizeInBits() >> 3;
- unsigned Offset = State.AllocateStack(SizeInBytes, OrigAlign);
+ unsigned Offset;
+ if (!ArgFlags.isSRet())
+ Offset = State.AllocateStack(SizeInBytes, OrigAlign);
+ else
+ Offset = State.AllocateStack(SizeInBytes, SizeInBytes);
if (!Reg)
State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo));
@@ -3438,6 +3444,17 @@
// Return Value Calling Convention Implementation
//===----------------------------------------------------------------------===//
+bool
+MipsTargetLowering::CanLowerReturn(CallingConv::ID CallConv,
+ MachineFunction &MF, bool isVarArg,
+ const SmallVectorImpl<ISD::OutputArg> &Outs,
+ LLVMContext &Context) const {
+ SmallVector<CCValAssign, 16> RVLocs;
+ CCState CCInfo(CallConv, isVarArg, MF, getTargetMachine(),
+ RVLocs, Context);
+ return CCInfo.CheckReturn(Outs, RetCC_Mips);
+}
+
SDValue
MipsTargetLowering::LowerReturn(SDValue Chain,
CallingConv::ID CallConv, bool isVarArg,
Modified: llvm/branches/R600/lib/Target/Mips/MipsISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MipsISelLowering.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MipsISelLowering.h (original)
+++ llvm/branches/R600/lib/Target/Mips/MipsISelLowering.h Thu Oct 11 16:28:00 2012
@@ -216,6 +216,12 @@
LowerCall(TargetLowering::CallLoweringInfo &CLI,
SmallVectorImpl<SDValue> &InVals) const;
+ virtual bool
+ CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
+ bool isVarArg,
+ const SmallVectorImpl<ISD::OutputArg> &Outs,
+ LLVMContext &Context) const;
+
virtual SDValue
LowerReturn(SDValue Chain,
CallingConv::ID CallConv, bool isVarArg,
Modified: llvm/branches/R600/lib/Target/Mips/MipsInstrFormats.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MipsInstrFormats.td?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MipsInstrFormats.td (original)
+++ llvm/branches/R600/lib/Target/Mips/MipsInstrFormats.td Thu Oct 11 16:28:00 2012
@@ -92,6 +92,14 @@
let Predicates = [HasStandardEncoding];
}
+// Pseudo-instructions for alternate assembly syntax (never used by codegen).
+// These are aliases that require C++ handling to convert to the target
+// instruction, while InstAliases can be handled directly by tblgen.
+class MipsAsmPseudoInst<dag outs, dag ins, string asmstr>:
+ MipsInst<outs, ins, asmstr, [], IIPseudo, Pseudo> {
+ let isPseudo = 1;
+ let Pattern = [];
+}
//===----------------------------------------------------------------------===//
// Format R instruction class in Mips : <|opcode|rs|rt|rd|shamt|funct|>
//===----------------------------------------------------------------------===//
@@ -163,6 +171,27 @@
let Inst{25-0} = addr;
}
+ //===----------------------------------------------------------------------===//
+// MFC instruction class in Mips : <|op|mf|rt|rd|0000000|sel|>
+//===----------------------------------------------------------------------===//
+class MFC3OP<bits<6> op, bits<5> _mfmt, dag outs, dag ins, string asmstr>:
+ InstSE<outs, ins, asmstr, [], NoItinerary, FrmFR>
+{
+ bits<5> mfmt;
+ bits<5> rt;
+ bits<5> rd;
+ bits<3> sel;
+
+ let Opcode = op;
+ let mfmt = _mfmt;
+
+ let Inst{25-21} = mfmt;
+ let Inst{20-16} = rt;
+ let Inst{15-11} = rd;
+ let Inst{10-3} = 0;
+ let Inst{2-0} = sel;
+}
+
//===----------------------------------------------------------------------===//
//
// FLOATING POINT INSTRUCTION FORMATS
Modified: llvm/branches/R600/lib/Target/Mips/MipsInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MipsInstrInfo.td?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MipsInstrInfo.td (original)
+++ llvm/branches/R600/lib/Target/Mips/MipsInstrInfo.td Thu Oct 11 16:28:00 2012
@@ -296,6 +296,23 @@
// Instructions specific format
//===----------------------------------------------------------------------===//
+/// Move Control Registers From/To CPU Registers
+def MFC0_3OP : MFC3OP<0x10, 0, (outs CPURegs:$rt),
+ (ins CPURegs:$rd, uimm16:$sel),"mfc0\t$rt, $rd, $sel">;
+def : InstAlias<"mfc0 $rt, $rd", (MFC0_3OP CPURegs:$rt, CPURegs:$rd, 0)>;
+
+def MTC0_3OP : MFC3OP<0x10, 4, (outs CPURegs:$rd, uimm16:$sel),
+ (ins CPURegs:$rt),"mtc0\t$rt, $rd, $sel">;
+def : InstAlias<"mtc0 $rt, $rd", (MTC0_3OP CPURegs:$rd, 0, CPURegs:$rt)>;
+
+def MFC2_3OP : MFC3OP<0x12, 0, (outs CPURegs:$rt),
+ (ins CPURegs:$rd, uimm16:$sel),"mfc2\t$rt, $rd, $sel">;
+def : InstAlias<"mfc2 $rt, $rd", (MFC2_3OP CPURegs:$rt, CPURegs:$rd, 0)>;
+
+def MTC2_3OP : MFC3OP<0x12, 4, (outs CPURegs:$rd, uimm16:$sel),
+ (ins CPURegs:$rt),"mtc2\t$rt, $rd, $sel">;
+def : InstAlias<"mtc2 $rt, $rd", (MTC2_3OP CPURegs:$rd, 0, CPURegs:$rt)>;
+
// Arithmetic and logical instructions with 3 register operands.
class ArithLogicR<bits<6> op, bits<6> func, string instr_asm, SDNode OpNode,
InstrItinClass itin, RegisterClass RC, bit isComm = 0>:
@@ -864,6 +881,21 @@
// Instruction definition
//===----------------------------------------------------------------------===//
+class LoadImm32< string instr_asm, Operand Od, RegisterClass RC> :
+ MipsAsmPseudoInst<(outs RC:$rt), (ins Od:$imm32),
+ !strconcat(instr_asm, "\t$rt, $imm32")> ;
+def LoadImm32Reg : LoadImm32<"li", shamt,CPURegs>;
+
+class LoadAddress<string instr_asm, Operand MemOpnd, RegisterClass RC> :
+ MipsAsmPseudoInst<(outs RC:$rt), (ins MemOpnd:$addr),
+ !strconcat(instr_asm, "\t$rt, $addr")> ;
+def LoadAddr32Reg : LoadAddress<"la", mem, CPURegs>;
+
+class LoadAddressImm<string instr_asm, Operand Od, RegisterClass RC> :
+ MipsAsmPseudoInst<(outs RC:$rt), (ins Od:$imm32),
+ !strconcat(instr_asm, "\t$rt, $imm32")> ;
+def LoadAddr32Imm : LoadAddressImm<"la", shamt,CPURegs>;
+
//===----------------------------------------------------------------------===//
// MipsI Instructions
//===----------------------------------------------------------------------===//
Modified: llvm/branches/R600/lib/Target/Mips/MipsSEFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MipsSEFrameLowering.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MipsSEFrameLowering.cpp (original)
+++ llvm/branches/R600/lib/Target/Mips/MipsSEFrameLowering.cpp Thu Oct 11 16:28:00 2012
@@ -22,7 +22,7 @@
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/CommandLine.h"
Modified: llvm/branches/R600/lib/Target/Mips/MipsTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MipsTargetMachine.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MipsTargetMachine.cpp (original)
+++ llvm/branches/R600/lib/Target/Mips/MipsTargetMachine.cpp Thu Oct 11 16:28:00 2012
@@ -43,7 +43,7 @@
bool isLittle)
: LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
Subtarget(TT, CPU, FS, isLittle, RM),
- DataLayout(isLittle ?
+ DL(isLittle ?
(Subtarget.isABI_N64() ?
"e-p:64:64:64-i8:8:32-i16:16:32-i64:64:64-f128:128:128-n32" :
"e-p:32:32:32-i8:8:32-i16:16:32-i64:64:64-n32") :
Modified: llvm/branches/R600/lib/Target/Mips/MipsTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MipsTargetMachine.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MipsTargetMachine.h (original)
+++ llvm/branches/R600/lib/Target/Mips/MipsTargetMachine.h Thu Oct 11 16:28:00 2012
@@ -22,7 +22,7 @@
#include "MipsSubtarget.h"
#include "MipsELFWriterInfo.h"
#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetFrameLowering.h"
namespace llvm {
@@ -31,7 +31,7 @@
class MipsTargetMachine : public LLVMTargetMachine {
MipsSubtarget Subtarget;
- const TargetData DataLayout; // Calculates type size & alignment
+ const DataLayout DL; // Calculates type size & alignment
const MipsInstrInfo *InstrInfo;
const MipsFrameLowering *FrameLowering;
MipsTargetLowering TLInfo;
@@ -54,8 +54,8 @@
{ return FrameLowering; }
virtual const MipsSubtarget *getSubtargetImpl() const
{ return &Subtarget; }
- virtual const TargetData *getTargetData() const
- { return &DataLayout;}
+ virtual const DataLayout *getDataLayout() const
+ { return &DL;}
virtual MipsJITInfo *getJITInfo()
{ return &JITInfo; }
Modified: llvm/branches/R600/lib/Target/Mips/MipsTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/Mips/MipsTargetObjectFile.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/Mips/MipsTargetObjectFile.cpp (original)
+++ llvm/branches/R600/lib/Target/Mips/MipsTargetObjectFile.cpp Thu Oct 11 16:28:00 2012
@@ -13,7 +13,7 @@
#include "llvm/GlobalVariable.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ELF.h"
@@ -82,7 +82,7 @@
return false;
Type *Ty = GV->getType()->getElementType();
- return IsInSmallSection(TM.getTargetData()->getTypeAllocSize(Ty));
+ return IsInSmallSection(TM.getDataLayout()->getTypeAllocSize(Ty));
}
Modified: llvm/branches/R600/lib/Target/NVPTX/NVPTXAllocaHoisting.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/NVPTX/NVPTXAllocaHoisting.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/NVPTX/NVPTXAllocaHoisting.h (original)
+++ llvm/branches/R600/lib/Target/NVPTX/NVPTXAllocaHoisting.h Thu Oct 11 16:28:00 2012
@@ -16,7 +16,7 @@
#include "llvm/CodeGen/MachineFunctionAnalysis.h"
#include "llvm/Pass.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
namespace llvm {
@@ -31,7 +31,7 @@
NVPTXAllocaHoisting() : FunctionPass(ID) {}
void getAnalysisUsage(AnalysisUsage &AU) const {
- AU.addRequired<TargetData>();
+ AU.addRequired<DataLayout>();
AU.addPreserved<MachineFunctionAnalysis>();
}
Modified: llvm/branches/R600/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/NVPTX/NVPTXAsmPrinter.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/NVPTX/NVPTXAsmPrinter.cpp (original)
+++ llvm/branches/R600/lib/Target/NVPTX/NVPTXAsmPrinter.cpp Thu Oct 11 16:28:00 2012
@@ -98,10 +98,10 @@
switch (CE->getOpcode()) {
default:
// If the code isn't optimized, there may be outstanding folding
- // opportunities. Attempt to fold the expression using TargetData as a
+ // opportunities. Attempt to fold the expression using DataLayout as a
// last resort before giving up.
if (Constant *C =
- ConstantFoldConstantExpression(CE, AP.TM.getTargetData()))
+ ConstantFoldConstantExpression(CE, AP.TM.getDataLayout()))
if (C != CE)
return LowerConstant(C, AP);
@@ -115,7 +115,7 @@
report_fatal_error(OS.str());
}
case Instruction::GetElementPtr: {
- const TargetData &TD = *AP.TM.getTargetData();
+ const DataLayout &TD = *AP.TM.getDataLayout();
// Generate a symbolic expression for the byte address
const Constant *PtrVal = CE->getOperand(0);
SmallVector<Value*, 8> IdxVec(CE->op_begin()+1, CE->op_end());
@@ -145,7 +145,7 @@
return LowerConstant(CE->getOperand(0), AP);
case Instruction::IntToPtr: {
- const TargetData &TD = *AP.TM.getTargetData();
+ const DataLayout &TD = *AP.TM.getDataLayout();
// Handle casts to pointers by changing them into casts to the appropriate
// integer type. This promotes constant folding and simplifies this code.
Constant *Op = CE->getOperand(0);
@@ -155,7 +155,7 @@
}
case Instruction::PtrToInt: {
- const TargetData &TD = *AP.TM.getTargetData();
+ const DataLayout &TD = *AP.TM.getDataLayout();
// Support only foldable casts to/from pointers that can be eliminated by
// changing the pointer to the appropriately sized integer type.
Constant *Op = CE->getOperand(0);
@@ -270,7 +270,7 @@
void NVPTXAsmPrinter::printReturnValStr(const Function *F,
raw_ostream &O)
{
- const TargetData *TD = TM.getTargetData();
+ const DataLayout *TD = TM.getDataLayout();
const TargetLowering *TLI = TM.getTargetLowering();
Type *Ty = F->getReturnType();
@@ -874,7 +874,7 @@
const_cast<TargetLoweringObjectFile&>(getObjFileLowering())
.Initialize(OutContext, TM);
- Mang = new Mangler(OutContext, *TM.getTargetData());
+ Mang = new Mangler(OutContext, *TM.getDataLayout());
// Emit header before any dwarf directives are emitted below.
emitHeader(M, OS1);
@@ -1023,7 +1023,7 @@
return;
}
- const TargetData *TD = TM.getTargetData();
+ const DataLayout *TD = TM.getDataLayout();
// GlobalVariables are always constant pointers themselves.
const PointerType *PTy = GVar->getType();
@@ -1296,7 +1296,7 @@
void NVPTXAsmPrinter::emitPTXGlobalVariable(const GlobalVariable* GVar,
raw_ostream &O) {
- const TargetData *TD = TM.getTargetData();
+ const DataLayout *TD = TM.getDataLayout();
// GlobalVariables are always constant pointers themselves.
const PointerType *PTy = GVar->getType();
@@ -1342,7 +1342,7 @@
static unsigned int
-getOpenCLAlignment(const TargetData *TD,
+getOpenCLAlignment(const DataLayout *TD,
Type *Ty) {
if (Ty->isPrimitiveType() || Ty->isIntegerTy() || isa<PointerType>(Ty))
return TD->getPrefTypeAlignment(Ty);
@@ -1421,7 +1421,7 @@
void NVPTXAsmPrinter::emitFunctionParamList(const Function *F,
raw_ostream &O) {
- const TargetData *TD = TM.getTargetData();
+ const DataLayout *TD = TM.getDataLayout();
const AttrListPtr &PAL = F->getAttributes();
const TargetLowering *TLI = TM.getTargetLowering();
Function::const_arg_iterator I, E;
@@ -1456,7 +1456,8 @@
continue;
}
- if (PAL.paramHasAttr(paramIndex+1, Attribute::ByVal) == false) {
+ if (PAL.getParamAttributes(paramIndex+1).
+ hasAttribute(Attributes::ByVal) == false) {
// Just a scalar
const PointerType *PTy = dyn_cast<PointerType>(Ty);
if (isKernelFunc) {
@@ -1714,7 +1715,7 @@
void NVPTXAsmPrinter::bufferLEByte(Constant *CPV, int Bytes,
AggBuffer *aggBuffer) {
- const TargetData *TD = TM.getTargetData();
+ const DataLayout *TD = TM.getDataLayout();
if (isa<UndefValue>(CPV) || CPV->isNullValue()) {
int s = TD->getTypeAllocSize(CPV->getType());
@@ -1843,7 +1844,7 @@
void NVPTXAsmPrinter::bufferAggregateConstant(Constant *CPV,
AggBuffer *aggBuffer) {
- const TargetData *TD = TM.getTargetData();
+ const DataLayout *TD = TM.getDataLayout();
int Bytes;
// Old constants
Modified: llvm/branches/R600/lib/Target/NVPTX/NVPTXISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/NVPTX/NVPTXISelLowering.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/NVPTX/NVPTXISelLowering.cpp (original)
+++ llvm/branches/R600/lib/Target/NVPTX/NVPTXISelLowering.cpp Thu Oct 11 16:28:00 2012
@@ -402,7 +402,7 @@
if (isABI) {
unsigned align = Outs[i].Flags.getByValAlign();
- unsigned sz = getTargetData()->getTypeAllocSize(ETy);
+ unsigned sz = getDataLayout()->getTypeAllocSize(ETy);
O << ".param .align " << align
<< " .b8 ";
O << "_";
@@ -655,11 +655,11 @@
else {
if (Func) { // direct call
if (!llvm::getAlign(*(CS->getCalledFunction()), 0, retAlignment))
- retAlignment = getTargetData()->getABITypeAlignment(retTy);
+ retAlignment = getDataLayout()->getABITypeAlignment(retTy);
} else { // indirect call
const CallInst *CallI = dyn_cast<CallInst>(CS->getInstruction());
if (!llvm::getAlign(*CallI, 0, retAlignment))
- retAlignment = getTargetData()->getABITypeAlignment(retTy);
+ retAlignment = getDataLayout()->getABITypeAlignment(retTy);
}
SDVTList DeclareRetVTs = DAG.getVTList(MVT::Other, MVT::Glue);
SDValue DeclareRetOps[] = { Chain, DAG.getConstant(retAlignment,
@@ -916,7 +916,7 @@
DebugLoc dl, SelectionDAG &DAG,
SmallVectorImpl<SDValue> &InVals) const {
MachineFunction &MF = DAG.getMachineFunction();
- const TargetData *TD = getTargetData();
+ const DataLayout *TD = getDataLayout();
const Function *F = MF.getFunction();
const AttrListPtr &PAL = F->getAttributes();
@@ -965,7 +965,7 @@
// to newly created nodes. The SDNOdes for params have to
// appear in the same order as their order of appearance
// in the original function. "idx+1" holds that order.
- if (PAL.paramHasAttr(i+1, Attribute::ByVal) == false) {
+ if (PAL.getParamAttributes(i+1).hasAttribute(Attributes::ByVal) == false) {
// A plain scalar.
if (isABI || isKernel) {
// If ABI, load from the param symbol
Modified: llvm/branches/R600/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp (original)
+++ llvm/branches/R600/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp Thu Oct 11 16:28:00 2012
@@ -21,7 +21,7 @@
#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/Support/InstIterator.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
using namespace llvm;
@@ -110,7 +110,7 @@
SmallVector<MemTransferInst *, 4> aggrMemcpys;
SmallVector<MemSetInst *, 4> aggrMemsets;
- TargetData *TD = &getAnalysis<TargetData>();
+ DataLayout *TD = &getAnalysis<DataLayout>();
LLVMContext &Context = F.getParent()->getContext();
//
Modified: llvm/branches/R600/lib/Target/NVPTX/NVPTXLowerAggrCopies.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/NVPTX/NVPTXLowerAggrCopies.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/NVPTX/NVPTXLowerAggrCopies.h (original)
+++ llvm/branches/R600/lib/Target/NVPTX/NVPTXLowerAggrCopies.h Thu Oct 11 16:28:00 2012
@@ -17,7 +17,7 @@
#include "llvm/Pass.h"
#include "llvm/CodeGen/MachineFunctionAnalysis.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
namespace llvm {
@@ -28,7 +28,7 @@
NVPTXLowerAggrCopies() : FunctionPass(ID) {}
void getAnalysisUsage(AnalysisUsage &AU) const {
- AU.addRequired<TargetData>();
+ AU.addRequired<DataLayout>();
AU.addPreserved<MachineFunctionAnalysis>();
}
Modified: llvm/branches/R600/lib/Target/NVPTX/NVPTXTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/NVPTX/NVPTXTargetMachine.cpp?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/NVPTX/NVPTXTargetMachine.cpp (original)
+++ llvm/branches/R600/lib/Target/NVPTX/NVPTXTargetMachine.cpp Thu Oct 11 16:28:00 2012
@@ -32,7 +32,7 @@
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
@@ -71,7 +71,7 @@
bool is64bit)
: LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
Subtarget(TT, CPU, FS, is64bit),
- DataLayout(Subtarget.getDataLayout()),
+ DL(Subtarget.getDataLayout()),
InstrInfo(*this), TLInfo(*this), TSInfo(*this), FrameLowering(*this,is64bit)
/*FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0)*/ {
}
Modified: llvm/branches/R600/lib/Target/NVPTX/NVPTXTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/lib/Target/NVPTX/NVPTXTargetMachine.h?rev=165748&r1=165747&r2=165748&view=diff
==============================================================================
--- llvm/branches/R600/lib/Target/NVPTX/NVPTXTargetMachine.h (original)
+++ llvm/branches/R600/lib/Target/NVPTX/NVPTXTargetMachine.h Thu Oct 11 16:28:00 2012
@@ -21,7 +21,7 @@
#include "NVPTXSubtarget.h"
#include "NVPTXFrameLowering.h"
#include "ManagedStringPool.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetSelectionDAGInfo.h"
@@ -32,7 +32,7 @@
///
class NVPTXTargetMachine : public LLVMTargetMachine {
NVPTXSubtarget Subtarget;
- const TargetData DataLayout; // Calculates type size & alignment
+ const DataLayout DL; // Calculates type size & alignment
NVPTXInstrInfo InstrInfo;
NVPTXTargetLowering TLInfo;
TargetSelectionDAGInfo TSInfo;
@@ -58,7 +58,7 @@
return &FrameLowering;
}
virtual const NVPTXInstrInfo *getInstrInfo() const { return &InstrInfo; }
- virtual const TargetData *getTargetData() const { return &DataLayout;}
+ virtual const DataLayout *getDataLayout() const { return &DL;}
virtual const NVPTXSubtarget *getSubtargetImpl() const { return &Subtarget;}
virtual const NVPTXRegisterInfo *getRegisterInfo() const {
More information about the llvm-branch-commits
mailing list