-static Constant *
-getFunctionData(const Function *F,
- const LLVMContextImpl::FunctionDataMapTy &Map) {
- const auto &Entry = Map.find(F);
- assert(Entry != Map.end());
- return cast<Constant>(Entry->second->getReturnValue());
-}
-
-/// setFunctionData - Set "Map[F] = Data". Return an updated SubclassData value
-/// in which Bit is low iff Data is null.
-static unsigned setFunctionData(Function *F,
- LLVMContextImpl::FunctionDataMapTy &Map,
- Constant *Data, unsigned SCData, unsigned Bit) {
- ReturnInst *&Holder = Map[F];
- if (Data) {
- if (Holder)
- Holder->setOperand(0, Data);
- else
- Holder = ReturnInst::Create(F->getContext(), Data);
- return SCData | (1 << Bit);
- } else {
- delete Holder;
- Map.erase(F);
- return SCData & ~(1 << Bit);
- }
+Constant *Function::getPersonalityFn() const {
+ assert(hasPersonalityFn() && getNumOperands());
+ return cast<Constant>(Op<0>());
+}
+
+void Function::setPersonalityFn(Constant *Fn) {
+ if (Fn)
+ setHungoffOperand<0>(Fn);
+ setValueSubclassDataBit(3, Fn != nullptr);