diff options
author | Amaury Sechet <deadalnix@gmail.com> | 2016-02-16 05:11:24 +0000 |
---|---|---|
committer | Amaury Sechet <deadalnix@gmail.com> | 2016-02-16 05:11:24 +0000 |
commit | 5590967610afa5fcc79386e08acc4d0fad5b6b9f (patch) | |
tree | 79b584bf548d4bc6d19e0656121a58dcb5870757 /llvm/tools/llvm-c-test | |
parent | 6615654f565c3a19f1f8a6e74ccdc723fd0c71d3 (diff) | |
download | bcm5719-llvm-5590967610afa5fcc79386e08acc4d0fad5b6b9f.tar.gz bcm5719-llvm-5590967610afa5fcc79386e08acc4d0fad5b6b9f.zip |
Restore the capability to manipulate datalayout from the C API
Summary:
This consist in variosu addition to the C API:
LLVMTargetDataRef LLVMGetModuleDataLayout(LLVMModuleRef M);
void LLVMSetModuleDataLayout(LLVMModuleRef M, LLVMTargetDataRef DL);
LLVMTargetDataRef LLVMCreateTargetMachineData(LLVMTargetMachineRef T);
Reviewers: joker.eph, Wallbraker, echristo
Subscribers: axw
Differential Revision: http://reviews.llvm.org/D17255
llvm-svn: 260936
Diffstat (limited to 'llvm/tools/llvm-c-test')
-rw-r--r-- | llvm/tools/llvm-c-test/echo.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/tools/llvm-c-test/echo.cpp b/llvm/tools/llvm-c-test/echo.cpp index b19ae951d4e..774e339879d 100644 --- a/llvm/tools/llvm-c-test/echo.cpp +++ b/llvm/tools/llvm-c-test/echo.cpp @@ -16,6 +16,7 @@ //===----------------------------------------------------------------------===// #include "llvm-c-test.h" +#include "llvm-c/Target.h" #include "llvm/ADT/DenseMap.h" #include "llvm/Support/ErrorHandling.h" @@ -629,6 +630,11 @@ int llvm_echo(void) { LLVMContextRef Ctx = LLVMContextCreate(); LLVMModuleRef M = LLVMModuleCreateWithNameInContext("<stdin>", Ctx); + LLVMSetTarget(M, LLVMGetTarget(Src)); + LLVMSetModuleDataLayout(M, LLVMGetModuleDataLayout(Src)); + if (strcmp(LLVMGetDataLayoutStr(M), LLVMGetDataLayoutStr(Src))) + report_fatal_error("Inconsistent DataLayout string representation"); + clone_functions(Src, M); char *Str = LLVMPrintModuleToString(M); fputs(Str, stdout); |