chrib updated this revision to Diff 113846.
chrib added a comment.
Herald added a subscriber: kristof.beyls.
Rebase and cleanup NeedsUnwindTable for be variants.
https://reviews.llvm.org/D31140
Files:
lib/CodeGen/CodeGenModule.cpp
lib/CodeGen/CodeGenModule.h
Index: lib/CodeGen/CodeGenModule.h
===================================================================
--- lib/CodeGen/CodeGenModule.h
+++ lib/CodeGen/CodeGenModule.h
@@ -1334,6 +1334,11 @@
void ConstructDefaultFnAttrList(StringRef Name, bool HasOptnone,
bool AttrOnCallSite,
llvm::AttrBuilder &FuncAttrs);
+
+ /// Check whether the attribute UWTable must be set to emit the unwind table
+ /// for exceptions
+ bool NeedsUnwindTable();
+
};
} // end namespace CodeGen
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -914,13 +914,32 @@
return true;
}
+// This function needs an unwind table
+bool CodeGenModule::NeedsUnwindTable() {
+ if (CodeGenOpts.UnwindTables)
+ return true;
+
+ // xxx checkarm eabi needs to emit the nowind attribute.
+ // implement function ins ARM.cpp
+ const llvm::Triple T = Context.getTargetInfo().getTriple();
+ if (hasUnwindExceptions (LangOpts)
+ && (T.isARM() || T.isThumb ())
+ && (T.getEnvironment() == llvm::Triple::EABI))
+ return true;
+
+ return false;
+}
+
void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
llvm::Function *F) {
llvm::AttrBuilder B;
- if (CodeGenOpts.UnwindTables)
+ // Set the attribute if the user requests it or if the language requiers it.
+ if (NeedsUnwindTable())
B.addAttribute(llvm::Attribute::UWTable);
+ // If the module doesn't support exceptions the function cannot throw.
+ // We can have a nothrow function even if unwind tables are required.
if (!hasUnwindExceptions(LangOpts))
B.addAttribute(llvm::Attribute::NoUnwind);
Index: lib/CodeGen/CodeGenModule.h
===================================================================
--- lib/CodeGen/CodeGenModule.h
+++ lib/CodeGen/CodeGenModule.h
@@ -1334,6 +1334,11 @@
void ConstructDefaultFnAttrList(StringRef Name, bool HasOptnone,
bool AttrOnCallSite,
llvm::AttrBuilder &FuncAttrs);
+
+ /// Check whether the attribute UWTable must be set to emit the unwind table
+ /// for exceptions
+ bool NeedsUnwindTable();
+
};
} // end namespace CodeGen
Index: lib/CodeGen/CodeGenModule.cpp
===================================================================
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -914,13 +914,32 @@
return true;
}
+// This function needs an unwind table
+bool CodeGenModule::NeedsUnwindTable() {
+ if (CodeGenOpts.UnwindTables)
+ return true;
+
+ // xxx checkarm eabi needs to emit the nowind attribute.
+ // implement function ins ARM.cpp
+ const llvm::Triple T = Context.getTargetInfo().getTriple();
+ if (hasUnwindExceptions (LangOpts)
+ && (T.isARM() || T.isThumb ())
+ && (T.getEnvironment() == llvm::Triple::EABI))
+ return true;
+
+ return false;
+}
+
void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
llvm::Function *F) {
llvm::AttrBuilder B;
- if (CodeGenOpts.UnwindTables)
+ // Set the attribute if the user requests it or if the language requiers it.
+ if (NeedsUnwindTable())
B.addAttribute(llvm::Attribute::UWTable);
+ // If the module doesn't support exceptions the function cannot throw.
+ // We can have a nothrow function even if unwind tables are required.
if (!hasUnwindExceptions(LangOpts))
B.addAttribute(llvm::Attribute::NoUnwind);
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits