MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / compileStmt

Method compileStmt

src/DesignCompile/CompileStmt.cpp:117–1125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117VectorOfany* CompileHelper::compileStmt(DesignComponent* component,
118 const FileContent* fC, NodeId the_stmt,
119 CompileDesign* compileDesign,
120 Reduce reduce, UHDM::any* pstmt,
121 ValuedComponentI* instance,
122 bool muteErrors) {
123 FileSystem* const fileSystem = FileSystem::getInstance();
124 VectorOfany* results = nullptr;
125 UHDM::Serializer& s = compileDesign->getSerializer();
126 VObjectType type = fC->Type(the_stmt);
127 UHDM::VectorOfattribute* attributes = nullptr;
128 if (type == VObjectType::paAttribute_instance) {
129 attributes =
130 compileAttributes(component, fC, the_stmt, compileDesign, nullptr);
131 while (fC->Type(the_stmt) == VObjectType::paAttribute_instance)
132 the_stmt = fC->Sibling(the_stmt);
133 }
134 type = fC->Type(the_stmt);
135 UHDM::any* stmt = nullptr;
136 switch (type) {
137 case VObjectType::paModule_common_item:
138 case VObjectType::paModule_or_generate_item:
139 case VObjectType::paModule_or_generate_item_declaration:
140 case VObjectType::paPackage_or_generate_item_declaration:
141 case VObjectType::paGenerate_item: {
142 if (instance) break;
143 NodeId child = fC->Child(the_stmt);
144 if (!child) {
145 // That is the null statement (no statement)
146 return nullptr;
147 }
148 results = compileStmt(component, fC, child, compileDesign, reduce, pstmt,
149 instance, muteErrors);
150 break;
151 }
152 case VObjectType::paGenerate_region: {
153 VectorOfgen_stmt* sts =
154 compileGenStmt(valuedcomponenti_cast<ModuleDefinition*>(component),
155 fC, compileDesign, the_stmt);
156 if (!sts->empty()) stmt = sts->front();
157 break;
158 }
159 case VObjectType::paGenerate_begin_end_block: {
160 if (instance) break;
161 NodeId child = fC->Child(the_stmt);
162 if (!child) {
163 // That is the null statement (no statement)
164 return nullptr;
165 }
166 if (fC->Sibling(child)) {
167 results = s.MakeAnyVec();
168 NodeId tmp = child;
169 while (tmp) {
170 if (fC->Type(tmp) != VObjectType::slStringConst) {
171 VectorOfany* stmts =
172 compileStmt(component, fC, tmp, compileDesign, reduce, pstmt,
173 instance, muteErrors);
174 if (stmts) {

Callers

nothing calls this directly

Calls 15

StrCatFunction · 0.85
populateCoreMembersMethod · 0.80
VariableMethod · 0.80
readLineMethod · 0.80
printObjectMethod · 0.80
TypeMethod · 0.45
SiblingMethod · 0.45
ChildMethod · 0.45
ParentMethod · 0.45
SymNameMethod · 0.45
getErrorContainerMethod · 0.45

Tested by

no test coverage detected