本文整理汇总了C++中VariableSymbol::get_name方法的典型用法代码示例。如果您正苦于以下问题:C++ VariableSymbol::get_name方法的具体用法?C++ VariableSymbol::get_name怎么用?C++ VariableSymbol::get_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VariableSymbol
的用法示例。
在下文中一共展示了VariableSymbol::get_name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle_static_variable_symbol
static String handle_static_variable_symbol(CPrintStyleModule *map,
const SuifObject *obj) {
VariableSymbol *var = to<VariableSymbol>(obj);
// I'd like to figure out what procedure and BLOCK scope this
// is in...
return(String(var->get_name()));
}
示例2: ReplaceNDReference
// All of the array references expressions in the passed in the struct are
// equivalent, so we can determine types of the original and use that
// to create a new expression with which to replace everything.
bool TransformUnrolledArraysPass::ReplaceNDReference(EquivalentReferences* a)
{
assert(a != NULL) ;
assert(a->original != NULL) ;
// Check to see if the reference at this stage is a constant or not
IntConstant* constantIndex =
dynamic_cast<IntConstant*>(a->original->get_index()) ;
if (constantIndex == NULL)
{
// There was no replacement made
return false ;
}
Expression* baseAddress = a->original->get_base_array_address() ;
assert(baseAddress != NULL) ;
assert(constantIndex != NULL) ;
// Create a replacement expression for this value. This will either
// be another array reference expression or a single variable.
Expression* replacementExp = NULL ;
// QualifiedType* elementType = GetQualifiedTypeOfElement(a->original) ;
VariableSymbol* originalSymbol = GetArrayVariable(a->original) ;
assert(originalSymbol != NULL) ;
LString replacementName =
GetReplacementName(originalSymbol->get_name(),
constantIndex->get_value().c_int()) ;
int dimensionality = GetDimensionality(a->original) ;
QualifiedType* elementType = originalSymbol->get_type() ;
while (dynamic_cast<ArrayType*>(elementType->get_base_type()) != NULL)
{
elementType = dynamic_cast<ArrayType*>(elementType->get_base_type())->get_element_type() ;
}
// There is a special case for one dimensional arrays as opposed to all
// other dimensional arrays. It only should happen if we are truly
// replacing an array with a one dimensional array.
if (dimensionality == 1 &&
dynamic_cast<ArrayReferenceExpression*>(a->original->get_parent())==NULL)
{
VariableSymbol* replacementVar =
create_variable_symbol(theEnv,
GetQualifiedTypeOfElement(a->original),
TempName(replacementName)) ;
procDef->get_symbol_table()->append_symbol_table_object(replacementVar) ;
replacementExp =
create_load_variable_expression(theEnv,
elementType->get_base_type(),
replacementVar) ;
}
else
{
// Create a new array with one less dimension. This requires a new
// array type.
ArrayType* varType =
dynamic_cast<ArrayType*>(originalSymbol->get_type()->get_base_type()) ;
assert(varType != NULL) ;
ArrayType* replacementArrayType =
create_array_type(theEnv,
varType->get_element_type()->get_base_type()->get_bit_size(),
0, // bit alignment
OneLessDimension(originalSymbol->get_type(), dimensionality),
dynamic_cast<Expression*>(varType->get_lower_bound()->deep_clone()),
dynamic_cast<Expression*>(varType->get_upper_bound()->deep_clone()),
TempName(varType->get_name())) ;
procDef->get_symbol_table()->append_symbol_table_object(replacementArrayType) ;
VariableSymbol* replacementArraySymbol =
create_variable_symbol(theEnv,
create_qualified_type(theEnv,
replacementArrayType,
TempName(LString("qualType"))),
TempName(replacementName)) ;
procDef->get_symbol_table()->append_symbol_table_object(replacementArraySymbol) ;
// Create a new symbol address expression for this variable symbol
SymbolAddressExpression* replacementAddrExp =
create_symbol_address_expression(theEnv,
replacementArrayType,
replacementArraySymbol) ;
// Now, replace the symbol address expression in the base
// array address with this symbol.
ReplaceSymbol(a->original, replacementAddrExp) ;
// And replace this reference with the base array address.
replacementExp = a->original->get_base_array_address() ;
a->original->set_base_array_address(NULL) ;
replacementExp->set_parent(NULL) ;
}
//.........这里部分代码省略.........
示例3: Transform
void TransformSystemsToModules::Transform()
{
assert(procDef != NULL) ;
// Collect all the input scalars and output scalars
list<VariableSymbol*> ports ;
SymbolTable* procSymTab = procDef->get_symbol_table() ;
bool foundInputs = false ;
bool foundOutputs = false ;
for (int i = 0 ; i < procSymTab->get_symbol_table_object_count() ; ++i)
{
SymbolTableObject* nextObject = procSymTab->get_symbol_table_object(i) ;
if (nextObject->lookup_annote_by_name("InputScalar") != NULL)
{
VariableSymbol* toConvert =
dynamic_cast<VariableSymbol*>(nextObject) ;
assert(toConvert != NULL) ;
LString inputName = toConvert->get_name() ;
inputName = inputName + "_in" ;
toConvert->set_name(inputName) ;
ports.push_back(toConvert) ;
foundInputs = true ;
}
if (nextObject->lookup_annote_by_name("OutputVariable") != NULL)
{
VariableSymbol* toConvert =
dynamic_cast<VariableSymbol*>(nextObject) ;
assert(toConvert != NULL) ;
LString outputName = toConvert->get_name() ;
outputName = outputName + "_out" ;
toConvert->set_name(outputName) ;
ports.push_back(toConvert) ;
foundOutputs = true ;
}
}
assert(foundInputs &&
"Could not identify inputs. Were they removed via optimizations?") ;
assert(foundOutputs &&
"Could not identify outputs. Were they removed via optimizations?") ;
// Determine the bit size and add everything to a new symbol table
int bitSize = 0 ;
GroupSymbolTable* structTable =
create_group_symbol_table(theEnv,
procDef->get_symbol_table()) ;
std::map<VariableSymbol*, FieldSymbol*> replacementFields ;
bool portsRemoved = false ;
// If this was actually a new style module, we should make sure to
// put these in the correct order.
if (isModule(procDef))
{
// Go through the original symbol table and remove any parameter
// symbols that originally existed
SymbolTable* originalSymTab = procDef->get_symbol_table() ;
Iter<SymbolTableObject*> originalIter =
originalSymTab->get_symbol_table_object_iterator() ;
while (originalIter.is_valid())
{
SymbolTableObject* currentObj = originalIter.current() ;
originalIter.next() ;
if (dynamic_cast<ParameterSymbol*>(currentObj) != NULL)
{
originalSymTab->remove_symbol_table_object(currentObj) ;
}
}
portsRemoved = true ;
// Sort the variable symbols in parameter order. This is just an
// insertion sort, so it could be done faster.
list<VariableSymbol*> sortedPorts ;
for (int i = 0 ; i < ports.size() ; ++i)
{
list<VariableSymbol*>::iterator portIter = ports.begin() ;
while (portIter != ports.end())
{
BrickAnnote* orderAnnote =
dynamic_cast<BrickAnnote*>((*portIter)->
lookup_annote_by_name("ParameterOrder")) ;
if (orderAnnote == NULL)
{
++portIter ;
continue ;
}
IntegerBrick* orderBrick =
dynamic_cast<IntegerBrick*>(orderAnnote->get_brick(0)) ;
assert(orderBrick != NULL) ;
if (orderBrick->get_value().c_int() == i)
{
sortedPorts.push_back(*portIter) ;
break ;
}
++portIter ;
}
}
if (sortedPorts.size() != ports.size())
//.........这里部分代码省略.........