summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2009-11-04 14:58:56 +0000
committerrdivacky <rdivacky@FreeBSD.org>2009-11-04 14:58:56 +0000
commit7ff99155c39edd73ebf1c6adfa023b1048fee9a4 (patch)
treeb4dc751bcee540346911aa4115729eff2f991657 /utils
parentd1f06de484602e72707476a6152974847bac1570 (diff)
downloadFreeBSD-src-7ff99155c39edd73ebf1c6adfa023b1048fee9a4.zip
FreeBSD-src-7ff99155c39edd73ebf1c6adfa023b1048fee9a4.tar.gz
Update LLVM to r86025.
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/CodeGenDAGPatterns.cpp1
-rw-r--r--utils/TableGen/CodeGenInstruction.cpp2
-rw-r--r--utils/TableGen/CodeGenInstruction.h2
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp61
-rw-r--r--utils/TableGen/InstrInfoEmitter.cpp3
-rw-r--r--utils/TableGen/LLVMCConfigurationEmitter.cpp18
-rw-r--r--utils/TableGen/Record.cpp2
-rw-r--r--utils/TableGen/Record.h2
-rw-r--r--utils/TableGen/TGLexer.h2
-rwxr-xr-xutils/UpdateCMakeLists.pl2
-rwxr-xr-xutils/buildit/build_llvm86
-rwxr-xr-xutils/findoptdiff2
-rw-r--r--utils/lit/TestRunner.py68
-rw-r--r--utils/lit/Util.py2
-rwxr-xr-xutils/lit/lit.py27
-rw-r--r--utils/unittest/UnitTestMain/Makefile2
-rw-r--r--utils/unittest/googletest/Makefile2
-rw-r--r--utils/vim/llvm.vim3
18 files changed, 154 insertions, 133 deletions
diff --git a/utils/TableGen/CodeGenDAGPatterns.cpp b/utils/TableGen/CodeGenDAGPatterns.cpp
index 6b8ceae..fab41c5 100644
--- a/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -915,7 +915,6 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
bool MadeChange = false;
MadeChange |= getChild(0)->ApplyTypeConstraints(TP, NotRegisters);
MadeChange |= getChild(1)->ApplyTypeConstraints(TP, NotRegisters);
- MadeChange |= UpdateNodeType(getChild(1)->getTypeNum(0), TP);
return MadeChange;
} else if (const CodeGenIntrinsic *Int = getIntrinsicInfo(CDP)) {
bool MadeChange = false;
diff --git a/utils/TableGen/CodeGenInstruction.cpp b/utils/TableGen/CodeGenInstruction.cpp
index d421fd0..8520d9e 100644
--- a/utils/TableGen/CodeGenInstruction.cpp
+++ b/utils/TableGen/CodeGenInstruction.cpp
@@ -94,7 +94,7 @@ CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr)
isTerminator = R->getValueAsBit("isTerminator");
isReMaterializable = R->getValueAsBit("isReMaterializable");
hasDelaySlot = R->getValueAsBit("hasDelaySlot");
- usesCustomDAGSchedInserter = R->getValueAsBit("usesCustomDAGSchedInserter");
+ usesCustomInserter = R->getValueAsBit("usesCustomInserter");
hasCtrlDep = R->getValueAsBit("hasCtrlDep");
isNotDuplicable = R->getValueAsBit("isNotDuplicable");
hasSideEffects = R->getValueAsBit("hasSideEffects");
diff --git a/utils/TableGen/CodeGenInstruction.h b/utils/TableGen/CodeGenInstruction.h
index 04506e9..d22ac3e 100644
--- a/utils/TableGen/CodeGenInstruction.h
+++ b/utils/TableGen/CodeGenInstruction.h
@@ -97,7 +97,7 @@ namespace llvm {
bool isTerminator;
bool isReMaterializable;
bool hasDelaySlot;
- bool usesCustomDAGSchedInserter;
+ bool usesCustomInserter;
bool isVariadic;
bool hasCtrlDep;
bool isNotDuplicable;
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index bbb8a18..c3520c1 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -114,7 +114,7 @@ static unsigned getResultPatternCost(TreePatternNode *P,
if (Op->isSubClassOf("Instruction")) {
Cost++;
CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op->getName());
- if (II.usesCustomDAGSchedInserter)
+ if (II.usesCustomInserter)
Cost += 10;
}
for (unsigned i = 0, e = P->getNumChildren(); i != e; ++i)
@@ -1917,40 +1917,6 @@ void DAGISelEmitter::EmitInstructionSelector(raw_ostream &OS) {
}
}
- // Emit boilerplate.
- OS << "SDNode *Select_INLINEASM(SDValue N) {\n"
- << " std::vector<SDValue> Ops(N.getNode()->op_begin(), N.getNode()->op_end());\n"
- << " SelectInlineAsmMemoryOperands(Ops);\n\n"
-
- << " std::vector<EVT> VTs;\n"
- << " VTs.push_back(MVT::Other);\n"
- << " VTs.push_back(MVT::Flag);\n"
- << " SDValue New = CurDAG->getNode(ISD::INLINEASM, N.getDebugLoc(), "
- "VTs, &Ops[0], Ops.size());\n"
- << " return New.getNode();\n"
- << "}\n\n";
-
- OS << "SDNode *Select_UNDEF(const SDValue &N) {\n"
- << " return CurDAG->SelectNodeTo(N.getNode(), TargetInstrInfo::IMPLICIT_DEF,\n"
- << " N.getValueType());\n"
- << "}\n\n";
-
- OS << "SDNode *Select_DBG_LABEL(const SDValue &N) {\n"
- << " SDValue Chain = N.getOperand(0);\n"
- << " unsigned C = cast<LabelSDNode>(N)->getLabelID();\n"
- << " SDValue Tmp = CurDAG->getTargetConstant(C, MVT::i32);\n"
- << " return CurDAG->SelectNodeTo(N.getNode(), TargetInstrInfo::DBG_LABEL,\n"
- << " MVT::Other, Tmp, Chain);\n"
- << "}\n\n";
-
- OS << "SDNode *Select_EH_LABEL(const SDValue &N) {\n"
- << " SDValue Chain = N.getOperand(0);\n"
- << " unsigned C = cast<LabelSDNode>(N)->getLabelID();\n"
- << " SDValue Tmp = CurDAG->getTargetConstant(C, MVT::i32);\n"
- << " return CurDAG->SelectNodeTo(N.getNode(), TargetInstrInfo::EH_LABEL,\n"
- << " MVT::Other, Tmp, Chain);\n"
- << "}\n\n";
-
OS << "// The main instruction selector code.\n"
<< "SDNode *SelectCode(SDValue N) {\n"
<< " MVT::SimpleValueType NVT = N.getNode()->getValueType(0).getSimpleVT().SimpleTy;\n"
@@ -1967,6 +1933,7 @@ void DAGISelEmitter::EmitInstructionSelector(raw_ostream &OS) {
<< " 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"
@@ -2054,30 +2021,6 @@ void DAGISelEmitter::EmitInstructionSelector(raw_ostream &OS) {
<< " }\n"
<< " return NULL;\n"
<< "}\n\n";
-
- OS << "void CannotYetSelect(SDValue N) DISABLE_INLINE {\n"
- << " std::string msg;\n"
- << " raw_string_ostream Msg(msg);\n"
- << " Msg << \"Cannot yet select: \";\n"
- << " N.getNode()->print(Msg, CurDAG);\n"
- << " llvm_report_error(Msg.str());\n"
- << "}\n\n";
-
- OS << "void CannotYetSelectIntrinsic(SDValue N) DISABLE_INLINE {\n"
- << " 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"
- << "}\n\n";
}
void DAGISelEmitter::run(raw_ostream &OS) {
diff --git a/utils/TableGen/InstrInfoEmitter.cpp b/utils/TableGen/InstrInfoEmitter.cpp
index 3a104ea..adb98fb9 100644
--- a/utils/TableGen/InstrInfoEmitter.cpp
+++ b/utils/TableGen/InstrInfoEmitter.cpp
@@ -275,8 +275,7 @@ void InstrInfoEmitter::emitRecord(const CodeGenInstruction &Inst, unsigned Num,
if (Inst.isReMaterializable) OS << "|(1<<TID::Rematerializable)";
if (Inst.isNotDuplicable) OS << "|(1<<TID::NotDuplicable)";
if (Inst.hasOptionalDef) OS << "|(1<<TID::HasOptionalDef)";
- if (Inst.usesCustomDAGSchedInserter)
- OS << "|(1<<TID::UsesCustomDAGSchedInserter)";
+ if (Inst.usesCustomInserter) OS << "|(1<<TID::UsesCustomInserter)";
if (Inst.isVariadic) OS << "|(1<<TID::Variadic)";
if (Inst.hasSideEffects) OS << "|(1<<TID::UnmodeledSideEffects)";
if (Inst.isAsCheapAsAMove) OS << "|(1<<TID::CheapAsAMove)";
diff --git a/utils/TableGen/LLVMCConfigurationEmitter.cpp b/utils/TableGen/LLVMCConfigurationEmitter.cpp
index f5d1139..546988a 100644
--- a/utils/TableGen/LLVMCConfigurationEmitter.cpp
+++ b/utils/TableGen/LLVMCConfigurationEmitter.cpp
@@ -28,7 +28,6 @@
using namespace llvm;
-namespace {
//===----------------------------------------------------------------------===//
/// Typedefs
@@ -40,16 +39,18 @@ typedef std::vector<std::string> StrVector;
/// Constants
// Indentation.
-unsigned TabWidth = 4;
-unsigned Indent1 = TabWidth*1;
-unsigned Indent2 = TabWidth*2;
-unsigned Indent3 = TabWidth*3;
+static const unsigned TabWidth = 4;
+static const unsigned Indent1 = TabWidth*1;
+static const unsigned Indent2 = TabWidth*2;
+static const unsigned Indent3 = TabWidth*3;
// Default help string.
-const char * DefaultHelpString = "NO HELP MESSAGE PROVIDED";
+static const char * const DefaultHelpString = "NO HELP MESSAGE PROVIDED";
// Name for the "sink" option.
-const char * SinkOptionName = "AutoGeneratedSinkOption";
+static const char * const SinkOptionName = "AutoGeneratedSinkOption";
+
+namespace {
//===----------------------------------------------------------------------===//
/// Helper functions
@@ -1901,7 +1902,8 @@ void EmitGenerateActionMethod (const ToolDescription& D,
// For every understood option, emit handling code.
if (D.Actions)
- EmitCaseConstructHandler(D.Actions, Indent2, EmitActionHandlersCallback(OptDescs),
+ EmitCaseConstructHandler(D.Actions, Indent2,
+ EmitActionHandlersCallback(OptDescs),
false, OptDescs, O);
O << '\n';
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp
index a551166..25fe5c4 100644
--- a/utils/TableGen/Record.cpp
+++ b/utils/TableGen/Record.cpp
@@ -12,7 +12,7 @@
//===----------------------------------------------------------------------===//
#include "Record.h"
-#include "llvm/Support/DataTypes.h"
+#include "llvm/System/DataTypes.h"
#include "llvm/Support/Format.h"
#include "llvm/ADT/StringExtras.h"
diff --git a/utils/TableGen/Record.h b/utils/TableGen/Record.h
index 1b33743..752bd0c 100644
--- a/utils/TableGen/Record.h
+++ b/utils/TableGen/Record.h
@@ -16,7 +16,7 @@
#define RECORD_H
#include "llvm/Support/SourceMgr.h"
-#include "llvm/Support/DataTypes.h"
+#include "llvm/System/DataTypes.h"
#include "llvm/Support/raw_ostream.h"
#include <map>
diff --git a/utils/TableGen/TGLexer.h b/utils/TableGen/TGLexer.h
index 80405ac..6790208 100644
--- a/utils/TableGen/TGLexer.h
+++ b/utils/TableGen/TGLexer.h
@@ -14,7 +14,7 @@
#ifndef TGLEXER_H
#define TGLEXER_H
-#include "llvm/Support/DataTypes.h"
+#include "llvm/System/DataTypes.h"
#include <vector>
#include <string>
#include <cassert>
diff --git a/utils/UpdateCMakeLists.pl b/utils/UpdateCMakeLists.pl
index 3aa2f88..6d24d90 100755
--- a/utils/UpdateCMakeLists.pl
+++ b/utils/UpdateCMakeLists.pl
@@ -68,7 +68,7 @@ sub UpdateCMake {
while(<IN>) {
if (!$foundLibrary) {
print OUT $_;
- if (/^add_clang_library\(/ || /^add_llvm_library\(/) {
+ if (/^add_clang_library\(/ || /^add_llvm_library\(/ || /^add_llvm_target\(/) {
$foundLibrary = 1;
EmitCMakeList($dir);
}
diff --git a/utils/buildit/build_llvm b/utils/buildit/build_llvm
index 2bdb208..9168d1a 100755
--- a/utils/buildit/build_llvm
+++ b/utils/buildit/build_llvm
@@ -59,6 +59,10 @@ echo DARWIN_VERS = $DARWIN_VERS
if [ "x$RC_ProjectName" = "xllvmCore_Embedded" ]; then
DT_HOME=$DEST_DIR/Developer/Platforms/iPhoneOS.platform/Developer/usr
DEST_ROOT="/Developer/Platforms/iPhoneOS.platform/Developer$DEST_ROOT"
+elif [ "x$RC_ProjectName" = "xllvmCore_EmbeddedHosted" ]; then
+ DT_HOME=$DEST_DIR/usr
+ DEST_ROOT="/Developer$DEST_ROOT"
+ HOST_SDKROOT=$SDKROOT
else
DT_HOME=$DEST_DIR/Developer/usr
DEST_ROOT="/Developer$DEST_ROOT"
@@ -91,24 +95,69 @@ sed -e '/[Aa]pple-style/d' -e '/include.*GNUmakefile/d' $ORIG_SRC_DIR/Makefile >
mkdir -p $DIR/obj-llvm || exit 1
cd $DIR/obj-llvm || exit 1
-# If the user has set CC or CXX, respect their wishes. If not,
-# compile with LLVM-GCC/LLVM-G++ if available; if LLVM is not
-# available, fall back to usual GCC/G++ default.
-savedPATH=$PATH ; PATH="$PATH:/Developer/usr/bin"
-XTMPCC=$(which llvm-gcc)
-if [ x$CC = x -a x$XTMPCC != x ] ; then export CC=$XTMPCC ; fi
-XTMPCC=$(which llvm-g++)
-if [ x$CXX = x -a x$XTMPCC != x ] ; then export CXX=$XTMPCC ; fi
-PATH=$savedPATH
-unset XTMPCC savedPATH
-
-if [ \! -f Makefile.config ]; then
- $SRC_DIR/configure --prefix=$DT_HOME/local \
- --enable-targets=arm,x86,powerpc,cbe \
- --enable-assertions=$LLVM_ASSERTIONS \
- --enable-optimized=$LLVM_OPTIMIZED \
- --disable-bindings \
- || exit 1
+
+if [ "x$RC_ProjectName" = "xllvmCore_EmbeddedHosted" ]; then
+ # The cross-tools' build process expects to find an existing cross toolchain
+ # under names like 'arm-apple-darwin$DARWIN_VERS-as'; so make them.
+ rm -rf $DIR/bin || exit 1
+ mkdir $DIR/bin || exit 1
+ for prog in ar nm ranlib strip lipo ld as ; do
+ P=$DIR/bin/arm-apple-darwin$DARWIN_VERS-${prog}
+ T=`xcrun -sdk $SDKROOT -find ${prog}`
+ echo '#!/bin/sh' > $P || exit 1
+ echo 'exec '$T' "$@"' >> $P || exit 1
+ chmod a+x $P || exit 1
+ done
+ # Try to use the platform llvm-gcc. Fall back to gcc if it's not available.
+ for prog in gcc g++ ; do
+ P=$DIR/bin/arm-apple-darwin$DARWIN_VERS-${prog}
+# FIXME: Uncomment once llvm-gcc works for this
+# T=`xcrun -find llvm-${prog}`
+# if [ "x$T" = "x" ] ; then
+ T=`xcrun -sdk $SDKROOT -find ${prog}`
+# fi
+ echo '#!/bin/sh' > $P || exit 1
+ echo 'exec '$T' -arch armv6 -isysroot '${SDKROOT}' "$@"' >> $P || exit 1
+ chmod a+x $P || exit 1
+ done
+
+ PATH=$DIR/bin:$PATH
+# otherwise, try to use llvm-gcc if it's available
+elif [ $DARWIN_VERS -gt 9 ]; then
+ # If the user has set CC or CXX, respect their wishes. If not,
+ # compile with LLVM-GCC/LLVM-G++ if available; if LLVM is not
+ # available, fall back to usual GCC/G++ default.
+ savedPATH=$PATH ; PATH="/Developer/usr/bin:$PATH"
+ XTMPCC=$(which llvm-gcc)
+ if [ x$CC = x -a x$XTMPCC != x ] ; then export CC=$XTMPCC ; fi
+ XTMPCC=$(which llvm-g++)
+ if [ x$CXX = x -a x$XTMPCC != x ] ; then export CXX=$XTMPCC ; fi
+ PATH=$savedPATH
+ unset XTMPCC savedPATH
+fi
+
+
+if [ "x$RC_ProjectName" = "xllvmCore_EmbeddedHosted" ]; then
+ if [ \! -f Makefile.config ]; then
+ $SRC_DIR/configure --prefix=$DT_HOME \
+ --enable-targets=arm \
+ --host=arm-apple-darwin10 \
+ --target=arm-apple-darwin10 \
+ --build=i686-apple-darwin10 \
+ --enable-assertions=$LLVM_ASSERTIONS \
+ --enable-optimized=$LLVM_OPTIMIZED \
+ --disable-bindings \
+ || exit 1
+ fi
+else
+ if [ \! -f Makefile.config ]; then
+ $SRC_DIR/configure --prefix=$DT_HOME/local \
+ --enable-targets=arm,x86,powerpc,cbe \
+ --enable-assertions=$LLVM_ASSERTIONS \
+ --enable-optimized=$LLVM_OPTIMIZED \
+ --disable-bindings \
+ || exit 1
+ fi
fi
SUBVERSION=`echo $RC_ProjectSourceVersion | sed -e 's/[^.]*\.\([0-9]*\).*/\1/'`
@@ -158,6 +207,7 @@ if [ "x$MAJ_VER" != "x4" -o "x$MIN_VER" != "x0" ]; then
fi
make $JOBS_FLAG $OPTIMIZE_OPTS UNIVERSAL=1 UNIVERSAL_ARCH="$TARGETS" \
+ UNIVERSAL_SDK_PATH=$HOST_SDKROOT \
NO_RUNTIME_LIBS=1 \
LLVM_SUBMIT_VERSION=$LLVM_SUBMIT_VERSION \
LLVM_SUBMIT_SUBVERSION=$LLVM_SUBMIT_SUBVERSION \
diff --git a/utils/findoptdiff b/utils/findoptdiff
index 36620d9..4f8d08d 100755
--- a/utils/findoptdiff
+++ b/utils/findoptdiff
@@ -70,7 +70,7 @@ dis2="$llvm2/Debug/bin/llvm-dis"
opt1="$llvm1/Debug/bin/opt"
opt2="$llvm2/Debug/bin/opt"
-all_switches="-verify -lowersetjmp -raiseallocs -simplifycfg -mem2reg -globalopt -globaldce -ipconstprop -deadargelim -instcombine -simplifycfg -prune-eh -inline -simplify-libcalls -argpromotion -tailduplicate -simplifycfg -scalarrepl -instcombine -predsimplify -condprop -tailcallelim -simplifycfg -reassociate -licm -loop-unswitch -instcombine -indvars -loop-unroll -instcombine -load-vn -gcse -sccp -instcombine -condprop -dse -dce -simplifycfg -deadtypeelim -constmerge -internalize -ipsccp -globalopt -constmerge -deadargelim -inline -prune-eh -globalopt -globaldce -argpromotion -instcombine -predsimplify -scalarrepl -globalsmodref-aa -licm -load-vn -gcse -dse -instcombine -simplifycfg -verify"
+all_switches="-verify -lowersetjmp -simplifycfg -mem2reg -globalopt -globaldce -ipconstprop -deadargelim -instcombine -simplifycfg -prune-eh -inline -simplify-libcalls -argpromotion -tailduplicate -simplifycfg -scalarrepl -instcombine -predsimplify -condprop -tailcallelim -simplifycfg -reassociate -licm -loop-unswitch -instcombine -indvars -loop-unroll -instcombine -load-vn -gcse -sccp -instcombine -condprop -dse -dce -simplifycfg -deadtypeelim -constmerge -internalize -ipsccp -globalopt -constmerge -deadargelim -inline -prune-eh -globalopt -globaldce -argpromotion -instcombine -predsimplify -scalarrepl -globalsmodref-aa -licm -load-vn -gcse -dse -instcombine -simplifycfg -verify"
#counter=0
function tryit {
diff --git a/utils/lit/TestRunner.py b/utils/lit/TestRunner.py
index 34e828b..bee1167 100644
--- a/utils/lit/TestRunner.py
+++ b/utils/lit/TestRunner.py
@@ -15,6 +15,10 @@ class InternalShellError(Exception):
# Don't use close_fds on Windows.
kUseCloseFDs = platform.system() != 'Windows'
+
+# Use temporary files to replace /dev/null on Windows.
+kAvoidDevNull = platform.system() == 'Windows'
+
def executeCommand(command, cwd=None, env=None):
p = subprocess.Popen(command, cwd=cwd,
stdin=subprocess.PIPE,
@@ -63,21 +67,30 @@ def executeShCmd(cmd, cfg, cwd, results):
# output. This is null until we have seen some output using
# stderr.
for i,j in enumerate(cmd.commands):
+ # Apply the redirections, we use (N,) as a sentinal to indicate stdin,
+ # stdout, stderr for N equal to 0, 1, or 2 respectively. Redirects to or
+ # from a file are represented with a list [file, mode, file-object]
+ # where file-object is initially None.
redirects = [(0,), (1,), (2,)]
for r in j.redirects:
if r[0] == ('>',2):
redirects[2] = [r[1], 'w', None]
+ elif r[0] == ('>>',2):
+ redirects[2] = [r[1], 'a', None]
elif r[0] == ('>&',2) and r[1] in '012':
redirects[2] = redirects[int(r[1])]
elif r[0] == ('>&',) or r[0] == ('&>',):
redirects[1] = redirects[2] = [r[1], 'w', None]
elif r[0] == ('>',):
redirects[1] = [r[1], 'w', None]
+ elif r[0] == ('>>',):
+ redirects[1] = [r[1], 'a', None]
elif r[0] == ('<',):
redirects[0] = [r[1], 'r', None]
else:
raise NotImplementedError,"Unsupported redirect: %r" % (r,)
+ # Map from the final redirections to something subprocess can handle.
final_redirects = []
for index,r in enumerate(redirects):
if r == (0,):
@@ -95,7 +108,10 @@ def executeShCmd(cmd, cfg, cwd, results):
result = subprocess.PIPE
else:
if r[2] is None:
- r[2] = open(r[0], r[1])
+ if kAvoidDevNull and r[0] == '/dev/null':
+ r[2] = tempfile.TemporaryFile(mode=r[1])
+ else:
+ r[2] = open(r[0], r[1])
result = r[2]
final_redirects.append(result)
@@ -317,7 +333,24 @@ def executeScript(test, litConfig, tmpBase, commands, cwd):
return executeCommand(command, cwd=cwd, env=test.config.environment)
-def parseIntegratedTestScript(test, xfailHasColon, requireAndAnd):
+def isExpectedFail(xfails, xtargets, target_triple):
+ # Check if any xfail matches this target.
+ for item in xfails:
+ if item == '*' or item in target_triple:
+ break
+ else:
+ return False
+
+ # If so, see if it is expected to pass on this target.
+ #
+ # FIXME: Rename XTARGET to something that makes sense, like XPASS.
+ for item in xtargets:
+ if item == '*' or item in target_triple:
+ return False
+
+ return True
+
+def parseIntegratedTestScript(test, requireAndAnd):
"""parseIntegratedTestScript - Scan an LLVM/Clang style integrated test
script and extract the lines to 'RUN' as well as 'XFAIL' and 'XTARGET'
information. The RUN lines also will have variable substitution performed.
@@ -361,12 +394,9 @@ def parseIntegratedTestScript(test, xfailHasColon, requireAndAnd):
script[-1] = script[-1][:-1] + ln
else:
script.append(ln)
- elif xfailHasColon and 'XFAIL:' in ln:
+ elif 'XFAIL:' in ln:
items = ln[ln.index('XFAIL:') + 6:].split(',')
xfails.extend([s.strip() for s in items])
- elif not xfailHasColon and 'XFAIL' in ln:
- items = ln[ln.index('XFAIL') + 5:].split(',')
- xfails.extend([s.strip() for s in items])
elif 'XTARGET:' in ln:
items = ln[ln.index('XTARGET:') + 8:].split(',')
xtargets.extend([s.strip() for s in items])
@@ -405,7 +435,8 @@ def parseIntegratedTestScript(test, xfailHasColon, requireAndAnd):
# Strip off '&&'
script[i] = ln[:-2]
- return script,xfails,xtargets,tmpBase,execdir
+ isXFail = isExpectedFail(xfails, xtargets, test.suite.config.target_triple)
+ return script,isXFail,tmpBase,execdir
def formatTestOutput(status, out, err, exitCode, script):
output = StringIO.StringIO()
@@ -428,11 +459,11 @@ def executeTclTest(test, litConfig):
if test.config.unsupported:
return (Test.UNSUPPORTED, 'Test is unsupported')
- res = parseIntegratedTestScript(test, True, False)
+ res = parseIntegratedTestScript(test, False)
if len(res) == 2:
return res
- script, xfails, xtargets, tmpBase, execdir = res
+ script, isXFail, tmpBase, execdir = res
if litConfig.noExecute:
return (Test.PASS, '')
@@ -444,19 +475,6 @@ def executeTclTest(test, litConfig):
if len(res) == 2:
return res
- isXFail = False
- for item in xfails:
- if item == '*' or item in test.suite.config.target_triple:
- isXFail = True
- break
-
- # If this is XFAIL, see if it is expected to pass on this target.
- if isXFail:
- for item in xtargets:
- if item == '*' or item in test.suite.config.target_triple:
- isXFail = False
- break
-
out,err,exitCode = res
if isXFail:
ok = exitCode != 0
@@ -474,11 +492,11 @@ def executeShTest(test, litConfig, useExternalSh, requireAndAnd):
if test.config.unsupported:
return (Test.UNSUPPORTED, 'Test is unsupported')
- res = parseIntegratedTestScript(test, False, requireAndAnd)
+ res = parseIntegratedTestScript(test, requireAndAnd)
if len(res) == 2:
return res
- script, xfails, xtargets, tmpBase, execdir = res
+ script, isXFail, tmpBase, execdir = res
if litConfig.noExecute:
return (Test.PASS, '')
@@ -494,7 +512,7 @@ def executeShTest(test, litConfig, useExternalSh, requireAndAnd):
return res
out,err,exitCode = res
- if xfails:
+ if isXFail:
ok = exitCode != 0
status = (Test.XPASS, Test.XFAIL)[ok]
else:
diff --git a/utils/lit/Util.py b/utils/lit/Util.py
index e62a8ed..66c5e46 100644
--- a/utils/lit/Util.py
+++ b/utils/lit/Util.py
@@ -15,7 +15,7 @@ def detectCPUs():
return int(os.popen2("sysctl -n hw.ncpu")[1].read())
# Windows:
if os.environ.has_key("NUMBER_OF_PROCESSORS"):
- ncpus = int(os.environ["NUMBER_OF_PROCESSORS"]);
+ ncpus = int(os.environ["NUMBER_OF_PROCESSORS"])
if ncpus > 0:
return ncpus
return 1 # Default
diff --git a/utils/lit/lit.py b/utils/lit/lit.py
index 5b24286..a856473 100755
--- a/utils/lit/lit.py
+++ b/utils/lit/lit.py
@@ -16,9 +16,13 @@ from TestingConfig import TestingConfig
import LitConfig
import Test
+# Configuration files to look for when discovering test suites. These can be
+# overridden with --config-prefix.
+#
# FIXME: Rename to 'config.lit', 'site.lit', and 'local.lit' ?
-kConfigName = 'lit.cfg'
-kSiteConfigName = 'lit.site.cfg'
+gConfigName = 'lit.cfg'
+gSiteConfigName = 'lit.site.cfg'
+
kLocalConfigName = 'lit.local.cfg'
class TestingProgressDisplay:
@@ -134,10 +138,10 @@ class Tester(threading.Thread):
self.display.update(test)
def dirContainsTestSuite(path):
- cfgpath = os.path.join(path, kSiteConfigName)
+ cfgpath = os.path.join(path, gSiteConfigName)
if os.path.exists(cfgpath):
return cfgpath
- cfgpath = os.path.join(path, kConfigName)
+ cfgpath = os.path.join(path, gConfigName)
if os.path.exists(cfgpath):
return cfgpath
@@ -268,7 +272,7 @@ def getTestsInSuite(ts, path_in_suite, litConfig,
file_sourcepath = os.path.join(source_path, filename)
if not os.path.isdir(file_sourcepath):
continue
-
+
# Check for nested test suites, first in the execpath in case there is a
# site configuration and then in the source path.
file_execpath = ts.getExecPath(path_in_suite + (filename,))
@@ -283,7 +287,7 @@ def getTestsInSuite(ts, path_in_suite, litConfig,
subiter = getTestsInSuite(ts, path_in_suite + (filename,),
litConfig, testSuiteCache,
localConfigCache)
-
+
for res in subiter:
yield res
@@ -314,6 +318,9 @@ def main():
parser.add_option("-j", "--threads", dest="numThreads", metavar="N",
help="Number of testing threads",
type=int, action="store", default=None)
+ parser.add_option("", "--config-prefix", dest="configPrefix",
+ metavar="NAME", help="Prefix for 'lit' config files",
+ action="store", default=None)
group = OptionGroup(parser, "Output Format")
# FIXME: I find these names very confusing, although I like the
@@ -379,6 +386,11 @@ def main():
if not args:
parser.error('No inputs specified')
+ if opts.configPrefix is not None:
+ global gConfigName, gSiteConfigName
+ gConfigName = '%s.cfg' % opts.configPrefix
+ gSiteConfigName = '%s.site.cfg' % opts.configPrefix
+
if opts.numThreads is None:
opts.numThreads = Util.detectCPUs()
@@ -413,7 +425,8 @@ def main():
if opts.showSuites:
suitesAndTests = dict([(ts,[])
- for ts,_ in testSuiteCache.values()])
+ for ts,_ in testSuiteCache.values()
+ if ts])
for t in tests:
suitesAndTests[t.suite].append(t)
diff --git a/utils/unittest/UnitTestMain/Makefile b/utils/unittest/UnitTestMain/Makefile
index aadff21..7b49191 100644
--- a/utils/unittest/UnitTestMain/Makefile
+++ b/utils/unittest/UnitTestMain/Makefile
@@ -10,8 +10,6 @@
LEVEL = ../../..
include $(LEVEL)/Makefile.config
-NO_MISSING_FIELD_INITIALIZERS := $(shell $(CXX) -Wno-missing-field-initializers -fsyntax-only -xc /dev/null 2>/dev/null && echo -Wno-missing-field-initializers)
-NO_VARIADIC_MACROS := $(shell $(CXX) -Wno-variadic-macros -fsyntax-only -xc /dev/null 2>/dev/null && echo -Wno-variadic-macros)
LIBRARYNAME = UnitTestMain
BUILD_ARCHIVE = 1
diff --git a/utils/unittest/googletest/Makefile b/utils/unittest/googletest/Makefile
index 29fe679..2d2c282 100644
--- a/utils/unittest/googletest/Makefile
+++ b/utils/unittest/googletest/Makefile
@@ -10,8 +10,6 @@
LEVEL := ../../..
include $(LEVEL)/Makefile.config
-NO_MISSING_FIELD_INITIALIZERS := $(shell $(CXX) -Wno-missing-field-initializers -fsyntax-only -xc /dev/null 2>/dev/null && echo -Wno-missing-field-initializers)
-NO_VARIADIC_MACROS := $(shell $(CXX) -Wno-variadic-macros -fsyntax-only -xc /dev/null 2>/dev/null && echo -Wno-variadic-macros)
LIBRARYNAME = GoogleTest
BUILD_ARCHIVE = 1
diff --git a/utils/vim/llvm.vim b/utils/vim/llvm.vim
index 2cc266b..451013e 100644
--- a/utils/vim/llvm.vim
+++ b/utils/vim/llvm.vim
@@ -34,7 +34,7 @@ syn keyword llvmStatement phi call select shl lshr ashr va_arg
syn keyword llvmStatement trunc zext sext
syn keyword llvmStatement fptrunc fpext fptoui fptosi uitofp sitofp
syn keyword llvmStatement ptrtoint inttoptr bitcast
-syn keyword llvmStatement ret br switch invoke unwind unreachable
+syn keyword llvmStatement ret br indirectbr switch invoke unwind unreachable
syn keyword llvmStatement malloc alloca free load store getelementptr
syn keyword llvmStatement extractelement insertelement shufflevector
syn keyword llvmStatement extractvalue insertvalue
@@ -56,6 +56,7 @@ syn keyword llvmKeyword noredzone noimplicitfloat naked
syn keyword llvmKeyword module asm align tail to
syn keyword llvmKeyword addrspace section alias sideeffect c gc
syn keyword llvmKeyword target datalayout triple
+syn keyword llvmKeyword blockaddress
" Obsolete keywords.
syn keyword llvmError uninitialized implementation
OpenPOWER on IntegriCloud