|
14 | 14 | //===----------------------------------------------------------------------===//
|
15 | 15 |
|
16 | 16 | #include "llvm/IR/Attributes.h"
|
17 |
| -#include "llvm/IR/Function.h" |
18 | 17 | #include "AttributeImpl.h"
|
19 | 18 | #include "LLVMContextImpl.h"
|
20 | 19 | #include "llvm/ADT/STLExtras.h"
|
@@ -1432,80 +1431,3 @@ AttrBuilder AttributeFuncs::typeIncompatible(Type *Ty) {
|
1432 | 1431 |
|
1433 | 1432 | return Incompatible;
|
1434 | 1433 | }
|
1435 |
| - |
1436 |
| -template<typename AttrClass> |
1437 |
| -static bool isEqual(const Function &Caller, const Function &Callee) { |
1438 |
| - return Caller.getFnAttribute(AttrClass::getKind()) == |
1439 |
| - Callee.getFnAttribute(AttrClass::getKind()); |
1440 |
| -} |
1441 |
| - |
1442 |
| -/// \brief Compute the logical AND of the attributes of the caller and the |
1443 |
| -/// callee. |
1444 |
| -/// |
1445 |
| -/// This function sets the caller's attribute to false if the callee's attribute |
1446 |
| -/// is false. |
1447 |
| -template<typename AttrClass> |
1448 |
| -static void setAND(Function &Caller, const Function &Callee) { |
1449 |
| - if (AttrClass::isSet(Caller, AttrClass::getKind()) && |
1450 |
| - !AttrClass::isSet(Callee, AttrClass::getKind())) |
1451 |
| - AttrClass::set(Caller, AttrClass::getKind(), false); |
1452 |
| -} |
1453 |
| - |
1454 |
| -/// \brief Compute the logical OR of the attributes of the caller and the |
1455 |
| -/// callee. |
1456 |
| -/// |
1457 |
| -/// This function sets the caller's attribute to true if the callee's attribute |
1458 |
| -/// is true. |
1459 |
| -template<typename AttrClass> |
1460 |
| -static void setOR(Function &Caller, const Function &Callee) { |
1461 |
| - if (!AttrClass::isSet(Caller, AttrClass::getKind()) && |
1462 |
| - AttrClass::isSet(Callee, AttrClass::getKind())) |
1463 |
| - AttrClass::set(Caller, AttrClass::getKind(), true); |
1464 |
| -} |
1465 |
| - |
1466 |
| -/// \brief If the inlined function had a higher stack protection level than the |
1467 |
| -/// calling function, then bump up the caller's stack protection level. |
1468 |
| -static void adjustCallerSSPLevel(Function &Caller, const Function &Callee) { |
1469 |
| - // If upgrading the SSP attribute, clear out the old SSP Attributes first. |
1470 |
| - // Having multiple SSP attributes doesn't actually hurt, but it adds useless |
1471 |
| - // clutter to the IR. |
1472 |
| - AttrBuilder B; |
1473 |
| - B.addAttribute(Attribute::StackProtect) |
1474 |
| - .addAttribute(Attribute::StackProtectStrong) |
1475 |
| - .addAttribute(Attribute::StackProtectReq); |
1476 |
| - AttributeSet OldSSPAttr = AttributeSet::get(Caller.getContext(), |
1477 |
| - AttributeSet::FunctionIndex, |
1478 |
| - B); |
1479 |
| - |
1480 |
| - if (Callee.hasFnAttribute(Attribute::SafeStack)) { |
1481 |
| - Caller.removeAttributes(AttributeSet::FunctionIndex, OldSSPAttr); |
1482 |
| - Caller.addFnAttr(Attribute::SafeStack); |
1483 |
| - } else if (Callee.hasFnAttribute(Attribute::StackProtectReq) && |
1484 |
| - !Caller.hasFnAttribute(Attribute::SafeStack)) { |
1485 |
| - Caller.removeAttributes(AttributeSet::FunctionIndex, OldSSPAttr); |
1486 |
| - Caller.addFnAttr(Attribute::StackProtectReq); |
1487 |
| - } else if (Callee.hasFnAttribute(Attribute::StackProtectStrong) && |
1488 |
| - !Caller.hasFnAttribute(Attribute::SafeStack) && |
1489 |
| - !Caller.hasFnAttribute(Attribute::StackProtectReq)) { |
1490 |
| - Caller.removeAttributes(AttributeSet::FunctionIndex, OldSSPAttr); |
1491 |
| - Caller.addFnAttr(Attribute::StackProtectStrong); |
1492 |
| - } else if (Callee.hasFnAttribute(Attribute::StackProtect) && |
1493 |
| - !Caller.hasFnAttribute(Attribute::SafeStack) && |
1494 |
| - !Caller.hasFnAttribute(Attribute::StackProtectReq) && |
1495 |
| - !Caller.hasFnAttribute(Attribute::StackProtectStrong)) |
1496 |
| - Caller.addFnAttr(Attribute::StackProtect); |
1497 |
| -} |
1498 |
| - |
1499 |
| -#define GET_ATTR_COMPAT_FUNC |
1500 |
| -#include "AttributesCompatFunc.inc" |
1501 |
| - |
1502 |
| -bool AttributeFuncs::areInlineCompatible(const Function &Caller, |
1503 |
| - const Function &Callee) { |
1504 |
| - return hasCompatibleFnAttrs(Caller, Callee); |
1505 |
| -} |
1506 |
| - |
1507 |
| - |
1508 |
| -void AttributeFuncs::mergeAttributesForInlining(Function &Caller, |
1509 |
| - const Function &Callee) { |
1510 |
| - mergeFnAttrs(Caller, Callee); |
1511 |
| -} |
0 commit comments