[llvm-commits] [hlvm] r38239 - in /hlvm/trunk/hlvm: AST/AST.h AST/Arithmetic.cpp AST/Arithmetic.h AST/BooleanOps.cpp AST/BooleanOps.h AST/Constants.h AST/ControlFlow.cpp AST/ControlFlow.h AST/MemoryOps.h AST/Node.h AST/RealMath.cpp AST/RealMath.h Pass/Validate.cpp
Reid Spencer
reid at x10sys.com
Sat Jul 7 17:01:29 PDT 2007
Author: reid
Date: Sat Jul 7 19:01:29 2007
New Revision: 38239
URL: http://llvm.org/viewvc/llvm-project?rev=38239&view=rev
Log:
Add Control Flow, Arithmetic, Real Math, and Boolean Operator support to
the AST. Set up the validator for validating these.
Added:
hlvm/trunk/hlvm/AST/Arithmetic.cpp
hlvm/trunk/hlvm/AST/Arithmetic.h
hlvm/trunk/hlvm/AST/BooleanOps.cpp
hlvm/trunk/hlvm/AST/BooleanOps.h
hlvm/trunk/hlvm/AST/RealMath.cpp
hlvm/trunk/hlvm/AST/RealMath.h
Modified:
hlvm/trunk/hlvm/AST/AST.h
hlvm/trunk/hlvm/AST/Constants.h
hlvm/trunk/hlvm/AST/ControlFlow.cpp
hlvm/trunk/hlvm/AST/ControlFlow.h
hlvm/trunk/hlvm/AST/MemoryOps.h
hlvm/trunk/hlvm/AST/Node.h
hlvm/trunk/hlvm/Pass/Validate.cpp
Modified: hlvm/trunk/hlvm/AST/AST.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/AST.h?rev=38239&r1=38238&r2=38239&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/AST.h (original)
+++ hlvm/trunk/hlvm/AST/AST.h Sat Jul 7 19:01:29 2007
@@ -34,6 +34,7 @@
#include <hlvm/AST/Type.h>
#include <hlvm/AST/ContainerType.h>
#include <hlvm/AST/RuntimeType.h>
+#include <hlvm/AST/Constant.h>
#include <string>
#include <vector>
@@ -437,6 +438,19 @@
const std::string& value, ///< The value of the ConstantText
const Locator* loc = 0 ///< The source locator
);
+ /// Create a unary ConstantExpression Node.
+ Constant* new_UnaryCE(
+ NodeIDs id, ///< The operator for the constant expression
+ Constant* C, ///< The constant operand of the unary operator
+ const Locator* loc = 0 ///< The source locator
+ );
+ /// Create a binary ConstantExpression Node.
+ Constant* new_BinaryCE(
+ NodeIDs id, ///< The operator for the constant expression
+ Constant* C1, ///< The first operand of the binary operator
+ Constant* C2, ///< The second operand of the binary operator
+ const Locator* loc = 0 ///< The source locator
+ );
/// Provide a template function for creating a nilary operator
template<class OpClass>
Added: hlvm/trunk/hlvm/AST/Arithmetic.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Arithmetic.cpp?rev=38239&view=auto
==============================================================================
--- hlvm/trunk/hlvm/AST/Arithmetic.cpp (added)
+++ hlvm/trunk/hlvm/AST/Arithmetic.cpp Sat Jul 7 19:01:29 2007
@@ -0,0 +1,50 @@
+//===-- AST Arithemetic Operators 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/AST/Arithmetic.cpp
+/// @author Reid Spencer <rspencer at reidspencer.com> (original author)
+/// @date 2006/06/14
+/// @since 0.2.0
+/// @brief Implements the AST Arithmentic Operators
+//===----------------------------------------------------------------------===//
+
+#include <hlvm/AST/Arithmetic.h>
+
+namespace hlvm
+{
+
+NegateOp::~NegateOp() {}
+ComplementOp::~ComplementOp() {}
+PreIncrOp::~PreIncrOp() {}
+PostIncrOp::~PostIncrOp() {}
+PreDecrOp::~PreDecrOp() {}
+PostDecrOp::~PostDecrOp() {}
+AddOp::~AddOp() {}
+SubtractOp::~SubtractOp() {}
+MultiplyOp::~MultiplyOp() {}
+DivideOp::~DivideOp() {}
+ModuloOp::~ModuloOp() {}
+BAndOp::~BAndOp() {}
+BOrOp::~BOrOp() {}
+BXorOp::~BXorOp() {}
+
+} // end hlvm namespace
Added: hlvm/trunk/hlvm/AST/Arithmetic.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Arithmetic.h?rev=38239&view=auto
==============================================================================
--- hlvm/trunk/hlvm/AST/Arithmetic.h (added)
+++ hlvm/trunk/hlvm/AST/Arithmetic.h Sat Jul 7 19:01:29 2007
@@ -0,0 +1,365 @@
+//===-- AST Arithemetic Operators 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/AST/Arithmetic.h
+/// @author Reid Spencer <rspencer at reidspencer.com> (original author)
+/// @date 2006/06/14
+/// @since 0.2.0
+/// @brief Declares the AST Arithmentic Operators
+//===----------------------------------------------------------------------===//
+
+#ifndef HLVM_AST_ARITHMETIC_H
+#define HLVM_AST_ARITHMETIC_H
+
+#include <hlvm/AST/Operator.h>
+
+namespace hlvm
+{
+
+/// This class provides an Abstract Syntax Tree node that represents a negation
+/// operator. The NegateOpID is a unary operator that negates its operand and
+/// returns that value.
+/// @brief AST Negate Operator Node
+class NegateOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ NegateOp() : UnaryOperator(NegateOpID) {}
+ virtual ~NegateOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const NegateOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(NegateOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a
+/// complement operator. The ComplementOpID is a unary operator that complements
+/// its operand and returns that value.
+/// @brief AST Complement Operator Node
+class ComplementOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ ComplementOp() : UnaryOperator(ComplementOpID) {}
+ virtual ~ComplementOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const ComplementOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(ComplementOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a
+/// pre-increment operator. The PreIncrOpID is a unary operator that increments
+/// its operand and returns the incremented value.
+/// @brief AST Pre-Increment Operator Node
+class PreIncrOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ PreIncrOp() : UnaryOperator(PreIncrOpID) {}
+ virtual ~PreIncrOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const PreIncrOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(PreIncrOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a
+/// post-increment operator. The PostIncrOpID is a unary operator that returns
+/// its operand and arranges for that operand to be incremented some time after
+/// the value has been used.
+/// @brief AST Post-Increment Operator Node
+class PostIncrOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ PostIncrOp() : UnaryOperator(PostIncrOpID) {}
+ virtual ~PostIncrOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const PostIncrOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(PostIncrOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a
+/// pre-decrement operator. The PreDecrOp is a unary operator that decrements
+/// the value of its operand and returns that decremented value.
+/// @brief AST Pre-Decrement Operator Node
+class PreDecrOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ PreDecrOp() : UnaryOperator(PreDecrOpID) {}
+ virtual ~PreDecrOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const PreDecrOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(PreDecrOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a
+/// post-decrement operator. The PostDecrOp is a unary operator that
+/// returns the value of its operand and then arranges for that value to be
+/// decremented after it has been used.
+/// @brief AST Post-Decrement Operator Node
+class PostDecrOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ PostDecrOp() : UnaryOperator(PostDecrOpID) {}
+ virtual ~PostDecrOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const PostDecrOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(PostDecrOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an operator
+/// to add two quantities. The AddOp is a binary operator that
+/// computes the sum of its two operands and returns that value.
+/// @brief AST Add Operator Node
+class AddOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ AddOp() : BinaryOperator(AddOpID) {}
+ virtual ~AddOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const AddOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(AddOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an operator
+/// to subtract two quantities. The SubractOp is a binary operator that
+/// computes the difference of its two operands and returns that value.
+/// @brief AST Subtract Operator Node
+class SubtractOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ SubtractOp() : BinaryOperator(SubtractOpID) {}
+ virtual ~SubtractOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const SubtractOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(SubtractOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an operator
+/// to multiply two quantities. The MultiplyOp is a binary operator that
+/// computes the product of its two operands and returns that value.
+/// @brief AST Multiply Operator Node
+class MultiplyOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ MultiplyOp() : BinaryOperator(MultiplyOpID) {}
+ virtual ~MultiplyOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const MultiplyOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(MultiplyOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an operator
+/// to divide two quantities. The DivideOp is a binary operator that
+/// computes the dividend of its two operands and returns that value.
+/// @brief AST Divide Operator Node
+class DivideOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ DivideOp() : BinaryOperator(DivideOpID) {}
+ virtual ~DivideOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const DivideOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(DivideOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a modulo
+/// operator. The ModuloOp is a binary operator that computes the remainder
+/// when its operands are divided and returns that value.
+/// @brief AST Modulo Operator Node
+class ModuloOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ ModuloOp() : BinaryOperator(ModuloOpID) {}
+ virtual ~ModuloOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const ModuloOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(ModuloOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a bitwise
+/// and operator. The BAndOp is a binary operator that computes a bitwise and on
+/// its two operands and returns that value. BAndOp can only be used with
+/// integral types.
+/// @brief AST Bitwise And Operator Node
+class BAndOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ BAndOp() : BinaryOperator(BAndOpID) {}
+ virtual ~BAndOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const BAndOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(BAndOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a bitwise
+/// or operator. The BOrOp is a binary operator that computes the bitwise or
+/// of its two operands and returns that value.
+/// @brief AST Bitwise Or Operator Node
+class BOrOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ BOrOp() : BinaryOperator(BOrOpID) {}
+ virtual ~BOrOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const BOrOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(BOrOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a bitwise
+/// exclusive or operator. The BXorOp is a binary operator that computes the
+/// bitwise exclusive or of its two operands and returns that value.
+/// @brief AST Bitwise Exclusive Or Operator Node
+class BXorOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ BXorOp() : BinaryOperator(BXorOpID) {}
+ virtual ~BXorOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const BXorOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(BXorOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+} // end hlvm namespace
+
+#endif
Added: hlvm/trunk/hlvm/AST/BooleanOps.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/BooleanOps.cpp?rev=38239&view=auto
==============================================================================
--- hlvm/trunk/hlvm/AST/BooleanOps.cpp (added)
+++ hlvm/trunk/hlvm/AST/BooleanOps.cpp Sat Jul 7 19:01:29 2007
@@ -0,0 +1,47 @@
+//===-- AST Boolean Operators 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/AST/BooleanOps.cpp
+/// @author Reid Spencer <rspencer at reidspencer.com> (original author)
+/// @date 2006/06/14
+/// @since 0.2.0
+/// @brief Implements the AST Boolean Operators
+//===----------------------------------------------------------------------===//
+
+#include <hlvm/AST/BooleanOps.h>
+
+namespace hlvm
+{
+
+NotOp::~NotOp() {}
+AndOp::~AndOp() {}
+OrOp::~OrOp() {}
+NorOp::~NorOp() {}
+XorOp::~XorOp() {}
+LessThanOp::~LessThanOp() {}
+GreaterThanOp::~GreaterThanOp() {}
+LessEqualOp::~LessEqualOp() {}
+GreaterEqualOp::~GreaterEqualOp() {}
+EqualityOp::~EqualityOp() {}
+InequalityOp::~InequalityOp() {}
+
+} // end hlvm namespace
Added: hlvm/trunk/hlvm/AST/BooleanOps.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/BooleanOps.h?rev=38239&view=auto
==============================================================================
--- hlvm/trunk/hlvm/AST/BooleanOps.h (added)
+++ hlvm/trunk/hlvm/AST/BooleanOps.h Sat Jul 7 19:01:29 2007
@@ -0,0 +1,302 @@
+//===-- AST Boolean Operators 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/AST/BooleanOps.h
+/// @author Reid Spencer <rspencer at reidspencer.com> (original author)
+/// @date 2006/06/14
+/// @since 0.2.0
+/// @brief Declares the AST Boolean Operators
+//===----------------------------------------------------------------------===//
+
+#ifndef HLVM_AST_BOOLEANOPS_H
+#define HLVM_AST_BOOLEANOPS_H
+
+#include <hlvm/AST/Operator.h>
+
+namespace hlvm
+{
+
+/// This class provides an Abstract Syntax Tree node that represents a not
+/// operator. The NotOp is a unary operator that returns false if its operand is
+/// is non-zero and true if its operand is zero.
+/// @brief AST Not Operator Node
+class NotOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ NotOp() : UnaryOperator(NotOpID) {}
+ virtual ~NotOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const NotOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(NotOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an operator
+/// to compute the logical and of two quantities. The AndOp is a binary operator
+/// that returns true if both its operands are non-zero and returns false
+/// otherwise.
+/// @brief AST And Operator Node
+class AndOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ AndOp() : BinaryOperator(AndOpID) {}
+ virtual ~AndOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const AndOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(AndOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an operator
+/// to compute the logical or of two quantities. The OrOp is a binary operator
+/// that returns false if both its operands are zero and returns true otherwise.
+/// @brief AST Or Operator Node
+class OrOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ OrOp() : BinaryOperator(OrOpID) {}
+ virtual ~OrOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const OrOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(OrOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an operator
+/// to compute the logical nor of two quantities. The NorOp is a binary operator
+/// that returns true if both its operands are zero and returns false
+/// otherwise.
+/// @brief AST And Operator Node
+class NorOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ NorOp() : BinaryOperator(NorOpID) {}
+ virtual ~NorOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const NorOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(NorOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an operator
+/// to compute the logical exclusive or of two quantities. The XorOp is a
+/// binary operator that returns true if either of its operands are non-zero
+/// and returns false if both operands are zero or non-zero.
+/// @brief AST Xor Operator Node
+class XorOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ XorOp() : BinaryOperator(XorOpID) {}
+ virtual ~XorOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const XorOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(XorOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an operator
+/// for performing less-than test. The LessThanOp compares its operands and if
+/// the first operand is less than the second operand it returns true, otherwise
+/// it returns false.
+/// @brief AST Less-Than Operator Node
+class LessThanOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ LessThanOp() : BinaryOperator(LessThanOpID) {}
+ virtual ~LessThanOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const LessThanOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(LessThanOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an operator
+/// for performing greater-than test. The GreaterThanOp compares its operands
+/// and if the first operand is greater than the second operand it returns true,
+/// otherwise it returns false.
+/// @brief AST Less-Than Operator Node
+class GreaterThanOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ GreaterThanOp() : BinaryOperator(GreaterThanOpID) {}
+ virtual ~GreaterThanOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const GreaterThanOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(GreaterThanOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an operator
+/// for performing less-equal test. The LessEqualOp compares its operands and
+/// if the first operand is less than or equal to the second operand it returns
+/// true, otherwise it returns false.
+/// @brief AST Less-Equal Operator Node
+class LessEqualOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ LessEqualOp() : BinaryOperator(LessEqualOpID) {}
+ virtual ~LessEqualOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const LessEqualOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(LessEqualOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an operator
+/// for performing greater-equal test. The GreaterEqualOp compares its operands
+/// and if the first operand is less than or equal to the second operand it
+/// returns true, otherwise it returns false.
+/// @brief AST Less-Equal Operator Node
+class GreaterEqualOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ GreaterEqualOp() : BinaryOperator(GreaterEqualOpID) {}
+ virtual ~GreaterEqualOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const GreaterEqualOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(GreaterEqualOpID);}
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an operator
+/// for performing equality test. The EqualsOp compares its operands
+/// and if the first operand is equal to the second operand it
+/// returns true, otherwise it returns false.
+/// @brief AST Equality Operator Node
+class EqualityOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ EqualityOp() : BinaryOperator(EqualityOpID) {}
+ virtual ~EqualityOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const EqualityOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(EqualityOpID);}
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an operator
+/// for performing inequality test. The InequalityOp compares its operands
+/// and if the first operand is less than or equal to the second operand it
+/// returns true, otherwise it returns false.
+/// @brief AST Inequality Operator Node
+class InequalityOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ InequalityOp() : BinaryOperator(InequalityOpID) {}
+ virtual ~InequalityOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const InequalityOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(InequalityOpID);}
+
+ /// @}
+ friend class AST;
+};
+
+} // end hlvm namespace
+
+#endif
Modified: hlvm/trunk/hlvm/AST/Constants.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Constants.h?rev=38239&r1=38238&r2=38239&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/Constants.h (original)
+++ hlvm/trunk/hlvm/AST/Constants.h Sat Jul 7 19:01:29 2007
@@ -161,7 +161,7 @@
/// the AST constants cumbersome. The way to think about this node is that it
/// represents a constant value of any type such that all the bits of that type
/// are zero.
-/// AST Constant Zero Node
+/// @brief AST Constant Zero Node
class ConstantZero : public Constant
{
/// @name Constructors
@@ -182,6 +182,92 @@
friend class AST;
};
+/// This class provides an Abstract Syntax Tree node that yields a constant
+/// aggregate. This can be used to specify constant values of aggregate types
+/// such as arrays, vectors, structures and continuations. It simply contains
+/// a list of other elements which themselves must be constants.
+/// @brief AST Constant Array Node.
+class ConstantAggregate : public Constant
+{
+ /// @name Types
+ /// @{
+ public:
+ typedef std::vector<Constant*> ElementsList;
+ typedef ElementsList::iterator iterator;
+ typedef ElementsList::const_iterator const_iterator;
+
+ /// @name Constructors
+ /// @{
+ protected:
+ ConstantAggregate() : Constant(ConstantAggregateID), elems() {}
+ virtual ~ConstantAggregate();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const ConstantAggregate*) { return true; }
+ static inline bool classof(const Node* N)
+ { return N->is(ConstantAggregateID); }
+
+ /// @}
+ /// @name Mutators
+ /// @{
+ protected:
+ virtual void insertChild(Node* n);
+ virtual void removeChild(Node* n);
+
+ /// @}
+ /// @name Iterators
+ /// @{
+ public:
+ iterator begin() { return elems.begin(); }
+ const_iterator begin() const { return elems.begin(); }
+ iterator end () { return elems.end(); }
+ const_iterator end () const { return elems.end(); }
+ size_t size () const { return elems.size(); }
+ bool empty() const { return elems.empty(); }
+ Constant* front() { return elems.front(); }
+ const Constant* front() const { return elems.front(); }
+ Constant* back() { return elems.back(); }
+ const Constant* back() const { return elems.back(); }
+
+ /// @}
+ /// @name Data
+ /// @{
+ protected:
+ ElementsList elems; ///< The contained types
+ /// @}
+
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that yields a constant
+/// expression. The expression uses a limited set of operator identifiers that
+/// can yield constants such as arithmetic or comparison operators.
+/// @brief AST Constant Expression Node.
+class ConstantExpression : public Constant
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ ConstantExpression(NodeIDs exprOp) : Constant(ConstantExpressionID)
+ { flags = exprOp; }
+ virtual ~ConstantExpression();
+ public:
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const ConstantExpression*) { return true; }
+ static inline bool classof(const Node* N)
+ { return N->is(ConstantExpressionID); }
+
+ /// @}
+ friend class AST;
+};
+
} // end hlvm namespace
#endif
Modified: hlvm/trunk/hlvm/AST/ControlFlow.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/ControlFlow.cpp?rev=38239&r1=38238&r2=38239&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/ControlFlow.cpp (original)
+++ hlvm/trunk/hlvm/AST/ControlFlow.cpp Sat Jul 7 19:01:29 2007
@@ -31,14 +31,11 @@
namespace hlvm {
-ReturnOp::~ReturnOp()
-{
-}
-
-ReturnOp*
-ReturnOp::create()
-{
- return new ReturnOp;
-}
+SelectOp::~SelectOp() {}
+SwitchOp::~SwitchOp() {}
+LoopOp::~LoopOp() {}
+ReturnOp::~ReturnOp() { }
+BreakOp::~BreakOp() {}
+ContinueOp::~ContinueOp() {}
}
Modified: hlvm/trunk/hlvm/AST/ControlFlow.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/ControlFlow.h?rev=38239&r1=38238&r2=38239&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/ControlFlow.h (original)
+++ hlvm/trunk/hlvm/AST/ControlFlow.h Sat Jul 7 19:01:29 2007
@@ -35,6 +35,97 @@
namespace hlvm
{
+/// This class provides an Abstract Syntax Tree node that represents a select
+/// operator. The select operator is a ternary operator that evaluates its first
+/// operand as a boolean. If the result is true, the second operand is evaluated
+/// and its result is the result of the select operator. If the result of the
+/// first operand is false, the third operand is evaluated and its result is the
+/// result of the select operator. This is similar to an "if" statement in other
+/// languages except it is unrestricted. The three operands can be of any type.
+/// @brief AST Select Operator Node
+class SelectOp : public TernaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ SelectOp() : TernaryOperator(SelectOpID) {}
+ virtual ~SelectOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const SelectOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(SelectOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a switch
+/// statement. THis is one of the more complicated operators in HLVM. The switch
+/// operator can have an unlimited number of operands. Its first operand is an
+/// expression to evaluate of any simple or primary type. This is the control
+/// expression. The remaining operands must be in pairs. The first operand of
+/// the pair is an operator to match agains the control expression. The second
+/// operand of the pair is an operator to execute if the first operand of the
+/// pair matched. This is very analagous to a switch statement in other
+/// languages except that it has fewer restrictions. It is not limited to
+/// integer types, but only to those types with a collation order. Its "case
+/// statements" are not limited to constant values but can be full expressions
+/// or even blocks of operators. Of course, constant values will execute faster.
+/// @brief AST Switch Operator Node
+class SwitchOp : public MultiOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ SwitchOp() : MultiOperator(SwitchOpID) {}
+ virtual ~SwitchOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const SwitchOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(SwitchOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a
+/// generalized loop construct for HLVM. The LoopOp takes three operands, as
+/// follows:
+/// -# a boolean expression to be evaluated before each iteration begins that
+/// controls loop termination
+/// -# an operator (typically a block) to be evaluated on each iteration of the
+/// loop. This is the main body of the loop
+/// -# a boolean expression to be evaluated after each iteration ends that
+/// controls loop termination
+/// Either or both of the control expressions can be a NoOp operator in which
+/// case the test is not performed. If both control expressions are NoOp, the
+/// loop is infinite.
+/// @brief AST Loop Operator Node
+class LoopOp : public TernaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ LoopOp() : TernaryOperator(LoopOpID) {}
+ virtual ~LoopOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const LoopOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(LoopOpID); }
+
+ /// @}
+ friend class AST;
+};
+
/// This class provides an Abstract Syntax Tree node that represents a return
/// operator. The return operator returns from the function that contains it.
/// The ReturnOp takes one operand which is the value to return to the caller
@@ -44,9 +135,6 @@
{
/// @name Constructors
/// @{
- public:
- static ReturnOp* create();
-
protected:
ReturnOp() : UnaryOperator(ReturnOpID) {}
virtual ~ReturnOp();
@@ -68,5 +156,62 @@
friend class AST;
};
+/// This class provides an Abstract Syntax Tree node that represents a break
+/// operator. A BreakOp causes control to flow to the operator immediately
+/// following the enclosing block. The enclosing block can be any kind of block.
+/// If a BreakOp occurs in the main block of a function, it is equivalent to
+/// returning void from that function. If the function doesn't return void, it
+/// is an error.
+/// @brief AST Break Operator Node
+class BreakOp : public NilaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ BreakOp() : NilaryOperator(BreakOpID) {}
+ virtual ~BreakOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const BreakOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(BreakOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a continue
+/// operator. A ContinueOp causes control to flow back to the start of the
+/// the enclosing block. The enclosing block is not required to be a loop. If
+/// the enclosing block is a loop, continuation first evaluates any exit
+/// criteria, then evaluates any entry criteria, and finally re-enters the body
+/// of the loop. This ensures that loop termination conditions are checked
+/// before continuing.
+/// @brief AST Continue Operator Node
+class ContinueOp : public NilaryOperator
+{
+ /// @name Constructors
+ /// @{
+ public:
+ static ContinueOp* create();
+
+ protected:
+ ContinueOp() : NilaryOperator(ContinueOpID) {}
+ virtual ~ContinueOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const ContinueOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(ContinueOpID); }
+
+ /// @}
+ friend class AST;
+};
+
} // end hlvm namespace
+
#endif
Modified: hlvm/trunk/hlvm/AST/MemoryOps.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/MemoryOps.h?rev=38239&r1=38238&r2=38239&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/MemoryOps.h (original)
+++ hlvm/trunk/hlvm/AST/MemoryOps.h Sat Jul 7 19:01:29 2007
@@ -39,6 +39,64 @@
class Variable;
/// This class provides an Abstract Syntax Tree node that represents an operator
+/// for allocating memory from the heap. The type of this operator indicates the
+/// element size for the allocation. The single operand must be of an integral
+/// type and indicates the number of elements to allocate.
+/// @brief AST Memory Allocation Operator
+class AllocateOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ AllocateOp() : UnaryOperator(AllocateOpID) {}
+
+ public:
+ virtual ~AllocateOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const AllocateOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(AllocateOpID); }
+
+ /// @}
+ /// @name Data
+ /// @{
+ protected:
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an operator
+/// for deallocating memory from the heap. This operator requires one operand
+/// which must be the value returned from a previous AllocateOp.
+/// @brief AST Memory Deallocation Operator
+class DeallocateOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ DeallocateOp() : UnaryOperator(DeallocateOpID) {}
+
+ public:
+ virtual ~DeallocateOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const DeallocateOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(DeallocateOpID); }
+
+ /// @}
+ /// @name Data
+ /// @{
+ protected:
+ /// @}
+ friend class AST;
+};
+/// This class provides an Abstract Syntax Tree node that represents an operator
/// for loading a value from a memory location. This operator takes a single
/// operand which must resolve to the address of a memory location, either
/// global or local (stack). The result of the operator is the value of the
Modified: hlvm/trunk/hlvm/AST/Node.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Node.h?rev=38239&r1=38238&r2=38239&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/Node.h (original)
+++ hlvm/trunk/hlvm/AST/Node.h Sat Jul 7 19:01:29 2007
@@ -137,6 +137,8 @@
ConstantIntegerID, ///< A constant integer value
ConstantRealID, ///< A constant real value
ConstantTextID, ///< A constant text value
+ ConstantAggregateID, ///< A constant aggregate for arrays, structures, etc
+ ConstantExpressionID, ///< A constant expression
SizeOfID, ///< Size of a type
// Linkage Items
@@ -154,6 +156,7 @@
// Nilary Operators (those taking no operands)
BreakOpID, ///< Break out of the enclosing loop
FirstNilaryOperatorID = BreakOpID,
+ ContinueOpID, ///< Continue from start of enclosing block
PInfOpID, ///< Constant Positive Infinity Real Value
NInfOpID, ///< Constant Negative Infinity Real Value
NaNOpID, ///< Constant Not-A-Number Real Value
@@ -164,7 +167,6 @@
ReturnOpID, ///< The Return A Value Operator
FirstUnaryOperatorID = ReturnOpID,
ThrowOpID, ///< The Throw an Exception Operator
- JumpToOpID, ///< The Jump To Labelled Block Operator
// Integer Arithmetic Unary Operators
NotOpID, ///< Not Unary Boolean Operator
@@ -178,7 +180,7 @@
// 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
+ IsNanOpID, ///< Real Number Not-A-Number Test Operator
TruncOpID, ///< Real Number Truncation Operator
RoundOpID, ///< Real Number Rounding Operator
FloorOpID, ///< Real Number Floor Operator
@@ -186,15 +188,15 @@
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
+ SquareRootOpID, ///< Real Number Square Root Operator
+ CubeRootOpID, ///< Real Number Cube Root Operator
FactorialOpID, ///< Real Number Factorial Operator
// Memory Unary Operators
LoadOpID, ///< The Load Operator (load a value from a location)
- AllocateOpID, ///< The Allocate Memory Operator (get heap memory)
- FreeOpID, ///< The Free Memory Operator (free heap memory)
+ AllocateOpID, ///< The Allocate Memory Operator
+ DeallocateOpID, ///< The Deallocate Memory Operator
AutoVarOpID, ///< Declaration of an automatic (stack) variable
- IndexOpID, ///< The Index Operator for indexing an array
// Input/Output Unary Operators
TellOpID, ///< Tell the position of a stream
@@ -210,22 +212,22 @@
SubtractOpID, ///< Subtraction Binary Operator
MultiplyOpID, ///< Multiplcation Binary Operator
DivideOpID, ///< Division Binary Operator
- ModulusOpID, ///< Modulus Binary Operator
+ ModuloOpID, ///< Modulus Binary Operator
BAndOpID, ///< Bitwise And Binary Operator
BOrOpID, ///< Bitwise Or Binary Operator
- BXOrOpID, ///< Bitwise XOr Binary Operator
+ BXorOpID, ///< Bitwise XOr Binary Operator
// Boolean Binary Operators
AndOpID, ///< And Binary Boolean Operator
OrOpID, ///< Or Binary Boolean Operator
NorOpID, ///< Nor Binary Boolean Operator
XorOpID, ///< Xor Binary Boolean Operator
- LTOpID, ///< < Binary Comparison Operator
- GTOpID, ///< > Binary Comparison Operator
- LEOpID, ///< <= Binary Comparison Operator
- GEOpID, ///< >= Binary Comparison Operator
- EQOpID, ///< == Binary Comparison Operator
- NEOpID, ///< != Binary Comparison Operator
+ LessThanOpID, ///< < Binary Comparison Operator
+ GreaterThanOpID, ///< > Binary Comparison Operator
+ LessEqualOpID, ///< <= Binary Comparison Operator
+ GreaterEqualOpID, ///< >= Binary Comparison Operator
+ EqualityOpID, ///< == Binary Comparison Operator
+ InequalityOpID, ///< != Binary Comparison Operator
// Real Arithmetic Binary Operators
PowerOpID, ///< Real Number Power Operator
@@ -245,13 +247,14 @@
LastBinaryOperatorID = CreateContOpID,
// Ternary Operators
- IfOpID, ///< The If-Then-Else Operator
-FirstTernaryOperatorID = IfOpID,
+ SelectOpID, ///< The select an alternate operator
+FirstTernaryOperatorID = SelectOpID,
StrInsertOpID, ///< Insert(str,where,what)
StrEraseOpID, ///< Erase(str,at,len)
StrReplaceOpID, ///< Replace(str,at,len,what)
PositionOpID, ///< Position a stream (stream,where,relative-to)
-LastTernaryOperatorID = PositionOpID,
+ LoopOpID, ///< The General Purpose Loop Operator
+LastTernaryOperatorID = LoopOpID,
// Multi Operators
CallOpID, ///< The Call Operator (n operands)
@@ -259,13 +262,13 @@
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)
-LastMultiOperatorID = LoopOpID,
-LastOperatorID = LoopOpID,
-LastValueID = LoopOpID,
-LastDocumentableID = LoopOpID,
-LastNodeID = LoopOpID,
+ IndexOpID, ///< The Index Operator for indexing an array
+ SwitchOpID, ///< The Switch Operator (n operands)
+LastMultiOperatorID = SwitchOpID,
+LastOperatorID = SwitchOpID,
+LastValueID = SwitchOpID,
+LastDocumentableID = SwitchOpID,
+LastNodeID = SwitchOpID,
NumNodeIDs ///< The number of node identifiers in the enum
};
Added: hlvm/trunk/hlvm/AST/RealMath.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/RealMath.cpp?rev=38239&view=auto
==============================================================================
--- hlvm/trunk/hlvm/AST/RealMath.cpp (added)
+++ hlvm/trunk/hlvm/AST/RealMath.cpp Sat Jul 7 19:01:29 2007
@@ -0,0 +1,52 @@
+//===-- AST Real Math Operators 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/AST/RealMath.cpp
+/// @author Reid Spencer <rspencer at reidspencer.com> (original author)
+/// @date 2006/06/14
+/// @since 0.2.0
+/// @brief Implements the AST Real Math Operators
+//===----------------------------------------------------------------------===//
+
+#include <hlvm/AST/RealMath.h>
+
+namespace hlvm {
+
+IsPInfOp::~IsPInfOp() {}
+IsNInfOp::~IsNInfOp() {}
+IsNanOp::~IsNanOp() {}
+TruncOp::~TruncOp() {}
+RoundOp::~RoundOp() {}
+FloorOp::~FloorOp() {}
+CeilingOp::~CeilingOp() {}
+LogEOp::~LogEOp() {}
+Log2Op::~Log2Op() {}
+Log10Op::~Log10Op() {}
+SquareRootOp::~SquareRootOp() {}
+CubeRootOp::~CubeRootOp() {}
+FactorialOp::~FactorialOp() {}
+PowerOp::~PowerOp() {}
+RootOp::~RootOp() {}
+GCDOp::~GCDOp() {}
+LCMOp::~LCMOp() {}
+
+} // end hlvm namespace
Added: hlvm/trunk/hlvm/AST/RealMath.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/RealMath.h?rev=38239&view=auto
==============================================================================
--- hlvm/trunk/hlvm/AST/RealMath.h (added)
+++ hlvm/trunk/hlvm/AST/RealMath.h Sat Jul 7 19:01:29 2007
@@ -0,0 +1,437 @@
+//===-- AST Real Math Operators 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/AST/RealMath.h
+/// @author Reid Spencer <rspencer at reidspencer.com> (original author)
+/// @date 2006/06/14
+/// @since 0.2.0
+/// @brief Declares the AST Real Math Operators
+//===----------------------------------------------------------------------===//
+
+#ifndef HLVM_AST_REALMATH_H
+#define HLVM_AST_REALMATH_H
+
+#include <hlvm/AST/Operator.h>
+
+namespace hlvm
+{
+
+/// This class provides an Abstract Syntax Tree node that represents a test
+/// for positive infinity on a real value. The IsPInOp is a unary operator
+/// that determines if its real number typed operand is the postive infinity
+/// value or not. A Boolean value is returned.
+/// @brief AST Positive Infinity Test Operator Node
+class IsPInfOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ IsPInfOp() : UnaryOperator(IsPInfOpID) {}
+ virtual ~IsPInfOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const IsPInfOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(IsPInfOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a test
+/// for negative infinity on a real value. The IsNInOp is a unary operator
+/// that determines if its real number typed operand is the negative infinity
+/// value or not. A Boolean value is returned.
+/// @brief AST Negative Infinity Test Operator Node
+class IsNInfOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ IsNInfOp() : UnaryOperator(IsNInfOpID) {}
+ virtual ~IsNInfOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const IsNInfOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(IsNInfOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a test
+/// for not-a-number (NaN) on a real value. The IsNaNOp is a unary operator
+/// that determines if its real number typed operand is the not-a-number
+/// value or not. A Boolean value is returned.
+/// @brief AST Not-A-Number Test Operator Node
+class IsNanOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ IsNanOp() : UnaryOperator(IsNanOpID) {}
+ virtual ~IsNanOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const IsNanOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(IsNanOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a real
+/// number truncation operator. The TruncOp removes the fractional portion of
+/// its real number operand and returns that truncated value.
+/// @brief AST Truncate Operator Node
+class TruncOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ TruncOp() : UnaryOperator(TruncOpID) {}
+ virtual ~TruncOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const TruncOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(TruncOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a real
+/// number rounding operator. The TruncOp rounds its real number operand towards
+/// the nearest integer, but rounds halfway cases away from zero. The rounded
+/// value is returned. This follows the C99 standard for rounding floating point
+/// numbers.
+/// @brief AST Rounding Operator Node
+class RoundOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ RoundOp() : UnaryOperator(RoundOpID) {}
+ virtual ~RoundOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const RoundOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(RoundOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a real
+/// number rounding operator. The FloorOp rounds its real number down to the
+/// nearest integer.
+/// @brief AST Floor Operator Node
+class FloorOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ FloorOp() : UnaryOperator(FloorOpID) {}
+ virtual ~FloorOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const FloorOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(FloorOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a real
+/// number rounding operator. The CeilingOp rounds its real number operand
+/// upwards to the nearest integer. The rounded value is returned.
+/// @brief AST Ceiling Operator Node
+class CeilingOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ CeilingOp() : UnaryOperator(CeilingOpID) {}
+ virtual ~CeilingOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const CeilingOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(CeilingOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an
+/// natural logarithm operator. The LogEOp is a unary operator that computes
+/// the natural (base e, Euler's number) logarithm of its operand and returns
+/// the result.
+/// @brief AST Natural Logarithm Operator Node
+class LogEOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ LogEOp() : UnaryOperator(LogEOpID) {}
+ virtual ~LogEOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const LogEOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(LogEOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a base
+/// two logarithm operator. The Log2Op is a unary operator that computes
+/// the base 2 logaritm of its operand and returns the result.
+/// @brief AST Base 2 Logarithm Operator Node
+class Log2Op : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ Log2Op() : UnaryOperator(Log2OpID) {}
+ virtual ~Log2Op();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const Log2Op*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(Log2OpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a base
+/// ten logarithm operator. The Log10Op is a unary operator that computes
+/// the base 10 logaritm of its operand and returns the result.
+/// @brief AST Base 10 Logarithm Operator Node
+class Log10Op : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ Log10Op() : UnaryOperator(Log10OpID) {}
+ virtual ~Log10Op();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const Log10Op*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(Log10OpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a square
+/// root operator. The SquareRootOp is a unary operator that computes
+/// the square root of its operand and returns the result.
+/// @brief AST Squar Root Operator Node
+class SquareRootOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ SquareRootOp() : UnaryOperator(SquareRootOpID) {}
+ virtual ~SquareRootOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const SquareRootOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(SquareRootOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a cube
+/// root operator. The CubeRootOp is a unary operator that computes
+/// the cube root of its operand and returns the result.
+/// @brief AST Squar Root Operator Node
+class CubeRootOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ CubeRootOp() : UnaryOperator(CubeRootOpID) {}
+ virtual ~CubeRootOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const CubeRootOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(CubeRootOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a factorial
+/// operator. The FactorialOp is a unary operator that computes
+/// the factorial of its operand and returns the result.
+/// @brief AST Factorial Operator Node
+class FactorialOp : public UnaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ FactorialOp() : UnaryOperator(FactorialOpID) {}
+ virtual ~FactorialOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const FactorialOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(FactorialOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an power
+/// operator. The PowerOp is a binary operator that raises the value of its
+/// first operand to the power of its second operand and returns the result.
+/// @brief AST Power Operator Node
+class PowerOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ PowerOp() : BinaryOperator(PowerOpID) {}
+ virtual ~PowerOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const PowerOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(PowerOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents an root
+/// operator. The RootOp is a binary operator that determines the root of its
+/// first operand as a base of its second operand and returns the result.
+/// @brief AST Root Operator Node
+class RootOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ RootOp() : BinaryOperator(RootOpID) {}
+ virtual ~RootOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const RootOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(RootOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a greatest
+/// common denominator operator. The GCDOp is a unary operator that computes
+/// the greatest common denominator of its operands and returns the result.
+/// @brief AST Factorial Operator Node
+class GCDOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ GCDOp() : BinaryOperator(GCDOpID) {}
+ virtual ~GCDOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const GCDOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(GCDOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+/// This class provides an Abstract Syntax Tree node that represents a least
+/// common multiple operator. The LCMOp is a binary operator that computes the
+/// least common multiple of its operands and returns the result.
+/// @brief AST Least Common Multiple Operator Node
+class LCMOp : public BinaryOperator
+{
+ /// @name Constructors
+ /// @{
+ protected:
+ LCMOp() : BinaryOperator(LCMOpID) {}
+ virtual ~LCMOp();
+
+ /// @}
+ /// @name Accessors
+ /// @{
+ public:
+ static inline bool classof(const LCMOp*) { return true; }
+ static inline bool classof(const Node* N) { return N->is(LCMOpID); }
+
+ /// @}
+ friend class AST;
+};
+
+} // end hlvm namespace
+
+#endif
Modified: hlvm/trunk/hlvm/Pass/Validate.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Pass/Validate.cpp?rev=38239&r1=38238&r2=38239&view=diff
==============================================================================
--- hlvm/trunk/hlvm/Pass/Validate.cpp (original)
+++ hlvm/trunk/hlvm/Pass/Validate.cpp Sat Jul 7 19:01:29 2007
@@ -29,9 +29,17 @@
#include <hlvm/Pass/Pass.h>
#include <hlvm/Base/Assert.h>
-#include <hlvm/AST/ContainerType.h>
#include <hlvm/AST/Bundle.h>
+#include <hlvm/AST/ContainerType.h>
+#include <hlvm/AST/RuntimeType.h>
+#include <hlvm/AST/ControlFlow.h>
+#include <hlvm/AST/MemoryOps.h>
+#include <hlvm/AST/InputOutput.h>
+#include <hlvm/AST/Arithmetic.h>
+#include <hlvm/AST/RealMath.h>
+#include <hlvm/AST/BooleanOps.h>
#include <hlvm/AST/LinkageItems.h>
+#include <hlvm/AST/Constants.h>
#include <llvm/Support/Casting.h>
#include <iostream>
@@ -46,20 +54,9 @@
virtual void handle(Node* b,Pass::TraversalKinds k);
inline void error(Node*n, const char* msg);
inline void validateName(Node*n, const std::string& name);
- inline void validateIntegerType(IntegerType* n);
- inline void validateRangeType(RangeType* n);
- inline void validateEnumerationType(EnumerationType* n);
- inline void validateRealType(RealType* n);
- inline void validateAliasType(AliasType* n);
- inline void validatePointerType(PointerType* n);
- inline void validateArrayType(ArrayType* n);
- inline void validateVectorType(VectorType* n);
- inline void validateStructureType(StructureType* n);
- inline void validateSignatureType(SignatureType* n);
- inline void validateVariable(Variable* n);
- inline void validateFunction(Variable* n);
- inline void validateProgram(Program* n);
- inline void validateBundle(Bundle* n);
+
+ template <class NodeClass>
+ inline void validate(NodeClass* C);
};
void
@@ -75,8 +72,34 @@
error(0,"Empty Name");
}
}
-inline void
-ValidateImpl::validateIntegerType(IntegerType* n)
+
+template<> inline void
+ValidateImpl::validate(VoidType* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(AnyType* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(BooleanType* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(CharacterType* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(OctetType* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(IntegerType* n)
{
validateName(n,n->getName());
if (n->getBits() == 0) {
@@ -84,68 +107,419 @@
}
}
-inline void
-ValidateImpl::validateRangeType(RangeType* n)
+template<> inline void
+ValidateImpl::validate(RangeType* n)
{
}
-inline void
-ValidateImpl::validateEnumerationType(EnumerationType* n)
+template<> inline void
+ValidateImpl::validate(EnumerationType* n)
{
}
-inline void
-ValidateImpl::validateRealType(RealType* n)
+template<> inline void
+ValidateImpl::validate(RealType* n)
{
}
-inline void
-ValidateImpl::validateAliasType(AliasType* n)
+template<> inline void
+ValidateImpl::validate(OpaqueType* n)
{
}
-inline void
-ValidateImpl::validatePointerType(PointerType* n)
+template<> inline void
+ValidateImpl::validate(TextType* n)
{
}
-inline void
-ValidateImpl::validateArrayType(ArrayType* n)
+template<> inline void
+ValidateImpl::validate(StreamType* n)
{
}
-inline void
-ValidateImpl::validateVectorType(VectorType* n)
+template<> inline void
+ValidateImpl::validate(BufferType* n)
{
}
-inline void
-ValidateImpl::validateStructureType(StructureType* n)
+template<> inline void
+ValidateImpl::validate(AliasType* n)
{
}
-inline void
-ValidateImpl::validateSignatureType(SignatureType* n)
+template<> inline void
+ValidateImpl::validate(PointerType* n)
{
}
-inline void
-ValidateImpl::validateVariable(Variable* n)
+template<> inline void
+ValidateImpl::validate(ArrayType* n)
{
}
-inline void
-ValidateImpl::validateFunction(Variable* n)
+template<> inline void
+ValidateImpl::validate(VectorType* n)
{
}
-inline void
-ValidateImpl::validateProgram(Program* n)
+template<> inline void
+ValidateImpl::validate(StructureType* n)
{
}
-inline void
-ValidateImpl::validateBundle(Bundle* n)
+template<> inline void
+ValidateImpl::validate(ContinuationType* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(SignatureType* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(Variable* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(Function* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(Program* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(Block* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(ReturnOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(BreakOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(ContinueOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(SelectOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(LoopOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(SwitchOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(AllocateOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(DeallocateOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(LoadOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(StoreOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(AutoVarOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(NegateOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(ComplementOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(PreIncrOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(PostIncrOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(PreDecrOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(PostDecrOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(AddOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(SubtractOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(MultiplyOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(DivideOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(ModuloOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(BAndOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(BOrOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(BXorOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(NotOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(AndOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(OrOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(NorOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(XorOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(LessThanOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(GreaterThanOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(LessEqualOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(GreaterEqualOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(EqualityOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(InequalityOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(IsPInfOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(IsNInfOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(IsNanOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(TruncOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(RoundOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(FloorOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(CeilingOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(LogEOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(Log2Op* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(Log10Op* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(SquareRootOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(CubeRootOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(FactorialOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(PowerOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(RootOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(GCDOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(LCMOp* n)
+{
+}
+
+
+template<> inline void
+ValidateImpl::validate(OpenOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(CloseOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(ReadOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(WriteOp* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(ConstantInteger* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(ConstantReal* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(ConstantText* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(ConstantZero* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(ConstantAggregate* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(ConstantExpression* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(Bundle* n)
+{
+}
+
+template<> inline void
+ValidateImpl::validate(Import* n)
{
}
@@ -157,141 +531,113 @@
case NoTypeID:
hlvmDeadCode("Invalid Node Kind");
break;
- case VoidTypeID:
- case AnyTypeID:
- case BooleanTypeID:
- case CharacterTypeID:
- case OctetTypeID:
- validateName(n,cast<Type>(n)->getName());
- break;
- case IntegerTypeID:
- validateIntegerType(cast<IntegerType>(n));
- break;
- case RangeTypeID:
- validateRangeType(cast<RangeType>(n));
- break;
- case EnumerationTypeID:
- validateEnumerationType(cast<EnumerationType>(n));
- break;
- case RealTypeID:
- validateRealType(cast<RealType>(n));
- break;
- case RationalTypeID:
- break; // Not implemented yet
- case TextTypeID:
- break; // Not imlpemented yet
- case AliasTypeID:
- validateAliasType(cast<AliasType>(n));
- break;
- case PointerTypeID:
- validatePointerType(cast<PointerType>(n));
- break;
- case ArrayTypeID:
- validateArrayType(cast<ArrayType>(n));
- break;
- case VectorTypeID:
- validateVectorType(cast<VectorType>(n));
- break;
- case StructureTypeID:
- validateStructureType(cast<StructureType>(n));
- break;
- case SignatureTypeID:
- validateSignatureType(cast<SignatureType>(n));
- break;
- case ContinuationTypeID:
- case OpaqueTypeID:
- case InterfaceID:
- case ClassID:
- case MethodID:
- case ImplementsID:
- break; // Not implemented yet
- case VariableID:
- validateVariable(cast<Variable>(n));
- break;
- case FunctionID:
- validateFunction(cast<Variable>(n));
- break;
- case ProgramID:
- validateProgram(cast<Program>(n));
- break;
- case BundleID:
- validateBundle(cast<Bundle>(n));
- break;
- case BlockID:
- case ImportID:
- case CallOpID:
- case InvokeOpID:
- case DispatchOpID:
- case CreateContOpID:
- case CallWithContOpID:
- case ReturnOpID:
- case ThrowOpID:
- case JumpToOpID:
- case BreakOpID:
- case IfOpID:
- case LoopOpID:
- case SelectOpID:
- case LoadOpID:
- case StoreOpID:
- case AllocateOpID:
- case FreeOpID:
- case ReallocateOpID:
- case ReferenceOpID:
- case NegateOpID:
- case ComplementOpID:
- case PreIncrOpID:
- case PostIncrOpID:
- case PreDecrOpID:
- case PostDecrOpID:
- case AddOpID:
- case SubtractOpID:
- case MultiplyOpID:
- case DivideOpID:
- case ModulusOpID:
- case BAndOpID:
- case BOrOpID:
- case BXOrOpID:
- case AndOpID:
- case OrOpID:
- case NorOpID:
- case XorOpID:
- case NotOpID:
- case LTOpID:
- case GTOpID:
- case LEOpID:
- case GEOpID:
- case EQOpID:
- case NEOpID:
- case IsPInfOpID:
- case IsNInfOpID:
- case IsNaNOpID:
- case AutoVarOpID:
- case TruncOpID:
- case RoundOpID:
- case FloorOpID:
- case CeilingOpID:
- case PowerOpID:
- case LogEOpID:
- case Log2OpID:
- case Log10OpID:
- case SqRootOpID:
- case RootOpID:
- case FactorialOpID:
- case GCDOpID:
- case LCMOpID:
- case LengthOpID:
- case OpenOpID:
- case CloseOpID:
- case ReadOpID:
- case WriteOpID:
- case PositionOpID:
- case PInfOpID:
- case NInfOpID:
- case NaNOpID:
- case ConstantIntegerID:
- case ConstantRealID:
- case ConstantTextID:
- case ConstantZeroID:
+ case VoidTypeID: validate(cast<VoidType>(n)); break;
+ case AnyTypeID: validate(cast<AnyType>(n)); break;
+ case BooleanTypeID: validate(cast<BooleanType>(n)); break;
+ case CharacterTypeID: validate(cast<CharacterType>(n)); break;
+ case OctetTypeID: validate(cast<OctetType>(n)); break;
+ case IntegerTypeID: validate(cast<IntegerType>(n)); break;
+ case RangeTypeID: validate(cast<RangeType>(n)); break;
+ case EnumerationTypeID: validate(cast<EnumerationType>(n)); break;
+ case RealTypeID: validate(cast<RealType>(n)); break;
+ case RationalTypeID: /*validate(cast<RationalType>(n));*/ break;
+ case TextTypeID: validate(cast<TextType>(n)); break;
+ case StreamTypeID: validate(cast<StreamType>(n)); break;
+ case BufferTypeID: validate(cast<BufferType>(n)); break;
+ case AliasTypeID: validate(cast<AliasType>(n)); break;
+ case PointerTypeID: validate(cast<PointerType>(n)); break;
+ case ArrayTypeID: validate(cast<ArrayType>(n)); break;
+ case VectorTypeID: validate(cast<VectorType>(n)); break;
+ case StructureTypeID: validate(cast<StructureType>(n)); break;
+ case SignatureTypeID: validate(cast<SignatureType>(n)); break;
+ case ContinuationTypeID: validate(cast<ContinuationType>(n)); break;
+ case OpaqueTypeID: validate(cast<OpaqueType>(n)); break;
+ case InterfaceID: /*validate(cast<InterfaceID>);*/ break;
+ case ClassID: /*validate(cast<ClassID>);*/ break;
+ case MethodID: /*validate(cast<MethodID>);*/ break;
+ case ImplementsID: /*validate(cast<ImplementsID>);*/ break;
+ case VariableID: validate(cast<Variable>(n)); break;
+ case FunctionID: validate(cast<Function>(n)); break;
+ case ProgramID: validate(cast<Program>(n)); break;
+ case BundleID: validate(cast<Bundle>(n)); break;
+ case BlockID: validate(cast<Block>(n)); break;
+ case ImportID: validate(cast<Import>(n)); break;
+ case CallOpID: /*validate(cast<CallOp>(n));*/ break;
+ case InvokeOpID: /*validate(cast<InvokeOp>(n));*/ break;
+ case DispatchOpID: /*validate(cast<DispatchOp>(n));*/ break;
+ case CreateContOpID: /*validate(cast<CreateContOp>(n));*/ break;
+ case CallWithContOpID: /*validate(cast<CallWithContOp>(n));*/ break;
+ case ReturnOpID: validate(cast<ReturnOp>(n)); break;
+ case ThrowOpID: /*validate(cast<ThrowOp>(n));*/ break;
+ case ContinueOpID: /*validate(cast<ContinueOp>(n));*/ break;
+ case BreakOpID: validate(cast<BreakOp>(n)); break;
+ case SelectOpID: validate(cast<SelectOp>(n)); break;
+ case LoopOpID: validate(cast<LoopOp>(n)); break;
+ case SwitchOpID: validate(cast<SwitchOp>(n)); break;
+ case LoadOpID: validate(cast<LoadOp>(n)); break;
+ case StoreOpID: validate(cast<StoreOp>(n)); break;
+ case AllocateOpID: validate(cast<AllocateOp>(n)); break;
+ case DeallocateOpID: validate(cast<DeallocateOp>(n)); break;
+ case ReallocateOpID: /*validate(cast<ReallocateOp>(n));*/ break;
+ case ReferenceOpID: /*validate(cast<ReferenceOp>(n));*/ break;
+ case AutoVarOpID: validate(cast<AutoVarOp>(n)); break;
+ case NegateOpID: validate(cast<NegateOp>(n)); break;
+ case ComplementOpID: validate(cast<ComplementOp>(n)); break;
+ case PreIncrOpID: validate(cast<PreIncrOp>(n)); break;
+ case PostIncrOpID: validate(cast<PostIncrOp>(n)); break;
+ case PreDecrOpID: validate(cast<PreDecrOp>(n)); break;
+ case PostDecrOpID: validate(cast<PostDecrOp>(n)); break;
+ case AddOpID: validate(cast<AddOp>(n)); break;
+ case SubtractOpID: validate(cast<SubtractOp>(n)); break;
+ case MultiplyOpID: validate(cast<MultiplyOp>(n)); break;
+ case DivideOpID: validate(cast<DivideOp>(n)); break;
+ case ModuloOpID: validate(cast<ModuloOp>(n)); break;
+ case BAndOpID: validate(cast<BAndOp>(n)); break;
+ case BOrOpID: validate(cast<BOrOp>(n)); break;
+ case BXorOpID: validate(cast<BXorOp>(n)); break;
+ case AndOpID: validate(cast<AndOp>(n)); break;
+ case OrOpID: validate(cast<OrOp>(n)); break;
+ case NorOpID: validate(cast<NorOp>(n)); break;
+ case XorOpID: validate(cast<XorOp>(n)); break;
+ case NotOpID: validate(cast<NotOp>(n)); break;
+ case LessThanOpID: validate(cast<LessThanOp>(n)); break;
+ case GreaterThanOpID: validate(cast<GreaterThanOp>(n)); break;
+ case LessEqualOpID: validate(cast<LessEqualOp>(n)); break;
+ case GreaterEqualOpID: validate(cast<GreaterEqualOp>(n)); break;
+ case EqualityOpID: validate(cast<EqualityOp>(n)); break;
+ case InequalityOpID: validate(cast<InequalityOp>(n)); break;
+ case IsPInfOpID: validate(cast<IsPInfOp>(n)); break;
+ case IsNInfOpID: validate(cast<IsNInfOp>(n)); break;
+ case IsNanOpID: validate(cast<IsNanOp>(n)); break;
+ case TruncOpID: validate(cast<TruncOp>(n)); break;
+ case RoundOpID: validate(cast<RoundOp>(n)); break;
+ case FloorOpID: validate(cast<FloorOp>(n)); break;
+ case CeilingOpID: validate(cast<CeilingOp>(n)); break;
+ case LogEOpID: validate(cast<LogEOp>(n)); break;
+ case Log2OpID: validate(cast<Log2Op>(n)); break;
+ case Log10OpID: validate(cast<Log10Op>(n)); break;
+ case SquareRootOpID: validate(cast<SquareRootOp>(n)); break;
+ case CubeRootOpID: validate(cast<CubeRootOp>(n)); break;
+ case FactorialOpID: validate(cast<FactorialOp>(n)); break;
+ case PowerOpID: validate(cast<PowerOp>(n)); break;
+ case RootOpID: validate(cast<RootOp>(n)); break;
+ case GCDOpID: validate(cast<GCDOp>(n)); break;
+ case LCMOpID: validate(cast<LCMOp>(n)); break;
+ case LengthOpID: /*validate(cast<LengthOp>(n)); */ break;
+ case OpenOpID: validate(cast<OpenOp>(n)); break;
+ case CloseOpID: validate(cast<CloseOp>(n)); break;
+ case ReadOpID: validate(cast<ReadOp>(n)); break;
+ case WriteOpID: validate(cast<WriteOp>(n)); break;
+ case PositionOpID: /*validate(cast<PositionOp>(n));*/ break;
+ case PInfOpID: /*validate(cast<PInfOp>(n));*/ break;
+ case NInfOpID: /*validate(cast<NInfoOp>(n));*/ break;
+ case NaNOpID: /*validate(cast<NaNOp>(n));*/ break;
+ case ConstantIntegerID: validate(cast<ConstantInteger>(n)); break;
+ case ConstantRealID: validate(cast<ConstantReal>(n)); break;
+ case ConstantTextID: validate(cast<ConstantText>(n)); break;
+ case ConstantZeroID: validate(cast<ConstantZero>(n)); break;
+ case ConstantAggregateID: validate(cast<ConstantAggregate>(n)); break;
+ case ConstantExpressionID: validate(cast<ConstantExpression>(n)); break;
break; // Not implemented yet
case DocumentationID:
/// Nothing to validate (any doc is a good thing :)
More information about the llvm-commits
mailing list