[llvm-branch-commits] [llvm-branch] r85819 - in /llvm/branches/Apple/Leela: ./ autoconf/ cmake/ docs/ include/llvm-c/ include/llvm/ include/llvm/ADT/ include/llvm/Analysis/ include/llvm/Bitcode/ include/llvm/CodeGen/ include/llvm/ExecutionEngine/ include/llvm/MC/ include/llvm/Support/ include/llvm/System/ include/llvm/Target/ include/llvm/Transforms/Utils/ lib/Analysis/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/ lib/CodeGen/ lib/CodeGen/AsmPrinter/ lib/CodeGen/SelectionDAG/ lib/ExecutionEngine/ lib/ExecutionEngine...
Bill Wendling
isanbard at gmail.com
Mon Nov 2 11:33:56 PST 2009
Author: void
Date: Mon Nov 2 13:33:53 2009
New Revision: 85819
URL: http://llvm.org/viewvc/llvm-project?rev=85819&view=rev
Log:
Revert these patches that attempted to add indirectbr to Leela. They broke the
Apple-style build.
svn merge -c -85763 https://llvm.org/svn/llvm-project/llvm/branches/Apple/Leela
svn merge -c -85755 https://llvm.org/svn/llvm-project/llvm/branches/Apple/Leela
svn merge -c -85750 https://llvm.org/svn/llvm-project/llvm/branches/Apple/Leela
svn merge -c -85745 https://llvm.org/svn/llvm-project/llvm/branches/Apple/Leela
Added:
llvm/branches/Apple/Leela/include/llvm/Support/AIXDataTypesFix.h
- copied unchanged from r85762, llvm/branches/Apple/Leela/include/llvm/Support/AIXDataTypesFix.h
llvm/branches/Apple/Leela/include/llvm/Support/DataTypes.h.cmake
- copied unchanged from r85762, llvm/branches/Apple/Leela/include/llvm/Support/DataTypes.h.cmake
llvm/branches/Apple/Leela/include/llvm/Support/DataTypes.h.in
- copied unchanged from r85762, llvm/branches/Apple/Leela/include/llvm/Support/DataTypes.h.in
llvm/branches/Apple/Leela/include/llvm/Transforms/Utils/InlineCost.h
- copied unchanged from r85749, llvm/branches/Apple/Leela/include/llvm/Transforms/Utils/InlineCost.h
llvm/branches/Apple/Leela/lib/Transforms/Utils/InlineCost.cpp
- copied unchanged from r85749, llvm/branches/Apple/Leela/lib/Transforms/Utils/InlineCost.cpp
llvm/branches/Apple/Leela/test/Feature/testswitch.ll
- copied unchanged from r85744, llvm/branches/Apple/Leela/test/Feature/testswitch.ll
llvm/branches/Apple/Leela/test/Transforms/ConstProp/2009-09-19-ConstFold-i1-ConstExpr.ll
- copied unchanged from r85762, llvm/branches/Apple/Leela/test/Transforms/ConstProp/2009-09-19-ConstFold-i1-ConstExpr.ll
Removed:
llvm/branches/Apple/Leela/include/llvm/Analysis/InlineCost.h
llvm/branches/Apple/Leela/include/llvm/System/AIXDataTypesFix.h
llvm/branches/Apple/Leela/include/llvm/System/DataTypes.h.cmake
llvm/branches/Apple/Leela/include/llvm/System/DataTypes.h.in
llvm/branches/Apple/Leela/lib/Analysis/InlineCost.cpp
llvm/branches/Apple/Leela/test/CodeGen/X86/loop_blocks.ll
llvm/branches/Apple/Leela/test/CodeGen/X86/x86-64-jumps.ll
llvm/branches/Apple/Leela/test/Feature/terminators.ll
llvm/branches/Apple/Leela/test/Transforms/ConstProp/constant-expr.ll
Modified:
llvm/branches/Apple/Leela/Makefile
llvm/branches/Apple/Leela/autoconf/configure.ac
llvm/branches/Apple/Leela/cmake/config-ix.cmake
llvm/branches/Apple/Leela/configure
llvm/branches/Apple/Leela/docs/LangRef.html
llvm/branches/Apple/Leela/include/llvm-c/Core.h
llvm/branches/Apple/Leela/include/llvm/ADT/EquivalenceClasses.h
llvm/branches/Apple/Leela/include/llvm/ADT/FoldingSet.h
llvm/branches/Apple/Leela/include/llvm/ADT/ImmutableList.h
llvm/branches/Apple/Leela/include/llvm/ADT/ImmutableSet.h
llvm/branches/Apple/Leela/include/llvm/ADT/SmallPtrSet.h
llvm/branches/Apple/Leela/include/llvm/ADT/SparseBitVector.h
llvm/branches/Apple/Leela/include/llvm/ADT/StringExtras.h
llvm/branches/Apple/Leela/include/llvm/ADT/Twine.h
llvm/branches/Apple/Leela/include/llvm/Analysis/ScalarEvolution.h
llvm/branches/Apple/Leela/include/llvm/Analysis/ValueTracking.h
llvm/branches/Apple/Leela/include/llvm/BasicBlock.h
llvm/branches/Apple/Leela/include/llvm/Bitcode/BitCodes.h
llvm/branches/Apple/Leela/include/llvm/Bitcode/Deserialize.h
llvm/branches/Apple/Leela/include/llvm/Bitcode/LLVMBitCodes.h
llvm/branches/Apple/Leela/include/llvm/CodeGen/AsmPrinter.h
llvm/branches/Apple/Leela/include/llvm/CodeGen/BinaryObject.h
llvm/branches/Apple/Leela/include/llvm/CodeGen/ELFRelocation.h
llvm/branches/Apple/Leela/include/llvm/CodeGen/JITCodeEmitter.h
llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineBasicBlock.h
llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineCodeEmitter.h
llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineFrameInfo.h
llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineInstrBuilder.h
llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineModuleInfo.h
llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineOperand.h
llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineRelocation.h
llvm/branches/Apple/Leela/include/llvm/CodeGen/SelectionDAG.h
llvm/branches/Apple/Leela/include/llvm/CodeGen/SelectionDAGNodes.h
llvm/branches/Apple/Leela/include/llvm/CodeGen/ValueTypes.h
llvm/branches/Apple/Leela/include/llvm/Constant.h
llvm/branches/Apple/Leela/include/llvm/Constants.h
llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/ExecutionEngine.h
llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/GenericValue.h
llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/JITEventListener.h
llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/JITMemoryManager.h
llvm/branches/Apple/Leela/include/llvm/InstrTypes.h
llvm/branches/Apple/Leela/include/llvm/Instruction.def
llvm/branches/Apple/Leela/include/llvm/Instruction.h
llvm/branches/Apple/Leela/include/llvm/Instructions.h
llvm/branches/Apple/Leela/include/llvm/MC/MCAsmLexer.h
llvm/branches/Apple/Leela/include/llvm/MC/MCAsmParser.h
llvm/branches/Apple/Leela/include/llvm/MC/MCAssembler.h
llvm/branches/Apple/Leela/include/llvm/MC/MCDisassembler.h
llvm/branches/Apple/Leela/include/llvm/MC/MCExpr.h
llvm/branches/Apple/Leela/include/llvm/MC/MCInst.h
llvm/branches/Apple/Leela/include/llvm/MC/MCStreamer.h
llvm/branches/Apple/Leela/include/llvm/MC/MCSymbol.h
llvm/branches/Apple/Leela/include/llvm/MC/MCValue.h
llvm/branches/Apple/Leela/include/llvm/Module.h
llvm/branches/Apple/Leela/include/llvm/Pass.h
llvm/branches/Apple/Leela/include/llvm/Support/Allocator.h
llvm/branches/Apple/Leela/include/llvm/Support/ConstantRange.h
llvm/branches/Apple/Leela/include/llvm/Support/ELF.h
llvm/branches/Apple/Leela/include/llvm/Support/IRBuilder.h
llvm/branches/Apple/Leela/include/llvm/Support/InstVisitor.h
llvm/branches/Apple/Leela/include/llvm/Support/MathExtras.h
llvm/branches/Apple/Leela/include/llvm/Support/MemoryBuffer.h
llvm/branches/Apple/Leela/include/llvm/Support/MemoryObject.h
llvm/branches/Apple/Leela/include/llvm/Support/PointerLikeTypeTraits.h
llvm/branches/Apple/Leela/include/llvm/Support/SlowOperationInformer.h
llvm/branches/Apple/Leela/include/llvm/Support/Timer.h
llvm/branches/Apple/Leela/include/llvm/Support/ValueHandle.h
llvm/branches/Apple/Leela/include/llvm/Support/raw_ostream.h
llvm/branches/Apple/Leela/include/llvm/System/Atomic.h
llvm/branches/Apple/Leela/include/llvm/System/Disassembler.h
llvm/branches/Apple/Leela/include/llvm/System/Memory.h
llvm/branches/Apple/Leela/include/llvm/System/TimeValue.h
llvm/branches/Apple/Leela/include/llvm/Target/SubtargetFeature.h
llvm/branches/Apple/Leela/include/llvm/Target/TargetData.h
llvm/branches/Apple/Leela/include/llvm/Target/TargetIntrinsicInfo.h
llvm/branches/Apple/Leela/include/llvm/Target/TargetJITInfo.h
llvm/branches/Apple/Leela/include/llvm/Target/TargetSelectionDAG.td
llvm/branches/Apple/Leela/include/llvm/Transforms/Utils/BasicBlockUtils.h
llvm/branches/Apple/Leela/include/llvm/Transforms/Utils/BasicInliner.h
llvm/branches/Apple/Leela/include/llvm/Transforms/Utils/ValueMapper.h
llvm/branches/Apple/Leela/include/llvm/Type.h
llvm/branches/Apple/Leela/include/llvm/Value.h
llvm/branches/Apple/Leela/include/llvm/ValueSymbolTable.h
llvm/branches/Apple/Leela/lib/Analysis/SparsePropagation.cpp
llvm/branches/Apple/Leela/lib/AsmParser/LLLexer.cpp
llvm/branches/Apple/Leela/lib/AsmParser/LLParser.cpp
llvm/branches/Apple/Leela/lib/AsmParser/LLParser.h
llvm/branches/Apple/Leela/lib/AsmParser/LLToken.h
llvm/branches/Apple/Leela/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/branches/Apple/Leela/lib/Bitcode/Reader/BitcodeReader.h
llvm/branches/Apple/Leela/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/branches/Apple/Leela/lib/Bitcode/Writer/ValueEnumerator.cpp
llvm/branches/Apple/Leela/lib/Bitcode/Writer/ValueEnumerator.h
llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/branches/Apple/Leela/lib/CodeGen/BranchFolding.cpp
llvm/branches/Apple/Leela/lib/CodeGen/ELF.h
llvm/branches/Apple/Leela/lib/CodeGen/MachineBasicBlock.cpp
llvm/branches/Apple/Leela/lib/CodeGen/MachineInstr.cpp
llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h
llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/SelectionDAGBuild.h
llvm/branches/Apple/Leela/lib/ExecutionEngine/ExecutionEngine.cpp
llvm/branches/Apple/Leela/lib/ExecutionEngine/Interpreter/Execution.cpp
llvm/branches/Apple/Leela/lib/ExecutionEngine/Interpreter/Interpreter.h
llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JIT.h
llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JITDebugRegisterer.h
llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JITEmitter.cpp
llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
llvm/branches/Apple/Leela/lib/Linker/LinkModules.cpp
llvm/branches/Apple/Leela/lib/MC/MCAsmInfo.cpp
llvm/branches/Apple/Leela/lib/Support/Allocator.cpp
llvm/branches/Apple/Leela/lib/System/Unix/Memory.inc
llvm/branches/Apple/Leela/lib/System/Win32/Memory.inc
llvm/branches/Apple/Leela/lib/Target/CBackend/CBackend.cpp
llvm/branches/Apple/Leela/lib/Target/CellSPU/SPU.h
llvm/branches/Apple/Leela/lib/Target/CppBackend/CPPBackend.cpp
llvm/branches/Apple/Leela/lib/Target/MSIL/MSILWriter.cpp
llvm/branches/Apple/Leela/lib/Target/TargetIntrinsicInfo.cpp
llvm/branches/Apple/Leela/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
llvm/branches/Apple/Leela/lib/Target/X86/X86ISelDAGToDAG.cpp
llvm/branches/Apple/Leela/lib/Target/X86/X86ISelLowering.cpp
llvm/branches/Apple/Leela/lib/Target/X86/X86ISelLowering.h
llvm/branches/Apple/Leela/lib/Target/X86/X86Instr64bit.td
llvm/branches/Apple/Leela/lib/Target/X86/X86InstrInfo.td
llvm/branches/Apple/Leela/lib/Transforms/IPO/GlobalDCE.cpp
llvm/branches/Apple/Leela/lib/Transforms/IPO/GlobalOpt.cpp
llvm/branches/Apple/Leela/lib/Transforms/IPO/InlineAlways.cpp
llvm/branches/Apple/Leela/lib/Transforms/IPO/InlineSimple.cpp
llvm/branches/Apple/Leela/lib/Transforms/IPO/Inliner.cpp
llvm/branches/Apple/Leela/lib/Transforms/IPO/StripSymbols.cpp
llvm/branches/Apple/Leela/lib/Transforms/Scalar/CodeGenPrepare.cpp
llvm/branches/Apple/Leela/lib/Transforms/Scalar/CondPropagate.cpp
llvm/branches/Apple/Leela/lib/Transforms/Scalar/GVN.cpp
llvm/branches/Apple/Leela/lib/Transforms/Scalar/IndVarSimplify.cpp
llvm/branches/Apple/Leela/lib/Transforms/Scalar/LoopUnswitch.cpp
llvm/branches/Apple/Leela/lib/Transforms/Scalar/SCCP.cpp
llvm/branches/Apple/Leela/lib/Transforms/Utils/BasicBlockUtils.cpp
llvm/branches/Apple/Leela/lib/Transforms/Utils/BreakCriticalEdges.cpp
llvm/branches/Apple/Leela/lib/Transforms/Utils/CloneFunction.cpp
llvm/branches/Apple/Leela/lib/Transforms/Utils/CloneModule.cpp
llvm/branches/Apple/Leela/lib/Transforms/Utils/Local.cpp
llvm/branches/Apple/Leela/lib/Transforms/Utils/ValueMapper.cpp
llvm/branches/Apple/Leela/lib/VMCore/AsmWriter.cpp
llvm/branches/Apple/Leela/lib/VMCore/BasicBlock.cpp
llvm/branches/Apple/Leela/lib/VMCore/ConstantFold.cpp
llvm/branches/Apple/Leela/lib/VMCore/Constants.cpp
llvm/branches/Apple/Leela/lib/VMCore/ConstantsContext.h
llvm/branches/Apple/Leela/lib/VMCore/Function.cpp
llvm/branches/Apple/Leela/lib/VMCore/Globals.cpp
llvm/branches/Apple/Leela/lib/VMCore/Instruction.cpp
llvm/branches/Apple/Leela/lib/VMCore/Instructions.cpp
llvm/branches/Apple/Leela/lib/VMCore/LLVMContextImpl.h
llvm/branches/Apple/Leela/lib/VMCore/Verifier.cpp
llvm/branches/Apple/Leela/projects/sample/lib/sample/sample.c
llvm/branches/Apple/Leela/test/Transforms/SimplifyCFG/basictest.ll
llvm/branches/Apple/Leela/tools/llvm-mc/AsmLexer.h
llvm/branches/Apple/Leela/unittests/ADT/StringMapTest.cpp
llvm/branches/Apple/Leela/unittests/ExecutionEngine/ExecutionEngineTest.cpp
llvm/branches/Apple/Leela/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp
llvm/branches/Apple/Leela/unittests/ExecutionEngine/JIT/JITTest.cpp
llvm/branches/Apple/Leela/unittests/ExecutionEngine/JIT/Makefile
llvm/branches/Apple/Leela/unittests/Transforms/Utils/Cloning.cpp
llvm/branches/Apple/Leela/utils/TableGen/CodeGenDAGPatterns.h
llvm/branches/Apple/Leela/utils/TableGen/DAGISelEmitter.cpp
llvm/branches/Apple/Leela/utils/TableGen/Record.cpp
llvm/branches/Apple/Leela/utils/TableGen/Record.h
llvm/branches/Apple/Leela/utils/TableGen/TGLexer.h
Modified: llvm/branches/Apple/Leela/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/Makefile?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/Makefile (original)
+++ llvm/branches/Apple/Leela/Makefile Mon Nov 2 13:33:53 2009
@@ -136,7 +136,8 @@
$(Echo) Eliminating files constructed by configure
$(Verb) $(RM) -f \
$(TopDistDir)/include/llvm/Config/config.h \
- $(TopDistDir)/include/llvm/System/DataTypes.h
+ $(TopDistDir)/include/llvm/Support/DataTypes.h \
+ $(TopDistDir)/include/llvm/Support/ThreadSupport.h
clang-only: all
tools-only: all
@@ -152,7 +153,7 @@
include/llvm/Config/config.h \
include/llvm/Config/Targets.def \
include/llvm/Config/AsmPrinters.def \
- include/llvm/System/DataTypes.h \
+ include/llvm/Support/DataTypes.h \
tools/llvmc/plugins/Base/Base.td
FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
Modified: llvm/branches/Apple/Leela/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/autoconf/configure.ac?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/autoconf/configure.ac (original)
+++ llvm/branches/Apple/Leela/autoconf/configure.ac Mon Nov 2 13:33:53 2009
@@ -1344,7 +1344,7 @@
AC_CONFIG_FILES([include/llvm/Config/Targets.def])
AC_CONFIG_FILES([include/llvm/Config/AsmPrinters.def])
AC_CONFIG_FILES([include/llvm/Config/AsmParsers.def])
-AC_CONFIG_HEADERS([include/llvm/System/DataTypes.h])
+AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h])
dnl Configure the makefile's configuration data
AC_CONFIG_FILES([Makefile.config])
Modified: llvm/branches/Apple/Leela/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/cmake/config-ix.cmake?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/cmake/config-ix.cmake (original)
+++ llvm/branches/Apple/Leela/cmake/config-ix.cmake Mon Nov 2 13:33:53 2009
@@ -229,7 +229,7 @@
)
configure_file(
- ${LLVM_MAIN_INCLUDE_DIR}/llvm/System/DataTypes.h.cmake
- ${LLVM_BINARY_DIR}/include/llvm/System/DataTypes.h
+ ${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/DataTypes.h.cmake
+ ${LLVM_BINARY_DIR}/include/llvm/Support/DataTypes.h
)
Modified: llvm/branches/Apple/Leela/configure
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/configure?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/configure (original)
+++ llvm/branches/Apple/Leela/configure Mon Nov 2 13:33:53 2009
@@ -35269,7 +35269,7 @@
ac_config_files="$ac_config_files include/llvm/Config/AsmParsers.def"
-ac_config_headers="$ac_config_headers include/llvm/System/DataTypes.h"
+ac_config_headers="$ac_config_headers include/llvm/Support/DataTypes.h"
ac_config_files="$ac_config_files Makefile.config"
@@ -35896,7 +35896,7 @@
"include/llvm/Config/Targets.def") CONFIG_FILES="$CONFIG_FILES include/llvm/Config/Targets.def" ;;
"include/llvm/Config/AsmPrinters.def") CONFIG_FILES="$CONFIG_FILES include/llvm/Config/AsmPrinters.def" ;;
"include/llvm/Config/AsmParsers.def") CONFIG_FILES="$CONFIG_FILES include/llvm/Config/AsmParsers.def" ;;
- "include/llvm/System/DataTypes.h") CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/System/DataTypes.h" ;;
+ "include/llvm/Support/DataTypes.h") CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/Support/DataTypes.h" ;;
"Makefile.config") CONFIG_FILES="$CONFIG_FILES Makefile.config" ;;
"llvm.spec") CONFIG_FILES="$CONFIG_FILES llvm.spec" ;;
"docs/doxygen.cfg") CONFIG_FILES="$CONFIG_FILES docs/doxygen.cfg" ;;
Modified: llvm/branches/Apple/Leela/docs/LangRef.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/docs/LangRef.html?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/docs/LangRef.html (original)
+++ llvm/branches/Apple/Leela/docs/LangRef.html Mon Nov 2 13:33:53 2009
@@ -83,7 +83,6 @@
<li><a href="#complexconstants">Complex Constants</a></li>
<li><a href="#globalconstants">Global Variable and Function Addresses</a></li>
<li><a href="#undefvalues">Undefined Values</a></li>
- <li><a href="#blockaddress">Addresses of Basic Blocks</a></li>
<li><a href="#constantexprs">Constant Expressions</a></li>
<li><a href="#metadata">Embedded Metadata</a></li>
</ol>
@@ -111,7 +110,6 @@
<li><a href="#i_ret">'<tt>ret</tt>' Instruction</a></li>
<li><a href="#i_br">'<tt>br</tt>' Instruction</a></li>
<li><a href="#i_switch">'<tt>switch</tt>' Instruction</a></li>
- <li><a href="#i_indirectbr">'<tt>indirectbr</tt>' Instruction</a></li>
<li><a href="#i_invoke">'<tt>invoke</tt>' Instruction</a></li>
<li><a href="#i_unwind">'<tt>unwind</tt>' Instruction</a></li>
<li><a href="#i_unreachable">'<tt>unreachable</tt>' Instruction</a></li>
@@ -2166,34 +2164,6 @@
</div>
<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="blockaddress">Addresses of Basic
- Blocks</a></div>
-<div class="doc_text">
-
-<p><b><tt>blockaddress(@function, %block)</tt></b></p>
-
-<p>The '<tt>blockaddress</tt>' constant computes the address of the specified
- basic block in the specified function, and always has an i8* type. Taking
- the address of the entry block is illegal.</p>
-
-<p>This value only has defined behavior when used as an operand to the
- '<a href="#i_indirectbr"><tt>indirectbr</tt></a>' instruction or for comparisons
- against null. Pointer equality tests between labels addresses is undefined
- behavior - though, again, comparison against null is ok, and no label is
- equal to the null pointer. This may also be passed around as an opaque
- pointer sized value as long as the bits are not inspected. This allows
- <tt>ptrtoint</tt> and arithmetic to be performed on these values so long as
- the original value is reconstituted before the <tt>indirectbr</tt>.</p>
-
-<p>Finally, some targets may provide defined semantics when
- using the value as the operand to an inline assembly, but that is target
- specific.
- </p>
-
-</div>
-
-
-<!-- ======================================================================= -->
<div class="doc_subsection"><a name="constantexprs">Constant Expressions</a>
</div>
@@ -2517,7 +2487,6 @@
'<a href="#i_ret"><tt>ret</tt></a>' instruction, the
'<a href="#i_br"><tt>br</tt></a>' instruction, the
'<a href="#i_switch"><tt>switch</tt></a>' instruction, the
- '<a href="#i_indirectbr">'<tt>indirectbr</tt>' Instruction, the
'<a href="#i_invoke"><tt>invoke</tt></a>' instruction, the
'<a href="#i_unwind"><tt>unwind</tt></a>' instruction, and the
'<a href="#i_unreachable"><tt>unreachable</tt></a>' instruction.</p>
@@ -2676,55 +2645,6 @@
</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
- <a name="i_indirectbr">'<tt>indirectbr</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
- indirectbr <somety>* <address>, [ label <dest1>, label <dest2>, ... ]
-</pre>
-
-<h5>Overview:</h5>
-
-<p>The '<tt>indirectbr</tt>' instruction implements an indirect branch to a label
- within the current function, whose address is specified by
- "<tt>address</tt>". Address must be derived from a <a
- href="#blockaddress">blockaddress</a> constant.</p>
-
-<h5>Arguments:</h5>
-
-<p>The '<tt>address</tt>' argument is the address of the label to jump to. The
- rest of the arguments indicate the full set of possible destinations that the
- address may point to. Blocks are allowed to occur multiple times in the
- destination list, though this isn't particularly useful.</p>
-
-<p>This destination list is required so that dataflow analysis has an accurate
- understanding of the CFG.</p>
-
-<h5>Semantics:</h5>
-
-<p>Control transfers to the block specified in the address argument. All
- possible destination blocks must be listed in the label list, otherwise this
- instruction has undefined behavior. This implies that jumps to labels
- defined in other functions have undefined behavior as well.</p>
-
-<h5>Implementation:</h5>
-
-<p>This is typically implemented with a jump through a register.</p>
-
-<h5>Example:</h5>
-<pre>
- indirectbr i8* %Addr, [ label %bb1, label %bb2, label %bb3 ]
-</pre>
-
-</div>
-
-
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="i_invoke">'<tt>invoke</tt>' Instruction</a>
Modified: llvm/branches/Apple/Leela/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm-c/Core.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm-c/Core.h (original)
+++ llvm/branches/Apple/Leela/include/llvm-c/Core.h Mon Nov 2 13:33:53 2009
@@ -33,7 +33,7 @@
#ifndef LLVM_C_CORE_H
#define LLVM_C_CORE_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#ifdef __cplusplus
Modified: llvm/branches/Apple/Leela/include/llvm/ADT/EquivalenceClasses.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/ADT/EquivalenceClasses.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/ADT/EquivalenceClasses.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/ADT/EquivalenceClasses.h Mon Nov 2 13:33:53 2009
@@ -15,7 +15,7 @@
#ifndef LLVM_ADT_EQUIVALENCECLASSES_H
#define LLVM_ADT_EQUIVALENCECLASSES_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <set>
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/ADT/FoldingSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/ADT/FoldingSet.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/ADT/FoldingSet.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/ADT/FoldingSet.h Mon Nov 2 13:33:53 2009
@@ -16,7 +16,7 @@
#ifndef LLVM_ADT_FOLDINGSET_H
#define LLVM_ADT_FOLDINGSET_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include <iterator>
Modified: llvm/branches/Apple/Leela/include/llvm/ADT/ImmutableList.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/ADT/ImmutableList.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/ADT/ImmutableList.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/ADT/ImmutableList.h Mon Nov 2 13:33:53 2009
@@ -16,7 +16,7 @@
#include "llvm/Support/Allocator.h"
#include "llvm/ADT/FoldingSet.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <cassert>
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/ADT/ImmutableSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/ADT/ImmutableSet.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/ADT/ImmutableSet.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/ADT/ImmutableSet.h Mon Nov 2 13:33:53 2009
@@ -16,7 +16,7 @@
#include "llvm/Support/Allocator.h"
#include "llvm/ADT/FoldingSet.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <cassert>
#include <functional>
Modified: llvm/branches/Apple/Leela/include/llvm/ADT/SmallPtrSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/ADT/SmallPtrSet.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/ADT/SmallPtrSet.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/ADT/SmallPtrSet.h Mon Nov 2 13:33:53 2009
@@ -18,7 +18,7 @@
#include <cassert>
#include <cstring>
#include <iterator>
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/Support/PointerLikeTypeTraits.h"
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/ADT/SparseBitVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/ADT/SparseBitVector.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/ADT/SparseBitVector.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/ADT/SparseBitVector.h Mon Nov 2 13:33:53 2009
@@ -17,7 +17,7 @@
#include "llvm/ADT/ilist.h"
#include "llvm/ADT/ilist_node.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
Modified: llvm/branches/Apple/Leela/include/llvm/ADT/StringExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/ADT/StringExtras.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/ADT/StringExtras.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/ADT/StringExtras.h Mon Nov 2 13:33:53 2009
@@ -14,7 +14,7 @@
#ifndef LLVM_ADT_STRINGEXTRAS_H
#define LLVM_ADT_STRINGEXTRAS_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/ADT/APFloat.h"
#include <cctype>
#include <cstdio>
Modified: llvm/branches/Apple/Leela/include/llvm/ADT/Twine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/ADT/Twine.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/ADT/Twine.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/ADT/Twine.h Mon Nov 2 13:33:53 2009
@@ -11,7 +11,7 @@
#define LLVM_ADT_TWINE_H
#include "llvm/ADT/StringRef.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <cassert>
#include <string>
Removed: llvm/branches/Apple/Leela/include/llvm/Analysis/InlineCost.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Analysis/InlineCost.h?rev=85818&view=auto
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Analysis/InlineCost.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Analysis/InlineCost.h (removed)
@@ -1,180 +0,0 @@
-//===- InlineCost.cpp - Cost analysis for inliner ---------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements heuristics for inlining decisions.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ANALYSIS_INLINECOST_H
-#define LLVM_ANALYSIS_INLINECOST_H
-
-#include <cassert>
-#include <climits>
-#include <map>
-#include <vector>
-
-namespace llvm {
-
- class Value;
- class Function;
- class BasicBlock;
- class CallSite;
- template<class PtrType, unsigned SmallSize>
- class SmallPtrSet;
-
- // CodeMetrics - Calculate size and a few similar metrics for a set of
- // basic blocks.
- struct CodeMetrics {
- /// NeverInline - True if this callee should never be inlined into a
- /// caller.
- bool NeverInline;
-
- /// usesDynamicAlloca - True if this function calls alloca (in the C sense).
- bool usesDynamicAlloca;
-
- /// NumInsts, NumBlocks - Keep track of how large each function is, which
- /// is used to estimate the code size cost of inlining it.
- unsigned NumInsts, NumBlocks;
-
- /// NumVectorInsts - Keep track of how many instructions produce vector
- /// values. The inliner is being more aggressive with inlining vector
- /// kernels.
- unsigned NumVectorInsts;
-
- /// NumRets - Keep track of how many Ret instructions the block contains.
- unsigned NumRets;
-
- CodeMetrics() : NeverInline(false), usesDynamicAlloca(false), NumInsts(0),
- NumBlocks(0), NumVectorInsts(0), NumRets(0) {}
-
- /// analyzeBasicBlock - Add information about the specified basic block
- /// to the current structure.
- void analyzeBasicBlock(const BasicBlock *BB);
-
- /// analyzeFunction - Add information about the specified function
- /// to the current structure.
- void analyzeFunction(Function *F);
- };
-
- namespace InlineConstants {
- // Various magic constants used to adjust heuristics.
- const int CallPenalty = 5;
- const int LastCallToStaticBonus = -15000;
- const int ColdccPenalty = 2000;
- const int NoreturnPenalty = 10000;
- }
-
- /// InlineCost - Represent the cost of inlining a function. This
- /// supports special values for functions which should "always" or
- /// "never" be inlined. Otherwise, the cost represents a unitless
- /// amount; smaller values increase the likelyhood of the function
- /// being inlined.
- class InlineCost {
- enum Kind {
- Value,
- Always,
- Never
- };
-
- // This is a do-it-yourself implementation of
- // int Cost : 30;
- // unsigned Type : 2;
- // We used to use bitfields, but they were sometimes miscompiled (PR3822).
- enum { TYPE_BITS = 2 };
- enum { COST_BITS = unsigned(sizeof(unsigned)) * CHAR_BIT - TYPE_BITS };
- unsigned TypedCost; // int Cost : COST_BITS; unsigned Type : TYPE_BITS;
-
- Kind getType() const {
- return Kind(TypedCost >> COST_BITS);
- }
-
- int getCost() const {
- // Sign-extend the bottom COST_BITS bits.
- return (int(TypedCost << TYPE_BITS)) >> TYPE_BITS;
- }
-
- InlineCost(int C, int T) {
- TypedCost = (unsigned(C << TYPE_BITS) >> TYPE_BITS) | (T << COST_BITS);
- assert(getCost() == C && "Cost exceeds InlineCost precision");
- }
- public:
- static InlineCost get(int Cost) { return InlineCost(Cost, Value); }
- static InlineCost getAlways() { return InlineCost(0, Always); }
- static InlineCost getNever() { return InlineCost(0, Never); }
-
- bool isVariable() const { return getType() == Value; }
- bool isAlways() const { return getType() == Always; }
- bool isNever() const { return getType() == Never; }
-
- /// getValue() - Return a "variable" inline cost's amount. It is
- /// an error to call this on an "always" or "never" InlineCost.
- int getValue() const {
- assert(getType() == Value && "Invalid access of InlineCost");
- return getCost();
- }
- };
-
- /// InlineCostAnalyzer - Cost analyzer used by inliner.
- class InlineCostAnalyzer {
- struct ArgInfo {
- public:
- unsigned ConstantWeight;
- unsigned AllocaWeight;
-
- ArgInfo(unsigned CWeight, unsigned AWeight)
- : ConstantWeight(CWeight), AllocaWeight(AWeight) {}
- };
-
- struct FunctionInfo {
- CodeMetrics Metrics;
-
- /// ArgumentWeights - Each formal argument of the function is inspected to
- /// see if it is used in any contexts where making it a constant or alloca
- /// would reduce the code size. If so, we add some value to the argument
- /// entry here.
- std::vector<ArgInfo> ArgumentWeights;
-
- /// CountCodeReductionForConstant - Figure out an approximation for how
- /// many instructions will be constant folded if the specified value is
- /// constant.
- unsigned CountCodeReductionForConstant(Value *V);
-
- /// CountCodeReductionForAlloca - Figure out an approximation of how much
- /// smaller the function will be if it is inlined into a context where an
- /// argument becomes an alloca.
- ///
- unsigned CountCodeReductionForAlloca(Value *V);
-
- /// analyzeFunction - Add information about the specified function
- /// to the current structure.
- void analyzeFunction(Function *F);
- };
-
- std::map<const Function *, FunctionInfo> CachedFunctionInfo;
-
- public:
-
- /// getInlineCost - The heuristic used to determine if we should inline the
- /// function call or not.
- ///
- InlineCost getInlineCost(CallSite CS,
- SmallPtrSet<const Function *, 16> &NeverInline);
-
- /// getInlineFudgeFactor - Return a > 1.0 factor if the inliner should use a
- /// higher threshold to determine if the function call should be inlined.
- float getInlineFudgeFactor(CallSite CS);
-
- /// resetCachedFunctionInfo - erase any cached cost info for this function.
- void resetCachedCostInfo(Function* Caller) {
- CachedFunctionInfo[Caller] = FunctionInfo();
- }
- };
-}
-
-#endif
Modified: llvm/branches/Apple/Leela/include/llvm/Analysis/ScalarEvolution.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Analysis/ScalarEvolution.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Analysis/ScalarEvolution.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Analysis/ScalarEvolution.h Mon Nov 2 13:33:53 2009
@@ -24,7 +24,7 @@
#include "llvm/Pass.h"
#include "llvm/Instructions.h"
#include "llvm/Function.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/Support/ValueHandle.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/ConstantRange.h"
Modified: llvm/branches/Apple/Leela/include/llvm/Analysis/ValueTracking.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Analysis/ValueTracking.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Analysis/ValueTracking.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Analysis/ValueTracking.h Mon Nov 2 13:33:53 2009
@@ -15,7 +15,7 @@
#ifndef LLVM_ANALYSIS_VALUETRACKING_H
#define LLVM_ANALYSIS_VALUETRACKING_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <string>
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/BasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/BasicBlock.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/BasicBlock.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/BasicBlock.h Mon Nov 2 13:33:53 2009
@@ -17,13 +17,12 @@
#include "llvm/Instruction.h"
#include "llvm/SymbolTableListTraits.h"
#include "llvm/ADT/ilist.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
class TerminatorInst;
class LLVMContext;
-class BlockAddress;
template<> struct ilist_traits<Instruction>
: public SymbolTableListTraits<Instruction, BasicBlock> {
@@ -67,7 +66,7 @@
/// @brief LLVM Basic Block Representation
class BasicBlock : public Value, // Basic blocks are data objects also
public ilist_node<BasicBlock> {
- friend class BlockAddress;
+
public:
typedef iplist<Instruction> InstListType;
private:
@@ -109,10 +108,10 @@
Function *getParent() { return Parent; }
/// use_back - Specialize the methods defined in Value, as we know that an
- /// BasicBlock can only be used by Users (specifically PHI nodes, terminators,
- /// and BlockAddress's).
- User *use_back() { return cast<User>(*use_begin());}
- const User *use_back() const { return cast<User>(*use_begin());}
+ /// BasicBlock can only be used by Instructions (specifically PHI nodes and
+ /// terminators).
+ Instruction *use_back() { return cast<Instruction>(*use_begin());}
+ const Instruction *use_back() const { return cast<Instruction>(*use_begin());}
/// getTerminator() - If this is a well formed basic block, then this returns
/// a pointer to the terminator instruction. If it is not, then you get a
@@ -236,19 +235,6 @@
/// keeping loop information consistent, use the SplitBlock utility function.
///
BasicBlock *splitBasicBlock(iterator I, const Twine &BBName = "");
-
- /// hasAddressTaken - returns true if there are any uses of this basic block
- /// other than direct branches, switches, etc. to it.
- bool hasAddressTaken() const { return SubclassData != 0; }
-
-private:
- /// AdjustBlockAddressRefCount - BasicBlock stores the number of BlockAddress
- /// objects using it. This is almost always 0, sometimes one, possibly but
- /// almost never 2, and inconceivably 3 or more.
- void AdjustBlockAddressRefCount(int Amt) {
- SubclassData += Amt;
- assert((int)(char)SubclassData >= 0 && "Refcount wrap-around");
- }
};
} // End llvm namespace
Modified: llvm/branches/Apple/Leela/include/llvm/Bitcode/BitCodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Bitcode/BitCodes.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Bitcode/BitCodes.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Bitcode/BitCodes.h Mon Nov 2 13:33:53 2009
@@ -19,7 +19,7 @@
#define LLVM_BITCODE_BITCODES_H
#include "llvm/ADT/SmallVector.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <cassert>
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/Bitcode/Deserialize.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Bitcode/Deserialize.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Bitcode/Deserialize.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Bitcode/Deserialize.h Mon Nov 2 13:33:53 2009
@@ -20,7 +20,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Allocator.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <vector>
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/Bitcode/LLVMBitCodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Bitcode/LLVMBitCodes.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Bitcode/LLVMBitCodes.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Bitcode/LLVMBitCodes.h Mon Nov 2 13:33:53 2009
@@ -138,8 +138,7 @@
CST_CODE_CE_CMP = 17, // CE_CMP: [opty, opval, opval, pred]
CST_CODE_INLINEASM = 18, // INLINEASM: [sideeffect,asmstr,conststr]
CST_CODE_CE_SHUFVEC_EX = 19, // SHUFVEC_EX: [opty, opval, opval, opval]
- CST_CODE_CE_INBOUNDS_GEP = 20,// INBOUNDS_GEP: [n x operands]
- CST_CODE_BLOCKADDRESS = 21 // CST_CODE_BLOCKADDRESS [fnty, fnval, bb#]
+ CST_CODE_CE_INBOUNDS_GEP = 20 // INBOUNDS_GEP: [n x operands]
};
/// CastOpcodes - These are values used in the bitcode files to encode which
@@ -210,7 +209,7 @@
FUNC_CODE_INST_RET = 10, // RET: [opty,opval<both optional>]
FUNC_CODE_INST_BR = 11, // BR: [bb#, bb#, cond] or [bb#]
- FUNC_CODE_INST_SWITCH = 12, // SWITCH: [opty, op0, op1, ...]
+ FUNC_CODE_INST_SWITCH = 12, // SWITCH: [opty, opval, n, n x ops]
FUNC_CODE_INST_INVOKE = 13, // INVOKE: [attr, fnty, op0,op1, ...]
FUNC_CODE_INST_UNWIND = 14, // UNWIND
FUNC_CODE_INST_UNREACHABLE = 15, // UNREACHABLE
@@ -237,8 +236,7 @@
FUNC_CODE_INST_CMP2 = 28, // CMP2: [opty, opval, opval, pred]
// new select on i1 or [N x i1]
FUNC_CODE_INST_VSELECT = 29, // VSELECT: [ty,opval,opval,predty,pred]
- FUNC_CODE_INST_INBOUNDS_GEP= 30, // INBOUNDS_GEP: [n x operands]
- FUNC_CODE_INST_INDIRECTBR = 31 // INDIRECTBR: [opty, op0, op1, ...]
+ FUNC_CODE_INST_INBOUNDS_GEP = 30 // INBOUNDS_GEP: [n x operands]
};
} // End bitc namespace
} // End llvm namespace
Modified: llvm/branches/Apple/Leela/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/CodeGen/AsmPrinter.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/CodeGen/AsmPrinter.h Mon Nov 2 13:33:53 2009
@@ -22,7 +22,6 @@
#include "llvm/ADT/DenseMap.h"
namespace llvm {
- class BlockAddress;
class GCStrategy;
class Constant;
class ConstantArray;
@@ -335,12 +334,6 @@
/// block label.
MCSymbol *GetMBBSymbol(unsigned MBBID) const;
- /// GetBlockAddressSymbol - Return the MCSymbol used to satisfy BlockAddress
- /// uses of the specified basic block.
- MCSymbol *GetBlockAddressSymbol(const BlockAddress *BA) const;
- MCSymbol *GetBlockAddressSymbol(const Function *F,
- const BasicBlock *BB) const;
-
/// EmitBasicBlockStart - This method prints the label for the specified
/// MachineBasicBlock, an alignment (if present) and a comment describing
/// it if appropriate.
Modified: llvm/branches/Apple/Leela/include/llvm/CodeGen/BinaryObject.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/CodeGen/BinaryObject.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/CodeGen/BinaryObject.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/CodeGen/BinaryObject.h Mon Nov 2 13:33:53 2009
@@ -15,7 +15,7 @@
#ifndef LLVM_CODEGEN_BINARYOBJECT_H
#define LLVM_CODEGEN_BINARYOBJECT_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <string>
#include <vector>
Modified: llvm/branches/Apple/Leela/include/llvm/CodeGen/ELFRelocation.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/CodeGen/ELFRelocation.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/CodeGen/ELFRelocation.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/CodeGen/ELFRelocation.h Mon Nov 2 13:33:53 2009
@@ -14,7 +14,7 @@
#ifndef LLVM_CODEGEN_ELF_RELOCATION_H
#define LLVM_CODEGEN_ELF_RELOCATION_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/CodeGen/JITCodeEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/CodeGen/JITCodeEmitter.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/CodeGen/JITCodeEmitter.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/CodeGen/JITCodeEmitter.h Mon Nov 2 13:33:53 2009
@@ -18,7 +18,7 @@
#define LLVM_CODEGEN_JITCODEEMITTER_H
#include <string>
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/CodeGen/MachineCodeEmitter.h"
Modified: llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineBasicBlock.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineBasicBlock.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineBasicBlock.h Mon Nov 2 13:33:53 2009
@@ -76,10 +76,6 @@
/// exception handler.
bool IsLandingPad;
- /// AddressTaken - Indicate that this basic block is potentially the
- /// target of an indirect branch.
- bool AddressTaken;
-
// Intrusive list support
MachineBasicBlock() {}
@@ -96,14 +92,6 @@
///
const BasicBlock *getBasicBlock() const { return BB; }
- /// hasAddressTaken - Test whether this block is potentially the target
- /// of an indirect branch.
- bool hasAddressTaken() const { return AddressTaken; }
-
- /// setHasAddressTaken - Set this block to reflect that it potentially
- /// is the target of an indirect branch.
- void setHasAddressTaken() { AddressTaken = true; }
-
/// getParent - Return the MachineFunction containing this basic block.
///
const MachineFunction *getParent() const { return xParent; }
Modified: llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineCodeEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineCodeEmitter.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineCodeEmitter.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineCodeEmitter.h Mon Nov 2 13:33:53 2009
@@ -17,7 +17,7 @@
#ifndef LLVM_CODEGEN_MACHINECODEEMITTER_H
#define LLVM_CODEGEN_MACHINECODEEMITTER_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/Support/DebugLoc.h"
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineFrameInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineFrameInfo.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineFrameInfo.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineFrameInfo.h Mon Nov 2 13:33:53 2009
@@ -16,7 +16,7 @@
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DenseSet.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <cassert>
#include <vector>
Modified: llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineInstrBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineInstrBuilder.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineInstrBuilder.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineInstrBuilder.h Mon Nov 2 13:33:53 2009
@@ -108,6 +108,13 @@
return *this;
}
+ const MachineInstrBuilder &addMetadata(MDNode *N,
+ int64_t Offset = 0,
+ unsigned char TargetFlags = 0) const {
+ MI->addOperand(MachineOperand::CreateMDNode(N, Offset, TargetFlags));
+ return *this;
+ }
+
const MachineInstrBuilder &addExternalSymbol(const char *FnName,
unsigned char TargetFlags = 0) const {
MI->addOperand(MachineOperand::CreateES(FnName, TargetFlags));
Modified: llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineModuleInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineModuleInfo.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineModuleInfo.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineModuleInfo.h Mon Nov 2 13:33:53 2009
@@ -32,7 +32,7 @@
#define LLVM_CODEGEN_MACHINEMODULEINFO_H
#include "llvm/Support/Dwarf.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/UniqueVector.h"
Modified: llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineOperand.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineOperand.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineOperand.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineOperand.h Mon Nov 2 13:33:53 2009
@@ -14,15 +14,15 @@
#ifndef LLVM_CODEGEN_MACHINEOPERAND_H
#define LLVM_CODEGEN_MACHINEOPERAND_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <cassert>
namespace llvm {
class ConstantFP;
-class BlockAddress;
class MachineBasicBlock;
class GlobalValue;
+class MDNode;
class MachineInstr;
class TargetMachine;
class MachineRegisterInfo;
@@ -42,7 +42,7 @@
MO_JumpTableIndex, ///< Address of indexed Jump Table for switch
MO_ExternalSymbol, ///< Name of external global symbol
MO_GlobalAddress, ///< Address of a global value
- MO_BlockAddress ///< Address of a basic block
+ MO_Metadata ///< Metadata info
};
private:
@@ -108,7 +108,7 @@
int Index; // For MO_*Index - The index itself.
const char *SymbolName; // For MO_ExternalSymbol.
GlobalValue *GV; // For MO_GlobalAddress.
- BlockAddress *BA; // For MO_BlockAddress.
+ MDNode *Node; // For MO_Metadata.
} Val;
int64_t Offset; // An offset from the object.
} OffsetedInfo;
@@ -156,8 +156,8 @@
bool isGlobal() const { return OpKind == MO_GlobalAddress; }
/// isSymbol - Tests if this is a MO_ExternalSymbol operand.
bool isSymbol() const { return OpKind == MO_ExternalSymbol; }
- /// isBlockAddress - Tests if this is a MO_BlockAddress operand.
- bool isBlockAddress() const { return OpKind == MO_BlockAddress; }
+ /// isMetadata - Tests if this is a MO_Metadata operand.
+ bool isMetadata() const { return OpKind == MO_Metadata; }
//===--------------------------------------------------------------------===//
// Accessors for Register Operands
@@ -293,16 +293,15 @@
assert(isGlobal() && "Wrong MachineOperand accessor");
return Contents.OffsetedInfo.Val.GV;
}
-
- BlockAddress *getBlockAddress() const {
- assert(isBlockAddress() && "Wrong MachineOperand accessor");
- return Contents.OffsetedInfo.Val.BA;
+
+ MDNode *getMDNode() const {
+ return Contents.OffsetedInfo.Val.Node;
}
/// getOffset - Return the offset from the symbol in this operand. This always
/// returns 0 for ExternalSymbol operands.
int64_t getOffset() const {
- assert((isGlobal() || isSymbol() || isCPI() || isBlockAddress()) &&
+ assert((isGlobal() || isSymbol() || isCPI()) &&
"Wrong MachineOperand accessor");
return Contents.OffsetedInfo.Offset;
}
@@ -322,7 +321,7 @@
}
void setOffset(int64_t Offset) {
- assert((isGlobal() || isSymbol() || isCPI() || isBlockAddress()) &&
+ assert((isGlobal() || isSymbol() || isCPI() || isMetadata()) &&
"Wrong MachineOperand accessor");
Contents.OffsetedInfo.Offset = Offset;
}
@@ -427,6 +426,14 @@
Op.setTargetFlags(TargetFlags);
return Op;
}
+ static MachineOperand CreateMDNode(MDNode *N, int64_t Offset,
+ unsigned char TargetFlags = 0) {
+ MachineOperand Op(MachineOperand::MO_Metadata);
+ Op.Contents.OffsetedInfo.Val.Node = N;
+ Op.setOffset(Offset);
+ Op.setTargetFlags(TargetFlags);
+ return Op;
+ }
static MachineOperand CreateES(const char *SymName,
unsigned char TargetFlags = 0) {
MachineOperand Op(MachineOperand::MO_ExternalSymbol);
@@ -435,12 +442,6 @@
Op.setTargetFlags(TargetFlags);
return Op;
}
- static MachineOperand CreateBA(BlockAddress *BA) {
- MachineOperand Op(MachineOperand::MO_BlockAddress);
- Op.Contents.OffsetedInfo.Val.BA = BA;
- Op.setOffset(0); // Offset is always 0.
- return Op;
- }
friend class MachineInstr;
friend class MachineRegisterInfo;
Modified: llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineRelocation.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineRelocation.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineRelocation.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/CodeGen/MachineRelocation.h Mon Nov 2 13:33:53 2009
@@ -14,7 +14,7 @@
#ifndef LLVM_CODEGEN_MACHINERELOCATION_H
#define LLVM_CODEGEN_MACHINERELOCATION_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <cassert>
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/CodeGen/SelectionDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/CodeGen/SelectionDAG.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/CodeGen/SelectionDAG.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/CodeGen/SelectionDAG.h Mon Nov 2 13:33:53 2009
@@ -326,8 +326,6 @@
unsigned Line, unsigned Col, MDNode *CU);
SDValue getLabel(unsigned Opcode, DebugLoc dl, SDValue Root,
unsigned LabelID);
- SDValue getBlockAddress(BlockAddress *BA, DebugLoc dl,
- bool isTarget = false);
SDValue getCopyToReg(SDValue Chain, DebugLoc dl, unsigned Reg, SDValue N) {
return getNode(ISD::CopyToReg, dl, MVT::Other, Chain,
Modified: llvm/branches/Apple/Leela/include/llvm/CodeGen/SelectionDAGNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/CodeGen/SelectionDAGNodes.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/CodeGen/SelectionDAGNodes.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/CodeGen/SelectionDAGNodes.h Mon Nov 2 13:33:53 2009
@@ -28,7 +28,7 @@
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/Support/MathExtras.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/Support/DebugLoc.h"
#include <cassert>
@@ -97,7 +97,7 @@
BasicBlock, VALUETYPE, CONDCODE, Register,
Constant, ConstantFP,
GlobalAddress, GlobalTLSAddress, FrameIndex,
- JumpTable, ConstantPool, ExternalSymbol, BlockAddress,
+ JumpTable, ConstantPool, ExternalSymbol,
// The address of the GOT
GLOBAL_OFFSET_TABLE,
@@ -146,7 +146,6 @@
TargetJumpTable,
TargetConstantPool,
TargetExternalSymbol,
- TargetBlockAddress,
/// RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...)
/// This node represents a target intrinsic function with no side effects.
@@ -2027,27 +2026,11 @@
}
};
-class BlockAddressSDNode : public SDNode {
- BlockAddress *BA;
- friend class SelectionDAG;
- BlockAddressSDNode(unsigned NodeTy, DebugLoc dl, EVT VT, BlockAddress *ba)
- : SDNode(NodeTy, dl, getSDVTList(VT)), BA(ba) {
- }
-public:
- BlockAddress *getBlockAddress() const { return BA; }
-
- static bool classof(const BlockAddressSDNode *) { return true; }
- static bool classof(const SDNode *N) {
- return N->getOpcode() == ISD::BlockAddress ||
- N->getOpcode() == ISD::TargetBlockAddress;
- }
-};
-
class LabelSDNode : public SDNode {
SDUse Chain;
unsigned LabelID;
friend class SelectionDAG;
- LabelSDNode(unsigned NodeTy, DebugLoc dl, SDValue ch, unsigned id)
+LabelSDNode(unsigned NodeTy, DebugLoc dl, SDValue ch, unsigned id)
: SDNode(NodeTy, dl, getSDVTList(MVT::Other)), LabelID(id) {
InitOperands(&Chain, ch);
}
Modified: llvm/branches/Apple/Leela/include/llvm/CodeGen/ValueTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/CodeGen/ValueTypes.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/CodeGen/ValueTypes.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/CodeGen/ValueTypes.h Mon Nov 2 13:33:53 2009
@@ -18,7 +18,7 @@
#include <cassert>
#include <string>
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/Support/MathExtras.h"
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/Constant.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Constant.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Constant.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Constant.h Mon Nov 2 13:33:53 2009
@@ -48,10 +48,6 @@
: User(ty, vty, Ops, NumOps) {}
void destroyConstantImpl();
-
- void setOperand(unsigned i, Value *V) {
- User::setOperand(i, V);
- }
public:
/// isNullValue - Return true if this is the value that would be returned by
/// getNullValue.
@@ -65,10 +61,6 @@
/// true for things like constant expressions that could divide by zero.
bool canTrap() const;
- /// isConstantUsed - Return true if the constant has users other than constant
- /// exprs and other dangling things.
- bool isConstantUsed() const;
-
enum PossibleRelocationsTy {
NoRelocation = 0,
LocalRelocation = 1,
@@ -91,13 +83,16 @@
/// FIXME: This really should not be in VMCore.
PossibleRelocationsTy getRelocationInfo() const;
- // Specialize get/setOperand for Users as their operands are always
- // constants or BasicBlocks as well.
- User *getOperand(unsigned i) {
- return static_cast<User*>(User::getOperand(i));
+ // Specialize get/setOperand for Constants as their operands are always
+ // constants as well.
+ Constant *getOperand(unsigned i) {
+ return static_cast<Constant*>(User::getOperand(i));
+ }
+ const Constant *getOperand(unsigned i) const {
+ return static_cast<const Constant*>(User::getOperand(i));
}
- const User *getOperand(unsigned i) const {
- return static_cast<const User*>(User::getOperand(i));
+ void setOperand(unsigned i, Constant *C) {
+ User::setOperand(i, C);
}
/// getVectorElements - This method, which is only valid on constant of vector
Modified: llvm/branches/Apple/Leela/include/llvm/Constants.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Constants.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Constants.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Constants.h Mon Nov 2 13:33:53 2009
@@ -548,47 +548,7 @@
}
};
-/// BlockAddress - The address of a basic block.
-///
-class BlockAddress : public Constant {
- void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
- void *operator new(size_t s) { return User::operator new(s, 2); }
- BlockAddress(Function *F, BasicBlock *BB);
-public:
- /// get - Return a BlockAddress for the specified function and basic block.
- static BlockAddress *get(Function *F, BasicBlock *BB);
-
- /// get - Return a BlockAddress for the specified basic block. The basic
- /// block must be embedded into a function.
- static BlockAddress *get(BasicBlock *BB);
-
- /// Transparently provide more efficient getOperand methods.
- DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
-
- Function *getFunction() const { return (Function*)Op<0>().get(); }
- BasicBlock *getBasicBlock() const { return (BasicBlock*)Op<1>().get(); }
-
- /// isNullValue - Return true if this is the value that would be returned by
- /// getNullValue.
- virtual bool isNullValue() const { return false; }
-
- virtual void destroyConstant();
- virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U);
-
- /// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const BlockAddress *) { return true; }
- static inline bool classof(const Value *V) {
- return V->getValueID() == BlockAddressVal;
- }
-};
-template <>
-struct OperandTraits<BlockAddress> : public FixedNumOperandTraits<2> {
-};
-
-DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(BlockAddress, Value)
-
-//===----------------------------------------------------------------------===//
/// ConstantExpr - a constant value that is initialized with an expression using
/// other constant values.
///
Modified: llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/ExecutionEngine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/ExecutionEngine.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/ExecutionEngine.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/ExecutionEngine.h Mon Nov 2 13:33:53 2009
@@ -19,8 +19,6 @@
#include <map>
#include <string>
#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/ValueMap.h"
-#include "llvm/Support/ValueHandle.h"
#include "llvm/System/Mutex.h"
#include "llvm/Target/TargetMachine.h"
@@ -28,7 +26,6 @@
struct GenericValue;
class Constant;
-class ExecutionEngine;
class Function;
class GlobalVariable;
class GlobalValue;
@@ -40,26 +37,13 @@
class MutexGuard;
class TargetData;
class Type;
+template<typename> class AssertingVH;
class ExecutionEngineState {
-public:
- struct AddressMapConfig : public ValueMapConfig<const GlobalValue*> {
- typedef ExecutionEngineState *ExtraData;
- static sys::Mutex *getMutex(ExecutionEngineState *EES);
- static void onDelete(ExecutionEngineState *EES, const GlobalValue *Old);
- static void onRAUW(ExecutionEngineState *, const GlobalValue *,
- const GlobalValue *);
- };
-
- typedef ValueMap<const GlobalValue *, void *, AddressMapConfig>
- GlobalAddressMapTy;
-
private:
- ExecutionEngine &EE;
-
/// GlobalAddressMap - A mapping between LLVM global values and their
/// actualized version...
- GlobalAddressMapTy GlobalAddressMap;
+ std::map<AssertingVH<const GlobalValue>, void *> GlobalAddressMap;
/// GlobalAddressReverseMap - This is the reverse mapping of GlobalAddressMap,
/// used to convert raw addresses into the LLVM global value that is emitted
@@ -68,9 +52,7 @@
std::map<void *, AssertingVH<const GlobalValue> > GlobalAddressReverseMap;
public:
- ExecutionEngineState(ExecutionEngine &EE);
-
- GlobalAddressMapTy &
+ std::map<AssertingVH<const GlobalValue>, void *> &
getGlobalAddressMap(const MutexGuard &) {
return GlobalAddressMap;
}
@@ -87,7 +69,7 @@
class ExecutionEngine {
const TargetData *TD;
- ExecutionEngineState EEState;
+ ExecutionEngineState state;
bool LazyCompilationDisabled;
bool GVCompilationDisabled;
bool SymbolSearchingDisabled;
@@ -231,8 +213,8 @@
/// at the specified location. This is used internally as functions are JIT'd
/// and as global variables are laid out in memory. It can and should also be
/// used by clients of the EE that want to have an LLVM global overlay
- /// existing data in memory. Mappings are automatically removed when their
- /// GlobalValue is destroyed.
+ /// existing data in memory. After adding a mapping for GV, you must not
+ /// destroy it until you've removed the mapping.
void addGlobalMapping(const GlobalValue *GV, void *Addr);
/// clearAllGlobalMappings - Clear all global mappings and start over again
@@ -256,29 +238,29 @@
void *getPointerToGlobalIfAvailable(const GlobalValue *GV);
/// getPointerToGlobal - This returns the address of the specified global
- /// value. This may involve code generation if it's a function.
+ /// value. This may involve code generation if it's a function. After
+ /// getting a pointer to GV, it and all globals it transitively refers to have
+ /// been passed to addGlobalMapping. You must clear the mapping for each
+ /// referred-to global before destroying it. If a referred-to global RTG is a
+ /// function and this ExecutionEngine is a JIT compiler, calling
+ /// updateGlobalMapping(RTG, 0) will leak the function's machine code, so you
+ /// should call freeMachineCodeForFunction(RTG) instead. Note that
+ /// optimizations can move and delete non-external GlobalValues without
+ /// notifying the ExecutionEngine.
///
void *getPointerToGlobal(const GlobalValue *GV);
/// getPointerToFunction - The different EE's represent function bodies in
/// different ways. They should each implement this to say what a function
- /// pointer should look like. When F is destroyed, the ExecutionEngine will
- /// remove its global mapping but will not yet free its machine code. Call
- /// freeMachineCodeForFunction(F) explicitly to do that. Note that global
- /// optimizations can destroy Functions without notifying the ExecutionEngine.
+ /// pointer should look like. See getPointerToGlobal for the requirements on
+ /// destroying F and any GlobalValues it refers to.
///
virtual void *getPointerToFunction(Function *F) = 0;
- /// getPointerToBasicBlock - The different EE's represent basic blocks in
- /// different ways. Return the representation for a blockaddress of the
- /// specified block.
- ///
- virtual void *getPointerToBasicBlock(BasicBlock *BB) = 0;
-
/// getPointerToFunctionOrStub - If the specified function has been
/// code-gen'd, return a pointer to the function. If not, compile it, or use
- /// a stub to implement lazy compilation if available. See
- /// getPointerToFunction for the requirements on destroying F.
+ /// a stub to implement lazy compilation if available. See getPointerToGlobal
+ /// for the requirements on destroying F and any GlobalValues it refers to.
///
virtual void *getPointerToFunctionOrStub(Function *F) {
// Default implementation, just codegen the function.
@@ -314,7 +296,8 @@
/// getOrEmitGlobalVariable - Return the address of the specified global
/// variable, possibly emitting it to memory if needed. This is used by the
- /// Emitter.
+ /// Emitter. See getPointerToGlobal for the requirements on destroying GV and
+ /// any GlobalValues it refers to.
virtual void *getOrEmitGlobalVariable(const GlobalVariable *GV) {
return getPointerToGlobal((GlobalValue*)GV);
}
@@ -485,6 +468,7 @@
}
ExecutionEngine *create();
+
};
} // End llvm namespace
Modified: llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/GenericValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/GenericValue.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/GenericValue.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/GenericValue.h Mon Nov 2 13:33:53 2009
@@ -16,7 +16,7 @@
#define GENERIC_VALUE_H
#include "llvm/ADT/APInt.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/JITEventListener.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/JITEventListener.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/JITEventListener.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/JITEventListener.h Mon Nov 2 13:33:53 2009
@@ -15,7 +15,7 @@
#ifndef LLVM_EXECUTION_ENGINE_JIT_EVENTLISTENER_H
#define LLVM_EXECUTION_ENGINE_JIT_EVENTLISTENER_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/Support/DebugLoc.h"
#include <vector>
Modified: llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/JITMemoryManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/JITMemoryManager.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/JITMemoryManager.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/ExecutionEngine/JITMemoryManager.h Mon Nov 2 13:33:53 2009
@@ -14,7 +14,7 @@
#ifndef LLVM_EXECUTION_ENGINE_JIT_MEMMANAGER_H
#define LLVM_EXECUTION_ENGINE_JIT_MEMMANAGER_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <string>
namespace llvm {
@@ -132,11 +132,9 @@
///
virtual uint8_t *allocateGlobal(uintptr_t Size, unsigned Alignment) = 0;
- /// deallocateFunctionBody - Free the specified function body. The argument
- /// must be the return value from a call to startFunctionBody() that hasn't
- /// been deallocated yet. This is never called when the JIT is currently
- /// emitting a function.
- virtual void deallocateFunctionBody(void *Body) = 0;
+ /// deallocateMemForFunction - Free JIT memory for the specified function.
+ /// This is never called when the JIT is currently emitting a function.
+ virtual void deallocateMemForFunction(const Function *F) = 0;
/// startExceptionTable - When we finished JITing the function, if exception
/// handling is set, we emit the exception table.
@@ -148,12 +146,6 @@
virtual void endExceptionTable(const Function *F, uint8_t *TableStart,
uint8_t *TableEnd, uint8_t* FrameRegister) = 0;
- /// deallocateExceptionTable - Free the specified exception table's memory.
- /// The argument must be the return value from a call to startExceptionTable()
- /// that hasn't been deallocated yet. This is never called when the JIT is
- /// currently emitting an exception table.
- virtual void deallocateExceptionTable(void *ET) = 0;
-
/// CheckInvariants - For testing only. Return true if all internal
/// invariants are preserved, or return false and set ErrorStr to a helpful
/// error message.
Modified: llvm/branches/Apple/Leela/include/llvm/InstrTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/InstrTypes.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/InstrTypes.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/InstrTypes.h Mon Nov 2 13:33:53 2009
@@ -51,9 +51,10 @@
virtual BasicBlock *getSuccessorV(unsigned idx) const = 0;
virtual unsigned getNumSuccessorsV() const = 0;
virtual void setSuccessorV(unsigned idx, BasicBlock *B) = 0;
- virtual TerminatorInst *clone_impl() const = 0;
public:
+ virtual TerminatorInst *clone() const = 0;
+
/// getNumSuccessors - Return the number of successors that this terminator
/// has.
unsigned getNumSuccessors() const {
@@ -146,7 +147,6 @@
const Twine &Name, Instruction *InsertBefore);
BinaryOperator(BinaryOps iType, Value *S1, Value *S2, const Type *Ty,
const Twine &Name, BasicBlock *InsertAtEnd);
- virtual BinaryOperator *clone_impl() const;
public:
// allocate space for exactly two operands
void *operator new(size_t s) {
@@ -299,6 +299,8 @@
return static_cast<BinaryOps>(Instruction::getOpcode());
}
+ virtual BinaryOperator *clone() const;
+
/// swapOperands - Exchange the two operands to this instruction.
/// This instruction is safe to use on any binary instruction and
/// does not modify the semantics of the instruction. If the instruction
Modified: llvm/branches/Apple/Leela/include/llvm/Instruction.def
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Instruction.def?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Instruction.def (original)
+++ llvm/branches/Apple/Leela/include/llvm/Instruction.def Mon Nov 2 13:33:53 2009
@@ -97,80 +97,80 @@
HANDLE_TERM_INST ( 1, Ret , ReturnInst)
HANDLE_TERM_INST ( 2, Br , BranchInst)
HANDLE_TERM_INST ( 3, Switch , SwitchInst)
-HANDLE_TERM_INST ( 4, IndirectBr , IndirectBrInst)
-HANDLE_TERM_INST ( 5, Invoke , InvokeInst)
-HANDLE_TERM_INST ( 6, Unwind , UnwindInst)
-HANDLE_TERM_INST ( 7, Unreachable, UnreachableInst)
- LAST_TERM_INST ( 7)
+HANDLE_TERM_INST ( 4, Invoke , InvokeInst)
+HANDLE_TERM_INST ( 5, Unwind , UnwindInst)
+HANDLE_TERM_INST ( 6, Unreachable, UnreachableInst)
+ LAST_TERM_INST ( 6)
// Standard binary operators...
- FIRST_BINARY_INST( 8)
-HANDLE_BINARY_INST( 8, Add , BinaryOperator)
-HANDLE_BINARY_INST( 9, FAdd , BinaryOperator)
-HANDLE_BINARY_INST(10, Sub , BinaryOperator)
-HANDLE_BINARY_INST(11, FSub , BinaryOperator)
-HANDLE_BINARY_INST(12, Mul , BinaryOperator)
-HANDLE_BINARY_INST(13, FMul , BinaryOperator)
-HANDLE_BINARY_INST(14, UDiv , BinaryOperator)
-HANDLE_BINARY_INST(15, SDiv , BinaryOperator)
-HANDLE_BINARY_INST(16, FDiv , BinaryOperator)
-HANDLE_BINARY_INST(17, URem , BinaryOperator)
-HANDLE_BINARY_INST(18, SRem , BinaryOperator)
-HANDLE_BINARY_INST(19, FRem , BinaryOperator)
+ FIRST_BINARY_INST( 7)
+HANDLE_BINARY_INST( 7, Add , BinaryOperator)
+HANDLE_BINARY_INST( 8, FAdd , BinaryOperator)
+HANDLE_BINARY_INST( 9, Sub , BinaryOperator)
+HANDLE_BINARY_INST(10, FSub , BinaryOperator)
+HANDLE_BINARY_INST(11, Mul , BinaryOperator)
+HANDLE_BINARY_INST(12, FMul , BinaryOperator)
+HANDLE_BINARY_INST(13, UDiv , BinaryOperator)
+HANDLE_BINARY_INST(14, SDiv , BinaryOperator)
+HANDLE_BINARY_INST(15, FDiv , BinaryOperator)
+HANDLE_BINARY_INST(16, URem , BinaryOperator)
+HANDLE_BINARY_INST(17, SRem , BinaryOperator)
+HANDLE_BINARY_INST(18, FRem , BinaryOperator)
// Logical operators (integer operands)
-HANDLE_BINARY_INST(20, Shl , BinaryOperator) // Shift left (logical)
-HANDLE_BINARY_INST(21, LShr , BinaryOperator) // Shift right (logical)
-HANDLE_BINARY_INST(22, AShr , BinaryOperator) // Shift right (arithmetic)
-HANDLE_BINARY_INST(23, And , BinaryOperator)
-HANDLE_BINARY_INST(24, Or , BinaryOperator)
-HANDLE_BINARY_INST(25, Xor , BinaryOperator)
- LAST_BINARY_INST(25)
+HANDLE_BINARY_INST(19, Shl , BinaryOperator) // Shift left (logical)
+HANDLE_BINARY_INST(20, LShr , BinaryOperator) // Shift right (logical)
+HANDLE_BINARY_INST(21, AShr , BinaryOperator) // Shift right (arithmetic)
+HANDLE_BINARY_INST(22, And , BinaryOperator)
+HANDLE_BINARY_INST(23, Or , BinaryOperator)
+HANDLE_BINARY_INST(24, Xor , BinaryOperator)
+ LAST_BINARY_INST(24)
// Memory operators...
- FIRST_MEMORY_INST(26)
-HANDLE_MEMORY_INST(26, Malloc, MallocInst) // Heap management instructions
-HANDLE_MEMORY_INST(27, Free , FreeInst )
-HANDLE_MEMORY_INST(28, Alloca, AllocaInst) // Stack management
-HANDLE_MEMORY_INST(29, Load , LoadInst ) // Memory manipulation instrs
-HANDLE_MEMORY_INST(30, Store , StoreInst )
-HANDLE_MEMORY_INST(31, GetElementPtr, GetElementPtrInst)
- LAST_MEMORY_INST(31)
+ FIRST_MEMORY_INST(25)
+HANDLE_MEMORY_INST(25, Malloc, MallocInst) // Heap management instructions
+HANDLE_MEMORY_INST(26, Free , FreeInst )
+HANDLE_MEMORY_INST(27, Alloca, AllocaInst) // Stack management
+HANDLE_MEMORY_INST(28, Load , LoadInst ) // Memory manipulation instrs
+HANDLE_MEMORY_INST(29, Store , StoreInst )
+HANDLE_MEMORY_INST(30, GetElementPtr, GetElementPtrInst)
+ LAST_MEMORY_INST(30)
// Cast operators ...
// NOTE: The order matters here because CastInst::isEliminableCastPair
// NOTE: (see Instructions.cpp) encodes a table based on this ordering.
- FIRST_CAST_INST(32)
-HANDLE_CAST_INST(32, Trunc , TruncInst ) // Truncate integers
-HANDLE_CAST_INST(33, ZExt , ZExtInst ) // Zero extend integers
-HANDLE_CAST_INST(34, SExt , SExtInst ) // Sign extend integers
-HANDLE_CAST_INST(35, FPToUI , FPToUIInst ) // floating point -> UInt
-HANDLE_CAST_INST(36, FPToSI , FPToSIInst ) // floating point -> SInt
-HANDLE_CAST_INST(37, UIToFP , UIToFPInst ) // UInt -> floating point
-HANDLE_CAST_INST(38, SIToFP , SIToFPInst ) // SInt -> floating point
-HANDLE_CAST_INST(39, FPTrunc , FPTruncInst ) // Truncate floating point
-HANDLE_CAST_INST(40, FPExt , FPExtInst ) // Extend floating point
-HANDLE_CAST_INST(41, PtrToInt, PtrToIntInst) // Pointer -> Integer
-HANDLE_CAST_INST(42, IntToPtr, IntToPtrInst) // Integer -> Pointer
-HANDLE_CAST_INST(43, BitCast , BitCastInst ) // Type cast
- LAST_CAST_INST(43)
+ FIRST_CAST_INST(31)
+HANDLE_CAST_INST(31, Trunc , TruncInst ) // Truncate integers
+HANDLE_CAST_INST(32, ZExt , ZExtInst ) // Zero extend integers
+HANDLE_CAST_INST(33, SExt , SExtInst ) // Sign extend integers
+HANDLE_CAST_INST(34, FPToUI , FPToUIInst ) // floating point -> UInt
+HANDLE_CAST_INST(35, FPToSI , FPToSIInst ) // floating point -> SInt
+HANDLE_CAST_INST(36, UIToFP , UIToFPInst ) // UInt -> floating point
+HANDLE_CAST_INST(37, SIToFP , SIToFPInst ) // SInt -> floating point
+HANDLE_CAST_INST(38, FPTrunc , FPTruncInst ) // Truncate floating point
+HANDLE_CAST_INST(39, FPExt , FPExtInst ) // Extend floating point
+HANDLE_CAST_INST(40, PtrToInt, PtrToIntInst) // Pointer -> Integer
+HANDLE_CAST_INST(41, IntToPtr, IntToPtrInst) // Integer -> Pointer
+HANDLE_CAST_INST(42, BitCast , BitCastInst ) // Type cast
+ LAST_CAST_INST(42)
// Other operators...
- FIRST_OTHER_INST(44)
-HANDLE_OTHER_INST(44, ICmp , ICmpInst ) // Integer comparison instruction
-HANDLE_OTHER_INST(45, FCmp , FCmpInst ) // Floating point comparison instr.
-HANDLE_OTHER_INST(46, PHI , PHINode ) // PHI node instruction
-HANDLE_OTHER_INST(47, Call , CallInst ) // Call a function
-HANDLE_OTHER_INST(48, Select , SelectInst ) // select instruction
-HANDLE_OTHER_INST(49, UserOp1, Instruction) // May be used internally in a pass
-HANDLE_OTHER_INST(50, UserOp2, Instruction) // Internal to passes only
-HANDLE_OTHER_INST(51, VAArg , VAArgInst ) // vaarg instruction
-HANDLE_OTHER_INST(52, ExtractElement, ExtractElementInst)// extract from vector
-HANDLE_OTHER_INST(53, InsertElement, InsertElementInst) // insert into vector
-HANDLE_OTHER_INST(54, ShuffleVector, ShuffleVectorInst) // shuffle two vectors.
-HANDLE_OTHER_INST(55, ExtractValue, ExtractValueInst)// extract from aggregate
-HANDLE_OTHER_INST(56, InsertValue, InsertValueInst) // insert into aggregate
- LAST_OTHER_INST(56)
+ FIRST_OTHER_INST(43)
+HANDLE_OTHER_INST(43, ICmp , ICmpInst ) // Integer comparison instruction
+HANDLE_OTHER_INST(44, FCmp , FCmpInst ) // Floating point comparison instr.
+HANDLE_OTHER_INST(45, PHI , PHINode ) // PHI node instruction
+HANDLE_OTHER_INST(46, Call , CallInst ) // Call a function
+HANDLE_OTHER_INST(47, Select , SelectInst ) // select instruction
+HANDLE_OTHER_INST(48, UserOp1, Instruction) // May be used internally in a pass
+HANDLE_OTHER_INST(49, UserOp2, Instruction) // Internal to passes only
+HANDLE_OTHER_INST(50, VAArg , VAArgInst ) // vaarg instruction
+HANDLE_OTHER_INST(51, ExtractElement, ExtractElementInst)// extract from vector
+HANDLE_OTHER_INST(52, InsertElement, InsertElementInst) // insert into vector
+HANDLE_OTHER_INST(53, ShuffleVector, ShuffleVectorInst) // shuffle two vectors.
+HANDLE_OTHER_INST(54, ExtractValue, ExtractValueInst)// extract from aggregate
+HANDLE_OTHER_INST(55, InsertValue, InsertValueInst) // insert into aggregate
+
+ LAST_OTHER_INST(55)
#undef FIRST_TERM_INST
#undef HANDLE_TERM_INST
Modified: llvm/branches/Apple/Leela/include/llvm/Instruction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Instruction.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Instruction.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Instruction.h Mon Nov 2 13:33:53 2009
@@ -38,7 +38,6 @@
Instruction *InsertBefore = 0);
Instruction(const Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
BasicBlock *InsertAtEnd);
- virtual Instruction *clone_impl() const = 0;
public:
// Out of line virtual method, so the vtable, etc has a home.
~Instruction();
@@ -48,7 +47,7 @@
/// * The instruction has no parent
/// * The instruction has no name
///
- Instruction *clone() const;
+ virtual Instruction *clone() const = 0;
/// isIdenticalTo - Return true if the specified instruction is exactly
/// identical to the current one. This means that all operands match and any
Modified: llvm/branches/Apple/Leela/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Instructions.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Instructions.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Instructions.h Mon Nov 2 13:33:53 2009
@@ -19,7 +19,9 @@
#include "llvm/InstrTypes.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Attributes.h"
+#include "llvm/BasicBlock.h"
#include "llvm/CallingConv.h"
+#include "llvm/LLVMContext.h"
#include "llvm/ADT/SmallVector.h"
#include <iterator>
@@ -46,8 +48,6 @@
AllocationInst(const Type *Ty, Value *ArraySize,
unsigned iTy, unsigned Align, const Twine &Name,
BasicBlock *InsertAtEnd);
-protected:
- virtual AllocationInst *clone_impl() const = 0;
public:
// Out of line virtual method, so the vtable, etc. has a home.
virtual ~AllocationInst();
@@ -80,6 +80,8 @@
unsigned getAlignment() const { return (1u << SubclassData) >> 1; }
void setAlignment(unsigned Align);
+ virtual AllocationInst *clone() const = 0;
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const AllocationInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -99,8 +101,6 @@
/// MallocInst - an instruction to allocated memory on the heap
///
class MallocInst : public AllocationInst {
-protected:
- virtual MallocInst *clone_impl() const;
public:
explicit MallocInst(const Type *Ty, Value *ArraySize = 0,
const Twine &NameStr = "",
@@ -129,6 +129,8 @@
: AllocationInst(Ty, ArraySize,
Malloc, Align, NameStr, InsertBefore) {}
+ virtual MallocInst *clone() const;
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const MallocInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -147,8 +149,6 @@
/// AllocaInst - an instruction to allocate memory on the stack
///
class AllocaInst : public AllocationInst {
-protected:
- virtual AllocaInst *clone_impl() const;
public:
explicit AllocaInst(const Type *Ty,
Value *ArraySize = 0,
@@ -179,6 +179,8 @@
: AllocationInst(Ty, ArraySize, Alloca,
Align, NameStr, InsertAtEnd) {}
+ virtual AllocaInst *clone() const;
+
/// isStaticAlloca - Return true if this alloca is in the entry block of the
/// function and is a constant size. If so, the code generator will fold it
/// into the prolog/epilog code, so it is basically free.
@@ -203,12 +205,12 @@
///
class FreeInst : public UnaryInstruction {
void AssertOK();
-protected:
- virtual FreeInst *clone_impl() const;
public:
explicit FreeInst(Value *Ptr, Instruction *InsertBefore = 0);
FreeInst(Value *Ptr, BasicBlock *InsertAfter);
+ virtual FreeInst *clone() const;
+
// Accessor methods for consistency with other memory operations
Value *getPointerOperand() { return getOperand(0); }
const Value *getPointerOperand() const { return getOperand(0); }
@@ -233,8 +235,6 @@
///
class LoadInst : public UnaryInstruction {
void AssertOK();
-protected:
- virtual LoadInst *clone_impl() const;
public:
LoadInst(Value *Ptr, const Twine &NameStr, Instruction *InsertBefore);
LoadInst(Value *Ptr, const Twine &NameStr, BasicBlock *InsertAtEnd);
@@ -265,6 +265,8 @@
SubclassData = (SubclassData & ~1) | (V ? 1 : 0);
}
+ virtual LoadInst *clone() const;
+
/// getAlignment - Return the alignment of the access that is being performed
///
unsigned getAlignment() const {
@@ -302,8 +304,6 @@
class StoreInst : public Instruction {
void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
void AssertOK();
-protected:
- virtual StoreInst *clone_impl() const;
public:
// allocate space for exactly two operands
void *operator new(size_t s) {
@@ -342,6 +342,8 @@
void setAlignment(unsigned Align);
+ virtual StoreInst *clone() const;
+
Value *getPointerOperand() { return getOperand(1); }
const Value *getPointerOperand() const { return getOperand(1); }
static unsigned getPointerOperandIndex() { return 1U; }
@@ -450,8 +452,6 @@
Instruction *InsertBefore = 0);
GetElementPtrInst(Value *Ptr, Value *Idx,
const Twine &NameStr, BasicBlock *InsertAtEnd);
-protected:
- virtual GetElementPtrInst *clone_impl() const;
public:
template<typename InputIterator>
static GetElementPtrInst *Create(Value *Ptr, InputIterator IdxBegin,
@@ -525,6 +525,8 @@
return GEP;
}
+ virtual GetElementPtrInst *clone() const;
+
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -671,9 +673,6 @@
/// must be identical types.
/// @brief Represent an integer comparison operator.
class ICmpInst: public CmpInst {
-protected:
- /// @brief Clone an indentical ICmpInst
- virtual ICmpInst *clone_impl() const;
public:
/// @brief Constructor with insert-before-instruction semantics.
ICmpInst(
@@ -826,6 +825,8 @@
Op<0>().swap(Op<1>());
}
+ virtual ICmpInst *clone() const;
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ICmpInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -846,9 +847,6 @@
/// vectors of floating point values. The operands must be identical types.
/// @brief Represents a floating point comparison operator.
class FCmpInst: public CmpInst {
-protected:
- /// @brief Clone an indentical FCmpInst
- virtual FCmpInst *clone_impl() const;
public:
/// @brief Constructor with insert-before-instruction semantics.
FCmpInst(
@@ -936,6 +934,8 @@
Op<0>().swap(Op<1>());
}
+ virtual FCmpInst *clone() const;
+
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const FCmpInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -1003,8 +1003,6 @@
explicit CallInst(Value *F, const Twine &NameStr,
Instruction *InsertBefore);
CallInst(Value *F, const Twine &NameStr, BasicBlock *InsertAtEnd);
-protected:
- virtual CallInst *clone_impl() const;
public:
template<typename InputIterator>
static CallInst *Create(Value *Func,
@@ -1058,6 +1056,8 @@
SubclassData = (SubclassData & ~1) | unsigned(isTC);
}
+ virtual CallInst *clone() const;
+
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -1220,8 +1220,6 @@
init(C, S1, S2);
setName(NameStr);
}
-protected:
- virtual SelectInst *clone_impl() const;
public:
static SelectInst *Create(Value *C, Value *S1, Value *S2,
const Twine &NameStr = "",
@@ -1252,6 +1250,8 @@
return static_cast<OtherOps>(Instruction::getOpcode());
}
+ virtual SelectInst *clone() const;
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SelectInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -1276,9 +1276,6 @@
/// an argument of the specified type given a va_list and increments that list
///
class VAArgInst : public UnaryInstruction {
-protected:
- virtual VAArgInst *clone_impl() const;
-
public:
VAArgInst(Value *List, const Type *Ty, const Twine &NameStr = "",
Instruction *InsertBefore = 0)
@@ -1291,6 +1288,8 @@
setName(NameStr);
}
+ virtual VAArgInst *clone() const;
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const VAArgInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -1313,9 +1312,6 @@
Instruction *InsertBefore = 0);
ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr,
BasicBlock *InsertAtEnd);
-protected:
- virtual ExtractElementInst *clone_impl() const;
-
public:
static ExtractElementInst *Create(Value *Vec, Value *Idx,
const Twine &NameStr = "",
@@ -1332,6 +1328,8 @@
/// formed with the specified operands.
static bool isValidOperands(const Value *Vec, const Value *Idx);
+ virtual ExtractElementInst *clone() const;
+
Value *getVectorOperand() { return Op<0>(); }
Value *getIndexOperand() { return Op<1>(); }
const Value *getVectorOperand() const { return Op<0>(); }
@@ -1374,9 +1372,6 @@
Instruction *InsertBefore = 0);
InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
const Twine &NameStr, BasicBlock *InsertAtEnd);
-protected:
- virtual InsertElementInst *clone_impl() const;
-
public:
static InsertElementInst *Create(Value *Vec, Value *NewElt, Value *Idx,
const Twine &NameStr = "",
@@ -1394,6 +1389,8 @@
static bool isValidOperands(const Value *Vec, const Value *NewElt,
const Value *Idx);
+ virtual InsertElementInst *clone() const;
+
/// getType - Overload to return most specific vector type.
///
const VectorType *getType() const {
@@ -1427,9 +1424,6 @@
/// input vectors.
///
class ShuffleVectorInst : public Instruction {
-protected:
- virtual ShuffleVectorInst *clone_impl() const;
-
public:
// allocate space for exactly three operands
void *operator new(size_t s) {
@@ -1446,6 +1440,8 @@
static bool isValidOperands(const Value *V1, const Value *V2,
const Value *Mask);
+ virtual ShuffleVectorInst *clone() const;
+
/// getType - Overload to return most specific vector type.
///
const VectorType *getType() const {
@@ -1554,8 +1550,6 @@
void *operator new(size_t s) {
return User::operator new(s, 1);
}
-protected:
- virtual ExtractValueInst *clone_impl() const;
public:
template<typename InputIterator>
@@ -1590,6 +1584,8 @@
return new ExtractValueInst(Agg, Idxs, Idxs + 1, NameStr, InsertAtEnd);
}
+ virtual ExtractValueInst *clone() const;
+
/// getIndexedType - Returns the type of the element that would be extracted
/// with an extractvalue instruction with the specified parameters.
///
@@ -1721,8 +1717,6 @@
Instruction *InsertBefore = 0);
InsertValueInst(Value *Agg, Value *Val, unsigned Idx,
const Twine &NameStr, BasicBlock *InsertAtEnd);
-protected:
- virtual InsertValueInst *clone_impl() const;
public:
// allocate space for exactly two operands
void *operator new(size_t s) {
@@ -1760,6 +1754,8 @@
return new InsertValueInst(Agg, Val, Idx, NameStr, InsertAtEnd);
}
+ virtual InsertValueInst *clone() const;
+
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -1868,8 +1864,6 @@
ReservedSpace(0) {
setName(NameStr);
}
-protected:
- virtual PHINode *clone_impl() const;
public:
static PHINode *Create(const Type *Ty, const Twine &NameStr = "",
Instruction *InsertBefore = 0) {
@@ -1889,6 +1883,8 @@
resizeOperands(NumValues*2);
}
+ virtual PHINode *clone() const;
+
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -1938,7 +1934,7 @@
void setIncomingBlock(unsigned i, BasicBlock *BB) {
- setOperand(i*2+1, (Value*)BB);
+ setOperand(i*2+1, BB);
}
static unsigned getOperandNumForIncomingBlock(unsigned i) {
return i*2+1;
@@ -1961,7 +1957,7 @@
// Initialize some new operands.
NumOperands = OpNo+2;
OperandList[OpNo] = V;
- OperandList[OpNo+1] = (Value*)BB;
+ OperandList[OpNo+1] = BB;
}
/// removeIncomingValue - Remove an incoming value. This is useful if a
@@ -1986,7 +1982,7 @@
int getBasicBlockIndex(const BasicBlock *BB) const {
Use *OL = OperandList;
for (unsigned i = 0, e = getNumOperands(); i != e; i += 2)
- if (OL[i+1].get() == (const Value*)BB) return i/2;
+ if (OL[i+1].get() == BB) return i/2;
return -1;
}
@@ -2050,8 +2046,6 @@
Instruction *InsertBefore = 0);
ReturnInst(LLVMContext &C, Value *retVal, BasicBlock *InsertAtEnd);
explicit ReturnInst(LLVMContext &C, BasicBlock *InsertAtEnd);
-protected:
- virtual ReturnInst *clone_impl() const;
public:
static ReturnInst* Create(LLVMContext &C, Value *retVal = 0,
Instruction *InsertBefore = 0) {
@@ -2066,6 +2060,8 @@
}
virtual ~ReturnInst();
+ virtual ReturnInst *clone() const;
+
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -2125,8 +2121,6 @@
BranchInst(BasicBlock *IfTrue, BasicBlock *InsertAtEnd);
BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
BasicBlock *InsertAtEnd);
-protected:
- virtual BranchInst *clone_impl() const;
public:
static BranchInst *Create(BasicBlock *IfTrue, Instruction *InsertBefore = 0) {
return new(1, true) BranchInst(IfTrue, InsertBefore);
@@ -2148,6 +2142,8 @@
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
+ virtual BranchInst *clone() const;
+
bool isUnconditional() const { return getNumOperands() == 1; }
bool isConditional() const { return getNumOperands() == 3; }
@@ -2165,7 +2161,7 @@
// targeting the specified block.
// FIXME: Eliminate this ugly method.
void setUnconditionalDest(BasicBlock *Dest) {
- Op<-1>() = (Value*)Dest;
+ Op<-1>() = Dest;
if (isConditional()) { // Convert this to an uncond branch.
Op<-2>() = 0;
Op<-3>() = 0;
@@ -2183,7 +2179,7 @@
void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
assert(idx < getNumSuccessors() && "Successor # out of range for Branch!");
- *(&Op<-1>() - idx) = (Value*)NewSucc;
+ *(&Op<-1>() - idx) = NewSucc;
}
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -2219,7 +2215,7 @@
// Operand[1] = Default basic block destination
// Operand[2n ] = Value to match
// Operand[2n+1] = BasicBlock to go to on match
- SwitchInst(const SwitchInst &SI);
+ SwitchInst(const SwitchInst &RI);
void init(Value *Value, BasicBlock *Default, unsigned NumCases);
void resizeOperands(unsigned No);
// allocate space for exactly zero operands
@@ -2231,7 +2227,7 @@
/// be specified here to make memory allocation more efficient. This
/// constructor can also autoinsert before another instruction.
SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
- Instruction *InsertBefore);
+ Instruction *InsertBefore = 0);
/// SwitchInst ctor - Create a new switch instruction, specifying a value to
/// switch on and a default destination. The number of additional cases can
@@ -2239,8 +2235,6 @@
/// constructor also autoinserts at the end of the specified BasicBlock.
SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
BasicBlock *InsertAtEnd);
-protected:
- virtual SwitchInst *clone_impl() const;
public:
static SwitchInst *Create(Value *Value, BasicBlock *Default,
unsigned NumCases, Instruction *InsertBefore = 0) {
@@ -2318,6 +2312,8 @@
///
void removeCase(unsigned idx);
+ virtual SwitchInst *clone() const;
+
unsigned getNumSuccessors() const { return getNumOperands()/2; }
BasicBlock *getSuccessor(unsigned idx) const {
assert(idx < getNumSuccessors() &&"Successor idx out of range for switch!");
@@ -2325,7 +2321,7 @@
}
void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
assert(idx < getNumSuccessors() && "Successor # out of range for switch!");
- setOperand(idx*2+1, (Value*)NewSucc);
+ setOperand(idx*2+1, NewSucc);
}
// getSuccessorValue - Return the value associated with the specified
@@ -2357,105 +2353,6 @@
//===----------------------------------------------------------------------===//
-// IndirectBrInst Class
-//===----------------------------------------------------------------------===//
-
-//===---------------------------------------------------------------------------
-/// IndirectBrInst - Indirect Branch Instruction.
-///
-class IndirectBrInst : public TerminatorInst {
- void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
- unsigned ReservedSpace;
- // Operand[0] = Value to switch on
- // Operand[1] = Default basic block destination
- // Operand[2n ] = Value to match
- // Operand[2n+1] = BasicBlock to go to on match
- IndirectBrInst(const IndirectBrInst &IBI);
- void init(Value *Address, unsigned NumDests);
- void resizeOperands(unsigned No);
- // allocate space for exactly zero operands
- void *operator new(size_t s) {
- return User::operator new(s, 0);
- }
- /// IndirectBrInst ctor - Create a new indirectbr instruction, specifying an
- /// Address to jump to. The number of expected destinations can be specified
- /// here to make memory allocation more efficient. This constructor can also
- /// autoinsert before another instruction.
- IndirectBrInst(Value *Address, unsigned NumDests, Instruction *InsertBefore);
-
- /// IndirectBrInst ctor - Create a new indirectbr instruction, specifying an
- /// Address to jump to. The number of expected destinations can be specified
- /// here to make memory allocation more efficient. This constructor also
- /// autoinserts at the end of the specified BasicBlock.
- IndirectBrInst(Value *Address, unsigned NumDests, BasicBlock *InsertAtEnd);
-protected:
- virtual IndirectBrInst *clone_impl() const;
-public:
- static IndirectBrInst *Create(Value *Address, unsigned NumDests,
- Instruction *InsertBefore = 0) {
- return new IndirectBrInst(Address, NumDests, InsertBefore);
- }
- static IndirectBrInst *Create(Value *Address, unsigned NumDests,
- BasicBlock *InsertAtEnd) {
- return new IndirectBrInst(Address, NumDests, InsertAtEnd);
- }
- ~IndirectBrInst();
-
- /// Provide fast operand accessors.
- DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
-
- // Accessor Methods for IndirectBrInst instruction.
- Value *getAddress() { return getOperand(0); }
- const Value *getAddress() const { return getOperand(0); }
- void setAddress(Value *V) { setOperand(0, V); }
-
-
- /// getNumDestinations - return the number of possible destinations in this
- /// indirectbr instruction.
- unsigned getNumDestinations() const { return getNumOperands()-1; }
-
- /// getDestination - Return the specified destination.
- BasicBlock *getDestination(unsigned i) { return getSuccessor(i); }
- const BasicBlock *getDestination(unsigned i) const { return getSuccessor(i); }
-
- /// addDestination - Add a destination.
- ///
- void addDestination(BasicBlock *Dest);
-
- /// removeDestination - This method removes the specified successor from the
- /// indirectbr instruction.
- void removeDestination(unsigned i);
-
- unsigned getNumSuccessors() const { return getNumOperands()-1; }
- BasicBlock *getSuccessor(unsigned i) const {
- return cast<BasicBlock>(getOperand(i+1));
- }
- void setSuccessor(unsigned i, BasicBlock *NewSucc) {
- setOperand(i+1, (Value*)NewSucc);
- }
-
- // Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const IndirectBrInst *) { return true; }
- static inline bool classof(const Instruction *I) {
- return I->getOpcode() == Instruction::IndirectBr;
- }
- static inline bool classof(const Value *V) {
- return isa<Instruction>(V) && classof(cast<Instruction>(V));
- }
-private:
- virtual BasicBlock *getSuccessorV(unsigned idx) const;
- virtual unsigned getNumSuccessorsV() const;
- virtual void setSuccessorV(unsigned idx, BasicBlock *B);
-};
-
-template <>
-struct OperandTraits<IndirectBrInst> : public HungoffOperandTraits<1> {
-};
-
-DEFINE_TRANSPARENT_OPERAND_ACCESSORS(IndirectBrInst, Value)
-
-
-//===----------------------------------------------------------------------===//
// InvokeInst Class
//===----------------------------------------------------------------------===//
@@ -2507,8 +2404,6 @@
InputIterator ArgBegin, InputIterator ArgEnd,
unsigned Values,
const Twine &NameStr, BasicBlock *InsertAtEnd);
-protected:
- virtual InvokeInst *clone_impl() const;
public:
template<typename InputIterator>
static InvokeInst *Create(Value *Func,
@@ -2531,6 +2426,8 @@
Values, NameStr, InsertAtEnd);
}
+ virtual InvokeInst *clone() const;
+
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -2633,11 +2530,11 @@
return cast<BasicBlock>(getOperand(2));
}
void setNormalDest(BasicBlock *B) {
- setOperand(1, (Value*)B);
+ setOperand(1, B);
}
void setUnwindDest(BasicBlock *B) {
- setOperand(2, (Value*)B);
+ setOperand(2, B);
}
BasicBlock *getSuccessor(unsigned i) const {
@@ -2647,7 +2544,7 @@
void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
assert(idx < 2 && "Successor # out of range for invoke!");
- setOperand(idx+1, (Value*)NewSucc);
+ setOperand(idx+1, NewSucc);
}
unsigned getNumSuccessors() const { return 2; }
@@ -2711,8 +2608,6 @@
///
class UnwindInst : public TerminatorInst {
void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
-protected:
- virtual UnwindInst *clone_impl() const;
public:
// allocate space for exactly zero operands
void *operator new(size_t s) {
@@ -2721,6 +2616,8 @@
explicit UnwindInst(LLVMContext &C, Instruction *InsertBefore = 0);
explicit UnwindInst(LLVMContext &C, BasicBlock *InsertAtEnd);
+ virtual UnwindInst *clone() const;
+
unsigned getNumSuccessors() const { return 0; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -2748,9 +2645,6 @@
///
class UnreachableInst : public TerminatorInst {
void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
-protected:
- virtual UnreachableInst *clone_impl() const;
-
public:
// allocate space for exactly zero operands
void *operator new(size_t s) {
@@ -2759,6 +2653,8 @@
explicit UnreachableInst(LLVMContext &C, Instruction *InsertBefore = 0);
explicit UnreachableInst(LLVMContext &C, BasicBlock *InsertAtEnd);
+ virtual UnreachableInst *clone() const;
+
unsigned getNumSuccessors() const { return 0; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -2781,10 +2677,6 @@
/// @brief This class represents a truncation of integer types.
class TruncInst : public CastInst {
-protected:
- /// @brief Clone an identical TruncInst
- virtual TruncInst *clone_impl() const;
-
public:
/// @brief Constructor with insert-before-instruction semantics
TruncInst(
@@ -2802,6 +2694,9 @@
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
+ /// @brief Clone an identical TruncInst
+ virtual TruncInst *clone() const;
+
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const TruncInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -2818,10 +2713,6 @@
/// @brief This class represents zero extension of integer types.
class ZExtInst : public CastInst {
-protected:
- /// @brief Clone an identical ZExtInst
- virtual ZExtInst *clone_impl() const;
-
public:
/// @brief Constructor with insert-before-instruction semantics
ZExtInst(
@@ -2839,6 +2730,9 @@
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
+ /// @brief Clone an identical ZExtInst
+ virtual ZExtInst *clone() const;
+
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ZExtInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -2855,10 +2749,6 @@
/// @brief This class represents a sign extension of integer types.
class SExtInst : public CastInst {
-protected:
- /// @brief Clone an identical SExtInst
- virtual SExtInst *clone_impl() const;
-
public:
/// @brief Constructor with insert-before-instruction semantics
SExtInst(
@@ -2876,6 +2766,9 @@
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
+ /// @brief Clone an identical SExtInst
+ virtual SExtInst *clone() const;
+
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SExtInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -2892,10 +2785,6 @@
/// @brief This class represents a truncation of floating point types.
class FPTruncInst : public CastInst {
-protected:
- /// @brief Clone an identical FPTruncInst
- virtual FPTruncInst *clone_impl() const;
-
public:
/// @brief Constructor with insert-before-instruction semantics
FPTruncInst(
@@ -2913,6 +2802,9 @@
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
+ /// @brief Clone an identical FPTruncInst
+ virtual FPTruncInst *clone() const;
+
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const FPTruncInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -2929,10 +2821,6 @@
/// @brief This class represents an extension of floating point types.
class FPExtInst : public CastInst {
-protected:
- /// @brief Clone an identical FPExtInst
- virtual FPExtInst *clone_impl() const;
-
public:
/// @brief Constructor with insert-before-instruction semantics
FPExtInst(
@@ -2950,6 +2838,9 @@
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
+ /// @brief Clone an identical FPExtInst
+ virtual FPExtInst *clone() const;
+
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const FPExtInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -2966,10 +2857,6 @@
/// @brief This class represents a cast unsigned integer to floating point.
class UIToFPInst : public CastInst {
-protected:
- /// @brief Clone an identical UIToFPInst
- virtual UIToFPInst *clone_impl() const;
-
public:
/// @brief Constructor with insert-before-instruction semantics
UIToFPInst(
@@ -2987,6 +2874,9 @@
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
+ /// @brief Clone an identical UIToFPInst
+ virtual UIToFPInst *clone() const;
+
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const UIToFPInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -3003,10 +2893,6 @@
/// @brief This class represents a cast from signed integer to floating point.
class SIToFPInst : public CastInst {
-protected:
- /// @brief Clone an identical SIToFPInst
- virtual SIToFPInst *clone_impl() const;
-
public:
/// @brief Constructor with insert-before-instruction semantics
SIToFPInst(
@@ -3024,6 +2910,9 @@
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
+ /// @brief Clone an identical SIToFPInst
+ virtual SIToFPInst *clone() const;
+
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SIToFPInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -3040,10 +2929,6 @@
/// @brief This class represents a cast from floating point to unsigned integer
class FPToUIInst : public CastInst {
-protected:
- /// @brief Clone an identical FPToUIInst
- virtual FPToUIInst *clone_impl() const;
-
public:
/// @brief Constructor with insert-before-instruction semantics
FPToUIInst(
@@ -3061,6 +2946,9 @@
BasicBlock *InsertAtEnd ///< Where to insert the new instruction
);
+ /// @brief Clone an identical FPToUIInst
+ virtual FPToUIInst *clone() const;
+
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const FPToUIInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -3077,10 +2965,6 @@
/// @brief This class represents a cast from floating point to signed integer.
class FPToSIInst : public CastInst {
-protected:
- /// @brief Clone an identical FPToSIInst
- virtual FPToSIInst *clone_impl() const;
-
public:
/// @brief Constructor with insert-before-instruction semantics
FPToSIInst(
@@ -3098,6 +2982,9 @@
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
+ /// @brief Clone an identical FPToSIInst
+ virtual FPToSIInst *clone() const;
+
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const FPToSIInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -3132,7 +3019,7 @@
);
/// @brief Clone an identical IntToPtrInst
- virtual IntToPtrInst *clone_impl() const;
+ virtual IntToPtrInst *clone() const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const IntToPtrInst *) { return true; }
@@ -3150,10 +3037,6 @@
/// @brief This class represents a cast from a pointer to an integer
class PtrToIntInst : public CastInst {
-protected:
- /// @brief Clone an identical PtrToIntInst
- virtual PtrToIntInst *clone_impl() const;
-
public:
/// @brief Constructor with insert-before-instruction semantics
PtrToIntInst(
@@ -3171,6 +3054,9 @@
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
+ /// @brief Clone an identical PtrToIntInst
+ virtual PtrToIntInst *clone() const;
+
// 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) {
@@ -3187,10 +3073,6 @@
/// @brief This class represents a no-op cast from one type to another.
class BitCastInst : public CastInst {
-protected:
- /// @brief Clone an identical BitCastInst
- virtual BitCastInst *clone_impl() const;
-
public:
/// @brief Constructor with insert-before-instruction semantics
BitCastInst(
@@ -3208,6 +3090,9 @@
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
+ /// @brief Clone an identical BitCastInst
+ virtual BitCastInst *clone() const;
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const BitCastInst *) { return true; }
static inline bool classof(const Instruction *I) {
Modified: llvm/branches/Apple/Leela/include/llvm/MC/MCAsmLexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/MC/MCAsmLexer.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/MC/MCAsmLexer.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/MC/MCAsmLexer.h Mon Nov 2 13:33:53 2009
@@ -11,7 +11,7 @@
#define LLVM_MC_MCASMLEXER_H
#include "llvm/ADT/StringRef.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
class MCAsmLexer;
Modified: llvm/branches/Apple/Leela/include/llvm/MC/MCAsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/MC/MCAsmParser.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/MC/MCAsmParser.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/MC/MCAsmParser.h Mon Nov 2 13:33:53 2009
@@ -10,7 +10,7 @@
#ifndef LLVM_MC_MCASMPARSER_H
#define LLVM_MC_MCASMPARSER_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
class MCAsmLexer;
Modified: llvm/branches/Apple/Leela/include/llvm/MC/MCAssembler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/MC/MCAssembler.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/MC/MCAssembler.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/MC/MCAssembler.h Mon Nov 2 13:33:53 2009
@@ -15,7 +15,7 @@
#include "llvm/ADT/ilist_node.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/Casting.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <vector> // FIXME: Shouldn't be needed.
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/MC/MCDisassembler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/MC/MCDisassembler.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/MC/MCDisassembler.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/MC/MCDisassembler.h Mon Nov 2 13:33:53 2009
@@ -9,7 +9,7 @@
#ifndef MCDISASSEMBLER_H
#define MCDISASSEMBLER_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/MC/MCExpr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/MC/MCExpr.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/MC/MCExpr.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/MC/MCExpr.h Mon Nov 2 13:33:53 2009
@@ -11,7 +11,7 @@
#define LLVM_MC_MCEXPR_H
#include "llvm/Support/Casting.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
class MCAsmInfo;
Modified: llvm/branches/Apple/Leela/include/llvm/MC/MCInst.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/MC/MCInst.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/MC/MCInst.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/MC/MCInst.h Mon Nov 2 13:33:53 2009
@@ -17,7 +17,7 @@
#define LLVM_MC_MCINST_H
#include "llvm/ADT/SmallVector.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
class raw_ostream;
Modified: llvm/branches/Apple/Leela/include/llvm/MC/MCStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/MC/MCStreamer.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/MC/MCStreamer.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/MC/MCStreamer.h Mon Nov 2 13:33:53 2009
@@ -14,7 +14,7 @@
#ifndef LLVM_MC_MCSTREAMER_H
#define LLVM_MC_MCSTREAMER_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
class MCAsmInfo;
Modified: llvm/branches/Apple/Leela/include/llvm/MC/MCSymbol.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/MC/MCSymbol.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/MC/MCSymbol.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/MC/MCSymbol.h Mon Nov 2 13:33:53 2009
@@ -16,7 +16,7 @@
#include <string>
#include "llvm/ADT/StringRef.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
class MCAsmInfo;
Modified: llvm/branches/Apple/Leela/include/llvm/MC/MCValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/MC/MCValue.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/MC/MCValue.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/MC/MCValue.h Mon Nov 2 13:33:53 2009
@@ -14,7 +14,7 @@
#ifndef LLVM_MC_MCVALUE_H
#define LLVM_MC_MCVALUE_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/MC/MCSymbol.h"
#include <cassert>
Modified: llvm/branches/Apple/Leela/include/llvm/Module.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Module.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Module.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Module.h Mon Nov 2 13:33:53 2009
@@ -19,7 +19,7 @@
#include "llvm/GlobalVariable.h"
#include "llvm/GlobalAlias.h"
#include "llvm/Metadata.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <vector>
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/Pass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Pass.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Pass.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Pass.h Mon Nov 2 13:33:53 2009
@@ -29,7 +29,7 @@
#ifndef LLVM_PASS_H
#define LLVM_PASS_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <cassert>
#include <utility>
#include <vector>
Modified: llvm/branches/Apple/Leela/include/llvm/Support/Allocator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Support/Allocator.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Support/Allocator.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Support/Allocator.h Mon Nov 2 13:33:53 2009
@@ -15,7 +15,7 @@
#define LLVM_SUPPORT_ALLOCATOR_H
#include "llvm/Support/AlignOf.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <cassert>
#include <cstdlib>
Modified: llvm/branches/Apple/Leela/include/llvm/Support/ConstantRange.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Support/ConstantRange.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Support/ConstantRange.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Support/ConstantRange.h Mon Nov 2 13:33:53 2009
@@ -33,7 +33,7 @@
#define LLVM_SUPPORT_CONSTANT_RANGE_H
#include "llvm/ADT/APInt.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/Support/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Support/ELF.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Support/ELF.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Support/ELF.h Mon Nov 2 13:33:53 2009
@@ -21,7 +21,7 @@
#ifndef LLVM_SUPPORT_ELF_H
#define LLVM_SUPPORT_ELF_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <cstring>
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/Support/IRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Support/IRBuilder.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Support/IRBuilder.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Support/IRBuilder.h Mon Nov 2 13:33:53 2009
@@ -253,13 +253,6 @@
return Insert(SwitchInst::Create(V, Dest, NumCases));
}
- /// CreateIndirectBr - Create an indirect branch instruction with the
- /// specified address operand, with an optional hint for the number of
- /// destinations that will be added (for efficient allocation).
- IndirectBrInst *CreateIndirectBr(Value *Addr, unsigned NumDests = 10) {
- return Insert(IndirectBrInst::Create(Addr, NumDests));
- }
-
/// CreateInvoke - Create an invoke instruction.
template<typename InputIterator>
InvokeInst *CreateInvoke(Value *Callee, BasicBlock *NormalDest,
Modified: llvm/branches/Apple/Leela/include/llvm/Support/InstVisitor.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Support/InstVisitor.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Support/InstVisitor.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Support/InstVisitor.h Mon Nov 2 13:33:53 2009
@@ -160,7 +160,6 @@
RetTy visitReturnInst(ReturnInst &I) { DELEGATE(TerminatorInst);}
RetTy visitBranchInst(BranchInst &I) { DELEGATE(TerminatorInst);}
RetTy visitSwitchInst(SwitchInst &I) { DELEGATE(TerminatorInst);}
- RetTy visitIndirectBrInst(IndirectBrInst &I) { DELEGATE(TerminatorInst);}
RetTy visitInvokeInst(InvokeInst &I) { DELEGATE(TerminatorInst);}
RetTy visitUnwindInst(UnwindInst &I) { DELEGATE(TerminatorInst);}
RetTy visitUnreachableInst(UnreachableInst &I) { DELEGATE(TerminatorInst);}
Modified: llvm/branches/Apple/Leela/include/llvm/Support/MathExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Support/MathExtras.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Support/MathExtras.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Support/MathExtras.h Mon Nov 2 13:33:53 2009
@@ -14,7 +14,7 @@
#ifndef LLVM_SUPPORT_MATHEXTRAS_H
#define LLVM_SUPPORT_MATHEXTRAS_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/Support/MemoryBuffer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Support/MemoryBuffer.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Support/MemoryBuffer.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Support/MemoryBuffer.h Mon Nov 2 13:33:53 2009
@@ -15,7 +15,7 @@
#define LLVM_SUPPORT_MEMORYBUFFER_H
#include "llvm/ADT/StringRef.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <string>
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/Support/MemoryObject.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Support/MemoryObject.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Support/MemoryObject.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Support/MemoryObject.h Mon Nov 2 13:33:53 2009
@@ -10,7 +10,7 @@
#ifndef MEMORYOBJECT_H
#define MEMORYOBJECT_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/Support/PointerLikeTypeTraits.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Support/PointerLikeTypeTraits.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Support/PointerLikeTypeTraits.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Support/PointerLikeTypeTraits.h Mon Nov 2 13:33:53 2009
@@ -15,7 +15,7 @@
#ifndef LLVM_SUPPORT_POINTERLIKETYPETRAITS_H
#define LLVM_SUPPORT_POINTERLIKETYPETRAITS_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/Support/SlowOperationInformer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Support/SlowOperationInformer.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Support/SlowOperationInformer.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Support/SlowOperationInformer.h Mon Nov 2 13:33:53 2009
@@ -31,7 +31,7 @@
#include <string>
#include <cassert>
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
class SlowOperationInformer {
Modified: llvm/branches/Apple/Leela/include/llvm/Support/Timer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Support/Timer.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Support/Timer.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Support/Timer.h Mon Nov 2 13:33:53 2009
@@ -15,7 +15,7 @@
#ifndef LLVM_SUPPORT_TIMER_H
#define LLVM_SUPPORT_TIMER_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/System/Mutex.h"
#include <string>
#include <vector>
Modified: llvm/branches/Apple/Leela/include/llvm/Support/ValueHandle.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Support/ValueHandle.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Support/ValueHandle.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Support/ValueHandle.h Mon Nov 2 13:33:53 2009
@@ -238,31 +238,6 @@
template<> struct simplify_type<AssertingVH<Value> >
: public simplify_type<const AssertingVH<Value> > {};
-// Specialize DenseMapInfo to allow AssertingVH to participate in DenseMap.
-template<typename T>
-struct DenseMapInfo<AssertingVH<T> > {
- typedef DenseMapInfo<T*> PointerInfo;
- static inline AssertingVH<T> getEmptyKey() {
- return AssertingVH<T>(PointerInfo::getEmptyKey());
- }
- static inline T* getTombstoneKey() {
- return AssertingVH<T>(PointerInfo::getTombstoneKey());
- }
- static unsigned getHashValue(const AssertingVH<T> &Val) {
- return PointerInfo::getHashValue(Val);
- }
- static bool isEqual(const AssertingVH<T> &LHS, const AssertingVH<T> &RHS) {
- return LHS == RHS;
- }
- static bool isPod() {
-#ifdef NDEBUG
- return true;
-#else
- return false;
-#endif
- }
-};
-
/// TrackingVH - This is a value handle that tracks a Value (or Value subclass),
/// even across RAUW operations.
///
Modified: llvm/branches/Apple/Leela/include/llvm/Support/raw_ostream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Support/raw_ostream.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Support/raw_ostream.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Support/raw_ostream.h Mon Nov 2 13:33:53 2009
@@ -15,7 +15,7 @@
#define LLVM_SUPPORT_RAW_OSTREAM_H
#include "llvm/ADT/StringRef.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
class format_object_base;
Removed: llvm/branches/Apple/Leela/include/llvm/System/AIXDataTypesFix.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/System/AIXDataTypesFix.h?rev=85818&view=auto
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/System/AIXDataTypesFix.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/System/AIXDataTypesFix.h (removed)
@@ -1,25 +0,0 @@
-//===-- llvm/System/AIXDataTypesFix.h - Fix datatype defs ------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file overrides default system-defined types and limits which cannot be
-// done in DataTypes.h.in because it is processed by autoheader first, which
-// comments out any #undef statement
-//
-//===----------------------------------------------------------------------===//
-
-// No include guards desired!
-
-#ifndef SUPPORT_DATATYPES_H
-#error "AIXDataTypesFix.h must only be included via DataTypes.h!"
-#endif
-
-// GCC is strict about defining large constants: they must have LL modifier.
-// These will be defined properly at the end of DataTypes.h
-#undef INT64_MAX
-#undef INT64_MIN
Modified: llvm/branches/Apple/Leela/include/llvm/System/Atomic.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/System/Atomic.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/System/Atomic.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/System/Atomic.h Mon Nov 2 13:33:53 2009
@@ -14,7 +14,7 @@
#ifndef LLVM_SYSTEM_ATOMIC_H
#define LLVM_SYSTEM_ATOMIC_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
namespace sys {
Removed: llvm/branches/Apple/Leela/include/llvm/System/DataTypes.h.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/System/DataTypes.h.cmake?rev=85818&view=auto
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/System/DataTypes.h.cmake (original)
+++ llvm/branches/Apple/Leela/include/llvm/System/DataTypes.h.cmake (removed)
@@ -1,152 +0,0 @@
-/*===-- include/System/DataTypes.h - Define fixed size types -----*- 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 definitions to figure out the size of _HOST_ data types.*|
-|* This file is important because different host OS's define different macros,*|
-|* which makes portability tough. This file exports the following *|
-|* definitions: *|
-|* *|
-|* [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types*|
-|* [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values. *|
-|* *|
-|* No library is required when using these functinons. *|
-|* *|
-|*===----------------------------------------------------------------------===*/
-
-/* Please leave this file C-compatible. */
-
-#ifndef SUPPORT_DATATYPES_H
-#define SUPPORT_DATATYPES_H
-
-#cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H}
-#cmakedefine HAVE_INTTYPES_H ${HAVE_INTTYPES_H}
-#cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H}
-#cmakedefine HAVE_UINT64_T ${HAVE_UINT64_T}
-#cmakedefine HAVE_U_INT64_T ${HAVE_U_INT64_T}
-
-#ifdef __cplusplus
-#include <cmath>
-#else
-#include <math.h>
-#endif
-
-#ifndef _MSC_VER
-
-/* Note that this header's correct operation depends on __STDC_LIMIT_MACROS
- being defined. We would define it here, but in order to prevent Bad Things
- happening when system headers or C++ STL headers include stdint.h before we
- define it here, we define it on the g++ command line (in Makefile.rules). */
-#if !defined(__STDC_LIMIT_MACROS)
-# error "Must #define __STDC_LIMIT_MACROS before #including System/DataTypes.h"
-#endif
-
-#if !defined(__STDC_CONSTANT_MACROS)
-# error "Must #define __STDC_CONSTANT_MACROS before " \
- "#including System/DataTypes.h"
-#endif
-
-/* Note that <inttypes.h> includes <stdint.h>, if this is a C99 system. */
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
-
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-
-#ifdef _AIX
-#include "llvm/System/AIXDataTypesFix.h"
-#endif
-
-/* Handle incorrect definition of uint64_t as u_int64_t */
-#ifndef HAVE_UINT64_T
-#ifdef HAVE_U_INT64_T
-typedef u_int64_t uint64_t;
-#else
-# error "Don't have a definition for uint64_t on this platform"
-#endif
-#endif
-
-#ifdef _OpenBSD_
-#define INT8_MAX 127
-#define INT8_MIN -128
-#define UINT8_MAX 255
-#define INT16_MAX 32767
-#define INT16_MIN -32768
-#define UINT16_MAX 65535
-#define INT32_MAX 2147483647
-#define INT32_MIN -2147483648
-#define UINT32_MAX 4294967295U
-#endif
-
-#else /* _MSC_VER */
-/* Visual C++ doesn't provide standard integer headers, but it does provide
- built-in data types. */
-#include <stdlib.h>
-#include <stddef.h>
-#include <sys/types.h>
-#ifdef __cplusplus
-#include <cmath>
-#else
-#include <math.h>
-#endif
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef short int16_t;
-typedef unsigned short uint16_t;
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed int ssize_t;
-#define INT8_MAX 127
-#define INT8_MIN -128
-#define UINT8_MAX 255
-#define INT16_MAX 32767
-#define INT16_MIN -32768
-#define UINT16_MAX 65535
-#define INT32_MAX 2147483647
-#define INT32_MIN -2147483648
-#define UINT32_MAX 4294967295U
-#define INT8_C(C) C
-#define UINT8_C(C) C
-#define INT16_C(C) C
-#define UINT16_C(C) C
-#define INT32_C(C) C
-#define UINT32_C(C) C ## U
-#define INT64_C(C) ((int64_t) C ## LL)
-#define UINT64_C(C) ((uint64_t) C ## ULL)
-#endif /* _MSC_VER */
-
-/* Set defaults for constants which we cannot find. */
-#if !defined(INT64_MAX)
-# define INT64_MAX 9223372036854775807LL
-#endif
-#if !defined(INT64_MIN)
-# define INT64_MIN ((-INT64_MAX)-1)
-#endif
-#if !defined(UINT64_MAX)
-# define UINT64_MAX 0xffffffffffffffffULL
-#endif
-
-#if __GNUC__ > 3
-#define END_WITH_NULL __attribute__((sentinel))
-#else
-#define END_WITH_NULL
-#endif
-
-#ifndef HUGE_VALF
-#define HUGE_VALF (float)HUGE_VAL
-#endif
-
-#endif /* SUPPORT_DATATYPES_H */
Removed: llvm/branches/Apple/Leela/include/llvm/System/DataTypes.h.in
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/System/DataTypes.h.in?rev=85818&view=auto
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/System/DataTypes.h.in (original)
+++ llvm/branches/Apple/Leela/include/llvm/System/DataTypes.h.in (removed)
@@ -1,147 +0,0 @@
-/*===-- include/System/DataTypes.h - Define fixed size types -----*- 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 definitions to figure out the size of _HOST_ data types.*|
-|* This file is important because different host OS's define different macros,*|
-|* which makes portability tough. This file exports the following *|
-|* definitions: *|
-|* *|
-|* [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types*|
-|* [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values. *|
-|* *|
-|* No library is required when using these functinons. *|
-|* *|
-|*===----------------------------------------------------------------------===*/
-
-/* Please leave this file C-compatible. */
-
-#ifndef SUPPORT_DATATYPES_H
-#define SUPPORT_DATATYPES_H
-
-#undef HAVE_SYS_TYPES_H
-#undef HAVE_INTTYPES_H
-#undef HAVE_STDINT_H
-#undef HAVE_UINT64_T
-#undef HAVE_U_INT64_T
-
-#ifdef __cplusplus
-#include <cmath>
-#else
-#include <math.h>
-#endif
-
-#ifndef _MSC_VER
-
-/* Note that this header's correct operation depends on __STDC_LIMIT_MACROS
- being defined. We would define it here, but in order to prevent Bad Things
- happening when system headers or C++ STL headers include stdint.h before we
- define it here, we define it on the g++ command line (in Makefile.rules). */
-#if !defined(__STDC_LIMIT_MACROS)
-# error "Must #define __STDC_LIMIT_MACROS before #including System/DataTypes.h"
-#endif
-
-#if !defined(__STDC_CONSTANT_MACROS)
-# error "Must #define __STDC_CONSTANT_MACROS before " \
- "#including System/DataTypes.h"
-#endif
-
-/* Note that <inttypes.h> includes <stdint.h>, if this is a C99 system. */
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
-
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-
-#ifdef _AIX
-#include "llvm/System/AIXDataTypesFix.h"
-#endif
-
-/* Handle incorrect definition of uint64_t as u_int64_t */
-#ifndef HAVE_UINT64_T
-#ifdef HAVE_U_INT64_T
-typedef u_int64_t uint64_t;
-#else
-# error "Don't have a definition for uint64_t on this platform"
-#endif
-#endif
-
-#ifdef _OpenBSD_
-#define INT8_MAX 127
-#define INT8_MIN -128
-#define UINT8_MAX 255
-#define INT16_MAX 32767
-#define INT16_MIN -32768
-#define UINT16_MAX 65535
-#define INT32_MAX 2147483647
-#define INT32_MIN -2147483648
-#define UINT32_MAX 4294967295U
-#endif
-
-#else /* _MSC_VER */
-/* Visual C++ doesn't provide standard integer headers, but it does provide
- built-in data types. */
-#include <stdlib.h>
-#include <stddef.h>
-#include <sys/types.h>
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef short int16_t;
-typedef unsigned short uint16_t;
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed int ssize_t;
-#define INT8_MAX 127
-#define INT8_MIN -128
-#define UINT8_MAX 255
-#define INT16_MAX 32767
-#define INT16_MIN -32768
-#define UINT16_MAX 65535
-#define INT32_MAX 2147483647
-#define INT32_MIN -2147483648
-#define UINT32_MAX 4294967295U
-#define INT8_C(C) C
-#define UINT8_C(C) C
-#define INT16_C(C) C
-#define UINT16_C(C) C
-#define INT32_C(C) C
-#define UINT32_C(C) C ## U
-#define INT64_C(C) ((int64_t) C ## LL)
-#define UINT64_C(C) ((uint64_t) C ## ULL)
-#endif /* _MSC_VER */
-
-/* Set defaults for constants which we cannot find. */
-#if !defined(INT64_MAX)
-# define INT64_MAX 9223372036854775807LL
-#endif
-#if !defined(INT64_MIN)
-# define INT64_MIN ((-INT64_MAX)-1)
-#endif
-#if !defined(UINT64_MAX)
-# define UINT64_MAX 0xffffffffffffffffULL
-#endif
-
-#if __GNUC__ > 3
-#define END_WITH_NULL __attribute__((sentinel))
-#else
-#define END_WITH_NULL
-#endif
-
-#ifndef HUGE_VALF
-#define HUGE_VALF (float)HUGE_VAL
-#endif
-
-#endif /* SUPPORT_DATATYPES_H */
Modified: llvm/branches/Apple/Leela/include/llvm/System/Disassembler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/System/Disassembler.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/System/Disassembler.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/System/Disassembler.h Mon Nov 2 13:33:53 2009
@@ -15,7 +15,7 @@
#ifndef LLVM_SYSTEM_DISASSEMBLER_H
#define LLVM_SYSTEM_DISASSEMBLER_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <string>
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/System/Memory.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/System/Memory.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/System/Memory.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/System/Memory.h Mon Nov 2 13:33:53 2009
@@ -14,7 +14,7 @@
#ifndef LLVM_SYSTEM_MEMORY_H
#define LLVM_SYSTEM_MEMORY_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <string>
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/System/TimeValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/System/TimeValue.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/System/TimeValue.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/System/TimeValue.h Mon Nov 2 13:33:53 2009
@@ -11,7 +11,7 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <string>
#ifndef LLVM_SYSTEM_TIMEVALUE_H
Modified: llvm/branches/Apple/Leela/include/llvm/Target/SubtargetFeature.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Target/SubtargetFeature.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Target/SubtargetFeature.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Target/SubtargetFeature.h Mon Nov 2 13:33:53 2009
@@ -21,7 +21,7 @@
#include <string>
#include <vector>
#include <cstring>
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
class raw_ostream;
Modified: llvm/branches/Apple/Leela/include/llvm/Target/TargetData.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Target/TargetData.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Target/TargetData.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Target/TargetData.h Mon Nov 2 13:33:53 2009
@@ -21,7 +21,7 @@
#define LLVM_TARGET_TARGETDATA_H
#include "llvm/Pass.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/ADT/SmallVector.h"
#include <string>
Modified: llvm/branches/Apple/Leela/include/llvm/Target/TargetIntrinsicInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Target/TargetIntrinsicInfo.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Target/TargetIntrinsicInfo.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Target/TargetIntrinsicInfo.h Mon Nov 2 13:33:53 2009
@@ -25,21 +25,35 @@
/// TargetIntrinsicInfo - Interface to description of machine instruction set
///
class TargetIntrinsicInfo {
- TargetIntrinsicInfo(const TargetIntrinsicInfo &); // DO NOT IMPLEMENT
- void operator=(const TargetIntrinsicInfo &); // DO NOT IMPLEMENT
+
+ const char **Intrinsics; // Raw array to allow static init'n
+ unsigned NumIntrinsics; // Number of entries in the desc array
+
+ TargetIntrinsicInfo(const TargetIntrinsicInfo &); // DO NOT IMPLEMENT
+ void operator=(const TargetIntrinsicInfo &); // DO NOT IMPLEMENT
public:
- TargetIntrinsicInfo();
+ TargetIntrinsicInfo(const char **desc, unsigned num);
virtual ~TargetIntrinsicInfo();
- /// Return the name of a target intrinsic, e.g. "llvm.bfin.ssync".
- virtual const char *getName(unsigned IntrID) const =0;
+ unsigned getNumIntrinsics() const { return NumIntrinsics; }
+
+ virtual Function *getDeclaration(Module *M, const char *BuiltinName) const {
+ return 0;
+ }
+
+ // Returns the Function declaration for intrinsic BuiltinName. If the
+ // intrinsic can be overloaded, uses Tys to return the correct function.
+ virtual Function *getDeclaration(Module *M, const char *BuiltinName,
+ const Type **Tys, unsigned numTys) const {
+ return 0;
+ }
- /// Look up target intrinsic by name. Return intrinsic ID or 0 for unknown
- /// names.
- virtual unsigned lookupName(const char *Name, unsigned Len) const =0;
+ // Returns true if the Builtin can be overloaded.
+ virtual bool isOverloaded(Module *M, const char *BuiltinName) const {
+ return false;
+ }
- /// Return the target intrinsic ID of a function, or 0.
- virtual unsigned getIntrinsicID(Function *F) const;
+ virtual unsigned getIntrinsicID(Function *F) const { return 0; }
};
} // End llvm namespace
Modified: llvm/branches/Apple/Leela/include/llvm/Target/TargetJITInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Target/TargetJITInfo.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Target/TargetJITInfo.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Target/TargetJITInfo.h Mon Nov 2 13:33:53 2009
@@ -18,7 +18,7 @@
#define LLVM_TARGET_TARGETJITINFO_H
#include <cassert>
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
class Function;
Modified: llvm/branches/Apple/Leela/include/llvm/Target/TargetSelectionDAG.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Target/TargetSelectionDAG.td?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Target/TargetSelectionDAG.td (original)
+++ llvm/branches/Apple/Leela/include/llvm/Target/TargetSelectionDAG.td Mon Nov 2 13:33:53 2009
@@ -269,10 +269,6 @@
"ExternalSymbolSDNode">;
def texternalsym: SDNode<"ISD::TargetExternalSymbol", SDTPtrLeaf, [],
"ExternalSymbolSDNode">;
-def blockaddress : SDNode<"ISD::BlockAddress", SDTPtrLeaf, [],
- "BlockAddressSDNode">;
-def tblockaddress: SDNode<"ISD::TargetBlockAddress", SDTPtrLeaf, [],
- "BlockAddressSDNode">;
def add : SDNode<"ISD::ADD" , SDTIntBinOp ,
[SDNPCommutative, SDNPAssociative]>;
Modified: llvm/branches/Apple/Leela/include/llvm/Transforms/Utils/BasicBlockUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Transforms/Utils/BasicBlockUtils.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Transforms/Utils/BasicBlockUtils.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Transforms/Utils/BasicBlockUtils.h Mon Nov 2 13:33:53 2009
@@ -116,8 +116,8 @@
/// SplitCriticalEdge - If this edge is a critical edge, insert a new node to
/// split the critical edge. This will update DominatorTree and
/// DominatorFrontier information if it is available, thus calling this pass
-/// will not invalidate either of them. This returns the new block if the edge
-/// was split, null otherwise.
+/// will not invalidate either of them. This returns true if the edge was split,
+/// false otherwise.
///
/// If MergeIdenticalEdges is true (not the default), *all* edges from TI to the
/// specified successor will be merged into the same critical edge block.
@@ -126,16 +126,10 @@
/// dest go to one block instead of each going to a different block, but isn't
/// the standard definition of a "critical edge".
///
-/// It is invalid to call this function on a critical edge that starts at an
-/// IndirectBrInst. Splitting these edges will almost always create an invalid
-/// program because the addr of the new block won't be the one that is jumped
-/// to.
-///
BasicBlock *SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
Pass *P = 0, bool MergeIdenticalEdges = false);
-inline BasicBlock *SplitCriticalEdge(BasicBlock *BB, succ_iterator SI,
- Pass *P = 0) {
+inline BasicBlock *SplitCriticalEdge(BasicBlock *BB, succ_iterator SI, Pass *P = 0) {
return SplitCriticalEdge(BB->getTerminator(), SI.getSuccessorIndex(), P);
}
Modified: llvm/branches/Apple/Leela/include/llvm/Transforms/Utils/BasicInliner.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Transforms/Utils/BasicInliner.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Transforms/Utils/BasicInliner.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Transforms/Utils/BasicInliner.h Mon Nov 2 13:33:53 2009
@@ -15,7 +15,7 @@
#ifndef BASICINLINER_H
#define BASICINLINER_H
-#include "llvm/Analysis/InlineCost.h"
+#include "llvm/Transforms/Utils/InlineCost.h"
namespace llvm {
Modified: llvm/branches/Apple/Leela/include/llvm/Transforms/Utils/ValueMapper.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Transforms/Utils/ValueMapper.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Transforms/Utils/ValueMapper.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Transforms/Utils/ValueMapper.h Mon Nov 2 13:33:53 2009
@@ -20,9 +20,10 @@
namespace llvm {
class Value;
class Instruction;
+ class LLVMContext;
typedef DenseMap<const Value *, Value *> ValueMapTy;
- Value *MapValue(const Value *V, ValueMapTy &VM);
+ Value *MapValue(const Value *V, ValueMapTy &VM, LLVMContext &Context);
void RemapInstruction(Instruction *I, ValueMapTy &VM);
} // End llvm namespace
Modified: llvm/branches/Apple/Leela/include/llvm/Type.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Type.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Type.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Type.h Mon Nov 2 13:33:53 2009
@@ -14,7 +14,7 @@
#include "llvm/AbstractTypeUser.h"
#include "llvm/LLVMContext.h"
#include "llvm/Support/Casting.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/System/Atomic.h"
#include "llvm/ADT/GraphTraits.h"
#include <string>
Modified: llvm/branches/Apple/Leela/include/llvm/Value.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/Value.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/Value.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/Value.h Mon Nov 2 13:33:53 2009
@@ -210,7 +210,6 @@
GlobalAliasVal, // This is an instance of GlobalAlias
GlobalVariableVal, // This is an instance of GlobalVariable
UndefValueVal, // This is an instance of UndefValue
- BlockAddressVal, // This is an instance of BlockAddress
ConstantExprVal, // This is an instance of ConstantExpr
ConstantAggregateZeroVal, // This is an instance of ConstantAggregateNull
ConstantIntVal, // This is an instance of ConstantInt
Modified: llvm/branches/Apple/Leela/include/llvm/ValueSymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/include/llvm/ValueSymbolTable.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/include/llvm/ValueSymbolTable.h (original)
+++ llvm/branches/Apple/Leela/include/llvm/ValueSymbolTable.h Mon Nov 2 13:33:53 2009
@@ -16,7 +16,7 @@
#include "llvm/Value.h"
#include "llvm/ADT/StringMap.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
template<typename ValueSubClass, typename ItemParentClass>
Removed: llvm/branches/Apple/Leela/lib/Analysis/InlineCost.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Analysis/InlineCost.cpp?rev=85818&view=auto
==============================================================================
--- llvm/branches/Apple/Leela/lib/Analysis/InlineCost.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Analysis/InlineCost.cpp (removed)
@@ -1,348 +0,0 @@
-//===- InlineCost.cpp - Cost analysis for inliner -------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements inline cost analysis.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Analysis/InlineCost.h"
-#include "llvm/Support/CallSite.h"
-#include "llvm/CallingConv.h"
-#include "llvm/IntrinsicInst.h"
-#include "llvm/ADT/SmallPtrSet.h"
-using namespace llvm;
-
-// CountCodeReductionForConstant - Figure out an approximation for how many
-// instructions will be constant folded if the specified value is constant.
-//
-unsigned InlineCostAnalyzer::FunctionInfo::
- CountCodeReductionForConstant(Value *V) {
- unsigned Reduction = 0;
- for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E; ++UI)
- if (isa<BranchInst>(*UI))
- Reduction += 40; // Eliminating a conditional branch is a big win
- else if (SwitchInst *SI = dyn_cast<SwitchInst>(*UI))
- // Eliminating a switch is a big win, proportional to the number of edges
- // deleted.
- Reduction += (SI->getNumSuccessors()-1) * 40;
- else if (isa<IndirectBrInst>(*UI))
- // Eliminating an indirect branch is a big win.
- Reduction += 200;
- else if (CallInst *CI = dyn_cast<CallInst>(*UI)) {
- // Turning an indirect call into a direct call is a BIG win
- Reduction += CI->getCalledValue() == V ? 500 : 0;
- } else if (InvokeInst *II = dyn_cast<InvokeInst>(*UI)) {
- // Turning an indirect call into a direct call is a BIG win
- Reduction += II->getCalledValue() == V ? 500 : 0;
- } else {
- // Figure out if this instruction will be removed due to simple constant
- // propagation.
- Instruction &Inst = cast<Instruction>(**UI);
-
- // We can't constant propagate instructions which have effects or
- // read memory.
- //
- // FIXME: It would be nice to capture the fact that a load from a
- // pointer-to-constant-global is actually a *really* good thing to zap.
- // Unfortunately, we don't know the pointer that may get propagated here,
- // so we can't make this decision.
- if (Inst.mayReadFromMemory() || Inst.mayHaveSideEffects() ||
- isa<AllocationInst>(Inst))
- continue;
-
- bool AllOperandsConstant = true;
- for (unsigned i = 0, e = Inst.getNumOperands(); i != e; ++i)
- if (!isa<Constant>(Inst.getOperand(i)) && Inst.getOperand(i) != V) {
- AllOperandsConstant = false;
- break;
- }
-
- if (AllOperandsConstant) {
- // We will get to remove this instruction...
- Reduction += 7;
-
- // And any other instructions that use it which become constants
- // themselves.
- Reduction += CountCodeReductionForConstant(&Inst);
- }
- }
-
- return Reduction;
-}
-
-// CountCodeReductionForAlloca - Figure out an approximation of how much smaller
-// the function will be if it is inlined into a context where an argument
-// becomes an alloca.
-//
-unsigned InlineCostAnalyzer::FunctionInfo::
- CountCodeReductionForAlloca(Value *V) {
- if (!isa<PointerType>(V->getType())) return 0; // Not a pointer
- unsigned Reduction = 0;
- for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI){
- Instruction *I = cast<Instruction>(*UI);
- if (isa<LoadInst>(I) || isa<StoreInst>(I))
- Reduction += 10;
- else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(I)) {
- // If the GEP has variable indices, we won't be able to do much with it.
- if (!GEP->hasAllConstantIndices())
- Reduction += CountCodeReductionForAlloca(GEP)+15;
- } else {
- // If there is some other strange instruction, we're not going to be able
- // to do much if we inline this.
- return 0;
- }
- }
-
- return Reduction;
-}
-
-/// analyzeBasicBlock - Fill in the current structure with information gleaned
-/// from the specified block.
-void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB) {
- ++NumBlocks;
-
- for (BasicBlock::const_iterator II = BB->begin(), E = BB->end();
- II != E; ++II) {
- if (isa<PHINode>(II)) continue; // PHI nodes don't count.
-
- // Special handling for calls.
- if (isa<CallInst>(II) || isa<InvokeInst>(II)) {
- if (isa<DbgInfoIntrinsic>(II))
- continue; // Debug intrinsics don't count as size.
-
- CallSite CS = CallSite::get(const_cast<Instruction*>(&*II));
-
- // If this function contains a call to setjmp or _setjmp, 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.
- if (Function *F = CS.getCalledFunction())
- if (F->isDeclaration() &&
- (F->getName() == "setjmp" || F->getName() == "_setjmp"))
- NeverInline = true;
-
- // Calls often compile into many machine instructions. Bump up their
- // cost to reflect this.
- if (!isa<IntrinsicInst>(II))
- NumInsts += InlineConstants::CallPenalty;
- }
-
- // These, too, are calls.
- if (isa<MallocInst>(II) || isa<FreeInst>(II))
- NumInsts += InlineConstants::CallPenalty;
-
- if (const AllocaInst *AI = dyn_cast<AllocaInst>(II)) {
- if (!AI->isStaticAlloca())
- this->usesDynamicAlloca = true;
- }
-
- if (isa<ExtractElementInst>(II) || isa<VectorType>(II->getType()))
- ++NumVectorInsts;
-
- // Noop casts, including ptr <-> int, don't count.
- if (const CastInst *CI = dyn_cast<CastInst>(II)) {
- if (CI->isLosslessCast() || isa<IntToPtrInst>(CI) ||
- isa<PtrToIntInst>(CI))
- continue;
- } else if (const GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(II)){
- // If a GEP has all constant indices, it will probably be folded with
- // a load/store.
- if (GEPI->hasAllConstantIndices())
- continue;
- }
-
- ++NumInsts;
- }
-
- if (isa<ReturnInst>(BB->getTerminator()))
- ++NumRets;
-
- // We never want to inline functions that contain an indirectbr. This is
- // incorrect because all the blockaddress's (e.g. in static global
- // initializers would be referring to the original function, and this indirect
- // jump would jump from the inlined copy of the function into the original
- // function which is extremely undefined behavior.
- if (isa<IndirectBrInst>(BB->getTerminator()))
- NeverInline = true;
-}
-
-/// analyzeFunction - Fill in the current structure with information gleaned
-/// from the specified function.
-void CodeMetrics::analyzeFunction(Function *F) {
- // Look at the size of the callee.
- for (Function::const_iterator BB = F->begin(), E = F->end(); BB != E; ++BB)
- analyzeBasicBlock(&*BB);
-}
-
-/// analyzeFunction - Fill in the current structure with information gleaned
-/// from the specified function.
-void InlineCostAnalyzer::FunctionInfo::analyzeFunction(Function *F) {
- Metrics.analyzeFunction(F);
-
- // A function with exactly one return has it removed during the inlining
- // process (see InlineFunction), so don't count it.
- // FIXME: This knowledge should really be encoded outside of FunctionInfo.
- if (Metrics.NumRets==1)
- --Metrics.NumInsts;
-
- // Check out all of the arguments to the function, figuring out how much
- // code can be eliminated if one of the arguments is a constant.
- for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I)
- ArgumentWeights.push_back(ArgInfo(CountCodeReductionForConstant(I),
- CountCodeReductionForAlloca(I)));
-}
-
-// getInlineCost - The heuristic used to determine if we should inline the
-// function call or not.
-//
-InlineCost InlineCostAnalyzer::getInlineCost(CallSite CS,
- SmallPtrSet<const Function *, 16> &NeverInline) {
- Instruction *TheCall = CS.getInstruction();
- Function *Callee = CS.getCalledFunction();
- Function *Caller = TheCall->getParent()->getParent();
-
- // Don't inline functions which can be redefined at link-time to mean
- // something else. Don't inline functions marked noinline.
- if (Callee->mayBeOverridden() ||
- Callee->hasFnAttr(Attribute::NoInline) || NeverInline.count(Callee))
- return llvm::InlineCost::getNever();
-
- // InlineCost - This value measures how good of an inline candidate this call
- // site is to inline. A lower inline cost make is more likely for the call to
- // be inlined. This value may go negative.
- //
- int InlineCost = 0;
-
- // If there is only one call of the function, and it has internal linkage,
- // make it almost guaranteed to be inlined.
- //
- if (Callee->hasLocalLinkage() && Callee->hasOneUse())
- InlineCost += InlineConstants::LastCallToStaticBonus;
-
- // If this function uses the coldcc calling convention, prefer not to inline
- // it.
- if (Callee->getCallingConv() == CallingConv::Cold)
- InlineCost += InlineConstants::ColdccPenalty;
-
- // If the instruction after the call, or if the normal destination of the
- // invoke is an unreachable instruction, the function is noreturn. As such,
- // there is little point in inlining this.
- if (InvokeInst *II = dyn_cast<InvokeInst>(TheCall)) {
- if (isa<UnreachableInst>(II->getNormalDest()->begin()))
- InlineCost += InlineConstants::NoreturnPenalty;
- } else if (isa<UnreachableInst>(++BasicBlock::iterator(TheCall)))
- InlineCost += InlineConstants::NoreturnPenalty;
-
- // Get information about the callee...
- FunctionInfo &CalleeFI = CachedFunctionInfo[Callee];
-
- // If we haven't calculated this information yet, do so now.
- if (CalleeFI.Metrics.NumBlocks == 0)
- CalleeFI.analyzeFunction(Callee);
-
- // If we should never inline this, return a huge cost.
- if (CalleeFI.Metrics.NeverInline)
- return InlineCost::getNever();
-
- // FIXME: It would be nice to kill off CalleeFI.NeverInline. Then we
- // could move this up and avoid computing the FunctionInfo for
- // things we are going to just return always inline for. This
- // requires handling setjmp somewhere else, however.
- if (!Callee->isDeclaration() && Callee->hasFnAttr(Attribute::AlwaysInline))
- return InlineCost::getAlways();
-
- if (CalleeFI.Metrics.usesDynamicAlloca) {
- // Get infomation about the caller...
- FunctionInfo &CallerFI = CachedFunctionInfo[Caller];
-
- // If we haven't calculated this information yet, do so now.
- if (CallerFI.Metrics.NumBlocks == 0)
- CallerFI.analyzeFunction(Caller);
-
- // Don't inline a callee with dynamic alloca into a caller without them.
- // Functions containing dynamic alloca's are inefficient in various ways;
- // don't create more inefficiency.
- if (!CallerFI.Metrics.usesDynamicAlloca)
- return InlineCost::getNever();
- }
-
- // Add to the inline quality for properties that make the call valuable to
- // inline. This includes factors that indicate that the result of inlining
- // the function will be optimizable. Currently this just looks at arguments
- // passed into the function.
- //
- unsigned ArgNo = 0;
- for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end();
- I != E; ++I, ++ArgNo) {
- // Each argument passed in has a cost at both the caller and the callee
- // sides. This favors functions that take many arguments over functions
- // that take few arguments.
- InlineCost -= 20;
-
- // If this is a function being passed in, it is very likely that we will be
- // able to turn an indirect function call into a direct function call.
- if (isa<Function>(I))
- InlineCost -= 100;
-
- // If an alloca is passed in, inlining this function is likely to allow
- // significant future optimization possibilities (like scalar promotion, and
- // scalarization), so encourage the inlining of the function.
- //
- else if (isa<AllocaInst>(I)) {
- if (ArgNo < CalleeFI.ArgumentWeights.size())
- InlineCost -= CalleeFI.ArgumentWeights[ArgNo].AllocaWeight;
-
- // If this is a constant being passed into the function, use the argument
- // weights calculated for the callee to determine how much will be folded
- // away with this information.
- } else if (isa<Constant>(I)) {
- if (ArgNo < CalleeFI.ArgumentWeights.size())
- InlineCost -= CalleeFI.ArgumentWeights[ArgNo].ConstantWeight;
- }
- }
-
- // Now that we have considered all of the factors that make the call site more
- // likely to be inlined, look at factors that make us not want to inline it.
-
- // Don't inline into something too big, which would make it bigger.
- // "size" here is the number of basic blocks, not instructions.
- //
- InlineCost += Caller->size()/15;
-
- // Look at the size of the callee. Each instruction counts as 5.
- InlineCost += CalleeFI.Metrics.NumInsts*5;
-
- return llvm::InlineCost::get(InlineCost);
-}
-
-// getInlineFudgeFactor - Return a > 1.0 factor if the inliner should use a
-// higher threshold to determine if the function call should be inlined.
-float InlineCostAnalyzer::getInlineFudgeFactor(CallSite CS) {
- Function *Callee = CS.getCalledFunction();
-
- // Get information about the callee...
- FunctionInfo &CalleeFI = CachedFunctionInfo[Callee];
-
- // If we haven't calculated this information yet, do so now.
- if (CalleeFI.Metrics.NumBlocks == 0)
- CalleeFI.analyzeFunction(Callee);
-
- float Factor = 1.0f;
- // Single BB functions are often written to be inlined.
- if (CalleeFI.Metrics.NumBlocks == 1)
- Factor += 0.5f;
-
- // Be more aggressive if the function contains a good chunk (if it mades up
- // at least 10% of the instructions) of vector instructions.
- if (CalleeFI.Metrics.NumVectorInsts > CalleeFI.Metrics.NumInsts/2)
- Factor += 2.0f;
- else if (CalleeFI.Metrics.NumVectorInsts > CalleeFI.Metrics.NumInsts/10)
- Factor += 1.5f;
- return Factor;
-}
Modified: llvm/branches/Apple/Leela/lib/Analysis/SparsePropagation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Analysis/SparsePropagation.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Analysis/SparsePropagation.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Analysis/SparsePropagation.cpp Mon Nov 2 13:33:53 2009
@@ -166,11 +166,6 @@
return;
}
- if (isa<IndirectBrInst>(TI)) {
- Succs.assign(Succs.size(), true);
- return;
- }
-
SwitchInst &SI = cast<SwitchInst>(TI);
LatticeVal SCValue;
if (AggressiveUndef)
Modified: llvm/branches/Apple/Leela/lib/AsmParser/LLLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/AsmParser/LLLexer.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/AsmParser/LLLexer.cpp (original)
+++ llvm/branches/Apple/Leela/lib/AsmParser/LLLexer.cpp Mon Nov 2 13:33:53 2009
@@ -575,7 +575,6 @@
KEYWORD(oge); KEYWORD(ord); KEYWORD(uno); KEYWORD(ueq); KEYWORD(une);
KEYWORD(x);
- KEYWORD(blockaddress);
#undef KEYWORD
// Keywords for types.
@@ -637,7 +636,6 @@
INSTKEYWORD(ret, Ret);
INSTKEYWORD(br, Br);
INSTKEYWORD(switch, Switch);
- INSTKEYWORD(indirectbr, IndirectBr);
INSTKEYWORD(invoke, Invoke);
INSTKEYWORD(unwind, Unwind);
INSTKEYWORD(unreachable, Unreachable);
Modified: llvm/branches/Apple/Leela/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/AsmParser/LLParser.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/AsmParser/LLParser.cpp (original)
+++ llvm/branches/Apple/Leela/lib/AsmParser/LLParser.cpp Mon Nov 2 13:33:53 2009
@@ -29,6 +29,34 @@
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
+namespace llvm {
+ /// ValID - Represents a reference of a definition of some sort with no type.
+ /// There are several cases where we have to parse the value but where the
+ /// type can depend on later context. This may either be a numeric reference
+ /// or a symbolic (%var) reference. This is just a discriminated union.
+ struct ValID {
+ enum {
+ t_LocalID, t_GlobalID, // ID in UIntVal.
+ t_LocalName, t_GlobalName, // Name in StrVal.
+ t_APSInt, t_APFloat, // Value in APSIntVal/APFloatVal.
+ t_Null, t_Undef, t_Zero, // No value.
+ t_EmptyArray, // No value: []
+ t_Constant, // Value in ConstantVal.
+ t_InlineAsm, // Value in StrVal/StrVal2/UIntVal.
+ t_Metadata // Value in MetadataVal.
+ } Kind;
+
+ LLParser::LocTy Loc;
+ unsigned UIntVal;
+ std::string StrVal, StrVal2;
+ APSInt APSIntVal;
+ APFloat APFloatVal;
+ Constant *ConstantVal;
+ MetadataBase *MetadataVal;
+ ValID() : APFloatVal(0.0) {}
+ };
+}
+
/// Run: module ::= toplevelentity*
bool LLParser::Run() {
// Prime the lexer.
@@ -41,29 +69,6 @@
/// ValidateEndOfModule - Do final validity and sanity checks at the end of the
/// module.
bool LLParser::ValidateEndOfModule() {
- // If there are entries in ForwardRefBlockAddresses at this point, they are
- // references after the function was defined. Resolve those now.
- while (!ForwardRefBlockAddresses.empty()) {
- // Okay, we are referencing an already-parsed function, resolve them now.
- Function *TheFn = 0;
- const ValID &Fn = ForwardRefBlockAddresses.begin()->first;
- if (Fn.Kind == ValID::t_GlobalName)
- TheFn = M->getFunction(Fn.StrVal);
- else if (Fn.UIntVal < NumberedVals.size())
- TheFn = dyn_cast<Function>(NumberedVals[Fn.UIntVal]);
-
- if (TheFn == 0)
- return Error(Fn.Loc, "unknown function referenced by blockaddress");
-
- // Resolve all these references.
- if (ResolveForwardRefBlockAddresses(TheFn,
- ForwardRefBlockAddresses.begin()->second,
- 0))
- return true;
-
- ForwardRefBlockAddresses.erase(ForwardRefBlockAddresses.begin());
- }
-
if (!ForwardRefTypes.empty())
return Error(ForwardRefTypes.begin()->second.second,
"use of undefined type named '" +
@@ -98,38 +103,6 @@
return false;
}
-bool LLParser::ResolveForwardRefBlockAddresses(Function *TheFn,
- std::vector<std::pair<ValID, GlobalValue*> > &Refs,
- PerFunctionState *PFS) {
- // Loop over all the references, resolving them.
- for (unsigned i = 0, e = Refs.size(); i != e; ++i) {
- BasicBlock *Res;
- if (PFS) {
- if (Refs[i].first.Kind == ValID::t_LocalName)
- Res = PFS->GetBB(Refs[i].first.StrVal, Refs[i].first.Loc);
- else
- Res = PFS->GetBB(Refs[i].first.UIntVal, Refs[i].first.Loc);
- } else if (Refs[i].first.Kind == ValID::t_LocalID) {
- return Error(Refs[i].first.Loc,
- "cannot take address of numeric label after it the function is defined");
- } else {
- Res = dyn_cast_or_null<BasicBlock>(
- TheFn->getValueSymbolTable().lookup(Refs[i].first.StrVal));
- }
-
- if (Res == 0)
- return Error(Refs[i].first.Loc,
- "referenced value is not a basic block");
-
- // Get the BlockAddress for this and update references to use it.
- BlockAddress *BA = BlockAddress::get(TheFn, Res);
- Refs[i].second->replaceAllUsesWith(BA);
- Refs[i].second->eraseFromParent();
- }
- return false;
-}
-
-
//===----------------------------------------------------------------------===//
// Top-Level Entities
//===----------------------------------------------------------------------===//
@@ -1584,9 +1557,8 @@
// Function Semantic Analysis.
//===----------------------------------------------------------------------===//
-LLParser::PerFunctionState::PerFunctionState(LLParser &p, Function &f,
- int functionNumber)
- : P(p), F(f), FunctionNumber(functionNumber) {
+LLParser::PerFunctionState::PerFunctionState(LLParser &p, Function &f)
+ : P(p), F(f) {
// Insert unnamed arguments into the NumberedVals list.
for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end();
@@ -1616,29 +1588,7 @@
}
}
-bool LLParser::PerFunctionState::FinishFunction() {
- // Check to see if someone took the address of labels in this block.
- if (!P.ForwardRefBlockAddresses.empty()) {
- ValID FunctionID;
- if (!F.getName().empty()) {
- FunctionID.Kind = ValID::t_GlobalName;
- FunctionID.StrVal = F.getName();
- } else {
- FunctionID.Kind = ValID::t_GlobalID;
- FunctionID.UIntVal = FunctionNumber;
- }
-
- std::map<ValID, std::vector<std::pair<ValID, GlobalValue*> > >::iterator
- FRBAI = P.ForwardRefBlockAddresses.find(FunctionID);
- if (FRBAI != P.ForwardRefBlockAddresses.end()) {
- // Resolve all these references.
- if (P.ResolveForwardRefBlockAddresses(&F, FRBAI->second, this))
- return true;
-
- P.ForwardRefBlockAddresses.erase(FRBAI);
- }
- }
-
+bool LLParser::PerFunctionState::VerifyFunctionComplete() {
if (!ForwardRefVals.empty())
return P.Error(ForwardRefVals.begin()->second.second,
"use of undefined value '%" + ForwardRefVals.begin()->first +
@@ -2021,35 +1971,6 @@
return false;
}
- case lltok::kw_blockaddress: {
- // ValID ::= 'blockaddress' '(' @foo ',' %bar ')'
- Lex.Lex();
-
- ValID Fn, Label;
- LocTy FnLoc, LabelLoc;
-
- if (ParseToken(lltok::lparen, "expected '(' in block address expression") ||
- ParseValID(Fn) ||
- ParseToken(lltok::comma, "expected comma in block address expression")||
- ParseValID(Label) ||
- ParseToken(lltok::rparen, "expected ')' in block address expression"))
- return true;
-
- if (Fn.Kind != ValID::t_GlobalID && Fn.Kind != ValID::t_GlobalName)
- return Error(Fn.Loc, "expected function name in blockaddress");
- if (Label.Kind != ValID::t_LocalID && Label.Kind != ValID::t_LocalName)
- return Error(Label.Loc, "expected basic block name in blockaddress");
-
- // Make a global variable as a placeholder for this reference.
- GlobalVariable *FwdRef = new GlobalVariable(*M, Type::getInt8Ty(Context),
- false, GlobalValue::InternalLinkage,
- 0, "");
- ForwardRefBlockAddresses[Fn].push_back(std::make_pair(Label, FwdRef));
- ID.ConstantVal = FwdRef;
- ID.Kind = ValID::t_Constant;
- return false;
- }
-
case lltok::kw_trunc:
case lltok::kw_zext:
case lltok::kw_sext:
@@ -2472,18 +2393,6 @@
ParseValue(T, V, PFS);
}
-bool LLParser::ParseTypeAndBasicBlock(BasicBlock *&BB, LocTy &Loc,
- PerFunctionState &PFS) {
- Value *V;
- Loc = Lex.getLoc();
- if (ParseTypeAndValue(V, PFS)) return true;
- if (!isa<BasicBlock>(V))
- return Error(Loc, "expected a basic block");
- BB = cast<BasicBlock>(V);
- return false;
-}
-
-
/// FunctionHeader
/// ::= OptionalLinkage OptionalVisibility OptionalCallingConv OptRetAttrs
/// Type GlobalName '(' ArgList ')' OptFuncAttrs OptSection
@@ -2695,10 +2604,7 @@
return TokError("expected '{' in function body");
Lex.Lex(); // eat the {.
- int FunctionNumber = -1;
- if (!Fn.hasName()) FunctionNumber = NumberedVals.size()-1;
-
- PerFunctionState PFS(*this, Fn, FunctionNumber);
+ PerFunctionState PFS(*this, Fn);
while (Lex.getKind() != lltok::rbrace && Lex.getKind() != lltok::kw_end)
if (ParseBasicBlock(PFS)) return true;
@@ -2707,7 +2613,7 @@
Lex.Lex();
// Verify function is ok.
- return PFS.FinishFunction();
+ return PFS.VerifyFunctionComplete();
}
/// ParseBasicBlock
@@ -2792,7 +2698,6 @@
case lltok::kw_ret: return ParseRet(Inst, BB, PFS);
case lltok::kw_br: return ParseBr(Inst, PFS);
case lltok::kw_switch: return ParseSwitch(Inst, PFS);
- case lltok::kw_indirectbr: return ParseIndirectBr(Inst, PFS);
case lltok::kw_invoke: return ParseInvoke(Inst, PFS);
// Binary Operators.
case lltok::kw_add:
@@ -2996,8 +2901,7 @@
/// ::= 'br' TypeAndValue ',' TypeAndValue ',' TypeAndValue
bool LLParser::ParseBr(Instruction *&Inst, PerFunctionState &PFS) {
LocTy Loc, Loc2;
- Value *Op0;
- BasicBlock *Op1, *Op2;
+ Value *Op0, *Op1, *Op2;
if (ParseTypeAndValue(Op0, Loc, PFS)) return true;
if (BasicBlock *BB = dyn_cast<BasicBlock>(Op0)) {
@@ -3009,12 +2913,17 @@
return Error(Loc, "branch condition must have 'i1' type");
if (ParseToken(lltok::comma, "expected ',' after branch condition") ||
- ParseTypeAndBasicBlock(Op1, Loc, PFS) ||
+ ParseTypeAndValue(Op1, Loc, PFS) ||
ParseToken(lltok::comma, "expected ',' after true destination") ||
- ParseTypeAndBasicBlock(Op2, Loc2, PFS))
+ ParseTypeAndValue(Op2, Loc2, PFS))
return true;
- Inst = BranchInst::Create(Op1, Op2, Op0);
+ if (!isa<BasicBlock>(Op1))
+ return Error(Loc, "true destination of branch must be a basic block");
+ if (!isa<BasicBlock>(Op2))
+ return Error(Loc2, "true destination of branch must be a basic block");
+
+ Inst = BranchInst::Create(cast<BasicBlock>(Op1), cast<BasicBlock>(Op2), Op0);
return false;
}
@@ -3025,87 +2934,50 @@
/// ::= (TypeAndValue ',' TypeAndValue)*
bool LLParser::ParseSwitch(Instruction *&Inst, PerFunctionState &PFS) {
LocTy CondLoc, BBLoc;
- Value *Cond;
- BasicBlock *DefaultBB;
+ Value *Cond, *DefaultBB;
if (ParseTypeAndValue(Cond, CondLoc, PFS) ||
ParseToken(lltok::comma, "expected ',' after switch condition") ||
- ParseTypeAndBasicBlock(DefaultBB, BBLoc, PFS) ||
+ ParseTypeAndValue(DefaultBB, BBLoc, PFS) ||
ParseToken(lltok::lsquare, "expected '[' with switch table"))
return true;
if (!isa<IntegerType>(Cond->getType()))
return Error(CondLoc, "switch condition must have integer type");
+ if (!isa<BasicBlock>(DefaultBB))
+ return Error(BBLoc, "default destination must be a basic block");
// Parse the jump table pairs.
SmallPtrSet<Value*, 32> SeenCases;
SmallVector<std::pair<ConstantInt*, BasicBlock*>, 32> Table;
while (Lex.getKind() != lltok::rsquare) {
- Value *Constant;
- BasicBlock *DestBB;
+ Value *Constant, *DestBB;
if (ParseTypeAndValue(Constant, CondLoc, PFS) ||
ParseToken(lltok::comma, "expected ',' after case value") ||
- ParseTypeAndBasicBlock(DestBB, PFS))
+ ParseTypeAndValue(DestBB, BBLoc, PFS))
return true;
-
+
if (!SeenCases.insert(Constant))
return Error(CondLoc, "duplicate case value in switch");
if (!isa<ConstantInt>(Constant))
return Error(CondLoc, "case value is not a constant integer");
+ if (!isa<BasicBlock>(DestBB))
+ return Error(BBLoc, "case destination is not a basic block");
- Table.push_back(std::make_pair(cast<ConstantInt>(Constant), DestBB));
+ Table.push_back(std::make_pair(cast<ConstantInt>(Constant),
+ cast<BasicBlock>(DestBB)));
}
Lex.Lex(); // Eat the ']'.
- SwitchInst *SI = SwitchInst::Create(Cond, DefaultBB, Table.size());
+ SwitchInst *SI = SwitchInst::Create(Cond, cast<BasicBlock>(DefaultBB),
+ Table.size());
for (unsigned i = 0, e = Table.size(); i != e; ++i)
SI->addCase(Table[i].first, Table[i].second);
Inst = SI;
return false;
}
-/// ParseIndirectBr
-/// Instruction
-/// ::= 'indirectbr' TypeAndValue ',' '[' LabelList ']'
-bool LLParser::ParseIndirectBr(Instruction *&Inst, PerFunctionState &PFS) {
- LocTy AddrLoc;
- Value *Address;
- if (ParseTypeAndValue(Address, AddrLoc, PFS) ||
- ParseToken(lltok::comma, "expected ',' after indirectbr address") ||
- ParseToken(lltok::lsquare, "expected '[' with indirectbr"))
- return true;
-
- if (!isa<PointerType>(Address->getType()))
- return Error(AddrLoc, "indirectbr address must have pointer type");
-
- // Parse the destination list.
- SmallVector<BasicBlock*, 16> DestList;
-
- if (Lex.getKind() != lltok::rsquare) {
- BasicBlock *DestBB;
- if (ParseTypeAndBasicBlock(DestBB, PFS))
- return true;
- DestList.push_back(DestBB);
-
- while (EatIfPresent(lltok::comma)) {
- if (ParseTypeAndBasicBlock(DestBB, PFS))
- return true;
- DestList.push_back(DestBB);
- }
- }
-
- if (ParseToken(lltok::rsquare, "expected ']' at end of block list"))
- return true;
-
- IndirectBrInst *IBI = IndirectBrInst::Create(Address, DestList.size());
- for (unsigned i = 0, e = DestList.size(); i != e; ++i)
- IBI->addDestination(DestList[i]);
- Inst = IBI;
- return false;
-}
-
-
/// ParseInvoke
/// ::= 'invoke' OptionalCallingConv OptionalAttrs Type Value ParamList
/// OptionalAttrs 'to' TypeAndValue 'unwind' TypeAndValue
@@ -3118,7 +2990,7 @@
ValID CalleeID;
SmallVector<ParamInfo, 16> ArgList;
- BasicBlock *NormalBB, *UnwindBB;
+ Value *NormalBB, *UnwindBB;
if (ParseOptionalCallingConv(CC) ||
ParseOptionalAttrs(RetAttrs, 1) ||
ParseType(RetType, RetTypeLoc, true /*void allowed*/) ||
@@ -3126,11 +2998,16 @@
ParseParameterList(ArgList, PFS) ||
ParseOptionalAttrs(FnAttrs, 2) ||
ParseToken(lltok::kw_to, "expected 'to' in invoke") ||
- ParseTypeAndBasicBlock(NormalBB, PFS) ||
+ ParseTypeAndValue(NormalBB, PFS) ||
ParseToken(lltok::kw_unwind, "expected 'unwind' in invoke") ||
- ParseTypeAndBasicBlock(UnwindBB, PFS))
+ ParseTypeAndValue(UnwindBB, PFS))
return true;
+ if (!isa<BasicBlock>(NormalBB))
+ return Error(CallLoc, "normal destination is not a basic block");
+ if (!isa<BasicBlock>(UnwindBB))
+ return Error(CallLoc, "unwind destination is not a basic block");
+
// If RetType is a non-function pointer type, then this is the short syntax
// for the call, which means that RetType is just the return type. Infer the
// rest of the function argument types from the arguments that are present.
@@ -3198,7 +3075,8 @@
// Finish off the Attributes and check them
AttrListPtr PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());
- InvokeInst *II = InvokeInst::Create(Callee, NormalBB, UnwindBB,
+ InvokeInst *II = InvokeInst::Create(Callee, cast<BasicBlock>(NormalBB),
+ cast<BasicBlock>(UnwindBB),
Args.begin(), Args.end());
II->setCallingConv(CC);
II->setAttributes(PAL);
Modified: llvm/branches/Apple/Leela/lib/AsmParser/LLParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/AsmParser/LLParser.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/AsmParser/LLParser.h (original)
+++ llvm/branches/Apple/Leela/lib/AsmParser/LLParser.h Mon Nov 2 13:33:53 2009
@@ -31,41 +31,8 @@
class MetadataBase;
class MDString;
class MDNode;
+ struct ValID;
- /// ValID - Represents a reference of a definition of some sort with no type.
- /// There are several cases where we have to parse the value but where the
- /// type can depend on later context. This may either be a numeric reference
- /// or a symbolic (%var) reference. This is just a discriminated union.
- struct ValID {
- enum {
- t_LocalID, t_GlobalID, // ID in UIntVal.
- t_LocalName, t_GlobalName, // Name in StrVal.
- t_APSInt, t_APFloat, // Value in APSIntVal/APFloatVal.
- t_Null, t_Undef, t_Zero, // No value.
- t_EmptyArray, // No value: []
- t_Constant, // Value in ConstantVal.
- t_InlineAsm, // Value in StrVal/StrVal2/UIntVal.
- t_Metadata // Value in MetadataVal.
- } Kind;
-
- LLLexer::LocTy Loc;
- unsigned UIntVal;
- std::string StrVal, StrVal2;
- APSInt APSIntVal;
- APFloat APFloatVal;
- Constant *ConstantVal;
- MetadataBase *MetadataVal;
- ValID() : APFloatVal(0.0) {}
-
- bool operator<(const ValID &RHS) const {
- if (Kind == t_LocalID || Kind == t_GlobalID)
- return UIntVal < RHS.UIntVal;
- assert((Kind == t_LocalName || Kind == t_GlobalName) &&
- "Ordering not defined for this ValID kind yet");
- return StrVal < RHS.StrVal;
- }
- };
-
class LLParser {
public:
typedef LLLexer::LocTy LocTy;
@@ -108,11 +75,6 @@
std::map<std::string, std::pair<GlobalValue*, LocTy> > ForwardRefVals;
std::map<unsigned, std::pair<GlobalValue*, LocTy> > ForwardRefValIDs;
std::vector<GlobalValue*> NumberedVals;
-
- // References to blockaddress. The key is the function ValID, the value is
- // a list of references to blocks in that function.
- std::map<ValID, std::vector<std::pair<ValID, GlobalValue*> > >
- ForwardRefBlockAddresses;
public:
LLParser(MemoryBuffer *F, SourceMgr &SM, SMDiagnostic &Err, Module *m) :
Context(m->getContext()), Lex(F, SM, Err, m->getContext()), M(m) {}
@@ -220,17 +182,13 @@
std::map<std::string, std::pair<Value*, LocTy> > ForwardRefVals;
std::map<unsigned, std::pair<Value*, LocTy> > ForwardRefValIDs;
std::vector<Value*> NumberedVals;
-
- /// FunctionNumber - If this is an unnamed function, this is the slot
- /// number of it, otherwise it is -1.
- int FunctionNumber;
public:
- PerFunctionState(LLParser &p, Function &f, int FunctionNumber);
+ PerFunctionState(LLParser &p, Function &f);
~PerFunctionState();
Function &getFunction() const { return F; }
- bool FinishFunction();
+ bool VerifyFunctionComplete();
/// GetVal - Get a value with the specified name or ID, creating a
/// forward reference record if needed. This can return null if the value
@@ -270,13 +228,7 @@
Loc = Lex.getLoc();
return ParseTypeAndValue(V, PFS);
}
- bool ParseTypeAndBasicBlock(BasicBlock *&BB, LocTy &Loc,
- PerFunctionState &PFS);
- bool ParseTypeAndBasicBlock(BasicBlock *&BB, PerFunctionState &PFS) {
- LocTy Loc;
- return ParseTypeAndBasicBlock(BB, Loc, PFS);
- }
-
+
struct ParamInfo {
LocTy Loc;
Value *V;
@@ -310,7 +262,6 @@
bool ParseRet(Instruction *&Inst, BasicBlock *BB, PerFunctionState &PFS);
bool ParseBr(Instruction *&Inst, PerFunctionState &PFS);
bool ParseSwitch(Instruction *&Inst, PerFunctionState &PFS);
- bool ParseIndirectBr(Instruction *&Inst, PerFunctionState &PFS);
bool ParseInvoke(Instruction *&Inst, PerFunctionState &PFS);
bool ParseArithmetic(Instruction *&I, PerFunctionState &PFS, unsigned Opc,
@@ -333,10 +284,6 @@
bool ParseGetElementPtr(Instruction *&I, PerFunctionState &PFS);
bool ParseExtractValue(Instruction *&I, PerFunctionState &PFS);
bool ParseInsertValue(Instruction *&I, PerFunctionState &PFS);
-
- bool ResolveForwardRefBlockAddresses(Function *TheFn,
- std::vector<std::pair<ValID, GlobalValue*> > &Refs,
- PerFunctionState *PFS);
};
} // End llvm namespace
Modified: llvm/branches/Apple/Leela/lib/AsmParser/LLToken.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/AsmParser/LLToken.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/AsmParser/LLToken.h (original)
+++ llvm/branches/Apple/Leela/lib/AsmParser/LLToken.h Mon Nov 2 13:33:53 2009
@@ -110,13 +110,12 @@
kw_fptoui, kw_fptosi, kw_inttoptr, kw_ptrtoint, kw_bitcast,
kw_select, kw_va_arg,
- kw_ret, kw_br, kw_switch, kw_indirectbr, kw_invoke, kw_unwind,
- kw_unreachable,
+ kw_ret, kw_br, kw_switch, kw_invoke, kw_unwind, kw_unreachable,
kw_malloc, kw_alloca, kw_free, kw_load, kw_store, kw_getelementptr,
kw_extractelement, kw_insertelement, kw_shufflevector, kw_getresult,
- kw_extractvalue, kw_insertvalue, kw_blockaddress,
+ kw_extractvalue, kw_insertvalue,
// Unsigned Valued tokens (UIntVal).
GlobalID, // @42
Modified: llvm/branches/Apple/Leela/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Bitcode/Reader/BitcodeReader.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Bitcode/Reader/BitcodeReader.cpp Mon Nov 2 13:33:53 2009
@@ -1189,22 +1189,6 @@
AsmStr, ConstrStr, HasSideEffects);
break;
}
- case bitc::CST_CODE_BLOCKADDRESS:{
- if (Record.size() < 3) return Error("Invalid CE_BLOCKADDRESS record");
- const Type *FnTy = getTypeByID(Record[0]);
- if (FnTy == 0) return Error("Invalid CE_BLOCKADDRESS record");
- Function *Fn =
- dyn_cast_or_null<Function>(ValueList.getConstantFwdRef(Record[1],FnTy));
- if (Fn == 0) return Error("Invalid CE_BLOCKADDRESS record");
-
- GlobalVariable *FwdRef = new GlobalVariable(*Fn->getParent(),
- Type::getInt8Ty(Context),
- false, GlobalValue::InternalLinkage,
- 0, "");
- BlockAddrFwdRefs[Fn].push_back(std::make_pair(Record[2], FwdRef));
- V = FwdRef;
- break;
- }
}
ValueList.AssignValue(V, NextCstNo);
@@ -1964,7 +1948,7 @@
}
break;
}
- case bitc::FUNC_CODE_INST_SWITCH: { // SWITCH: [opty, op0, op1, ...]
+ case bitc::FUNC_CODE_INST_SWITCH: { // SWITCH: [opty, opval, n, n x ops]
if (Record.size() < 3 || (Record.size() & 1) == 0)
return Error("Invalid SWITCH record");
const Type *OpTy = getTypeByID(Record[0]);
@@ -1988,28 +1972,7 @@
I = SI;
break;
}
- case bitc::FUNC_CODE_INST_INDIRECTBR: { // INDIRECTBR: [opty, op0, op1, ...]
- if (Record.size() < 2)
- return Error("Invalid INDIRECTBR record");
- const Type *OpTy = getTypeByID(Record[0]);
- Value *Address = getFnValueByID(Record[1], OpTy);
- if (OpTy == 0 || Address == 0)
- return Error("Invalid INDIRECTBR record");
- unsigned NumDests = Record.size()-2;
- IndirectBrInst *IBI = IndirectBrInst::Create(Address, NumDests);
- InstructionList.push_back(IBI);
- for (unsigned i = 0, e = NumDests; i != e; ++i) {
- if (BasicBlock *DestBB = getBasicBlock(Record[2+i])) {
- IBI->addDestination(DestBB);
- } else {
- delete IBI;
- return Error("Invalid INDIRECTBR record!");
- }
- }
- I = IBI;
- break;
- }
-
+
case bitc::FUNC_CODE_INST_INVOKE: {
// INVOKE: [attrs, cc, normBB, unwindBB, fnty, op0,op1,op2, ...]
if (Record.size() < 4) return Error("Invalid INVOKE record");
@@ -2256,27 +2219,6 @@
}
}
- // See if anything took the address of blocks in this function. If so,
- // resolve them now.
- /// BlockAddrFwdRefs - These are blockaddr references to basic blocks. These
- /// are resolved lazily when functions are loaded.
- DenseMap<Function*, std::vector<BlockAddrRefTy> >::iterator BAFRI =
- BlockAddrFwdRefs.find(F);
- if (BAFRI != BlockAddrFwdRefs.end()) {
- std::vector<BlockAddrRefTy> &RefList = BAFRI->second;
- for (unsigned i = 0, e = RefList.size(); i != e; ++i) {
- unsigned BlockIdx = RefList[i].first;
- if (BlockIdx >= FunctionBBs.size())
- return Error("Invalid blockaddress block #");
-
- GlobalVariable *FwdRef = RefList[i].second;
- FwdRef->replaceAllUsesWith(BlockAddress::get(F, FunctionBBs[BlockIdx]));
- FwdRef->eraseFromParent();
- }
-
- BlockAddrFwdRefs.erase(BAFRI);
- }
-
// Trim the value list down to the size it was before we parsed this function.
ValueList.shrinkTo(ModuleValueListSize);
std::vector<BasicBlock*>().swap(FunctionBBs);
Modified: llvm/branches/Apple/Leela/lib/Bitcode/Reader/BitcodeReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Bitcode/Reader/BitcodeReader.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Bitcode/Reader/BitcodeReader.h (original)
+++ llvm/branches/Apple/Leela/lib/Bitcode/Reader/BitcodeReader.h Mon Nov 2 13:33:53 2009
@@ -94,7 +94,7 @@
class BitcodeReaderMDValueList {
std::vector<WeakVH> MDValuePtrs;
- LLVMContext &Context;
+ LLVMContext& Context;
public:
BitcodeReaderMDValueList(LLVMContext& C) : Context(C) {}
@@ -122,7 +122,7 @@
};
class BitcodeReader : public ModuleProvider {
- LLVMContext &Context;
+ LLVMContext& Context;
MemoryBuffer *Buffer;
BitstreamReader StreamFile;
BitstreamCursor Stream;
@@ -163,12 +163,6 @@
/// map contains info about where to find deferred function body (in the
/// stream) and what linkage the original function had.
DenseMap<Function*, std::pair<uint64_t, unsigned> > DeferredFunctionInfo;
-
- /// BlockAddrFwdRefs - These are blockaddr references to basic blocks. These
- /// are resolved lazily when functions are loaded.
- typedef std::pair<unsigned, GlobalVariable*> BlockAddrRefTy;
- DenseMap<Function*, std::vector<BlockAddrRefTy> > BlockAddrFwdRefs;
-
public:
explicit BitcodeReader(MemoryBuffer *buffer, LLVMContext& C)
: Context(C), Buffer(buffer), ErrorString(0), ValueList(C), MDValueList(C) {
Modified: llvm/branches/Apple/Leela/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Bitcode/Writer/BitcodeWriter.cpp Mon Nov 2 13:33:53 2009
@@ -749,11 +749,10 @@
assert (0 && "Unknown FP type!");
}
} else if (isa<ConstantArray>(C) && cast<ConstantArray>(C)->isString()) {
- const ConstantArray *CA = cast<ConstantArray>(C);
// Emit constant strings specially.
- unsigned NumOps = CA->getNumOperands();
+ unsigned NumOps = C->getNumOperands();
// If this is a null-terminated string, use the denser CSTRING encoding.
- if (CA->getOperand(NumOps-1)->isNullValue()) {
+ if (C->getOperand(NumOps-1)->isNullValue()) {
Code = bitc::CST_CODE_CSTRING;
--NumOps; // Don't encode the null, which isn't allowed by char6.
} else {
@@ -763,7 +762,7 @@
bool isCStr7 = Code == bitc::CST_CODE_CSTRING;
bool isCStrChar6 = Code == bitc::CST_CODE_CSTRING;
for (unsigned i = 0; i != NumOps; ++i) {
- unsigned char V = cast<ConstantInt>(CA->getOperand(i))->getZExtValue();
+ unsigned char V = cast<ConstantInt>(C->getOperand(i))->getZExtValue();
Record.push_back(V);
isCStr7 &= (V & 128) == 0;
if (isCStrChar6)
@@ -851,13 +850,6 @@
Record.push_back(CE->getPredicate());
break;
}
- } else if (const BlockAddress *BA = dyn_cast<BlockAddress>(C)) {
- assert(BA->getFunction() == BA->getBasicBlock()->getParent() &&
- "Malformed blockaddress");
- Code = bitc::CST_CODE_BLOCKADDRESS;
- Record.push_back(VE.getTypeID(BA->getFunction()->getType()));
- Record.push_back(VE.getValueID(BA->getFunction()));
- Record.push_back(VE.getGlobalBasicBlockID(BA->getBasicBlock()));
} else {
llvm_unreachable("Unknown constant!");
}
@@ -1007,7 +999,7 @@
case Instruction::Br:
{
Code = bitc::FUNC_CODE_INST_BR;
- BranchInst &II = cast<BranchInst>(I);
+ BranchInst &II(cast<BranchInst>(I));
Vals.push_back(VE.getValueID(II.getSuccessor(0)));
if (II.isConditional()) {
Vals.push_back(VE.getValueID(II.getSuccessor(1)));
@@ -1021,13 +1013,6 @@
for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i)
Vals.push_back(VE.getValueID(I.getOperand(i)));
break;
- case Instruction::IndirectBr:
- Code = bitc::FUNC_CODE_INST_INDIRECTBR;
- Vals.push_back(VE.getTypeID(I.getOperand(0)->getType()));
- for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i)
- Vals.push_back(VE.getValueID(I.getOperand(i)));
- break;
-
case Instruction::Invoke: {
const InvokeInst *II = cast<InvokeInst>(&I);
const Value *Callee(II->getCalledValue());
Modified: llvm/branches/Apple/Leela/lib/Bitcode/Writer/ValueEnumerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Bitcode/Writer/ValueEnumerator.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Bitcode/Writer/ValueEnumerator.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Bitcode/Writer/ValueEnumerator.cpp Mon Nov 2 13:33:53 2009
@@ -222,9 +222,7 @@
EnumerateType(Type::getVoidTy(MD->getContext()));
}
return;
- }
-
- if (const NamedMDNode *N = dyn_cast<NamedMDNode>(MD)) {
+ } else if (const NamedMDNode *N = dyn_cast<NamedMDNode>(MD)) {
for(NamedMDNode::const_elem_iterator I = N->elem_begin(),
E = N->elem_end(); I != E; ++I) {
MetadataBase *M = *I;
@@ -275,8 +273,7 @@
// graph that don't go through a global variable.
for (User::const_op_iterator I = C->op_begin(), E = C->op_end();
I != E; ++I)
- if (!isa<BasicBlock>(*I)) // Don't enumerate BB operand to BlockAddress.
- EnumerateValue(*I);
+ EnumerateValue(*I);
// Finally, add the value. Doing this could make the ValueID reference be
// dangling, don't reuse it.
@@ -322,20 +319,15 @@
// This constant may have operands, make sure to enumerate the types in
// them.
- for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i) {
- const User *Op = C->getOperand(i);
-
- // Don't enumerate basic blocks here, this happens as operands to
- // blockaddress.
- if (isa<BasicBlock>(Op)) continue;
-
- EnumerateOperandType(cast<Constant>(Op));
- }
+ for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i)
+ EnumerateOperandType(C->getOperand(i));
if (const MDNode *N = dyn_cast<MDNode>(V)) {
- for (unsigned i = 0, e = N->getNumElements(); i != e; ++i)
- if (Value *Elem = N->getElement(i))
+ for (unsigned i = 0, e = N->getNumElements(); i != e; ++i) {
+ Value *Elem = N->getElement(i);
+ if (Elem)
EnumerateOperandType(Elem);
+ }
}
} else if (isa<MDString>(V) || isa<MDNode>(V))
EnumerateValue(V);
@@ -404,23 +396,3 @@
Values.resize(NumModuleValues);
BasicBlocks.clear();
}
-
-static void IncorporateFunctionInfoGlobalBBIDs(const Function *F,
- DenseMap<const BasicBlock*, unsigned> &IDMap) {
- unsigned Counter = 0;
- for (Function::const_iterator BB = F->begin(), E = F->end(); BB != E; ++BB)
- IDMap[BB] = ++Counter;
-}
-
-/// getGlobalBasicBlockID - This returns the function-specific ID for the
-/// specified basic block. This is relatively expensive information, so it
-/// should only be used by rare constructs such as address-of-label.
-unsigned ValueEnumerator::getGlobalBasicBlockID(const BasicBlock *BB) const {
- unsigned &Idx = GlobalBasicBlockIDs[BB];
- if (Idx != 0)
- return Idx-1;
-
- IncorporateFunctionInfoGlobalBBIDs(BB->getParent(), GlobalBasicBlockIDs);
- return getGlobalBasicBlockID(BB);
-}
-
Modified: llvm/branches/Apple/Leela/lib/Bitcode/Writer/ValueEnumerator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Bitcode/Writer/ValueEnumerator.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Bitcode/Writer/ValueEnumerator.h (original)
+++ llvm/branches/Apple/Leela/lib/Bitcode/Writer/ValueEnumerator.h Mon Nov 2 13:33:53 2009
@@ -53,10 +53,6 @@
AttributeMapType AttributeMap;
std::vector<AttrListPtr> Attributes;
- /// GlobalBasicBlockIDs - This map memoizes the basic block ID's referenced by
- /// the "getGlobalBasicBlockID" method.
- mutable DenseMap<const BasicBlock*, unsigned> GlobalBasicBlockIDs;
-
typedef DenseMap<const Instruction*, unsigned> InstructionMapType;
InstructionMapType InstructionMap;
unsigned InstructionCount;
@@ -110,11 +106,6 @@
const std::vector<AttrListPtr> &getAttributes() const {
return Attributes;
}
-
- /// getGlobalBasicBlockID - This returns the function-specific ID for the
- /// specified basic block. This is relatively expensive information, so it
- /// should only be used by rare constructs such as address-of-label.
- unsigned getGlobalBasicBlockID(const BasicBlock *BB) const;
/// incorporateFunction/purgeFunction - If you'd like to deal with a function,
/// use these two methods to get its data into the ValueEnumerator!
Modified: llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Nov 2 13:33:53 2009
@@ -919,8 +919,6 @@
default:
llvm_unreachable("Unsupported operator!");
}
- } else if (const BlockAddress *BA = dyn_cast<BlockAddress>(CV)) {
- GetBlockAddressSymbol(BA)->print(O, MAI);
} else {
llvm_unreachable("Unknown constant value!");
}
@@ -1615,24 +1613,6 @@
return true;
}
-MCSymbol *AsmPrinter::GetBlockAddressSymbol(const BlockAddress *BA) const {
- return GetBlockAddressSymbol(BA->getFunction(), BA->getBasicBlock());
-}
-
-MCSymbol *AsmPrinter::GetBlockAddressSymbol(const Function *F,
- const BasicBlock *BB) const {
- assert(BB->hasName() &&
- "Address of anonymous basic block not supported yet!");
-
- // FIXME: This isn't guaranteed to produce a unique name even if the
- // block and function have a name.
- std::string Mangled =
- Mang->getMangledName(F, Mang->makeNameProper(BB->getName()).c_str(),
- /*ForcePrivate=*/true);
-
- return OutContext.GetOrCreateSymbol(StringRef(Mangled));
-}
-
MCSymbol *AsmPrinter::GetMBBSymbol(unsigned MBBID) const {
SmallString<60> Name;
raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix() << "BB"
@@ -1646,27 +1626,9 @@
/// MachineBasicBlock, an alignment (if present) and a comment describing
/// it if appropriate.
void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const {
- // Emit an alignment directive for this block, if needed.
if (unsigned Align = MBB->getAlignment())
EmitAlignment(Log2_32(Align));
- // If the block has its address taken, emit a special label to satisfy
- // references to the block. This is done so that we don't need to
- // remember the number of this label, and so that we can make
- // forward references to labels without knowing what their numbers
- // will be.
- if (MBB->hasAddressTaken()) {
- GetBlockAddressSymbol(MBB->getBasicBlock()->getParent(),
- MBB->getBasicBlock())->print(O, MAI);
- O << ':';
- if (VerboseAsm) {
- O.PadToColumn(MAI->getCommentColumn());
- O << MAI->getCommentString() << " Address Taken";
- }
- O << '\n';
- }
-
- // Print the main label for the block.
if (MBB->pred_empty() || MBB->isOnlyReachableByFallthrough()) {
if (VerboseAsm)
O << MAI->getCommentString() << " BB#" << MBB->getNumber() << ':';
@@ -1677,7 +1639,6 @@
O << '\n';
}
- // Print some comments to accompany the label.
if (VerboseAsm) {
if (const BasicBlock *BB = MBB->getBasicBlock())
if (BB->hasName()) {
Modified: llvm/branches/Apple/Leela/lib/CodeGen/BranchFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/BranchFolding.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/BranchFolding.cpp (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/BranchFolding.cpp Mon Nov 2 13:33:53 2009
@@ -881,9 +881,8 @@
// If this block is empty, make everyone use its fall-through, not the block
// explicitly. Landing pads should not do this since the landing-pad table
- // points to this block. Blocks with their addresses taken shouldn't be
- // optimized away.
- if (MBB->empty() && !MBB->isLandingPad() && !MBB->hasAddressTaken()) {
+ // points to this block.
+ if (MBB->empty() && !MBB->isLandingPad()) {
// Dead block? Leave for cleanup later.
if (MBB->pred_empty()) return MadeChange;
Modified: llvm/branches/Apple/Leela/lib/CodeGen/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/ELF.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/ELF.h (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/ELF.h Mon Nov 2 13:33:53 2009
@@ -22,7 +22,7 @@
#include "llvm/CodeGen/BinaryObject.h"
#include "llvm/CodeGen/MachineRelocation.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
namespace llvm {
class GlobalValue;
Modified: llvm/branches/Apple/Leela/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/MachineBasicBlock.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/MachineBasicBlock.cpp Mon Nov 2 13:33:53 2009
@@ -24,8 +24,7 @@
using namespace llvm;
MachineBasicBlock::MachineBasicBlock(MachineFunction &mf, const BasicBlock *bb)
- : BB(bb), Number(-1), xParent(&mf), Alignment(0), IsLandingPad(false),
- AddressTaken(false) {
+ : BB(bb), Number(-1), xParent(&mf), Alignment(0), IsLandingPad(false) {
Insts.Parent = this;
}
@@ -185,7 +184,6 @@
<< ", LLVM BB @" << (const void*) LBB << ", ID#" << getNumber();
if (Alignment) OS << ", Alignment " << Alignment;
if (isLandingPad()) OS << ", EH LANDING PAD";
- if (hasAddressTaken()) OS << ", ADDRESS TAKEN";
OS << ":\n";
const TargetRegisterInfo *TRI = MF->getTarget().getRegisterInfo();
Modified: llvm/branches/Apple/Leela/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/MachineInstr.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/MachineInstr.cpp Mon Nov 2 13:33:53 2009
@@ -13,7 +13,6 @@
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/Constants.h"
-#include "llvm/Function.h"
#include "llvm/InlineAsm.h"
#include "llvm/Value.h"
#include "llvm/Assembly/Writer.h"
@@ -181,8 +180,6 @@
case MachineOperand::MO_ExternalSymbol:
return !strcmp(getSymbolName(), Other.getSymbolName()) &&
getOffset() == Other.getOffset();
- case MachineOperand::MO_BlockAddress:
- return getBlockAddress() == Other.getBlockAddress();
}
}
@@ -274,13 +271,6 @@
if (getOffset()) OS << "+" << getOffset();
OS << '>';
break;
- case MachineOperand::MO_BlockAddress:
- OS << "<blockaddress: ";
- WriteAsOperand(OS, getBlockAddress()->getFunction(), /*PrintType=*/false);
- OS << ", ";
- WriteAsOperand(OS, getBlockAddress()->getBasicBlock(), /*PrintType=*/false);
- OS << '>';
- break;
default:
llvm_unreachable("Unrecognized operand type");
}
Modified: llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/InstrEmitter.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/InstrEmitter.cpp (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/InstrEmitter.cpp Mon Nov 2 13:33:53 2009
@@ -349,8 +349,6 @@
} else if (ExternalSymbolSDNode *ES = dyn_cast<ExternalSymbolSDNode>(Op)) {
MI->addOperand(MachineOperand::CreateES(ES->getSymbol(),
ES->getTargetFlags()));
- } else if (BlockAddressSDNode *BA = dyn_cast<BlockAddressSDNode>(Op)) {
- MI->addOperand(MachineOperand::CreateBA(BA->getBlockAddress()));
} else {
assert(Op.getValueType() != MVT::Other &&
Op.getValueType() != MVT::Flag &&
Modified: llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h Mon Nov 2 13:33:53 2009
@@ -58,7 +58,6 @@
if (isa<ConstantPoolSDNode>(Node)) return true;
if (isa<JumpTableSDNode>(Node)) return true;
if (isa<ExternalSymbolSDNode>(Node)) return true;
- if (isa<BlockAddressSDNode>(Node)) return true;
if (Node->getOpcode() == ISD::EntryToken) return true;
return false;
}
Modified: llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Nov 2 13:33:53 2009
@@ -30,7 +30,6 @@
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/TargetInstrInfo.h"
-#include "llvm/Target/TargetIntrinsicInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
@@ -460,11 +459,6 @@
ID.AddInteger(SVN->getMaskElt(i));
break;
}
- case ISD::TargetBlockAddress:
- case ISD::BlockAddress: {
- ID.AddPointer(cast<BlockAddressSDNode>(N));
- break;
- }
} // end switch (N->getOpcode())
}
@@ -1310,23 +1304,6 @@
return SDValue(N, 0);
}
-SDValue SelectionDAG::getBlockAddress(BlockAddress *BA, DebugLoc DL,
- bool isTarget) {
- unsigned Opc = isTarget ? ISD::TargetBlockAddress : ISD::BlockAddress;
-
- FoldingSetNodeID ID;
- AddNodeIDNode(ID, Opc, getVTList(TLI.getPointerTy()), 0, 0);
- ID.AddPointer(BA);
- void *IP = 0;
- if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
- return SDValue(E, 0);
- SDNode *N = NodeAllocator.Allocate<BlockAddressSDNode>();
- new (N) BlockAddressSDNode(Opc, DL, TLI.getPointerTy(), BA);
- CSEMap.InsertNode(N, IP);
- AllNodes.push_back(N);
- return SDValue(N, 0);
-}
-
SDValue SelectionDAG::getSrcValue(const Value *V) {
assert((!V || isa<PointerType>(V->getType())) &&
"SrcValue is not a pointer?");
@@ -5410,17 +5387,14 @@
case ISD::EH_RETURN: return "EH_RETURN";
case ISD::ConstantPool: return "ConstantPool";
case ISD::ExternalSymbol: return "ExternalSymbol";
- case ISD::BlockAddress: return "BlockAddress";
- case ISD::INTRINSIC_WO_CHAIN:
+ case ISD::INTRINSIC_WO_CHAIN: {
+ unsigned IID = cast<ConstantSDNode>(getOperand(0))->getZExtValue();
+ return Intrinsic::getName((Intrinsic::ID)IID);
+ }
case ISD::INTRINSIC_VOID:
case ISD::INTRINSIC_W_CHAIN: {
- unsigned OpNo = getOpcode() == ISD::INTRINSIC_WO_CHAIN ? 0 : 1;
- unsigned IID = cast<ConstantSDNode>(getOperand(OpNo))->getZExtValue();
- if (IID < Intrinsic::num_intrinsics)
- return Intrinsic::getName((Intrinsic::ID)IID);
- else if (const TargetIntrinsicInfo *TII = G->getTarget().getIntrinsicInfo())
- return TII->getName(IID);
- llvm_unreachable("Invalid intrinsic ID");
+ unsigned IID = cast<ConstantSDNode>(getOperand(1))->getZExtValue();
+ return Intrinsic::getName((Intrinsic::ID)IID);
}
case ISD::BUILD_VECTOR: return "BUILD_VECTOR";
@@ -5432,7 +5406,6 @@
case ISD::TargetJumpTable: return "TargetJumpTable";
case ISD::TargetConstantPool: return "TargetConstantPool";
case ISD::TargetExternalSymbol: return "TargetExternalSymbol";
- case ISD::TargetBlockAddress: return "TargetBlockAddress";
case ISD::CopyToReg: return "CopyToReg";
case ISD::CopyFromReg: return "CopyFromReg";
@@ -5790,13 +5763,6 @@
OS << ">";
} else if (const MemSDNode* M = dyn_cast<MemSDNode>(this)) {
OS << " <" << *M->getMemOperand() << ">";
- } else if (const BlockAddressSDNode *BA =
- dyn_cast<BlockAddressSDNode>(this)) {
- OS << "<";
- WriteAsOperand(OS, BA->getBlockAddress()->getFunction(), false);
- OS << ", ";
- WriteAsOperand(OS, BA->getBlockAddress()->getBasicBlock(), false);
- OS << ">";
}
}
Modified: llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Nov 2 13:33:53 2009
@@ -322,12 +322,6 @@
MBBMap[BB] = MBB;
MF->push_back(MBB);
- // Transfer the address-taken flag. This is necessary because there could
- // be multiple MachineBasicBlocks corresponding to one BasicBlock, and only
- // the first one should be marked.
- if (BB->hasAddressTaken())
- MBB->setHasAddressTaken();
-
// Create Machine PHI nodes for LLVM PHI nodes, lowering them as
// appropriate.
PHINode *PN;
@@ -901,9 +895,6 @@
return DAG.getMergeValues(&Constants[0], NumElts, getCurDebugLoc());
}
- if (BlockAddress *BA = dyn_cast<BlockAddress>(C))
- return DAG.getBlockAddress(BA, getCurDebugLoc());
-
const VectorType *VecTy = cast<VectorType>(V->getType());
unsigned NumElements = VecTy->getNumElements();
@@ -2151,16 +2142,6 @@
}
}
-void SelectionDAGLowering::visitIndirectBr(IndirectBrInst &I) {
- // Update machine-CFG edges.
- for (unsigned i = 0, e = I.getNumSuccessors(); i != e; ++i)
- CurMBB->addSuccessor(FuncInfo.MBBMap[I.getSuccessor(i)]);
-
- DAG.setRoot(DAG.getNode(ISD::BRIND, getCurDebugLoc(),
- MVT::Other, getControlRoot(),
- getValue(I.getAddress())));
-}
-
void SelectionDAGLowering::visitFSub(User &I) {
// -0.0 - X --> fneg
@@ -5846,7 +5827,8 @@
#include "llvm/CodeGen/SelectionDAGISel.h"
-void SelectionDAGISel::LowerArguments(BasicBlock *LLVMBB) {
+void SelectionDAGISel::
+LowerArguments(BasicBlock *LLVMBB) {
// If this is the entry block, emit arguments.
Function &F = *LLVMBB->getParent();
SelectionDAG &DAG = SDL->DAG;
Modified: llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/SelectionDAGBuild.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/SelectionDAGBuild.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/SelectionDAGBuild.h (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/SelectionDAGBuild.h Mon Nov 2 13:33:53 2009
@@ -50,7 +50,6 @@
class GCFunctionInfo;
class ICmpInst;
class IntToPtrInst;
-class IndirectBrInst;
class InvokeInst;
class InsertElementInst;
class InsertValueInst;
@@ -451,7 +450,6 @@
void visitRet(ReturnInst &I);
void visitBr(BranchInst &I);
void visitSwitch(SwitchInst &I);
- void visitIndirectBr(IndirectBrInst &I);
void visitUnreachable(UnreachableInst &I) { /* noop */ }
// Helpers for visitSwitch
Modified: llvm/branches/Apple/Leela/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/ExecutionEngine/ExecutionEngine.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/branches/Apple/Leela/lib/ExecutionEngine/ExecutionEngine.cpp Mon Nov 2 13:33:53 2009
@@ -46,9 +46,7 @@
ExecutionEngine::EERegisterFn ExecutionEngine::ExceptionTableRegister = 0;
-ExecutionEngine::ExecutionEngine(ModuleProvider *P)
- : EEState(*this),
- LazyFunctionCreator(0) {
+ExecutionEngine::ExecutionEngine(ModuleProvider *P) : LazyFunctionCreator(0) {
LazyCompilationDisabled = false;
GVCompilationDisabled = false;
SymbolSearchingDisabled = false;
@@ -117,7 +115,8 @@
void *ExecutionEngineState::RemoveMapping(
const MutexGuard &, const GlobalValue *ToUnmap) {
- GlobalAddressMapTy::iterator I = GlobalAddressMap.find(ToUnmap);
+ std::map<AssertingVH<const GlobalValue>, void *>::iterator I =
+ GlobalAddressMap.find(ToUnmap);
void *OldVal;
if (I == GlobalAddressMap.end())
OldVal = 0;
@@ -140,14 +139,14 @@
DEBUG(errs() << "JIT: Map \'" << GV->getName()
<< "\' to [" << Addr << "]\n";);
- void *&CurVal = EEState.getGlobalAddressMap(locked)[GV];
+ void *&CurVal = state.getGlobalAddressMap(locked)[GV];
assert((CurVal == 0 || Addr == 0) && "GlobalMapping already established!");
CurVal = Addr;
// If we are using the reverse mapping, add it too
- if (!EEState.getGlobalAddressReverseMap(locked).empty()) {
+ if (!state.getGlobalAddressReverseMap(locked).empty()) {
AssertingVH<const GlobalValue> &V =
- EEState.getGlobalAddressReverseMap(locked)[Addr];
+ state.getGlobalAddressReverseMap(locked)[Addr];
assert((V == 0 || GV == 0) && "GlobalMapping already established!");
V = GV;
}
@@ -158,8 +157,8 @@
void ExecutionEngine::clearAllGlobalMappings() {
MutexGuard locked(lock);
- EEState.getGlobalAddressMap(locked).clear();
- EEState.getGlobalAddressReverseMap(locked).clear();
+ state.getGlobalAddressMap(locked).clear();
+ state.getGlobalAddressReverseMap(locked).clear();
}
/// clearGlobalMappingsFromModule - Clear all global mappings that came from a
@@ -168,11 +167,11 @@
MutexGuard locked(lock);
for (Module::iterator FI = M->begin(), FE = M->end(); FI != FE; ++FI) {
- EEState.RemoveMapping(locked, FI);
+ state.RemoveMapping(locked, FI);
}
for (Module::global_iterator GI = M->global_begin(), GE = M->global_end();
GI != GE; ++GI) {
- EEState.RemoveMapping(locked, GI);
+ state.RemoveMapping(locked, GI);
}
}
@@ -182,25 +181,25 @@
void *ExecutionEngine::updateGlobalMapping(const GlobalValue *GV, void *Addr) {
MutexGuard locked(lock);
- ExecutionEngineState::GlobalAddressMapTy &Map =
- EEState.getGlobalAddressMap(locked);
+ std::map<AssertingVH<const GlobalValue>, void *> &Map =
+ state.getGlobalAddressMap(locked);
// Deleting from the mapping?
if (Addr == 0) {
- return EEState.RemoveMapping(locked, GV);
+ return state.RemoveMapping(locked, GV);
}
void *&CurVal = Map[GV];
void *OldVal = CurVal;
- if (CurVal && !EEState.getGlobalAddressReverseMap(locked).empty())
- EEState.getGlobalAddressReverseMap(locked).erase(CurVal);
+ if (CurVal && !state.getGlobalAddressReverseMap(locked).empty())
+ state.getGlobalAddressReverseMap(locked).erase(CurVal);
CurVal = Addr;
// If we are using the reverse mapping, add it too
- if (!EEState.getGlobalAddressReverseMap(locked).empty()) {
+ if (!state.getGlobalAddressReverseMap(locked).empty()) {
AssertingVH<const GlobalValue> &V =
- EEState.getGlobalAddressReverseMap(locked)[Addr];
+ state.getGlobalAddressReverseMap(locked)[Addr];
assert((V == 0 || GV == 0) && "GlobalMapping already established!");
V = GV;
}
@@ -213,9 +212,9 @@
void *ExecutionEngine::getPointerToGlobalIfAvailable(const GlobalValue *GV) {
MutexGuard locked(lock);
- ExecutionEngineState::GlobalAddressMapTy::iterator I =
- EEState.getGlobalAddressMap(locked).find(GV);
- return I != EEState.getGlobalAddressMap(locked).end() ? I->second : 0;
+ std::map<AssertingVH<const GlobalValue>, void*>::iterator I =
+ state.getGlobalAddressMap(locked).find(GV);
+ return I != state.getGlobalAddressMap(locked).end() ? I->second : 0;
}
/// getGlobalValueAtAddress - Return the LLVM global value object that starts
@@ -225,17 +224,17 @@
MutexGuard locked(lock);
// If we haven't computed the reverse mapping yet, do so first.
- if (EEState.getGlobalAddressReverseMap(locked).empty()) {
- for (ExecutionEngineState::GlobalAddressMapTy::iterator
- I = EEState.getGlobalAddressMap(locked).begin(),
- E = EEState.getGlobalAddressMap(locked).end(); I != E; ++I)
- EEState.getGlobalAddressReverseMap(locked).insert(std::make_pair(I->second,
+ if (state.getGlobalAddressReverseMap(locked).empty()) {
+ for (std::map<AssertingVH<const GlobalValue>, void *>::iterator
+ I = state.getGlobalAddressMap(locked).begin(),
+ E = state.getGlobalAddressMap(locked).end(); I != E; ++I)
+ state.getGlobalAddressReverseMap(locked).insert(std::make_pair(I->second,
I->first));
}
std::map<void *, AssertingVH<const GlobalValue> >::iterator I =
- EEState.getGlobalAddressReverseMap(locked).find(Addr);
- return I != EEState.getGlobalAddressReverseMap(locked).end() ? I->second : 0;
+ state.getGlobalAddressReverseMap(locked).find(Addr);
+ return I != state.getGlobalAddressReverseMap(locked).end() ? I->second : 0;
}
// CreateArgv - Turn a vector of strings into a nice argv style array of
@@ -475,7 +474,7 @@
return getPointerToFunction(F);
MutexGuard locked(lock);
- void *p = EEState.getGlobalAddressMap(locked)[GV];
+ void *p = state.getGlobalAddressMap(locked)[GV];
if (p)
return p;
@@ -485,7 +484,7 @@
EmitGlobalVariable(GVar);
else
llvm_unreachable("Global hasn't had an address allocated yet!");
- return EEState.getGlobalAddressMap(locked)[GV];
+ return state.getGlobalAddressMap(locked)[GV];
}
/// This function converts a Constant* into a GenericValue. The interesting
@@ -760,11 +759,8 @@
Result.PointerVal = 0;
else if (const Function *F = dyn_cast<Function>(C))
Result = PTOGV(getPointerToFunctionOrStub(const_cast<Function*>(F)));
- else if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(C))
+ else if (const GlobalVariable* GV = dyn_cast<GlobalVariable>(C))
Result = PTOGV(getOrEmitGlobalVariable(const_cast<GlobalVariable*>(GV)));
- else if (const BlockAddress *BA = dyn_cast<BlockAddress>(C))
- Result = PTOGV(getPointerToBasicBlock(const_cast<BasicBlock*>(
- BA->getBasicBlock())));
else
llvm_unreachable("Unknown constant pointer type!");
break;
@@ -1073,23 +1069,3 @@
NumInitBytes += (unsigned)GVSize;
++NumGlobals;
}
-
-ExecutionEngineState::ExecutionEngineState(ExecutionEngine &EE)
- : EE(EE), GlobalAddressMap(this) {
-}
-
-sys::Mutex *ExecutionEngineState::AddressMapConfig::getMutex(
- ExecutionEngineState *EES) {
- return &EES->EE.lock;
-}
-void ExecutionEngineState::AddressMapConfig::onDelete(
- ExecutionEngineState *EES, const GlobalValue *Old) {
- void *OldVal = EES->GlobalAddressMap.lookup(Old);
- EES->GlobalAddressReverseMap.erase(OldVal);
-}
-
-void ExecutionEngineState::AddressMapConfig::onRAUW(
- ExecutionEngineState *, const GlobalValue *, const GlobalValue *) {
- assert(false && "The ExecutionEngine doesn't know how to handle a"
- " RAUW on a value it has a global mapping for.");
-}
Modified: llvm/branches/Apple/Leela/lib/ExecutionEngine/Interpreter/Execution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/ExecutionEngine/Interpreter/Execution.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/ExecutionEngine/Interpreter/Execution.cpp (original)
+++ llvm/branches/Apple/Leela/lib/ExecutionEngine/Interpreter/Execution.cpp Mon Nov 2 13:33:53 2009
@@ -572,9 +572,9 @@
// runAtExitHandlers() assumes there are no stack frames, but
// if exit() was called, then it had a stack frame. Blow away
// the stack before interpreting atexit handlers.
- ECStack.clear();
- runAtExitHandlers();
- exit(GV.IntVal.zextOrTrunc(32).getZExtValue());
+ ECStack.clear ();
+ runAtExitHandlers ();
+ exit (GV.IntVal.zextOrTrunc(32).getZExtValue());
}
/// Pop the last stack frame off of ECStack and then copy the result
@@ -585,8 +585,8 @@
/// care of switching to the normal destination BB, if we are returning
/// from an invoke.
///
-void Interpreter::popStackAndReturnValueToCaller(const Type *RetTy,
- GenericValue Result) {
+void Interpreter::popStackAndReturnValueToCaller (const Type *RetTy,
+ GenericValue Result) {
// Pop the current stack frame.
ECStack.pop_back();
@@ -629,15 +629,15 @@
// Unwind stack
Instruction *Inst;
do {
- ECStack.pop_back();
- if (ECStack.empty())
+ ECStack.pop_back ();
+ if (ECStack.empty ())
llvm_report_error("Empty stack during unwind!");
- Inst = ECStack.back().Caller.getInstruction();
- } while (!(Inst && isa<InvokeInst>(Inst)));
+ Inst = ECStack.back ().Caller.getInstruction ();
+ } while (!(Inst && isa<InvokeInst> (Inst)));
// Return from invoke
- ExecutionContext &InvokingSF = ECStack.back();
- InvokingSF.Caller = CallSite();
+ ExecutionContext &InvokingSF = ECStack.back ();
+ InvokingSF.Caller = CallSite ();
// Go to exceptional destination BB of invoke instruction
SwitchToNewBasicBlock(cast<InvokeInst>(Inst)->getUnwindDest(), InvokingSF);
@@ -678,13 +678,6 @@
SwitchToNewBasicBlock(Dest, SF);
}
-void Interpreter::visitIndirectBrInst(IndirectBrInst &I) {
- ExecutionContext &SF = ECStack.back();
- void *Dest = GVTOP(getOperandValue(I.getAddress(), SF));
- SwitchToNewBasicBlock((BasicBlock*)Dest, SF);
-}
-
-
// SwitchToNewBasicBlock - This method is used to jump to a new basic block.
// This function handles the actual updating of block and instruction iterators
// as well as execution of all of the PHI nodes in the destination block.
@@ -842,7 +835,7 @@
// Check to see if this is an intrinsic function call...
Function *F = CS.getCalledFunction();
- if (F && F->isDeclaration())
+ if (F && F->isDeclaration ())
switch (F->getIntrinsicID()) {
case Intrinsic::not_intrinsic:
break;
Modified: llvm/branches/Apple/Leela/lib/ExecutionEngine/Interpreter/Interpreter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/ExecutionEngine/Interpreter/Interpreter.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/ExecutionEngine/Interpreter/Interpreter.h (original)
+++ llvm/branches/Apple/Leela/lib/ExecutionEngine/Interpreter/Interpreter.h Mon Nov 2 13:33:53 2009
@@ -19,7 +19,7 @@
#include "llvm/ExecutionEngine/GenericValue.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Support/CallSite.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/InstVisitor.h"
#include "llvm/Support/raw_ostream.h"
@@ -135,7 +135,6 @@
void visitReturnInst(ReturnInst &I);
void visitBranchInst(BranchInst &I);
void visitSwitchInst(SwitchInst &I);
- void visitIndirectBrInst(IndirectBrInst &I);
void visitBinaryOperator(BinaryOperator &I);
void visitICmpInst(ICmpInst &I);
@@ -204,7 +203,6 @@
void SwitchToNewBasicBlock(BasicBlock *Dest, ExecutionContext &SF);
void *getPointerToFunction(Function *F) { return (void*)F; }
- void *getPointerToBasicBlock(BasicBlock *BB) { return (void*)BB; }
void initializeExecutionEngine() { }
void initializeExternalFunctions();
Modified: llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JIT.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JIT.h (original)
+++ llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JIT.h Mon Nov 2 13:33:53 2009
@@ -127,10 +127,6 @@
///
void *getPointerToFunction(Function *F);
- void *getPointerToBasicBlock(BasicBlock *BB) {
- assert(0 && "JIT does not support address-of-label yet!");
- }
-
/// getOrEmitGlobalVariable - Return the address of the specified global
/// variable, possibly emitting it to memory if needed. This is used by the
/// Emitter.
Modified: llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JITDebugRegisterer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JITDebugRegisterer.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JITDebugRegisterer.h (original)
+++ llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JITDebugRegisterer.h Mon Nov 2 13:33:53 2009
@@ -16,7 +16,7 @@
#define LLVM_EXECUTION_ENGINE_JIT_DEBUGREGISTERER_H
#include "llvm/ADT/DenseMap.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <string>
// This must be kept in sync with gdb/gdb/jit.h .
Modified: llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JITEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JITEmitter.cpp (original)
+++ llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JITEmitter.cpp Mon Nov 2 13:33:53 2009
@@ -42,11 +42,9 @@
#include "llvm/System/Disassembler.h"
#include "llvm/System/Memory.h"
#include "llvm/Target/TargetInstrInfo.h"
-#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
-#include "llvm/ADT/ValueMap.h"
#include <algorithm>
#ifndef NDEBUG
#include <iomanip>
@@ -63,132 +61,38 @@
// JIT lazy compilation code.
//
namespace {
- class JITResolverState;
-
- template<typename ValueTy>
- struct NoRAUWValueMapConfig : public ValueMapConfig<ValueTy> {
- typedef JITResolverState *ExtraData;
- static void onRAUW(JITResolverState *, Value *Old, Value *New) {
- assert(false && "The JIT doesn't know how to handle a"
- " RAUW on a value it has emitted.");
- }
- };
-
- struct CallSiteValueMapConfig : public NoRAUWValueMapConfig<Function*> {
- typedef JITResolverState *ExtraData;
- static void onDelete(JITResolverState *JRS, Function *F);
- };
-
class JITResolverState {
public:
- typedef ValueMap<Function*, void*, NoRAUWValueMapConfig<Function*> >
- FunctionToStubMapTy;
- typedef std::map<void*, AssertingVH<Function> > CallSiteToFunctionMapTy;
- typedef ValueMap<Function *, SmallPtrSet<void*, 1>,
- CallSiteValueMapConfig> FunctionToCallSitesMapTy;
+ typedef std::map<AssertingVH<Function>, void*> FunctionToStubMapTy;
+ typedef std::map<void*, Function*> StubToFunctionMapTy;
typedef std::map<AssertingVH<GlobalValue>, void*> GlobalToIndirectSymMapTy;
private:
/// FunctionToStubMap - Keep track of the stub created for a particular
/// function so that we can reuse them if necessary.
FunctionToStubMapTy FunctionToStubMap;
- /// CallSiteToFunctionMap - Keep track of the function that each lazy call
- /// site corresponds to, and vice versa.
- CallSiteToFunctionMapTy CallSiteToFunctionMap;
- FunctionToCallSitesMapTy FunctionToCallSitesMap;
+ /// StubToFunctionMap - Keep track of the function that each stub
+ /// corresponds to.
+ StubToFunctionMapTy StubToFunctionMap;
/// GlobalToIndirectSymMap - Keep track of the indirect symbol created for a
/// particular GlobalVariable so that we can reuse them if necessary.
GlobalToIndirectSymMapTy GlobalToIndirectSymMap;
public:
- JITResolverState() : FunctionToStubMap(this),
- FunctionToCallSitesMap(this) {}
-
FunctionToStubMapTy& getFunctionToStubMap(const MutexGuard& locked) {
assert(locked.holds(TheJIT->lock));
return FunctionToStubMap;
}
- GlobalToIndirectSymMapTy& getGlobalToIndirectSymMap(const MutexGuard& locked) {
- assert(locked.holds(TheJIT->lock));
- return GlobalToIndirectSymMap;
- }
-
- pair<void *, Function *> LookupFunctionFromCallSite(
- const MutexGuard &locked, void *CallSite) const {
- assert(locked.holds(TheJIT->lock));
-
- // The address given to us for the stub may not be exactly right, it might be
- // a little bit after the stub. As such, use upper_bound to find it.
- CallSiteToFunctionMapTy::const_iterator I =
- CallSiteToFunctionMap.upper_bound(CallSite);
- assert(I != CallSiteToFunctionMap.begin() &&
- "This is not a known call site!");
- --I;
- return *I;
- }
-
- void AddCallSite(const MutexGuard &locked, void *CallSite, Function *F) {
+ StubToFunctionMapTy& getStubToFunctionMap(const MutexGuard& locked) {
assert(locked.holds(TheJIT->lock));
-
- bool Inserted = CallSiteToFunctionMap.insert(
- std::make_pair(CallSite, F)).second;
- (void)Inserted;
- assert(Inserted && "Pair was already in CallSiteToFunctionMap");
- FunctionToCallSitesMap[F].insert(CallSite);
- }
-
- // Returns the Function of the stub if a stub was erased, or NULL if there
- // was no stub. This function uses the call-site->function map to find a
- // relevant function, but asserts that only stubs and not other call sites
- // will be passed in.
- Function *EraseStub(const MutexGuard &locked, void *Stub) {
- CallSiteToFunctionMapTy::iterator C2F_I =
- CallSiteToFunctionMap.find(Stub);
- if (C2F_I == CallSiteToFunctionMap.end()) {
- // Not a stub.
- return NULL;
- }
-
- Function *const F = C2F_I->second;
-#ifndef NDEBUG
- void *RealStub = FunctionToStubMap.lookup(F);
- assert(RealStub == Stub &&
- "Call-site that wasn't a stub pass in to EraseStub");
-#endif
- FunctionToStubMap.erase(F);
- CallSiteToFunctionMap.erase(C2F_I);
-
- // Remove the stub from the function->call-sites map, and remove the whole
- // entry from the map if that was the last call site.
- FunctionToCallSitesMapTy::iterator F2C_I = FunctionToCallSitesMap.find(F);
- assert(F2C_I != FunctionToCallSitesMap.end() &&
- "FunctionToCallSitesMap broken");
- bool Erased = F2C_I->second.erase(Stub);
- (void)Erased;
- assert(Erased && "FunctionToCallSitesMap broken");
- if (F2C_I->second.empty())
- FunctionToCallSitesMap.erase(F2C_I);
-
- return F;
+ return StubToFunctionMap;
}
- void EraseAllCallSites(const MutexGuard &locked, Function *F) {
+ GlobalToIndirectSymMapTy& getGlobalToIndirectSymMap(const MutexGuard& locked) {
assert(locked.holds(TheJIT->lock));
- EraseAllCallSitesPrelocked(F);
- }
- void EraseAllCallSitesPrelocked(Function *F) {
- FunctionToCallSitesMapTy::iterator F2C = FunctionToCallSitesMap.find(F);
- if (F2C == FunctionToCallSitesMap.end())
- return;
- for (SmallPtrSet<void*, 1>::const_iterator I = F2C->second.begin(),
- E = F2C->second.end(); I != E; ++I) {
- bool Erased = CallSiteToFunctionMap.erase(*I);
- (void)Erased;
- assert(Erased && "Missing call site->function mapping");
- }
- FunctionToCallSitesMap.erase(F2C);
+ return GlobalToIndirectSymMap;
}
};
@@ -196,7 +100,7 @@
/// have not yet been compiled.
class JITResolver {
typedef JITResolverState::FunctionToStubMapTy FunctionToStubMapTy;
- typedef JITResolverState::CallSiteToFunctionMapTy CallSiteToFunctionMapTy;
+ typedef JITResolverState::StubToFunctionMapTy StubToFunctionMapTy;
typedef JITResolverState::GlobalToIndirectSymMapTy GlobalToIndirectSymMapTy;
/// LazyResolverFn - The target lazy resolver function that we actually
@@ -250,7 +154,7 @@
void *AddCallbackAtLocation(Function *F, void *Location) {
MutexGuard locked(TheJIT->lock);
/// Get the target-specific JIT resolver function.
- state.AddCallSite(locked, Location, F);
+ state.getStubToFunctionMap(locked)[Location] = F;
return (void*)(intptr_t)LazyResolverFn;
}
@@ -273,17 +177,14 @@
JITResolver *JITResolver::TheJITResolver = 0;
-void CallSiteValueMapConfig::onDelete(JITResolverState *JRS, Function *F) {
- JRS->EraseAllCallSitesPrelocked(F);
-}
-
/// getFunctionStubIfAvailable - This returns a pointer to a function stub
/// if it has already been created.
void *JITResolver::getFunctionStubIfAvailable(Function *F) {
MutexGuard locked(TheJIT->lock);
// If we already have a stub for this function, recycle it.
- return state.getFunctionToStubMap(locked).lookup(F);
+ void *&Stub = state.getFunctionToStubMap(locked)[F];
+ return Stub;
}
/// getFunctionStub - This returns a pointer to a function stub, creating
@@ -329,7 +230,7 @@
// Finally, keep track of the stub-to-Function mapping so that the
// JITCompilerFn knows which function to compile!
- state.AddCallSite(locked, Stub, F);
+ state.getStubToFunctionMap(locked)[Stub] = F;
// If we are JIT'ing non-lazily but need to call a function that does not
// exist yet, add it to the JIT's work list so that we can fill in the stub
@@ -390,11 +291,10 @@
SmallVectorImpl<void*> &Ptrs) {
MutexGuard locked(TheJIT->lock);
- const FunctionToStubMapTy &FM = state.getFunctionToStubMap(locked);
+ FunctionToStubMapTy &FM = state.getFunctionToStubMap(locked);
GlobalToIndirectSymMapTy &GM = state.getGlobalToIndirectSymMap(locked);
- for (FunctionToStubMapTy::const_iterator i = FM.begin(), e = FM.end();
- i != e; ++i){
+ for (FunctionToStubMapTy::iterator i = FM.begin(), e = FM.end(); i != e; ++i){
Function *F = i->first;
if (F->isDeclaration() && F->hasExternalLinkage()) {
GVs.push_back(i->first);
@@ -410,15 +310,20 @@
GlobalValue *JITResolver::invalidateStub(void *Stub) {
MutexGuard locked(TheJIT->lock);
-
+
+ FunctionToStubMapTy &FM = state.getFunctionToStubMap(locked);
+ StubToFunctionMapTy &SM = state.getStubToFunctionMap(locked);
GlobalToIndirectSymMapTy &GM = state.getGlobalToIndirectSymMap(locked);
-
+
// Look up the cheap way first, to see if it's a function stub we are
// invalidating. If so, remove it from both the forward and reverse maps.
- if (Function *F = state.EraseStub(locked, Stub)) {
+ if (SM.find(Stub) != SM.end()) {
+ Function *F = SM[Stub];
+ SM.erase(Stub);
+ FM.erase(F);
return F;
}
-
+
// Otherwise, it might be an indirect symbol stub. Find it and remove it.
for (GlobalToIndirectSymMapTy::iterator i = GM.begin(), e = GM.end();
i != e; ++i) {
@@ -456,12 +361,14 @@
// JIT lock to be unlocked.
MutexGuard locked(TheJIT->lock);
- // The address given to us for the stub may not be exactly right, it might
- // be a little bit after the stub. As such, use upper_bound to find it.
- pair<void*, Function*> I =
- JR.state.LookupFunctionFromCallSite(locked, Stub);
- F = I.second;
- ActualPtr = I.first;
+ // The address given to us for the stub may not be exactly right, it might be
+ // a little bit after the stub. As such, use upper_bound to find it.
+ StubToFunctionMapTy::iterator I =
+ JR.state.getStubToFunctionMap(locked).upper_bound(Stub);
+ assert(I != JR.state.getStubToFunctionMap(locked).begin() &&
+ "This is not a known stub!");
+ F = (--I)->second;
+ ActualPtr = I->first;
}
// If we have already code generated the function, just return the address.
@@ -476,21 +383,25 @@
+ F->getName() + "' when lazy compiles are disabled!");
}
+ // We might like to remove the stub from the StubToFunction map.
+ // We can't do that! Multiple threads could be stuck, waiting to acquire the
+ // lock above. As soon as the 1st function finishes compiling the function,
+ // the next one will be released, and needs to be able to find the function
+ // it needs to call.
+ //JR.state.getStubToFunctionMap(locked).erase(I);
+
DEBUG(errs() << "JIT: Lazily resolving function '" << F->getName()
<< "' In stub ptr = " << Stub << " actual ptr = "
<< ActualPtr << "\n");
Result = TheJIT->getPointerToFunction(F);
}
-
- // Reacquire the lock to update the GOT map.
+
+ // Reacquire the lock to erase the stub in the map.
MutexGuard locked(TheJIT->lock);
- // We might like to remove the call site from the CallSiteToFunction map, but
- // we can't do that! Multiple threads could be stuck, waiting to acquire the
- // lock above. As soon as the 1st function finishes compiling the function,
- // the next one will be released, and needs to be able to find the function it
- // needs to call.
+ // We don't need to reuse this stub in the future, as F is now compiled.
+ JR.state.getFunctionToStubMap(locked).erase(F);
// FIXME: We could rewrite all references to this stub if we knew them.
@@ -581,13 +492,6 @@
/// finishFunction.
JITEvent_EmittedFunctionDetails EmissionDetails;
- struct EmittedCode {
- void *FunctionBody;
- void *ExceptionTable;
- EmittedCode() : FunctionBody(0), ExceptionTable(0) {}
- };
- DenseMap<const Function *, EmittedCode> EmittedFunctions;
-
// CurFnStubUses - For a given Function, a vector of stubs that it
// references. This facilitates the JIT detecting that a stub is no
// longer used, so that it may be deallocated.
@@ -1054,8 +958,7 @@
BufferBegin = CurBufferPtr = MemMgr->startFunctionBody(F.getFunction(),
ActualSize);
BufferEnd = BufferBegin+ActualSize;
- EmittedFunctions[F.getFunction()].FunctionBody = BufferBegin;
-
+
// Ensure the constant pool/jump table info is at least 4-byte aligned.
emitAlignment(16);
@@ -1245,7 +1148,6 @@
BufferBegin = CurBufferPtr = MemMgr->startExceptionTable(F.getFunction(),
ActualSize);
BufferEnd = BufferBegin+ActualSize;
- EmittedFunctions[F.getFunction()].ExceptionTable = BufferBegin;
uint8_t *EhStart;
uint8_t *FrameRegister = DE->EmitDwarfTable(F, *this, FnStart, FnEnd,
EhStart);
@@ -1289,13 +1191,7 @@
/// deallocateMemForFunction - Deallocate all memory for the specified
/// function body. Also drop any references the function has to stubs.
void JITEmitter::deallocateMemForFunction(const Function *F) {
- DenseMap<const Function *, EmittedCode>::iterator Emitted =
- EmittedFunctions.find(F);
- if (Emitted != EmittedFunctions.end()) {
- MemMgr->deallocateFunctionBody(Emitted->second.FunctionBody);
- MemMgr->deallocateExceptionTable(Emitted->second.ExceptionTable);
- EmittedFunctions.erase(Emitted);
- }
+ MemMgr->deallocateMemForFunction(F);
// TODO: Do we need to unregister exception handling information from libgcc
// here?
Modified: llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JITMemoryManager.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JITMemoryManager.cpp (original)
+++ llvm/branches/Apple/Leela/lib/ExecutionEngine/JIT/JITMemoryManager.cpp Mon Nov 2 13:33:53 2009
@@ -297,6 +297,9 @@
uint8_t *GOTBase; // Target Specific reserved memory
void *DlsymTable; // Stub external symbol information
+
+ std::map<const Function*, MemoryRangeHeader*> FunctionBlocks;
+ std::map<const Function*, MemoryRangeHeader*> TableBlocks;
public:
DefaultJITMemoryManager();
~DefaultJITMemoryManager();
@@ -411,6 +414,7 @@
"Mismatched function start/end!");
uintptr_t BlockSize = FunctionEnd - (uint8_t *)CurBlock;
+ FunctionBlocks[F] = CurBlock;
// Release the memory at the end of this block that isn't needed.
FreeMemoryList =CurBlock->TrimAllocationToSize(FreeMemoryList, BlockSize);
@@ -460,6 +464,7 @@
"Mismatched table start/end!");
uintptr_t BlockSize = TableEnd - (uint8_t *)CurBlock;
+ TableBlocks[F] = CurBlock;
// Release the memory at the end of this block that isn't needed.
FreeMemoryList =CurBlock->TrimAllocationToSize(FreeMemoryList, BlockSize);
@@ -473,9 +478,15 @@
return DlsymTable;
}
- void deallocateBlock(void *Block) {
+ /// deallocateMemForFunction - Deallocate all memory for the specified
+ /// function body.
+ void deallocateMemForFunction(const Function *F) {
+ std::map<const Function*, MemoryRangeHeader*>::iterator
+ I = FunctionBlocks.find(F);
+ if (I == FunctionBlocks.end()) return;
+
// Find the block that is allocated for this function.
- MemoryRangeHeader *MemRange = static_cast<MemoryRangeHeader*>(Block) - 1;
+ MemoryRangeHeader *MemRange = I->second;
assert(MemRange->ThisAllocated && "Block isn't allocated!");
// Fill the buffer with garbage!
@@ -485,18 +496,27 @@
// Free the memory.
FreeMemoryList = MemRange->FreeBlock(FreeMemoryList);
- }
+
+ // Finally, remove this entry from FunctionBlocks.
+ FunctionBlocks.erase(I);
+
+ I = TableBlocks.find(F);
+ if (I == TableBlocks.end()) return;
+
+ // Find the block that is allocated for this function.
+ MemRange = I->second;
+ assert(MemRange->ThisAllocated && "Block isn't allocated!");
- /// deallocateFunctionBody - Deallocate all memory for the specified
- /// function body.
- void deallocateFunctionBody(void *Body) {
- deallocateBlock(Body);
- }
+ // Fill the buffer with garbage!
+ if (PoisonMemory) {
+ memset(MemRange+1, 0xCD, MemRange->BlockSize-sizeof(*MemRange));
+ }
- /// deallocateExceptionTable - Deallocate memory for the specified
- /// exception table.
- void deallocateExceptionTable(void *ET) {
- deallocateBlock(ET);
+ // Free the memory.
+ FreeMemoryList = MemRange->FreeBlock(FreeMemoryList);
+
+ // Finally, remove this entry from TableBlocks.
+ TableBlocks.erase(I);
}
/// setMemoryWritable - When code generation is in progress,
Modified: llvm/branches/Apple/Leela/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Linker/LinkModules.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Linker/LinkModules.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Linker/LinkModules.cpp Mon Nov 2 13:33:53 2009
@@ -349,7 +349,8 @@
// RemapOperand - Use ValueMap to convert constants from one module to another.
static Value *RemapOperand(const Value *In,
- std::map<const Value*, Value*> &ValueMap) {
+ std::map<const Value*, Value*> &ValueMap,
+ LLVMContext &Context) {
std::map<const Value*,Value*>::const_iterator I = ValueMap.find(In);
if (I != ValueMap.end())
return I->second;
@@ -364,29 +365,31 @@
if (const ConstantArray *CPA = dyn_cast<ConstantArray>(CPV)) {
std::vector<Constant*> Operands(CPA->getNumOperands());
for (unsigned i = 0, e = CPA->getNumOperands(); i != e; ++i)
- Operands[i] =cast<Constant>(RemapOperand(CPA->getOperand(i), ValueMap));
- Result = ConstantArray::get(cast<ArrayType>(CPA->getType()), Operands);
+ Operands[i] =cast<Constant>(RemapOperand(CPA->getOperand(i), ValueMap,
+ Context));
+ Result =
+ ConstantArray::get(cast<ArrayType>(CPA->getType()), Operands);
} else if (const ConstantStruct *CPS = dyn_cast<ConstantStruct>(CPV)) {
std::vector<Constant*> Operands(CPS->getNumOperands());
for (unsigned i = 0, e = CPS->getNumOperands(); i != e; ++i)
- Operands[i] =cast<Constant>(RemapOperand(CPS->getOperand(i), ValueMap));
- Result = ConstantStruct::get(cast<StructType>(CPS->getType()), Operands);
+ Operands[i] =cast<Constant>(RemapOperand(CPS->getOperand(i), ValueMap,
+ Context));
+ Result =
+ ConstantStruct::get(cast<StructType>(CPS->getType()), Operands);
} else if (isa<ConstantPointerNull>(CPV) || isa<UndefValue>(CPV)) {
Result = const_cast<Constant*>(CPV);
} else if (const ConstantVector *CP = dyn_cast<ConstantVector>(CPV)) {
std::vector<Constant*> Operands(CP->getNumOperands());
for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)
- Operands[i] = cast<Constant>(RemapOperand(CP->getOperand(i), ValueMap));
+ Operands[i] = cast<Constant>(RemapOperand(CP->getOperand(i), ValueMap,
+ Context));
Result = ConstantVector::get(Operands);
} else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CPV)) {
std::vector<Constant*> Ops;
for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i)
- Ops.push_back(cast<Constant>(RemapOperand(CE->getOperand(i),ValueMap)));
+ Ops.push_back(cast<Constant>(RemapOperand(CE->getOperand(i),ValueMap,
+ Context)));
Result = CE->getWithOperands(Ops);
- } else if (const BlockAddress *CE = dyn_cast<BlockAddress>(CPV)) {
- Result = BlockAddress::get(
- cast<Function>(RemapOperand(CE->getFunction(), ValueMap)),
- CE->getBasicBlock());
} else {
assert(!isa<GlobalValue>(CPV) && "Unmapped global?");
llvm_unreachable("Unknown type of derived type constant value!");
@@ -893,7 +896,8 @@
if (SGV->hasInitializer()) { // Only process initialized GV's
// Figure out what the initializer looks like in the dest module...
Constant *SInit =
- cast<Constant>(RemapOperand(SGV->getInitializer(), ValueMap));
+ cast<Constant>(RemapOperand(SGV->getInitializer(), ValueMap,
+ Dest->getContext()));
// Grab destination global variable or alias.
GlobalValue *DGV = cast<GlobalValue>(ValueMap[SGV]->stripPointerCasts());
@@ -1080,7 +1084,7 @@
for (Instruction::op_iterator OI = I->op_begin(), OE = I->op_end();
OI != OE; ++OI)
if (!isa<Instruction>(*OI) && !isa<BasicBlock>(*OI))
- *OI = RemapOperand(*OI, ValueMap);
+ *OI = RemapOperand(*OI, ValueMap, Dest->getContext());
// There is no need to map the arguments anymore.
for (Function::arg_iterator I = Src->arg_begin(), E = Src->arg_end();
Modified: llvm/branches/Apple/Leela/lib/MC/MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/MC/MCAsmInfo.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/MC/MCAsmInfo.cpp (original)
+++ llvm/branches/Apple/Leela/lib/MC/MCAsmInfo.cpp Mon Nov 2 13:33:53 2009
@@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCAsmInfo.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <cctype>
#include <cstring>
using namespace llvm;
Modified: llvm/branches/Apple/Leela/lib/Support/Allocator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Support/Allocator.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Support/Allocator.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Support/Allocator.cpp Mon Nov 2 13:33:53 2009
@@ -12,7 +12,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Support/Allocator.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Recycler.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Memory.h"
Modified: llvm/branches/Apple/Leela/lib/System/Unix/Memory.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/System/Unix/Memory.inc?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/System/Unix/Memory.inc (original)
+++ llvm/branches/Apple/Leela/lib/System/Unix/Memory.inc Mon Nov 2 13:33:53 2009
@@ -12,7 +12,7 @@
//===----------------------------------------------------------------------===//
#include "Unix.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/System/Process.h"
#ifdef HAVE_SYS_MMAN_H
Modified: llvm/branches/Apple/Leela/lib/System/Win32/Memory.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/System/Win32/Memory.inc?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/System/Win32/Memory.inc (original)
+++ llvm/branches/Apple/Leela/lib/System/Win32/Memory.inc Mon Nov 2 13:33:53 2009
@@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
#include "Win32.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/System/Process.h"
namespace llvm {
Modified: llvm/branches/Apple/Leela/lib/Target/CBackend/CBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/CBackend/CBackend.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Target/CBackend/CBackend.cpp Mon Nov 2 13:33:53 2009
@@ -282,7 +282,6 @@
void visitReturnInst(ReturnInst &I);
void visitBranchInst(BranchInst &I);
void visitSwitchInst(SwitchInst &I);
- void visitIndirectBrInst(IndirectBrInst &I);
void visitInvokeInst(InvokeInst &I) {
llvm_unreachable("Lowerinvoke pass didn't work!");
}
@@ -2581,12 +2580,6 @@
Out << " }\n";
}
-void CWriter::visitIndirectBrInst(IndirectBrInst &IBI) {
- Out << " goto *(void*)(";
- writeOperand(IBI.getOperand(0));
- Out << ");\n";
-}
-
void CWriter::visitUnreachableInst(UnreachableInst &I) {
Out << " /*UNREACHABLE*/;\n";
}
Modified: llvm/branches/Apple/Leela/lib/Target/CellSPU/SPU.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/CellSPU/SPU.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/CellSPU/SPU.h (original)
+++ llvm/branches/Apple/Leela/lib/Target/CellSPU/SPU.h Mon Nov 2 13:33:53 2009
@@ -15,7 +15,7 @@
#ifndef LLVM_TARGET_IBMCELLSPU_H
#define LLVM_TARGET_IBMCELLSPU_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/Target/TargetMachine.h"
namespace llvm {
Modified: llvm/branches/Apple/Leela/lib/Target/CppBackend/CPPBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/CppBackend/CPPBackend.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/CppBackend/CPPBackend.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Target/CppBackend/CPPBackend.cpp Mon Nov 2 13:33:53 2009
@@ -1118,13 +1118,13 @@
break;
}
case Instruction::Switch: {
- const SwitchInst *SI = cast<SwitchInst>(I);
+ const SwitchInst* sw = cast<SwitchInst>(I);
Out << "SwitchInst* " << iName << " = SwitchInst::Create("
<< opNames[0] << ", "
<< opNames[1] << ", "
- << SI->getNumCases() << ", " << bbname << ");";
+ << sw->getNumCases() << ", " << bbname << ");";
nl(Out);
- for (unsigned i = 2; i != SI->getNumOperands(); i += 2) {
+ for (unsigned i = 2; i < sw->getNumOperands(); i += 2 ) {
Out << iName << "->addCase("
<< opNames[i] << ", "
<< opNames[i+1] << ");";
@@ -1132,17 +1132,6 @@
}
break;
}
- case Instruction::IndirectBr: {
- const IndirectBrInst *IBI = cast<IndirectBrInst>(I);
- Out << "IndirectBrInst *" << iName << " = IndirectBrInst::Create("
- << opNames[0] << ", " << IBI->getNumDestinations() << ");";
- nl(Out);
- for (unsigned i = 1; i != IBI->getNumOperands(); ++i) {
- Out << iName << "->addDestination(" << opNames[i] << ");";
- nl(Out);
- }
- break;
- }
case Instruction::Invoke: {
const InvokeInst* inv = cast<InvokeInst>(I);
Out << "std::vector<Value*> " << iName << "_params;";
Modified: llvm/branches/Apple/Leela/lib/Target/MSIL/MSILWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/MSIL/MSILWriter.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/MSIL/MSILWriter.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Target/MSIL/MSILWriter.cpp Mon Nov 2 13:33:53 2009
@@ -1535,7 +1535,7 @@
case Type::StructTyID:
for (unsigned I = 0, E = C->getNumOperands(); I<E; I++) {
if (I!=0) Out << ",\n";
- printStaticConstant(cast<Constant>(C->getOperand(I)), Offset);
+ printStaticConstant(C->getOperand(I),Offset);
}
break;
case Type::PointerTyID:
Modified: llvm/branches/Apple/Leela/lib/Target/TargetIntrinsicInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/TargetIntrinsicInfo.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/TargetIntrinsicInfo.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Target/TargetIntrinsicInfo.cpp Mon Nov 2 13:33:53 2009
@@ -12,19 +12,11 @@
//===----------------------------------------------------------------------===//
#include "llvm/Target/TargetIntrinsicInfo.h"
-#include "llvm/Function.h"
-#include "llvm/ADT/StringMap.h"
using namespace llvm;
-TargetIntrinsicInfo::TargetIntrinsicInfo() {
+TargetIntrinsicInfo::TargetIntrinsicInfo(const char **desc, unsigned count)
+ : Intrinsics(desc), NumIntrinsics(count) {
}
TargetIntrinsicInfo::~TargetIntrinsicInfo() {
}
-
-unsigned TargetIntrinsicInfo::getIntrinsicID(Function *F) const {
- const ValueName *ValName = F->getValueName();
- if (!ValName)
- return 0;
- return lookupName(ValName->getKeyData(), ValName->getKeyLength());
-}
Modified: llvm/branches/Apple/Leela/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp Mon Nov 2 13:33:53 2009
@@ -329,10 +329,6 @@
case MachineOperand::MO_ConstantPoolIndex:
MCOp = LowerSymbolOperand(MO, GetConstantPoolIndexSymbol(MO));
break;
- case MachineOperand::MO_BlockAddress:
- MCOp = LowerSymbolOperand(MO, AsmPrinter.GetBlockAddressSymbol(
- MO.getBlockAddress()));
- break;
}
OutMI.addOperand(MCOp);
Modified: llvm/branches/Apple/Leela/lib/Target/X86/X86ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Nov 2 13:33:53 2009
@@ -72,7 +72,6 @@
SDValue Segment;
GlobalValue *GV;
Constant *CP;
- BlockAddress *BlockAddr;
const char *ES;
int JT;
unsigned Align; // CP alignment.
@@ -80,12 +79,12 @@
X86ISelAddressMode()
: BaseType(RegBase), Scale(1), IndexReg(), Disp(0),
- Segment(), GV(0), CP(0), BlockAddr(0), ES(0), JT(-1), Align(0),
+ Segment(), GV(0), CP(0), ES(0), JT(-1), Align(0),
SymbolFlags(X86II::MO_NO_FLAG) {
}
bool hasSymbolicDisplacement() const {
- return GV != 0 || CP != 0 || ES != 0 || JT != -1 || BlockAddr != 0;
+ return GV != 0 || CP != 0 || ES != 0 || JT != -1;
}
bool hasBaseOrIndexReg() const {
@@ -243,9 +242,6 @@
Disp = CurDAG->getTargetExternalSymbol(AM.ES, MVT::i32, AM.SymbolFlags);
else if (AM.JT != -1)
Disp = CurDAG->getTargetJumpTable(AM.JT, MVT::i32, AM.SymbolFlags);
- else if (AM.BlockAddr)
- Disp = CurDAG->getBlockAddress(AM.BlockAddr, DebugLoc()/*MVT::i32*/,
- true /*AM.SymbolFlags*/);
else
Disp = CurDAG->getTargetConstant(AM.Disp, MVT::i32);
@@ -765,12 +761,10 @@
} else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(N0)) {
AM.ES = S->getSymbol();
AM.SymbolFlags = S->getTargetFlags();
- } else if (JumpTableSDNode *J = dyn_cast<JumpTableSDNode>(N0)) {
+ } else {
+ JumpTableSDNode *J = cast<JumpTableSDNode>(N0);
AM.JT = J->getIndex();
AM.SymbolFlags = J->getTargetFlags();
- } else {
- AM.BlockAddr = cast<BlockAddressSDNode>(N0)->getBlockAddress();
- //AM.SymbolFlags = cast<BlockAddressSDNode>(N0)->getTargetFlags();
}
if (N.getOpcode() == X86ISD::WrapperRIP)
@@ -796,12 +790,10 @@
} else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(N0)) {
AM.ES = S->getSymbol();
AM.SymbolFlags = S->getTargetFlags();
- } else if (JumpTableSDNode *J = dyn_cast<JumpTableSDNode>(N0)) {
+ } else {
+ JumpTableSDNode *J = cast<JumpTableSDNode>(N0);
AM.JT = J->getIndex();
AM.SymbolFlags = J->getTargetFlags();
- } else {
- AM.BlockAddr = cast<BlockAddressSDNode>(N0)->getBlockAddress();
- //AM.SymbolFlags = cast<BlockAddressSDNode>(N0)->getTargetFlags();
}
return false;
}
Modified: llvm/branches/Apple/Leela/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/X86/X86ISelLowering.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Target/X86/X86ISelLowering.cpp Mon Nov 2 13:33:53 2009
@@ -328,13 +328,11 @@
if (Subtarget->is64Bit())
setOperationAction(ISD::GlobalTLSAddress, MVT::i64, Custom);
setOperationAction(ISD::ExternalSymbol , MVT::i32 , Custom);
- setOperationAction(ISD::BlockAddress , MVT::i32 , Custom);
if (Subtarget->is64Bit()) {
setOperationAction(ISD::ConstantPool , MVT::i64 , Custom);
setOperationAction(ISD::JumpTable , MVT::i64 , Custom);
setOperationAction(ISD::GlobalAddress , MVT::i64 , Custom);
setOperationAction(ISD::ExternalSymbol, MVT::i64 , Custom);
- setOperationAction(ISD::BlockAddress , MVT::i64 , Custom);
}
// 64-bit addm sub, shl, sra, srl (iff 32-bit x86)
setOperationAction(ISD::SHL_PARTS , MVT::i32 , Custom);
@@ -4695,24 +4693,6 @@
}
SDValue
-X86TargetLowering::LowerBlockAddress(SDValue Op, SelectionDAG &DAG) {
- unsigned WrapperKind = X86ISD::Wrapper;
- CodeModel::Model M = getTargetMachine().getCodeModel();
- if (Subtarget->isPICStyleRIPRel() &&
- (M == CodeModel::Small || M == CodeModel::Kernel))
- WrapperKind = X86ISD::WrapperRIP;
-
- DebugLoc DL = Op.getDebugLoc();
-
- BlockAddress *BA = cast<BlockAddressSDNode>(Op)->getBlockAddress();
- SDValue Result = DAG.getBlockAddress(BA, DL, /*isTarget=*/true);
-
- Result = DAG.getNode(WrapperKind, DL, getPointerTy(), Result);
-
- return Result;
-}
-
-SDValue
X86TargetLowering::LowerGlobalAddress(const GlobalValue *GV, DebugLoc dl,
int64_t Offset,
SelectionDAG &DAG) const {
@@ -7039,7 +7019,6 @@
case ISD::GlobalAddress: return LowerGlobalAddress(Op, DAG);
case ISD::GlobalTLSAddress: return LowerGlobalTLSAddress(Op, DAG);
case ISD::ExternalSymbol: return LowerExternalSymbol(Op, DAG);
- case ISD::BlockAddress: return LowerBlockAddress(Op, DAG);
case ISD::SHL_PARTS:
case ISD::SRA_PARTS:
case ISD::SRL_PARTS: return LowerShift(Op, DAG);
Modified: llvm/branches/Apple/Leela/lib/Target/X86/X86ISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/X86/X86ISelLowering.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/X86/X86ISelLowering.h (original)
+++ llvm/branches/Apple/Leela/lib/Target/X86/X86ISelLowering.h Mon Nov 2 13:33:53 2009
@@ -635,7 +635,6 @@
SDValue LowerINSERT_VECTOR_ELT_SSE4(SDValue Op, SelectionDAG &DAG);
SDValue LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG);
SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG);
- SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG);
SDValue LowerGlobalAddress(const GlobalValue *GV, DebugLoc dl,
int64_t Offset, SelectionDAG &DAG) const;
SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG);
Modified: llvm/branches/Apple/Leela/lib/Target/X86/X86Instr64bit.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/X86/X86Instr64bit.td?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/X86/X86Instr64bit.td (original)
+++ llvm/branches/Apple/Leela/lib/Target/X86/X86Instr64bit.td Mon Nov 2 13:33:53 2009
@@ -1602,8 +1602,6 @@
(MOV64ri tglobaladdr :$dst)>, Requires<[FarData]>;
def : Pat<(i64 (X86Wrapper texternalsym:$dst)),
(MOV64ri texternalsym:$dst)>, Requires<[FarData]>;
-def : Pat<(i64 (X86Wrapper tblockaddress:$dst)),
- (MOV64ri tblockaddress:$dst)>, Requires<[FarData]>;
// In static codegen with small code model, we can get the address of a label
// into a register with 'movl'. FIXME: This is a hack, the 'imm' predicate of
@@ -1616,8 +1614,6 @@
(MOV64ri64i32 tglobaladdr :$dst)>, Requires<[SmallCode]>;
def : Pat<(i64 (X86Wrapper texternalsym:$dst)),
(MOV64ri64i32 texternalsym:$dst)>, Requires<[SmallCode]>;
-def : Pat<(i64 (X86Wrapper tblockaddress:$dst)),
- (MOV64ri64i32 tblockaddress:$dst)>, Requires<[SmallCode]>;
// In kernel code model, we can get the address of a label
// into a register with 'movq'. FIXME: This is a hack, the 'imm' predicate of
@@ -1630,8 +1626,6 @@
(MOV64ri32 tglobaladdr :$dst)>, Requires<[KernelCode]>;
def : Pat<(i64 (X86Wrapper texternalsym:$dst)),
(MOV64ri32 texternalsym:$dst)>, Requires<[KernelCode]>;
-def : Pat<(i64 (X86Wrapper tblockaddress:$dst)),
- (MOV64ri32 tblockaddress:$dst)>, Requires<[KernelCode]>;
// If we have small model and -static mode, it is safe to store global addresses
// directly as immediates. FIXME: This is really a hack, the 'imm' predicate
@@ -1648,9 +1642,6 @@
def : Pat<(store (i64 (X86Wrapper texternalsym:$src)), addr:$dst),
(MOV64mi32 addr:$dst, texternalsym:$src)>,
Requires<[NearData, IsStatic]>;
-def : Pat<(store (i64 (X86Wrapper tblockaddress:$src)), addr:$dst),
- (MOV64mi32 addr:$dst, tblockaddress:$src)>,
- Requires<[NearData, IsStatic]>;
// Calls
// Direct PC relative function call for small code model. 32-bit displacement
Modified: llvm/branches/Apple/Leela/lib/Target/X86/X86InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/X86/X86InstrInfo.td?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/X86/X86InstrInfo.td (original)
+++ llvm/branches/Apple/Leela/lib/Target/X86/X86InstrInfo.td Mon Nov 2 13:33:53 2009
@@ -3794,7 +3794,6 @@
def : Pat<(i32 (X86Wrapper tglobaltlsaddr:$dst)),(MOV32ri tglobaltlsaddr:$dst)>;
def : Pat<(i32 (X86Wrapper tglobaladdr :$dst)), (MOV32ri tglobaladdr :$dst)>;
def : Pat<(i32 (X86Wrapper texternalsym:$dst)), (MOV32ri texternalsym:$dst)>;
-def : Pat<(i32 (X86Wrapper tblockaddress:$dst)), (MOV32ri tblockaddress:$dst)>;
def : Pat<(add GR32:$src1, (X86Wrapper tconstpool:$src2)),
(ADD32ri GR32:$src1, tconstpool:$src2)>;
@@ -3804,15 +3803,11 @@
(ADD32ri GR32:$src1, tglobaladdr:$src2)>;
def : Pat<(add GR32:$src1, (X86Wrapper texternalsym:$src2)),
(ADD32ri GR32:$src1, texternalsym:$src2)>;
-def : Pat<(add GR32:$src1, (X86Wrapper tblockaddress:$src2)),
- (ADD32ri GR32:$src1, tblockaddress:$src2)>;
def : Pat<(store (i32 (X86Wrapper tglobaladdr:$src)), addr:$dst),
(MOV32mi addr:$dst, tglobaladdr:$src)>;
def : Pat<(store (i32 (X86Wrapper texternalsym:$src)), addr:$dst),
(MOV32mi addr:$dst, texternalsym:$src)>;
-def : Pat<(store (i32 (X86Wrapper tblockaddress:$src)), addr:$dst),
- (MOV32mi addr:$dst, tblockaddress:$src)>;
// Calls
// tailcall stuff
Modified: llvm/branches/Apple/Leela/lib/Transforms/IPO/GlobalDCE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/IPO/GlobalDCE.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/IPO/GlobalDCE.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/IPO/GlobalDCE.cpp Mon Nov 2 13:33:53 2009
@@ -192,13 +192,13 @@
void GlobalDCE::MarkUsedGlobalsAsNeeded(Constant *C) {
if (GlobalValue *GV = dyn_cast<GlobalValue>(C))
- return GlobalIsNeeded(GV);
-
- // Loop over all of the operands of the constant, adding any globals they
- // use to the list of needed globals.
- for (User::op_iterator I = C->op_begin(), E = C->op_end(); I != E; ++I)
- if (Constant *OpC = dyn_cast<Constant>(*I))
- MarkUsedGlobalsAsNeeded(OpC);
+ GlobalIsNeeded(GV);
+ else {
+ // Loop over all of the operands of the constant, adding any globals they
+ // use to the list of needed globals.
+ for (User::op_iterator I = C->op_begin(), E = C->op_end(); I != E; ++I)
+ MarkUsedGlobalsAsNeeded(cast<Constant>(*I));
+ }
}
// RemoveUnusedGlobalValue - Loop over all of the uses of the specified
Modified: llvm/branches/Apple/Leela/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/IPO/GlobalOpt.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/IPO/GlobalOpt.cpp Mon Nov 2 13:33:53 2009
@@ -2734,12 +2734,6 @@
dyn_cast<ConstantInt>(getVal(Values, SI->getCondition()));
if (!Val) return false; // Cannot determine.
NewBB = SI->getSuccessor(SI->findCaseValue(Val));
- } else if (IndirectBrInst *IBI = dyn_cast<IndirectBrInst>(CurInst)) {
- Value *Val = getVal(Values, IBI->getAddress())->stripPointerCasts();
- if (BlockAddress *BA = dyn_cast<BlockAddress>(Val))
- NewBB = BA->getBasicBlock();
- else
- return false; // Cannot determine.
} else if (ReturnInst *RI = dyn_cast<ReturnInst>(CurInst)) {
if (RI->getNumOperands())
RetVal = getVal(Values, RI->getOperand(0));
Modified: llvm/branches/Apple/Leela/lib/Transforms/IPO/InlineAlways.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/IPO/InlineAlways.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/IPO/InlineAlways.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/IPO/InlineAlways.cpp Mon Nov 2 13:33:53 2009
@@ -19,11 +19,11 @@
#include "llvm/Module.h"
#include "llvm/Type.h"
#include "llvm/Analysis/CallGraph.h"
-#include "llvm/Analysis/InlineCost.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/IPO/InlinerPass.h"
+#include "llvm/Transforms/Utils/InlineCost.h"
#include "llvm/ADT/SmallPtrSet.h"
using namespace llvm;
Modified: llvm/branches/Apple/Leela/lib/Transforms/IPO/InlineSimple.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/IPO/InlineSimple.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/IPO/InlineSimple.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/IPO/InlineSimple.cpp Mon Nov 2 13:33:53 2009
@@ -18,11 +18,11 @@
#include "llvm/Module.h"
#include "llvm/Type.h"
#include "llvm/Analysis/CallGraph.h"
-#include "llvm/Analysis/InlineCost.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/IPO/InlinerPass.h"
+#include "llvm/Transforms/Utils/InlineCost.h"
#include "llvm/ADT/SmallPtrSet.h"
using namespace llvm;
Modified: llvm/branches/Apple/Leela/lib/Transforms/IPO/Inliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/IPO/Inliner.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/IPO/Inliner.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/IPO/Inliner.cpp Mon Nov 2 13:33:53 2009
@@ -18,10 +18,10 @@
#include "llvm/Instructions.h"
#include "llvm/IntrinsicInst.h"
#include "llvm/Analysis/CallGraph.h"
-#include "llvm/Analysis/InlineCost.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Transforms/IPO/InlinerPass.h"
+#include "llvm/Transforms/Utils/InlineCost.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
Modified: llvm/branches/Apple/Leela/lib/Transforms/IPO/StripSymbols.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/IPO/StripSymbols.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/IPO/StripSymbols.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/IPO/StripSymbols.cpp Mon Nov 2 13:33:53 2009
@@ -112,11 +112,11 @@
static void RemoveDeadConstant(Constant *C) {
assert(C->use_empty() && "Constant is not dead!");
- SmallPtrSet<Constant*, 4> Operands;
+ SmallPtrSet<Constant *, 4> Operands;
for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i)
if (isa<DerivedType>(C->getOperand(i)->getType()) &&
OnlyUsedBy(C->getOperand(i), C))
- Operands.insert(cast<Constant>(C->getOperand(i)));
+ Operands.insert(C->getOperand(i));
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(C)) {
if (!GV->hasLocalLinkage()) return; // Don't delete non static globals.
GV->eraseFromParent();
@@ -126,7 +126,7 @@
C->destroyConstant();
// If the constant referenced anything, see if we can delete it as well.
- for (SmallPtrSet<Constant*, 4>::iterator OI = Operands.begin(),
+ for (SmallPtrSet<Constant *, 4>::iterator OI = Operands.begin(),
OE = Operands.end(); OI != OE; ++OI)
RemoveDeadConstant(*OI);
}
@@ -305,7 +305,8 @@
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(C)) {
if (GV->hasLocalLinkage())
RemoveDeadConstant(GV);
- } else
+ }
+ else
RemoveDeadConstant(C);
}
Modified: llvm/branches/Apple/Leela/lib/Transforms/Scalar/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/Scalar/CodeGenPrepare.cpp Mon Nov 2 13:33:53 2009
@@ -318,7 +318,6 @@
if (Invoke->getSuccessor(1) == Dest)
return;
}
-
// As a hack, never split backedges of loops. Even though the copy for any
// PHIs inserted on the backedge would be dead for exits from the loop, we
@@ -853,7 +852,7 @@
// Split all critical edges where the dest block has a PHI.
TerminatorInst *BBTI = BB.getTerminator();
- if (BBTI->getNumSuccessors() > 1 && !isa<IndirectBrInst>(BBTI)) {
+ if (BBTI->getNumSuccessors() > 1) {
for (unsigned i = 0, e = BBTI->getNumSuccessors(); i != e; ++i) {
BasicBlock *SuccBB = BBTI->getSuccessor(i);
if (isa<PHINode>(SuccBB->begin()) && isCriticalEdge(BBTI, i, true))
Modified: llvm/branches/Apple/Leela/lib/Transforms/Scalar/CondPropagate.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/Scalar/CondPropagate.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/Scalar/CondPropagate.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/Scalar/CondPropagate.cpp Mon Nov 2 13:33:53 2009
@@ -196,20 +196,18 @@
// possible, and to avoid invalidating "i".
for (unsigned i = PN->getNumIncomingValues(); i != 0; --i)
if (ConstantInt *CI = dyn_cast<ConstantInt>(PN->getIncomingValue(i-1))) {
- BasicBlock *PredBB = PN->getIncomingBlock(i-1);
- if (isa<BranchInst>(PredBB->getTerminator())) {
- // If we have a constant, forward the edge from its current to its
- // ultimate destination.
- unsigned DestCase = SI->findCaseValue(CI);
- RevectorBlockTo(PredBB, SI->getSuccessor(DestCase));
- ++NumSwThread;
-
- // If there were two predecessors before this simplification, or if the
- // PHI node contained all the same value except for the one we just
- // substituted, the PHI node may be deleted. Don't iterate through it the
- // last time.
- if (SI->getCondition() != PN) return;
- }
+ // If we have a constant, forward the edge from its current to its
+ // ultimate destination.
+ unsigned DestCase = SI->findCaseValue(CI);
+ RevectorBlockTo(PN->getIncomingBlock(i-1),
+ SI->getSuccessor(DestCase));
+ ++NumSwThread;
+
+ // If there were two predecessors before this simplification, or if the
+ // PHI node contained all the same value except for the one we just
+ // substituted, the PHI node may be deleted. Don't iterate through it the
+ // last time.
+ if (SI->getCondition() != PN) return;
}
}
Modified: llvm/branches/Apple/Leela/lib/Transforms/Scalar/GVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/Scalar/GVN.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/Scalar/GVN.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/Scalar/GVN.cpp Mon Nov 2 13:33:53 2009
@@ -1809,7 +1809,7 @@
/// performPRE - Perform a purely local form of PRE that looks for diamond
/// control flow patterns and attempts to perform simple PRE at the join point.
-bool GVN::performPRE(Function &F) {
+bool GVN::performPRE(Function& F) {
bool Changed = false;
SmallVector<std::pair<TerminatorInst*, unsigned>, 4> toSplit;
DenseMap<BasicBlock*, Value*> predMap;
@@ -1874,10 +1874,6 @@
// we would need to insert instructions in more than one pred.
if (NumWithout != 1 || NumWith == 0)
continue;
-
- // Don't do PRE across indirect branch.
- if (isa<IndirectBrInst>(PREPred->getTerminator()))
- continue;
// We can't do PRE safely on a critical edge, so instead we schedule
// the edge to be split and perform the PRE the next time we iterate
Modified: llvm/branches/Apple/Leela/lib/Transforms/Scalar/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/Scalar/IndVarSimplify.cpp Mon Nov 2 13:33:53 2009
@@ -292,7 +292,7 @@
if (NumPreds != 1) {
// Clone the PHI and delete the original one. This lets IVUsers and
// any other maps purge the original user from their records.
- PHINode *NewPN = cast<PHINode>(PN->clone());
+ PHINode *NewPN = PN->clone();
NewPN->takeName(PN);
NewPN->insertBefore(PN);
PN->replaceAllUsesWith(NewPN);
Modified: llvm/branches/Apple/Leela/lib/Transforms/Scalar/LoopUnswitch.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/Scalar/LoopUnswitch.cpp Mon Nov 2 13:33:53 2009
@@ -34,7 +34,6 @@
#include "llvm/Instructions.h"
#include "llvm/LLVMContext.h"
#include "llvm/Analysis/ConstantFolding.h"
-#include "llvm/Analysis/InlineCost.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/Dominators.h"
@@ -57,11 +56,9 @@
STATISTIC(NumTrivial , "Number of unswitches that are trivial");
STATISTIC(NumSimplify, "Number of simplifications of unswitched code");
-// The specific value of 50 here was chosen based only on intuition and a
-// few specific examples.
static cl::opt<unsigned>
Threshold("loop-unswitch-threshold", cl::desc("Max loop size to unswitch"),
- cl::init(50), cl::Hidden);
+ cl::init(10), cl::Hidden);
namespace {
class LoopUnswitch : public LoopPass {
@@ -138,6 +135,7 @@
void SplitExitEdges(Loop *L, const SmallVector<BasicBlock *, 8> &ExitBlocks);
bool UnswitchIfProfitable(Value *LoopCond, Constant *Val);
+ unsigned getLoopUnswitchCost(Value *LIC);
void UnswitchTrivialCondition(Loop *L, Value *Cond, Constant *Val,
BasicBlock *ExitBlock);
void UnswitchNontrivialCondition(Value *LIC, Constant *OnVal, Loop *L);
@@ -399,6 +397,40 @@
return true;
}
+/// getLoopUnswitchCost - Return the cost (code size growth) that will happen if
+/// we choose to unswitch current loop on the specified value.
+///
+unsigned LoopUnswitch::getLoopUnswitchCost(Value *LIC) {
+ // If the condition is trivial, always unswitch. There is no code growth for
+ // this case.
+ if (IsTrivialUnswitchCondition(LIC))
+ return 0;
+
+ // FIXME: This is really overly conservative. However, more liberal
+ // estimations have thus far resulted in excessive unswitching, which is bad
+ // both in compile time and in code size. This should be replaced once
+ // someone figures out how a good estimation.
+ return currentLoop->getBlocks().size();
+
+ unsigned Cost = 0;
+ // FIXME: this is brain dead. It should take into consideration code
+ // shrinkage.
+ for (Loop::block_iterator I = currentLoop->block_begin(),
+ E = currentLoop->block_end();
+ I != E; ++I) {
+ BasicBlock *BB = *I;
+ // Do not include empty blocks in the cost calculation. This happen due to
+ // loop canonicalization and will be removed.
+ if (BB->begin() == BasicBlock::iterator(BB->getTerminator()))
+ continue;
+
+ // Count basic blocks.
+ ++Cost;
+ }
+
+ return Cost;
+}
+
/// UnswitchIfProfitable - We have found that we can unswitch currentLoop when
/// LoopCond == Val to simplify the loop. If we decide that this is profitable,
/// unswitch the loop, reprocess the pieces, then return true.
@@ -407,36 +439,24 @@
initLoopData();
Function *F = loopHeader->getParent();
- // If the condition is trivial, always unswitch. There is no code growth for
- // this case.
- if (!IsTrivialUnswitchCondition(LoopCond)) {
- // Check to see if it would be profitable to unswitch current loop.
- // Do not do non-trivial unswitch while optimizing for size.
- if (OptimizeForSize || F->hasFnAttr(Attribute::OptimizeForSize))
- return false;
+ // Check to see if it would be profitable to unswitch current loop.
+ unsigned Cost = getLoopUnswitchCost(LoopCond);
- // FIXME: This is overly conservative because it does not take into
- // consideration code simplification opportunities and code that can
- // be shared by the resultant unswitched loops.
- CodeMetrics Metrics;
- for (Loop::block_iterator I = currentLoop->block_begin(),
- E = currentLoop->block_end();
- I != E; ++I)
- Metrics.analyzeBasicBlock(*I);
-
- // Limit the number of instructions to avoid causing significant code
- // expansion, and the number of basic blocks, to avoid loops with
- // large numbers of branches which cause loop unswitching to go crazy.
- // This is a very ad-hoc heuristic.
- if (Metrics.NumInsts > Threshold ||
- Metrics.NumBlocks * 5 > Threshold ||
- Metrics.NeverInline) {
- DEBUG(errs() << "NOT unswitching loop %"
- << currentLoop->getHeader()->getName() << ", cost too high: "
- << currentLoop->getBlocks().size() << "\n");
- return false;
- }
+ // Do not do non-trivial unswitch while optimizing for size.
+ if (Cost && OptimizeForSize)
+ return false;
+ if (Cost && !F->isDeclaration() && F->hasFnAttr(Attribute::OptimizeForSize))
+ return false;
+
+ if (Cost > Threshold) {
+ // FIXME: this should estimate growth by the amount of code shared by the
+ // resultant unswitched loops.
+ //
+ DEBUG(errs() << "NOT unswitching loop %"
+ << currentLoop->getHeader()->getName() << ", cost too high: "
+ << currentLoop->getBlocks().size() << "\n");
+ return false;
}
Constant *CondVal;
@@ -775,7 +795,7 @@
// uses replaced with undefs.
// If I is not void type then replaceAllUsesWith undef.
// This allows ValueHandlers and custom metadata to adjust itself.
- if (!I->getType()->isVoidTy())
+ if (I->getType() != Type::getVoidTy(I->getContext()))
I->replaceAllUsesWith(UndefValue::get(I->getType()));
}
Modified: llvm/branches/Apple/Leela/lib/Transforms/Scalar/SCCP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/Scalar/SCCP.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/Scalar/SCCP.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/Scalar/SCCP.cpp Mon Nov 2 13:33:53 2009
@@ -446,16 +446,10 @@
Succs[BCValue.getConstant() == ConstantInt::getFalse(*Context)] = true;
}
}
- return;
- }
-
- if (isa<InvokeInst>(&TI)) {
+ } else if (isa<InvokeInst>(&TI)) {
// Invoke instructions successors are always executable.
Succs[0] = Succs[1] = true;
- return;
- }
-
- if (SwitchInst *SI = dyn_cast<SwitchInst>(&TI)) {
+ } else if (SwitchInst *SI = dyn_cast<SwitchInst>(&TI)) {
LatticeVal &SCValue = getValueState(SI->getCondition());
if (SCValue.isOverdefined() || // Overdefined condition?
(SCValue.isConstant() && !isa<ConstantInt>(SCValue.getConstant()))) {
@@ -463,20 +457,9 @@
Succs.assign(TI.getNumSuccessors(), true);
} else if (SCValue.isConstant())
Succs[SI->findCaseValue(cast<ConstantInt>(SCValue.getConstant()))] = true;
- return;
- }
-
- // TODO: This could be improved if the operand is a [cast of a] BlockAddress.
- if (isa<IndirectBrInst>(&TI)) {
- // Just mark all destinations executable!
- Succs.assign(TI.getNumSuccessors(), true);
- return;
+ } else {
+ llvm_unreachable("SCCP: Don't know how to handle this terminator!");
}
-
-#ifndef NDEBUG
- errs() << "Unknown terminator instruction: " << TI << '\n';
-#endif
- llvm_unreachable("SCCP: Don't know how to handle this terminator!");
}
@@ -494,27 +477,25 @@
if (BranchInst *BI = dyn_cast<BranchInst>(TI)) {
if (BI->isUnconditional())
return true;
-
- LatticeVal &BCValue = getValueState(BI->getCondition());
- if (BCValue.isOverdefined()) {
- // Overdefined condition variables mean the branch could go either way.
- return true;
- } else if (BCValue.isConstant()) {
- // Not branching on an evaluatable constant?
- if (!isa<ConstantInt>(BCValue.getConstant())) return true;
-
- // Constant condition variables mean the branch can only go a single way
- return BI->getSuccessor(BCValue.getConstant() ==
- ConstantInt::getFalse(*Context)) == To;
+ else {
+ LatticeVal &BCValue = getValueState(BI->getCondition());
+ if (BCValue.isOverdefined()) {
+ // Overdefined condition variables mean the branch could go either way.
+ return true;
+ } else if (BCValue.isConstant()) {
+ // Not branching on an evaluatable constant?
+ if (!isa<ConstantInt>(BCValue.getConstant())) return true;
+
+ // Constant condition variables mean the branch can only go a single way
+ return BI->getSuccessor(BCValue.getConstant() ==
+ ConstantInt::getFalse(*Context)) == To;
+ }
+ return false;
}
- return false;
- }
-
- // Invoke instructions successors are always executable.
- if (isa<InvokeInst>(TI))
+ } else if (isa<InvokeInst>(TI)) {
+ // Invoke instructions successors are always executable.
return true;
-
- if (SwitchInst *SI = dyn_cast<SwitchInst>(TI)) {
+ } else if (SwitchInst *SI = dyn_cast<SwitchInst>(TI)) {
LatticeVal &SCValue = getValueState(SI->getCondition());
if (SCValue.isOverdefined()) { // Overdefined condition?
// All destinations are executable!
@@ -534,17 +515,12 @@
return SI->getDefaultDest() == To;
}
return false;
- }
-
- // Just mark all destinations executable!
- // TODO: This could be improved if the operand is a [cast of a] BlockAddress.
- if (isa<IndirectBrInst>(&TI))
- return true;
-
+ } else {
#ifndef NDEBUG
- errs() << "Unknown terminator instruction: " << *TI << '\n';
+ errs() << "Unknown terminator instruction: " << *TI << '\n';
#endif
- llvm_unreachable(0);
+ llvm_unreachable(0);
+ }
}
// visit Implementations - Something changed in this instruction... Either an
Modified: llvm/branches/Apple/Leela/lib/Transforms/Utils/BasicBlockUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/Utils/BasicBlockUtils.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/Utils/BasicBlockUtils.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/Utils/BasicBlockUtils.cpp Mon Nov 2 13:33:53 2009
@@ -97,14 +97,10 @@
/// MergeBlockIntoPredecessor - Attempts to merge a block into its predecessor,
/// if possible. The return value indicates success or failure.
-bool llvm::MergeBlockIntoPredecessor(BasicBlock *BB, Pass *P) {
+bool llvm::MergeBlockIntoPredecessor(BasicBlock* BB, Pass* P) {
pred_iterator PI(pred_begin(BB)), PE(pred_end(BB));
- // Can't merge the entry block. Don't merge away blocks who have their
- // address taken: this is a bug if the predecessor block is the entry node
- // (because we'd end up taking the address of the entry) and undesirable in
- // any case.
- if (pred_begin(BB) == pred_end(BB) ||
- BB->hasAddressTaken()) return false;
+ // Can't merge the entry block.
+ if (pred_begin(BB) == pred_end(BB)) return false;
BasicBlock *PredBB = *PI++;
for (; PI != PE; ++PI) // Search all predecessors, see if they are all same
@@ -278,8 +274,6 @@
/// SplitEdge - Split the edge connecting specified block. Pass P must
/// not be NULL.
BasicBlock *llvm::SplitEdge(BasicBlock *BB, BasicBlock *Succ, Pass *P) {
- assert(!isa<IndirectBrInst>(BB->getTerminator()) &&
- "Cannot split an edge from an IndirectBrInst");
TerminatorInst *LatchTerm = BB->getTerminator();
unsigned SuccNum = 0;
#ifndef NDEBUG
@@ -669,7 +663,7 @@
if (I != I->getParent()->begin()) {
BasicBlock::iterator BBI = I; --BBI;
if (DbgStopPointInst *DSPI = dyn_cast<DbgStopPointInst>(BBI)) {
- CallInst *newDSPI = cast<CallInst>(DSPI->clone());
+ CallInst *newDSPI = DSPI->clone();
newDSPI->insertBefore(InsertPos);
}
}
Modified: llvm/branches/Apple/Leela/lib/Transforms/Utils/BreakCriticalEdges.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/Utils/BreakCriticalEdges.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/Utils/BreakCriticalEdges.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/Utils/BreakCriticalEdges.cpp Mon Nov 2 13:33:53 2009
@@ -70,7 +70,7 @@
bool Changed = false;
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
TerminatorInst *TI = I->getTerminator();
- if (TI->getNumSuccessors() > 1 && !isa<IndirectBrInst>(TI))
+ if (TI->getNumSuccessors() > 1)
for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i)
if (SplitCriticalEdge(TI, i, this)) {
++NumBroken;
@@ -151,29 +151,14 @@
/// SplitCriticalEdge - If this edge is a critical edge, insert a new node to
/// split the critical edge. This will update DominatorTree and
-/// DominatorFrontier information if it is available, thus calling this pass
-/// will not invalidate either of them. This returns the new block if the edge
-/// was split, null otherwise.
-///
-/// If MergeIdenticalEdges is true (not the default), *all* edges from TI to the
-/// specified successor will be merged into the same critical edge block.
-/// This is most commonly interesting with switch instructions, which may
-/// have many edges to any one destination. This ensures that all edges to that
-/// dest go to one block instead of each going to a different block, but isn't
-/// the standard definition of a "critical edge".
-///
-/// It is invalid to call this function on a critical edge that starts at an
-/// IndirectBrInst. Splitting these edges will almost always create an invalid
-/// program because the address of the new block won't be the one that is jumped
-/// to.
-///
+/// DominatorFrontier information if it is available, thus calling this pass
+/// will not invalidate any of them. This returns true if the edge was split,
+/// false otherwise. This ensures that all edges to that dest go to one block
+/// instead of each going to a different block.
+//
BasicBlock *llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
Pass *P, bool MergeIdenticalEdges) {
if (!isCriticalEdge(TI, SuccNum, MergeIdenticalEdges)) return 0;
-
- assert(!isa<IndirectBrInst>(TI) &&
- "Cannot split critical edge from IndirectBrInst");
-
BasicBlock *TIBB = TI->getParent();
BasicBlock *DestBB = TI->getSuccessor(SuccNum);
Modified: llvm/branches/Apple/Leela/lib/Transforms/Utils/CloneFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/Utils/CloneFunction.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/Utils/CloneFunction.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/Utils/CloneFunction.cpp Mon Nov 2 13:33:53 2009
@@ -20,7 +20,9 @@
#include "llvm/IntrinsicInst.h"
#include "llvm/GlobalVariable.h"
#include "llvm/Function.h"
+#include "llvm/LLVMContext.h"
#include "llvm/Support/CFG.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/DebugInfo.h"
@@ -174,7 +176,7 @@
namespace {
/// PruningFunctionCloner - This class is a private class used to implement
/// the CloneAndPruneFunctionInto method.
- struct PruningFunctionCloner {
+ struct VISIBILITY_HIDDEN PruningFunctionCloner {
Function *NewFunc;
const Function *OldFunc;
DenseMap<const Value*, Value*> &ValueMap;
@@ -327,7 +329,8 @@
SmallVector<Constant*, 8> Ops;
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
if (Constant *Op = dyn_cast_or_null<Constant>(MapValue(I->getOperand(i),
- ValueMap)))
+ ValueMap,
+ Context)))
Ops.push_back(Op);
else
return 0; // All operands not constant!
@@ -363,6 +366,7 @@
ClonedCodeInfo *CodeInfo,
const TargetData *TD) {
assert(NameSuffix && "NameSuffix cannot be null!");
+ LLVMContext &Context = OldFunc->getContext();
#ifndef NDEBUG
for (Function::const_arg_iterator II = OldFunc->arg_begin(),
@@ -433,7 +437,7 @@
if (BasicBlock *MappedBlock =
cast_or_null<BasicBlock>(ValueMap[PN->getIncomingBlock(pred)])) {
Value *InVal = MapValue(PN->getIncomingValue(pred),
- ValueMap);
+ ValueMap, Context);
assert(InVal && "Unknown input value?");
PN->setIncomingValue(pred, InVal);
PN->setIncomingBlock(pred, MappedBlock);
Modified: llvm/branches/Apple/Leela/lib/Transforms/Utils/CloneModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/Utils/CloneModule.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/Utils/CloneModule.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/Utils/CloneModule.cpp Mon Nov 2 13:33:53 2009
@@ -89,7 +89,8 @@
GlobalVariable *GV = cast<GlobalVariable>(ValueMap[I]);
if (I->hasInitializer())
GV->setInitializer(cast<Constant>(MapValue(I->getInitializer(),
- ValueMap)));
+ ValueMap,
+ M->getContext())));
GV->setLinkage(I->getLinkage());
GV->setThreadLocal(I->isThreadLocal());
GV->setConstant(I->isConstant());
@@ -120,7 +121,7 @@
GlobalAlias *GA = cast<GlobalAlias>(ValueMap[I]);
GA->setLinkage(I->getLinkage());
if (const Constant* C = I->getAliasee())
- GA->setAliasee(cast<Constant>(MapValue(C, ValueMap)));
+ GA->setAliasee(cast<Constant>(MapValue(C, ValueMap, M->getContext())));
}
return New;
Modified: llvm/branches/Apple/Leela/lib/Transforms/Utils/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/Utils/Local.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/Utils/Local.cpp Mon Nov 2 13:33:53 2009
@@ -110,9 +110,7 @@
// unconditional branch.
BI->setUnconditionalDest(Destination);
return true;
- }
-
- if (Dest2 == Dest1) { // Conditional branch to same location?
+ } else if (Dest2 == Dest1) { // Conditional branch to same location?
// This branch matches something like this:
// br bool %cond, label %Dest, label %Dest
// and changes it into: br label %Dest
@@ -125,10 +123,7 @@
BI->setUnconditionalDest(Dest1);
return true;
}
- return false;
- }
-
- if (SwitchInst *SI = dyn_cast<SwitchInst>(T)) {
+ } else if (SwitchInst *SI = dyn_cast<SwitchInst>(T)) {
// If we are switching on a constant, we can convert the switch into a
// single branch instruction!
ConstantInt *CI = dyn_cast<ConstantInt>(SI->getCondition());
@@ -137,7 +132,7 @@
assert(TheOnlyDest == SI->getDefaultDest() &&
"Default destination is not successor #0?");
- // Figure out which case it goes to.
+ // Figure out which case it goes to...
for (unsigned i = 1, e = SI->getNumSuccessors(); i != e; ++i) {
// Found case matching a constant operand?
if (SI->getSuccessorValue(i) == CI) {
@@ -148,7 +143,7 @@
// Check to see if this branch is going to the same place as the default
// dest. If so, eliminate it as an explicit compare.
if (SI->getSuccessor(i) == DefaultDest) {
- // Remove this entry.
+ // Remove this entry...
DefaultDest->removePredecessor(SI->getParent());
SI->removeCase(i);
--i; --e; // Don't skip an entry...
@@ -170,7 +165,7 @@
// If we found a single destination that we can fold the switch into, do so
// now.
if (TheOnlyDest) {
- // Insert the new branch.
+ // Insert the new branch..
BranchInst::Create(TheOnlyDest, SI);
BasicBlock *BB = SI->getParent();
@@ -184,54 +179,22 @@
Succ->removePredecessor(BB);
}
- // Delete the old switch.
+ // Delete the old switch...
BB->getInstList().erase(SI);
return true;
- }
-
- if (SI->getNumSuccessors() == 2) {
+ } else if (SI->getNumSuccessors() == 2) {
// Otherwise, we can fold this switch into a conditional branch
// instruction if it has only one non-default destination.
Value *Cond = new ICmpInst(SI, ICmpInst::ICMP_EQ, SI->getCondition(),
SI->getSuccessorValue(1), "cond");
- // Insert the new branch.
+ // Insert the new branch...
BranchInst::Create(SI->getSuccessor(1), SI->getSuccessor(0), Cond, SI);
- // Delete the old switch.
+ // Delete the old switch...
SI->eraseFromParent();
return true;
}
- return false;
}
-
- if (IndirectBrInst *IBI = dyn_cast<IndirectBrInst>(T)) {
- // indirectbr blockaddress(@F, @BB) -> br label @BB
- if (BlockAddress *BA =
- dyn_cast<BlockAddress>(IBI->getAddress()->stripPointerCasts())) {
- BasicBlock *TheOnlyDest = BA->getBasicBlock();
- // Insert the new branch.
- BranchInst::Create(TheOnlyDest, IBI);
-
- for (unsigned i = 0, e = IBI->getNumDestinations(); i != e; ++i) {
- if (IBI->getDestination(i) == TheOnlyDest)
- TheOnlyDest = 0;
- else
- IBI->getDestination(i)->removePredecessor(IBI->getParent());
- }
- IBI->eraseFromParent();
-
- // If we didn't find our destination in the IBI successor list, then we
- // have undefined behavior. Replace the unconditional branch with an
- // 'unreachable' instruction.
- if (TheOnlyDest) {
- BB->getTerminator()->eraseFromParent();
- new UnreachableInst(BB->getContext(), BB);
- }
-
- return true;
- }
- }
-
return false;
}
Modified: llvm/branches/Apple/Leela/lib/Transforms/Utils/ValueMapper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Transforms/Utils/ValueMapper.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/Transforms/Utils/ValueMapper.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Transforms/Utils/ValueMapper.cpp Mon Nov 2 13:33:53 2009
@@ -13,15 +13,18 @@
//===----------------------------------------------------------------------===//
#include "llvm/Transforms/Utils/ValueMapper.h"
+#include "llvm/BasicBlock.h"
#include "llvm/DerivedTypes.h" // For getNullValue(Type::Int32Ty)
#include "llvm/Constants.h"
-#include "llvm/Function.h"
+#include "llvm/GlobalValue.h"
+#include "llvm/Instruction.h"
+#include "llvm/LLVMContext.h"
#include "llvm/Metadata.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/ErrorHandling.h"
using namespace llvm;
-Value *llvm::MapValue(const Value *V, ValueMapTy &VM) {
+Value *llvm::MapValue(const Value *V, ValueMapTy &VM, LLVMContext &Context) {
Value *&VMSlot = VM[V];
if (VMSlot) return VMSlot; // Does it exist in the map yet?
@@ -33,91 +36,80 @@
if (isa<GlobalValue>(V) || isa<InlineAsm>(V) || isa<MetadataBase>(V))
return VMSlot = const_cast<Value*>(V);
- Constant *C = const_cast<Constant*>(dyn_cast<Constant>(V));
- if (C == 0) return 0;
-
- if (isa<ConstantInt>(C) || isa<ConstantFP>(C) ||
- isa<ConstantPointerNull>(C) || isa<ConstantAggregateZero>(C) ||
- isa<UndefValue>(C) || isa<MDString>(C))
- return VMSlot = C; // Primitive constants map directly
-
- if (ConstantArray *CA = dyn_cast<ConstantArray>(C)) {
- for (User::op_iterator b = CA->op_begin(), i = b, e = CA->op_end();
- i != e; ++i) {
- Value *MV = MapValue(*i, VM);
- if (MV != *i) {
- // This array must contain a reference to a global, make a new array
- // and return it.
- //
- std::vector<Constant*> Values;
- Values.reserve(CA->getNumOperands());
- for (User::op_iterator j = b; j != i; ++j)
- Values.push_back(cast<Constant>(*j));
- Values.push_back(cast<Constant>(MV));
- for (++i; i != e; ++i)
- Values.push_back(cast<Constant>(MapValue(*i, VM)));
- return VM[V] = ConstantArray::get(CA->getType(), Values);
+ if (Constant *C = const_cast<Constant*>(dyn_cast<Constant>(V))) {
+ if (isa<ConstantInt>(C) || isa<ConstantFP>(C) ||
+ isa<ConstantPointerNull>(C) || isa<ConstantAggregateZero>(C) ||
+ isa<UndefValue>(C) || isa<MDString>(C))
+ return VMSlot = C; // Primitive constants map directly
+ else if (ConstantArray *CA = dyn_cast<ConstantArray>(C)) {
+ for (User::op_iterator b = CA->op_begin(), i = b, e = CA->op_end();
+ i != e; ++i) {
+ Value *MV = MapValue(*i, VM, Context);
+ if (MV != *i) {
+ // This array must contain a reference to a global, make a new array
+ // and return it.
+ //
+ std::vector<Constant*> Values;
+ Values.reserve(CA->getNumOperands());
+ for (User::op_iterator j = b; j != i; ++j)
+ Values.push_back(cast<Constant>(*j));
+ Values.push_back(cast<Constant>(MV));
+ for (++i; i != e; ++i)
+ Values.push_back(cast<Constant>(MapValue(*i, VM, Context)));
+ return VM[V] = ConstantArray::get(CA->getType(), Values);
+ }
}
- }
- return VM[V] = C;
- }
-
- if (ConstantStruct *CS = dyn_cast<ConstantStruct>(C)) {
- for (User::op_iterator b = CS->op_begin(), i = b, e = CS->op_end();
- i != e; ++i) {
- Value *MV = MapValue(*i, VM);
- if (MV != *i) {
- // This struct must contain a reference to a global, make a new struct
- // and return it.
- //
- std::vector<Constant*> Values;
- Values.reserve(CS->getNumOperands());
- for (User::op_iterator j = b; j != i; ++j)
- Values.push_back(cast<Constant>(*j));
- Values.push_back(cast<Constant>(MV));
- for (++i; i != e; ++i)
- Values.push_back(cast<Constant>(MapValue(*i, VM)));
- return VM[V] = ConstantStruct::get(CS->getType(), Values);
+ return VM[V] = C;
+
+ } else if (ConstantStruct *CS = dyn_cast<ConstantStruct>(C)) {
+ for (User::op_iterator b = CS->op_begin(), i = b, e = CS->op_end();
+ i != e; ++i) {
+ Value *MV = MapValue(*i, VM, Context);
+ if (MV != *i) {
+ // This struct must contain a reference to a global, make a new struct
+ // and return it.
+ //
+ std::vector<Constant*> Values;
+ Values.reserve(CS->getNumOperands());
+ for (User::op_iterator j = b; j != i; ++j)
+ Values.push_back(cast<Constant>(*j));
+ Values.push_back(cast<Constant>(MV));
+ for (++i; i != e; ++i)
+ Values.push_back(cast<Constant>(MapValue(*i, VM, Context)));
+ return VM[V] = ConstantStruct::get(CS->getType(), Values);
+ }
}
- }
- return VM[V] = C;
- }
-
- if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
- std::vector<Constant*> Ops;
- for (User::op_iterator i = CE->op_begin(), e = CE->op_end(); i != e; ++i)
- Ops.push_back(cast<Constant>(MapValue(*i, VM)));
- return VM[V] = CE->getWithOperands(Ops);
- }
-
- if (ConstantVector *CV = dyn_cast<ConstantVector>(C)) {
- for (User::op_iterator b = CV->op_begin(), i = b, e = CV->op_end();
- i != e; ++i) {
- Value *MV = MapValue(*i, VM);
- if (MV != *i) {
- // This vector value must contain a reference to a global, make a new
- // vector constant and return it.
- //
- std::vector<Constant*> Values;
- Values.reserve(CV->getNumOperands());
- for (User::op_iterator j = b; j != i; ++j)
- Values.push_back(cast<Constant>(*j));
- Values.push_back(cast<Constant>(MV));
- for (++i; i != e; ++i)
- Values.push_back(cast<Constant>(MapValue(*i, VM)));
- return VM[V] = ConstantVector::get(Values);
+ return VM[V] = C;
+
+ } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
+ std::vector<Constant*> Ops;
+ for (User::op_iterator i = CE->op_begin(), e = CE->op_end(); i != e; ++i)
+ Ops.push_back(cast<Constant>(MapValue(*i, VM, Context)));
+ return VM[V] = CE->getWithOperands(Ops);
+ } else if (ConstantVector *CP = dyn_cast<ConstantVector>(C)) {
+ for (User::op_iterator b = CP->op_begin(), i = b, e = CP->op_end();
+ i != e; ++i) {
+ Value *MV = MapValue(*i, VM, Context);
+ if (MV != *i) {
+ // This vector value must contain a reference to a global, make a new
+ // vector constant and return it.
+ //
+ std::vector<Constant*> Values;
+ Values.reserve(CP->getNumOperands());
+ for (User::op_iterator j = b; j != i; ++j)
+ Values.push_back(cast<Constant>(*j));
+ Values.push_back(cast<Constant>(MV));
+ for (++i; i != e; ++i)
+ Values.push_back(cast<Constant>(MapValue(*i, VM, Context)));
+ return VM[V] = ConstantVector::get(Values);
+ }
}
+ return VM[V] = C;
+
+ } else {
+ llvm_unreachable("Unknown type of constant!");
}
- return VM[V] = C;
}
-
- if (BlockAddress *BA = dyn_cast<BlockAddress>(C)) {
- Function *F = cast<Function>(MapValue(BA->getFunction(), VM));
- BasicBlock *BB = cast_or_null<BasicBlock>(MapValue(BA->getBasicBlock(),VM));
- return VM[V] = BlockAddress::get(F, BB ? BB : BA->getBasicBlock());
- }
-
- llvm_unreachable("Unknown type of constant!");
return 0;
}
@@ -126,7 +118,7 @@
///
void llvm::RemapInstruction(Instruction *I, ValueMapTy &ValueMap) {
for (User::op_iterator op = I->op_begin(), E = I->op_end(); op != E; ++op) {
- Value *V = MapValue(*op, ValueMap);
+ Value *V = MapValue(*op, ValueMap, I->getParent()->getContext());
assert(V && "Referenced value not in value map!");
*op = V;
}
Modified: llvm/branches/Apple/Leela/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/VMCore/AsmWriter.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/branches/Apple/Leela/lib/VMCore/AsmWriter.cpp Mon Nov 2 13:33:53 2009
@@ -1059,15 +1059,6 @@
Out << "zeroinitializer";
return;
}
-
- if (const BlockAddress *BA = dyn_cast<BlockAddress>(CV)) {
- Out << "blockaddress(";
- WriteAsOperandInternal(Out, BA->getFunction(), &TypePrinter, Machine);
- Out << ", ";
- WriteAsOperandInternal(Out, BA->getBasicBlock(), &TypePrinter, Machine);
- Out << ")";
- return;
- }
if (const ConstantArray *CA = dyn_cast<ConstantArray>(CV)) {
// As a special case, print the array as a string if it is an array of
@@ -1838,7 +1829,7 @@
writeOperand(BI.getSuccessor(1), true);
} else if (isa<SwitchInst>(I)) {
- // Special case switch instruction to get formatting nice and correct.
+ // Special case switch statement to get formatting nice and correct...
Out << ' ';
writeOperand(Operand , true);
Out << ", ";
@@ -1852,19 +1843,6 @@
writeOperand(I.getOperand(op+1), true);
}
Out << "\n ]";
- } else if (isa<IndirectBrInst>(I)) {
- // Special case indirectbr instruction to get formatting nice and correct.
- Out << ' ';
- writeOperand(Operand, true);
- Out << ", ";
- Out << " [";
-
- for (unsigned i = 1, e = I.getNumOperands(); i != e; ++i) {
- if (i != 1)
- Out << ", ";
- writeOperand(I.getOperand(i), true);
- }
- Out << ']';
} else if (isa<PHINode>(I)) {
Out << ' ';
TypePrinter.print(I.getType(), Out);
Modified: llvm/branches/Apple/Leela/lib/VMCore/BasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/VMCore/BasicBlock.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/VMCore/BasicBlock.cpp (original)
+++ llvm/branches/Apple/Leela/lib/VMCore/BasicBlock.cpp Mon Nov 2 13:33:53 2009
@@ -58,24 +58,6 @@
BasicBlock::~BasicBlock() {
- // If the address of the block is taken and it is being deleted (e.g. because
- // it is dead), this means that there is either a dangling constant expr
- // hanging off the block, or an undefined use of the block (source code
- // expecting the address of a label to keep the block alive even though there
- // is no indirect branch). Handle these cases by zapping the BlockAddress
- // nodes. There are no other possible uses at this point.
- if (hasAddressTaken()) {
- assert(!use_empty() && "There should be at least one blockaddress!");
- Constant *Replacement =
- ConstantInt::get(llvm::Type::getInt32Ty(getContext()), 1);
- while (!use_empty()) {
- BlockAddress *BA = cast<BlockAddress>(use_back());
- BA->replaceAllUsesWith(ConstantExpr::getIntToPtr(Replacement,
- BA->getType()));
- BA->destroyConstant();
- }
- }
-
assert(getParent() == 0 && "BasicBlock still linked into the program!");
dropAllReferences();
InstList.clear();
@@ -295,4 +277,3 @@
}
return New;
}
-
Modified: llvm/branches/Apple/Leela/lib/VMCore/ConstantFold.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/VMCore/ConstantFold.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/VMCore/ConstantFold.cpp (original)
+++ llvm/branches/Apple/Leela/lib/VMCore/ConstantFold.cpp Mon Nov 2 13:33:53 2009
@@ -179,151 +179,6 @@
}
-/// ExtractConstantBytes - V is an integer constant which only has a subset of
-/// its bytes used. The bytes used are indicated by ByteStart (which is the
-/// first byte used, counting from the least significant byte) and ByteSize,
-/// which is the number of bytes used.
-///
-/// This function analyzes the specified constant to see if the specified byte
-/// range can be returned as a simplified constant. If so, the constant is
-/// returned, otherwise null is returned.
-///
-static Constant *ExtractConstantBytes(Constant *C, unsigned ByteStart,
- unsigned ByteSize) {
- assert(isa<IntegerType>(C->getType()) &&
- (cast<IntegerType>(C->getType())->getBitWidth() & 7) == 0 &&
- "Non-byte sized integer input");
- unsigned CSize = cast<IntegerType>(C->getType())->getBitWidth()/8;
- assert(ByteSize && "Must be accessing some piece");
- assert(ByteStart+ByteSize <= CSize && "Extracting invalid piece from input");
- assert(ByteSize != CSize && "Should not extract everything");
-
- // Constant Integers are simple.
- if (ConstantInt *CI = dyn_cast<ConstantInt>(C)) {
- APInt V = CI->getValue();
- if (ByteStart)
- V = V.lshr(ByteStart*8);
- V.trunc(ByteSize*8);
- return ConstantInt::get(CI->getContext(), V);
- }
-
- // In the input is a constant expr, we might be able to recursively simplify.
- // If not, we definitely can't do anything.
- ConstantExpr *CE = dyn_cast<ConstantExpr>(C);
- if (CE == 0) return 0;
-
- switch (CE->getOpcode()) {
- default: return 0;
- case Instruction::Or: {
- Constant *RHS = ExtractConstantBytes(CE->getOperand(1), ByteStart,ByteSize);
- if (RHS == 0)
- return 0;
-
- // X | -1 -> -1.
- if (ConstantInt *RHSC = dyn_cast<ConstantInt>(RHS))
- if (RHSC->isAllOnesValue())
- return RHSC;
-
- Constant *LHS = ExtractConstantBytes(CE->getOperand(0), ByteStart,ByteSize);
- if (LHS == 0)
- return 0;
- return ConstantExpr::getOr(LHS, RHS);
- }
- case Instruction::And: {
- Constant *RHS = ExtractConstantBytes(CE->getOperand(1), ByteStart,ByteSize);
- if (RHS == 0)
- return 0;
-
- // X & 0 -> 0.
- if (RHS->isNullValue())
- return RHS;
-
- Constant *LHS = ExtractConstantBytes(CE->getOperand(0), ByteStart,ByteSize);
- if (LHS == 0)
- return 0;
- return ConstantExpr::getAnd(LHS, RHS);
- }
- case Instruction::LShr: {
- ConstantInt *Amt = dyn_cast<ConstantInt>(CE->getOperand(1));
- if (Amt == 0)
- return 0;
- unsigned ShAmt = Amt->getZExtValue();
- // Cannot analyze non-byte shifts.
- if ((ShAmt & 7) != 0)
- return 0;
- ShAmt >>= 3;
-
- // If the extract is known to be all zeros, return zero.
- if (ByteStart >= CSize-ShAmt)
- return Constant::getNullValue(IntegerType::get(CE->getContext(),
- ByteSize*8));
- // If the extract is known to be fully in the input, extract it.
- if (ByteStart+ByteSize+ShAmt <= CSize)
- return ExtractConstantBytes(CE->getOperand(0), ByteStart+ShAmt, ByteSize);
-
- // TODO: Handle the 'partially zero' case.
- return 0;
- }
-
- case Instruction::Shl: {
- ConstantInt *Amt = dyn_cast<ConstantInt>(CE->getOperand(1));
- if (Amt == 0)
- return 0;
- unsigned ShAmt = Amt->getZExtValue();
- // Cannot analyze non-byte shifts.
- if ((ShAmt & 7) != 0)
- return 0;
- ShAmt >>= 3;
-
- // If the extract is known to be all zeros, return zero.
- if (ByteStart+ByteSize <= ShAmt)
- return Constant::getNullValue(IntegerType::get(CE->getContext(),
- ByteSize*8));
- // If the extract is known to be fully in the input, extract it.
- if (ByteStart >= ShAmt)
- return ExtractConstantBytes(CE->getOperand(0), ByteStart-ShAmt, ByteSize);
-
- // TODO: Handle the 'partially zero' case.
- return 0;
- }
-
- case Instruction::ZExt: {
- unsigned SrcBitSize =
- cast<IntegerType>(CE->getOperand(0)->getType())->getBitWidth();
-
- // If extracting something that is completely zero, return 0.
- if (ByteStart*8 >= SrcBitSize)
- return Constant::getNullValue(IntegerType::get(CE->getContext(),
- ByteSize*8));
-
- // If exactly extracting the input, return it.
- if (ByteStart == 0 && ByteSize*8 == SrcBitSize)
- return CE->getOperand(0);
-
- // If extracting something completely in the input, if if the input is a
- // multiple of 8 bits, recurse.
- if ((SrcBitSize&7) == 0 && (ByteStart+ByteSize)*8 <= SrcBitSize)
- return ExtractConstantBytes(CE->getOperand(0), ByteStart, ByteSize);
-
- // Otherwise, if extracting a subset of the input, which is not multiple of
- // 8 bits, do a shift and trunc to get the bits.
- if ((ByteStart+ByteSize)*8 < SrcBitSize) {
- assert((SrcBitSize&7) && "Shouldn't get byte sized case here");
- Constant *Res = CE->getOperand(0);
- if (ByteStart)
- Res = ConstantExpr::getLShr(Res,
- ConstantInt::get(Res->getType(), ByteStart*8));
- return ConstantExpr::getTrunc(Res, IntegerType::get(C->getContext(),
- ByteSize*8));
- }
-
- // TODO: Handle the 'partially zero' case.
- return 0;
- }
- }
-}
-
-
Constant *llvm::ConstantFoldCastInstruction(LLVMContext &Context,
unsigned opc, Constant *V,
const Type *DestTy) {
@@ -381,8 +236,6 @@
// We actually have to do a cast now. Perform the cast according to the
// opcode specified.
switch (opc) {
- default:
- llvm_unreachable("Failed to cast constant expression");
case Instruction::FPTrunc:
case Instruction::FPExt:
if (ConstantFP *FPC = dyn_cast<ConstantFP>(V)) {
@@ -447,27 +300,23 @@
return ConstantInt::get(Context, Result);
}
return 0;
- case Instruction::Trunc: {
- uint32_t DestBitWidth = cast<IntegerType>(DestTy)->getBitWidth();
+ case Instruction::Trunc:
if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
+ uint32_t BitWidth = cast<IntegerType>(DestTy)->getBitWidth();
APInt Result(CI->getValue());
- Result.trunc(DestBitWidth);
+ Result.trunc(BitWidth);
return ConstantInt::get(Context, Result);
}
-
- // The input must be a constantexpr. See if we can simplify this based on
- // the bytes we are demanding. Only do this if the source and dest are an
- // even multiple of a byte.
- if ((DestBitWidth & 7) == 0 &&
- (cast<IntegerType>(V->getType())->getBitWidth() & 7) == 0)
- if (Constant *Res = ExtractConstantBytes(V, 0, DestBitWidth / 8))
- return Res;
-
return 0;
- }
case Instruction::BitCast:
return FoldBitCast(Context, V, DestTy);
+ default:
+ assert(!"Invalid CE CastInst opcode");
+ break;
}
+
+ llvm_unreachable("Failed to cast constant expression");
+ return 0;
}
Constant *llvm::ConstantFoldSelectInstruction(LLVMContext&,
@@ -634,15 +483,7 @@
Idxs + NumIdx));
// Otherwise recurse.
- if (ConstantStruct *CS = dyn_cast<ConstantStruct>(Agg))
- return ConstantFoldExtractValueInstruction(Context, CS->getOperand(*Idxs),
- Idxs+1, NumIdx-1);
-
- if (ConstantArray *CA = dyn_cast<ConstantArray>(Agg))
- return ConstantFoldExtractValueInstruction(Context, CA->getOperand(*Idxs),
- Idxs+1, NumIdx-1);
- ConstantVector *CV = cast<ConstantVector>(Agg);
- return ConstantFoldExtractValueInstruction(Context, CV->getOperand(*Idxs),
+ return ConstantFoldExtractValueInstruction(Context, Agg->getOperand(*Idxs),
Idxs+1, NumIdx-1);
}
@@ -722,10 +563,11 @@
// Insertion of constant into aggregate constant.
std::vector<Constant*> Ops(Agg->getNumOperands());
for (unsigned i = 0; i < Agg->getNumOperands(); ++i) {
- Constant *Op = cast<Constant>(Agg->getOperand(i));
- if (*Idxs == i)
- Op = ConstantFoldInsertValueInstruction(Context, Op,
- Val, Idxs+1, NumIdx-1);
+ Constant *Op =
+ (*Idxs == i) ?
+ ConstantFoldInsertValueInstruction(Context, Agg->getOperand(i),
+ Val, Idxs+1, NumIdx-1) :
+ Agg->getOperand(i);
Ops[i] = Op;
}
Modified: llvm/branches/Apple/Leela/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/VMCore/Constants.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/VMCore/Constants.cpp (original)
+++ llvm/branches/Apple/Leela/lib/VMCore/Constants.cpp Mon Nov 2 13:33:53 2009
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// This file implements the Constant* classes.
+// This file implements the Constant* classes...
//
//===----------------------------------------------------------------------===//
@@ -44,7 +44,7 @@
// Constructor to create a '0' constant of arbitrary type...
static const uint64_t zero[2] = {0, 0};
-Constant *Constant::getNullValue(const Type *Ty) {
+Constant* Constant::getNullValue(const Type* Ty) {
switch (Ty->getTypeID()) {
case Type::IntegerTyID:
return ConstantInt::get(Ty, 0);
@@ -72,7 +72,7 @@
}
}
-Constant* Constant::getIntegerValue(const Type *Ty, const APInt &V) {
+Constant* Constant::getIntegerValue(const Type* Ty, const APInt &V) {
const Type *ScalarTy = Ty->getScalarType();
// Create the base integer constant.
@@ -89,13 +89,13 @@
return C;
}
-Constant* Constant::getAllOnesValue(const Type *Ty) {
- if (const IntegerType *ITy = dyn_cast<IntegerType>(Ty))
+Constant* Constant::getAllOnesValue(const Type* Ty) {
+ if (const IntegerType* ITy = dyn_cast<IntegerType>(Ty))
return ConstantInt::get(Ty->getContext(),
APInt::getAllOnesValue(ITy->getBitWidth()));
std::vector<Constant*> Elts;
- const VectorType *VTy = cast<VectorType>(Ty);
+ const VectorType* VTy = cast<VectorType>(Ty);
Elts.resize(VTy->getNumElements(), getAllOnesValue(VTy->getElementType()));
assert(Elts[0] && "Not a vector integer type!");
return cast<ConstantVector>(ConstantVector::get(Elts));
@@ -140,7 +140,7 @@
// ConstantExpr traps if any operands can trap.
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
- if (CE->getOperand(i)->canTrap())
+ if (getOperand(i)->canTrap())
return true;
// Otherwise, only specific operations can trap.
@@ -154,27 +154,12 @@
case Instruction::SRem:
case Instruction::FRem:
// Div and rem can trap if the RHS is not known to be non-zero.
- if (!isa<ConstantInt>(CE->getOperand(1)) ||CE->getOperand(1)->isNullValue())
+ if (!isa<ConstantInt>(getOperand(1)) || getOperand(1)->isNullValue())
return true;
return false;
}
}
-/// isConstantUsed - Return true if the constant has users other than constant
-/// exprs and other dangling things.
-bool Constant::isConstantUsed() const {
- for (use_const_iterator UI = use_begin(), E = use_end(); UI != E; ++UI) {
- const Constant *UC = dyn_cast<Constant>(*UI);
- if (UC == 0 || isa<GlobalValue>(UC))
- return true;
-
- if (UC->isConstantUsed())
- return true;
- }
- return false;
-}
-
-
/// getRelocationInfo - This method classifies the entry according to
/// whether or not it may generate a relocation entry. This must be
@@ -197,13 +182,9 @@
return GlobalRelocations; // Global reference.
}
- if (const BlockAddress *BA = dyn_cast<BlockAddress>(this))
- return BA->getFunction()->getRelocationInfo();
-
PossibleRelocationsTy Result = NoRelocation;
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
- Result = std::max(Result,
- cast<Constant>(getOperand(i))->getRelocationInfo());
+ Result = std::max(Result, getOperand(i)->getRelocationInfo());
return Result;
}
@@ -1029,7 +1010,7 @@
return Elt;
}
-//---- ConstantPointerNull::get() implementation.
+//---- ConstantPointerNull::get() implementation...
//
ConstantPointerNull *ConstantPointerNull::get(const PointerType *Ty) {
@@ -1046,95 +1027,23 @@
}
-//---- UndefValue::get() implementation.
+//---- UndefValue::get() implementation...
//
UndefValue *UndefValue::get(const Type *Ty) {
+ // Implicitly locked.
return Ty->getContext().pImpl->UndefValueConstants.getOrCreate(Ty, 0);
}
// destroyConstant - Remove the constant from the constant table.
//
void UndefValue::destroyConstant() {
+ // Implicitly locked.
getType()->getContext().pImpl->UndefValueConstants.remove(this);
destroyConstantImpl();
}
-//---- BlockAddress::get() implementation.
-//
-
-BlockAddress *BlockAddress::get(BasicBlock *BB) {
- assert(BB->getParent() != 0 && "Block must have a parent");
- return get(BB->getParent(), BB);
-}
-
-BlockAddress *BlockAddress::get(Function *F, BasicBlock *BB) {
- BlockAddress *&BA =
- F->getContext().pImpl->BlockAddresses[std::make_pair(F, BB)];
- if (BA == 0)
- BA = new BlockAddress(F, BB);
-
- assert(BA->getFunction() == F && "Basic block moved between functions");
- return BA;
-}
-
-BlockAddress::BlockAddress(Function *F, BasicBlock *BB)
-: Constant(Type::getInt8PtrTy(F->getContext()), Value::BlockAddressVal,
- &Op<0>(), 2) {
- setOperand(0, F);
- setOperand(1, BB);
- BB->AdjustBlockAddressRefCount(1);
-}
-
-
-// destroyConstant - Remove the constant from the constant table.
-//
-void BlockAddress::destroyConstant() {
- getFunction()->getType()->getContext().pImpl
- ->BlockAddresses.erase(std::make_pair(getFunction(), getBasicBlock()));
- getBasicBlock()->AdjustBlockAddressRefCount(-1);
- destroyConstantImpl();
-}
-
-void BlockAddress::replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) {
- // This could be replacing either the Basic Block or the Function. In either
- // case, we have to remove the map entry.
- Function *NewF = getFunction();
- BasicBlock *NewBB = getBasicBlock();
-
- if (U == &Op<0>())
- NewF = cast<Function>(To);
- else
- NewBB = cast<BasicBlock>(To);
-
- // See if the 'new' entry already exists, if not, just update this in place
- // and return early.
- BlockAddress *&NewBA =
- getContext().pImpl->BlockAddresses[std::make_pair(NewF, NewBB)];
- if (NewBA == 0) {
- getBasicBlock()->AdjustBlockAddressRefCount(-1);
-
- // Remove the old entry, this can't cause the map to rehash (just a
- // tombstone will get added).
- getContext().pImpl->BlockAddresses.erase(std::make_pair(getFunction(),
- getBasicBlock()));
- NewBA = this;
- setOperand(0, NewF);
- setOperand(1, NewBB);
- getBasicBlock()->AdjustBlockAddressRefCount(1);
- return;
- }
-
- // Otherwise, I do need to replace this with an existing value.
- assert(NewBA != this && "I didn't contain From!");
-
- // Everyone using this now uses the replacement.
- uncheckedReplaceAllUsesWith(NewBA);
-
- destroyConstant();
-}
-
-//---- ConstantExpr::get() implementations.
+//---- ConstantExpr::get() implementations...
//
/// This is a utility function to handle folding of casts and lookup of the
@@ -1952,7 +1861,7 @@
/// single invocation handles all 1000 uses. Handling them one at a time would
/// work, but would be really slow because it would have to unique each updated
/// array instance.
-///
+
void ConstantArray::replaceUsesOfWithOnConstant(Value *From, Value *To,
Use *U) {
assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!");
Modified: llvm/branches/Apple/Leela/lib/VMCore/ConstantsContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/VMCore/ConstantsContext.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/VMCore/ConstantsContext.h (original)
+++ llvm/branches/Apple/Leela/lib/VMCore/ConstantsContext.h Mon Nov 2 13:33:53 2009
@@ -332,7 +332,7 @@
// The number of operands for each ConstantCreator::create method is
// determined by the ConstantTraits template.
// ConstantCreator - A class that is used to create constants by
-// ConstantUniqueMap*. This class should be partially specialized if there is
+// ValueMap*. This class should be partially specialized if there is
// something strange that needs to be done to interface to the ctor for the
// constant.
//
@@ -506,7 +506,7 @@
template<class ValType, class TypeClass, class ConstantClass,
bool HasLargeKey = false /*true for arrays and structs*/ >
-class ConstantUniqueMap : public AbstractTypeUser {
+class ValueMap : public AbstractTypeUser {
public:
typedef std::pair<const TypeClass*, ValType> MapKey;
typedef std::map<MapKey, ConstantClass *> MapTy;
@@ -529,8 +529,8 @@
///
AbstractTypeMapTy AbstractTypeMap;
- /// ConstantUniqueMapLock - Mutex for this map.
- sys::SmartMutex<true> ConstantUniqueMapLock;
+ /// ValueMapLock - Mutex for this map.
+ sys::SmartMutex<true> ValueMapLock;
public:
// NOTE: This function is not locked. It is the caller's responsibility
@@ -619,7 +619,7 @@
/// getOrCreate - Return the specified constant from the map, creating it if
/// necessary.
ConstantClass *getOrCreate(const TypeClass *Ty, const ValType &V) {
- sys::SmartScopedLock<true> Lock(ConstantUniqueMapLock);
+ sys::SmartScopedLock<true> Lock(ValueMapLock);
MapKey Lookup(Ty, V);
ConstantClass* Result = 0;
@@ -674,7 +674,7 @@
}
void remove(ConstantClass *CP) {
- sys::SmartScopedLock<true> Lock(ConstantUniqueMapLock);
+ sys::SmartScopedLock<true> Lock(ValueMapLock);
typename MapTy::iterator I = FindExistingElement(CP);
assert(I != Map.end() && "Constant not found in constant table!");
assert(I->second == CP && "Didn't find correct element?");
@@ -725,7 +725,7 @@
}
void refineAbstractType(const DerivedType *OldTy, const Type *NewTy) {
- sys::SmartScopedLock<true> Lock(ConstantUniqueMapLock);
+ sys::SmartScopedLock<true> Lock(ValueMapLock);
typename AbstractTypeMapTy::iterator I = AbstractTypeMap.find(OldTy);
assert(I != AbstractTypeMap.end() &&
@@ -778,7 +778,7 @@
}
void dump() const {
- DEBUG(errs() << "Constant.cpp: ConstantUniqueMap\n");
+ DEBUG(errs() << "Constant.cpp: ValueMap\n");
}
};
Modified: llvm/branches/Apple/Leela/lib/VMCore/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/VMCore/Function.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/VMCore/Function.cpp (original)
+++ llvm/branches/Apple/Leela/lib/VMCore/Function.cpp Mon Nov 2 13:33:53 2009
@@ -217,20 +217,7 @@
void Function::dropAllReferences() {
for (iterator I = begin(), E = end(); I != E; ++I)
I->dropAllReferences();
-
- // Delete all basic blocks.
- while (!BasicBlocks.empty()) {
- // If there is still a reference to the block, it must be a 'blockaddress'
- // constant pointing to it. Just replace the BlockAddress with undef.
- BasicBlock *BB = BasicBlocks.begin();
- if (!BB->use_empty()) {
- BlockAddress *BA = cast<BlockAddress>(BB->use_back());
- BA->replaceAllUsesWith(UndefValue::get(BA->getType()));
- BA->destroyConstant();
- }
-
- BB->eraseFromParent();
- }
+ BasicBlocks.clear(); // Delete all basic blocks...
}
void Function::addAttribute(unsigned i, Attributes attr) {
Modified: llvm/branches/Apple/Leela/lib/VMCore/Globals.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/VMCore/Globals.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/VMCore/Globals.cpp (original)
+++ llvm/branches/Apple/Leela/lib/VMCore/Globals.cpp Mon Nov 2 13:33:53 2009
@@ -75,7 +75,6 @@
}
}
-
/// Override destroyConstant to make sure it doesn't get called on
/// GlobalValue's because they shouldn't be treated like other constants.
void GlobalValue::destroyConstant() {
Modified: llvm/branches/Apple/Leela/lib/VMCore/Instruction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/VMCore/Instruction.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/VMCore/Instruction.cpp (original)
+++ llvm/branches/Apple/Leela/lib/VMCore/Instruction.cpp Mon Nov 2 13:33:53 2009
@@ -103,7 +103,6 @@
case Ret: return "ret";
case Br: return "br";
case Switch: return "switch";
- case IndirectBr: return "indirectbr";
case Invoke: return "invoke";
case Unwind: return "unwind";
case Unreachable: return "unreachable";
@@ -456,11 +455,3 @@
return false; // Misc instructions which have effects
}
}
-
-Instruction *Instruction::clone() const {
- Instruction *New = clone_impl();
- New->SubclassOptionalData = SubclassOptionalData;
- if (hasMetadata())
- getContext().pImpl->TheMetadata.ValueIsCloned(this, New);
- return New;
-}
Modified: llvm/branches/Apple/Leela/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/VMCore/Instructions.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/VMCore/Instructions.cpp (original)
+++ llvm/branches/Apple/Leela/lib/VMCore/Instructions.cpp Mon Nov 2 13:33:53 2009
@@ -3012,282 +3012,376 @@
setSuccessor(idx, B);
}
-//===----------------------------------------------------------------------===//
-// SwitchInst Implementation
-//===----------------------------------------------------------------------===//
-
-void IndirectBrInst::init(Value *Address, unsigned NumDests) {
- assert(Address && isa<PointerType>(Address->getType()) &&
- "Address of indirectbr must be a pointer");
- ReservedSpace = 1+NumDests;
- NumOperands = 1;
- OperandList = allocHungoffUses(ReservedSpace);
-
- OperandList[0] = Address;
-}
-
-
-/// resizeOperands - resize operands - This adjusts the length of the operands
-/// list according to the following behavior:
-/// 1. If NumOps == 0, grow the operand list in response to a push_back style
-/// of operation. This grows the number of ops by 2 times.
-/// 2. If NumOps > NumOperands, reserve space for NumOps operands.
-/// 3. If NumOps == NumOperands, trim the reserved space.
-///
-void IndirectBrInst::resizeOperands(unsigned NumOps) {
- unsigned e = getNumOperands();
- if (NumOps == 0) {
- NumOps = e*2;
- } else if (NumOps*2 > NumOperands) {
- // No resize needed.
- if (ReservedSpace >= NumOps) return;
- } else if (NumOps == NumOperands) {
- if (ReservedSpace == NumOps) return;
- } else {
- return;
- }
-
- ReservedSpace = NumOps;
- Use *NewOps = allocHungoffUses(NumOps);
- Use *OldOps = OperandList;
- for (unsigned i = 0; i != e; ++i)
- NewOps[i] = OldOps[i];
- OperandList = NewOps;
- if (OldOps) Use::zap(OldOps, OldOps + e, true);
-}
-
-IndirectBrInst::IndirectBrInst(Value *Address, unsigned NumCases,
- Instruction *InsertBefore)
-: TerminatorInst(Type::getVoidTy(Address->getContext()),Instruction::IndirectBr,
- 0, 0, InsertBefore) {
- init(Address, NumCases);
-}
-
-IndirectBrInst::IndirectBrInst(Value *Address, unsigned NumCases,
- BasicBlock *InsertAtEnd)
-: TerminatorInst(Type::getVoidTy(Address->getContext()),Instruction::IndirectBr,
- 0, 0, InsertAtEnd) {
- init(Address, NumCases);
-}
-
-IndirectBrInst::IndirectBrInst(const IndirectBrInst &IBI)
- : TerminatorInst(Type::getVoidTy(IBI.getContext()), Instruction::IndirectBr,
- allocHungoffUses(IBI.getNumOperands()),
- IBI.getNumOperands()) {
- Use *OL = OperandList, *InOL = IBI.OperandList;
- for (unsigned i = 0, E = IBI.getNumOperands(); i != E; ++i)
- OL[i] = InOL[i];
- SubclassOptionalData = IBI.SubclassOptionalData;
-}
-
-IndirectBrInst::~IndirectBrInst() {
- dropHungoffUses(OperandList);
-}
-
-/// addDestination - Add a destination.
-///
-void IndirectBrInst::addDestination(BasicBlock *DestBB) {
- unsigned OpNo = NumOperands;
- if (OpNo+1 > ReservedSpace)
- resizeOperands(0); // Get more space!
- // Initialize some new operands.
- assert(OpNo < ReservedSpace && "Growing didn't work!");
- NumOperands = OpNo+1;
- OperandList[OpNo] = DestBB;
-}
-
-/// removeDestination - This method removes the specified successor from the
-/// indirectbr instruction.
-void IndirectBrInst::removeDestination(unsigned idx) {
- assert(idx < getNumOperands()-1 && "Successor index out of range!");
-
- unsigned NumOps = getNumOperands();
- Use *OL = OperandList;
-
- // Replace this value with the last one.
- OL[idx+1] = OL[NumOps-1];
-
- // Nuke the last value.
- OL[NumOps-1].set(0);
- NumOperands = NumOps-1;
-}
-
-BasicBlock *IndirectBrInst::getSuccessorV(unsigned idx) const {
- return getSuccessor(idx);
-}
-unsigned IndirectBrInst::getNumSuccessorsV() const {
- return getNumSuccessors();
-}
-void IndirectBrInst::setSuccessorV(unsigned idx, BasicBlock *B) {
- setSuccessor(idx, B);
-}
-
-//===----------------------------------------------------------------------===//
-// clone_impl() implementations
-//===----------------------------------------------------------------------===//
-
// Define these methods here so vtables don't get emitted into every translation
// unit that uses these classes.
-GetElementPtrInst *GetElementPtrInst::clone_impl() const {
- return new (getNumOperands()) GetElementPtrInst(*this);
+GetElementPtrInst *GetElementPtrInst::clone() const {
+ GetElementPtrInst *New = new(getNumOperands()) GetElementPtrInst(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-BinaryOperator *BinaryOperator::clone_impl() const {
- return Create(getOpcode(), Op<0>(), Op<1>());
+BinaryOperator *BinaryOperator::clone() const {
+ BinaryOperator *New = Create(getOpcode(), Op<0>(), Op<1>());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-FCmpInst* FCmpInst::clone_impl() const {
- return new FCmpInst(getPredicate(), Op<0>(), Op<1>());
+FCmpInst* FCmpInst::clone() const {
+ FCmpInst *New = new FCmpInst(getPredicate(), Op<0>(), Op<1>());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-
-ICmpInst* ICmpInst::clone_impl() const {
- return new ICmpInst(getPredicate(), Op<0>(), Op<1>());
+ICmpInst* ICmpInst::clone() const {
+ ICmpInst *New = new ICmpInst(getPredicate(), Op<0>(), Op<1>());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-ExtractValueInst *ExtractValueInst::clone_impl() const {
- return new ExtractValueInst(*this);
+ExtractValueInst *ExtractValueInst::clone() const {
+ ExtractValueInst *New = new ExtractValueInst(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-
-InsertValueInst *InsertValueInst::clone_impl() const {
- return new InsertValueInst(*this);
+InsertValueInst *InsertValueInst::clone() const {
+ InsertValueInst *New = new InsertValueInst(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-MallocInst *MallocInst::clone_impl() const {
- return new MallocInst(getAllocatedType(),
- (Value*)getOperand(0),
- getAlignment());
+MallocInst *MallocInst::clone() const {
+ MallocInst *New = new MallocInst(getAllocatedType(),
+ (Value*)getOperand(0),
+ getAlignment());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-AllocaInst *AllocaInst::clone_impl() const {
- return new AllocaInst(getAllocatedType(),
- (Value*)getOperand(0),
- getAlignment());
+AllocaInst *AllocaInst::clone() const {
+ AllocaInst *New = new AllocaInst(getAllocatedType(),
+ (Value*)getOperand(0),
+ getAlignment());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-FreeInst *FreeInst::clone_impl() const {
- return new FreeInst(getOperand(0));
+FreeInst *FreeInst::clone() const {
+ FreeInst *New = new FreeInst(getOperand(0));
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-LoadInst *LoadInst::clone_impl() const {
- return new LoadInst(getOperand(0),
- Twine(), isVolatile(),
- getAlignment());
+LoadInst *LoadInst::clone() const {
+ LoadInst *New = new LoadInst(getOperand(0),
+ Twine(), isVolatile(),
+ getAlignment());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-StoreInst *StoreInst::clone_impl() const {
- return new StoreInst(getOperand(0), getOperand(1),
- isVolatile(), getAlignment());
+StoreInst *StoreInst::clone() const {
+ StoreInst *New = new StoreInst(getOperand(0), getOperand(1),
+ isVolatile(), getAlignment());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-TruncInst *TruncInst::clone_impl() const {
- return new TruncInst(getOperand(0), getType());
+TruncInst *TruncInst::clone() const {
+ TruncInst *New = new TruncInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-ZExtInst *ZExtInst::clone_impl() const {
- return new ZExtInst(getOperand(0), getType());
+ZExtInst *ZExtInst::clone() const {
+ ZExtInst *New = new ZExtInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-SExtInst *SExtInst::clone_impl() const {
- return new SExtInst(getOperand(0), getType());
+SExtInst *SExtInst::clone() const {
+ SExtInst *New = new SExtInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-FPTruncInst *FPTruncInst::clone_impl() const {
- return new FPTruncInst(getOperand(0), getType());
+FPTruncInst *FPTruncInst::clone() const {
+ FPTruncInst *New = new FPTruncInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-FPExtInst *FPExtInst::clone_impl() const {
- return new FPExtInst(getOperand(0), getType());
+FPExtInst *FPExtInst::clone() const {
+ FPExtInst *New = new FPExtInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-UIToFPInst *UIToFPInst::clone_impl() const {
- return new UIToFPInst(getOperand(0), getType());
+UIToFPInst *UIToFPInst::clone() const {
+ UIToFPInst *New = new UIToFPInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-SIToFPInst *SIToFPInst::clone_impl() const {
- return new SIToFPInst(getOperand(0), getType());
+SIToFPInst *SIToFPInst::clone() const {
+ SIToFPInst *New = new SIToFPInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-FPToUIInst *FPToUIInst::clone_impl() const {
- return new FPToUIInst(getOperand(0), getType());
+FPToUIInst *FPToUIInst::clone() const {
+ FPToUIInst *New = new FPToUIInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-FPToSIInst *FPToSIInst::clone_impl() const {
- return new FPToSIInst(getOperand(0), getType());
+FPToSIInst *FPToSIInst::clone() const {
+ FPToSIInst *New = new FPToSIInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-PtrToIntInst *PtrToIntInst::clone_impl() const {
- return new PtrToIntInst(getOperand(0), getType());
+PtrToIntInst *PtrToIntInst::clone() const {
+ PtrToIntInst *New = new PtrToIntInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-IntToPtrInst *IntToPtrInst::clone_impl() const {
- return new IntToPtrInst(getOperand(0), getType());
+IntToPtrInst *IntToPtrInst::clone() const {
+ IntToPtrInst *New = new IntToPtrInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-BitCastInst *BitCastInst::clone_impl() const {
- return new BitCastInst(getOperand(0), getType());
+BitCastInst *BitCastInst::clone() const {
+ BitCastInst *New = new BitCastInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-CallInst *CallInst::clone_impl() const {
- return new(getNumOperands()) CallInst(*this);
+CallInst *CallInst::clone() const {
+ CallInst *New = new(getNumOperands()) CallInst(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-SelectInst *SelectInst::clone_impl() const {
- return SelectInst::Create(getOperand(0), getOperand(1), getOperand(2));
+SelectInst *SelectInst::clone() const {
+ SelectInst *New = SelectInst::Create(getOperand(0),
+ getOperand(1),
+ getOperand(2));
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-VAArgInst *VAArgInst::clone_impl() const {
- return new VAArgInst(getOperand(0), getType());
+VAArgInst *VAArgInst::clone() const {
+ VAArgInst *New = new VAArgInst(getOperand(0), getType());
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-ExtractElementInst *ExtractElementInst::clone_impl() const {
- return ExtractElementInst::Create(getOperand(0), getOperand(1));
+ExtractElementInst *ExtractElementInst::clone() const {
+ ExtractElementInst *New = ExtractElementInst::Create(getOperand(0),
+ getOperand(1));
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-InsertElementInst *InsertElementInst::clone_impl() const {
- return InsertElementInst::Create(getOperand(0),
- getOperand(1),
- getOperand(2));
+InsertElementInst *InsertElementInst::clone() const {
+ InsertElementInst *New = InsertElementInst::Create(getOperand(0),
+ getOperand(1),
+ getOperand(2));
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-ShuffleVectorInst *ShuffleVectorInst::clone_impl() const {
- return new ShuffleVectorInst(getOperand(0),
- getOperand(1),
- getOperand(2));
+ShuffleVectorInst *ShuffleVectorInst::clone() const {
+ ShuffleVectorInst *New = new ShuffleVectorInst(getOperand(0),
+ getOperand(1),
+ getOperand(2));
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-PHINode *PHINode::clone_impl() const {
- return new PHINode(*this);
+PHINode *PHINode::clone() const {
+ PHINode *New = new PHINode(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-ReturnInst *ReturnInst::clone_impl() const {
- return new(getNumOperands()) ReturnInst(*this);
+ReturnInst *ReturnInst::clone() const {
+ ReturnInst *New = new(getNumOperands()) ReturnInst(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-BranchInst *BranchInst::clone_impl() const {
+BranchInst *BranchInst::clone() const {
unsigned Ops(getNumOperands());
- return new(Ops, Ops == 1) BranchInst(*this);
-}
-
-SwitchInst *SwitchInst::clone_impl() const {
- return new SwitchInst(*this);
+ BranchInst *New = new(Ops, Ops == 1) BranchInst(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-IndirectBrInst *IndirectBrInst::clone_impl() const {
- return new IndirectBrInst(*this);
+SwitchInst *SwitchInst::clone() const {
+ SwitchInst *New = new SwitchInst(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-
-InvokeInst *InvokeInst::clone_impl() const {
- return new(getNumOperands()) InvokeInst(*this);
+InvokeInst *InvokeInst::clone() const {
+ InvokeInst *New = new(getNumOperands()) InvokeInst(*this);
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata()) {
+ LLVMContext &Context = getContext();
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ }
+ return New;
}
-UnwindInst *UnwindInst::clone_impl() const {
+UnwindInst *UnwindInst::clone() const {
LLVMContext &Context = getContext();
- return new UnwindInst(Context);
+ UnwindInst *New = new UnwindInst(Context);
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata())
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ return New;
}
-UnreachableInst *UnreachableInst::clone_impl() const {
+UnreachableInst *UnreachableInst::clone() const {
LLVMContext &Context = getContext();
- return new UnreachableInst(Context);
+ UnreachableInst *New = new UnreachableInst(Context);
+ New->SubclassOptionalData = SubclassOptionalData;
+ if (hasMetadata())
+ Context.pImpl->TheMetadata.ValueIsCloned(this, New);
+ return New;
}
Modified: llvm/branches/Apple/Leela/lib/VMCore/LLVMContextImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/VMCore/LLVMContextImpl.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/VMCore/LLVMContextImpl.h (original)
+++ llvm/branches/Apple/Leela/lib/VMCore/LLVMContextImpl.h Mon Nov 2 13:33:53 2009
@@ -109,26 +109,25 @@
FoldingSet<MDNode> MDNodeSet;
- ConstantUniqueMap<char, Type, ConstantAggregateZero> AggZeroConstants;
+ ValueMap<char, Type, ConstantAggregateZero> AggZeroConstants;
- typedef ConstantUniqueMap<std::vector<Constant*>, ArrayType,
+ typedef ValueMap<std::vector<Constant*>, ArrayType,
ConstantArray, true /*largekey*/> ArrayConstantsTy;
ArrayConstantsTy ArrayConstants;
- typedef ConstantUniqueMap<std::vector<Constant*>, StructType,
- ConstantStruct, true /*largekey*/> StructConstantsTy;
+ typedef ValueMap<std::vector<Constant*>, StructType,
+ ConstantStruct, true /*largekey*/> StructConstantsTy;
StructConstantsTy StructConstants;
- typedef ConstantUniqueMap<std::vector<Constant*>, VectorType,
- ConstantVector> VectorConstantsTy;
+ typedef ValueMap<std::vector<Constant*>, VectorType,
+ ConstantVector> VectorConstantsTy;
VectorConstantsTy VectorConstants;
- ConstantUniqueMap<char, PointerType, ConstantPointerNull> NullPtrConstants;
+ ValueMap<char, PointerType, ConstantPointerNull> NullPtrConstants;
- ConstantUniqueMap<char, Type, UndefValue> UndefValueConstants;
+ ValueMap<char, Type, UndefValue> UndefValueConstants;
- DenseMap<std::pair<Function*, BasicBlock*> , BlockAddress*> BlockAddresses;
- ConstantUniqueMap<ExprMapKeyType, Type, ConstantExpr> ExprConstants;
+ ValueMap<ExprMapKeyType, Type, ConstantExpr> ExprConstants;
ConstantInt *TheTrueVal;
ConstantInt *TheFalseVal;
Modified: llvm/branches/Apple/Leela/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/VMCore/Verifier.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/VMCore/Verifier.cpp (original)
+++ llvm/branches/Apple/Leela/lib/VMCore/Verifier.cpp Mon Nov 2 13:33:53 2009
@@ -659,12 +659,6 @@
BasicBlock *Entry = &F.getEntryBlock();
Assert1(pred_begin(Entry) == pred_end(Entry),
"Entry block to function must not have predecessors!", Entry);
-
- // The address of the entry block cannot be taken, unless it is dead.
- if (Entry->hasAddressTaken()) {
- Assert1(!BlockAddress::get(Entry)->isConstantUsed(),
- "blockaddress may not be used with the entry block!", Entry);
- }
}
// If this function is actually an intrinsic, verify that it is only used in
Modified: llvm/branches/Apple/Leela/projects/sample/lib/sample/sample.c
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/projects/sample/lib/sample/sample.c?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/projects/sample/lib/sample/sample.c (original)
+++ llvm/branches/Apple/Leela/projects/sample/lib/sample/sample.c Mon Nov 2 13:33:53 2009
@@ -11,7 +11,7 @@
#include <stdlib.h>
/* LLVM Header File
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
*/
/* Header file global to this project */
Removed: llvm/branches/Apple/Leela/test/CodeGen/X86/loop_blocks.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/test/CodeGen/X86/loop_blocks.ll?rev=85818&view=auto
==============================================================================
--- llvm/branches/Apple/Leela/test/CodeGen/X86/loop_blocks.ll (original)
+++ llvm/branches/Apple/Leela/test/CodeGen/X86/loop_blocks.ll (removed)
@@ -1,207 +0,0 @@
-; RUN: llc < %s -march=x86-64 -mtriple=x86_64-unknown-linux-gnu -asm-verbose=false | FileCheck %s
-
-; These tests check for loop branching structure, and that the loop align
-; directive is placed in the expected place.
-
-; CodeGen should insert a branch into the middle of the loop in
-; order to avoid a branch within the loop.
-
-; CHECK: simple:
-; CHECK: jmp .LBB1_1
-; CHECK-NEXT: align
-; CHECK-NEXT: .LBB1_2:
-; CHECK-NEXT: call loop_latch
-; CHECK-NEXT: .LBB1_1:
-; CHECK-NEXT: call loop_header
-
-define void @simple() nounwind {
-entry:
- br label %loop
-
-loop:
- call void @loop_header()
- %t0 = tail call i32 @get()
- %t1 = icmp slt i32 %t0, 0
- br i1 %t1, label %done, label %bb
-
-bb:
- call void @loop_latch()
- br label %loop
-
-done:
- call void @exit()
- ret void
-}
-
-; CodeGen should move block_a to the top of the loop so that it
-; falls through into the loop, avoiding a branch within the loop.
-
-; CHECK: slightly_more_involved:
-; CHECK: jmp .LBB2_1
-; CHECK-NEXT: align
-; CHECK-NEXT: .LBB2_4:
-; CHECK-NEXT: call bar99
-; CHECK-NEXT: .LBB2_1:
-; CHECK-NEXT: call body
-
-define void @slightly_more_involved() nounwind {
-entry:
- br label %loop
-
-loop:
- call void @body()
- %t0 = call i32 @get()
- %t1 = icmp slt i32 %t0, 2
- br i1 %t1, label %block_a, label %bb
-
-bb:
- %t2 = call i32 @get()
- %t3 = icmp slt i32 %t2, 99
- br i1 %t3, label %exit, label %loop
-
-block_a:
- call void @bar99()
- br label %loop
-
-exit:
- call void @exit()
- ret void
-}
-
-; Same as slightly_more_involved, but block_a is now a CFG diamond with
-; fallthrough edges which should be preserved.
-
-; CHECK: yet_more_involved:
-; CHECK: jmp .LBB3_1
-; CHECK-NEXT: align
-; CHECK-NEXT: .LBB3_7:
-; CHECK-NEXT: call block_a_true_func
-; CHECK-NEXT: jmp .LBB3_4
-; CHECK-NEXT: .LBB3_2:
-; CHECK-NEXT: call bar99
-; CHECK-NEXT: call get
-; CHECK-NEXT: cmpl $2999, %eax
-; CHECK-NEXT: jle .LBB3_7
-; CHECK-NEXT: call block_a_false_func
-; CHECK-NEXT: .LBB3_4:
-; CHECK-NEXT: call block_a_merge_func
-; CHECK-NEXT: .LBB3_1:
-; CHECK-NEXT: call body
-
-define void @yet_more_involved() nounwind {
-entry:
- br label %loop
-
-loop:
- call void @body()
- %t0 = call i32 @get()
- %t1 = icmp slt i32 %t0, 2
- br i1 %t1, label %block_a, label %bb
-
-bb:
- %t2 = call i32 @get()
- %t3 = icmp slt i32 %t2, 99
- br i1 %t3, label %exit, label %loop
-
-block_a:
- call void @bar99()
- %z0 = call i32 @get()
- %z1 = icmp slt i32 %z0, 3000
- br i1 %z1, label %block_a_true, label %block_a_false
-
-block_a_true:
- call void @block_a_true_func()
- br label %block_a_merge
-
-block_a_false:
- call void @block_a_false_func()
- br label %block_a_merge
-
-block_a_merge:
- call void @block_a_merge_func()
- br label %loop
-
-exit:
- call void @exit()
- ret void
-}
-
-; CodeGen should move the CFG islands that are part of the loop but don't
-; conveniently fit anywhere so that they are at least contiguous with the
-; loop.
-
-; CHECK: cfg_islands:
-; CHECK: jmp .LBB4_1
-; CHECK-NEXT: align
-; CHECK-NEXT: .LBB4_7:
-; CHECK-NEXT: call bar100
-; CHECK-NEXT: jmp .LBB4_1
-; CHECK-NEXT: .LBB4_8:
-; CHECK-NEXT: call bar101
-; CHECK-NEXT: jmp .LBB4_1
-; CHECK-NEXT: .LBB4_9:
-; CHECK-NEXT: call bar102
-; CHECK-NEXT: jmp .LBB4_1
-; CHECK-NEXT: .LBB4_5:
-; CHECK-NEXT: call loop_latch
-; CHECK-NEXT: .LBB4_1:
-; CHECK-NEXT: call loop_header
-
-define void @cfg_islands() nounwind {
-entry:
- br label %loop
-
-loop:
- call void @loop_header()
- %t0 = call i32 @get()
- %t1 = icmp slt i32 %t0, 100
- br i1 %t1, label %block100, label %bb
-
-bb:
- %t2 = call i32 @get()
- %t3 = icmp slt i32 %t2, 101
- br i1 %t3, label %block101, label %bb1
-
-bb1:
- %t4 = call i32 @get()
- %t5 = icmp slt i32 %t4, 102
- br i1 %t5, label %block102, label %bb2
-
-bb2:
- %t6 = call i32 @get()
- %t7 = icmp slt i32 %t6, 103
- br i1 %t7, label %exit, label %bb3
-
-bb3:
- call void @loop_latch()
- br label %loop
-
-exit:
- call void @exit()
- ret void
-
-block100:
- call void @bar100()
- br label %loop
-
-block101:
- call void @bar101()
- br label %loop
-
-block102:
- call void @bar102()
- br label %loop
-}
-
-declare void @bar99() nounwind
-declare void @bar100() nounwind
-declare void @bar101() nounwind
-declare void @bar102() nounwind
-declare void @body() nounwind
-declare void @exit() nounwind
-declare void @loop_header() nounwind
-declare void @loop_latch() nounwind
-declare i32 @get() nounwind
-declare void @block_a_true_func() nounwind
-declare void @block_a_false_func() nounwind
-declare void @block_a_merge_func() nounwind
Removed: llvm/branches/Apple/Leela/test/CodeGen/X86/x86-64-jumps.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/test/CodeGen/X86/x86-64-jumps.ll?rev=85818&view=auto
==============================================================================
--- llvm/branches/Apple/Leela/test/CodeGen/X86/x86-64-jumps.ll (original)
+++ llvm/branches/Apple/Leela/test/CodeGen/X86/x86-64-jumps.ll (removed)
@@ -1,16 +0,0 @@
-; RUN: llc < %s
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
-target triple = "x86_64-apple-darwin10.0"
-
-define i8 @test1() nounwind ssp {
-entry:
- %0 = select i1 undef, i8* blockaddress(@test1, %bb), i8* blockaddress(@test1, %bb6) ; <i8*> [#uses=1]
- indirectbr i8* %0, [label %bb, label %bb6]
-
-bb: ; preds = %entry
- ret i8 1
-
-bb6: ; preds = %entry
- ret i8 2
-}
-
Removed: llvm/branches/Apple/Leela/test/Feature/terminators.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/test/Feature/terminators.ll?rev=85818&view=auto
==============================================================================
--- llvm/branches/Apple/Leela/test/Feature/terminators.ll (original)
+++ llvm/branches/Apple/Leela/test/Feature/terminators.ll (removed)
@@ -1,43 +0,0 @@
-; RUN: llvm-as < %s | llvm-dis > %t1.ll
-; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
-; RUN: diff %t1.ll %t2.ll
-
- %int = type i32
-
-define i32 @squared(i32 %i0) {
- switch i32 %i0, label %Default [
- i32 1, label %Case1
- i32 2, label %Case2
- i32 4, label %Case4
- ]
-
-Default: ; preds = %0
- ret i32 -1
-
-Case1: ; preds = %0
- ret i32 1
-
-Case2: ; preds = %0
- ret i32 4
-
-Case4: ; preds = %0
- ret i32 16
-}
-
-
- at Addr = global i8* blockaddress(@indbrtest, %BB1)
- at Addr3 = global i8* blockaddress(@squared, %Case1)
-
-
-define i32 @indbrtest(i8* %P, i32* %Q) {
- indirectbr i8* %P, [label %BB1, label %BB2, label %BB3]
-BB1:
- indirectbr i32* %Q, []
-BB2:
- %R = bitcast i8* blockaddress(@indbrtest, %BB3) to i8*
- indirectbr i8* %R, [label %BB1, label %BB2, label %BB3]
-BB3:
- ret i32 2
-}
-
-
Removed: llvm/branches/Apple/Leela/test/Transforms/ConstProp/constant-expr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/test/Transforms/ConstProp/constant-expr.ll?rev=85818&view=auto
==============================================================================
--- llvm/branches/Apple/Leela/test/Transforms/ConstProp/constant-expr.ll (original)
+++ llvm/branches/Apple/Leela/test/Transforms/ConstProp/constant-expr.ll (removed)
@@ -1,60 +0,0 @@
-; RUN: llvm-as < %s | llvm-dis | FileCheck %s
-
- at X = external global i8
- at Y = external global i8
- at Z = external global i8
-
- at A = global i1 add (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z))
-; CHECK: @A = global i1 xor (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z))
- at B = global i1 sub (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)), align 2
-; CHECK: @B = global i1 xor (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z))
- at C = global i1 mul (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z))
-; CHECK: @C = global i1 and (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z))
-
- at D = global i1 sdiv (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z))
-; CHECK: @D = global i1 icmp ult (i8* @X, i8* @Y)
- at E = global i1 udiv (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z))
-; CHECK: @E = global i1 icmp ult (i8* @X, i8* @Y)
- at F = global i1 srem (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z))
-; CHECK: @F = global i1 false ; <i1*> [#uses=0]
- at G = global i1 urem (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z))
-; CHECK: @G = global i1 false ; <i1*> [#uses=0]
-
- at H = global i1 icmp ule (i32* bitcast (i8* @X to i32*), i32* bitcast (i8* @Y to i32*))
-; CHECK: @H = global i1 icmp ule (i8* @X, i8* @Y)
-
- at I = global i1 xor (i1 icmp ult (i8* @X, i8* @Y), i1 false)
-; CHECK: @I = global i1 icmp ult (i8* @X, i8* @Y)
- at J = global i1 xor (i1 icmp ult (i8* @X, i8* @Y), i1 true)
-; CHECK: @J = global i1 icmp uge (i8* @X, i8* @Y)
-
- at K = global i1 icmp eq (i1 icmp ult (i8* @X, i8* @Y), i1 false)
-; CHECK: @K = global i1 icmp uge (i8* @X, i8* @Y)
- at L = global i1 icmp eq (i1 icmp ult (i8* @X, i8* @Y), i1 true)
-; CHECK: @L = global i1 icmp ult (i8* @X, i8* @Y)
- at M = global i1 icmp ne (i1 icmp ult (i8* @X, i8* @Y), i1 true)
-; CHECK: @M = global i1 icmp uge (i8* @X, i8* @Y)
- at N = global i1 icmp ne (i1 icmp ult (i8* @X, i8* @Y), i1 false)
-; CHECK: @N = global i1 icmp ult (i8* @X, i8* @Y)
-
- at O = global i1 icmp eq (i32 zext (i1 icmp ult (i8* @X, i8* @Y) to i32), i32 0)
-; CHECK: @O = global i1 icmp uge (i8* @X, i8* @Y)
-
-
-
-; PR5176
-
-; CHECK: @T1 = global i1 true
- at T1 = global i1 icmp eq (i64 and (i64 trunc (i256 lshr (i256 or (i256 and (i256 and (i256 shl (i256 zext (i64 ptrtoint (i1* @B to i64) to i256), i256 64), i256 -6277101735386680763495507056286727952638980837032266301441), i256 6277101735386680763835789423207666416102355444464034512895), i256 shl (i256 zext (i64 ptrtoint (i1* @A to i64) to i256), i256 192)), i256 64) to i64), i64 1), i64 0)
-
-; CHECK: @T2 = global i1* @B
- at T2 = global i1* inttoptr (i64 add (i64 trunc (i256 lshr (i256 or (i256 and (i256 and (i256 shl (i256 zext (i64 ptrtoint (i1* @A to i64) to i256), i256 64), i256 -6277101735386680763495507056286727952638980837032266301441), i256 6277101735386680763835789423207666416102355444464034512895), i256 shl (i256 zext (i64 ptrtoint (i1* @B to i64) to i256), i256 192)), i256 192) to i64), i64 trunc (i256 lshr (i256 or (i256 and (i256 and (i256 shl (i256 zext (i64 ptrtoint (i1* @A to i64) to i256), i256 64), i256 -6277101735386680763495507056286727952638980837032266301441), i256 6277101735386680763835789423207666416102355444464034512895), i256 shl (i256 zext (i64 ptrtoint (i1* @B to i64) to i256), i256 192)), i256 128) to i64)) to i1*)
-
-; CHECK: @T3 = global i64 add (i64 ptrtoint (i1* @B to i64), i64 -1)
- at T3 = global i64 add (i64 trunc (i256 lshr (i256 or (i256 and (i256 and (i256 shl (i256 zext (i64 ptrtoint (i1* @B to i64) to i256), i256 64), i256 -6277101735386680763495507056286727952638980837032266301441), i256 6277101735386680763835789423207666416102355444464034512895), i256 shl (i256 zext (i64 ptrtoint (i1* @A to i64) to i256), i256 192)), i256 64) to i64), i64 -1)
-
-; CHECK: @T4 = global i1* @B
- at T4 = global i1* inttoptr (i64 trunc (i256 lshr (i256 or (i256 and (i256 and (i256 shl (i256 zext (i64 ptrtoint (i1* @B to i64) to i256), i256 64), i256 -6277101735386680763495507056286727952638980837032266301441), i256 6277101735386680763835789423207666416102355444464034512895), i256 shl (i256 zext (i64 ptrtoint (i1* @A to i64) to i256), i256 192)), i256 64) to i64) to i1*)
-
-; CHECK: @T5 = global i1* @A
- at T5 = global i1* inttoptr (i64 add (i64 trunc (i256 lshr (i256 or (i256 and (i256 and (i256 shl (i256 zext (i64 ptrtoint (i1* @B to i64) to i256), i256 64), i256 -6277101735386680763495507056286727952638980837032266301441), i256 6277101735386680763835789423207666416102355444464034512895), i256 shl (i256 zext (i64 ptrtoint (i1* @A to i64) to i256), i256 192)), i256 192) to i64), i64 trunc (i256 lshr (i256 or (i256 and (i256 and (i256 shl (i256 zext (i64 ptrtoint (i1* @B to i64) to i256), i256 64), i256 -6277101735386680763495507056286727952638980837032266301441), i256 6277101735386680763835789423207666416102355444464034512895), i256 shl (i256 zext (i64 ptrtoint (i1* @A to i64) to i256), i256 192)), i256 128) to i64)) to i1*)
\ No newline at end of file
Modified: llvm/branches/Apple/Leela/test/Transforms/SimplifyCFG/basictest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/test/Transforms/SimplifyCFG/basictest.ll?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/test/Transforms/SimplifyCFG/basictest.ll (original)
+++ llvm/branches/Apple/Leela/test/Transforms/SimplifyCFG/basictest.ll Mon Nov 2 13:33:53 2009
@@ -21,10 +21,5 @@
}
-define void @test4() {
-entry:
- br label %return
-return:
- ret void
-}
- at test4g = global i8* blockaddress(@test4, %return)
+
+
Modified: llvm/branches/Apple/Leela/tools/llvm-mc/AsmLexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/tools/llvm-mc/AsmLexer.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/tools/llvm-mc/AsmLexer.h (original)
+++ llvm/branches/Apple/Leela/tools/llvm-mc/AsmLexer.h Mon Nov 2 13:33:53 2009
@@ -17,7 +17,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCAsmLexer.h"
#include "llvm/MC/MCAsmInfo.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <string>
#include <cassert>
Modified: llvm/branches/Apple/Leela/unittests/ADT/StringMapTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/unittests/ADT/StringMapTest.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/unittests/ADT/StringMapTest.cpp (original)
+++ llvm/branches/Apple/Leela/unittests/ADT/StringMapTest.cpp Mon Nov 2 13:33:53 2009
@@ -9,7 +9,7 @@
#include "gtest/gtest.h"
#include "llvm/ADT/StringMap.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
using namespace llvm;
namespace {
Modified: llvm/branches/Apple/Leela/unittests/ExecutionEngine/ExecutionEngineTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/unittests/ExecutionEngine/ExecutionEngineTest.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/unittests/ExecutionEngine/ExecutionEngineTest.cpp (original)
+++ llvm/branches/Apple/Leela/unittests/ExecutionEngine/ExecutionEngineTest.cpp Mon Nov 2 13:33:53 2009
@@ -113,17 +113,4 @@
EXPECT_EQ(G2, Engine->getGlobalValueAtAddress(&Mem1));
}
-TEST_F(ExecutionEngineTest, DestructionRemovesGlobalMapping) {
- GlobalVariable *G1 =
- NewExtGlobal(Type::getInt32Ty(getGlobalContext()), "Global1");
- int32_t Mem1 = 3;
- Engine->addGlobalMapping(G1, &Mem1);
- // Make sure the reverse mapping is enabled.
- EXPECT_EQ(G1, Engine->getGlobalValueAtAddress(&Mem1));
- // When the GV goes away, the ExecutionEngine should remove any
- // mappings that refer to it.
- G1->eraseFromParent();
- EXPECT_EQ(NULL, Engine->getGlobalValueAtAddress(&Mem1));
-}
-
}
Modified: llvm/branches/Apple/Leela/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp (original)
+++ llvm/branches/Apple/Leela/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp Mon Nov 2 13:33:53 2009
@@ -32,36 +32,37 @@
OwningPtr<JITMemoryManager> MemMgr(
JITMemoryManager::CreateDefaultMemManager());
uintptr_t size;
+ uint8_t *start;
std::string Error;
// Allocate the functions.
OwningPtr<Function> F1(makeFakeFunction());
size = 1024;
- uint8_t *FunctionBody1 = MemMgr->startFunctionBody(F1.get(), size);
- memset(FunctionBody1, 0xFF, 1024);
- MemMgr->endFunctionBody(F1.get(), FunctionBody1, FunctionBody1 + 1024);
+ start = MemMgr->startFunctionBody(F1.get(), size);
+ memset(start, 0xFF, 1024);
+ MemMgr->endFunctionBody(F1.get(), start, start + 1024);
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
OwningPtr<Function> F2(makeFakeFunction());
size = 1024;
- uint8_t *FunctionBody2 = MemMgr->startFunctionBody(F2.get(), size);
- memset(FunctionBody2, 0xFF, 1024);
- MemMgr->endFunctionBody(F2.get(), FunctionBody2, FunctionBody2 + 1024);
+ start = MemMgr->startFunctionBody(F2.get(), size);
+ memset(start, 0xFF, 1024);
+ MemMgr->endFunctionBody(F2.get(), start, start + 1024);
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
OwningPtr<Function> F3(makeFakeFunction());
size = 1024;
- uint8_t *FunctionBody3 = MemMgr->startFunctionBody(F3.get(), size);
- memset(FunctionBody3, 0xFF, 1024);
- MemMgr->endFunctionBody(F3.get(), FunctionBody3, FunctionBody3 + 1024);
+ start = MemMgr->startFunctionBody(F3.get(), size);
+ memset(start, 0xFF, 1024);
+ MemMgr->endFunctionBody(F3.get(), start, start + 1024);
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
// Deallocate them out of order, in case that matters.
- MemMgr->deallocateFunctionBody(FunctionBody2);
+ MemMgr->deallocateMemForFunction(F2.get());
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
- MemMgr->deallocateFunctionBody(FunctionBody1);
+ MemMgr->deallocateMemForFunction(F1.get());
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
- MemMgr->deallocateFunctionBody(FunctionBody3);
+ MemMgr->deallocateMemForFunction(F3.get());
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
}
@@ -71,6 +72,7 @@
OwningPtr<JITMemoryManager> MemMgr(
JITMemoryManager::CreateDefaultMemManager());
uintptr_t size;
+ uint8_t *start;
std::string Error;
// Big functions are a little less than the largest block size.
@@ -81,26 +83,26 @@
// Allocate big functions
OwningPtr<Function> F1(makeFakeFunction());
size = bigFuncSize;
- uint8_t *FunctionBody1 = MemMgr->startFunctionBody(F1.get(), size);
+ start = MemMgr->startFunctionBody(F1.get(), size);
ASSERT_LE(bigFuncSize, size);
- memset(FunctionBody1, 0xFF, bigFuncSize);
- MemMgr->endFunctionBody(F1.get(), FunctionBody1, FunctionBody1 + bigFuncSize);
+ memset(start, 0xFF, bigFuncSize);
+ MemMgr->endFunctionBody(F1.get(), start, start + bigFuncSize);
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
OwningPtr<Function> F2(makeFakeFunction());
size = bigFuncSize;
- uint8_t *FunctionBody2 = MemMgr->startFunctionBody(F2.get(), size);
+ start = MemMgr->startFunctionBody(F2.get(), size);
ASSERT_LE(bigFuncSize, size);
- memset(FunctionBody2, 0xFF, bigFuncSize);
- MemMgr->endFunctionBody(F2.get(), FunctionBody2, FunctionBody2 + bigFuncSize);
+ memset(start, 0xFF, bigFuncSize);
+ MemMgr->endFunctionBody(F2.get(), start, start + bigFuncSize);
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
OwningPtr<Function> F3(makeFakeFunction());
size = bigFuncSize;
- uint8_t *FunctionBody3 = MemMgr->startFunctionBody(F3.get(), size);
+ start = MemMgr->startFunctionBody(F3.get(), size);
ASSERT_LE(bigFuncSize, size);
- memset(FunctionBody3, 0xFF, bigFuncSize);
- MemMgr->endFunctionBody(F3.get(), FunctionBody3, FunctionBody3 + bigFuncSize);
+ memset(start, 0xFF, bigFuncSize);
+ MemMgr->endFunctionBody(F3.get(), start, start + bigFuncSize);
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
// Check that each large function took it's own slab.
@@ -109,46 +111,43 @@
// Allocate small functions
OwningPtr<Function> F4(makeFakeFunction());
size = smallFuncSize;
- uint8_t *FunctionBody4 = MemMgr->startFunctionBody(F4.get(), size);
+ start = MemMgr->startFunctionBody(F4.get(), size);
ASSERT_LE(smallFuncSize, size);
- memset(FunctionBody4, 0xFF, smallFuncSize);
- MemMgr->endFunctionBody(F4.get(), FunctionBody4,
- FunctionBody4 + smallFuncSize);
+ memset(start, 0xFF, smallFuncSize);
+ MemMgr->endFunctionBody(F4.get(), start, start + smallFuncSize);
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
OwningPtr<Function> F5(makeFakeFunction());
size = smallFuncSize;
- uint8_t *FunctionBody5 = MemMgr->startFunctionBody(F5.get(), size);
+ start = MemMgr->startFunctionBody(F5.get(), size);
ASSERT_LE(smallFuncSize, size);
- memset(FunctionBody5, 0xFF, smallFuncSize);
- MemMgr->endFunctionBody(F5.get(), FunctionBody5,
- FunctionBody5 + smallFuncSize);
+ memset(start, 0xFF, smallFuncSize);
+ MemMgr->endFunctionBody(F5.get(), start, start + smallFuncSize);
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
OwningPtr<Function> F6(makeFakeFunction());
size = smallFuncSize;
- uint8_t *FunctionBody6 = MemMgr->startFunctionBody(F6.get(), size);
+ start = MemMgr->startFunctionBody(F6.get(), size);
ASSERT_LE(smallFuncSize, size);
- memset(FunctionBody6, 0xFF, smallFuncSize);
- MemMgr->endFunctionBody(F6.get(), FunctionBody6,
- FunctionBody6 + smallFuncSize);
+ memset(start, 0xFF, smallFuncSize);
+ MemMgr->endFunctionBody(F6.get(), start, start + smallFuncSize);
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
// Check that the small functions didn't allocate any new slabs.
EXPECT_EQ(3U, MemMgr->GetNumCodeSlabs());
// Deallocate them out of order, in case that matters.
- MemMgr->deallocateFunctionBody(FunctionBody2);
+ MemMgr->deallocateMemForFunction(F2.get());
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
- MemMgr->deallocateFunctionBody(FunctionBody1);
+ MemMgr->deallocateMemForFunction(F1.get());
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
- MemMgr->deallocateFunctionBody(FunctionBody4);
+ MemMgr->deallocateMemForFunction(F4.get());
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
- MemMgr->deallocateFunctionBody(FunctionBody3);
+ MemMgr->deallocateMemForFunction(F3.get());
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
- MemMgr->deallocateFunctionBody(FunctionBody5);
+ MemMgr->deallocateMemForFunction(F5.get());
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
- MemMgr->deallocateFunctionBody(FunctionBody6);
+ MemMgr->deallocateMemForFunction(F6.get());
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
}
Modified: llvm/branches/Apple/Leela/unittests/ExecutionEngine/JIT/JITTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/unittests/ExecutionEngine/JIT/JITTest.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/unittests/ExecutionEngine/JIT/JITTest.cpp (original)
+++ llvm/branches/Apple/Leela/unittests/ExecutionEngine/JIT/JITTest.cpp Mon Nov 2 13:33:53 2009
@@ -9,7 +9,6 @@
#include "gtest/gtest.h"
#include "llvm/ADT/OwningPtr.h"
-#include "llvm/Assembly/Parser.h"
#include "llvm/BasicBlock.h"
#include "llvm/Constant.h"
#include "llvm/Constants.h"
@@ -23,7 +22,6 @@
#include "llvm/Module.h"
#include "llvm/ModuleProvider.h"
#include "llvm/Support/IRBuilder.h"
-#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/TypeBuilder.h"
#include "llvm/Target/TargetSelect.h"
#include "llvm/Type.h"
@@ -51,25 +49,14 @@
protected:
virtual void SetUp() {
M = new Module("<main>", Context);
- MP = new ExistingModuleProvider(M);
std::string Error;
- TheJIT.reset(EngineBuilder(MP).setEngineKind(EngineKind::JIT)
+ TheJIT.reset(EngineBuilder(M).setEngineKind(EngineKind::JIT)
.setErrorStr(&Error).create());
ASSERT_TRUE(TheJIT.get() != NULL) << Error;
}
- void LoadAssembly(const char *assembly) {
- SMDiagnostic Error;
- bool success = NULL != ParseAssemblyString(assembly, M, Error, Context);
- std::string errMsg;
- raw_string_ostream os(errMsg);
- Error.Print("", os);
- ASSERT_TRUE(success) << os.str();
- }
-
LLVMContext Context;
- Module *M; // Owned by MP.
- ModuleProvider *MP; // Owned by ExecutionEngine.
+ Module *M; // Owned by ExecutionEngine.
OwningPtr<ExecutionEngine> TheJIT;
};
@@ -179,20 +166,6 @@
EXPECT_EQ(8, TestFunctionPtr());
}
-TEST_F(JITTest, ModuleDeletion) {
- LoadAssembly("define void @main() { "
- " call i32 @computeVal() "
- " ret void "
- "} "
- " "
- "define internal i32 @computeVal() { "
- " ret i32 0 "
- "} ");
- Function *func = M->getFunction("main");
- TheJIT->getPointerToFunction(func);
- TheJIT->deleteModuleProvider(MP);
-}
-
// This code is copied from JITEventListenerTest, but it only runs once for all
// the tests in this directory. Everything seems fine, but that's strange
// behavior.
Modified: llvm/branches/Apple/Leela/unittests/ExecutionEngine/JIT/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/unittests/ExecutionEngine/JIT/Makefile?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/unittests/ExecutionEngine/JIT/Makefile (original)
+++ llvm/branches/Apple/Leela/unittests/ExecutionEngine/JIT/Makefile Mon Nov 2 13:33:53 2009
@@ -9,7 +9,7 @@
LEVEL = ../../..
TESTNAME = JIT
-LINK_COMPONENTS := asmparser core support jit native
+LINK_COMPONENTS := core support jit native
include $(LEVEL)/Makefile.config
include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest
Modified: llvm/branches/Apple/Leela/unittests/Transforms/Utils/Cloning.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/unittests/Transforms/Utils/Cloning.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/unittests/Transforms/Utils/Cloning.cpp (original)
+++ llvm/branches/Apple/Leela/unittests/Transforms/Utils/Cloning.cpp Mon Nov 2 13:33:53 2009
@@ -21,45 +21,45 @@
BinaryOperator *Sub = BinaryOperator::Create(Instruction::Sub, V, V);
BinaryOperator *Mul = BinaryOperator::Create(Instruction::Mul, V, V);
- EXPECT_FALSE(cast<BinaryOperator>(Add->clone())->hasNoUnsignedWrap());
- EXPECT_FALSE(cast<BinaryOperator>(Add->clone())->hasNoSignedWrap());
- EXPECT_FALSE(cast<BinaryOperator>(Sub->clone())->hasNoUnsignedWrap());
- EXPECT_FALSE(cast<BinaryOperator>(Sub->clone())->hasNoSignedWrap());
- EXPECT_FALSE(cast<BinaryOperator>(Mul->clone())->hasNoUnsignedWrap());
- EXPECT_FALSE(cast<BinaryOperator>(Mul->clone())->hasNoSignedWrap());
+ EXPECT_FALSE(Add->clone()->hasNoUnsignedWrap());
+ EXPECT_FALSE(Add->clone()->hasNoSignedWrap());
+ EXPECT_FALSE(Sub->clone()->hasNoUnsignedWrap());
+ EXPECT_FALSE(Sub->clone()->hasNoSignedWrap());
+ EXPECT_FALSE(Mul->clone()->hasNoUnsignedWrap());
+ EXPECT_FALSE(Mul->clone()->hasNoSignedWrap());
Add->setHasNoUnsignedWrap();
Sub->setHasNoUnsignedWrap();
Mul->setHasNoUnsignedWrap();
- EXPECT_TRUE(cast<BinaryOperator>(Add->clone())->hasNoUnsignedWrap());
- EXPECT_FALSE(cast<BinaryOperator>(Add->clone())->hasNoSignedWrap());
- EXPECT_TRUE(cast<BinaryOperator>(Sub->clone())->hasNoUnsignedWrap());
- EXPECT_FALSE(cast<BinaryOperator>(Sub->clone())->hasNoSignedWrap());
- EXPECT_TRUE(cast<BinaryOperator>(Mul->clone())->hasNoUnsignedWrap());
- EXPECT_FALSE(cast<BinaryOperator>(Mul->clone())->hasNoSignedWrap());
+ EXPECT_TRUE(Add->clone()->hasNoUnsignedWrap());
+ EXPECT_FALSE(Add->clone()->hasNoSignedWrap());
+ EXPECT_TRUE(Sub->clone()->hasNoUnsignedWrap());
+ EXPECT_FALSE(Sub->clone()->hasNoSignedWrap());
+ EXPECT_TRUE(Mul->clone()->hasNoUnsignedWrap());
+ EXPECT_FALSE(Mul->clone()->hasNoSignedWrap());
Add->setHasNoSignedWrap();
Sub->setHasNoSignedWrap();
Mul->setHasNoSignedWrap();
- EXPECT_TRUE(cast<BinaryOperator>(Add->clone())->hasNoUnsignedWrap());
- EXPECT_TRUE(cast<BinaryOperator>(Add->clone())->hasNoSignedWrap());
- EXPECT_TRUE(cast<BinaryOperator>(Sub->clone())->hasNoUnsignedWrap());
- EXPECT_TRUE(cast<BinaryOperator>(Sub->clone())->hasNoSignedWrap());
- EXPECT_TRUE(cast<BinaryOperator>(Mul->clone())->hasNoUnsignedWrap());
- EXPECT_TRUE(cast<BinaryOperator>(Mul->clone())->hasNoSignedWrap());
+ EXPECT_TRUE(Add->clone()->hasNoUnsignedWrap());
+ EXPECT_TRUE(Add->clone()->hasNoSignedWrap());
+ EXPECT_TRUE(Sub->clone()->hasNoUnsignedWrap());
+ EXPECT_TRUE(Sub->clone()->hasNoSignedWrap());
+ EXPECT_TRUE(Mul->clone()->hasNoUnsignedWrap());
+ EXPECT_TRUE(Mul->clone()->hasNoSignedWrap());
Add->setHasNoUnsignedWrap(false);
Sub->setHasNoUnsignedWrap(false);
Mul->setHasNoUnsignedWrap(false);
- EXPECT_FALSE(cast<BinaryOperator>(Add->clone())->hasNoUnsignedWrap());
- EXPECT_TRUE(cast<BinaryOperator>(Add->clone())->hasNoSignedWrap());
- EXPECT_FALSE(cast<BinaryOperator>(Sub->clone())->hasNoUnsignedWrap());
- EXPECT_TRUE(cast<BinaryOperator>(Sub->clone())->hasNoSignedWrap());
- EXPECT_FALSE(cast<BinaryOperator>(Mul->clone())->hasNoUnsignedWrap());
- EXPECT_TRUE(cast<BinaryOperator>(Mul->clone())->hasNoSignedWrap());
+ EXPECT_FALSE(Add->clone()->hasNoUnsignedWrap());
+ EXPECT_TRUE(Add->clone()->hasNoSignedWrap());
+ EXPECT_FALSE(Sub->clone()->hasNoUnsignedWrap());
+ EXPECT_TRUE(Sub->clone()->hasNoSignedWrap());
+ EXPECT_FALSE(Mul->clone()->hasNoUnsignedWrap());
+ EXPECT_TRUE(Mul->clone()->hasNoSignedWrap());
}
TEST(CloneInstruction, Inbounds) {
@@ -69,10 +69,10 @@
std::vector<Value *> ops;
ops.push_back(Z);
GetElementPtrInst *GEP = GetElementPtrInst::Create(V, ops.begin(), ops.end());
- EXPECT_FALSE(cast<GetElementPtrInst>(GEP->clone())->isInBounds());
+ EXPECT_FALSE(GEP->clone()->isInBounds());
GEP->setIsInBounds();
- EXPECT_TRUE(cast<GetElementPtrInst>(GEP->clone())->isInBounds());
+ EXPECT_TRUE(GEP->clone()->isInBounds());
}
TEST(CloneInstruction, Exact) {
@@ -80,8 +80,8 @@
Value *V = new Argument(Type::getInt32Ty(context));
BinaryOperator *SDiv = BinaryOperator::Create(Instruction::SDiv, V, V);
- EXPECT_FALSE(cast<BinaryOperator>(SDiv->clone())->isExact());
+ EXPECT_FALSE(SDiv->clone()->isExact());
SDiv->setIsExact(true);
- EXPECT_TRUE(cast<BinaryOperator>(SDiv->clone())->isExact());
+ EXPECT_TRUE(SDiv->clone()->isExact());
}
Modified: llvm/branches/Apple/Leela/utils/TableGen/CodeGenDAGPatterns.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/utils/TableGen/CodeGenDAGPatterns.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/utils/TableGen/CodeGenDAGPatterns.h (original)
+++ llvm/branches/Apple/Leela/utils/TableGen/CodeGenDAGPatterns.h Mon Nov 2 13:33:53 2009
@@ -584,8 +584,6 @@
return intrinsic_wo_chain_sdnode;
}
- bool hasTargetIntrinsics() { return !TgtIntrinsics.empty(); }
-
private:
void ParseNodeInfo();
void ParseNodeTransforms();
Modified: llvm/branches/Apple/Leela/utils/TableGen/DAGISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/utils/TableGen/DAGISelEmitter.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/utils/TableGen/DAGISelEmitter.cpp (original)
+++ llvm/branches/Apple/Leela/utils/TableGen/DAGISelEmitter.cpp Mon Nov 2 13:33:53 2009
@@ -1967,7 +1967,6 @@
<< " case ISD::TargetConstantPool:\n"
<< " case ISD::TargetFrameIndex:\n"
<< " case ISD::TargetExternalSymbol:\n"
- << " case ISD::TargetBlockAddress:\n"
<< " case ISD::TargetJumpTable:\n"
<< " case ISD::TargetGlobalTLSAddress:\n"
<< " case ISD::TargetGlobalAddress:\n"
@@ -2068,16 +2067,8 @@
<< " errs() << \"Cannot yet select: \";\n"
<< " unsigned iid = cast<ConstantSDNode>(N.getOperand("
<< "N.getOperand(0).getValueType() == MVT::Other))->getZExtValue();\n"
- << " if (iid < Intrinsic::num_intrinsics)\n"
- << " llvm_report_error(\"Cannot yet select: intrinsic %\" + "
- << "Intrinsic::getName((Intrinsic::ID)iid));\n";
- if (CGP.hasTargetIntrinsics()) {
- OS << " else if (const TargetIntrinsicInfo *tii = TM.getIntrinsicInfo())\n"
- << " llvm_report_error(Twine(\"Cannot yet select: target intrinsic "
- << "%\") + tii->getName(iid));\n";
- }
- OS << " else\n"
- << " llvm_report_error(\"Cannot yet select: invalid intrinsic\");\n"
+ << " llvm_report_error(\"Cannot yet select: intrinsic %\" +\n"
+ << "Intrinsic::getName((Intrinsic::ID)iid));\n"
<< "}\n\n";
}
Modified: llvm/branches/Apple/Leela/utils/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/utils/TableGen/Record.cpp?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/utils/TableGen/Record.cpp (original)
+++ llvm/branches/Apple/Leela/utils/TableGen/Record.cpp Mon Nov 2 13:33:53 2009
@@ -12,7 +12,7 @@
//===----------------------------------------------------------------------===//
#include "Record.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Format.h"
#include "llvm/ADT/StringExtras.h"
Modified: llvm/branches/Apple/Leela/utils/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/utils/TableGen/Record.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/utils/TableGen/Record.h (original)
+++ llvm/branches/Apple/Leela/utils/TableGen/Record.h Mon Nov 2 13:33:53 2009
@@ -16,7 +16,7 @@
#define RECORD_H
#include "llvm/Support/SourceMgr.h"
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include "llvm/Support/raw_ostream.h"
#include <map>
Modified: llvm/branches/Apple/Leela/utils/TableGen/TGLexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/utils/TableGen/TGLexer.h?rev=85819&r1=85818&r2=85819&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/utils/TableGen/TGLexer.h (original)
+++ llvm/branches/Apple/Leela/utils/TableGen/TGLexer.h Mon Nov 2 13:33:53 2009
@@ -14,7 +14,7 @@
#ifndef TGLEXER_H
#define TGLEXER_H
-#include "llvm/System/DataTypes.h"
+#include "llvm/Support/DataTypes.h"
#include <vector>
#include <string>
#include <cassert>
More information about the llvm-branch-commits
mailing list