summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2009-09-10 16:21:38 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2009-09-10 16:21:38 +0000
commit7b047b9c81f8e0b9582da2b867d415a79f6ab8db (patch)
treebf2a79e998a50233df7e42795a7d4fe2a4c4ff43
parentd1f1ff3978b2df90b43d824bc2b3c5a46a8079b4 (diff)
downloadbcm5719-llvm-7b047b9c81f8e0b9582da2b867d415a79f6ab8db.tar.gz
bcm5719-llvm-7b047b9c81f8e0b9582da2b867d415a79f6ab8db.zip
Add a logical 'not' operator to llvmc's TableGen dialect.
llvm-svn: 81447
-rw-r--r--llvm/include/llvm/CompilerDriver/Common.td1
-rw-r--r--llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp12
2 files changed, 13 insertions, 0 deletions
diff --git a/llvm/include/llvm/CompilerDriver/Common.td b/llvm/include/llvm/CompilerDriver/Common.td
index 914249e7d90..2ea1f4a3f0c 100644
--- a/llvm/include/llvm/CompilerDriver/Common.td
+++ b/llvm/include/llvm/CompilerDriver/Common.td
@@ -59,6 +59,7 @@ def false;
// Boolean operators.
def and;
def or;
+def not;
// Primitive tests.
def switch_on;
diff --git a/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp b/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp
index 6bade9bc6e4..8a5b36acd58 100644
--- a/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp
+++ b/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp
@@ -1074,6 +1074,16 @@ void EmitLogicalOperationTest(const DagInit& d, const char* LogicOp,
}
}
+void EmitLogicalNot(const DagInit& d, const char* IndentLevel,
+ const OptionDescriptions& OptDescs, raw_ostream& O)
+{
+ checkNumberOfArguments(&d, 1);
+ const DagInit& InnerTest = InitPtrToDag(d.getArg(0));
+ O << "! (";
+ EmitCaseTest(InnerTest, IndentLevel, OptDescs, O);
+ O << ")";
+}
+
/// EmitCaseTest - Helper function used by EmitCaseConstructHandler.
void EmitCaseTest(const DagInit& d, const char* IndentLevel,
const OptionDescriptions& OptDescs,
@@ -1084,6 +1094,8 @@ void EmitCaseTest(const DagInit& d, const char* IndentLevel,
EmitLogicalOperationTest(d, "&&", IndentLevel, OptDescs, O);
else if (TestName == "or")
EmitLogicalOperationTest(d, "||", IndentLevel, OptDescs, O);
+ else if (TestName == "not")
+ EmitLogicalNot(d, IndentLevel, OptDescs, O);
else if (EmitCaseTest1Arg(TestName, d, OptDescs, O))
return;
else if (EmitCaseTest2Args(TestName, d, IndentLevel, OptDescs, O))
OpenPOWER on IntegriCloud