1 #ifndef VISITORS_LLVM_ASM_GENERATOR_HH
2 # define VISITORS_LLVM_ASM_GENERATOR_HH
7 # include <ozulis/ast/ast.hh>
8 # include <ozulis/visitors/visitor.hh>
14 /// @defgroup Visitors
16 * @brief Generates LLVM assembly
19 class LLVMAsmGenerator
: public ConstVisitor
<LLVMAsmGenerator
>
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
;
53 (LLVMAsmGenerator::*castTableValue_t
)(const ast::CastExp
& node
);
54 typedef std::map
<const castTableKey_t
, castTableValue_t
> castTable_t
;
56 castTable_t castTable_
;
63 #endif /* !VISITORS_LLVM_ASM_GENERATOR_HH */