summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Core.cpp
diff options
context:
space:
mode:
authorRobert Widmann <devteam.codafi@gmail.com>2018-04-06 02:31:29 +0000
committerRobert Widmann <devteam.codafi@gmail.com>2018-04-06 02:31:29 +0000
commitf108d57f9b12ec176a87faa46464057d51063d65 (patch)
tree6950b6fa68cf8841c2613d6f4012637c0e6fdd4b /llvm/lib/IR/Core.cpp
parent9298e077f7a3256aa23f5a962ac50f6b1cc60ed4 (diff)
downloadbcm5719-llvm-f108d57f9b12ec176a87faa46464057d51063d65.tar.gz
bcm5719-llvm-f108d57f9b12ec176a87faa46464057d51063d65.zip
[LLVM-C] Audit Inline Assembly APIs for Consistency
Summary: - Add a missing getter for module-level inline assembly - Add a missing append function for module-level inline assembly - Deprecate LLVMSetModuleInlineAsm and replace it with LLVMSetModuleInlineAsm2 which takes an explicit length parameter - Deprecate LLVMConstInlineAsm and replace it with LLVMGetInlineAsm, a function that allows passing a dialect and is not mis-classified as a constant operation Reviewers: whitequark, deadalnix Reviewed By: whitequark Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D45346 llvm-svn: 329369
Diffstat (limited to 'llvm/lib/IR/Core.cpp')
-rw-r--r--llvm/lib/IR/Core.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index 29a82ec6c54..439c34bec32 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -304,10 +304,42 @@ char *LLVMPrintModuleToString(LLVMModuleRef M) {
}
/*--.. Operations on inline assembler ......................................--*/
+void LLVMSetModuleInlineAsm2(LLVMModuleRef M, const char *Asm, size_t Len) {
+ unwrap(M)->setModuleInlineAsm(StringRef(Asm, Len));
+}
+
void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm) {
unwrap(M)->setModuleInlineAsm(StringRef(Asm));
}
+void LLVMAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm, size_t Len) {
+ unwrap(M)->appendModuleInlineAsm(StringRef(Asm, Len));
+}
+
+const char *LLVMGetModuleInlineAsm(LLVMModuleRef M, size_t *Len) {
+ auto &Str = unwrap(M)->getModuleInlineAsm();
+ *Len = Str.length();
+ return Str.c_str();
+}
+
+LLVMValueRef LLVMGetInlineAsm(LLVMTypeRef Ty,
+ char *AsmString, size_t AsmStringSize,
+ char *Constraints, size_t ConstraintsSize,
+ LLVMBool HasSideEffects, LLVMBool IsAlignStack,
+ LLVMInlineAsmDialect Dialect) {
+ InlineAsm::AsmDialect AD;
+ switch (Dialect) {
+ case LLVMInlineAsmDialectATT:
+ AD = InlineAsm::AD_ATT;
+ case LLVMInlineAsmDialectIntel:
+ AD = InlineAsm::AD_Intel;
+ }
+ return wrap(InlineAsm::get(unwrap<FunctionType>(Ty),
+ StringRef(AsmString, AsmStringSize),
+ StringRef(Constraints, ConstraintsSize),
+ HasSideEffects, IsAlignStack, AD));
+}
+
/*--.. Operations on module contexts ......................................--*/
LLVMContextRef LLVMGetModuleContext(LLVMModuleRef M) {
OpenPOWER on IntegriCloud