コード例 #1
0
ファイル: GenOpaque.cpp プロジェクト: asdfeng/swift
/// Emit a call to do a 'destroy' operation.
void irgen::emitDestroyCall(IRGenFunction &IGF,
                            SILType T,
                            llvm::Value *object) {
  auto metadata = IGF.emitTypeMetadataRefForLayout(T);
  llvm::Value *fn = IGF.emitValueWitnessForLayout(T,
                                   ValueWitness::Destroy);
  llvm::CallInst *call = IGF.Builder.CreateCall(fn, {object, metadata});
  call->setCallingConv(IGF.IGM.RuntimeCC);
  setHelperAttributes(call);
}
コード例 #2
0
ファイル: GenOpaque.cpp プロジェクト: 007Indian/swift
/// Emit a call to the 'destructiveProjectEnumData' operation.
/// The type must be dynamically known to have enum witnesses.
void irgen::emitDestructiveProjectEnumDataCall(IRGenFunction &IGF,
                                               SILType T,
                                               Address srcObject) {
  auto metadata = IGF.emitTypeMetadataRefForLayout(T);
  llvm::Value *fn = IGF.emitValueWitnessForLayout(T,
                                      ValueWitness::DestructiveProjectEnumData);
  llvm::CallInst *call =
    IGF.Builder.CreateCall(fn, {srcObject.getAddress(), metadata});
  call->setCallingConv(IGF.IGM.DefaultCC);
  setHelperAttributes(call);
}
コード例 #3
0
ファイル: GenOpaque.cpp プロジェクト: 007Indian/swift
void irgen::emitDeallocateBufferCall(IRGenFunction &IGF,
                                     SILType T,
                                     Address buffer) {
  auto metadata = IGF.emitTypeMetadataRefForLayout(T);
  llvm::Value *fn = IGF.emitValueWitnessForLayout(T,
                                   ValueWitness::DeallocateBuffer);
  llvm::CallInst *call =
    IGF.Builder.CreateCall(fn, {buffer.getAddress(), metadata});
  call->setCallingConv(IGF.IGM.DefaultCC);
  setHelperAttributes(call);
}
コード例 #4
0
ファイル: GenOpaque.cpp プロジェクト: 007Indian/swift
/// Emit a call to do a 'destroyArray' operation.
void irgen::emitDestroyArrayCall(IRGenFunction &IGF,
                                 SILType T,
                                 Address object,
                                 llvm::Value *count) {
  auto metadata = IGF.emitTypeMetadataRefForLayout(T);
  llvm::Value *fn = IGF.emitValueWitnessForLayout(T,
                                   ValueWitness::DestroyArray);
  llvm::CallInst *call =
    IGF.Builder.CreateCall(fn, {object.getAddress(), count, metadata});
  call->setCallingConv(IGF.IGM.DefaultCC);
  setHelperAttributes(call);
}
コード例 #5
0
ファイル: GenOpaque.cpp プロジェクト: asdfeng/swift
/// Emit a call to do an 'assignWithTake' operation.
void irgen::emitAssignWithTakeCall(IRGenFunction &IGF,
                                   SILType T,
                                   llvm::Value *destObject,
                                   llvm::Value *srcObject) {
  auto metadata = IGF.emitTypeMetadataRefForLayout(T);
  llvm::Value *copyFn = IGF.emitValueWitnessForLayout(T,
                                         ValueWitness::AssignWithTake);
  llvm::CallInst *call =
    IGF.Builder.CreateCall(copyFn, {destObject, srcObject, metadata});
  call->setCallingConv(IGF.IGM.RuntimeCC);
  call->setDoesNotThrow();
}
コード例 #6
0
ファイル: GenOpaque.cpp プロジェクト: 007Indian/swift
void irgen::emitAssignWithCopyCall(IRGenFunction &IGF,
                                   SILType T,
                                   Address destObject,
                                   Address srcObject) {
  auto metadata = IGF.emitTypeMetadataRefForLayout(T);
  llvm::Value *copyFn = IGF.emitValueWitnessForLayout(T,
                                         ValueWitness::AssignWithCopy);
  llvm::CallInst *call =
    IGF.Builder.CreateCall(copyFn,
      {destObject.getAddress(), srcObject.getAddress(), metadata});
  call->setCallingConv(IGF.IGM.DefaultCC);
  call->setDoesNotThrow();
}
コード例 #7
0
ファイル: GenOpaque.cpp プロジェクト: 007Indian/swift
/// Emit a call to the 'destructiveInjectEnumTag' operation.
/// The type must be dynamically known to have enum witnesses.
void irgen::emitDestructiveInjectEnumTagCall(IRGenFunction &IGF,
                                             SILType T,
                                             unsigned tag,
                                             Address srcObject) {
  auto metadata = IGF.emitTypeMetadataRefForLayout(T);
  llvm::Value *fn = IGF.emitValueWitnessForLayout(T,
                                      ValueWitness::DestructiveInjectEnumTag);
  llvm::Value *tagValue =
    llvm::ConstantInt::get(IGF.IGM.Int32Ty, tag);
  llvm::CallInst *call =
    IGF.Builder.CreateCall(fn, {srcObject.getAddress(), tagValue, metadata});
  call->setCallingConv(IGF.IGM.DefaultCC);
  setHelperAttributes(call);
}
コード例 #8
0
ファイル: GenOpaque.cpp プロジェクト: 007Indian/swift
/// Emit a call to do an 'initializeArrayWithTakeBackToFront' operation.
void irgen::emitInitializeArrayWithTakeBackToFrontCall(IRGenFunction &IGF,
                                            SILType T,
                                            Address destObject,
                                            Address srcObject,
                                            llvm::Value *count) {
  auto metadata = IGF.emitTypeMetadataRefForLayout(T);
  llvm::Value *copyFn = IGF.emitValueWitnessForLayout(T,
                             ValueWitness::InitializeArrayWithTakeBackToFront);
  llvm::CallInst *call =
    IGF.Builder.CreateCall(copyFn,
      {destObject.getAddress(), srcObject.getAddress(), count, metadata});
  call->setCallingConv(IGF.IGM.DefaultCC);
  call->setDoesNotThrow();
}