mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-30 06:40:53 +00:00
Add LLVMAddTargetLibraryInfo to the C API.
llvm-svn: 135975
This commit is contained in:
parent
040076bda2
commit
7c7d45a67c
@ -29,6 +29,7 @@ extern "C" {
|
||||
enum LLVMByteOrdering { LLVMBigEndian, LLVMLittleEndian };
|
||||
|
||||
typedef struct LLVMOpaqueTargetData *LLVMTargetDataRef;
|
||||
typedef struct LLVMOpaqueTargetLibraryInfotData *LLVMTargetLibraryInfoRef;
|
||||
typedef struct LLVMStructLayout *LLVMStructLayoutRef;
|
||||
|
||||
/* Declare all of the target-initialization functions that are available. */
|
||||
@ -90,6 +91,11 @@ LLVMTargetDataRef LLVMCreateTargetData(const char *StringRep);
|
||||
See the method llvm::PassManagerBase::add. */
|
||||
void LLVMAddTargetData(LLVMTargetDataRef, LLVMPassManagerRef);
|
||||
|
||||
/** Adds target library information to a pass manager. This does not take
|
||||
ownership of the target library info.
|
||||
See the method llvm::PassManagerBase::add. */
|
||||
void LLVMAddTargetLibraryInfo(LLVMTargetLibraryInfoRef, LLVMPassManagerRef);
|
||||
|
||||
/** Converts target data to a target layout string. The string must be disposed
|
||||
with LLVMDisposeMessage.
|
||||
See the constructor llvm::TargetData::TargetData. */
|
||||
@ -157,6 +163,7 @@ void LLVMDisposeTargetData(LLVMTargetDataRef);
|
||||
|
||||
namespace llvm {
|
||||
class TargetData;
|
||||
class TargetLibraryInfo;
|
||||
|
||||
inline TargetData *unwrap(LLVMTargetDataRef P) {
|
||||
return reinterpret_cast<TargetData*>(P);
|
||||
@ -165,6 +172,15 @@ namespace llvm {
|
||||
inline LLVMTargetDataRef wrap(const TargetData *P) {
|
||||
return reinterpret_cast<LLVMTargetDataRef>(const_cast<TargetData*>(P));
|
||||
}
|
||||
|
||||
inline TargetLibraryInfo *unwrap(LLVMTargetLibraryInfoRef P) {
|
||||
return reinterpret_cast<TargetLibraryInfo*>(P);
|
||||
}
|
||||
|
||||
inline LLVMTargetLibraryInfoRef wrap(const TargetLibraryInfo *P) {
|
||||
TargetLibraryInfo *X = const_cast<TargetLibraryInfo*>(P);
|
||||
return reinterpret_cast<LLVMTargetLibraryInfoRef>(X);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* defined(__cplusplus) */
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "llvm/InitializePasses.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Target/TargetLibraryInfo.h"
|
||||
#include "llvm/LLVMContext.h"
|
||||
#include <cstring>
|
||||
|
||||
@ -39,6 +40,11 @@ void LLVMAddTargetData(LLVMTargetDataRef TD, LLVMPassManagerRef PM) {
|
||||
unwrap(PM)->add(new TargetData(*unwrap(TD)));
|
||||
}
|
||||
|
||||
void LLVMAddTargetLibraryInfo(LLVMTargetLibraryInfoRef TLI,
|
||||
LLVMPassManagerRef PM) {
|
||||
unwrap(PM)->add(new TargetLibraryInfo(*unwrap(TLI)));
|
||||
}
|
||||
|
||||
char *LLVMCopyStringRepOfTargetData(LLVMTargetDataRef TD) {
|
||||
std::string StringRep = unwrap(TD)->getStringRepresentation();
|
||||
return strdup(StringRep.c_str());
|
||||
|
Loading…
Reference in New Issue
Block a user