summaryrefslogtreecommitdiffhomepage
path: root/C++Kit/AsmKit/AsmKit.hpp
blob: e156dfe9462a8feea7ed74ae0def5e806f2681b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 *	========================================================
 *
 *	C++Kit
 * 	Copyright WestCo, all rights reserved.
 *
 * 	========================================================
 */

#pragma once

#include <CompilerKit/Compiler.hpp>
#include <C++Kit/Defines.hpp>
#include <C++Kit/StdKit/String.hpp>

namespace CxxKit
{
	//
	//	@brief Frontend to Assembly mountpoint.
	//
	class AssemblyMountpoint
	{
	public:
    	explicit AssemblyMountpoint() = default;
    	virtual ~AssemblyMountpoint() = default;

		CXXKIT_COPY_DEFAULT(AssemblyMountpoint);

		//@ brief compile to object file.
		// Example C++ -> Assembly -> AE object.
		virtual Int32 CompileToFormat(StringView& src, Int32 arch) = 0;

	};
	
    class AssemblyFactory final
    {
    public:
        explicit AssemblyFactory() = default;
        ~AssemblyFactory() = default;

		CXXKIT_COPY_DEFAULT(AssemblyFactory);

	public:
		enum
		{
			kArchAMD64,
			kArchARM64,
			kArchPowerPC,
			kArchARC,
			kArchRISCV,
			kArchUnknown,
		};

        Int32 Compile(StringView& sourceFile, const Int32& arch) noexcept;

		void Mount(AssemblyMountpoint* mountPtr) noexcept;
		AssemblyMountpoint* Unmount() noexcept;

	private:
		AssemblyMountpoint* fMounted{ nullptr };

    };
}