Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] [EraVM] Enable predication of context instructions #716

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions llvm/lib/Target/EraVM/EraVMInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,20 @@ MachineInstr *EraVMInstrInfo::createPHISourceCopy(
bool EraVMInstrInfo::isPredicatedInstr(const MachineInstr &MI) const {
if (MI.isBranch())
return !MI.isUnconditionalBranch();
switch (MI.getOpcode()) {
default:
break;
case EraVM::CTXThis:
case EraVM::CTXCaller:
case EraVM::CTXCodeSource:
case EraVM::CTXGetU128:
case EraVM::CTXMeta:
case EraVM::CTXSetU128:
case EraVM::CTXGasLeft:
case EraVM::CTXGetSp:
case EraVM::CTXIncTx:
return true;
}
return isArithmetic(MI) || isBitwise(MI) || isShift(MI) || isRotate(MI) ||
isLoad(MI) || isFatLoad(MI) || isStore(MI) || isNOP(MI) || isSel(MI) ||
isPtr(MI);
Expand Down Expand Up @@ -1271,10 +1285,6 @@ bool EraVMInstrInfo::isPredicable(const MachineInstr &MI) const {
if (!isPredicatedInstr(MI))
return false;

// Do not predicate gas_left instruction
if (MI.getOpcode() == EraVM::CTXGasLeft)
return false;

// we cannot make a flag setting instruction predicated execute
if (EraVMInstrInfo::isFlagSettingInstruction(MI.getOpcode()))
return false;
Expand Down