summaryrefslogtreecommitdiffhomepage
path: root/CompilerKit/AsmKit/AsmKit.hpp
blob: 14dc7a72ff6fdd7c1a6e8ab5a602e2651f27fbdd (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 Mahrouss Logic, all rights reserved.
 *
 * 	========================================================
 */

#pragma once

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

namespace CompilerKit
{
	//
	//	@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++ -> MASM -> AE object.
		virtual Int32 CompileToFormat(StringView& src, Int32 arch) = 0;

	};
	
    /// @brief Simple assembly factory
    class AssemblyFactory final
    {
    public:
        explicit AssemblyFactory() = default;
        ~AssemblyFactory() = default;

		CXXKIT_COPY_DEFAULT(AssemblyFactory);

	public:
		enum
		{
			kArchAMD64,
			kArch32x0,
			kArch64x0,
			kArchRISCV,
			kArchUnknown,
		};

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

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

	private:
		AssemblyMountpoint* fMounted{ nullptr };

    };
}