OpenASIP 2.2
Loading...
Searching...
No Matches
Assembler.hh
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2017 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file Assembler.hh
26 *
27 * Declaration of Assembler class.
28 *
29 * @author Mikael Lepistö 2005 (tmlepist-no.spam-cs.tut.fi)
30 * @author Pekka Jääskeläinen 2006 (pekka.jaaskelainen-no.spam-tut.fi)
31 * @author Henry Linjamäki 2017 (henry.linjamaki-no.spam-tut.fi)
32 *
33 * @note rating yellow
34 */
35
36#ifndef TCEASM_ASSEMBLER_HH
37#define TCEASM_ASSEMBLER_HH
38
39#include "Exception.hh"
40#include "ParserStructs.hh"
42
43namespace TPEF {
44 class BinaryStream;
45 class Binary;
46}
47
48namespace TTAMachine {
49 class Machine;
50}
51
52/**
53 * TCE Assembler user interface.
54 */
55class Assembler {
56public:
58 TPEF::BinaryStream& assemblerFile,
59 TTAMachine::Machine& assemblerMachine);
60
62
63 const std::set<CompilerMessage>& warnings() const;
64
65 const CompilerMessage& error() const;
66
67 void addWarning(UValue lineNumber, std::string errorMessage);
68
70
71private:
72 void readAssemblerCode();
73
74 std::string codeLine(UValue lineNumber) const;
75
76 /// File containing file to assemble.
78
79 /// Machine for assembled TPEF.
81
82 /// Last thrown error message
84
85 /// Parser messages.
87
88 /// String containing code to compile.
89 std::shared_ptr<std::string> asmCode_;
90};
91
92#endif
unsigned long UValue
TTAMachine::Machine * mach_
Machine for assembled TPEF.
Definition Assembler.hh:80
TPEF::Binary * compile()
Definition Assembler.cc:68
AssemblyParserDiagnostic parserDiagnostic_
Parser messages.
Definition Assembler.hh:86
TPEF::BinaryStream & stream_
File containing file to assemble.
Definition Assembler.hh:77
const CompilerMessage & error() const
Definition Assembler.cc:165
std::string codeLine(UValue lineNumber) const
Definition Assembler.cc:196
std::shared_ptr< std::string > asmCode_
String containing code to compile.
Definition Assembler.hh:89
void readAssemblerCode()
Definition Assembler.cc:173
const std::set< CompilerMessage > & warnings() const
Definition Assembler.cc:155
const TTAMachine::Machine & targetMachine() const
Definition Assembler.cc:150
CompilerMessage error_
Last thrown error message.
Definition Assembler.hh:83
void addWarning(UValue lineNumber, std::string errorMessage)
Definition Assembler.cc:140