mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
[a64] Implement HIR Branch labeling
Adds support for HIR labels to create actual oaknut labels
This commit is contained in:
parent
e5fd3d340c
commit
8257740d21
|
|
@ -265,8 +265,7 @@ bool A64Emitter::Emit(HIRBuilder* builder, EmitFunctionInfo& func_info) {
|
||||||
// Mark block labels.
|
// Mark block labels.
|
||||||
auto label = block->label_head;
|
auto label = block->label_head;
|
||||||
while (label) {
|
while (label) {
|
||||||
// TODO(wunkolo): string-labels?
|
l(label_lookup_[label->name]);
|
||||||
// L(label->name);
|
|
||||||
label = label->next;
|
label = label->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#ifndef XENIA_CPU_BACKEND_A64_A64_EMITTER_H_
|
#ifndef XENIA_CPU_BACKEND_A64_A64_EMITTER_H_
|
||||||
#define XENIA_CPU_BACKEND_A64_A64_EMITTER_H_
|
#define XENIA_CPU_BACKEND_A64_A64_EMITTER_H_
|
||||||
|
|
||||||
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "xenia/base/arena.h"
|
#include "xenia/base/arena.h"
|
||||||
|
|
@ -165,6 +166,11 @@ class A64Emitter : public oaknut::CodeBlock, public oaknut::CodeGenerator {
|
||||||
r = oaknut::QReg(idx);
|
r = oaknut::QReg(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gets(and possibly create) an HIR label with the specified name
|
||||||
|
oaknut::Label* lookup_label(const char* label_name) {
|
||||||
|
return &label_lookup_[label_name];
|
||||||
|
}
|
||||||
|
|
||||||
oaknut::Label& epilog_label() { return *epilog_label_; }
|
oaknut::Label& epilog_label() { return *epilog_label_; }
|
||||||
|
|
||||||
void MarkSourceOffset(const hir::Instr* i);
|
void MarkSourceOffset(const hir::Instr* i);
|
||||||
|
|
@ -229,6 +235,9 @@ class A64Emitter : public oaknut::CodeBlock, public oaknut::CodeGenerator {
|
||||||
|
|
||||||
oaknut::Label* epilog_label_ = nullptr;
|
oaknut::Label* epilog_label_ = nullptr;
|
||||||
|
|
||||||
|
// Convert from plain-text label-names into oaknut-labels
|
||||||
|
std::unordered_map<std::string, oaknut::Label> label_lookup_;
|
||||||
|
|
||||||
hir::Instr* current_instr_ = nullptr;
|
hir::Instr* current_instr_ = nullptr;
|
||||||
|
|
||||||
FunctionDebugInfo* debug_info_ = nullptr;
|
FunctionDebugInfo* debug_info_ = nullptr;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue