aboutsummaryrefslogtreecommitdiff
path: root/src/zig_llvm.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-03-23 18:59:43 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-03-23 18:59:43 -0400
commit5c04730534ea7933855429c5fc5dc7b22eba7bc2 (patch)
tree6270702f9aefc48a6a1eabfa61c3e8209d020569 /src/zig_llvm.cpp
parentfd634f3db35791ea904e82a525e4f49f4c5b67a8 (diff)
downloadzig-5c04730534ea7933855429c5fc5dc7b22eba7bc2.tar.gz
zig-5c04730534ea7933855429c5fc5dc7b22eba7bc2.zip
use intel dialect for inline assembly
closes #242
Diffstat (limited to 'src/zig_llvm.cpp')
-rw-r--r--src/zig_llvm.cpp35
1 files changed, 24 insertions, 11 deletions
diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp
index a837c896cc..d946426b54 100644
--- a/src/zig_llvm.cpp
+++ b/src/zig_llvm.cpp
@@ -22,22 +22,23 @@
* 3. Prevent C++ from infecting the rest of the project.
*/
+#include <llvm/Analysis/TargetLibraryInfo.h>
+#include <llvm/Analysis/TargetTransformInfo.h>
+#include <llvm/IR/DIBuilder.h>
+#include <llvm/IR/DiagnosticInfo.h>
+#include <llvm/IR/IRBuilder.h>
+#include <llvm/IR/InlineAsm.h>
+#include <llvm/IR/Instructions.h>
+#include <llvm/IR/LegacyPassManager.h>
+#include <llvm/IR/Module.h>
+#include <llvm/IR/Verifier.h>
#include <llvm/InitializePasses.h>
-#include <llvm/PassRegistry.h>
#include <llvm/MC/SubtargetFeature.h>
-#include <llvm/Support/raw_ostream.h>
+#include <llvm/PassRegistry.h>
#include <llvm/Support/FileSystem.h>
#include <llvm/Support/TargetParser.h>
+#include <llvm/Support/raw_ostream.h>
#include <llvm/Target/TargetMachine.h>
-#include <llvm/IR/LegacyPassManager.h>
-#include <llvm/IR/Module.h>
-#include <llvm/IR/Verifier.h>
-#include <llvm/IR/Instructions.h>
-#include <llvm/IR/IRBuilder.h>
-#include <llvm/IR/DIBuilder.h>
-#include <llvm/IR/DiagnosticInfo.h>
-#include <llvm/Analysis/TargetLibraryInfo.h>
-#include <llvm/Analysis/TargetTransformInfo.h>
#include <llvm/Transforms/IPO.h>
#include <llvm/Transforms/IPO/PassManagerBuilder.h>
#include <llvm/Transforms/Scalar.h>
@@ -139,6 +140,18 @@ LLVMValueRef ZigLLVMBuildCall(LLVMBuilderRef B, LLVMValueRef Fn, LLVMValueRef *A
return wrap(unwrap(B)->Insert(call_inst));
}
+LLVMValueRef ZigLLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString,
+ const char *Constraints, bool HasSideEffects, bool IsAlignStack, bool is_x86)
+{
+ if (is_x86) {
+ return wrap(InlineAsm::get(dyn_cast<FunctionType>(unwrap(Ty)), AsmString,
+ Constraints, HasSideEffects, IsAlignStack, InlineAsm::AD_Intel));
+ } else {
+ return wrap(InlineAsm::get(dyn_cast<FunctionType>(unwrap(Ty)), AsmString,
+ Constraints, HasSideEffects, IsAlignStack));
+ }
+}
+
void ZigLLVMFnSetSubprogram(LLVMValueRef fn, ZigLLVMDISubprogram *subprogram) {
assert( isa<Function>(unwrap(fn)) );
Function *unwrapped_function = reinterpret_cast<Function*>(unwrap(fn));