mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
PR21145: Teach LLVM about C++14 sized deallocation functions.
C++14 adds new builtin signatures for 'operator delete'. This change allows new/delete pairs to be removed in C++14 onwards, as they were in C++11 and before. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219014 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
83902832de
commit
2451e5b581
@ -26,10 +26,18 @@ namespace llvm {
|
||||
ZdaPv,
|
||||
/// void operator delete[](void*, nothrow);
|
||||
ZdaPvRKSt9nothrow_t,
|
||||
/// void operator delete[](void*, unsigned int);
|
||||
ZdaPvj,
|
||||
/// void operator delete[](void*, unsigned long);
|
||||
ZdaPvm,
|
||||
/// void operator delete(void*);
|
||||
ZdlPv,
|
||||
/// void operator delete(void*, nothrow);
|
||||
ZdlPvRKSt9nothrow_t,
|
||||
/// void operator delete(void*, unsigned int);
|
||||
ZdlPvj,
|
||||
/// void operator delete(void*, unsigned long);
|
||||
ZdlPvm,
|
||||
/// void *new[](unsigned int);
|
||||
Znaj,
|
||||
/// void *new[](unsigned int, nothrow);
|
||||
|
@ -332,7 +332,11 @@ const CallInst *llvm::isFreeCall(const Value *I, const TargetLibraryInfo *TLI) {
|
||||
TLIFn == LibFunc::ZdlPv || // operator delete(void*)
|
||||
TLIFn == LibFunc::ZdaPv) // operator delete[](void*)
|
||||
ExpectedNumParams = 1;
|
||||
else if (TLIFn == LibFunc::ZdlPvRKSt9nothrow_t || // delete(void*, nothrow)
|
||||
else if (TLIFn == LibFunc::ZdlPvj || // delete(void*, uint)
|
||||
TLIFn == LibFunc::ZdlPvm || // delete(void*, ulong)
|
||||
TLIFn == LibFunc::ZdlPvRKSt9nothrow_t || // delete(void*, nothrow)
|
||||
TLIFn == LibFunc::ZdaPvj || // delete[](void*, uint)
|
||||
TLIFn == LibFunc::ZdaPvm || // delete[](void*, ulong)
|
||||
TLIFn == LibFunc::ZdaPvRKSt9nothrow_t) // delete[](void*, nothrow)
|
||||
ExpectedNumParams = 2;
|
||||
else
|
||||
|
@ -28,8 +28,12 @@ const char* TargetLibraryInfo::StandardNames[LibFunc::NumLibFuncs] =
|
||||
"_IO_putc",
|
||||
"_ZdaPv",
|
||||
"_ZdaPvRKSt9nothrow_t",
|
||||
"_ZdaPvj",
|
||||
"_ZdaPvm",
|
||||
"_ZdlPv",
|
||||
"_ZdlPvRKSt9nothrow_t",
|
||||
"_ZdlPvj",
|
||||
"_ZdlPvm",
|
||||
"_Znaj",
|
||||
"_ZnajRKSt9nothrow_t",
|
||||
"_Znam",
|
||||
|
@ -144,3 +144,26 @@ lpad.i: ; preds = %entry
|
||||
call void @_ZdlPvRKSt9nothrow_t(i8* %call.i, i8* %nt) builtin nounwind
|
||||
resume { i8*, i32 } %0
|
||||
}
|
||||
|
||||
declare i8* @_Znwm(i64) nobuiltin
|
||||
declare void @_ZdlPvm(i8*, i64) nobuiltin
|
||||
declare i8* @_Znwj(i32) nobuiltin
|
||||
declare void @_ZdlPvj(i8*, i32) nobuiltin
|
||||
declare i8* @_Znam(i64) nobuiltin
|
||||
declare void @_ZdaPvm(i8*, i64) nobuiltin
|
||||
declare i8* @_Znaj(i32) nobuiltin
|
||||
declare void @_ZdaPvj(i8*, i32) nobuiltin
|
||||
|
||||
; CHECK-LABEL: @test8(
|
||||
define void @test8() {
|
||||
; CHECK-NOT: call
|
||||
%nwm = call i8* @_Znwm(i64 32) builtin
|
||||
call void @_ZdlPvm(i8* %nwm, i64 32) builtin
|
||||
%nwj = call i8* @_Znwj(i32 32) builtin
|
||||
call void @_ZdlPvj(i8* %nwj, i32 32) builtin
|
||||
%nam = call i8* @_Znam(i64 32) builtin
|
||||
call void @_ZdaPvm(i8* %nam, i64 32) builtin
|
||||
%naj = call i8* @_Znaj(i32 32) builtin
|
||||
call void @_ZdaPvj(i8* %naj, i32 32) builtin
|
||||
ret void
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user