[llvm-commits] [hlvm] r38248 - in /hlvm/trunk/tools: SConscript hlvm-config/ hlvm-config/SConscript hlvm-config/hlvm-config.cpp

Reid Spencer reid at x10sys.com
Sat Jul 7 17:01:37 PDT 2007


Author: reid
Date: Sat Jul  7 19:01:36 2007
New Revision: 38248

URL: http://llvm.org/viewvc/llvm-project?rev=38248&view=rev
Log:
Add a configuration utility. Doesn't do much right now but print out some
information that is useful for debugging.

Added:
    hlvm/trunk/tools/hlvm-config/
    hlvm/trunk/tools/hlvm-config/SConscript
    hlvm/trunk/tools/hlvm-config/hlvm-config.cpp
Modified:
    hlvm/trunk/tools/SConscript

Modified: hlvm/trunk/tools/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/tools/SConscript?rev=38248&r1=38247&r2=38248&view=diff

==============================================================================
--- hlvm/trunk/tools/SConscript (original)
+++ hlvm/trunk/tools/SConscript Sat Jul  7 19:01:36 2007
@@ -22,4 +22,4 @@
 #===----------------------------------------------------------------------===#
 from build import hlvm
 Import('env')
-hlvm.Dirs(env,['hlvm-xml2xml','hlvm-compiler','hlvm'])
+hlvm.Dirs(env,['hlvm-config','hlvm-xml2xml','hlvm-compiler','hlvm'])

Added: hlvm/trunk/tools/hlvm-config/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/tools/hlvm-config/SConscript?rev=38248&view=auto

==============================================================================
--- hlvm/trunk/tools/hlvm-config/SConscript (added)
+++ hlvm/trunk/tools/hlvm-config/SConscript Sat Jul  7 19:01:36 2007
@@ -0,0 +1,36 @@
+#===-- Build Script For test ----------------------------------*- Python -*-===#
+#
+#                      High Level Virtual Machine (HLVM)
+#
+# Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+#
+# This software is free software; you can redistribute it and/or modify it 
+# under the terms of the GNU Lesser General Public License as published by 
+# the Free Software Foundation; either version 2.1 of the License, or (at 
+# your option) any later version.
+#
+# This software is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for 
+# more details.
+#
+# You should have received a copy of the GNU Lesser General Public License 
+# along with this library in the file named LICENSE.txt; if not, write to the 
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+# MA 02110-1301 USA
+#
+#===----------------------------------------------------------------------===#
+from build import hlvm
+Import('env')
+prog = env.Program('hlvm-config', hlvm.GetAllCXXFiles(env),
+  LIBS=[
+    'HLVMRuntime',
+    'HLVMBase',
+    'LLVMSupport',
+    'LLVMSystem',
+    'apr-1',
+    'aprutil-1',
+    'stdc++'
+  ],
+)
+hlvm.InstallProgram(env,prog)

Added: hlvm/trunk/tools/hlvm-config/hlvm-config.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/tools/hlvm-config/hlvm-config.cpp?rev=38248&view=auto

==============================================================================
--- hlvm/trunk/tools/hlvm-config/hlvm-config.cpp (added)
+++ hlvm/trunk/tools/hlvm-config/hlvm-config.cpp Sat Jul  7 19:01:36 2007
@@ -0,0 +1,252 @@
+//===-- hlvm-config Main Program --------------------------------*- C++ -*-===//
+//
+//                      High Level Virtual Machine (HLVM)
+//
+// Copyright (C) 2006 Reid Spencer. All Rights Reserved.
+//
+// This software is free software; you can redistribute it and/or modify it 
+// under the terms of the GNU Lesser General Public License as published by 
+// the Free Software Foundation; either version 2.1 of the License, or (at 
+// your option) any later version.
+//
+// This software is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for 
+// more details.
+//
+// You should have received a copy of the GNU Lesser General Public License 
+// along with this library in the file named LICENSE.txt; if not, write to the 
+// Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+// MA 02110-1301 USA
+//
+//===----------------------------------------------------------------------===//
+/// @file tools/hlvm-config/hlvm-config.cpp
+/// @author Reid Spencer <rspencer at reidspencer.com> (original author)
+/// @date 2006/05/23
+/// @since 0.1.0
+/// @brief Implements the main program for the hlvm-config tool
+//===----------------------------------------------------------------------===//
+
+#include <hlvm/AST/Node.h>
+#include <llvm/Support/CommandLine.h>
+#include <iostream>
+
+using namespace llvm;
+using namespace hlvm;
+
+static llvm::cl::opt<bool> ShowNodeIds("node-ids", cl::init(false),
+  cl::desc("Show the node ids"));
+
+static const char* NodeIDStrs[] =
+{
+  "NoType",
+  "TreeTop",
+  "Documentation",
+  "Documentable",
+  "Bundle",
+  "Import",
+  "VoidType",
+  "BooleanType",
+  "CharacterType",
+  "OctetType",
+  "UInt8Type",
+  "UInt16Type",
+  "UInt32Type",
+  "UInt64Type",
+  "UInt128Type",
+  "SInt8Type",
+  "SInt16Type",
+  "SInt32Type",
+  "SInt64Type",
+  "SInt128Type",
+  "Float32Type",
+  "Float44Type",
+  "Float64Type",
+  "Float80Type",
+  "Float128Type",
+  "AnyType",
+  "IntegerType",
+  "RangeType",
+  "EnumerationType",
+  "RealType",
+  "RationalType",
+  "OpaqueType",
+  "AliasType",
+  "PointerType",
+  "ArrayType",
+  "VectorType",
+  "StructureType",
+  "SignatureType",
+  "ContinuationType",
+  "BufferType",
+  "StreamType",
+  "TextType",
+  "Interface",
+  "Class",
+  "Method",
+  "Implements",
+  "ConstantZero",
+  "ConstantBoolean",
+  "ConstantInteger",
+  "ConstantReal",
+  "ConstantText",
+  "ConstantAggregate",
+  "ConstantExpression",
+  "SizeOf",
+  "Variable",
+  "Function",
+  "Program",
+  "Block",
+  "BreakOp",
+  "ContinueOp",
+  "PInfOp",
+  "NInfOp",
+  "NaNOp",
+  "ReferenceOp",
+  "NoOperator",
+  "ReturnOp",
+  "ThrowOp",
+  "NotOp",
+  "NegateOp",
+  "ComplementOp",
+  "PreIncrOp",
+  "PostIncrOp",
+  "PreDecrOp",
+  "PostDecrOp",
+  "IsPInfOp",
+  "IsNInfOp",
+  "IsNanOp",
+  "TruncOp",
+  "RoundOp",
+  "FloorOp",
+  "CeilingOp",
+  "LogEOp",
+  "Log2Op",
+  "Log10Op",
+  "SquareRootOp",
+  "CubeRootOp",
+  "FactorialOp",
+  "LoadOp",
+  "AllocateOp",
+  "DeallocateOp",
+  "AutoVarOp",
+  "TellOp",
+  "CloseOp",
+  "LengthOp",
+  "AddOp",
+  "SubtractOp",
+  "MultiplyOp",
+  "DivideOp",
+  "ModuloOp",
+  "BAndOp",
+  "BOrOp",
+  "BXorOp",
+  "BNorOp",
+  "AndOp",
+  "OrOp",
+  "NorOp",
+  "XorOp",
+  "LessThanOp",
+  "GreaterThanOp",
+  "LessEqualOp",
+  "GreaterEqualOp",
+  "EqualityOp",
+  "InequalityOp",
+  "PowerOp",
+  "RootOp",
+  "GCDOp",
+  "LCMOp",
+  "ReallocateOp",
+  "StoreOp",
+  "OpenOp",
+  "ReadOp",
+  "WriteOp",
+  "CreateContOp",
+  "SelectOp",
+  "StrInsertOp",
+  "StrEraseOp",
+  "StrReplaceOp",
+  "PositionOp",
+  "LoopOp",
+  "CallOp",
+  "InvokeOp",
+  "DispatchOp",
+  "CallWithContOp",
+  "IndexOp",
+  "SwitchOp",
+};
+
+
+int 
+main(int argc, char**argv) 
+{
+  cl::ParseCommandLineOptions(argc, argv, 
+    "hlvm-config: HLVM Configuration Utility\n");
+
+  if (ShowNodeIds)
+  {
+    unsigned rowcount = 4;
+    for (unsigned i = FirstNodeID; i < LastNodeID; i++) {
+      if (rowcount % 4 == 0)
+        std::cout << "\n";
+      std::cout << "  " << i << ":" << NodeIDStrs[i];
+      rowcount++;
+    }
+    std::cout << "Number of NodeIDs: " << NumNodeIDs << "\n";
+    std::cout << "Nodes: " 
+              << FirstNodeID << " -> "
+              << LastNodeID << "\n";
+    std::cout << "Documentables: " 
+              << FirstDocumentableID << " -> "
+              << LastDocumentableID << "\n";
+    std::cout << "Types:" 
+              << FirstTypeID << " -> " 
+              << LastTypeID << "\n";
+    std::cout << "PrimitiveTypes: " 
+              << FirstPrimitiveTypeID << " -> " 
+              << LastPrimitiveTypeID << "\n";
+    std::cout << "SimpleTypeID: " 
+              << FirstSimpleTypeID << " -> " 
+              << LastSimpleTypeID << "\n";
+    std::cout << "ContainerTypes: " 
+              << FirstContainerTypeID << " -> "
+              << LastContainerTypeID << "\n";
+    std::cout << "UniformContainerTypes: " 
+              << FirstUniformContainerTypeID << " -> "
+              << LastUniformContainerTypeID << "\n";
+    std::cout << "DisparateContainerTypes: " 
+              << FirstDisparateContainerTypeID << " -> "
+              << LastDisparateContainerTypeID << "\n";
+    std::cout << "RuntimeTypes: " 
+              << FirstRuntimeTypeID << " -> "
+              << LastRuntimeTypeID << "\n";
+    std::cout << "Values: " 
+              << FirstValueID << " -> " 
+              << LastValueID << "\n";
+    std::cout << "Constants: " 
+              << FirstConstantID << " -> "
+              << LastConstantID << "\n";
+    std::cout << "LinkageItems: " 
+              << FirstLinkageItemID << " -> "
+              << LastLinkageItemID << "\n";
+    std::cout << "Operators: " 
+              << FirstOperatorID << " -> "
+              << LastOperatorID << "\n";
+    std::cout << "NilaryOperators: " 
+              << FirstNilaryOperatorID << " -> "
+              << LastNilaryOperatorID << "\n";
+    std::cout << "UnaryOperators: " 
+              << FirstUnaryOperatorID << " -> "
+              << LastUnaryOperatorID << "\n";
+    std::cout << "BinaryOperators: " 
+              << FirstBinaryOperatorID << " -> "
+              << LastBinaryOperatorID << "\n";
+    std::cout << "TernaryOperators: " 
+              << FirstTernaryOperatorID << " -> "
+              << LastTernaryOperatorID << "\n";
+    std::cout << "MultiOperators: " 
+              << FirstMultiOperatorID << " -> "
+              << LastMultiOperatorID << "\n";
+  }
+  return 0;
+}





More information about the llvm-commits mailing list