|
@@ -13,7 +13,6 @@
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
#include "llvm/CodeGen/FunctionLoweringInfo.h"
|
|
|
-#include "llvm/ADT/PostOrderIterator.h"
|
|
|
#include "llvm/CodeGen/Analysis.h"
|
|
|
#include "llvm/CodeGen/MachineFrameInfo.h"
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
|
@@ -544,61 +543,6 @@ unsigned FunctionLoweringInfo::getCatchPadExceptionPointerVReg(
|
|
|
return VReg;
|
|
|
}
|
|
|
|
|
|
-/// 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 (auto i : post_order(T)) {
|
|
|
- if (i->isFloatingPointTy()) {
|
|
|
- MMI->setUsesVAFloatArgument(true);
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-/// AddLandingPadInfo - Extract the exception handling information from the
|
|
|
-/// landingpad instruction and add them to the specified machine module info.
|
|
|
-void llvm::AddLandingPadInfo(const LandingPadInst &I, MachineModuleInfo &MMI,
|
|
|
- MachineBasicBlock *MBB) {
|
|
|
- if (const auto *PF = dyn_cast<Function>(
|
|
|
- I.getParent()->getParent()->getPersonalityFn()->stripPointerCasts()))
|
|
|
- MMI.addPersonality(PF);
|
|
|
-
|
|
|
- if (I.isCleanup())
|
|
|
- MMI.addCleanup(MBB);
|
|
|
-
|
|
|
- // FIXME: New EH - Add the clauses in reverse order. This isn't 100% correct,
|
|
|
- // but we need to do it this way because of how the DWARF EH emitter
|
|
|
- // processes the clauses.
|
|
|
- for (unsigned i = I.getNumClauses(); i != 0; --i) {
|
|
|
- Value *Val = I.getClause(i - 1);
|
|
|
- if (I.isCatch(i - 1)) {
|
|
|
- MMI.addCatchTypeInfo(MBB,
|
|
|
- dyn_cast<GlobalValue>(Val->stripPointerCasts()));
|
|
|
- } else {
|
|
|
- // Add filters in a list.
|
|
|
- Constant *CVal = cast<Constant>(Val);
|
|
|
- SmallVector<const GlobalValue*, 4> FilterList;
|
|
|
- for (User::op_iterator
|
|
|
- II = CVal->op_begin(), IE = CVal->op_end(); II != IE; ++II)
|
|
|
- FilterList.push_back(cast<GlobalValue>((*II)->stripPointerCasts()));
|
|
|
-
|
|
|
- MMI.addFilterTypeInfo(MBB, FilterList);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
unsigned
|
|
|
FunctionLoweringInfo::getOrCreateSwiftErrorVReg(const MachineBasicBlock *MBB,
|
|
|
const Value *Val) {
|