summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-13 01:49:43 +0000
committerChris Lattner <sabre@nondot.org>2004-07-13 01:49:43 +0000
commit35e24774ebb5e2f6f1e9de94fb86fa58bed9f265 (patch)
treef0e77cf75a20dd7147b0b7890679f3b0e8b17465 /llvm/lib/Bytecode
parentbe1b680f546a932e9534c4a643a3da7a682ae23c (diff)
downloadbcm5719-llvm-35e24774ebb5e2f6f1e9de94fb86fa58bed9f265.tar.gz
bcm5719-llvm-35e24774ebb5e2f6f1e9de94fb86fa58bed9f265.zip
Factor some code to handle "load (constantexpr cast foo)" just like
"load (cast foo)". This allows us to compile C++ code like this: class Bclass { public: virtual int operator()() { return 666; } }; class Dclass: public Bclass { public: virtual int operator()() { return 667; } } ; int main(int argc, char** argv) { Dclass x; return x(); } Into this: int %main(int %argc, sbyte** %argv) { entry: call void %__main( ) ret int 667 } Instead of this: int %main(int %argc, sbyte** %argv) { entry: %x = alloca "struct.std::bad_typeid" ; <"struct.std::bad_typeid"*> [#uses=3] call void %__main( ) %tmp.1.i.i = getelementptr "struct.std::bad_typeid"* %x, uint 0, uint 0, uint 0 ; <int (...)***> [#uses=1] store int (...)** getelementptr ([3 x int (...)*]* %vtable for Bclass, int 0, long 2), int (...)*** %tmp.1.i.i %tmp.3.i = getelementptr "struct.std::bad_typeid"* %x, int 0, uint 0, uint 0 ; <int (...)***> [#uses=1] store int (...)** getelementptr ([3 x int (...)*]* %vtable for Dclass, int 0, long 2), int (...)*** %tmp.3.i %tmp.5 = load int ("struct.std::bad_typeid"*)** cast (int (...)** getelementptr ([3 x int (...)*]* %vtable for Dclass, int 0, long 2) to int ("struct.std::bad_typeid"*)**) ; <int ("struct.std::bad_typeid"*)*> [#uses=1] %tmp.6 = call int %tmp.5( "struct.std::bad_typeid"* %x ) ; <int> [#uses=1] ret int %tmp.6 ret int 0 } In order words, we now resolve the virtual function call. llvm-svn: 14783
Diffstat (limited to 'llvm/lib/Bytecode')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud