VTable Method Index

Virtual call translates into IR like this:

%0 = bitcast %class.A* %call to i32 (%class.A*, i32)***
%vtable = load i32 (%class.A*, i32)*** %0
%vfn = getelementptr inbounds i32 (%class.A*, i32)** %vtable, i64 0
%1 = load i32 (%class.A*, i32)** %vfn

Is it possible to map pair [StructType, methodIndex(i64 0 in example)] into Function?

Yours sincerely,
Kadysev Mikhail

Hi Михаил,

Virtual call translates into IR like this:

%0 = bitcast %class.A* %call to i32 (%class.A*, i32)***
%vtable = load i32 (%class.A*, i32)*** %0
%vfn = getelementptr inbounds i32 (%class.A*, i32)** %vtable, i64 0
%1 = load i32 (%class.A*, i32)** %vfn

Is it possible to map pair [StructType, methodIndex(i64 0 in example)] into
Function?

if the vtable is present in the IR module, and the optimizers can work out that
%0 is pointing to it, then yes.

Ciao, Duncan.