[llvm-commits] [hlvm] r38096 - in /hlvm/trunk/hlvm: Makefile Pass/ Pass/Makefile Pass/Pass.cpp Pass/ResolveTypes.h Pass/SConscript Pass/Validate.cpp Pass/Validate.h SConscript

Reid Spencer reid at x10sys.com
Sat Jul 7 16:59:47 PDT 2007


Author: reid
Date: Sat Jul  7 18:59:47 2007
New Revision: 38096

URL: http://llvm.org/viewvc/llvm-project?rev=38096&view=rev
Log:
Add the beginnings of a "Pass" directory to support making passes over
the Abstract Syntax Tree.

Added:
    hlvm/trunk/hlvm/Pass/
    hlvm/trunk/hlvm/Pass/Makefile
    hlvm/trunk/hlvm/Pass/Pass.cpp
    hlvm/trunk/hlvm/Pass/ResolveTypes.h
    hlvm/trunk/hlvm/Pass/SConscript
    hlvm/trunk/hlvm/Pass/Validate.cpp
    hlvm/trunk/hlvm/Pass/Validate.h
Modified:
    hlvm/trunk/hlvm/Makefile
    hlvm/trunk/hlvm/SConscript

Modified: hlvm/trunk/hlvm/Makefile
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Makefile?rev=38096&r1=38095&r2=38096&view=diff

==============================================================================
--- hlvm/trunk/hlvm/Makefile (original)
+++ hlvm/trunk/hlvm/Makefile Sat Jul  7 18:59:47 2007
@@ -7,6 +7,6 @@
 #
 # List all of the subdirectories that we will compile.
 #
-DIRS=Base AST Reader Writer
+DIRS=Base AST Pass Reader Writer
 
 include $(LEVEL)/Makefile.hlvm

Added: hlvm/trunk/hlvm/Pass/Makefile
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Pass/Makefile?rev=38096&view=auto

==============================================================================
--- hlvm/trunk/hlvm/Pass/Makefile (added)
+++ hlvm/trunk/hlvm/Pass/Makefile Sat Jul  7 18:59:47 2007
@@ -0,0 +1,13 @@
+#-------------------------------------------------------------------------------
+# 
+# Copyright (C) 2006 HLVM Group. All Rights Reserved
+#
+#-------------------------------------------------------------------------------
+
+LEVEL 	            := ../..
+LIBRARYNAME         := HLVMPass
+DONT_BUILD_RELINKED := 1
+BUILD_ARCHIVE       := 1
+INSTALL_INCLUDES    := Validate.h
+
+include $(LEVEL)/Makefile.hlvm

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

==============================================================================
--- hlvm/trunk/hlvm/Pass/Pass.cpp (added)
+++ hlvm/trunk/hlvm/Pass/Pass.cpp Sat Jul  7 18:59:47 2007
@@ -0,0 +1,38 @@
+//===-- AST Pass Classes ----------------------------------------*- 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 hlvm/AST/Pass.cpp
+/// @author Reid Spencer <rspencer at reidspencer.org> (original author)
+/// @date 2006/05/18
+/// @since 0.1.0
+/// @brief Implements the functions of class hlvm::AST::Pass.
+//===----------------------------------------------------------------------===//
+
+#include <hlvm/AST/Pass.h>
+
+namespace hlvm { namespace AST {
+
+Pass::~Pass()
+{
+}
+
+}}

Added: hlvm/trunk/hlvm/Pass/ResolveTypes.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Pass/ResolveTypes.h?rev=38096&view=auto

==============================================================================
--- hlvm/trunk/hlvm/Pass/ResolveTypes.h (added)
+++ hlvm/trunk/hlvm/Pass/ResolveTypes.h Sat Jul  7 18:59:47 2007
@@ -0,0 +1,91 @@
+//===-- Type Resolution Pass ------------------------------------*- 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 hlvm/Pass/ResolveTypes.h
+/// @author Reid Spencer <rspencer at reidspencer.org> (original author)
+/// @date 2006/05/19
+/// @since 0.1.0
+/// @brief Declares the class hlvm::Pass::ResolveTypes
+//===----------------------------------------------------------------------===//
+
+#ifndef HLVM_PASS_RESOLVETYPES_H
+#define HLVM_PASS_RESOLVETYPES_H
+
+#include <hlvm/AST/Pass.h>
+
+namespace hlvm { 
+  using namespace AST;
+  
+namespace Pass {
+
+  /// This class provides a type resolution capability. It searches for 
+  /// instances of OpaqueType and resolves all their uses to the correct actual
+  /// type.
+  /// @brief Type Resolution Pass
+  class ResolveTypes : public Pass 
+  {
+    /// @}
+    /// @name Constructors
+    /// @{
+    protected:
+      ResolveTypes() : Pass(0);
+    public:
+      ~ResolveTypes();
+
+    /// @}
+    /// @name Handlers
+    /// @{
+    public:
+      /// Handle a Block node. Subclasses should override this; default 
+      /// implementation does nothing.
+      virtual void handle(Block* b);
+
+      /// Handle a Bundle node. Subclasses should override this; default 
+      /// implementation does nothing.
+      virtual void handle(Bundle* b);
+
+      /// Handle a Function node. Subclasses should override this; default 
+      /// implementation does nothing.
+      virtual void handle(Function* f);
+
+      /// Handle a Program node. Subclasses should override this; default 
+      /// implementation does nothing.
+      virtual void handle(Program* p);
+
+      /// Handle a Operator node. Subclasses should override this; default 
+      /// implementation does nothing.
+      virtual void handle(Operator* o);
+
+      /// Handle a Type node. Subclasses should override this; default 
+      /// implementation does nothing.
+      virtual void handle(Type* t);
+
+    /// @}
+    /// @name Data
+    /// @{
+    protected:
+      int interest;
+    /// @}
+  };
+} // AST
+} // hlvm
+#endif

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

==============================================================================
--- hlvm/trunk/hlvm/Pass/SConscript (added)
+++ hlvm/trunk/hlvm/Pass/SConscript Sat Jul  7 18:59:47 2007
@@ -0,0 +1,27 @@
+#===-- Build Script For hlvm/AST ------------------------------*- 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')
+lib = env.StaticLibrary('HLVMPass',hlvm.GetAllCXXFiles(env))
+hlvm.InstallLibrary(env,lib)
+hlvm.InstallHeader(env,hlvm.GetFiles(env,'*.h'))

Added: hlvm/trunk/hlvm/Pass/Validate.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Pass/Validate.cpp?rev=38096&view=auto

==============================================================================
--- hlvm/trunk/hlvm/Pass/Validate.cpp (added)
+++ hlvm/trunk/hlvm/Pass/Validate.cpp Sat Jul  7 18:59:47 2007
@@ -0,0 +1,56 @@
+//===-- AST Validation Pass -------------------------------------*- 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 hlvm/Pass/Validate.cpp
+/// @author Reid Spencer <rspencer at reidspencer.org> (original author)
+/// @date 2006/05/18
+/// @since 0.1.0
+/// @brief Implements the functions of class hlvm::Pass::Validate.
+//===----------------------------------------------------------------------===//
+
+#include <hlvm/Pass/Validate.h>
+
+using namespace hlvm;
+
+namespace {
+class ValidateImpl : public Validate
+{
+  public:
+    ValidateImpl() : Validate(0) {}
+    virtual void handle(Node* b);
+};
+
+void
+ValidateImpl::handle(Node* b)
+{
+}
+
+}
+
+Validate::~Validate()
+{
+}
+
+Validate* new_Validate()
+{
+  return new ValidateImpl();
+}

Added: hlvm/trunk/hlvm/Pass/Validate.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Pass/Validate.h?rev=38096&view=auto

==============================================================================
--- hlvm/trunk/hlvm/Pass/Validate.h (added)
+++ hlvm/trunk/hlvm/Pass/Validate.h Sat Jul  7 18:59:47 2007
@@ -0,0 +1,56 @@
+//===-- Abstract Syntax Tree Validation Pass --------------------*- 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 hlvm/Pass/Validate.h
+/// @author Reid Spencer <rspencer at reidspencer.org> (original author)
+/// @date 2006/05/19
+/// @since 0.1.0
+/// @brief Declares the class hlvm::Pass::Validate
+//===----------------------------------------------------------------------===//
+
+#ifndef HLVM_PASS_VALIDATE_H
+#define HLVM_PASS_VALIDATE_H
+
+#include <hlvm/AST/Pass.h>
+
+namespace hlvm 
+{
+
+/// This class provides a type resolution capability. It searches for 
+/// instances of OpaqueType and resolves all their uses to the correct actual
+/// type.
+/// @brief Type Resolution Pass
+class Validate : public Pass 
+{
+  /// @name Constructors
+  /// @{
+  protected:
+    Validate(int interest) : Pass(interest) {}
+  public:
+    Validate* new_Validate();
+    virtual ~Validate();
+
+  /// @}
+};
+
+} // hlvm
+#endif

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

==============================================================================
--- hlvm/trunk/hlvm/SConscript (original)
+++ hlvm/trunk/hlvm/SConscript Sat Jul  7 18:59:47 2007
@@ -22,4 +22,4 @@
 #===----------------------------------------------------------------------===#
 from build import hlvm
 Import('env')
-hlvm.Dirs(env,['Base','AST','Reader','Writer'])
+hlvm.Dirs(env,['Base','AST','Pass','Reader','Writer'])





More information about the llvm-commits mailing list