13 #ifndef XACC_XASMLISTENER_H 14 #define XACC_XASMLISTENER_H 17 #include "IRProvider.hpp" 18 #include "xasmBaseListener.h" 19 #include "expression_parsing_util.hpp" 20 #include "InstructionIterator.hpp" 34 std::shared_ptr<IRProvider> irProvider;
35 std::shared_ptr<CompositeInstruction>
function;
36 std::shared_ptr<CompositeInstruction> for_function;
37 std::shared_ptr<CompositeInstruction> if_stmt;
38 std::string bufferName =
"";
39 bool inForLoop =
false;
40 bool inIfStmt =
false;
42 std::vector<std::string> functionBufferNames;
43 std::string currentInstructionName;
44 std::vector<std::size_t> currentBits;
45 std::vector<std::string> currentBufferNames;
46 std::vector<InstructionParameter> currentParameters;
47 std::map<int, std::string> currentBitIdxExpressions;
49 std::map<std::string, int> new_var_to_vector_idx;
51 std::string currentCompositeName;
54 std::shared_ptr<ExpressionParsingUtil> parsingUtil;
58 std::vector<std::size_t> for_stmt_update_bits(
Instruction *inst,
59 const std::string varName,
61 std::vector<InstructionParameter>
62 for_stmt_update_params(
Instruction *inst,
const std::string varName,
66 void createForInstructions(xasmParser::ForstmtContext *ctx,
67 std::vector<InstPtr> &instructions,
68 std::shared_ptr<CompositeInstruction>
function) {
69 xacc::warning(
"[XasmCompiler] createForInstructions called with invalid " 70 "template parameter. Skipping.");
79 std::vector<std::string> getBufferNames() {
return functionBufferNames;}
81 std::shared_ptr<CompositeInstruction> getFunction() {
return function; }
83 void enterXacckernel(xasmParser::XacckernelContext * )
override;
84 void enterXacclambda(xasmParser::XacclambdaContext * )
override;
86 void enterInstruction(xasmParser::InstructionContext * )
override;
87 void enterBufferList(xasmParser::BufferListContext * )
override;
88 void enterParamList(xasmParser::ParamListContext * )
override;
89 void exitInstruction(xasmParser::InstructionContext * )
override;
91 void enterComposite_generator(
92 xasmParser::Composite_generatorContext * )
override;
93 void enterOptionsType(xasmParser::OptionsTypeContext * )
override;
94 void exitComposite_generator(
95 xasmParser::Composite_generatorContext * )
override;
97 void enterForstmt(xasmParser::ForstmtContext * )
override;
98 void exitForstmt(xasmParser::ForstmtContext * )
override;
100 void enterIfstmt(xasmParser::IfstmtContext * )
override;
101 void exitIfstmt(xasmParser::IfstmtContext * )
override;
Definition: xasm_listener.hpp:29
Definition: xasm_listener.hpp:28
Definition: Accelerator.hpp:25
Definition: xasm_listener.hpp:27
Definition: heterogeneous.hpp:45
Definition: Instruction.hpp:100
Definition: xasm_listener.hpp:30
Definition: xasm_listener.hpp:32