Rename InstructionFormat::IndirectCall for consistency with Opcode::CallIndirect.

This commit is contained in:
Dan Gohman
2018-04-17 09:43:05 -07:00
parent e2f6705e28
commit a9edb28414
10 changed files with 15 additions and 15 deletions

View File

@@ -20,7 +20,7 @@ stack_slot = EntityRefKind('stack_slot', 'A stack slot.')
global_var = EntityRefKind('global_var', 'A global variable.') global_var = EntityRefKind('global_var', 'A global variable.')
#: A reference to a function sugnature declared in the function preamble. #: A reference to a function sugnature declared in the function preamble.
#: Tbis is used to provide the call signature in an indirect call instruction. #: This is used to provide the call signature in a call_indirect instruction.
sig_ref = EntityRefKind('sig_ref', 'A function signature.') sig_ref = EntityRefKind('sig_ref', 'A function signature.')
#: A reference to an external function declared in the function preamble. #: A reference to an external function declared in the function preamble.

View File

@@ -53,7 +53,7 @@ BranchIcmp = InstructionFormat(intcc, VALUE, VALUE, ebb, VARIABLE_ARGS)
BranchTable = InstructionFormat(VALUE, entities.jump_table) BranchTable = InstructionFormat(VALUE, entities.jump_table)
Call = InstructionFormat(func_ref, VARIABLE_ARGS) Call = InstructionFormat(func_ref, VARIABLE_ARGS)
IndirectCall = InstructionFormat(sig_ref, VALUE, VARIABLE_ARGS) CallIndirect = InstructionFormat(sig_ref, VALUE, VARIABLE_ARGS)
FuncAddr = InstructionFormat(func_ref) FuncAddr = InstructionFormat(func_ref)
Load = InstructionFormat(memflags, VALUE, offset32) Load = InstructionFormat(memflags, VALUE, offset32)

View File

@@ -14,7 +14,7 @@ from cdsl.predicates import IsSignedInt
from cdsl.registers import Stack from cdsl.registers import Stack
from base.formats import Binary, BinaryImm, MultiAry, IntCompare, IntCompareImm from base.formats import Binary, BinaryImm, MultiAry, IntCompare, IntCompareImm
from base.formats import Unary, UnaryImm, BranchIcmp, Branch, Jump from base.formats import Unary, UnaryImm, BranchIcmp, Branch, Jump
from base.formats import Call, IndirectCall, RegMove from base.formats import Call, CallIndirect, RegMove
from .registers import GPR from .registers import GPR
# The low 7 bits of a RISC-V instruction is the base opcode. All 32-bit # The low 7 bits of a RISC-V instruction is the base opcode. All 32-bit
@@ -140,11 +140,11 @@ Iret = EncRecipe(
); );
''') ''')
# I-type encoding for `jalr` as an indirect call. # I-type encoding for `jalr` as a call_indirect.
Icall = EncRecipe( Icall = EncRecipe(
'Icall', IndirectCall, size=4, ins=GPR, outs=(), 'Icall', CallIndirect, size=4, ins=GPR, outs=(),
emit=''' emit='''
// Indirect instructions are jalr with rd=%x1. // call_indirect instructions are jalr with rd=%x1.
put_i( put_i(
bits, bits,
in_reg0, in_reg0,

View File

@@ -7,7 +7,7 @@ from cdsl.predicates import IsSignedInt, IsEqual, Or
from cdsl.registers import RegClass from cdsl.registers import RegClass
from base.formats import Unary, UnaryImm, UnaryBool, Binary, BinaryImm from base.formats import Unary, UnaryImm, UnaryBool, Binary, BinaryImm
from base.formats import MultiAry, NullAry from base.formats import MultiAry, NullAry
from base.formats import Trap, Call, IndirectCall, Store, Load from base.formats import Trap, Call, CallIndirect, Store, Load
from base.formats import IntCompare, IntCompareImm, FloatCompare from base.formats import IntCompare, IntCompareImm, FloatCompare
from base.formats import IntCond, FloatCond from base.formats import IntCond, FloatCond
from base.formats import IntSelect, IntCondTrap, FloatCondTrap from base.formats import IntSelect, IntCondTrap, FloatCondTrap
@@ -1055,7 +1055,7 @@ call_plt_id = TailRecipe(
''') ''')
call_r = TailRecipe( call_r = TailRecipe(
'call_r', IndirectCall, size=1, ins=GPR, outs=(), 'call_r', CallIndirect, size=1, ins=GPR, outs=(),
emit=''' emit='''
PUT_OP(bits, rex1(in_reg0), sink); PUT_OP(bits, rex1(in_reg0), sink);
modrm_r_bits(in_reg0, bits, sink); modrm_r_bits(in_reg0, bits, sink);

View File

@@ -248,7 +248,7 @@ impl InstructionData {
InstructionData::Call { func_ref, ref args, .. } => { InstructionData::Call { func_ref, ref args, .. } => {
CallInfo::Direct(func_ref, args.as_slice(pool)) CallInfo::Direct(func_ref, args.as_slice(pool))
} }
InstructionData::IndirectCall { sig_ref, ref args, .. } => { InstructionData::CallIndirect { sig_ref, ref args, .. } => {
CallInfo::Indirect(sig_ref, &args.as_slice(pool)[1..]) CallInfo::Indirect(sig_ref, &args.as_slice(pool)[1..])
} }
_ => { _ => {

View File

@@ -51,7 +51,7 @@ pub fn expand_call(
); );
} }
func.dfg.replace(inst).IndirectCall( func.dfg.replace(inst).CallIndirect(
ir::Opcode::CallIndirect, ir::Opcode::CallIndirect,
ptr_ty, ptr_ty,
sig, sig,

View File

@@ -319,7 +319,7 @@ impl<'a> Verifier<'a> {
self.verify_func_ref(inst, func_ref)?; self.verify_func_ref(inst, func_ref)?;
self.verify_value_list(inst, args)?; self.verify_value_list(inst, args)?;
} }
IndirectCall { sig_ref, ref args, .. } => { CallIndirect { sig_ref, ref args, .. } => {
self.verify_sig_ref(inst, sig_ref)?; self.verify_sig_ref(inst, sig_ref)?;
self.verify_value_list(inst, args)?; self.verify_value_list(inst, args)?;
} }

View File

@@ -349,7 +349,7 @@ pub fn write_operands(
Call { func_ref, ref args, .. } => { Call { func_ref, ref args, .. } => {
write!(w, " {}({})", func_ref, DisplayValues(args.as_slice(pool))) write!(w, " {}({})", func_ref, DisplayValues(args.as_slice(pool)))
} }
IndirectCall { sig_ref, ref args, .. } => { CallIndirect { sig_ref, ref args, .. } => {
let args = args.as_slice(pool); let args = args.as_slice(pool);
write!( write!(
w, w,

View File

@@ -2179,7 +2179,7 @@ impl<'a> Parser<'a> {
args: args.into_value_list(&[], &mut ctx.function.dfg.value_lists), args: args.into_value_list(&[], &mut ctx.function.dfg.value_lists),
} }
} }
InstructionFormat::IndirectCall => { InstructionFormat::CallIndirect => {
let sig_ref = self.match_sig("expected signature reference")?; let sig_ref = self.match_sig("expected signature reference")?;
ctx.check_sig(sig_ref, &self.loc)?; ctx.check_sig(sig_ref, &self.loc)?;
self.match_token( self.match_token(
@@ -2196,7 +2196,7 @@ impl<'a> Parser<'a> {
Token::RPar, Token::RPar,
"expected ')' after arguments", "expected ')' after arguments",
)?; )?;
InstructionData::IndirectCall { InstructionData::CallIndirect {
opcode, opcode,
sig_ref, sig_ref,
args: args.into_value_list(&[callee], &mut ctx.function.dfg.value_lists), args: args.into_value_list(&[callee], &mut ctx.function.dfg.value_lists),

View File

@@ -226,7 +226,7 @@ impl<'dummy_environment> FuncEnvironment for DummyFuncEnvironment<'dummy_environ
args.push(vmctx, &mut pos.func.dfg.value_lists); args.push(vmctx, &mut pos.func.dfg.value_lists);
pos.ins() pos.ins()
.IndirectCall(ir::Opcode::CallIndirect, ir::types::VOID, sig_ref, args) .CallIndirect(ir::Opcode::CallIndirect, ir::types::VOID, sig_ref, args)
.0 .0
} }