[llvm-commits] [hlvm] r38139 - in /hlvm/trunk: hlvm/AST/ hlvm/CodeGen/ hlvm/Pass/ hlvm/Reader/XML/ hlvm/Writer/XML/ test/lib/ test/return0/

Reid Spencer reid at x10sys.com
Sat Jul 7 17:00:14 PDT 2007


Author: reid
Date: Sat Jul  7 19:00:13 2007
New Revision: 38139

URL: http://llvm.org/viewvc/llvm-project?rev=38139&view=rev
Log:
Changes to get the helloworld.hlx and return0.hlx tests handled
properly through XML parsing. This involved separating the notion
of Constant, Value, and Operator. The return0.hlx program now
generates valid X86 assembly. The helloworld.hlx program needs
a little more work before the compiler can turn it into code.

Added:
    hlvm/trunk/hlvm/AST/Constant.cpp
    hlvm/trunk/hlvm/AST/Constant.h
    hlvm/trunk/hlvm/CodeGen/string.h
Modified:
    hlvm/trunk/hlvm/AST/AST.cpp
    hlvm/trunk/hlvm/AST/AST.h
    hlvm/trunk/hlvm/AST/Constants.cpp
    hlvm/trunk/hlvm/AST/Constants.h
    hlvm/trunk/hlvm/AST/ControlFlow.h
    hlvm/trunk/hlvm/AST/LinkageItem.h
    hlvm/trunk/hlvm/AST/Node.h
    hlvm/trunk/hlvm/AST/Operator.cpp
    hlvm/trunk/hlvm/AST/Operator.h
    hlvm/trunk/hlvm/AST/Type.h
    hlvm/trunk/hlvm/AST/Variable.h
    hlvm/trunk/hlvm/CodeGen/LLVMGenerator.cpp
    hlvm/trunk/hlvm/CodeGen/program.cxx
    hlvm/trunk/hlvm/CodeGen/string.cxx
    hlvm/trunk/hlvm/Pass/Pass.cpp
    hlvm/trunk/hlvm/Pass/Pass.h
    hlvm/trunk/hlvm/Pass/Validate.cpp
    hlvm/trunk/hlvm/Reader/XML/HLVM.rng
    hlvm/trunk/hlvm/Reader/XML/XMLReader.cpp
    hlvm/trunk/hlvm/Writer/XML/XMLWriter.cpp
    hlvm/trunk/test/lib/return0.exp
    hlvm/trunk/test/return0/helloworld.hlx

Modified: hlvm/trunk/hlvm/AST/AST.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/AST.cpp?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/AST/AST.cpp (original)
+++ hlvm/trunk/hlvm/AST/AST.cpp Sat Jul  7 19:00:13 2007
@@ -180,6 +180,25 @@
   return static_cast<const ASTImpl*>(this)->resolveType(name);
 }
 
+SignatureType* 
+AST::getProgramType() const
+{
+  ASTImpl* ast = const_cast<ASTImpl*>(static_cast<const ASTImpl*>(this));
+  if (!ast->ProgramTypeSingleton) {
+    ast->ProgramTypeSingleton = new SignatureType();
+    ast->ProgramTypeSingleton->setLocator(loc);
+    ast->ProgramTypeSingleton->setName("ProgramType");
+    Type* intType = ast->getPrimitiveType(SInt32TypeID);
+    ast->ProgramTypeSingleton->setResultType(intType);
+    ArrayType* arg_array = ast->new_ArrayType("arg_array",
+      ast->new_TextType("string",loc),0,loc);
+    PointerType* args = ast->new_PointerType("arg_array_ptr",arg_array,loc);
+    Argument* param = ast->new_Argument("args",args,loc);
+    ast->ProgramTypeSingleton->addArgument(param);
+  }
+  return ast->ProgramTypeSingleton;
+}
+
 Locator*
 AST::new_Locator(const URI* uri, uint32_t line, uint32_t col, uint32_t line2,
     uint32_t col2)
@@ -411,11 +430,39 @@
   return new OpaqueType(id);
 }
 
-ConstLiteralInteger*
-AST::new_ConstLiteralInteger(const Locator* loc)
+ConstantInteger*
+AST::new_ConstantInteger(uint64_t v, const Locator* loc)
+{
+  ConstantInteger* result = new ConstantInteger();
+  result->setLocator(loc);
+  result->setValue(v);
+  return result;
+}
+
+ConstantReal*
+AST::new_ConstantReal(double v, const Locator* loc)
 {
-  ConstLiteralInteger* result = new ConstLiteralInteger();
+  ConstantReal* result = new ConstantReal();
   result->setLocator(loc);
+  result->setValue(v);
+  return result;
+}
+
+ConstantText*
+AST::new_ConstantText(const std::string& v, const Locator* loc)
+{
+  ConstantText* result = new ConstantText();
+  result->setLocator(loc);
+  result->setValue(v);
+  return result;
+}
+
+ConstantZero*
+AST::new_ConstantZero(const Type* Ty, const Locator* loc)
+{
+  ConstantZero* result = new ConstantZero();
+  result->setLocator(loc);
+  result->setType(Ty);
   return result;
 }
 
@@ -441,24 +488,13 @@
 Program*
 AST::new_Program(const std::string& id, const Locator* loc)
 {
+  SignatureType* program_type = getProgramType();
   ASTImpl* ast = static_cast<ASTImpl*>(this);
-  if (!ast->ProgramTypeSingleton) {
-    ast->ProgramTypeSingleton = new SignatureType();
-    ast->ProgramTypeSingleton->setLocator(loc);
-    ast->ProgramTypeSingleton->setName(id);
-    Type* intType = getPrimitiveType(SInt32TypeID);
-    ast->ProgramTypeSingleton->setResultType(intType);
-    ArrayType* arg_array = new_ArrayType("arg_array",
-      new_TextType("string",loc),0,loc);
-    PointerType* args = new_PointerType("arg_array_ptr",arg_array,loc);
-    Argument* param = new_Argument("args",args,loc);
-    ast->ProgramTypeSingleton->addArgument(param);
-  }
 
   Program* result = new Program();
   result->setLocator(loc);
   result->setName(id);
-  result->setSignature(ast->ProgramTypeSingleton); 
+  result->setSignature(program_type);
   result->setLinkageKind(ExternalLinkage);
   return result;
 }

Modified: hlvm/trunk/hlvm/AST/AST.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/AST.h?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/AST/AST.h (original)
+++ hlvm/trunk/hlvm/AST/AST.h Sat Jul  7 19:00:13 2007
@@ -51,7 +51,10 @@
 class SignatureType;
 class StructureType;
 class Variable; 
-class ConstLiteralInteger;
+class ConstantInteger;
+class ConstantReal;
+class ConstantText;
+class ConstantZero;
 class ReturnOp;
 class AliasType;
 class Pool;
@@ -88,6 +91,7 @@
     const std::string& getSystemID() const { return sysid; }
     const std::string& getPublicID() const { return pubid; }
     Pool* getPool() const { return pool; }
+    SignatureType* getProgramType() const;
 
   /// @}
   /// @name Mutators
@@ -393,10 +397,27 @@
       const Type* ty,         ///< The type of the variable
       const Locator* loc = 0  ///< The source locator
     );
-    /// Create a new ConstantLiteralInteger node.
-    ConstLiteralInteger* new_ConstLiteralInteger(
+    /// Create a new ConstantZero node
+    ConstantZero* new_ConstantZero(
+      const Type* Ty,         ///< The type for the constant zero
       const Locator* loc = 0  ///< The source locator
     );
+    /// Create a new ConstantInteger node.
+    ConstantInteger* new_ConstantInteger(
+      uint64_t value,         ///< The value of the ConstantInteger
+      const Locator* loc = 0  ///< The source locator
+    );
+    /// Create a new ConstantInteger node.
+    ConstantReal* new_ConstantReal(
+      double value,           ///< The value of the ConstantReal
+      const Locator* loc = 0  ///< The source locator
+    );
+    /// Create a new ConstantText node.
+    ConstantText* new_ConstantText(
+      const std::string& value, ///< The value of the ConstantText
+      const Locator* loc = 0    ///< The source locator
+    );
+    /// Create a new ConstantText node.
     /// Create a new ReturnOp node. The ReturnOp is an operator that returns
     /// immediately from the enclosing function, possibly with a result value.
     ReturnOp* new_ReturnOp(

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

==============================================================================
--- hlvm/trunk/hlvm/AST/Constant.cpp (added)
+++ hlvm/trunk/hlvm/AST/Constant.cpp Sat Jul  7 19:00:13 2007
@@ -0,0 +1,38 @@
+//===-- AST Constant Node ---------------------------------------*- 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/Constant.cpp
+/// @author Reid Spencer <rspencer at reidspencer.com> (original author)
+/// @date 2006/06/02
+/// @since 0.1.0
+/// @brief Implements the functions of class hlvm::Constant.
+//===----------------------------------------------------------------------===//
+
+#include <hlvm/AST/Constant.h>
+
+namespace hlvm {
+
+Constant::~Constant()
+{
+}
+
+}

Added: hlvm/trunk/hlvm/AST/Constant.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Constant.h?rev=38139&view=auto

==============================================================================
--- hlvm/trunk/hlvm/AST/Constant.h (added)
+++ hlvm/trunk/hlvm/AST/Constant.h Sat Jul  7 19:00:13 2007
@@ -0,0 +1,68 @@
+//===-- AST Constant Abstract Class -----------------------------*- 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/Constant.h
+/// @author Reid Spencer <rspencer at reidspencer.com> (original author)
+/// @date 2006/05/25
+/// @since 0.1.0
+/// @brief Declares the AST Constant Class
+//===----------------------------------------------------------------------===//
+
+#ifndef HLVM_AST_CONSTANT_H
+#define HLVM_AST_CONSTANT_H
+
+#include <hlvm/AST/Node.h>
+
+namespace hlvm 
+{
+
+/// This abstract base class represents a constant value in the HLVM Abstract 
+/// Syntax Tree.  All ConstantValues are immutable values of a specific type. 
+/// ConstantValues do not have a storage location nor an address. However, 
+/// as they are values they may be used as the operand of any instruction or
+/// in other places.  ConstantValues are not suitable for linking. For that
+/// kind of constant you want the Constant class in Variable.h. 
+/// There are many kinds of ConstantValues from simple literal values to 
+/// complex constant expressions. 
+/// @brief HLVM AST Constant Node
+class Constant : public Value
+{
+  /// @name Constructors
+  /// @{
+  protected:
+    Constant(NodeIDs id) : Value(id) {}
+  public:
+    virtual ~Constant();
+
+  /// @}
+  /// @name Accessors
+  /// @{
+  public:
+    static inline bool classof(const Constant*) { return true; }
+    static inline bool classof(const Node* N) { return N->isConstant(); }
+
+  /// @}
+  friend class AST;
+};
+
+} // end hlvm namespace
+#endif

Modified: hlvm/trunk/hlvm/AST/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Constants.cpp?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/AST/Constants.cpp (original)
+++ hlvm/trunk/hlvm/AST/Constants.cpp Sat Jul  7 19:00:13 2007
@@ -32,24 +32,20 @@
 
 namespace hlvm {
 
-ConstLiteralInteger::~ConstLiteralInteger()
+ConstantInteger::~ConstantInteger()
 {
 }
 
-ConstLiteralInteger* 
-ConstLiteralInteger::create()
+ConstantReal::~ConstantReal()
 {
-  return new ConstLiteralInteger;
 }
 
-ConstLiteralString::~ConstLiteralString()
+ConstantText::~ConstantText()
 {
 }
 
-ConstLiteralString* 
-ConstLiteralString::create()
+ConstantZero::~ConstantZero()
 {
-  return new ConstLiteralString;
 }
 
 }

Modified: hlvm/trunk/hlvm/AST/Constants.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Constants.h?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/AST/Constants.h (original)
+++ hlvm/trunk/hlvm/AST/Constants.h Sat Jul  7 19:00:13 2007
@@ -30,7 +30,7 @@
 #ifndef HLVM_AST_CONSTANTS_H
 #define HLVM_AST_CONSTANTS_H
 
-#include <hlvm/AST/Operator.h>
+#include <hlvm/AST/Constant.h>
 
 namespace hlvm 
 {
@@ -38,16 +38,13 @@
 /// This class represents an operator that yields a literal constant integer 
 /// value.
 /// @brief HLVM AST Constant Integer Node
-class ConstLiteralInteger : public NilaryOperator
+class ConstantInteger: public Constant
 {
   /// @name Constructors
   /// @{
-  public:
-    static ConstLiteralInteger* create();
-
   protected:
-    ConstLiteralInteger() : NilaryOperator(ConstLiteralIntegerOpID) {}
-    virtual ~ConstLiteralInteger();
+    ConstantInteger() : Constant(ConstantIntegerID) {}
+    virtual ~ConstantInteger();
 
   /// @}
   /// @name Accessors
@@ -55,9 +52,9 @@
   public:
     uint64_t getValue(int) const { return value.u; }
     int64_t  getValue()    const { return value.s; }
-    static inline bool classof(const ConstLiteralInteger*) { return true; }
+    static inline bool classof(const ConstantInteger*) { return true; }
     static inline bool classof(const Node* N) 
-      { return N->is(ConstLiteralIntegerOpID); }
+      { return N->is(ConstantIntegerID); }
 
   /// @}
   /// @name Accessors
@@ -78,25 +75,55 @@
   friend class AST;
 };
 
-class ConstLiteralString : public NilaryOperator
+class ConstantReal : public Constant
 {
   /// @name Constructors
   /// @{
+  protected:
+    ConstantReal() : Constant(ConstantTextID)  {}
+    virtual ~ConstantReal();
+
+  /// @}
+  /// @name Accessors
+  /// @{
+  public:
+    double getValue() { return value; }
+    static inline bool classof(const ConstantReal*) { return true; }
+    static inline bool classof(const Node* N) 
+      { return N->is(ConstantRealID); }
+
+  /// @}
+  /// @name Accessors
+  /// @{
+  public:
+    void setValue(double v ) { value = v; }
+
+  /// @}
+  /// @name Data
+  /// @{
   public:
-    static ConstLiteralString* create();
+    double value;
+  /// @}
+  friend class AST;
+};
 
+/// A constant textual string
+class ConstantText : public Constant
+{
+  /// @name Constructors
+  /// @{
   protected:
-    ConstLiteralString() : NilaryOperator(ConstLiteralStringOpID)  {}
-    virtual ~ConstLiteralString();
+    ConstantText() : Constant(ConstantTextID)  {}
+    virtual ~ConstantText();
 
   /// @}
   /// @name Accessors
   /// @{
   public:
     const std::string&  getValue() { return value; }
-    static inline bool classof(const ConstLiteralString*) { return true; }
+    static inline bool classof(const ConstantText*) { return true; }
     static inline bool classof(const Node* N) 
-      { return N->is(ConstLiteralStringOpID); }
+      { return N->is(ConstantTextID); }
 
   /// @}
   /// @name Accessors
@@ -113,5 +140,28 @@
   friend class AST;
 };
 
-} // hlvm 
+/// A zero initializer constant. It represents a constant of any type whose
+/// entire data is filled with zero bytes.
+class ConstantZero : public Constant
+{
+  /// @name Constructors
+  /// @{
+  protected:
+    ConstantZero() : Constant(ConstantZeroID)  {}
+    virtual ~ConstantZero();
+
+  /// @}
+  /// @name Accessors
+  /// @{
+  public:
+    static inline bool classof(const ConstantZero*) { return true; }
+    static inline bool classof(const Node* N) 
+      { return N->is(ConstantTextID); }
+
+  /// @}
+  friend class AST;
+};
+
+} // end hlvm namespace
+
 #endif

Modified: hlvm/trunk/hlvm/AST/ControlFlow.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/ControlFlow.h?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/AST/ControlFlow.h (original)
+++ hlvm/trunk/hlvm/AST/ControlFlow.h Sat Jul  7 19:00:13 2007
@@ -54,7 +54,7 @@
   /// @name Accessors
   /// @{
   public:
-    Operator* getResult() { return UnaryOperator::op1; }
+    Value* getResult() { return UnaryOperator::op1; }
     static inline bool classof(const ReturnOp*) { return true; }
     static inline bool classof(const Node* N) { return N->is(ReturnOpID); }
 
@@ -62,7 +62,7 @@
   /// @name Accessors
   /// @{
   public:
-    void setResult(Operator* op) { op->setParent(this); }
+    void setResult(Value* op) { op->setParent(this); }
   /// @}
   friend class AST;
 };

Modified: hlvm/trunk/hlvm/AST/LinkageItem.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/LinkageItem.h?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/AST/LinkageItem.h (original)
+++ hlvm/trunk/hlvm/AST/LinkageItem.h Sat Jul  7 19:00:13 2007
@@ -30,7 +30,7 @@
 #ifndef HLVM_AST_LINKAGEITEM_H
 #define HLVM_AST_LINKAGEITEM_H
 
-#include <hlvm/AST/Node.h>
+#include <hlvm/AST/Constant.h>
 
 namespace hlvm
 {
@@ -50,12 +50,12 @@
 /// elsewhere and linked into another bundle to resolve the reference. The
 /// LinkageItem declares what kind of linkage is to be performed.
 /// @brief HLVM AST Bundle Node
-class LinkageItem : public Value
+class LinkageItem : public Constant
 {
   /// @name Constructors
   /// @{
   protected:
-    LinkageItem( NodeIDs id ) : Value(id), kind(InternalLinkage), name() {}
+    LinkageItem( NodeIDs id ) : Constant(id), kind(InternalLinkage), name() {}
   public:
     virtual ~LinkageItem();
 

Modified: hlvm/trunk/hlvm/AST/Node.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Node.h?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/AST/Node.h (original)
+++ hlvm/trunk/hlvm/AST/Node.h Sat Jul  7 19:00:13 2007
@@ -80,7 +80,7 @@
   EnumerationTypeID,       ///< The Enumeration Type (set of enumerated ids)
   RealTypeID,              ///< The Real Number Type (Any Real Number)
   RationalTypeID,          ///< The Rational Number Type (p/q type number)
-  TextTypeID,              ///< The Text Type (Array of UTF-16 chars + length)
+  TextTypeID = 26,         ///< The Text Type (Array of UTF-16 chars + length)
 
   // Container Types
   AliasTypeID,             ///< A new name for an existing type
@@ -90,7 +90,7 @@
   StructureTypeID,         ///< The Structure Type (Sequence of various types)
   SignatureTypeID,         ///< The Function Signature Type
   ContinuationTypeID,      ///< A Continuation Type (data to continuations)
-  OpaqueTypeID,            ///< A placeholder for unresolved types
+  OpaqueTypeID = 34,       ///< A placeholder for unresolved types
 
   // Class Constructs (TBD)
   InterfaceID,             ///< The Interface Type (set of Signatures)
@@ -98,6 +98,12 @@
   MethodID,                ///< The Method Node (define a method)
   ImplementsID,            ///< Specifies set of Interfaces implemented by class
 
+  // Constants
+  ConstantZeroID,          ///< A zero-filled constant of any type
+  ConstantIntegerID,       ///< A constant integer value
+  ConstantRealID,          ///< A constant real value
+  ConstantTextID,          ///< A constant text value
+
   // Linkage Items
   VariableID,              ///< The Variable Node (a storage location)
   FunctionID,              ///< The Function Node (a callable function)
@@ -110,9 +116,6 @@
 
   // Nilary Operators (those taking no operands)
   BreakOpID,               ///< Break out of the enclosing loop
-  ConstLiteralIntegerOpID, ///< Constant Literal Integer
-  ConstLiteralRealOpID,    ///< Constant Literal Real
-  ConstLiteralStringOpID,  ///< Constant Literal String
   PInfOpID,                ///< Constant Positive Infinity Real Value
   NInfOpID,                ///< Constant Negative Infinity Real Value
   NaNOpID,                 ///< Constant Not-A-Number Real Value
@@ -226,6 +229,8 @@
   LastContainerTypeID  = ContinuationTypeID, ///< Last Container Type
   FirstTypeID          = VoidTypeID,
   LastTypeID           = OpaqueTypeID,
+  FirstConstantID      = ConstantIntegerID,
+  LastConstantID       = ProgramID,
   FirstOperatorID      = BreakOpID, ///< First Operator
   LastOperatorID       = LoopOpID,  ///< Last Operator
   FirstNilaryOpID      = BreakOpID,
@@ -250,7 +255,7 @@
   /// @name Constructors
   /// @{
   protected:
-    Node(NodeIDs ID) : id(ID), parent(0), loc(0) {}
+    Node(NodeIDs ID) : id(ID), flags(0), parent(0), loc(0) {}
   public:
     virtual ~Node();
 
@@ -316,6 +321,11 @@
     inline bool isSignatureType() const { return id == SignatureTypeID; }
     inline bool isVoidType() const { return id == VoidTypeID; }
 
+    /// Determine if the node is one of the Constant values.
+    inline bool isConstant() const {
+      return id >= FirstConstantID && id <= LastConstantID;
+    }
+
     /// Determine if the node is any of the Operators
     inline bool isOperator() const { 
       return id >= FirstOperatorID && id <= LastOperatorID;
@@ -345,7 +355,7 @@
     }
 
     /// Determine if the node is a Value
-    bool isValue() const { return isLinkageItem() || isOperator(); }
+    bool isValue() const { return isOperator() || isConstant(); }
 
     /// Determine if the node is a Block
     inline bool isBlock() const { return id == BlockID; }
@@ -385,10 +395,10 @@
   /// @name Data
   /// @{
   protected:
-    unsigned id : 8;         ///< Really a value in NodeIDs
-    unsigned flags : 24;     ///< 24 boolean flags, subclass dependent interp.
-    Node* parent;            ///< The node that owns this node.
-    const Locator* loc;      ///< The source location corresponding to node.
+    uint16_t id;         ///< Really a value in NodeIDs
+    uint16_t flags;      ///< 16 flags, subclass dependent interpretation
+    Node* parent;        ///< The node that owns this node.
+    const Locator* loc;  ///< The source location corresponding to node.
   /// @}
   friend class AST;
 };

Modified: hlvm/trunk/hlvm/AST/Operator.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Operator.cpp?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/AST/Operator.cpp (original)
+++ hlvm/trunk/hlvm/AST/Operator.cpp Sat Jul  7 19:00:13 2007
@@ -43,7 +43,7 @@
 {
 }
 
-Operator*
+Value*
 NilaryOperator::getOperand(unsigned idx) const
 {
   hlvmAssert(!"Can't get operands from a NilaryOperator");
@@ -72,7 +72,7 @@
 {
 }
 
-Operator*
+Value*
 UnaryOperator::getOperand(unsigned idx) const
 {
   assert(idx == 0 && "Operand index out of range");
@@ -88,9 +88,9 @@
 void 
 UnaryOperator::insertChild(Node* child)
 {
-  hlvmAssert(isa<Operator>(child));
+  hlvmAssert(isa<Value>(child));
   if (!op1)
-    op1 = cast<Operator>(child);
+    op1 = cast<Value>(child);
   else
     hlvmAssert("UnaryOperator full");
 }
@@ -98,7 +98,7 @@
 void 
 UnaryOperator::removeChild(Node* child)
 {
-  hlvmAssert(isa<Operator>(child));
+  hlvmAssert(isa<Value>(child));
   if (op1 == child) {
     op1 = 0;
   } else
@@ -109,7 +109,7 @@
 {
 }
 
-Operator*
+Value*
 BinaryOperator::getOperand(unsigned idx) const
 {
   assert(idx <= 1 && "Operand index out of range");
@@ -125,11 +125,11 @@
 void 
 BinaryOperator::insertChild(Node* child)
 {
-  hlvmAssert(isa<Operator>(child));
+  hlvmAssert(isa<Value>(child));
   if (!ops[0])
-    ops[0] = cast<Operator>(child);
+    ops[0] = cast<Value>(child);
   else if (!ops[1])
-    ops[1] = cast<Operator>(child);
+    ops[1] = cast<Value>(child);
   else
     hlvmAssert(!"BinaryOperator full!");
 }
@@ -137,7 +137,7 @@
 void 
 BinaryOperator::removeChild(Node* child)
 {
-  hlvmAssert(isa<Operator>(child));
+  hlvmAssert(isa<Value>(child));
   if (ops[0] == child)
     ops[0] = 0;
   else if (ops[1] == child)
@@ -150,7 +150,7 @@
 {
 }
 
-Operator*
+Value*
 TernaryOperator::getOperand(unsigned idx) const
 {
   assert(idx <= 2 && "Operand index out of range");
@@ -166,13 +166,13 @@
 void 
 TernaryOperator::insertChild(Node* child)
 {
-  hlvmAssert(isa<Operator>(child));
+  hlvmAssert(isa<Value>(child));
   if (!ops[0])
-    ops[0] = cast<Operator>(child);
+    ops[0] = cast<Value>(child);
   else if (!ops[1])
-    ops[1] = cast<Operator>(child);
+    ops[1] = cast<Value>(child);
   else if (!ops[2])
-    ops[2] = cast<Operator>(child);
+    ops[2] = cast<Value>(child);
   else
     hlvmAssert(!"TernaryOperator full!");
 }
@@ -180,7 +180,7 @@
 void 
 TernaryOperator::removeChild(Node* child)
 {
-  hlvmAssert(isa<Operator>(child));
+  hlvmAssert(isa<Value>(child));
   if (ops[0] == child)
     ops[0] = 0;
   else if (ops[1] == child)
@@ -195,7 +195,7 @@
 {
 }
 
-Operator*
+Value*
 MultiOperator::getOperand(unsigned idx) const
 {
   assert(idx <= ops.size() && "Operand index out of range");
@@ -211,14 +211,14 @@
 void 
 MultiOperator::insertChild(Node* child)
 {
-  hlvmAssert(isa<Operator>(child));
-  ops.push_back(cast<Operator>(child));
+  hlvmAssert(isa<Value>(child));
+  ops.push_back(cast<Value>(child));
 }
 
 void 
 MultiOperator::removeChild(Node* child)
 {
-  hlvmAssert(isa<Operator>(child));
+  hlvmAssert(isa<Value>(child));
   for (iterator I = begin(), E = end(); I != E; ++I ) {
       if (*I == child) { ops.erase(I); return; }
   }

Modified: hlvm/trunk/hlvm/AST/Operator.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Operator.h?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/AST/Operator.h (original)
+++ hlvm/trunk/hlvm/AST/Operator.h Sat Jul  7 19:00:13 2007
@@ -54,7 +54,7 @@
   public:
     /// Get a specific operand of this operator.
     virtual size_t  numOperands() const = 0;
-    virtual Operator* getOperand(unsigned opnum) const = 0;
+    virtual Value* getOperand(unsigned opnum) const = 0;
 
     /// Determine if this is a classof some other type.
     static inline bool classof(const Operator*) { return true; }
@@ -78,7 +78,7 @@
   /// @{
   public:
     virtual size_t  numOperands() const;
-    virtual Operator* getOperand(unsigned opnum) const;
+    virtual Value* getOperand(unsigned opnum) const;
     static inline bool classof(const NilaryOperator*) { return true; }
     static inline bool classof(const Node* N) { return N->isNilaryOperator(); }
 
@@ -105,7 +105,7 @@
   /// @{
   public:
     virtual size_t  numOperands() const;
-    virtual Operator* getOperand(unsigned opnum) const;
+    virtual Value* getOperand(unsigned opnum) const;
     static inline bool classof(const UnaryOperator*) { return true; }
     static inline bool classof(const Node* N) { return N->isUnaryOperator(); }
 
@@ -115,12 +115,13 @@
   protected:
     virtual void insertChild(Node* child);
     virtual void removeChild(Node* child);
+    virtual void setOperand(Value* oprnd) { op1 = oprnd; }
 
   /// @}
   /// @name Data
   /// @{
   protected:
-    Operator* op1;
+    Value* op1;
   /// @}
   friend class AST;
 };
@@ -139,7 +140,7 @@
   /// @{
   public:
     virtual size_t  numOperands() const;
-    virtual Operator* getOperand(unsigned opnum) const;
+    virtual Value* getOperand(unsigned opnum) const;
     static inline bool classof(const BinaryOperator*) { return true; }
     static inline bool classof(const Node* N) { return N->isBinaryOperator(); }
 
@@ -154,7 +155,7 @@
   /// @name Data
   /// @{
   protected:
-    Operator* ops[2];
+    Value* ops[2];
   /// @}
   friend class AST;
 };
@@ -173,7 +174,7 @@
   /// @{
   public:
     virtual size_t  numOperands() const;
-    virtual Operator* getOperand(unsigned opnum) const;
+    virtual Value* getOperand(unsigned opnum) const;
     static inline bool classof(const TernaryOperator*) { return true; }
     static inline bool classof(const Node* N) { return N->isTernaryOperator(); }
 
@@ -188,7 +189,7 @@
   /// @name Data
   /// @{
   protected:
-    Operator* ops[3];
+    Value* ops[3];
   /// @}
   friend class AST;
 };
@@ -198,9 +199,9 @@
   /// @name Types
   /// @{
   public:
-    typedef std::vector<Operator*> OpList;
-    typedef OpList::iterator iterator;
-    typedef OpList::const_iterator const_iterator;
+    typedef std::vector<Value*> OprndList;
+    typedef OprndList::iterator iterator;
+    typedef OprndList::const_iterator const_iterator;
 
   /// @}
   /// @name Constructors
@@ -214,7 +215,7 @@
   /// @{
   public:
     virtual size_t  numOperands() const;
-    virtual Operator* getOperand(unsigned opnum) const;
+    virtual Value* getOperand(unsigned opnum) const;
     static inline bool classof(const MultiOperator*) { return true; }
     static inline bool classof(const Node* N) { return N->isMultiOperator(); }
 
@@ -228,16 +229,16 @@
     const_iterator end  () const { return ops.end(); }
     size_t         size () const { return ops.size(); }
     bool           empty() const { return ops.empty(); }
-    Operator*      front()       { return ops.front(); }
-    const Operator*front() const { return ops.front(); }
-    Operator*      back()        { return ops.back(); }
-    const Operator*back()  const { return ops.back(); }
+    Value*         front()       { return ops.front(); }
+    const Value*   front() const { return ops.front(); }
+    Value*         back()        { return ops.back(); }
+    const Value*   back()  const { return ops.back(); }
 
   /// @}
   /// @name Mutators
   /// @{
   public:
-    void addOperand(Operator* op) { op->setParent(this); }
+    void addOperand(Value* v) { v->setParent(this); }
   protected:
     virtual void insertChild(Node* child);
     virtual void removeChild(Node* child);
@@ -246,7 +247,7 @@
   /// @name Data
   /// @{
   protected:
-    OpList ops; ///< The operands of this Operator
+    OprndList ops; ///< The operands of this Operator
   /// @}
   friend class AST;
 };

Modified: hlvm/trunk/hlvm/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Type.h?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/AST/Type.h (original)
+++ hlvm/trunk/hlvm/AST/Type.h Sat Jul  7 19:00:13 2007
@@ -407,8 +407,8 @@
   /// @name Data
   /// @{
   protected:
-    uint32_t mantissa;  ///< Number of decimal digits in mantissa
-    uint32_t exponent; ///< Number of decimal digits of precision
+    uint32_t mantissa; ///< Number of bits in mantissa
+    uint32_t exponent; ///< Number of bits of precision
   /// @}
   friend class AST;
 };

Modified: hlvm/trunk/hlvm/AST/Variable.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Variable.h?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/AST/Variable.h (original)
+++ hlvm/trunk/hlvm/AST/Variable.h Sat Jul  7 19:00:13 2007
@@ -36,6 +36,7 @@
 {
 
 class Type; // Forward declare
+class Constant;
 
 /// This class represents an Variable in the HLVM Abstract Syntax Tree.  
 /// A Variable is a storage location of a specific type. It can either be
@@ -47,8 +48,6 @@
 {
   /// @name Constructors
   /// @{
-  public:
-    static Variable* create(const Locator& loc, std::string name);
   protected:
     Variable() : LinkageItem(VariableID) {}
   public:
@@ -58,21 +57,24 @@
   /// @name Accessors
   /// @{
   public:
-    const Type* getType() const { return type; }
+    bool isConstant() { return isConst; }
+    Constant* getInitializer() { return init; }
     static inline bool classof(const Variable*) { return true; }
     static inline bool classof(const Node* N) { return N->isVariable(); }
 
   /// @}
-  /// @name Accessors
+  /// @name Mutators
   /// @{
   public:
-    void setType(const Type* t) { type = t; }
+    void setIsConstant(bool v) { isConst = v; }
+    void setInitializer(Constant* C) { init = C; }
 
   /// @}
   /// @name Data
   /// @{
   protected:
-    const Type* type; ///< The type of the variable
+    Constant* init;
+    bool isConst;
   /// @}
   friend class AST;
 };

Modified: hlvm/trunk/hlvm/CodeGen/LLVMGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/CodeGen/LLVMGenerator.cpp?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/CodeGen/LLVMGenerator.cpp (original)
+++ hlvm/trunk/hlvm/CodeGen/LLVMGenerator.cpp Sat Jul  7 19:00:13 2007
@@ -96,14 +96,17 @@
   inline void gen(VectorType* t);
   inline void gen(StructureType* t);
   inline void gen(SignatureType* t);
-  inline void gen(ConstLiteralInteger* t);
+  inline void gen(ConstantInteger* t);
+  inline void gen(ConstantText* t);
   inline void gen(Variable* v);
   inline void gen(hlvm::Function* f);
   inline void gen(Program* p);
   inline void gen(Block* f);
   inline void gen(ReturnOp* f);
 
+  virtual void handleInitialize();
   virtual void handle(Node* n,Pass::TraversalKinds mode);
+  virtual void handleTerminate();
 
   inline llvm::Module* linkModules();
 
@@ -122,6 +125,7 @@
   const Bundle* bundle;      ///< The current Bundle we're traversing
   const hlvm::Function* function;  ///< The current Function we're traversing
   const Block* block;        ///< The current Block we're traversing
+  std::vector<llvm::Function*> progs; ///< The list of programs to emit at the end
 };
 
 
@@ -285,7 +289,7 @@
 }
 
 void 
-LLVMGeneratorPass::gen(ConstLiteralInteger* i)
+LLVMGeneratorPass::gen(ConstantInteger* i)
 {
   const hlvm::Type* hType = i->getType();
   const llvm::Type* lType = getType(hType);
@@ -296,6 +300,11 @@
 }
 
 void
+LLVMGeneratorPass::gen(ConstantText* t)
+{
+}
+
+void
 LLVMGeneratorPass::gen(Variable* v)
 {
 }
@@ -352,55 +361,19 @@
 void
 LLVMGeneratorPass::gen(Program* p)
 {
+  // points after the entire parse is completed.
+  std::string linkageName = getLinkageName(p);
+
+  // Get the FunctionType for entry points (programs)
   const llvm::FunctionType* entry_signature = 
     llvm::cast<llvm::FunctionType>(getType(p->getSignature()));
-  lfunc = new llvm::Function(entry_signature,
-    llvm::GlobalValue::InternalLinkage,getLinkageName(p),lmod);
-
-  /// Programs are stored in a global array of pointers to functions so the
-  /// VM can find them quickly. This array is called _hlvm_entry_points and it
-  /// uses LLVM's appending linkage to keep appending entry points to the end
-  /// of it. Here, we search for it and create it if we don't find it.
-  llvm::GlobalVariable *entry_points = 
-    lmod->getNamedGlobal("_hlvm_entry_points");
-  if (entry_points == 0) {
-    // Define the type of the array elements (a structure with a pointer to
-    // a string and a pointer to the function).
-    std::vector<const llvm::Type*> Fields;
-    Fields.push_back(llvm::PointerType::get(llvm::Type::SByteTy));
-    Fields.push_back(llvm::PointerType::get(entry_signature));
-    llvm::StructType* entry_elem_type = llvm::StructType::get(Fields);
-
-    // Define the type of the array for the entry points
-    llvm::ArrayType* array_type = llvm::ArrayType::get(entry_elem_type,1);
-
-    // Get a constant for the name of the entry point (char array)
-    llvm::Constant* name = llvm::ConstantArray::get(getLinkageName(p));
 
-    // Get a constant structure for the entry containing the name and pointer
-    // to the function.
-    std::vector<llvm::Constant*> items;
-    items.push_back(name);
-    items.push_back(lfunc);
-    llvm::Constant* entry = llvm::ConstantStruct::get(entry_elem_type,items);
-
-    // Get the constant array with the one entry
-    std::vector<llvm::Constant*> array_items;
-    array_items.push_back(entry);
-    llvm::Constant* array = llvm::ConstantArray::get(array_type,array_items);
-
-    // Now get the GlobalVariable
-    entry_points = new llvm::GlobalVariable(
-      /*Type=*/llvm::PointerType::get(array_type),
-      /*isConstant=*/true,
-      /*Linkage=*/llvm::GlobalValue::AppendingLinkage,
-      /*Initializer=*/array,
-      /*Name=*/"_hlvm_entry_points",
-      /*Parent=*/lmod
-    );
-  }
+  // Create a new function for the program based on the signature
+  lfunc = new llvm::Function(entry_signature,
+    llvm::GlobalValue::InternalLinkage,linkageName,lmod);
 
-  // Now that we have the entry points array
+  // Save the program so it can be generated into the list of program entry
+  progs.push_back(lfunc);
 }
 
 void
@@ -411,6 +384,11 @@
 }
 
 void
+LLVMGeneratorPass::handleInitialize()
+{
+}
+
+void
 LLVMGeneratorPass::handle(Node* n,Pass::TraversalKinds mode)
 {
   if (mode == Pass::PreOrderTraversal) {
@@ -444,7 +422,8 @@
     case VectorTypeID:            gen(llvm::cast<VectorType>(n)); break;
     case StructureTypeID:         gen(llvm::cast<StructureType>(n)); break;
     case SignatureTypeID:         gen(llvm::cast<SignatureType>(n)); break;
-    case ConstLiteralIntegerOpID: gen(llvm::cast<ConstLiteralInteger>(n));break;
+    case ConstantIntegerID:       gen(llvm::cast<ConstantInteger>(n));break;
+    case ConstantTextID:          gen(llvm::cast<ConstantText>(n));break;
     case VariableID:              gen(llvm::cast<Variable>(n)); break;
     case ReturnOpID:              gen(llvm::cast<ReturnOp>(n)); break;
     default:
@@ -453,6 +432,75 @@
   }
 }
 
+void
+LLVMGeneratorPass::handleTerminate()
+{
+  // Get the type of function that all entry points must have
+  const llvm::FunctionType* entry_signature = 
+    llvm::cast<llvm::FunctionType>(getType(ast->getProgramType())); 
+
+  // Define the type of the array elements (a structure with a pointer to
+  // a string and a pointer to the function).
+  std::vector<const llvm::Type*> Fields;
+  Fields.push_back(llvm::PointerType::get(llvm::Type::SByteTy));
+  Fields.push_back(llvm::PointerType::get(entry_signature));
+  llvm::StructType* entry_elem_type = llvm::StructType::get(Fields);
+
+  // Define the type of the array for the entry points
+  llvm::ArrayType* entry_points_type = llvm::ArrayType::get(entry_elem_type,1);
+
+  // Create a vector to hold the entry elements as they are created.
+  std::vector<llvm::Constant*> entry_points_items;
+
+  for (std::vector<llvm::Function*>::iterator I = progs.begin(), 
+       E = progs.end(); I != E; ++I )
+  {
+    const std::string& funcName = (*I)->getName();
+    // Get a constant for the name of the entry point (char array)
+    llvm::Constant* name_val = llvm::ConstantArray::get(funcName,false);
+
+    // Create a constant global variable to hold the name of the program.
+    llvm::GlobalVariable* name = new llvm::GlobalVariable(
+      /*Type=*/llvm::ArrayType::get(llvm::Type::SByteTy, funcName.length()),
+      /*isConst=*/true,
+      /*Linkage=*/llvm::GlobalValue::InternalLinkage, 
+      /*Initializer=*/name_val, 
+      /*name=*/"", 
+      /*InsertInto=*/lmod
+    );
+
+    // Get the GEP for indexing in to the name string
+    std::vector<llvm::Constant*> Indices;
+    Indices.push_back(llvm::Constant::getNullValue(llvm::Type::IntTy));
+    Indices.push_back(llvm::Constant::getNullValue(llvm::Type::IntTy));
+    llvm::Constant* index = llvm::ConstantExpr::getGetElementPtr(name,Indices);
+
+    // Get a constant structure for the entry containing the name and pointer
+    // to the function.
+    std::vector<llvm::Constant*> items;
+    items.push_back(index);
+    items.push_back(*I);
+    llvm::Constant* entry = llvm::ConstantStruct::get(entry_elem_type,items);
+
+    // Save the entry into the list of entry_point items
+    entry_points_items.push_back(entry);
+  }
+
+  // Create a constant array to initialize the entry_points
+  llvm::Constant* entry_points_initializer = llvm::ConstantArray::get(
+    entry_points_type,entry_points_items);
+
+  // Now get the GlobalVariable
+  llvm::GlobalVariable* entry_points = new llvm::GlobalVariable(
+    /*Type=*/entry_points_type,
+    /*isConstant=*/true,
+    /*Linkage=*/llvm::GlobalValue::AppendingLinkage,
+    /*Initializer=*/entry_points_initializer,
+    /*Name=*/"_hlvm_entry_points",
+    /*Parent=*/lmod
+  );
+}
+
 
 llvm::Module*
 LLVMGeneratorPass::linkModules()

Modified: hlvm/trunk/hlvm/CodeGen/program.cxx
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/CodeGen/program.cxx?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/CodeGen/program.cxx (original)
+++ hlvm/trunk/hlvm/CodeGen/program.cxx Sat Jul  7 19:00:13 2007
@@ -1,4 +1,4 @@
-#include "string.cxx"
+#include "string.h"
 
 extern "C" {
 
@@ -10,11 +10,14 @@
 typedef uint32_t (*_hlvm_program_type)(_hlvm_program_args* args);
 
 struct _hlvm_programs_element {
-  void* program_type;
-  _hlvm_string program_name;
+  const char* program_name;
   _hlvm_program_type program_entry;
 };
 
-_hlvm_programs_element _hlvm_programs[1];
+extern uint32_t return0_prog(_hlvm_program_args* args);
+
+_hlvm_programs_element _hlvm_programs[1] = {
+  { "return0", return0_prog }
+};
 
 }

Modified: hlvm/trunk/hlvm/CodeGen/string.cxx
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/CodeGen/string.cxx?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/CodeGen/string.cxx (original)
+++ hlvm/trunk/hlvm/CodeGen/string.cxx Sat Jul  7 19:00:13 2007
@@ -1,21 +1,7 @@
-#include <stdint.h>
+#include "string.h"
 
 extern "C" {
 
-typedef uint32_t _hlvm_size;
-typedef uint16_t _hlvm_char;
-
-struct _hlvm_string {
-  _hlvm_size len;
-  _hlvm_char* ptr;
-};
-
-extern void _hlvm_free_array(
-  void* array, 
-  _hlvm_size count, 
-  _hlvm_size elem_size
-);
-
 void _hlvm_string_clear(_hlvm_string* str) 
 {
   _hlvm_free_array(str->ptr,str->len,sizeof(_hlvm_char));

Added: hlvm/trunk/hlvm/CodeGen/string.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/CodeGen/string.h?rev=38139&view=auto

==============================================================================
--- hlvm/trunk/hlvm/CodeGen/string.h (added)
+++ hlvm/trunk/hlvm/CodeGen/string.h Sat Jul  7 19:00:13 2007
@@ -0,0 +1,20 @@
+#include <stdint.h>
+
+extern "C" {
+
+typedef uint32_t _hlvm_size;
+typedef char _hlvm_char;
+
+struct _hlvm_string {
+  _hlvm_size len;
+  _hlvm_char* ptr;
+};
+
+extern void _hlvm_free_array(
+  void* array, 
+  _hlvm_size count, 
+  _hlvm_size elem_size
+);
+
+extern void _hlvm_string_clear(_hlvm_string* str);
+}

Modified: hlvm/trunk/hlvm/Pass/Pass.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Pass/Pass.cpp?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/Pass/Pass.cpp (original)
+++ hlvm/trunk/hlvm/Pass/Pass.cpp Sat Jul  7 19:00:13 2007
@@ -33,6 +33,7 @@
 #include <hlvm/AST/ContainerType.h>
 #include <hlvm/AST/Program.h>
 #include <hlvm/AST/Variable.h>
+#include <hlvm/Base/Assert.h>
 
 using namespace hlvm;
 using namespace llvm;
@@ -52,15 +53,19 @@
   inline void runOn(Operator* b);
   inline void runOn(Block* b);
   inline void runOn(Bundle* b);
+  inline void runOn(Value* b);
+  inline void runOn(Constant* b);
 
 private:
   std::vector<Pass*> pre;
   std::vector<Pass*> post;
+  std::vector<Pass*> all;
 };
 
 void
 PassManagerImpl::addPass(Pass* p)
 {
+  all.push_back(p);
   if (p->mode() & Pass::PreOrderTraversal)
     pre.push_back(p);
   if (p->mode() & Pass::PostOrderTraversal)
@@ -104,6 +109,16 @@
 }
 
 inline void
+PassManagerImpl::runOn(Constant* cst)
+{
+  hlvmAssert(isa<Constant>(cst));
+  runPreOrder(cst);
+  // FIXME: Eventually we'll have structured constants which need to have 
+  // their contents examined as well.
+  runPostOrder(cst);
+}
+
+inline void
 PassManagerImpl::runOn(Operator* op)
 {
   runPreOrder(op);
@@ -115,6 +130,17 @@
 }
 
 inline void
+PassManagerImpl::runOn(Value* v)
+{
+  if (isa<Constant>(v))
+    runOn(cast<Constant>(v));
+  else if (isa<Operator>(v))
+    runOn(cast<Operator>(v));
+  else
+    hlvmDeadCode("Value not an Operator or Constant?");
+}
+
+inline void
 PassManagerImpl::runOn(Block* b)
 {
   runPreOrder(b);
@@ -123,8 +149,12 @@
       break;
     if (isa<Block>(*I))
       runOn(cast<Block>(*I)); // recurse!
-    else
+    else if (isa<Variable>(*I))
+      runOn(cast<Variable>(*I));
+    else if (isa<Operator>(*I))
       runOn(cast<Operator>(*I)); 
+    else
+      hlvmDeadCode("Block has invalid content");
   }
   runPostOrder(b);
 }
@@ -154,6 +184,10 @@
 
 void PassManagerImpl::runOn(AST* tree)
 {
+  // Call the initializers
+  std::vector<Pass*>::iterator PI = all.begin(), PE = all.end();
+  while (PI != PE) { (*PI)->handleInitialize(); ++PI; }
+
   // Just a little optimization for empty pass managers
   if (pre.empty() && post.empty())
     return;
@@ -161,6 +195,10 @@
   // Traverse each of the bundles in the AST node.
   for (AST::iterator I = tree->begin(), E = tree->end(); I != E; ++I)
     runOn(*I);
+
+  // Call the terminators
+  PI = all.begin(), PE = all.end();
+  while (PI != PE) { (*PI)->handleTerminate(); ++PI; }
 }
 
 } // anonymous namespace
@@ -169,6 +207,16 @@
 {
 }
 
+void 
+Pass::handleInitialize()
+{
+}
+
+void 
+Pass::handleTerminate()
+{
+}
+
 PassManager::~PassManager()
 {
 }

Modified: hlvm/trunk/hlvm/Pass/Pass.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Pass/Pass.h?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/Pass/Pass.h (original)
+++ hlvm/trunk/hlvm/Pass/Pass.h Sat Jul  7 19:00:13 2007
@@ -84,12 +84,20 @@
   /// @name Handlers
   /// @{
   public:
+    /// Handle initialization. This is called before any other handle method
+    /// is called. Default implementation does nothing
+    virtual void handleInitialize();
+
     /// Handle any kind of node. Subclasses should override this; the default
     /// implementation does nothing. This handler is only called if the
     /// interest is set to 0 (interested in everything). It is left to the
     /// subclass to disambiguate the Node.
     virtual void handle(Node* n, TraversalKinds mode) = 0;
 
+    /// Handle termination. This is called after all other handle methods
+    /// are called. Default implementation does nothing
+    virtual void handleTerminate();
+
   /// @}
   /// @name Accessors
   /// @{

Modified: hlvm/trunk/hlvm/Pass/Validate.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Pass/Validate.cpp?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/Pass/Validate.cpp (original)
+++ hlvm/trunk/hlvm/Pass/Validate.cpp Sat Jul  7 19:00:13 2007
@@ -291,7 +291,9 @@
     case PInfOpID:
     case NInfOpID:
     case NaNOpID:
-    case ConstLiteralIntegerOpID:
+    case ConstantIntegerID:
+    case ConstantRealID:
+    case ConstantTextID:
       break; // Not implemented yet
     case DocumentationID:
       /// Nothing to validate (any doc is a good thing :)

Modified: hlvm/trunk/hlvm/Reader/XML/HLVM.rng
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Reader/XML/HLVM.rng?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/Reader/XML/HLVM.rng (original)
+++ hlvm/trunk/hlvm/Reader/XML/HLVM.rng Sat Jul  7 19:00:13 2007
@@ -173,7 +173,6 @@
           <ref name="structure.elem"/>
           <ref name="signature.elem"/>
           <ref name="vector.elem"/>
-          <ref name="constant.elem"/>
           <ref name="variable.elem"/>
           <ref name="function.elem"/>
           <ref name="program.elem"/>
@@ -363,6 +362,9 @@
     <element name="variable">
       <ref name="Named_Typed_Element.pat"/>
       <optional>
+        <attribute name="const"><data type="boolean"/></attribute>
+      </optional>
+      <optional>
         <choice>
           <element name="init">
             <ref name="Constant.pat"/>
@@ -435,14 +437,7 @@
     </element>
   </define>
 
-  <!-- PATTERNS FOR DEFINING NAMED CONSTANTS -->
-
-  <define name="constant.elem">
-    <element name="constant">
-      <ref name="Named_Typed_Element.pat"/>
-      <ref name="Constant.pat"/>
-    </element>
-  </define>
+  <!-- PATTERNS FOR DEFINING CONSTANTS -->
 
   <define name="Constant.pat">
     <choice>
@@ -465,7 +460,6 @@
     </element>
   </define>
 
-  <!-- PATTERNS FOR CONSTANT EXPRESSIONS -->
   <define name="ConstantExpression.pat">
     <choice>
       <ref name="index.elem"/>
@@ -904,11 +898,11 @@
 
   <define name="ControlFlowOps.pat">
     <choice>
-      <ref name="Return.elem"/>
+      <ref name="ret.elem"/>
     </choice>
   </define>
 
-  <define name="Return.elem">
+  <define name="ret.elem">
     <element name="ret">
       <ref name="Operators.pat"/>
     </element>

Modified: hlvm/trunk/hlvm/Reader/XML/XMLReader.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Reader/XML/XMLReader.cpp?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/Reader/XML/XMLReader.cpp (original)
+++ hlvm/trunk/hlvm/Reader/XML/XMLReader.cpp Sat Jul  7 19:00:13 2007
@@ -102,10 +102,13 @@
   inline void handleParseError(xmlErrorPtr error);
   inline void handleValidationError(xmlErrorPtr error);
 
-  inline ConstLiteralInteger* parseBinary(xmlNodePtr& cur);
-  inline ConstLiteralInteger* parseOctal(xmlNodePtr& cur);
-  inline ConstLiteralInteger* parseDecimal(xmlNodePtr& cur);
-  inline ConstLiteralInteger* parseHexadecimal(xmlNodePtr& cur);
+  inline ConstantInteger* parseBinary(xmlNodePtr& cur);
+  inline ConstantInteger* parseOctal(xmlNodePtr& cur);
+  inline ConstantInteger* parseDecimal(xmlNodePtr& cur);
+  inline ConstantInteger* parseHexadecimal(xmlNodePtr& cur);
+  inline ConstantReal*    parseFloat(xmlNodePtr& cur);
+  inline ConstantReal*    parseDouble(xmlNodePtr& cur);
+  inline ConstantText*    parseText(xmlNodePtr& cur);
   void           parseTree          ();
   AliasType*     parseAlias         (xmlNodePtr& cur);
   Type*          parseArray         (xmlNodePtr& cur);
@@ -120,8 +123,13 @@
   Type*          parseSignature     (xmlNodePtr& cur);
   Variable*      parseVariable      (xmlNodePtr& cur);
   Type*          parseVector        (xmlNodePtr& cur);
-  ReturnOp*      parseReturn        (xmlNodePtr& cur);
+  Constant*      parseConstant      (xmlNodePtr& cur);
+  Constant*      parseConstant      (xmlNodePtr& cur, int token);
   Operator*      parseOperator      (xmlNodePtr& cur);
+  Operator*      parseOperator      (xmlNodePtr& cur, int token);
+  Value*         parseValue         (xmlNodePtr& cur);
+  Value*         parseValue         (xmlNodePtr& cur, int token);
+  ReturnOp*      parseReturn        (xmlNodePtr& cur);
   Block*         parseBlock         (xmlNodePtr& cur);
   Program*       parseProgram       (xmlNodePtr& cur);
   inline xmlNodePtr   checkDoc(xmlNodePtr cur, Documentable* node);
@@ -169,6 +177,12 @@
   return HLVMTokenizer::recognize(reinterpret_cast<const char*>(name));
 }
 
+inline int
+getToken(const char* name)
+{
+  return HLVMTokenizer::recognize(name);
+}
+
 inline bool 
 skipBlanks(xmlNodePtr &cur, bool skipText = true)
 {
@@ -190,7 +204,7 @@
 }
 
 LinkageKinds
-recognize_LinkageKinds(const xmlChar* str)
+recognize_LinkageKinds(const char* str)
 {
   switch (getToken(str)) 
   {
@@ -256,7 +270,7 @@
   type = getAttribute(cur,"type");
 }
 
-inline ConstLiteralInteger*
+inline ConstantInteger*
 XMLReaderImpl::parseBinary(xmlNodePtr& cur)
 {
   uint64_t value = 0;
@@ -273,13 +287,12 @@
   }
   if (child) skipBlanks(child);
   hlvmAssert(!child && "Illegal chlldren of <bin> element");
-  ConstLiteralInteger* result = ast->new_ConstLiteralInteger(getLocator(cur));
+  ConstantInteger* result = ast->new_ConstantInteger(value,getLocator(cur));
   result->setType(ast->getPrimitiveType(UInt64TypeID));
-  result->setValue(value);
   return result;
 }
 
-inline ConstLiteralInteger*
+inline ConstantInteger*
 XMLReaderImpl::parseOctal(xmlNodePtr& cur)
 {
   uint64_t value = 0;
@@ -296,13 +309,12 @@
   }
   if (child) skipBlanks(child);
   hlvmAssert(!child && "Illegal chlldren of <oct> element");
-  ConstLiteralInteger* result = ast->new_ConstLiteralInteger(getLocator(cur));
+  ConstantInteger* result = ast->new_ConstantInteger(value,getLocator(cur));
   result->setType(ast->getPrimitiveType(UInt64TypeID));
-  result->setValue(value);
   return result;
 }
 
-inline ConstLiteralInteger*
+inline ConstantInteger*
 XMLReaderImpl::parseDecimal(xmlNodePtr& cur)
 {
   uint64_t value = 0;
@@ -319,13 +331,12 @@
   }
   if (child) skipBlanks(child);
   hlvmAssert(!child && "Illegal chlldren of <dec> element");
-  ConstLiteralInteger* result = ast->new_ConstLiteralInteger(getLocator(cur));
+  ConstantInteger* result = ast->new_ConstantInteger(value,getLocator(cur));
   result->setType(ast->getPrimitiveType(UInt64TypeID));
-  result->setValue(value);
   return result;
 }
 
-inline ConstLiteralInteger*
+inline ConstantInteger*
 XMLReaderImpl::parseHexadecimal(xmlNodePtr& cur)
 {
   uint64_t value = 0;
@@ -362,12 +373,64 @@
   }
   if (child) skipBlanks(child);
   hlvmAssert(!child && "Illegal chlldren of <hex> element");
-  ConstLiteralInteger* result = ast->new_ConstLiteralInteger(getLocator(cur));
+  ConstantInteger* result = ast->new_ConstantInteger(value,getLocator(cur));
+  result->setType(ast->getPrimitiveType(UInt64TypeID));
+  return result;
+}
+
+inline ConstantReal*
+XMLReaderImpl::parseFloat(xmlNodePtr& cur)
+{
+  double value = 0;
+  std::string buffer;
+  xmlNodePtr child = cur->children;
+  if (child) skipBlanks(child,false);
+  while (child && child->type == XML_TEXT_NODE) {
+    buffer += reinterpret_cast<const char*>(cur->content);
+    child = child->next;
+  }
+  if (child) skipBlanks(child);
+  hlvmAssert(!child && "Illegal chlldren of <flt> element");
+  value = atof(buffer.c_str());
+  ConstantReal* result = ast->new_ConstantReal(value,getLocator(cur));
+  result->setType(ast->getPrimitiveType(UInt64TypeID));
+  return result;
+}
+
+inline ConstantReal*
+XMLReaderImpl::parseDouble(xmlNodePtr& cur)
+{
+  double value = 0;
+  std::string buffer;
+  xmlNodePtr child = cur->children;
+  if (child) skipBlanks(child,false);
+  while (child && child->type == XML_TEXT_NODE) {
+    buffer += reinterpret_cast<const char*>(cur->content);
+    child = child->next;
+  }
+  if (child) skipBlanks(child);
+  hlvmAssert(!child && "Illegal chlldren of <dbl> element");
+  value = atof(buffer.c_str());
+  ConstantReal* result = ast->new_ConstantReal(value,getLocator(cur));
   result->setType(ast->getPrimitiveType(UInt64TypeID));
-  result->setValue(value);
   return result;
 }
 
+inline ConstantText*
+XMLReaderImpl::parseText(xmlNodePtr& cur)
+{
+  std::string buffer;
+  xmlNodePtr child = cur->children;
+  if (child) skipBlanks(child,false);
+  while (child && child->type == XML_TEXT_NODE) {
+    buffer += reinterpret_cast<const char*>(cur->content);
+    child = child->next;
+  }
+  if (child) skipBlanks(child);
+  hlvmAssert(!child && "Illegal chlldren of <text> element");
+  return ast->new_ConstantText(buffer,getLocator(cur));
+}
+
 Documentation*
 XMLReaderImpl::parseDocumentation(xmlNodePtr& cur)
 {
@@ -636,8 +699,19 @@
   Locator* loc = getLocator(cur);
   std::string name, type;
   getNameType(cur, name, type);
-  Variable* var = ast->new_Variable(name,ast->resolveType(type),loc);
-  checkDoc(cur,var);
+  const char* cnst = getAttribute(cur, "const", false);
+  const char* lnkg = getAttribute(cur, "linkage", false);
+  const Type* Ty = ast->resolveType(type);
+  Variable* var = ast->new_Variable(name,Ty,loc);
+  if (cnst)
+    var->setIsConstant(recognize_boolean(cnst));
+  if (lnkg)
+    var->setLinkageKind(recognize_LinkageKinds(lnkg));
+  xmlNodePtr child = checkDoc(cur,var);
+  if (child && skipBlanks(child) && child->type == XML_ELEMENT_NODE) {
+    Constant* C = parseConstant(child);
+    var->setInitializer(C);
+  }
   return var;
 }
 
@@ -649,24 +723,58 @@
   ReturnOp* ret = ast->new_ReturnOp(loc);
   xmlNodePtr child = cur->children;
   if (child && skipBlanks(child) && child->type == XML_ELEMENT_NODE) {
-    Operator* op = parseOperator(child);
+    Value* op = parseValue(child);
     ret->setResult(op);
   }
   return ret;
 }
 
-Operator*
+inline Constant*
+XMLReaderImpl::parseConstant(xmlNodePtr& cur)
+{
+  return parseConstant(cur, getToken(cur->name));
+}
+
+Constant*
+XMLReaderImpl::parseConstant(xmlNodePtr& cur, int tkn)
+{
+  Constant* C = 0;
+  switch (tkn) {
+    case TKN_bin:          C = parseBinary(cur); break;
+    case TKN_oct:          C = parseOctal(cur); break;
+    case TKN_dec:          C = parseDecimal(cur); break;
+    case TKN_hex:          C = parseHexadecimal(cur); break;
+    case TKN_flt:          C = parseFloat(cur); break;
+    case TKN_dbl:          C = parseDouble(cur); break;
+    case TKN_text:         C = parseText(cur); break;
+    default:
+      hlvmAssert(!"Invalid kind of constant");
+      break;
+  }
+  return C;
+}
+
+
+inline Operator*
 XMLReaderImpl::parseOperator(xmlNodePtr& cur)
 {
-  int tkn = getToken(cur->name);
+  return parseOperator(cur, getToken(cur->name));
+}
+
+Operator*
+XMLReaderImpl::parseOperator(xmlNodePtr& cur, int tkn)
+{
   Operator* op = 0;
   switch (tkn) {
-    case TKN_bin:          op = parseBinary(cur); break;
-    case TKN_oct:          op = parseOctal(cur); break;
-    case TKN_dec:          op = parseDecimal(cur); break;
-    case TKN_hex:          op = parseHexadecimal(cur); break;
     case TKN_ret:          op = parseReturn(cur); break;
     case TKN_block:        op = parseBlock(cur); break;
+    case TKN_store:
+    case TKN_load:
+    case TKN_open:
+    case TKN_write:
+    case TKN_close:
+      std::cerr << "Operator " << cur->name << " not imlpemented.\n";
+      break;
     default:
       hlvmDeadCode("Unrecognized operator");
       break;
@@ -674,6 +782,52 @@
   return op;
 }
 
+inline Value*
+XMLReaderImpl::parseValue(xmlNodePtr& cur)
+{
+  return parseValue(cur,getToken(cur->name));
+}
+
+Value*
+XMLReaderImpl::parseValue(xmlNodePtr& cur, int tkn)
+{
+  Value* v = 0;
+  switch (tkn) {
+    case TKN_bin:
+    case TKN_oct:
+    case TKN_dec:
+    case TKN_hex:
+    case TKN_flt:
+    case TKN_dbl:
+    case TKN_text:
+    case TKN_zero:
+      v = parseConstant(cur,tkn);
+      break;
+    case TKN_ret:
+    case TKN_open:
+    case TKN_write:
+    case TKN_close:
+    case TKN_store:
+    case TKN_load:
+    case TKN_block: 
+      v = parseOperator(cur,tkn);
+      break;
+    case TKN_program:
+      v = parseProgram(cur);
+      break;
+    case TKN_function:
+      v = parseFunction(cur);
+      break;
+    case TKN_variable:
+      v = parseVariable(cur);
+      break;
+    default:
+      hlvmDeadCode("Unrecognized operator");
+      break;
+  }
+  return v;
+}
+
 Block*
 XMLReaderImpl::parseBlock(xmlNodePtr& cur)
 {
@@ -688,7 +842,7 @@
   xmlNodePtr child = cur->children;
   while (child && skipBlanks(child) && child->type == XML_ELEMENT_NODE) 
   {
-    Operator* op = parseOperator(child);
+    Value* op = parseValue(child);
     block->addOperand(op);
     child = child->next;
   }
@@ -703,6 +857,9 @@
   std::string name, type;
   getNameType(cur, name, type);
   Function* func = ast->new_Function(name,loc);
+  const char* lnkg = getAttribute(cur, "linkage", false);
+  if (lnkg)
+    func->setLinkageKind(recognize_LinkageKinds(lnkg));
   checkDoc(cur,func);
   return func;
 }

Modified: hlvm/trunk/hlvm/Writer/XML/XMLWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Writer/XML/XMLWriter.cpp?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/hlvm/Writer/XML/XMLWriter.cpp (original)
+++ hlvm/trunk/hlvm/Writer/XML/XMLWriter.cpp Sat Jul  7 19:00:13 2007
@@ -115,7 +115,10 @@
     inline void put(VectorType* t);
     inline void put(StructureType* t);
     inline void put(SignatureType* t);
-    inline void put(ConstLiteralInteger* t);
+    inline void put(ConstantInteger* t);
+    inline void put(ConstantReal* t);
+    inline void put(ConstantText* t);
+    inline void put(ConstantZero* t);
     inline void put(Variable* v);
     inline void put(Function* f);
     inline void put(Program* p);
@@ -374,7 +377,7 @@
 }
 
 void 
-XMLWriterImpl::WriterPass::put(ConstLiteralInteger* i)
+XMLWriterImpl::WriterPass::put(ConstantInteger* i)
 {
   startElement("dec");
   if (cast<IntegerType>(i->getType())->isSigned())
@@ -384,6 +387,26 @@
 }
 
 void
+XMLWriterImpl::WriterPass::put(ConstantReal* r)
+{
+  startElement("dbl");
+  writeString(llvm::ftostr(r->getValue()));
+}
+
+void
+XMLWriterImpl::WriterPass::put(ConstantText* t)
+{
+  startElement("text");
+  writeString(t->getValue());
+}
+
+void
+XMLWriterImpl::WriterPass::put(ConstantZero* t)
+{
+  startElement("zero");
+}
+
+void
 XMLWriterImpl::WriterPass::put(Variable* v)
 {
   startElement("variable");
@@ -456,7 +479,10 @@
       case VectorTypeID:              put(cast<VectorType>(n)); break;
       case StructureTypeID:           put(cast<StructureType>(n)); break;
       case SignatureTypeID:           put(cast<SignatureType>(n)); break;
-      case ConstLiteralIntegerOpID:   put(cast<ConstLiteralInteger>(n)); break;
+      case ConstantIntegerID:         put(cast<ConstantInteger>(n)); break;
+      case ConstantRealID:            put(cast<ConstantReal>(n)); break;
+      case ConstantTextID:            put(cast<ConstantText>(n)); break;
+      case ConstantZeroID:            put(cast<ConstantZero>(n)); break;
       case VariableID:                put(cast<Variable>(n)); break;
       case FunctionID:                put(cast<Function>(n)); break;
       case ProgramID:                 put(cast<Program>(n)); break;

Modified: hlvm/trunk/test/lib/return0.exp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/test/lib/return0.exp?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/test/lib/return0.exp (original)
+++ hlvm/trunk/test/lib/return0.exp Sat Jul  7 19:00:13 2007
@@ -48,12 +48,12 @@
     set execout ""
     set retval [ catch { exec -keepnewline $compiler $testsrc -llvmbc -o - | $llcpath -f -march x86 -o $testexe } msg ]
     if { $retval != 0 } {
-      fail "$test: $testexe returned $retval\n$msg"
+      fail "$test: hlvm-compiler returned $retval:\n$msg"
     } else {
       # Run the program compiled and see if it returns 0
       set retval [ catch {exec $testexe } msg ]
       if {$retval == 1} {
-        fail "$test: return 0 test failed:\n$msg"
+        fail "$test: $testexe returned $retval:\n$msg"
       } else {
         pass "$test"
       }

Modified: hlvm/trunk/test/return0/helloworld.hlx
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/test/return0/helloworld.hlx?rev=38139&r1=38138&r2=38139&view=diff

==============================================================================
--- hlvm/trunk/test/return0/helloworld.hlx (original)
+++ hlvm/trunk/test/return0/helloworld.hlx Sat Jul  7 19:00:13 2007
@@ -2,7 +2,6 @@
 <hlvm xmlns="http://hlvm.org/src/hlvm/Reader/XML/HLVM.rng"
       pubid="http://hlvm.org/src/hlvm/test/xml2xml/helloworld.hlx">
   <bundle id="helloworld">
-    <constant id="hw" type="text"><text>Hello, World
</text></constant>
     <program id="helloworld">
       <block>
         <variable id="stdout" type="io"/>
@@ -12,8 +11,8 @@
         </store>
         <write>
           <load><ref id="stdout"/></load>
-          <load><ref id="hw"/></load>
-          <length><ref id="hw"/></length>
+          <text>Hello, World
</text>
+          <dec>13</dec>
         </write>
         <close>
           <load><ref id="stdout"/></load>





More information about the llvm-commits mailing list