[visitors] ported llvm asm generator
[ozulis.git] / src / ozulis / visitors / llvm-asm-generator.hh
blobf9b5c02f57186baa6353cf7a3c22386d115495aa
1 #ifndef VISITORS_LLVM_ASM_GENERATOR_HH
2 # define VISITORS_LLVM_ASM_GENERATOR_HH
4 # include <ostream>
5 # include <map>
7 # include <ozulis/ast/ast.hh>
8 # include <ozulis/visitors/visitor.hh>
10 namespace ozulis
12 namespace visitors
14 /// @defgroup Visitors
15 /**
16 * @brief Generates LLVM assembly
17 * @ingroup Visitors
19 class LLVMAsmGenerator : public ConstVisitor<LLVMAsmGenerator>
21 public:
22 LLVMAsmGenerator(std::ostream & out);
23 virtual ~LLVMAsmGenerator();
25 static void initBase();
27 void visitUDivExp(const ast::DivExp & node);
28 void visitSDivExp(const ast::DivExp & node);
29 void visitFDivExp(const ast::DivExp & node);
30 void visitUModExp(const ast::ModExp & node);
31 void visitSModExp(const ast::ModExp & node);
32 void visitFModExp(const ast::ModExp & node);
34 void castBoolToBool(const ast::CastExp & node);
35 void castBoolToInteger(const ast::CastExp & node);
36 void castBoolToFloat(const ast::CastExp & node);
37 void castBoolToDouble(const ast::CastExp & node);
38 void castIntegerToBool(const ast::CastExp & node);
39 void castIntegerToInteger(const ast::CastExp & node);
40 void castIntegerToFloat(const ast::CastExp & node);
41 void castIntegerToDouble(const ast::CastExp & node);
42 void castFloatToDouble(const ast::CastExp & node);
43 void castFloatToBool(const ast::CastExp & node);
44 void castDoubleToBool(const ast::CastExp & node);
46 void castIntegerToPointer(const ast::CastExp & node);
47 void castPointerToInteger(const ast::CastExp & node);
49 void writeFunctionHeader(const ast::FunctionDecl & node);
51 typedef std::pair<core::id_t, core::id_t> castTableKey_t;
52 typedef void
53 (LLVMAsmGenerator::*castTableValue_t)(const ast::CastExp & node);
54 typedef std::map<const castTableKey_t, castTableValue_t> castTable_t;
56 castTable_t castTable_;
58 std::ostream & out_;
63 #endif /* !VISITORS_LLVM_ASM_GENERATOR_HH */