本文整理汇总了C++中UlamType::getUlamTypeMangledName方法的典型用法代码示例。如果您正苦于以下问题:C++ UlamType::getUlamTypeMangledName方法的具体用法?C++ UlamType::getUlamTypeMangledName怎么用?C++ UlamType::getUlamTypeMangledName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UlamType
的用法示例。
在下文中一共展示了UlamType::getUlamTypeMangledName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generateCodedVariableDeclarations
// replaced by NodeVarDecl:genCode to leverage the declaration order preserved by the parse tree.
void SymbolVariableDataMember::generateCodedVariableDeclarations(File * fp, ULAMCLASSTYPE classtype)
{
assert(classtype == UC_ELEMENT); //really?
UTI vuti = getUlamTypeIdx();
UlamType * vut = m_state.getUlamTypeByIndex(vuti);
ULAMCLASSTYPE vclasstype = vut->getUlamClassType();
m_state.indentUlamCode(fp);
fp->write(vut->getUlamTypeMangledName().c_str()); //for C++
if(vclasstype == UC_QUARK) //called on classtype elements only
{
fp->write("<");
fp->write_decimal(getPosOffset());
fp->write(">");
}
fp->write(" ");
fp->write(getMangledName().c_str());
#if 0
s32 arraysize = vut->getArraySize();
if(arraysize > NONARRAYSIZE)
{
fp->write("[");
fp->write_decimal(arraysize);
fp->write("]");
}
else if(arraysize == UNKNOWNSIZE)
{
fp->write("[UNKNOWN]");
}
#endif
fp->write(";"); GCNL;
} //generateCodedVariableDeclarations
示例2: genCodeCastAtomAndElement
void NodeCast::genCodeCastAtomAndElement(File * fp, UlamValue & uvpass)
{
UTI nuti = getNodeType();
UlamType * nut = m_state.getUlamTypeByIndex(nuti);
UTI vuti = uvpass.getUlamValueTypeIdx();
s32 tmpVarNum = 0;
if(vuti == Ptr)
{
tmpVarNum = uvpass.getPtrSlotIndex();
vuti = uvpass.getPtrTargetType(); //replace
}
// "downcast" might not be true; compare to be sure the atom is an element "Foo"
if(vuti == UAtom)
{
m_state.indent(fp);
fp->write("if(!");
fp->write(nut->getUlamTypeMangledName().c_str());
fp->write("<EC>::THE_INSTANCE.");
fp->write(m_state.getIsMangledFunctionName());
fp->write("(");
fp->write(m_state.getTmpVarAsString(vuti, tmpVarNum).c_str());
fp->write("))\n");
m_state.m_currentIndentLevel++;
m_state.indent(fp);
fp->write("FAIL(BAD_CAST);\n");
m_state.m_currentIndentLevel--;
}
//update the uvpass to have the casted type
uvpass = UlamValue::makePtr(tmpVarNum, uvpass.getPtrStorage(), nuti, m_state.determinePackable(nuti), m_state, 0, uvpass.getPtrNameId()); //POS 0 rightjustified; pass along name id
return;
} //genCodeCastAtomAndElement
示例3: genCodeCastAtomAndQuark
void NodeCast::genCodeCastAtomAndQuark(File * fp, UlamValue & uvpass)
{
UTI nuti = getNodeType(); //quark tobe
UlamType * nut = m_state.getUlamTypeByIndex(nuti);
UTI vuti = uvpass.getUlamValueTypeIdx();
if(vuti == Ptr)
vuti = uvpass.getPtrTargetType(); //replace
m_node->genCodeToStoreInto(fp, uvpass); //No need to load lhs into tmp (T); symbol's in COS vector
assert(!m_state.m_currentObjSymbolsForCodeGen.empty());
Symbol * stgcos = NULL;
stgcos = m_state.m_currentObjSymbolsForCodeGen[0];
s32 tmpVarPos = m_state.getNextTmpVarNumber();
// "downcast" might not be true; compare to be sure the atom has a quark "Foo"
// get signed pos
if(vuti == UAtom)
{
m_state.indent(fp);
fp->write("const s32 ");
fp->write(m_state.getTmpVarAsString(Int, tmpVarPos).c_str());;
fp->write(" = ");
//internal method, takes uc, u32 and const char*, returns s32 position
fp->write(m_state.getHasMangledFunctionName(vuti));
fp->write("(");
fp->write("uc, ");
Node::genLocalMemberNameOfMethod(fp); //assume atom is a local var (neither dm nor ep)
if(stgcos->isSelf())
fp->write("GetType(), "); //no read for self
else
fp->write("read().GetType(), ");
fp->write("\"");
fp->write(nut->getUlamTypeMangledName().c_str());
fp->write("\");\n"); //keeping pos in tmp
}
else
{
UlamType* vut = m_state.getUlamTypeByIndex(vuti);
if(vut->getUlamClass() == UC_ELEMENT)
{
m_state.indent(fp);
fp->write("const s32 ");
fp->write(m_state.getTmpVarAsString(Int, tmpVarPos).c_str());;
fp->write(" = ");
//internal method, takes uc, u32 and const char*, returns s32 position
fp->write(vut->getUlamTypeMangledName().c_str());
fp->write("<EC>::");
fp->write(m_state.getHasMangledFunctionName(vuti));
fp->write("(\"");
fp->write(nut->getUlamTypeMangledName().c_str());
fp->write("\");\n"); //keeping pos in tmp
}
else
{
//e.g. a quark here would be wrong
std::ostringstream msg;
msg << "Casting 'incomplete' types ";
msg << m_state.getUlamTypeNameBriefByIndex(nuti).c_str();
msg << " to be ";
msg << m_state.getUlamTypeNameBriefByIndex(vuti).c_str();
MSG(getNodeLocationAsString().c_str(), msg.str().c_str(), ERR);
assert(0);//return;
}
}
m_state.indent(fp);
fp->write("if(");
fp->write(m_state.getTmpVarAsString(Int, tmpVarPos).c_str());
fp->write(" < 0)\n");
m_state.m_currentIndentLevel++;
m_state.indent(fp);
fp->write("FAIL(BAD_CAST);\n\n");
m_state.m_currentIndentLevel--;
//informed by genCodedAutoLocal() in NodeVarDecl used for conditional-as
// uses stgcos since there's no m_varSymbol in this situation.
s32 tmpVarStg = m_state.getNextTmpVarNumber();
UTI stguti = stgcos->getUlamTypeIdx();
UlamType * stgut = m_state.getUlamTypeByIndex(stguti);
assert(stguti == UAtom || stgut->getUlamClass() == UC_ELEMENT);
// can't let Node::genCodeReadIntoTmpVar do this for us (we need a ref!):
assert(m_state.m_currentObjSymbolsForCodeGen.size() == 1);
m_state.indent(fp);
// no const here
fp->write(stgut->getTmpStorageTypeAsString().c_str());
fp->write("& ");
fp->write(m_state.getTmpVarAsString(stguti, tmpVarStg, TMPBITVAL).c_str());
fp->write(" = ");
fp->write(stgcos->getMangledName().c_str());
if(!stgcos->isSelf())
fp->write(".getRef()");
fp->write("; //ref needed\n");
//.........这里部分代码省略.........
示例4: genUlamTypeMangledDefinitionForC
//generates immediates with local storage
void UlamTypePrimitive::genUlamTypeMangledDefinitionForC(File * fp)
{
u32 len = getTotalBitSize(); //could be 0, includes arrays
m_state.m_currentIndentLevel = 0;
UTI anyuti = Nav;
AssertBool anyDefined = m_state.anyDefinedUTI(m_key, anyuti);
assert(anyDefined);
UTI scalaruti = m_state.getUlamTypeAsScalar(anyuti);
UlamType * scalarut = m_state.getUlamTypeByIndex(scalaruti);
const std::string scalarmangledName = scalarut->getUlamTypeMangledName();
const std::string mangledName = getUlamTypeImmediateMangledName();
const std::string automangledName = getUlamTypeImmediateAutoMangledName();
std::ostringstream ud;
ud << "Ud_" << mangledName; //d for define (p used for atomicparametrictype)
std::string udstr = ud.str();
m_state.indent(fp);
fp->write("#ifndef ");
fp->write(udstr.c_str());
fp->write("\n");
m_state.indent(fp);
fp->write("#define ");
fp->write(udstr.c_str());
fp->write("\n");
m_state.indent(fp);
fp->write("namespace MFM{\n");
fp->write("\n");
m_state.m_currentIndentLevel++;
m_state.indent(fp);
fp->write("template<class EC>\n");
m_state.indent(fp);
fp->write("struct ");
fp->write(mangledName.c_str());
fp->write(" : public ");
fp->write("BitVectorBitStorage");
fp->write("<EC, BitVector<");
fp->write_decimal_unsigned(len);
fp->write("u> >\n");
m_state.indent(fp);
fp->write("{\n");
m_state.m_currentIndentLevel++;
//typedef atomic parameter type inside struct
UlamType::genStandardConfigTypedefTypenames(fp, m_state);
m_state.indent(fp);
fp->write("typedef BitVector<");
fp->write_decimal_unsigned(len);
fp->write("> BV;"); GCNL;
m_state.indent(fp);
fp->write("typedef BitVectorBitStorage<EC, BV> BVS;"); GCNL;
fp->write("\n");
//put read/write methods before constructrtors that may use them.
//read BV method
genUlamTypeReadDefinitionForC(fp);
//write BV method
genUlamTypeWriteDefinitionForC(fp);
//default constructor (used by local vars)
m_state.indent(fp);
fp->write(mangledName.c_str());
fp->write("() { }"); GCNL;
//constructor here (used by const tmpVars)
m_state.indent(fp);
fp->write(mangledName.c_str());
fp->write("(const ");
fp->write(getTmpStorageTypeAsString().c_str()); //u32, u64
fp->write(" d) { ");
fp->write("write(d); }"); GCNL;
//array initialization constructor here (used by const tmpVars);
// in C, the array is just a pointer (since not within a struct);
if(!isScalar())
{
m_state.indent(fp);
fp->write(mangledName.c_str());
fp->write("(const u32");
fp->write(" d[");
fp->write_decimal_unsigned(UlamType::getTotalNumberOfWords());
fp->write("]) : BVS(d) { }"); GCNL;
}
//copy constructor here (return by value)
m_state.indent(fp);
fp->write(mangledName.c_str());
//.........这里部分代码省略.........