[llvm-commits] [llvm-gcc-4.2] r45072 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Duncan Sands
baldrick at free.fr
Sun Dec 16 07:39:41 PST 2007
Author: baldrick
Date: Sun Dec 16 09:39:40 2007
New Revision: 45072
URL: http://llvm.org/viewvc/llvm-project?rev=45072&view=rev
Log:
Give calls to inline assembler the nounwind attribute.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=45072&r1=45071&r2=45072&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Sun Dec 16 09:39:40 2007
@@ -3289,6 +3289,16 @@
//===----------------------------------------------------------------------===//
+/// Return a ParamAttrsList for the given function return attributes.
+const ParamAttrsList *getReturnAttrs(uint16_t attrs) {
+ if (attrs == ParamAttr::None)
+ return NULL;
+
+ ParamAttrsVector Attrs;
+ Attrs.push_back(ParamAttrsWithIndex::get(0, attrs));
+ return ParamAttrsList::get(Attrs);
+}
+
/// Reads from register variables are handled by emitting an inline asm node
/// that copies the value out of the specified register.
Value *TreeToLLVM::EmitReadOfRegisterVariable(tree decl,
@@ -3307,7 +3317,9 @@
const char *Name = extractRegisterName(decl);
InlineAsm *IA = InlineAsm::get(FTy, "", "={"+std::string(Name)+"}", false);
- return Builder.CreateCall(IA, "tmp");
+ CallInst *Call = Builder.CreateCall(IA, "tmp");
+ Call->setParamAttrs(getReturnAttrs(ParamAttr::NoUnwind));
+ return Call;
}
/// Stores to register variables are handled by emitting an inline asm node
@@ -3324,7 +3336,8 @@
const char *Name = extractRegisterName(decl);
InlineAsm *IA = InlineAsm::get(FTy, "", "{"+std::string(Name)+"}", true);
- Builder.CreateCall(IA, RHS);
+ CallInst *Call = Builder.CreateCall(IA, RHS);
+ Call->setParamAttrs(getReturnAttrs(ParamAttr::NoUnwind));
}
/// ConvertInlineAsmStr - Convert the specified inline asm string to an LLVM
@@ -3747,7 +3760,8 @@
ASM_VOLATILE_P(exp) || !ASM_OUTPUTS(exp));
CallInst *CV = Builder.CreateCall(Asm, CallOps.begin(), CallOps.end(),
StoreCallResultAddr ? "tmp" : "");
-
+ CV->setParamAttrs(getReturnAttrs(ParamAttr::NoUnwind));
+
// If the call produces a value, store it into the destination.
if (StoreCallResultAddr)
Builder.CreateStore(CV, StoreCallResultAddr);
More information about the llvm-commits
mailing list