[llvm-commits] [llvm] r81447 - in /llvm/trunk: include/llvm/CompilerDriver/Common.td utils/TableGen/LLVMCConfigurationEmitter.cpp

Mikhail Glushenkov foldr at codedgers.com
Thu Sep 10 09:21:39 PDT 2009


Author: foldr
Date: Thu Sep 10 11:21:38 2009
New Revision: 81447

URL: http://llvm.org/viewvc/llvm-project?rev=81447&view=rev
Log:
Add a logical 'not' operator to llvmc's TableGen dialect.

Modified:
    llvm/trunk/include/llvm/CompilerDriver/Common.td
    llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp

Modified: llvm/trunk/include/llvm/CompilerDriver/Common.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/Common.td?rev=81447&r1=81446&r2=81447&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CompilerDriver/Common.td (original)
+++ llvm/trunk/include/llvm/CompilerDriver/Common.td Thu Sep 10 11:21:38 2009
@@ -59,6 +59,7 @@
 // Boolean operators.
 def and;
 def or;
+def not;
 
 // Primitive tests.
 def switch_on;

Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp?rev=81447&r1=81446&r2=81447&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Thu Sep 10 11:21:38 2009
@@ -1074,6 +1074,16 @@
   }
 }
 
+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 @@
     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))





More information about the llvm-commits mailing list