trivial
This commit is contained in:
parent
01ec3d83f2
commit
8d23769410
@ -207,9 +207,11 @@ public:
|
|||||||
|
|
||||||
class MCModule {
|
class MCModule {
|
||||||
public:
|
public:
|
||||||
|
std::string file_name;
|
||||||
std::list<sptr(MFunction)> function_list;
|
std::list<sptr(MFunction)> function_list;
|
||||||
std::list<sptr(GlobalVar)> global_list;
|
std::list<sptr(GlobalVar)> global_list;
|
||||||
void IR2MC(const Module &ir_module);
|
void IR2MC(const Module &ir_module);
|
||||||
|
void MC2ASM(std::ostream& ostr);
|
||||||
};
|
};
|
||||||
|
|
||||||
class MInstBinary : public MInst {
|
class MInstBinary : public MInst {
|
||||||
|
|||||||
@ -128,6 +128,7 @@ int main(int argc, const char **argv) {
|
|||||||
// std::cout << tree->toStringTree(&parser) << std::endl << std::endl;
|
// std::cout << tree->toStringTree(&parser) << std::endl << std::endl;
|
||||||
|
|
||||||
MCModule mc_module;
|
MCModule mc_module;
|
||||||
|
mc_module.file_name = source_file;
|
||||||
mc_module.IR2MC(visitor.module);
|
mc_module.IR2MC(visitor.module);
|
||||||
std::vector<sptr(MCPass)> mc_passes = {std::make_shared<PassRegAlloc>()};
|
std::vector<sptr(MCPass)> mc_passes = {std::make_shared<PassRegAlloc>()};
|
||||||
for (auto pass : mc_passes) {
|
for (auto pass : mc_passes) {
|
||||||
|
|||||||
@ -1,3 +1,15 @@
|
|||||||
#include "mc_inst.h"
|
#include "mc_inst.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
namespace CompSysY {
|
||||||
|
|
||||||
|
|
||||||
|
void MCModule::MC2ASM(std::ostream &ostr) {
|
||||||
|
// header, specifying align and arch
|
||||||
|
ostr << "\t.text\n" << "\t.attribute\t4,\t16\n"
|
||||||
|
<< "\t.attribute\t5\t\"rv64i2p0_m2p0_f2p0_d2p0\"\n";
|
||||||
|
ostr << "\t.file\t\"" << this->file_name << "\"\n" << std::endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user