Skip to content

Commit

Permalink
attempt to reuduce memory footprint during compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Nic30 committed Dec 27, 2020
1 parent 1233e24 commit 06fbd10
Show file tree
Hide file tree
Showing 53 changed files with 128 additions and 142 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace hdlConvertor {
namespace vhdl {

class VhdlGenerateStatementParser : public BaseVhdlParser {
class VhdlGenerateStatementParser: public BaseVhdlParser {
public:
using BaseVhdlParser::BaseVhdlParser;
using vhdlParser = vhdl_antlr::vhdlParser;
Expand Down
2 changes: 0 additions & 2 deletions src/hdlAst/hdlNamespace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
namespace hdlConvertor {
namespace hdlAst {

using namespace std;

HdlValueIdspace::HdlValueIdspace() :
WithNameAndDoc(), defs_only(false) {
}
Expand Down
3 changes: 2 additions & 1 deletion src/hdlAst/hdlOp.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#include <hdlConvertor/hdlAst/hdlOp.h>
#include <hdlConvertor/createObject.h>

using namespace std;

namespace hdlConvertor {
namespace hdlAst {

using namespace std;

HdlOp::HdlOp() {
op = HdlOpType::ARROW;
operands.reserve(2);
Expand Down
3 changes: 2 additions & 1 deletion src/hdlAst/hdlStmAssign.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#include <hdlConvertor/hdlAst/hdlStmAssign.h>
#include <stdexcept>

using namespace std;

namespace hdlConvertor {
namespace hdlAst {

using namespace std;

HdlStmAssign::HdlStmAssign(std::unique_ptr<iHdlExprItem> _dst,
std::unique_ptr<iHdlExprItem> _src, bool _is_blocking) :
HdlStmAssign(move(_dst), move(_src), nullptr, nullptr, _is_blocking) {
Expand Down
3 changes: 2 additions & 1 deletion src/hdlAst/hdlStmProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

#include <hdlConvertor/createObject.h>

using namespace std;

namespace hdlConvertor {
namespace hdlAst {

using namespace std;

HdlStmProcess::HdlStmProcess() :
iHdlStatement(), body(create_object<HdlStmBlock>(nullptr)) {
}
Expand Down
3 changes: 2 additions & 1 deletion src/hdlAst/hdlValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
#include <array>
#include <assert.h>

using namespace std;

namespace hdlConvertor {
namespace hdlAst {

using namespace std;

HdlValueArr::HdlValueArr(const HdlValueArr &other) :
iHdlExprItem() {
assert(other._arr);
Expand Down
2 changes: 0 additions & 2 deletions src/hdlAst/iHdlExpr.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include <hdlConvertor/hdlAst/iHdlExpr.h>

using namespace std;

namespace hdlConvertor {
namespace hdlAst {

Expand Down
2 changes: 0 additions & 2 deletions src/hdlAst/iHdlStatement.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include <hdlConvertor/hdlAst/iHdlStatement.h>

using namespace std;

namespace hdlConvertor {
namespace hdlAst {

Expand Down
6 changes: 2 additions & 4 deletions src/hdlConvertor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
namespace hdlConvertor {

using namespace std;
using namespace antlr4;
using namespace antlr4::tree;
using namespace hdlConvertor::hdlAst;

bool HdlConvertor::debug = false;
Expand Down Expand Up @@ -58,7 +56,7 @@ class SVParserContainer: public iParserContainer<sv2017_antlr::sv2017Lexer,
string preprocessed_code = preprocess_res.str();
file_line_map = preprocess_res.file_line_map;

ANTLRInputStream input_for_parser(preprocessed_code);
antlr4::ANTLRInputStream input_for_parser(preprocessed_code);
input_for_parser.name = file_name.u8string();
this->_parse(input_for_parser, hierarchyOnly);
}
Expand All @@ -72,7 +70,7 @@ class SVParserContainer: public iParserContainer<sv2017_antlr::sv2017Lexer,
string preprocessed_code = preprocess_res.str();
file_line_map = preprocess_res.file_line_map;

ANTLRInputStream input_for_parser(preprocessed_code);
antlr4::ANTLRInputStream input_for_parser(preprocessed_code);
input_for_parser.name = STRING_FILENAME;
this->_parse(input_for_parser, hierarchyOnly);
}
Expand Down
2 changes: 0 additions & 2 deletions src/svConvertor/attributeParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
namespace hdlConvertor {
namespace sv {

using namespace sv2017_antlr;

void VerAttributeParser::visitAttribute_instance(
sv2017Parser::Attribute_instanceContext *ctx) {
// attribute_instance : '(' '*' attr_spec ( ',' attr_spec )* '*' ')' ;
Expand Down
2 changes: 0 additions & 2 deletions src/svConvertor/baseSvParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
namespace hdlConvertor {
namespace sv {

using namespace std;
using sv2017Parser = sv2017_antlr::sv2017Parser;
using namespace hdlConvertor::hdlAst;

BaseSvParser::BaseSvParser(SVCommentParser &_commentParser,
Expand Down
7 changes: 4 additions & 3 deletions src/svConvertor/declrParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@

#include <assert.h>

using namespace std;
using namespace sv2017_antlr;
using namespace hdlConvertor::hdlAst;

namespace hdlConvertor {
namespace sv {

using namespace std;
using namespace hdlConvertor::hdlAst;


void VerDeclrParser::visitData_declaration(
sv2017Parser::Data_declarationContext *ctx,
vector<unique_ptr<iHdlObj>> &res) {
Expand Down
5 changes: 2 additions & 3 deletions src/svConvertor/delayParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
#include <hdlConvertor/createObject.h>


using namespace std;
using sv2017Parser = sv2017_antlr::sv2017Parser;
using namespace hdlConvertor::hdlAst;

namespace hdlConvertor {
namespace sv {

using namespace std;

VerDelayParser::HdlEventList VerDelayParser::visitEvent_control(
sv2017Parser::Event_controlContext *ctx) {
// event_control:
Expand Down
8 changes: 4 additions & 4 deletions src/svConvertor/eventExprParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
#include <hdlConvertor/svConvertor/exprParser.h>
#include <hdlConvertor/notImplementedLogger.h>

using namespace std;
using sv2017Parser = sv2017_antlr::sv2017Parser;
using namespace hdlConvertor::hdlAst;


namespace hdlConvertor {
namespace sv {

using namespace std;
using namespace hdlConvertor::hdlAst;


void VerEventExprParser::visitEvent_expression(
sv2017Parser::Event_expressionContext *ctx,
std::vector<std::unique_ptr<iHdlExprItem>> &items) {
Expand Down
7 changes: 4 additions & 3 deletions src/svConvertor/exprParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
#include <hdlConvertor/svConvertor/exprPrimaryParser.h>
#include <hdlConvertor/svConvertor/typeParser.h>

using namespace std;
using sv2017Parser = sv2017_antlr::sv2017Parser;
using namespace hdlConvertor::hdlAst;

namespace hdlConvertor {
namespace sv {

using namespace std;
using namespace hdlConvertor::hdlAst;


unique_ptr<iHdlExprItem> VerExprParser::visitConstant_expression(
sv2017Parser::Constant_expressionContext *ctx) {
// constant_expression : expression ;
Expand Down
7 changes: 4 additions & 3 deletions src/svConvertor/exprPrimaryParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
#include <hdlConvertor/notImplementedLogger.h>
#include <hdlConvertor/createObject.h>

using namespace std;
using sv2017Parser = sv2017_antlr::sv2017Parser;
using namespace hdlConvertor::hdlAst;

namespace hdlConvertor {
namespace sv {

using namespace std;
using namespace hdlConvertor::hdlAst;


unique_ptr<iHdlExprItem> VerExprPrimaryParser::visitPrimary(
sv2017Parser::PrimaryContext *ctx) {
// primary:
Expand Down
7 changes: 4 additions & 3 deletions src/svConvertor/gateParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@

#include <assert.h>

using namespace std;
using namespace sv2017_antlr;
using namespace hdlConvertor::hdlAst;

namespace hdlConvertor {
namespace sv {

using namespace std;
using namespace hdlConvertor::hdlAst;


std::unique_ptr<iHdlExprItem> VerGateParser::visitEnable_terminal(
sv2017Parser::Enable_terminalContext *ctx) {
// enable_terminal: expression;
Expand Down
1 change: 0 additions & 1 deletion src/svConvertor/generateParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ namespace hdlConvertor {
namespace sv {

using namespace std;
using sv2017Parser = sv2017_antlr::sv2017Parser;
using namespace hdlConvertor::hdlAst;

void VerGenerateParser::visitGenerate_region(
Expand Down
7 changes: 4 additions & 3 deletions src/svConvertor/literalParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
#include <hdlConvertor/notImplementedLogger.h>
#include <hdlConvertor/createObject.h>

using sv2017Parser = sv2017_antlr::sv2017Parser;

namespace hdlConvertor {
namespace sv {

using namespace hdlConvertor::hdlAst;
using TerminalNode = antlr4::tree::TerminalNode;
using namespace std;

namespace hdlConvertor {
namespace sv {

unique_ptr<iHdlExprItem> VerLiteralParser::visitIntegral_number(
sv2017Parser::Integral_numberContext *ctx) {
Expand Down
1 change: 0 additions & 1 deletion src/svConvertor/moduleInstanceParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace hdlConvertor {
namespace sv {

using namespace std;
using sv2017Parser = sv2017_antlr::sv2017Parser;
using namespace hdlConvertor::hdlAst;

void VerModuleInstanceParser::visitModule_or_interface_or_program_or_udp_instantiation(
Expand Down
1 change: 0 additions & 1 deletion src/svConvertor/moduleParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ namespace hdlConvertor {
namespace sv {

using namespace std;
using namespace sv2017_antlr;
using namespace hdlConvertor::hdlAst;

void VerModuleParser::visitModule_header_common(
Expand Down
7 changes: 4 additions & 3 deletions src/svConvertor/paramDefParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
#include <hdlConvertor/svConvertor/typeParser.h>
#include <hdlConvertor/svConvertor/exprParser.h>

using namespace std;
using sv2017Parser = sv2017_antlr::sv2017Parser;
using namespace hdlConvertor::hdlAst;

namespace hdlConvertor {
namespace sv {

using namespace std;
using namespace hdlConvertor::hdlAst;


void VerParamDefParser::visitParameter_port_list(
sv2017Parser::Parameter_port_listContext *ctx,
vector<unique_ptr<HdlIdDef>> &res) {
Expand Down
1 change: 0 additions & 1 deletion src/svConvertor/portParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace hdlConvertor {
namespace sv {

using namespace std;
using sv2017Parser = sv2017_antlr::sv2017Parser;
using namespace hdlAst;

VerPortParser::VerPortParser(BaseSvParser *other,
Expand Down
7 changes: 4 additions & 3 deletions src/svConvertor/programParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
#include <hdlConvertor/svConvertor/attributeParser.h>
#include <hdlConvertor/createObject.h>

using namespace std;
using sv2017Parser = sv2017_antlr::sv2017Parser;
using namespace hdlConvertor::hdlAst;

namespace hdlConvertor {
namespace sv {

using namespace std;
using namespace hdlConvertor::hdlAst;


void VerProgramParser::visitTf_item_declaration(
sv2017Parser::Tf_item_declarationContext *ctx,
vector<unique_ptr<iHdlObj>> &objs,
Expand Down
1 change: 0 additions & 1 deletion src/svConvertor/source_textParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
namespace hdlConvertor {
namespace sv {

using sv2017Parser = sv2017_antlr::sv2017Parser;
using namespace hdlConvertor::hdlAst;

Source_textParser::Source_textParser(antlr4::TokenStream &tokens,
Expand Down
9 changes: 5 additions & 4 deletions src/svConvertor/statementParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
#include <hdlConvertor/svConvertor/paramDefParser.h>
#include <hdlConvertor/svConvertor/literalParser.h>

using namespace std;
using sv2017Parser = sv2017_antlr::sv2017Parser;
using namespace hdlConvertor::hdlAst;

namespace hdlConvertor {
namespace sv {

using namespace std;
using namespace hdlConvertor::hdlAst;


void HdlStmIf_collapse_elifs(HdlStmIf &ifStm) {
if (ifStm.ifFalse) {
auto as_if = dynamic_cast<HdlStmIf*>(ifStm.ifFalse.get());
Expand Down Expand Up @@ -594,7 +595,7 @@ unique_ptr<HdlStmBlock> VerStatementParser::visitSeq_block(
return visit_block(ctx);
}

HdlStmBlockJoinType visitJoin_keyword(sv2017Parser::Join_keywordContext *ctx) {
HdlStmBlockJoinType visitJoin_keyword(sv2017_antlr::sv2017Parser::Join_keywordContext *ctx) {
// join_keyword:
// KW_JOIN
// | KW_JOIN_ANY
Expand Down
6 changes: 4 additions & 2 deletions src/svConvertor/typeParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
#include <hdlConvertor/svConvertor/exprParser.h>
#include <hdlConvertor/hdlAst/hdlOp.h>

using namespace std;
using namespace hdlConvertor::hdlAst;

namespace hdlConvertor {
namespace sv {

using namespace std;
using namespace hdlConvertor::hdlAst;


unique_ptr<iHdlExprItem> VerTypeParser::visitType_reference(
sv2017Parser::Type_referenceContext *ctx) {
// type_reference:
Expand Down
7 changes: 4 additions & 3 deletions src/svConvertor/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

#include <hdlConvertor/createObject.h>

using sv2017Parser = sv2017_antlr::sv2017Parser;
using namespace hdlConvertor::hdlAst;
using namespace std;

namespace hdlConvertor {
namespace sv {

using namespace hdlConvertor::hdlAst;
using namespace std;


unique_ptr<iHdlExprItem> Utils::mkStringT() {
return make_unique<HdlValueId>("__str__");
}
Expand Down

0 comments on commit 06fbd10

Please sign in to comment.