diff --git a/lib/Target/EVM/EVM.td b/lib/Target/EVM/EVM.td index 5270bc8124ca9..bab0eacb6f8f6 100644 --- a/lib/Target/EVM/EVM.td +++ b/lib/Target/EVM/EVM.td @@ -24,14 +24,21 @@ def HasEIP211 : Predicate<"Subtarget->hasEIP211()">, def HasEIP615 : Predicate<"Subtarget->hasEIP615()">, AssemblerPredicate<"FeatureEIP615">; +*/ + +def FeatureSubroutine : SubtargetFeature<"subroutine", + "HasSubroutine", + "true", + "EVM Subroutine support">; + +def HasSubroutine : Predicate<"Subtarget->hasSubroutine()">, + AssemblerPredicate<"FeatureSubroutine">; class Proc Features> : Processor; def : Proc<"generic", []>; -def : Proc<"eip211", [EIP211]>; -def : Proc<"eip615", [EIP211, EIP615]>; -*/ +def : Proc<"EVM15", [FeatureSubroutine]>; //===----------------------------------------------------------------------===// // Registers, instruction descriptions. diff --git a/lib/Target/EVM/EVMInstrInfo.td b/lib/Target/EVM/EVMInstrInfo.td index 62973571d4dd2..8c19f6ede1aeb 100644 --- a/lib/Target/EVM/EVMInstrInfo.td +++ b/lib/Target/EVM/EVMInstrInfo.td @@ -444,14 +444,17 @@ def DUP16: EVMInst<(outs), (ins), [], "true", "DUP16", 0x8f, 3>; let isBranch = 1, isBarrier = 1, isTerminator = 1 in { defm JUMPTO : Inst_1_0<"JUMPTO", [], 0xb0, 8>; -/* -defm JUMPIF : // TODO: argument type is 4 bytes. - : RSInst<(outs GPR:$dst), (ins GPR:$src1, GPR:$src2), - pattern, - "JUMPIF\t$dst, $src1, $src2", "JUMPIF", 0xb1, 10>; -*/ + +def JUMPSUB : + EVMInst<(outs), (ins I256Imm:$tgt), [], "true", "JUMPSUB \t$tgt", 0xb3, 8>; } +def BEGINSUB : + EVMInst<(outs), (ins), [], "true", "BEGINSUB", 0xb5, 1>; +def RETURNSUB : + EVMInst<(outs), (ins), [], "true", "RETURNSUB", 0xb7, 2>; + + let mayStore = 1, hasSideEffects = 1 in { defm CREATE : Inst_3_1<"CREATE", [(set GPR:$dst, diff --git a/lib/Target/EVM/EVMSubtarget.h b/lib/Target/EVM/EVMSubtarget.h index 65feaa900d08b..b9a0dc81dab56 100644 --- a/lib/Target/EVM/EVMSubtarget.h +++ b/lib/Target/EVM/EVMSubtarget.h @@ -31,13 +31,9 @@ class StringRef; class EVMSubtarget : public EVMGenSubtargetInfo { virtual void anchor(); - // EVM Change - bool HasEIP211 = false; - bool HasEIP615 = false; + bool HasSubroutine = true; - bool hasEIP211() const { return HasEIP211; } - bool hasEIP615() const { return HasEIP615; } - // end of EVM Change + bool hasSubroutine() const {return HasSubroutine; } EVMFrameLowering FrameLowering; EVMInstrInfo InstrInfo;