> Provide support for intrinsics that lower themselves to a function > body. > This can happen for intrinsics that are overloaded. In such cases > it is > necessary to emit a function prototype before the body of the function > that calls the intrinsic and to ensure we don't emit it multiple > times.
Please make sure these are emitted with weak linkage, so they get merged across .o files. > #include "llvm/Config/config.h" > #include <algorithm> > #include <sstream> > +// #include <set> > using namespace llvm; Plz remove. > > + // We may have collected some prototypes to emit in the loop above. > + // Emit them now, before the function that uses them is emitted. > But, > + // be careful not to emit them twice. > + std::vector<Function*>::iterator I = prototypesToGen.begin(); > + std::vector<Function*>::iterator E = prototypesToGen.end(); > + for ( ; I != E; ++I) { > + if (intrinsicPrototypesAlreadyGenerated.count(*I) == 0) { > + Out << '\n'; > + printFunctionSignature(*I, true); > + Out << ";\n"; > + intrinsicPrototypesAlreadyGenerated.insert(*I); Instead of count+insert, just use insert and check the result to see if it succeeded. Thanks, -chris > + } > + } > +} > > > void CWriter::visitCallInst(CallInst &I) { > > > > _______________________________________________ > llvm-commits mailing list > [EMAIL PROTECTED] > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits _______________________________________________ llvm-commits mailing list [EMAIL PROTECTED] http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits