Пример #1
0
Node_ptr Array<T>::getNode() const
{
    if (!node) {

        unsigned bytes = this->getDataDims().elements() * sizeof(T);

        BufferNode<T> *buf_node = new BufferNode<T>(data,
                bytes,
                offset,
                dims().get(),
                strides().get());

        const_cast<Array<T> *>(this)->node = Node_ptr(reinterpret_cast<Node *>(buf_node));
    }

    return node;
}
Пример #2
0
Node_ptr ConditionalJumpNode::CreateFrom(Instruction_ptr i,/*{{{*/
		Addr follower,
		Instruction_list::iterator begin,
		Instruction_list::iterator end)
{
	ConditionalJump* jump = static_cast<ConditionalJump*>(i.get());
	Expression_ptr destination = jump->Second();
	Addr address;

	if (destination->IsType(Expression::GLOBAL))
	{
		address = static_cast<GlobalVariable*>(destination.get())->Address();
	}
	else
	{
		message("%p Error! Jump destination is not a GlobalVariable!\n", jump->Address());
		address = INVALID_ADDR;
	}

	return Node_ptr( new ConditionalJumpNode(address, follower, begin, end) );
}/*}}}*/
Пример #3
0
Node_ptr bufferNodePtr() {
    return Node_ptr(reinterpret_cast<Node *>(new BufferNode<T>()));
}
Пример #4
0
Array<T> createValueArray(const dim4 &dims, const T &value) {
    auto *node = new jit::ScalarNode<T>(value);
    return createNodeArray<T>(dims, Node_ptr(node));
}