OpenASIP
2.0
|
#include <Assembler.hh>
Public Member Functions | |
Assembler (TPEF::BinaryStream &assemblerFile, TTAMachine::Machine &assemblerMachine) | |
TPEF::Binary * | compile () |
const std::set< CompilerMessage > & | warnings () const |
const CompilerMessage & | error () const |
void | addWarning (UValue lineNumber, std::string errorMessage) |
const TTAMachine::Machine & | targetMachine () const |
Private Member Functions | |
void | readAssemblerCode () |
std::string | codeLine (UValue lineNumber) const |
Private Attributes | |
TPEF::BinaryStream & | stream_ |
File containing file to assemble. More... | |
TTAMachine::Machine * | mach_ |
Machine for assembled TPEF. More... | |
CompilerMessage | error_ |
Last thrown error message. More... | |
AssemblyParserDiagnostic | parserDiagnostic_ |
Parser messages. More... | |
std::shared_ptr< std::string > | asmCode_ |
String containing code to compile. More... | |
TCE Assembler user interface.
Definition at line 55 of file Assembler.hh.
Assembler::Assembler | ( | TPEF::BinaryStream & | assemblerFile, |
TTAMachine::Machine & | assemblerMachine | ||
) |
Constructor.
assemblerFile | Stream containing file to assemble. |
assemblerMachine | Machine to use for running compiled binary. |
Definition at line 55 of file Assembler.cc.
void Assembler::addWarning | ( | UValue | lineNumber, |
std::string | errorMessage | ||
) |
Adds warning message for client to see.
lineNumber | Line number of assembly code, where error accured. |
errorMessage | Warning message. |
Definition at line 140 of file Assembler.cc.
References AssemblyParserDiagnostic::addWarning(), and parserDiagnostic_.
|
private |
Definition at line 196 of file Assembler.cc.
References AssemblyParserDiagnostic::codeLine(), and parserDiagnostic_.
Referenced by compile().
Binary * Assembler::compile | ( | ) |
Compiles assembler and returns TPEF hierarchy.
CompileError | If there was any problems during the compilation. |
Definition at line 68 of file Assembler.cc.
References __func__, asmCode_, CompilerMessage::assemblerLine, AssemblerParser::cleanup(), CompileError::codeFileLineNumber(), codeLine(), AssemblerParser::compile(), error(), error_, AssemblerParser::errorLine(), Exception::errorMessage(), AssemblerParser::finalize(), TTAMachine::Machine::isLittleEndian(), CompilerMessage::lineNumber, mach_, CompilerMessage::message, parserDiagnostic_, readAssemblerCode(), AssemblyParserDiagnostic::reset(), and Conversion::toString().
Referenced by main().
const CompilerMessage & Assembler::error | ( | ) | const |
Returns last thrown error message..
Definition at line 165 of file Assembler.cc.
References error_.
Referenced by compile().
|
private |
Reads assembly code from binary stream to a string.
Definition at line 173 of file Assembler.cc.
References asmCode_, TPEF::BinaryStream::readByte(), TPEF::BinaryStream::readPosition(), TPEF::BinaryStream::setReadPosition(), TPEF::BinaryStream::sizeOfFile(), and stream_.
Referenced by compile().
const TTAMachine::Machine & Assembler::targetMachine | ( | ) | const |
Returns the target machine of the assembler.
Definition at line 150 of file Assembler.cc.
References mach_.
const std::set< CompilerMessage > & Assembler::warnings | ( | ) | const |
Definition at line 155 of file Assembler.cc.
References parserDiagnostic_, and AssemblyParserDiagnostic::warnings().
Referenced by main().
|
private |
String containing code to compile.
Definition at line 89 of file Assembler.hh.
Referenced by compile(), and readAssemblerCode().
|
private |
Last thrown error message.
Definition at line 83 of file Assembler.hh.
|
private |
Machine for assembled TPEF.
Definition at line 80 of file Assembler.hh.
Referenced by compile(), and targetMachine().
|
private |
Parser messages.
Definition at line 86 of file Assembler.hh.
Referenced by addWarning(), codeLine(), compile(), and warnings().
|
private |
File containing file to assemble.
Definition at line 77 of file Assembler.hh.
Referenced by readAssemblerCode().