本文整理汇总了C++中rc::ConstHandle类的典型用法代码示例。如果您正苦于以下问题:C++ ConstHandle类的具体用法?C++ ConstHandle怎么用?C++ ConstHandle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConstHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Exception
ValueGenerator::ValueGenerator(
RC::ConstHandle<ValueOutputOperator> const &operator_,
RC::ConstHandle<ValueProducer> const &shared
)
: m_operator( operator_ )
, m_shared( shared )
{
RC::ConstHandle<RT::Desc> operatorValueDesc = m_operator->getValueDesc();
if ( !operatorValueDesc )
throw Exception("operator is invalid");
m_valueDesc = operatorValueDesc;
RC::ConstHandle<RT::Desc> operatorSharedDesc = m_operator->getSharedDesc();
if ( operatorSharedDesc )
{
RC::ConstHandle<RT::Desc> sharedValueDesc = m_shared? m_shared->getValueDesc(): RC::ConstHandle<RT::Desc>();
if ( !sharedValueDesc )
throw Exception( "operator requires a shared value but no shared value producer is provided" );
if ( !sharedValueDesc->isEquivalentTo( operatorSharedDesc ) )
throw Exception(
"shared value type ("
+ _(sharedValueDesc->getUserName())
+ ") is not equivalent to operator shared type ("
+ _(operatorSharedDesc->getUserName()) + ")"
);
}
}
示例2:
void ValueGenerator::ComputeState::produce( void *data ) const
{
RC::ConstHandle<ValueOutputOperator> valueTransformOperator = m_valueTransform->m_operator;
if ( valueTransformOperator->takesSharedValue() )
valueTransformOperator->call( data, &m_sharedData[0] );
else valueTransformOperator->call( data );
}
示例3: encodeJSON
void DictImpl::encodeJSON( void const *data, JSON::Encoder &encoder ) const
{
RC::ConstHandle<StringImpl> keyImplAsStringImpl;
if ( isString( m_keyImpl->getType() ) )
keyImplAsStringImpl = RC::ConstHandle<StringImpl>::StaticCast( m_keyImpl );
JSON::ObjectEncoder objectEncoder = encoder.makeObject();
bits_t const *bits = *reinterpret_cast<bits_t const * const *>( data );
if ( bits )
{
node_t *node = bits->firstNode;
while ( node )
{
void const *keyData = immutableKeyData( node );
void const *valueData = immutableValueData( node );
if ( keyImplAsStringImpl )
{
JSON::Encoder memberEncoder = objectEncoder.makeMember( keyImplAsStringImpl->getValueData( keyData ), keyImplAsStringImpl->getValueLength( keyData ) );
m_valueImpl->encodeJSON( valueData, memberEncoder );
}
else
{
Util::SimpleString encodedKey;
{
JSON::Encoder encodedKeyEncoder( &encodedKey );
m_keyImpl->encodeJSON( keyData, encodedKeyEncoder );
}
JSON::Encoder memberEncoder = objectEncoder.makeMember( encodedKey );
m_valueImpl->encodeJSON( valueData, memberEncoder );
}
node = node->bitsNextNode;
}
}
}
示例4: Exception
void *ExecutionEngine::LazyFunctionCreator( std::string const &functionName )
{
if ( functionName == "report" )
return (void *)&ExecutionEngine::Report;
else
{
void *result = 0;
if ( !result )
result = KL::LookupExternalSymbol( functionName );
if ( !result )
result = Plug::Manager::Instance()->llvmResolveExternalFunction( functionName );
#if defined(FABRIC_MODULE_OPENCL)
if ( !result )
result = OCL::llvmResolveExternalFunction( functionName );
#endif
if ( !result )
{
RC::ConstHandle<Context> context = s_currentContext;
result = context->getCGManager()->llvmResolveExternalFunction( functionName );
}
// We should *always* return a valid symbol. Otherwise something's
// wrong in the KL compiler/support.
if( !result )
throw Exception( "LLVM lookup failed for symbol: " + functionName );
return result;
}
}
示例5: isLValueToRValueMatch
bool Function::isLValueToRValueMatch( ExprTypeVector const &argTypes ) const
{
if ( argTypes.size() != m_params.size() )
return false;
for ( size_t i=0; i<argTypes.size(); ++i )
{
Usage argUsage = argTypes[i].getUsage(), paramUsage = m_params[i].getUsage();
RC::ConstHandle<Adapter> argAdapter = argTypes[i].getAdapter(), paramAdapter = m_params[i].getAdapter();
if ( argUsage == paramUsage
&& argAdapter->isEquivalentTo( paramAdapter )
)
continue;
if ( paramUsage == USAGE_RVALUE )
{
if ( argUsage == USAGE_LVALUE
&& argAdapter->isEquivalentTo( paramAdapter )
)
continue;
}
return false;
}
return true;
}
示例6: isEquivalentTo
bool SlicedArrayImpl::isEquivalentTo( RC::ConstHandle<Impl> const &that ) const
{
if ( !isSlicedArray( that->getType() ) )
return false;
RC::ConstHandle<SlicedArrayImpl> slicedArrayImpl = RC::ConstHandle<SlicedArrayImpl>::StaticCast( that );
return getMemberImpl()->isEquivalentTo( slicedArrayImpl->getMemberImpl() );
}
示例7: ArrayImpl
SlicedArrayImpl::SlicedArrayImpl( std::string const &codeName, RC::ConstHandle<Impl> const &memberImpl )
: ArrayImpl( codeName, DT_SLICED_ARRAY, memberImpl )
, m_memberImpl( memberImpl )
, m_memberSize( memberImpl->getAllocSize() )
, m_variableArrayImpl( memberImpl->getVariableArrayImpl() )
{
setSize( sizeof(bits_t) );
}
示例8: buildExprValue
CG::ExprValue ConstFloat::buildExprValue( CG::BasicBlockBuilder &basicBlockBuilder, CG::Usage usage, std::string const &lValueErrorDesc ) const
{
if ( usage == CG::USAGE_LVALUE )
throw Exception( "constants cannot be used as l-values" );
RC::ConstHandle<CG::FloatAdapter> floatAdapter = basicBlockBuilder.getManager()->getFloat64Adapter();
floatAdapter->llvmCompileToModule( basicBlockBuilder.getModuleBuilder() );
double value = Util::parseDouble( m_valueString );
return CG::ExprValue( floatAdapter, CG::USAGE_RVALUE, basicBlockBuilder.getContext(), floatAdapter->llvmConst( basicBlockBuilder.getContext(), value ) );
}
示例9: time
BCCache::BCCache( std::string const &compileOptionsString )
{
RC::ConstHandle<IO::Dir> rootDir = IO::Dir::Private();
RC::ConstHandle<IO::Dir> baseDir = IO::Dir::Create( rootDir, "IRCache" );
baseDir->recursiveDeleteFilesOlderThan( time(NULL) - FABRIC_BC_CACHE_EXPIRY_SEC );
RC::ConstHandle<IO::Dir> osDir = IO::Dir::Create( baseDir, buildOS );
RC::ConstHandle<IO::Dir> archDir = IO::Dir::Create( osDir, runningArch );
RC::ConstHandle<IO::Dir> compileOptionsDir = IO::Dir::Create( archDir, compileOptionsString );
m_dir = IO::Dir::Create( compileOptionsDir, buildCacheGeneration );
}
示例10: getExprType
CG::ExprType MethodOp::getExprType( CG::BasicBlockBuilder &basicBlockBuilder ) const
{
RC::ConstHandle<CG::Adapter> adapter = getFunction( basicBlockBuilder )->getReturnInfo().getAdapter();
if ( adapter )
{
adapter->llvmCompileToModule( basicBlockBuilder.getModuleBuilder() );
return CG::ExprType( adapter, CG::USAGE_RVALUE );
}
else return CG::ExprType();
}
示例11: Adapter
ArrayProducerAdapter::ArrayProducerAdapter(
RC::ConstHandle<Manager> const &manager,
RC::ConstHandle<RT::ArrayProducerDesc> const &arrayProducerDesc
)
: Adapter( manager, arrayProducerDesc, FL_PASS_BY_REFERENCE )
, m_arrayProducerDesc( arrayProducerDesc )
, m_elementAdapter( manager->getAdapter( arrayProducerDesc->getElementDesc() ) )
, m_elementVariableArrayAdapter( manager->getVariableArrayOf( m_elementAdapter ) )
{
}
示例12: alloca
void ArrayProducer::ComputeState::produceJSON( size_t index, JSON::Encoder &jg ) const
{
RC::ConstHandle<RT::Desc> elementDesc = m_arrayProducer->getElementDesc();
size_t allocSize = elementDesc->getAllocSize();
void *valueData = alloca( allocSize );
memset( valueData, 0, allocSize );
produce( index, valueData );
elementDesc->encodeJSON( valueData, jg );
elementDesc->disposeData( valueData );
}
示例13:
void ArrayProducerAdapter::Produce2( void const *_adapter, void const *arrayProducerRValue, size_t indexRValue, size_t countRValue, void *dstLValue )
{
MR::ArrayProducer *arrayProducer = *static_cast<MR::ArrayProducer * const *>( arrayProducerRValue );
if ( arrayProducer )
{
RC::ConstHandle<RT::VariableArrayDesc> elementVariableArrayDesc = RC::ConstHandle<RT::VariableArrayDesc>::StaticCast( static_cast<ArrayProducerAdapter const *>( _adapter )->m_elementVariableArrayAdapter->getDesc() );
elementVariableArrayDesc->setNumMembers( dstLValue, countRValue );
void *firstMemberData = elementVariableArrayDesc->getMutableMemberData( dstLValue, 0 );
arrayProducer->createComputeState()->produce( indexRValue, countRValue, firstMemberData );
}
}
示例14:
RC::ConstHandle<CaseVector> CaseVector::Create( RC::ConstHandle<Case> const &first, RC::ConstHandle<CaseVector> const &remaining )
{
CaseVector *result = new CaseVector;
if ( first )
result->push_back( first );
if ( remaining )
{
for ( const_iterator it=remaining->begin(); it!=remaining->end(); ++it )
result->push_back( *it );
}
return result;
}
示例15: BinOpFullDesc
std::string BinOpFullDesc(
RC::ConstHandle<Adapter> const &returnAdapter,
BinOpType type,
RC::ConstHandle<CG::Adapter> const &lhsAdapter,
RC::ConstHandle<CG::Adapter> const &rhsAdapter
)
{
std::string result = "function ";
if ( returnAdapter )
result += returnAdapter->getUserName() + " ";
result += binOpUserName( type ) + "(" + lhsAdapter->getUserName() + ", " + rhsAdapter->getUserName() + ")";
return result;
}