llvm-6502/lib/Transforms/Scalar
Chris Lattner b89e071aea 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14783 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 01:49:43 +00:00
..
ADCE.cpp Do not mark instructions in unreachable sections of the function as live. 2004-05-04 17:00:46 +00:00
BasicBlockPlacement.cpp Remove obsolete comment. Unreachable blocks will automatically be left at the 2004-02-11 05:20:50 +00:00
ConstantProp.cpp Changes to fix up the inst_iterator to pass to boost iterator checks. This 2004-04-27 15:13:33 +00:00
CorrelatedExprs.cpp Remove use of the ConstantHandling interfaces 2004-01-12 19:12:50 +00:00
DCE.cpp Changes to fix up the inst_iterator to pass to boost iterator checks. This 2004-04-27 15:13:33 +00:00
DecomposeMultiDimRefs.cpp It doesn't matter what the 2nd operand is; if the GEP has 2 operands and 2004-07-06 19:24:47 +00:00
GCSE.cpp Add support for replacement of formal arguments with simpler expressions. 2004-05-23 21:19:55 +00:00
IndVarSimplify.cpp Two fixes. First, stop using the ugly shouldSubstituteIndVar method. 2004-06-24 06:49:18 +00:00
InstructionCombining.cpp Factor some code to handle "load (constantexpr cast foo)" just like 2004-07-13 01:49:43 +00:00
LICM.cpp Now that dominator tree children are built in determinstic order, this horrible code 2004-06-19 20:23:35 +00:00
LoopUnroll.cpp Fix a nasty bug that caused us to unroll EXTREMELY large loops due to overflow 2004-05-13 20:43:31 +00:00
LoopUnswitch.cpp Initial checkin of a simple loop unswitching pass. It still needs work, 2004-04-19 18:07:02 +00:00
LowerConstantExprs.cpp Add #include <iostream> since Value.h does not #include it any more. 2004-07-04 12:19:56 +00:00
LowerGC.cpp Spelling people's names right is kinda important 2004-05-23 21:27:29 +00:00
Makefile Added LLVM copyright notice to Makefiles. 2003-10-20 22:26:57 +00:00
PiNodeInsertion.cpp Finegrainify namespacification 2004-01-09 06:02:20 +00:00
PRE.cpp Finegrainify namespacification 2004-01-09 06:02:20 +00:00
Reassociate.cpp Make this pass use a more specific debug message than "Processing:". 2004-07-01 19:27:10 +00:00
ScalarReplAggregates.cpp Do not loop over uses as we delete them. This causes iterators to be 2004-06-19 02:02:22 +00:00
SCCP.cpp Add SCCP support for constant folding calls, implementing: 2004-04-13 19:43:54 +00:00
SimplifyCFG.cpp Finegrainify namespacification 2004-01-09 06:02:20 +00:00
SymbolStripping.cpp Make this pass simply invoke SymbolTable::strip(). 2004-05-25 08:51:25 +00:00
TailDuplication.cpp Remove unused header file. 2004-05-25 08:51:36 +00:00
TailRecursionElimination.cpp Adjust to the new BasicBlock ctor, which requires a function parameter 2004-02-04 03:58:28 +00:00