Skip to content

Commit

Permalink
[EVM] Support immutables in new stackification algorithm
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Radosavljevic <[email protected]>
  • Loading branch information
vladimirradosavljevic committed Feb 6, 2025
1 parent 0aeb883 commit 0ea80f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion llvm/lib/Target/EVM/EVMStackModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ void EVMStackModel::createOperation(MachineInstr &MI,
case EVM::DATASIZE:
case EVM::DATAOFFSET:
case EVM::LINKERSYMBOL:
case EVM::LOADIMMUTABLE:
// The copy/data instructions just represent an assignment. This case is
// handled below.
break;
Expand Down Expand Up @@ -194,7 +195,8 @@ void EVMStackModel::createOperation(MachineInstr &MI,
} break;
case EVM::DATASIZE:
case EVM::DATAOFFSET:
case EVM::LINKERSYMBOL: {
case EVM::LINKERSYMBOL:
case EVM::LOADIMMUTABLE: {
const Register DefReg = MI.getOperand(0).getReg();
MCSymbol *Sym = MI.getOperand(1).getMCSymbol();
Input.push_back(getSymbolSlot(Sym, &MI));
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Target/EVM/EVMStackifyCodeEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ void EVMStackifyCodeEmitter::CodeEmitter::emitSymbol(const MachineInstr *MI,
MCSymbol *Symbol) {
unsigned Opc = MI->getOpcode();
assert(Opc == EVM::DATASIZE || Opc == EVM::DATAOFFSET ||
Opc == EVM::LINKERSYMBOL && "Unexpected symbol instruction");
Opc == EVM::LINKERSYMBOL ||
Opc == EVM::LOADIMMUTABLE && "Unexpected symbol instruction");
StackHeight += 1;
// This is codegen-only instruction, that will be converted into PUSH4.
auto NewMI = BuildMI(*CurMBB, CurMBB->end(), MI->getDebugLoc(),
Expand Down

0 comments on commit 0ea80f9

Please sign in to comment.