Esempio n. 1
0
	core::ProgramPtr ConversionJob::execute(core::NodeManager& manager, bool fullApp) {
		// extension initialization
		frontendExtensionInit();

		// create a temporary manager
		core::NodeManager& tmpMgr = manager; // for performance we are just using the same manager
		//		core::NodeManager tmpMgr;		// not: due to the relevance of class-info-annotations no chaining of managers is allowed here

		// load and merge all files into a single translation unit
		auto unit = toIRTranslationUnit(tmpMgr);

		// convert units to a single program
		auto res = (fullApp) ? core::tu::toProgram(tmpMgr, unit) : core::tu::resolveEntryPoints(tmpMgr, unit);

		return applyPostProcessing(manager, res);
	}
Esempio n. 2
0
	core::ProgramPtr ConversionJob::execute(core::NodeManager& manager) {
		// extension initialization
		frontendExtensionInit();

		// create a temporary manager
	    core::NodeManager& tmpMgr = manager;	// for performance we are just using the same manager
//		core::NodeManager tmpMgr;		// not: due to the relevance of class-info-annotations no chaining of managers is allowed here

		// load and merge all files into a single translation unit
		auto unit = toIRTranslationUnit(tmpMgr);
		core::ProgramPtr res;

		if(unit.getEntryPoints().size() > 1)
			res = tu::resolveEntryPoints(tmpMgr, unit);
		else
			res = tu::toProgram(tmpMgr, unit);

		return execute(manager, res);
	}
Esempio n. 3
0
	core::tu::IRTranslationUnit ConversionJob::toIRTranslationUnit(core::NodeManager& manager) {
		// extension initialization
		frontendExtensionInit();

		// convert files to translation units
		auto units = ::transform(files, [&](const path& file) -> core::tu::IRTranslationUnit {
			auto res = convert(manager, file, *this);

			// maybe a visitor wants to manipulate the IR program
			for(auto extension : getExtensions())
				res = extension->IRVisit(res);

			// done
			return res;
		});

		// merge the translation units
		auto singleTu = core::tu::merge(manager, core::tu::merge(manager, libs), core::tu::merge(manager, units));

		// forward the C++ flag
		singleTu.setCXX(this->isCxx());
		return singleTu;
	}