Exemple #1
0
void llvm::computeUsesVAFloatArgument(const CallInst &I,
                                      MachineModuleInfo &MMI) {
  FunctionType *FT =
      cast<FunctionType>(I.getCalledValue()->getType()->getContainedType(0));
  if (FT->isVarArg() && !MMI.usesVAFloatArgument()) {
    for (unsigned i = 0, e = I.getNumArgOperands(); i != e; ++i) {
      Type *T = I.getArgOperand(i)->getType();
      for (auto i : post_order(T)) {
        if (i->isFloatingPointTy()) {
          MMI.setUsesVAFloatArgument(true);
          return;
        }
      }
    }
  }
}
/// ComputeUsesVAFloatArgument - Determine if any floating-point values are
/// being passed to this variadic function, and set the MachineModuleInfo's
/// usesVAFloatArgument flag if so. This flag is used to emit an undefined
/// reference to _fltused on Windows, which will link in MSVCRT's
/// floating-point support.
void llvm::ComputeUsesVAFloatArgument(const CallInst &I,
                                      MachineModuleInfo *MMI)
{
    FunctionType *FT = cast<FunctionType>(
                           I.getCalledValue()->getType()->getContainedType(0));
    if (FT->isVarArg() && !MMI->usesVAFloatArgument()) {
        for (unsigned i = 0, e = I.getNumArgOperands(); i != e; ++i) {
            Type* T = I.getArgOperand(i)->getType();
            for (po_iterator<Type*> i = po_begin(T), e = po_end(T);
                    i != e; ++i) {
                if (i->isFloatingPointTy()) {
                    MMI->setUsesVAFloatArgument(true);
                    return;
                }
            }
        }
    }
}