Beispiel #1
0
void Editor::findDialog()
    {
    FindDialog dialog(mEditFiles);
    bool done = false;
    while(!done)
        {
        int ret = dialog.runHideCancel();
        if(ret == GTK_RESPONSE_CANCEL || ret == GTK_RESPONSE_DELETE_EVENT)
            {
            done = true;
            }
        else
            {
            GtkToggleButton *downCheck = GTK_TOGGLE_BUTTON(getBuilder().getWidget(
                    "FindDownCheckbutton"));
            GtkToggleButton *caseCheck = GTK_TOGGLE_BUTTON(getBuilder().getWidget(
                    "CaseSensitiveCheckbutton"));
            GtkEntry *entry = GTK_ENTRY(Builder::getBuilder()->getWidget("FindEntry"));
            if(ret == GTK_RESPONSE_OK)
                {
                find(gtk_entry_get_text(entry), gtk_toggle_button_get_active(downCheck),
                    gtk_toggle_button_get_active(caseCheck));
                }
            else
                {
                GtkEntry *replaceEntry = GTK_ENTRY(getBuilder().getWidget("ReplaceEntry"));
                findAndReplace(gtk_entry_get_text(entry), gtk_toggle_button_get_active(downCheck),
                    gtk_toggle_button_get_active(caseCheck), gtk_entry_get_text(replaceEntry));
                }
            }
        }
    }
Beispiel #2
0
void Editor::findInFilesDialog()
    {
    FindDialog dialog(mEditFiles);
    GtkToggleButton *downCheck = GTK_TOGGLE_BUTTON(getBuilder().getWidget(
        "FindDownCheckbutton"));
    GtkToggleButton *sourceOnlyCheck = GTK_TOGGLE_BUTTON(getBuilder().getWidget(
        "SourceOnlyCheckbutton"));
    Gui::setVisible(GTK_WIDGET(downCheck), false);
    Gui::setVisible(GTK_WIDGET(sourceOnlyCheck), true);
    if(dialog.run(true))
        {
        GtkToggleButton *caseCheck = GTK_TOGGLE_BUTTON(getBuilder().getWidget(
            "CaseSensitiveCheckbutton"));
        ControlWindow::showNotebookTab(ControlWindow::CT_Find);
        GtkTextView *findView = GTK_TEXT_VIEW(ControlWindow::getTabView(
            ControlWindow::CT_Find));
        Gui::clear(findView);
        GtkEntry *entry = GTK_ENTRY(Builder::getBuilder()->getWidget("FindEntry"));
        findInFiles(gtk_entry_get_text(entry), Project::getSrcRootDirectory().getStr(),
            gtk_toggle_button_get_active(caseCheck),
            gtk_toggle_button_get_active(sourceOnlyCheck),
            findView);
        }
    Gui::setVisible(GTK_WIDGET(downCheck), true);
    Gui::setVisible(GTK_WIDGET(sourceOnlyCheck), false);
    }
Beispiel #3
0
void GasMeter::countSha3Data(llvm::Value* _dataLength)
{
	assert(m_checkCall);
	assert(m_blockCost > 0); // SHA3 instruction is already counted

	// TODO: This round ups to 32 happens in many places
	static_assert(c_sha3WordGas != 1, "SHA3 data cost has changed. Update GasMeter");
	auto dataLength64 = getBuilder().CreateTrunc(_dataLength, Type::Gas);
	auto words64 = m_builder.CreateUDiv(m_builder.CreateNUWAdd(dataLength64, getBuilder().getInt64(31)), getBuilder().getInt64(32));
	auto cost64 = m_builder.CreateNUWMul(getBuilder().getInt64(c_sha3WordGas), words64);
	count(cost64);
}
Beispiel #4
0
void OrthRoot::drawServer(const DrawParams& p) {
	ci::Matrix44f		m(ci::gl::getModelView());
	if(getBuilder().mDrawScaled){
		setCameraForDraw(m);
	}
	mSprite->drawServer(m, p);
}
Beispiel #5
0
/* NodeBuilders::init
 * Loads all node builder definitions from the program resource
 *******************************************************************/
void NodeBuilders::init()
{
	// Init invalid builder
	invalid.id = "invalid";

	// Get nodebuilders configuration from slade.pk3
	Archive* archive = theArchiveManager->programResourceArchive();
	ArchiveEntry* config = archive->entryAtPath("config/nodebuilders.cfg");
	if (!config)
		return;

	// Parse it
	Parser parser;
	parser.parseText(config->getMCData(), "nodebuilders.cfg");

	// Get 'nodebuilders' block
	ParseTreeNode* root = (ParseTreeNode*)parser.parseTreeRoot()->getChild("nodebuilders");
	if (!root)
		return;

	// Go through child block
	for (unsigned a = 0; a < root->nChildren(); a++)
	{
		ParseTreeNode* n_builder = (ParseTreeNode*)root->getChild(a);

		// Parse builder block
		builder_t builder;
		builder.id = n_builder->getName();
		for (unsigned b = 0; b < n_builder->nChildren(); b++)
		{
			ParseTreeNode* node = (ParseTreeNode*)n_builder->getChild(b);

			// Option
			if (S_CMPNOCASE(node->getType(), "option"))
			{
				builder.options.push_back(node->getName());
				builder.option_desc.push_back(node->getStringValue());
			}

			// Builder name
			else if (S_CMPNOCASE(node->getName(), "name"))
				builder.name = node->getStringValue();

			// Builder command
			else if (S_CMPNOCASE(node->getName(), "command"))
				builder.command = node->getStringValue();

			// Builder executable
			else if (S_CMPNOCASE(node->getName(), "executable"))
				builder.exe = node->getStringValue();
		}
		builders.push_back(builder);
	}

	// Set builder paths
	for (unsigned a = 0; a < builder_paths.size(); a+=2)
		getBuilder(builder_paths[a]).path = builder_paths[a+1];
}
Beispiel #6
0
void OrthRoot::drawClient(const DrawParams& p, AutoDrawService* auto_draw) {
	ci::Matrix44f		m(ci::gl::getModelView());
	if(getBuilder().mDrawScaled){
		setCameraForDraw(m);
	}
	mSprite->drawClient(m, p);

	if (auto_draw) auto_draw->drawClient(m, p);
}
Beispiel #7
0
		llvm::Value* Function::getRawReturnValue() {
			if (argInfo_.hasReturnVarArgument() || argInfo_.returnType().second->isVoidTy()) {
				return nullptr;
			}
			
			if (returnValuePtr_ == nullptr) {
				returnValuePtr_ = getEntryBuilder().CreateAlloca(function_.getFunctionType()->getReturnType(),
				                                                 nullptr, "returnvalueptr");
			}
			
			return getBuilder().CreateLoad(returnValuePtr_);
		}
Beispiel #8
0
		llvm::Instruction* Function::returnValue(llvm::Value* const value) {
			assert(!argInfo_.hasReturnVarArgument());
			assert(!value->getType()->isVoidTy());
			
			// Encode return value according to ABI.
			std::vector<llvm_abi::Type*> abiTypes;
			abiTypes.push_back(getArgInfo().returnType().first);
			
			std::vector<llvm::Value*> values;
			values.push_back(value);
			
			encodeABIValues(values, abiTypes);
			
			return getBuilder().CreateRet(values.at(0));
		}
Beispiel #9
0
		void Function::setReturnValue(llvm::Value* const value) {
			assert(!argInfo_.hasReturnVarArgument());
			assert(!value->getType()->isVoidTy());
			
			// Encode return value according to ABI.
			std::vector<llvm_abi::Type*> abiTypes;
			abiTypes.push_back(getArgInfo().returnType().first);
			
			std::vector<llvm::Value*> values;
			values.push_back(value);
			
			encodeABIValues(values, abiTypes);
			
			const auto encodedValue = values.at(0);
			
			if (returnValuePtr_ == nullptr) {
				returnValuePtr_ = getEntryBuilder().CreateAlloca(encodedValue->getType(),
				                                                 nullptr, "returnvalueptr");
			}
			
			getBuilder().CreateStore(encodedValue, returnValuePtr_);
		}
Beispiel #10
0
Function &OptimizeForRuntime(Function &F) {
#ifdef DEBUG
  static PassManagerBuilder Builder = getDebugBuilder();
#else
  static PassManagerBuilder Builder = getBuilder();
#endif
  Module *M = F.getParent();
  opt::GenerateOutput = true;
  polly::opt::PollyParallel = true;

  FunctionPassManager PM = FunctionPassManager(M);

  Builder.populateFunctionPassManager(PM);
  PM.doInitialization();
  PM.run(F);
  PM.doFinalization();

  if (opt::havePapi()) {
    PassManager MPM;
    Builder.populateModulePassManager(MPM);
    MPM.add(polli::createTraceMarkerPass());
    MPM.run(*M);
  }

  if (opt::haveLikwid()) {
    PassManager MPM;
    Builder.populateModulePassManager(MPM);
    MPM.add(polli::createLikwidMarkerPass());
    MPM.run(*M);
  }

  DEBUG(
  StoreModule(*M, M->getModuleIdentifier() + ".after.polly.ll")
  );
  opt::GenerateOutput = false;

  return F;
}
Beispiel #11
0
 Sequence * SequenceBuilderStr::build(const Array & seq) {
     SequenceBuilder * b = getBuilder(seq);
     Sequence * ret = b->build(seq);
     delete b;
     return ret;
 }
Beispiel #12
0
		void Function::setDebugPosition(const Debug::SourcePosition& position) {
			const auto debugLoc = llvm::DebugLoc::get(position.lineNumber(), position.column(), debugInfo());
			getBuilder().SetCurrentDebugLocation(debugLoc);
		}
Beispiel #13
0
		llvm::Value* Function::getContextValue(const SEM::TypeInstance* const typeInstance) {
			return getBuilder().CreatePointerCast(getRawContextValue(), genPointerType(module(), typeInstance->selfType()));
		}