mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 18:47:44 +00:00
LibJS: Make Bytecode::Generator::emit() return the created instruction
This will be useful for instructions that need to be modified later on during code generation, e.g jumps. :^)
This commit is contained in:
parent
0553e0b048
commit
4934d16397
1 changed files with 3 additions and 1 deletions
|
@ -18,10 +18,12 @@ public:
|
||||||
Register allocate_register();
|
Register allocate_register();
|
||||||
|
|
||||||
template<typename OpType, typename... Args>
|
template<typename OpType, typename... Args>
|
||||||
void emit(Args&&... args)
|
OpType& emit(Args&&... args)
|
||||||
{
|
{
|
||||||
auto instruction = make<OpType>(forward<Args>(args)...);
|
auto instruction = make<OpType>(forward<Args>(args)...);
|
||||||
|
auto* ptr = instruction.ptr();
|
||||||
append(move(instruction));
|
append(move(instruction));
|
||||||
|
return *ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue