[llvm-commits] [hlvm] r38243 - in /hlvm/trunk: hlvm/AST/AST.cpp hlvm/AST/Constants.h hlvm/Pass/Validate.cpp hlvm/Reader/HLVM.rng hlvm/Reader/XMLReader.cpp hlvm/Writer/XMLWriter.cpp test/xml2xml/arithmetic.hlx test/xml2xml/autovar.hlx test/xml2xml/booleanops.hlx
Reid Spencer
reid at x10sys.com
Sat Jul 7 17:01:33 PDT 2007
Author: reid
Date: Sat Jul 7 19:01:33 2007
New Revision: 38243
URL: http://llvm.org/viewvc/llvm-project?rev=38243&view=rev
Log:
Add reading/writing and AST constrution for arithmetic and boolean
operators.
Added:
hlvm/trunk/test/xml2xml/arithmetic.hlx
hlvm/trunk/test/xml2xml/autovar.hlx
hlvm/trunk/test/xml2xml/booleanops.hlx
Modified:
hlvm/trunk/hlvm/AST/AST.cpp
hlvm/trunk/hlvm/AST/Constants.h
hlvm/trunk/hlvm/Pass/Validate.cpp
hlvm/trunk/hlvm/Reader/HLVM.rng
hlvm/trunk/hlvm/Reader/XMLReader.cpp
hlvm/trunk/hlvm/Writer/XMLWriter.cpp
Modified: hlvm/trunk/hlvm/AST/AST.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/AST.cpp?rev=38243&r1=38242&r2=38243&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/AST.cpp (original)
+++ hlvm/trunk/hlvm/AST/AST.cpp Sat Jul 7 19:01:33 2007
@@ -38,6 +38,9 @@
#include <hlvm/AST/ControlFlow.h>
#include <hlvm/AST/MemoryOps.h>
#include <hlvm/AST/InputOutput.h>
+#include <hlvm/AST/Arithmetic.h>
+#include <hlvm/AST/BooleanOps.h>
+#include <hlvm/AST/RealMath.h>
#include <hlvm/AST/SymbolTable.h>
#include <hlvm/Base/Assert.h>
#include <hlvm/Base/Pool.h>
@@ -604,6 +607,62 @@
return result;
}
+// Arithmetic Operators
+template NegateOp*
+AST::new_UnaryOp<NegateOp>(Value* op1, const Locator* loc);
+template ComplementOp*
+AST::new_UnaryOp<ComplementOp>(Value* op1, const Locator* loc);
+template PreIncrOp*
+AST::new_UnaryOp<PreIncrOp>(Value* op1, const Locator* loc);
+template PreDecrOp*
+AST::new_UnaryOp<PreDecrOp>(Value* op1, const Locator* loc);
+template PostIncrOp*
+AST::new_UnaryOp<PostIncrOp>(Value* op1, const Locator* loc);
+template PostDecrOp*
+AST::new_UnaryOp<PostDecrOp>(Value* op1, const Locator* loc);
+template AddOp*
+AST::new_BinaryOp<AddOp>(Value* op1, Value* op2, const Locator* loc);
+template SubtractOp*
+AST::new_BinaryOp<SubtractOp>(Value* op1, Value* op2, const Locator* loc);
+template MultiplyOp*
+AST::new_BinaryOp<MultiplyOp>(Value* op1, Value* op2, const Locator* loc);
+template DivideOp*
+AST::new_BinaryOp<DivideOp>(Value* op1, Value* op2, const Locator* loc);
+template ModuloOp*
+AST::new_BinaryOp<ModuloOp>(Value* op1, Value* op2, const Locator* loc);
+template BAndOp*
+AST::new_BinaryOp<BAndOp>(Value* op1, Value* op2, const Locator* loc);
+template BOrOp*
+AST::new_BinaryOp<BOrOp>(Value* op1, Value* op2, const Locator* loc);
+template BXorOp*
+AST::new_BinaryOp<BXorOp>(Value* op1, Value* op2, const Locator* loc);
+template BNorOp*
+AST::new_BinaryOp<BNorOp>(Value* op1, Value* op2, const Locator* loc);
+
+// Boolean Operators
+template NotOp*
+AST::new_UnaryOp<NotOp>(Value* op1, const Locator* loc);
+template AndOp*
+AST::new_BinaryOp<AndOp>(Value* op1, Value* op2, const Locator* loc);
+template OrOp*
+AST::new_BinaryOp<OrOp>(Value* op1, Value* op2, const Locator* loc);
+template NorOp*
+AST::new_BinaryOp<NorOp>(Value* op1, Value* op2, const Locator* loc);
+template XorOp*
+AST::new_BinaryOp<XorOp>(Value* op1, Value* op2, const Locator* loc);
+template LessThanOp*
+AST::new_BinaryOp<LessThanOp>(Value* op1, Value* op2, const Locator* loc);
+template GreaterThanOp*
+AST::new_BinaryOp<GreaterThanOp>(Value* op1, Value* op2,const Locator* loc);
+template LessEqualOp*
+AST::new_BinaryOp<LessEqualOp>(Value* op1, Value* op2, const Locator* loc);
+template GreaterEqualOp*
+AST::new_BinaryOp<GreaterEqualOp>(Value* op1,Value* op2, const Locator* loc);
+template EqualityOp*
+AST::new_BinaryOp<EqualityOp>(Value* op1, Value* op2, const Locator* loc);
+template InequalityOp*
+AST::new_BinaryOp<InequalityOp>(Value* op1,Value* op2,const Locator* loc);
+
// Control Flow Operators
template NoOperator*
AST::new_NilaryOp<NoOperator>(const Locator*loc);
@@ -721,61 +780,61 @@
case UInt8TypeID:
if (!ast->UInt8Singleton) {
ast->UInt8Singleton = new IntegerType(UInt8TypeID,8,false);
- ast->UInt8Singleton->setName("uint8_t");
+ ast->UInt8Singleton->setName("u8");
}
return ast->UInt8Singleton;
case UInt16TypeID:
if (!ast->UInt16Singleton) {
ast->UInt16Singleton = new IntegerType(UInt16TypeID,16,false);
- ast->UInt16Singleton->setName("uint16_t");
+ ast->UInt16Singleton->setName("u16");
}
return ast->UInt16Singleton;
case UInt32TypeID:
if (!ast->UInt32Singleton) {
ast->UInt32Singleton = new IntegerType(UInt32TypeID,32,false);
- ast->UInt32Singleton->setName("uint32_t");
+ ast->UInt32Singleton->setName("u32");
}
return ast->UInt32Singleton;
case UInt64TypeID:
if (!ast->UInt64Singleton) {
ast->UInt64Singleton = new IntegerType(UInt64TypeID,64,false);
- ast->UInt64Singleton->setName("uint64_t");
+ ast->UInt64Singleton->setName("u64");
}
return ast->UInt64Singleton;
case UInt128TypeID:
if (!ast->UInt128Singleton) {
ast->UInt128Singleton = new IntegerType(UInt128TypeID,128,false);
- ast->UInt128Singleton->setName("uint128_t");
+ ast->UInt128Singleton->setName("u128");
}
return ast->UInt128Singleton;
case SInt8TypeID:
if (!ast->SInt8Singleton) {
ast->SInt8Singleton = new IntegerType(SInt8TypeID,8,false);
- ast->SInt8Singleton->setName("int8_t");
+ ast->SInt8Singleton->setName("i8");
}
return ast->SInt8Singleton;
case SInt16TypeID:
if (!ast->SInt16Singleton) {
ast->SInt16Singleton = new IntegerType(SInt16TypeID,16,false);
- ast->SInt16Singleton->setName("int16_t");
+ ast->SInt16Singleton->setName("i16");
}
return ast->SInt16Singleton;
case SInt32TypeID:
if (!ast->SInt32Singleton) {
ast->SInt32Singleton = new IntegerType(SInt32TypeID,32,false);
- ast->SInt32Singleton->setName("int32_t");
+ ast->SInt32Singleton->setName("i32");
}
return ast->SInt32Singleton;
case SInt64TypeID:
if (!ast->SInt64Singleton) {
ast->SInt64Singleton = new IntegerType(SInt64TypeID,64,false);
- ast->SInt64Singleton->setName("int64_t");
+ ast->SInt64Singleton->setName("i64");
}
return ast->SInt64Singleton;
case SInt128TypeID:
if (!ast->SInt128Singleton) {
ast->SInt128Singleton = new IntegerType(SInt128TypeID,128,false);
- ast->SInt128Singleton->setName("int128_t");
+ ast->SInt128Singleton->setName("i128");
}
return ast->SInt128Singleton;
case Float32TypeID:
Modified: hlvm/trunk/hlvm/AST/Constants.h
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/AST/Constants.h?rev=38243&r1=38242&r2=38243&view=diff
==============================================================================
--- hlvm/trunk/hlvm/AST/Constants.h (original)
+++ hlvm/trunk/hlvm/AST/Constants.h Sat Jul 7 19:01:33 2007
@@ -43,23 +43,20 @@
/// @name Constructors
/// @{
protected:
- ConstantBoolean(bool val) : Constant(ConstantBooleanID), value(val) {}
+ ConstantBoolean(bool val) : Constant(ConstantBooleanID) {
+ flags = val; }
virtual ~ConstantBoolean();
/// @}
/// @name Accessors
/// @{
public:
+ bool getValue() { return flags != 0; }
static inline bool classof(const ConstantBoolean*) { return true; }
static inline bool classof(const Node* N)
{ return N->is(ConstantBooleanID); }
/// @}
- /// @name Data
- /// @{
- public:
- bool value;
- /// @}
friend class AST;
};
Modified: hlvm/trunk/hlvm/Pass/Validate.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Pass/Validate.cpp?rev=38243&r1=38242&r2=38243&view=diff
==============================================================================
--- hlvm/trunk/hlvm/Pass/Validate.cpp (original)
+++ hlvm/trunk/hlvm/Pass/Validate.cpp Sat Jul 7 19:01:33 2007
@@ -328,6 +328,11 @@
}
template<> inline void
+ValidateImpl::validate(BNorOp* n)
+{
+}
+
+template<> inline void
ValidateImpl::validate(NotOp* n)
{
}
@@ -489,6 +494,11 @@
}
template<> inline void
+ValidateImpl::validate(ConstantBoolean* n)
+{
+}
+
+template<> inline void
ValidateImpl::validate(ConstantInteger* n)
{
}
@@ -601,11 +611,12 @@
case BAndOpID: validate(cast<BAndOp>(n)); break;
case BOrOpID: validate(cast<BOrOp>(n)); break;
case BXorOpID: validate(cast<BXorOp>(n)); break;
+ case BNorOpID: validate(cast<BNorOp>(n)); break;
+ case NotOpID: validate(cast<NotOp>(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;
@@ -638,6 +649,7 @@
case PInfOpID: /*validate(cast<PInfOp>(n));*/ break;
case NInfOpID: /*validate(cast<NInfoOp>(n));*/ break;
case NaNOpID: /*validate(cast<NaNOp>(n));*/ break;
+ case ConstantBooleanID: validate(cast<ConstantBoolean>(n)); break;
case ConstantIntegerID: validate(cast<ConstantInteger>(n)); break;
case ConstantRealID: validate(cast<ConstantReal>(n)); break;
case ConstantTextID: validate(cast<ConstantText>(n)); break;
Modified: hlvm/trunk/hlvm/Reader/HLVM.rng
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Reader/HLVM.rng?rev=38243&r1=38242&r2=38243&view=diff
==============================================================================
--- hlvm/trunk/hlvm/Reader/HLVM.rng (original)
+++ hlvm/trunk/hlvm/Reader/HLVM.rng Sat Jul 7 19:01:33 2007
@@ -463,10 +463,7 @@
<define name="ref.elem">
<element name="ref">
- <attribute name="id">
- <ref name="Identifier.type"/>
- </attribute>
- <ref name="Documentation.pat"/>
+ <ref name="Named_Element.pat"/>
</element>
</define>
@@ -480,10 +477,9 @@
<ref name="extract.elem"/>
<ref name="insert.elem"/>
<ref name="shuffle.elem"/>
- <ref name="ComparisonOperators.pat"/>
+ <ref name="BooleanOperators.pat"/>
<ref name="UnaryArithmeticOperators.pat"/>
<ref name="BinaryArithmeticOperators.pat"/>
- <ref name="BinaryBitwiseOperators.pat"/>
</choice>
</define>
@@ -682,6 +678,7 @@
<choice>
<ref name="Operators.pat"/>
<ref name="Constant.pat"/>
+ <ref name="Location.pat"/>
</choice>
</define>
@@ -695,10 +692,9 @@
<define name="Operators.pat">
<choice>
<ref name="noop.elem"/>
- <ref name="ComparisonOperators.pat"/>
+ <ref name="BooleanOperators.pat"/>
<ref name="UnaryArithmeticOperators.pat"/>
<ref name="BinaryArithmeticOperators.pat"/>
- <ref name="BinaryBitwiseOperators.pat"/>
<ref name="MemoryOps.pat"/>
<ref name="InputOutputOps.pat"/>
<ref name="ControlFlowOps.pat"/>
@@ -861,6 +857,10 @@
<choice>
<ref name="neg.elem"/>
<ref name="cmpl.elem"/>
+ <ref name="preinc.elem"/>
+ <ref name="predec.elem"/>
+ <ref name="postinc.elem"/>
+ <ref name="postdec.elem"/>
</choice>
</define>
@@ -876,6 +876,30 @@
</element>
</define>
+ <define name="preinc.elem">
+ <element name="preinc">
+ <ref name="UnaryOperator.pat"/>
+ </element>
+ </define>
+
+ <define name="predec.elem">
+ <element name="predec">
+ <ref name="UnaryOperator.pat"/>
+ </element>
+ </define>
+
+ <define name="postinc.elem">
+ <element name="postinc">
+ <ref name="UnaryOperator.pat"/>
+ </element>
+ </define>
+
+ <define name="postdec.elem">
+ <element name="postdec">
+ <ref name="UnaryOperator.pat"/>
+ </element>
+ </define>
+
<!-- BINARY ARITHMETIC OPERATORS -->
<define name="BinaryArithmeticOperators.pat">
@@ -885,6 +909,10 @@
<ref name="mul.elem"/>
<ref name="div.elem"/>
<ref name="mod.elem"/>
+ <ref name="band.elem"/>
+ <ref name="bor.elem"/>
+ <ref name="bxor.elem"/>
+ <ref name="bnor.elem"/>
</choice>
</define>
@@ -918,14 +946,6 @@
</element>
</define>
- <define name="BinaryBitwiseOperators.pat">
- <choice>
- <ref name="bor.elem"/>
- <ref name="band.elem"/>
- <ref name="bxor.elem"/>
- </choice>
- </define>
-
<define name="bor.elem">
<element name="bor">
<ref name="BinaryOperator.pat"/>
@@ -944,13 +964,60 @@
</element>
</define>
- <define name="ComparisonOperators.pat">
+ <define name="bnor.elem">
+ <element name="bnor">
+ <ref name="BinaryOperator.pat"/>
+ </element>
+ </define>
+
+ <!-- Comparison Operators -->
+
+ <define name="BooleanOperators.pat">
<choice>
+ <ref name="not.elem"/>
+ <ref name="and.elem"/>
+ <ref name="or.elem"/>
+ <ref name="xor.elem"/>
+ <ref name="nor.elem"/>
<ref name="eq.elem"/>
<ref name="ne.elem"/>
+ <ref name="lt.elem"/>
+ <ref name="gt.elem"/>
+ <ref name="le.elem"/>
+ <ref name="ge.elem"/>
</choice>
</define>
+ <define name="not.elem">
+ <element name="not">
+ <ref name="UnaryOperator.pat"/>
+ </element>
+ </define>
+
+ <define name="and.elem">
+ <element name="and">
+ <ref name="BinaryOperator.pat"/>
+ </element>
+ </define>
+
+ <define name="or.elem">
+ <element name="or">
+ <ref name="BinaryOperator.pat"/>
+ </element>
+ </define>
+
+ <define name="xor.elem">
+ <element name="xor">
+ <ref name="BinaryOperator.pat"/>
+ </element>
+ </define>
+
+ <define name="nor.elem">
+ <element name="nor">
+ <ref name="BinaryOperator.pat"/>
+ </element>
+ </define>
+
<define name="eq.elem">
<element name="eq">
<ref name="BinaryOperator.pat"/>
Modified: hlvm/trunk/hlvm/Reader/XMLReader.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Reader/XMLReader.cpp?rev=38243&r1=38242&r2=38243&view=diff
==============================================================================
--- hlvm/trunk/hlvm/Reader/XMLReader.cpp (original)
+++ hlvm/trunk/hlvm/Reader/XMLReader.cpp Sat Jul 7 19:01:33 2007
@@ -40,6 +40,9 @@
#include <hlvm/AST/ControlFlow.h>
#include <hlvm/AST/MemoryOps.h>
#include <hlvm/AST/InputOutput.h>
+#include <hlvm/AST/Arithmetic.h>
+#include <hlvm/AST/BooleanOps.h>
+#include <hlvm/AST/RealMath.h>
#include <hlvm/Base/Assert.h>
#include <libxml/parser.h>
#include <libxml/relaxng.h>
@@ -1060,7 +1063,33 @@
{
Operator* op = 0;
switch (tkn) {
+ case TKN_neg: op = parseUnaryOp<NegateOp>(cur); break;
+ case TKN_cmpl: op = parseUnaryOp<ComplementOp>(cur); break;
+ case TKN_preinc: op = parseUnaryOp<PreIncrOp>(cur); break;
+ case TKN_predec: op = parseUnaryOp<PreDecrOp>(cur); break;
+ case TKN_postinc: op = parseUnaryOp<PostIncrOp>(cur); break;
+ case TKN_postdec: op = parseUnaryOp<PostDecrOp>(cur); break;
+ case TKN_add: op = parseBinaryOp<AddOp>(cur); break;
+ case TKN_sub: op = parseBinaryOp<SubtractOp>(cur); break;
+ case TKN_mul: op = parseBinaryOp<MultiplyOp>(cur); break;
+ case TKN_div: op = parseBinaryOp<DivideOp>(cur); break;
+ case TKN_mod: op = parseBinaryOp<ModuloOp>(cur); break;
+ case TKN_band: op = parseBinaryOp<BAndOp>(cur); break;
+ case TKN_bor: op = parseBinaryOp<BOrOp>(cur); break;
+ case TKN_bxor: op = parseBinaryOp<BXorOp>(cur); break;
+ case TKN_bnor: op = parseBinaryOp<BNorOp>(cur); break;
case TKN_noop: op = parseNilaryOp<NoOperator>(cur); break;
+ case TKN_not: op = parseUnaryOp<NotOp>(cur); break;
+ case TKN_and: op = parseBinaryOp<AndOp>(cur); break;
+ case TKN_or: op = parseBinaryOp<OrOp>(cur); break;
+ case TKN_nor: op = parseBinaryOp<NorOp>(cur); break;
+ case TKN_xor: op = parseBinaryOp<XorOp>(cur); break;
+ case TKN_eq: op = parseBinaryOp<EqualityOp>(cur); break;
+ case TKN_ne: op = parseBinaryOp<InequalityOp>(cur); break;
+ case TKN_lt: op = parseBinaryOp<LessThanOp>(cur); break;
+ case TKN_gt: op = parseBinaryOp<GreaterThanOp>(cur); break;
+ case TKN_ge: op = parseBinaryOp<GreaterEqualOp>(cur); break;
+ case TKN_le: op = parseBinaryOp<LessEqualOp>(cur); break;
case TKN_select: op = parseTernaryOp<SelectOp>(cur); break;
case TKN_switch: op = parseMultiOp<SwitchOp>(cur); break;
case TKN_loop: op = parseTernaryOp<LoopOp>(cur); break;
@@ -1112,6 +1141,12 @@
case TKN_break:
case TKN_continue:
case TKN_ret:
+ case TKN_neg:
+ case TKN_cmpl:
+ case TKN_preinc:
+ case TKN_predec:
+ case TKN_postinc:
+ case TKN_postdec:
case TKN_open:
case TKN_write:
case TKN_close:
Modified: hlvm/trunk/hlvm/Writer/XMLWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/hlvm/Writer/XMLWriter.cpp?rev=38243&r1=38242&r2=38243&view=diff
==============================================================================
--- hlvm/trunk/hlvm/Writer/XMLWriter.cpp (original)
+++ hlvm/trunk/hlvm/Writer/XMLWriter.cpp Sat Jul 7 19:01:33 2007
@@ -38,6 +38,9 @@
#include <hlvm/AST/ControlFlow.h>
#include <hlvm/AST/MemoryOps.h>
#include <hlvm/AST/InputOutput.h>
+#include <hlvm/AST/Arithmetic.h>
+#include <hlvm/AST/BooleanOps.h>
+#include <hlvm/AST/RealMath.h>
#include <hlvm/Base/Assert.h>
#include <hlvm/Pass/Pass.h>
#include <llvm/ADT/StringExtras.h>
@@ -372,6 +375,15 @@
}
template<> void
+XMLWriterImpl::WriterPass::put<ConstantBoolean>(ConstantBoolean* i)
+{
+ if (i->getValue())
+ startElement("true");
+ else
+ startElement("false");
+}
+
+template<> void
XMLWriterImpl::WriterPass::put<ConstantInteger>(ConstantInteger* i)
{
startElement("dec");
@@ -447,6 +459,189 @@
}
template<> void
+XMLWriterImpl::WriterPass::put<NegateOp>(NegateOp* op)
+{
+ startElement("neg");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<ComplementOp>(ComplementOp* op)
+{
+ startElement("cmpl");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<PreIncrOp>(PreIncrOp* op)
+{
+ startElement("preinc");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<PreDecrOp>(PreDecrOp* op)
+{
+ startElement("predec");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<PostIncrOp>(PostIncrOp* op)
+{
+ startElement("postinc");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<PostDecrOp>(PostDecrOp* op)
+{
+ startElement("postdec");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<AddOp>(AddOp* op)
+{
+ startElement("add");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<SubtractOp>(SubtractOp* op)
+{
+ startElement("sub");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<MultiplyOp>(MultiplyOp* op)
+{
+ startElement("mul");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<DivideOp>(DivideOp* op)
+{
+ startElement("div");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<ModuloOp>(ModuloOp* op)
+{
+ startElement("mod");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<BAndOp>(BAndOp* op)
+{
+ startElement("band");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<BOrOp>(BOrOp* op)
+{
+ startElement("bor");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<BXorOp>(BXorOp* op)
+{
+ startElement("bxor");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<BNorOp>(BNorOp* op)
+{
+ startElement("bnor");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<NotOp>(NotOp* op)
+{
+ startElement("not");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<AndOp>(AndOp* op)
+{
+ startElement("and");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<OrOp>(OrOp* op)
+{
+ startElement("or");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<XorOp>(XorOp* op)
+{
+ startElement("xor");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<NorOp>(NorOp* op)
+{
+ startElement("nor");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<EqualityOp>(EqualityOp* op)
+{
+ startElement("eq");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<InequalityOp>(InequalityOp* op)
+{
+ startElement("ne");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<LessThanOp>(LessThanOp* op)
+{
+ startElement("lt");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<GreaterThanOp>(GreaterThanOp* op)
+{
+ startElement("gt");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<LessEqualOp>(LessEqualOp* op)
+{
+ startElement("le");
+ putDoc(op);
+}
+
+template<> void
+XMLWriterImpl::WriterPass::put<GreaterEqualOp>(GreaterEqualOp* op)
+{
+ startElement("ge");
+ putDoc(op);
+}
+
+
+template<> void
XMLWriterImpl::WriterPass::put<NoOperator>(NoOperator* op)
{
startElement("noop");
@@ -572,6 +767,7 @@
case VectorTypeID: put(cast<VectorType>(n)); break;
case StructureTypeID: put(cast<StructureType>(n)); break;
case SignatureTypeID: put(cast<SignatureType>(n)); break;
+ case ConstantBooleanID: put(cast<ConstantBoolean>(n)); break;
case ConstantIntegerID: put(cast<ConstantInteger>(n)); break;
case ConstantRealID: put(cast<ConstantReal>(n)); break;
case ConstantTextID: put(cast<ConstantText>(n)); break;
@@ -581,6 +777,32 @@
case ProgramID: put(cast<Program>(n)); break;
case BlockID: put(cast<Block>(n)); break;
case AutoVarOpID: put(cast<AutoVarOp>(n)); break;
+ case NegateOpID: put(cast<NegateOp>(n)); break;
+ case ComplementOpID: put(cast<ComplementOp>(n)); break;
+ case PreIncrOpID: put(cast<PreIncrOp>(n)); break;
+ case PreDecrOpID: put(cast<PreDecrOp>(n)); break;
+ case PostIncrOpID: put(cast<PostIncrOp>(n)); break;
+ case PostDecrOpID: put(cast<PostDecrOp>(n)); break;
+ case AddOpID: put(cast<AddOp>(n)); break;
+ case SubtractOpID: put(cast<SubtractOp>(n)); break;
+ case MultiplyOpID: put(cast<MultiplyOp>(n)); break;
+ case DivideOpID: put(cast<DivideOp>(n)); break;
+ case ModuloOpID: put(cast<ModuloOp>(n)); break;
+ case BAndOpID: put(cast<BAndOp>(n)); break;
+ case BOrOpID: put(cast<BOrOp>(n)); break;
+ case BXorOpID: put(cast<BXorOp>(n)); break;
+ case BNorOpID: put(cast<BNorOp>(n)); break;
+ case NotOpID: put(cast<NotOp>(n)); break;
+ case AndOpID: put(cast<AndOp>(n)); break;
+ case OrOpID: put(cast<OrOp>(n)); break;
+ case XorOpID: put(cast<XorOp>(n)); break;
+ case NorOpID: put(cast<NorOp>(n)); break;
+ case EqualityOpID: put(cast<EqualityOp>(n)); break;
+ case InequalityOpID: put(cast<InequalityOp>(n)); break;
+ case LessThanOpID: put(cast<LessThanOp>(n)); break;
+ case GreaterThanOpID: put(cast<GreaterThanOp>(n)); break;
+ case LessEqualOpID: put(cast<LessEqualOp>(n)); break;
+ case GreaterEqualOpID: put(cast<GreaterEqualOp>(n)); break;
case NoOperatorID: put(cast<NoOperator>(n)); break;
case SelectOpID: put(cast<SelectOp>(n)); break;
case SwitchOpID: put(cast<SwitchOp>(n)); break;
Added: hlvm/trunk/test/xml2xml/arithmetic.hlx
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/test/xml2xml/arithmetic.hlx?rev=38243&view=auto
==============================================================================
--- hlvm/trunk/test/xml2xml/arithmetic.hlx (added)
+++ hlvm/trunk/test/xml2xml/arithmetic.hlx Sat Jul 7 19:01:33 2007
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hlvm xmlns="http://hlvm.org/src/hlvm/Reader/XML/HLVM.rng" pubid="http://hlvm.org/src/hlvm/test/xml2xml/unaryarithmetic.hlx">
+ <bundle id="unaryarithmetic">
+ <program id="unaryarithmetic">
+ <block>
+ <autovar id="v1" type="u32">
+ <zero/>
+ </autovar>
+ <autovar id="v2" type="u32">
+ <zero/>
+ </autovar>
+ <preinc>
+ <ref id="v1"/>
+ </preinc>
+ <postinc>
+ <ref id="v1"/>
+ </postinc>
+ <postdec>
+ <ref id="v2"/>
+ </postdec>
+ <predec>
+ <ref id="v2"/>
+ </predec>
+ <neg>
+ <ref id="v1"/>
+ </neg>
+ <cmpl>
+ <ref id="v2"/>
+ </cmpl>
+ <add>
+ <ref id="v1"/>
+ <dec>1</dec>
+ </add>
+ <sub>
+ <ref id="v1"/>
+ <dec>1</dec>
+ </sub>
+ <mul>
+ <ref id="v1"/>
+ <ref id="v2"/>
+ </mul>
+ <div>
+ <ref id="v1"/>
+ <ref id="v2"/>
+ </div>
+ <mod>
+ <ref id="v1"/>
+ <ref id="v2"/>
+ </mod>
+ <band>
+ <ref id="v1"/>
+ <ref id="v2"/>
+ </band>
+ <bor>
+ <ref id="v1"/>
+ <ref id="v2"/>
+ </bor>
+ <bxor>
+ <ref id="v1"/>
+ <ref id="v2"/>
+ </bxor>
+ <bnor>
+ <ref id="v1"/>
+ <ref id="v2"/>
+ </bnor>
+ </block>
+ </program>
+ </bundle>
+</hlvm>
Added: hlvm/trunk/test/xml2xml/autovar.hlx
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/test/xml2xml/autovar.hlx?rev=38243&view=auto
==============================================================================
--- hlvm/trunk/test/xml2xml/autovar.hlx (added)
+++ hlvm/trunk/test/xml2xml/autovar.hlx Sat Jul 7 19:01:33 2007
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hlvm xmlns="http://hlvm.org/src/hlvm/Reader/XML/HLVM.rng" pubid="http://hlvm.org/src/hlvm/test/xml2xml/autovar.hlx">
+ <bundle id="autovar">
+ <program id="autovar">
+ <block>
+ <autovar id="v1" type="u32">
+ <zero/>
+ </autovar>
+ </block>
+ </program>
+ </bundle>
+</hlvm>
Added: hlvm/trunk/test/xml2xml/booleanops.hlx
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/test/xml2xml/booleanops.hlx?rev=38243&view=auto
==============================================================================
--- hlvm/trunk/test/xml2xml/booleanops.hlx (added)
+++ hlvm/trunk/test/xml2xml/booleanops.hlx Sat Jul 7 19:01:33 2007
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hlvm xmlns="http://hlvm.org/src/hlvm/Reader/XML/HLVM.rng" pubid="http://hlvm.org/src/hlvm/test/xml2xml/unaryarithmetic.hlx">
+ <bundle id="unaryarithmetic">
+ <program id="unaryarithmetic">
+ <block>
+ <autovar id="v1" type="bool">
+ <true/>
+ </autovar>
+ <autovar id="v2" type="bool">
+ <false/>
+ </autovar>
+ <not>
+ <ref id="v1"/>
+ </not>
+ <and>
+ <ref id="v1"/>
+ <ref id="v2"/>
+ </and>
+ <or>
+ <ref id="v1"/>
+ <ref id="v2"/>
+ </or>
+ <nor>
+ <ref id="v1"/>
+ <ref id="v2"/>
+ </nor>
+ <xor>
+ <ref id="v1"/>
+ <ref id="v2"/>
+ </xor>
+ <eq>
+ <ref id="v1"/>
+ <ref id="v2"/>
+ </eq>
+ <ne>
+ <ref id="v1"/>
+ <ref id="v2"/>
+ </ne>
+ <gt>
+ <ref id="v1"/>
+ <ref id="v2"/>
+ </gt>
+ <lt>
+ <ref id="v1"/>
+ <ref id="v2"/>
+ </lt>
+ <ge>
+ <ref id="v1"/>
+ <ref id="v2"/>
+ </ge>
+ <le>
+ <ref id="v1"/>
+ <ref id="v2"/>
+ </le>
+ </block>
+ </program>
+ </bundle>
+</hlvm>
More information about the llvm-commits
mailing list