summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmt.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-08-08 21:15:52 +0000
committerChad Rosier <mcrosier@apple.com>2012-08-08 21:15:52 +0000
commit360e1763d522bb73b721b4d3e972eee31da997fe (patch)
treea5d482094469f3506a1df3f4fa0d09e8089226ef /clang/lib/CodeGen/CGStmt.cpp
parent0415f3e13888d6c72f0d0463c2d3604b3b746985 (diff)
downloadbcm5719-llvm-360e1763d522bb73b721b4d3e972eee31da997fe.tar.gz
bcm5719-llvm-360e1763d522bb73b721b4d3e972eee31da997fe.zip
[ms-inline asm] Add basic codegen support for simple asm stmts. Currently,
only machine specific clobbers are modeled. llvm-svn: 161524
Diffstat (limited to 'clang/lib/CodeGen/CGStmt.cpp')
-rw-r--r--clang/lib/CodeGen/CGStmt.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index 33776b6c599..2e4c557db63 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -1686,4 +1686,19 @@ void CodeGenFunction::EmitMSAsmStmt(const MSAsmStmt &S) {
// MS-style inline assembly is not fully supported, so sema emits a warning.
if (!CGM.getCodeGenOpts().EmitMicrosoftInlineAsm)
return;
+
+ assert (S.isSimple() && "CodeGen can only handle simple MSAsmStmts.");
+
+ std::vector<llvm::Value*> Args;
+ std::vector<llvm::Type *> ArgTypes;
+
+ std::string MachineClobbers = Target.getClobbers();
+
+ llvm::FunctionType *FTy =
+ llvm::FunctionType::get(VoidTy, ArgTypes, false);
+
+ llvm::InlineAsm *IA =
+ llvm::InlineAsm::get(FTy, *S.getAsmString(), MachineClobbers, true);
+ llvm::CallInst *Result = Builder.CreateCall(IA, Args);
+ Result->addAttribute(~0, llvm::Attribute::NoUnwind);
}
OpenPOWER on IntegriCloud