[llvm-commits] [hlvm] r38107 - in /hlvm/trunk/hlvm: AST/Block.h AST/ControlFlow.h AST/Node.h AST/Operator.cpp AST/Operator.h Pass/SConscript Pass/Validate.cpp Runtime/ Runtime/FileIO.cpp Runtime/FileIO.h Runtime/SConscript Runtime/String.cpp Runtime/String.h SConscript
Reid Spencer
reid at x10sys.com
Sat Jul 7 16:59:53 PDT 2007
Author: reid
Date: Sat Jul 7 18:59:53 2007
New Revision: 38107
URL: http://llvm.org/viewvc/llvm-project?rev=38107&view=rev
Log:
Prepare for the "Hello World" program by creating a little infrastructure:
1. Created operator nodes for file i/o and strings.
2. Created seprate Unary/Binary/Ternary operator subclasses for efficiency
3. Removed some NodeIDs we're not too sure about.
4. Added a Runtime directory for holding the runtime library with skeletal
support for file I/O and strings.
Added:
hlvm/trunk/hlvm/AST/ControlFlow.h
hlvm/trunk/hlvm/Runtime/
hlvm/trunk/hlvm/Runtime/FileIO.cpp
hlvm/trunk/hlvm/Runtime/FileIO.h
hlvm/trunk/hlvm/Runtime/SConscript
hlvm/trunk/hlvm/Runtime/String.cpp
hlvm/trunk/hlvm/Runtime/String.h
Modified:
hlvm/trunk/hlvm/AST/Block.h
hlvm/trunk/hlvm/AST/Node.h
hlvm/trunk/hlvm/AST/Operator.cpp
hlvm/trunk/hlvm/AST/Operator.h
hlvm/trunk/hlvm/Pass/SConscript
hlvm/trunk/hlvm/Pass/Validate.cpp
hlvm/trunk/hlvm/SConscript
Modified: hlvm/trunk/hlvm/AST/Block.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Block.h?rev=38107&r1=38106&r2=38107&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/Block.h (original)
+++ hlvm/trunk/hlvm/AST/Block.h Sat Jul 7 18:59:53 2007
@@ -41,20 +41,12 @@
/// contained in a Bundle. Local variables are always contained in a
/// Function.
/// @brief HLVM AST Variable Node
-class Block : public Operator
+class Block : public MultiOperator
{
- /// @name Types
- /// @{
- public:
- typedef std::vector<Operator*> NodeList;
- typedef NodeList::iterator iterator;
- typedef NodeList::const_iterator const_iterator;
-
- /// @}
/// @name Constructors
/// @{
public:
- Block() : Operator(BlockID), ops() {}
+ Block() : MultiOperator(BlockID){}
virtual ~Block();
/// @}
@@ -66,26 +58,6 @@
static inline bool classof(const Node* N) { return N->isBlock(); }
/// @}
- /// @name Iterators
- /// @{
- public:
- iterator begin() { return ops.begin(); }
- const_iterator begin() const { return ops.begin(); }
- iterator end () { return ops.end(); }
- 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(); }
-
- /// @}
- /// @name Data
- /// @{
- protected:
- std::vector<Operator*> ops; ///< The operators the Block contains
- /// @}
friend class AST;
};
Added: hlvm/trunk/hlvm/AST/ControlFlow.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/ControlFlow.h?rev=38107&view=auto
==============================================================================
--- hlvm/trunk/hlvm/AST/ControlFlow.h (added)
+++ hlvm/trunk/hlvm/AST/ControlFlow.h Sat Jul 7 18:59:53 2007
@@ -0,0 +1,66 @@
+//===-- AST Control Flow Operators ------------------------------*- 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/ControlFlow.h
+/// @author Reid Spencer <rspencer at reidspencer.com> (original author)
+/// @date 2006/05/25
+/// @since 0.1.0
+/// @brief Declares the AST Control flow classes (Loop, If, Call, Return, etc.)
+//===----------------------------------------------------------------------===//
+
+#ifndef HLVM_AST_CONTROLFLOW_H
+#define HLVM_AST_CONTROLFLOW_H
+
+#include <hlvm/AST/Operator.h>
+
+namespace hlvm
+{
+
+/// This class represents a return operator. The return operator returns from
+/// the inner most enclosed function. It takes one operand which is the value
+/// to return to the caller.
+/// @brief HLVM AST Return Operator Node
+class ReturnOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ public:
+ static ReturnOp* create();
+
+ protected:
+ ReturnOp() : UnaryOperator(ReturnOpID) {}
+ virtual ~ReturnOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ Operator* getResult() { return UnaryOperator::op1; }
+ static inline bool classof(const ReturnOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(ReturnOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+} // hlvm
+#endif
Modified: hlvm/trunk/hlvm/AST/Node.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Node.h?rev=38107&r1=38106&r2=38107&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/Node.h (original)
+++ hlvm/trunk/hlvm/AST/Node.h Sat Jul 7 18:59:53 2007
@@ -43,7 +43,8 @@
/// very specific and dependent on the class hierarchy. In order to use these
/// values as ranges for class identification (classof methods), we need to
/// group things by inheritance rather than by function.
-enum NodeIDs {
+enum NodeIDs
+{
NoTypeID = 0, ///< Use this for an invalid type ID.
// Primitive Types (no child nodes)
VoidTypeID = 1, ///< The Void Type (The Null Type)
@@ -84,40 +85,54 @@
BlockID, ///< A Block Of Code Nodes
ImportID, ///< A bundle's Import declaration
- // Control Flow And Invocation Operators
- CallOpID, ///< The Call Operator
- InvokeOpID, ///< The Invoke Operator
- DispatchOpID, ///< The Object Method Dispatch Operator
- CreateContOpID, ///< The Create Continutation Operator
- CallWithContOpID, ///< The Call with Continuation Operator
+ // Nilary Operators (those taking no operands)
+ BreakOpID, ///< Break out of the enclosing loop
+ PInfOpID, ///< Constant Positive Infinity Real Value
+ NInfOpID, ///< Constant Negative Infinity Real Value
+ NaNOpID, ///< Constant Not-A-Number Real Value
+
+ // Control Flow Unary Operators
ReturnOpID, ///< The Return A Value Operator
- ThrowOpID, ///< The Throw And Exception Operator
+ ThrowOpID, ///< The Throw an Exception Operator
JumpToOpID, ///< The Jump To Labelled Block Operator
- BreakOpID, ///< The Break Out Of Block Operator
- IfOpID, ///< The If-Then-Else Operator
- LoopOpID, ///< The General Purpose Loop Operator
- SelectOpID, ///< The Select An Alternate Operator
- // Scoping Operators
- WithOpID, ///< Create a shorthand for a Bundle (like using/import)
+ // Integer Arithmetic Unary Operators
+ NegateOpID, ///< The Negation Unary Integer Operator
+ ComplementOpID, ///< The Bitwise Complement Unary Integer Operator
+ PreIncrOpID, ///< The Pre-Increment Unary Integer Operator
+ PostIncrOpID, ///< The Post-Increment Unary Integer Operator
+ PreDecrOpID, ///< The Pre-Decrement Unary Integer Operator
+ PostDecrOpID, ///< The Post-Decrement Unary Integer Operator
+
+ // Real Arithmetic Unary Operators
+ IsPInfOpID, ///< Real Number Positive Infinity Test Operator
+ IsNInfOpID, ///< Real Number Negative Infinity Test Operator
+ IsNaNOpID, ///< Real Number Not-A-Number Test Operator
+ TruncOpID, ///< Real Number Truncation Operator
+ RoundOpID, ///< Real Number Rounding Operator
+ FloorOpID, ///< Real Number Floor Operator
+ CeilingOpID, ///< Real Number Ceiling Operator
+ LogEOpID, ///< Real Number Base e (Euler's Number) logarithm
+ Log2OpID, ///< Real Number Base 2 logarithm Operator
+ Log10OpID, ///< Real Number Base 10 logarithm Operator
+ SqRootOpID, ///< Real Number Square Root Operator
+ FactorialOpID, ///< Real Number Factorial Operator
- // Memory Operators
+ // Memory Unary Operators
LoadOpID, ///< The Load Operator (load a value from a location)
- StoreOpID, ///< The Store Operator (store a value to a location)
AllocateOpID, ///< The Allocate Memory Operator (get some heap memory)
FreeOpID, ///< The Free Memory Operator (free some heap memory)
- ReallocateOpID, ///< The Reallocate Memory Operator (realloc heap mem)
StackAllocOpID, ///< The Stack Allocation Operator (get some stack mem)
ReferenceOpID, ///< The Reference A Memory Object Operator (for GC)
DereferenceOpID, ///< The Dereference A Memory Object Operator (for GC)
- // Arithmetic Operators
- NegateOpID, ///< The Negation Unary Integer Operator
- ComplementOpID, ///< The Bitwise Complement Unary Integer Operator
- PreIncrOpID, ///< The Pre-Increment Unary Integer Operator
- PostIncrOpID, ///< The Post-Increment Unary Integer Operator
- PreDecrOpID, ///< The Pre-Decrement Unary Integer Operator
- PostDecrOpID, ///< The Post-Decrement Unary Integer Operator
+ // Other Unary Operators
+ TellOpID, ///< Tell the position of a stream
+ CloseOpID, ///< Close a stream previously opened.
+ LengthOpID, ///< Extract Length of a String Operator
+ WithOpID, ///< Scoping Operator (shorthand for a Bundle, e.g.using)
+
+ // Arithmetic Binary Operators
AddOpID, ///< The Addition Binary Integer Operator
SubtractOpID, ///< The Subtraction Binary Integer Operator
MultiplyOpID, ///< The Multiplcation Binary Integer Operator
@@ -127,7 +142,7 @@
BOrOpID, ///< The Bitwise Or Binary Integer Operator
BXOrOpID, ///< The Bitwise XOr Binary Integer Operator
- // Boolean Operators
+ // Boolean Binary Operators
AndOpID, ///< The And Binary Boolean Operator
OrOpID, ///< The Or Binary Boolean Operator
NorOpID, ///< The Nor Binary Boolean Operator
@@ -140,46 +155,36 @@
EQOpID, ///< The esual Binary Boolean Operator
NEOpID, ///< The not-equal Binary Comparison Operator
- // Real Arithmetic Operators
- IsPInfOpID, ///< Real Number Positive Infinity Test Operator
- IsNInfOpID, ///< Real Number Negative Infinity Test Operator
- IsNaNOpID, ///< Real Number Not-A-Number Test Operator
- TruncOpID, ///< Real Number Truncation Operator
- RoundOpID, ///< Real Number Rounding Operator
- FloorOpID, ///< Real Number Floor Operator
- CeilingOpID, ///< Real Number Ceiling Operator
+ // Real Arithmetic Binary Operators
PowerOpID, ///< Real Number Power Operator
- LogEOpID, ///< Real Number Base e (Euler's Number) logarithm
- Log2OpID, ///< Real Number Base 2 logarithm Operator
- Log10OpID, ///< Real Number Base 10 logarithm Operator
- SqRootOpID, ///< Real Number Square Root Operator
RootOpID, ///< Real Number Arbitrary Root Operator
- FactorialOpID, ///< Real Number Factorial Operator
GCDOpID, ///< Real Number Greatest Common Divisor Operator
LCMOpID, ///< Real Number Least Common Multiplicator Operator
- // Character And String Operators
- MungeOpID, ///< General Purpose String Editing Operator
- LengthOpID, ///< Extract Length of a String Operator
+ // Memory Binary Operators
+ ReallocateOpID, ///< The Reallocate Memory Operator (realloc heap mem)
+ StoreOpID, ///< The Store Operator (store a value to a location)
- // Input/Output Operators
- MapFileOpID, ///< Map a file to memory (mmap)
+ // Other Binary Operators
OpenOpID, ///< Open a stream from a URL
- CloseOpID, ///< Close a stream previously opened.
ReadOpID, ///< Read from a stream
WriteOpID, ///< Write to a stream
- PositionOpID, ///< Position a stream
+ CreateContOpID, ///< The Create Continutation Operator
- // Constant Value Operators
- IntOpID, ///< Constant Integer Value
- RealOpID, ///< Constant Real Value
- PInfOpID, ///< Constant Positive Infinity Real Value
- NInfOpID, ///< Constant Negative Infinity Real Value
- NaNOpID, ///< Constant Not-A-Number Real Value
- StringOpID, ///< Constant String Value
- ArrayOpID, ///< Constant Array Value
- VectorOpID, ///< Constant Vector Value
- StructureOpID, ///< Constant Structure Value
+ // Ternary Operators
+ IfOpID, ///< The If-Then-Else Operator
+ StrInsertOpID, ///< Insert(str,where,what)
+ StrEraseOpID, ///< Erase(str,at,len)
+ StrReplaceOpID, ///< Replace(str,at,len,what)
+ PositionOpID, ///< Position a stream (stream,where,relative-to)
+
+ // Multi Operators
+ CallOpID, ///< The Call Operator (n operands)
+ InvokeOpID, ///< The Invoke Operator (n operands)
+ DispatchOpID, ///< The Object Method Dispatch Operator (n operands)
+ CallWithContOpID, ///< The Call with Continuation Operator (n operands)
+ SelectOpID, ///< The Select An Alternate Operator (n operands)
+ LoopOpID, ///< The General Purpose Loop Operator (5 operands)
// Miscellaneous Nodes
DocumentationID, ///< XHTML Documentation Node
@@ -190,10 +195,20 @@
LastPrimitiveTypeID = StringTypeID, ///< Last Primitive Type
FirstContainerTypeID = PointerTypeID, ///< First Container Type
LastContainerTypeID = ContinuationTypeID, ///< Last Container Type
- FirstOperatorID = CallOpID, ///< First Operator
- LastOperatorID = StructureOpID, ///< Last Operator
- FirstTypeID = VoidTypeID,
- LastTypeID = OpaqueTypeID
+ FirstTypeID = VoidTypeID,
+ LastTypeID = OpaqueTypeID,
+ FirstOperatorID = BreakOpID, ///< First Operator
+ LastOperatorID = LoopOpID, ///< Last Operator
+ FirstNilaryOpID = BreakOpID,
+ LastNilaryOpID = NaNOpID,
+ FirstUnaryOpID = ReturnOpID,
+ LastUnaryOpID = WithOpID,
+ FirstBinaryOpID = AddOpID,
+ LastBinaryOpID = CreateContOpID,
+ FirstTernaryOpID = IfOpID,
+ LastTernaryOpID = PositionOpID,
+ FirstMultiOpID = CallOpID,
+ LastMultiOpID = LoopOpID
};
class ParentNode;
@@ -237,6 +252,21 @@
inline bool isOperator() const {
return id >= FirstOperatorID && id <= LastOperatorID;
}
+ inline bool isNilaryOperator() const {
+ return id >= FirstNilaryOpID && id <= LastNilaryOpID;
+ }
+ inline bool isUnaryOperator() const {
+ return id >= FirstUnaryOpID && id <= LastUnaryOpID;
+ }
+ inline bool isBinaryOperator() const {
+ return id >= FirstBinaryOpID && id <= LastBinaryOpID;
+ }
+ inline bool isTernaryOperator() const {
+ return id >= FirstTernaryOpID && id <= LastTernaryOpID;
+ }
+ inline bool isMultiOperator() const {
+ return id >= FirstMultiOpID && id <= LastMultiOpID;
+ }
/// Determine if the node is a NamedNode
bool isNamedNode() const ;
@@ -356,7 +386,6 @@
/// @{
protected:
std::string name; ///< The name of this node.
- Documentation* doc;///< All named nodes can have documentation
/// @}
friend class AST;
};
Modified: hlvm/trunk/hlvm/AST/Operator.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Operator.cpp?rev=38107&r1=38106&r2=38107&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/Operator.cpp (original)
+++ hlvm/trunk/hlvm/AST/Operator.cpp Sat Jul 7 18:59:53 2007
@@ -35,4 +35,58 @@
{
}
+NilaryOperator::~NilaryOperator()
+{
+}
+
+Operator*
+NilaryOperator::getOperand(unsigned idx)
+{
+ assert(!"Can't get operands from a NilaryOperator");
+}
+
+UnaryOperator::~UnaryOperator()
+{
+}
+
+Operator*
+UnaryOperator::getOperand(unsigned idx)
+{
+ assert(idx == 0 && "Operand index out of range");
+ return op1;
+}
+
+BinaryOperator::~BinaryOperator()
+{
+}
+
+Operator*
+BinaryOperator::getOperand(unsigned idx)
+{
+ assert(idx <= 1 && "Operand index out of range");
+ return ops[idx];
+}
+
+TernaryOperator::~TernaryOperator()
+{
+}
+
+Operator*
+TernaryOperator::getOperand(unsigned idx)
+{
+ assert(idx <= 2 && "Operand index out of range");
+ return ops[idx];
+}
+
+MultiOperator::~MultiOperator()
+{
+}
+
+Operator*
+MultiOperator::getOperand(unsigned idx)
+{
+ assert(idx <= ops.size() && "Operand index out of range");
+ return ops[idx];
+}
+
}
Modified: hlvm/trunk/hlvm/AST/Operator.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Operator.h?rev=38107&r1=38106&r2=38107&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/Operator.h (original)
+++ hlvm/trunk/hlvm/AST/Operator.h Sat Jul 7 18:59:53 2007
@@ -35,40 +35,175 @@
namespace hlvm
{
-class Type; // Forward declare
+class Type;
-/// 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
-/// global or local, depending on its parent. Global variables are always
-/// contained in a Bundle. Local variables are always contained in a
-/// Function.
-/// @brief HLVM AST Variable Node
-class Operator : public Node
+/// This class is the abstract superclass for all Operators. It provides the
+/// methods and virtual signature that is common to all Operator nodes.
+/// @brief HLVM AST Abstract Operator Node
+class Operator : public Documentable
{
/// @name Constructors
/// @{
- public:
- Operator(
- NodeIDs opID ///< The Operator ID for this operator kind
- ) : Node(opID), Operands() {}
+ protected:
+ Operator(NodeIDs opID) : Documentable(opID) {}
virtual ~Operator();
/// @}
/// @name Accessors
/// @{
public:
- bool isNilaryOperator();
- bool isUnaryOperator();
- bool isBinaryOperator();
- bool isTernaryOperator();
+ /// Get a specific operand of this operator.
+ virtual Operator* getOperand(unsigned opnum) = 0;
+
+ /// Determine if this is a classof some other type.
static inline bool classof(const Operator*) { return true; }
static inline bool classof(const Node* N) { return N->isOperator(); }
/// @}
+ friend class AST;
+};
+
+// An operator that takes no operands
+class NilaryOperator : public Operator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ NilaryOperator(NodeIDs opID ) : Operator(opID) {}
+ virtual ~NilaryOperator();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ virtual Operator* getOperand(unsigned opnum);
+ static inline bool classof(const NilaryOperator*) { return true; }
+ static inline bool classof(const Node* N) { return N->isNilaryOperator(); }
+ /// @}
+ friend class AST;
+};
+
+class UnaryOperator : public Operator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ UnaryOperator(NodeIDs opID) : Operator(opID), op1(0) {}
+ virtual ~UnaryOperator();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ virtual Operator* getOperand(unsigned opnum);
+ static inline bool classof(const UnaryOperator*) { return true; }
+ static inline bool classof(const Node* N) { return N->isUnaryOperator(); }
+
+ /// @}
+ /// @name Data
+ /// @{
+ protected:
+ Operator* op1;
+ /// @}
+ friend class AST;
+};
+
+class BinaryOperator : public Operator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ BinaryOperator(NodeIDs opID) : Operator(opID)
+ { ops[0] = ops[1] = 0; }
+ virtual ~BinaryOperator();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ virtual Operator* getOperand(unsigned opnum);
+ static inline bool classof(const BinaryOperator*) { return true; }
+ static inline bool classof(const Node* N) { return N->isBinaryOperator(); }
+
+ /// @}
+ /// @name Data
+ /// @{
+ protected:
+ Operator* ops[2];
+ /// @}
+ friend class AST;
+};
+
+class TernaryOperator : public Operator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ TernaryOperator(NodeIDs opID) : Operator(opID)
+ { ops[0] = ops[1] = ops[2] = 0; }
+ virtual ~TernaryOperator();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ virtual Operator* getOperand(unsigned opnum);
+ static inline bool classof(const TernaryOperator*) { return true; }
+ static inline bool classof(const Node* N) { return N->isTernaryOperator(); }
+
+ /// @}
+ /// @name Data
+ /// @{
+ protected:
+ Operator* ops[3];
+ /// @}
+ friend class AST;
+};
+
+class MultiOperator : public Operator
+{
+ /// @name Types
+ /// @{
+ public:
+ typedef std::vector<Operator*> OpList;
+ typedef OpList::iterator iterator;
+ typedef OpList::const_iterator const_iterator;
+
+ /// @}
+ /// @name Constructors
+ /// @{
+ protected:
+ MultiOperator(NodeIDs opID) : Operator(opID), ops(8) {}
+ virtual ~MultiOperator();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ virtual Operator* getOperand(unsigned opnum);
+ static inline bool classof(const MultiOperator*) { return true; }
+ static inline bool classof(const Node* N) { return N->isMultiOperator(); }
+
+ /// @}
+ /// @name Iterators
+ /// @{
+ public:
+ iterator begin() { return ops.begin(); }
+ const_iterator begin() const { return ops.begin(); }
+ iterator end () { return ops.end(); }
+ 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(); }
+
+ /// @}
/// @name Data
/// @{
protected:
- std::vector<Operator*> Operands; ///< The list of Operands
+ OpList ops; ///< The operands of this Operator
/// @}
friend class AST;
};
Modified: hlvm/trunk/hlvm/Pass/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Pass/SConscript?rev=38107&r1=38106&r2=38107&view=diff
==============================================================================
--- hlvm/trunk/hlvm/Pass/SConscript (original)
+++ hlvm/trunk/hlvm/Pass/SConscript Sat Jul 7 18:59:53 2007
@@ -1,4 +1,4 @@
-#===-- Build Script For hlvm/AST ------------------------------*- Python -*-===#
+#===-- Build Script For hlvm/Pass -----------------------------*- Python -*-===#
#
# High Level Virtual Machine (HLVM)
#
Modified: hlvm/trunk/hlvm/Pass/Validate.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Pass/Validate.cpp?rev=38107&r1=38106&r2=38107&view=diff
==============================================================================
--- hlvm/trunk/hlvm/Pass/Validate.cpp (original)
+++ hlvm/trunk/hlvm/Pass/Validate.cpp Sat Jul 7 18:59:53 2007
@@ -283,25 +283,18 @@
case FactorialOpID:
case GCDOpID:
case LCMOpID:
- case MungeOpID:
case LengthOpID:
- case MapFileOpID:
case OpenOpID:
case CloseOpID:
case ReadOpID:
case WriteOpID:
case PositionOpID:
- case IntOpID:
- case RealOpID:
case PInfOpID:
case NInfOpID:
case NaNOpID:
- case StringOpID:
- case ArrayOpID:
- case VectorOpID:
- case StructureOpID:
break; // Not implemented yet
case DocumentationID:
+ /// Nothing to validate (any doc is a good thing :)
break;
default:
hlvmDeadCode("Invalid Node Kind");
Added: hlvm/trunk/hlvm/Runtime/FileIO.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Runtime/FileIO.cpp?rev=38107&view=auto
==============================================================================
--- hlvm/trunk/hlvm/Runtime/FileIO.cpp (added)
+++ hlvm/trunk/hlvm/Runtime/FileIO.cpp Sat Jul 7 18:59:53 2007
@@ -0,0 +1,57 @@
+//===-- Runtime File I/O Implementation -------------------------*- 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/Runtime/FileIO.cpp
+/// @author Reid Spencer <rspencer at reidspencer.org> (original author)
+/// @date 2006/05/24
+/// @since 0.1.0
+/// @brief Implements the functions for runtime file input/output.
+//===----------------------------------------------------------------------===//
+
+#include <hlvm/Runtime/FileIO.h>
+#include <apr-1/apr_file_io.h>
+
+namespace
+{
+}
+
+extern "C"
+{
+
+void*
+_hlvm_op_file_open(_hlvm_ty_string* fname, uint32_t flags)
+{
+ return 0;
+}
+
+void
+_hlvm_op_file_close(void* fnum)
+{
+}
+
+uint32_t
+_hovm_op_file_write(void* fnum, void* data, size_t len)
+{
+ return 0;
+}
+
+}
Added: hlvm/trunk/hlvm/Runtime/FileIO.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Runtime/FileIO.h?rev=38107&view=auto
==============================================================================
--- hlvm/trunk/hlvm/Runtime/FileIO.h (added)
+++ hlvm/trunk/hlvm/Runtime/FileIO.h Sat Jul 7 18:59:53 2007
@@ -0,0 +1,46 @@
+//===-- Runtime File I/O Interface ------------------------------*- 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/Runtime/FileIO.h
+/// @author Reid Spencer <rspencer at reidspencer.com> (original author)
+/// @date 2006/05/24
+/// @since 0.1.0
+/// @brief Declares the interface to the runtime File Input/Output operations
+//===----------------------------------------------------------------------===//
+
+#ifndef HLVM_RUNTIME_FILEIO_H
+#define HLVM_RUNTIME_FILEIO_H
+
+#include <hlvm/Runtime/String.h>
+#include <llvm/Support/DataTypes.h>
+
+extern "C"
+{
+
+void* _hlvm_op_file_open(_hlvm_ty_string* fname, uint32_t flags);
+
+void _hlvm_op_file_close(void* file);
+
+uint32_t _hovm_op_file_write(void* file, void* data, size_t len);
+}
+
+#endif
Added: hlvm/trunk/hlvm/Runtime/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Runtime/SConscript?rev=38107&view=auto
==============================================================================
--- hlvm/trunk/hlvm/Runtime/SConscript (added)
+++ hlvm/trunk/hlvm/Runtime/SConscript Sat Jul 7 18:59:53 2007
@@ -0,0 +1,27 @@
+#===-- Build Script For hlvm/Runtime --------------------------*- 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.SharedLibrary('HLVMRuntime',hlvm.GetAllCXXFiles(env))
+hlvm.InstallLibrary(env,lib)
+hlvm.InstallHeader(env,hlvm.GetFiles(env,'*.h'))
Added: hlvm/trunk/hlvm/Runtime/String.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Runtime/String.cpp?rev=38107&view=auto
==============================================================================
--- hlvm/trunk/hlvm/Runtime/String.cpp (added)
+++ hlvm/trunk/hlvm/Runtime/String.cpp Sat Jul 7 18:59:53 2007
@@ -0,0 +1,38 @@
+//===-- Runtime String Implementation ---------------------------*- 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/Runtime/String.cpp
+/// @author Reid Spencer <rspencer at reidspencer.org> (original author)
+/// @date 2006/05/24
+/// @since 0.1.0
+/// @brief Implements the functions for runtime string support
+//===----------------------------------------------------------------------===//
+
+#include <hlvm/Runtime/String.h>
+#include <apr-1/apr_strings.h>
+
+namespace {
+}
+
+extern "C" {
+
+}
Added: hlvm/trunk/hlvm/Runtime/String.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Runtime/String.h?rev=38107&view=auto
==============================================================================
--- hlvm/trunk/hlvm/Runtime/String.h (added)
+++ hlvm/trunk/hlvm/Runtime/String.h Sat Jul 7 18:59:53 2007
@@ -0,0 +1,44 @@
+//===-- Runtime String Interface --------------------------------*- 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/Runtime/String.h
+/// @author Reid Spencer <rspencer at reidspencer.com> (original author)
+/// @date 2006/05/24
+/// @since 0.1.0
+/// @brief Declares the interface to the runtime string facilities
+//===----------------------------------------------------------------------===//
+
+#ifndef HLVM_RUNTIME_STRING_H
+#define HLVM_RUNTIME_STRING_H
+
+#include <llvm/Support/DataTypes.h>
+
+extern "C" {
+
+struct _hlvm_ty_string {
+ uint64_t len;
+ const char* str;
+};
+
+}
+
+#endif
Modified: hlvm/trunk/hlvm/SConscript
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/SConscript?rev=38107&r1=38106&r2=38107&view=diff
==============================================================================
--- hlvm/trunk/hlvm/SConscript (original)
+++ hlvm/trunk/hlvm/SConscript Sat Jul 7 18:59:53 2007
@@ -22,4 +22,4 @@
#===----------------------------------------------------------------------===#
from build import hlvm
Import('env')
-hlvm.Dirs(env,['Base','AST','Pass','Reader','Writer'])
+hlvm.Dirs(env,['Base','AST','Pass','Reader','Writer','Runtime'])
More information about the llvm-commits
mailing list