mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[LLVM-C] Redo unnamed_address attribute bindings
Summary: The old bindings should have used an enum instead of a boolean. This deprecates LLVMHasUnnamedAddr and LLVMSetUnnamedAddr , replacing them with LLVMGetUnnamedAddress and LLVMSetUnnamedAddress respectively that do. Though it is unlikely LLVM will gain more supported global value linker hints, the new API can scale to accommodate this. Reviewers: deadalnix, whitequark Reviewed By: whitequark Subscribers: llvm-commits, harlanhaskins Differential Revision: https://reviews.llvm.org/D43448 llvm-svn: 327479
This commit is contained in:
parent
36c2aadfc7
commit
da759a6ef9
@ -186,6 +186,12 @@ typedef enum {
|
|||||||
LLVMProtectedVisibility /**< The GV is protected */
|
LLVMProtectedVisibility /**< The GV is protected */
|
||||||
} LLVMVisibility;
|
} LLVMVisibility;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
LLVMNoUnnamedAddr, /**< Address of the GV is significant. */
|
||||||
|
LLVMLocalUnnamedAddr, /**< Address of the GV is locally insignificant. */
|
||||||
|
LLVMGlobalUnnamedAddr /**< Address of the GV is globally insignificant. */
|
||||||
|
} LLVMUnnamedAddr;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
LLVMDefaultStorageClass = 0,
|
LLVMDefaultStorageClass = 0,
|
||||||
LLVMDLLImportStorageClass = 1, /**< Function to be imported from DLL. */
|
LLVMDLLImportStorageClass = 1, /**< Function to be imported from DLL. */
|
||||||
@ -1844,7 +1850,12 @@ LLVMVisibility LLVMGetVisibility(LLVMValueRef Global);
|
|||||||
void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz);
|
void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz);
|
||||||
LLVMDLLStorageClass LLVMGetDLLStorageClass(LLVMValueRef Global);
|
LLVMDLLStorageClass LLVMGetDLLStorageClass(LLVMValueRef Global);
|
||||||
void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class);
|
void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class);
|
||||||
|
LLVMUnnamedAddr LLVMGetUnnamedAddress(LLVMValueRef Global);
|
||||||
|
void LLVMSetUnnamedAddress(LLVMValueRef Global, LLVMUnnamedAddr UnnamedAddr);
|
||||||
|
|
||||||
|
/** Deprecated: Use LLVMGetUnnamedAddress instead. */
|
||||||
LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global);
|
LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global);
|
||||||
|
/** Deprecated: Use LLVMSetUnnamedAddress instead. */
|
||||||
void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr);
|
void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1607,6 +1607,30 @@ void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class) {
|
|||||||
static_cast<GlobalValue::DLLStorageClassTypes>(Class));
|
static_cast<GlobalValue::DLLStorageClassTypes>(Class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLVMUnnamedAddr LLVMGetUnnamedAddress(LLVMValueRef Global) {
|
||||||
|
switch (unwrap<GlobalValue>(Global)->getUnnamedAddr()) {
|
||||||
|
case GlobalVariable::UnnamedAddr::None:
|
||||||
|
return LLVMNoUnnamedAddr;
|
||||||
|
case GlobalVariable::UnnamedAddr::Local:
|
||||||
|
return LLVMLocalUnnamedAddr;
|
||||||
|
case GlobalVariable::UnnamedAddr::Global:
|
||||||
|
return LLVMGlobalUnnamedAddr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLVMSetUnnamedAddress(LLVMValueRef Global, LLVMUnnamedAddr UnnamedAddr) {
|
||||||
|
GlobalValue *GV = unwrap<GlobalValue>(Global);
|
||||||
|
|
||||||
|
switch (UnnamedAddr) {
|
||||||
|
case LLVMNoUnnamedAddr:
|
||||||
|
return GV->setUnnamedAddr(GlobalVariable::UnnamedAddr::None);
|
||||||
|
case LLVMLocalUnnamedAddr:
|
||||||
|
return GV->setUnnamedAddr(GlobalVariable::UnnamedAddr::Local);
|
||||||
|
case LLVMGlobalUnnamedAddr:
|
||||||
|
return GV->setUnnamedAddr(GlobalVariable::UnnamedAddr::Global);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global) {
|
LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global) {
|
||||||
return unwrap<GlobalValue>(Global)->hasGlobalUnnamedAddr();
|
return unwrap<GlobalValue>(Global)->hasGlobalUnnamedAddr();
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ target triple = "x86_64-apple-macosx10.11.0"
|
|||||||
@tl = thread_local global { i64, %S* } { i64 1, %S* @cst }
|
@tl = thread_local global { i64, %S* } { i64 1, %S* @cst }
|
||||||
@arr = linkonce_odr global [5 x i8] [ i8 2, i8 3, i8 5, i8 7, i8 11 ]
|
@arr = linkonce_odr global [5 x i8] [ i8 2, i8 3, i8 5, i8 7, i8 11 ]
|
||||||
@str = private unnamed_addr constant [13 x i8] c"hello world\0A\00"
|
@str = private unnamed_addr constant [13 x i8] c"hello world\0A\00"
|
||||||
|
@locStr = private local_unnamed_addr constant [13 x i8] c"hello world\0A\00"
|
||||||
@hidden = hidden global i32 7
|
@hidden = hidden global i32 7
|
||||||
@protected = protected global i32 23
|
@protected = protected global i32 23
|
||||||
@section = global i32 27, section ".custom"
|
@section = global i32 27, section ".custom"
|
||||||
|
@ -864,7 +864,7 @@ static void clone_symbols(LLVMModuleRef Src, LLVMModuleRef M) {
|
|||||||
LLVMSetLinkage(G, LLVMGetLinkage(Cur));
|
LLVMSetLinkage(G, LLVMGetLinkage(Cur));
|
||||||
LLVMSetSection(G, LLVMGetSection(Cur));
|
LLVMSetSection(G, LLVMGetSection(Cur));
|
||||||
LLVMSetVisibility(G, LLVMGetVisibility(Cur));
|
LLVMSetVisibility(G, LLVMGetVisibility(Cur));
|
||||||
LLVMSetUnnamedAddr(G, LLVMHasUnnamedAddr(Cur));
|
LLVMSetUnnamedAddress(G, LLVMGetUnnamedAddress(Cur));
|
||||||
LLVMSetAlignment(G, LLVMGetAlignment(Cur));
|
LLVMSetAlignment(G, LLVMGetAlignment(Cur));
|
||||||
|
|
||||||
Next = LLVMGetNextGlobal(Cur);
|
Next = LLVMGetNextGlobal(Cur);
|
||||||
|
Loading…
Reference in New Issue
Block a user