Files
swift-mirror/lib/IRGen/GenStruct.h
Min-Yih Hsu b363bbdd78 [IRGen][Patch 2/2] Add IRGen support for SIL DIExpression
This patch is primarily doing two things:
 - Teach IRGen for some of the instructions to generate debug info based
   on SILDebugVariable rather than AST node, which is not always
   available when reading from SIL.
 - Generate corresponding `llvm.dbg.*` intrinsics and `!DIExpression`
   from the newly added SIL DIExpression.
2021-07-21 09:26:51 -07:00

78 lines
2.9 KiB
C++

//===--- GenStruct.h - Swift IR generation for structs ----------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file provides the private interface to the struct-emission code.
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_IRGEN_GENSTRUCT_H
#define SWIFT_IRGEN_GENSTRUCT_H
#include "llvm/ADT/Optional.h"
namespace llvm {
class Constant;
}
namespace swift {
class CanType;
class SILType;
class VarDecl;
namespace irgen {
class Address;
class Explosion;
class IRGenFunction;
class IRGenModule;
class MemberAccessStrategy;
class TypeInfo;
Address projectPhysicalStructMemberAddress(IRGenFunction &IGF,
Address base,
SILType baseType,
VarDecl *field);
void projectPhysicalStructMemberFromExplosion(IRGenFunction &IGF,
SILType baseType,
Explosion &base,
VarDecl *field,
Explosion &out);
/// Return the constant offset of the given stored property in a struct,
/// or return None if the field does not have fixed layout.
llvm::Constant *emitPhysicalStructMemberFixedOffset(IRGenModule &IGM,
SILType baseType,
VarDecl *field);
/// Return a strategy for accessing the given stored struct property.
///
/// This API is used by RemoteAST.
MemberAccessStrategy
getPhysicalStructMemberAccessStrategy(IRGenModule &IGM,
SILType baseType, VarDecl *field);
const TypeInfo *getPhysicalStructFieldTypeInfo(IRGenModule &IGM,
SILType baseType,
VarDecl *field);
/// Returns the index of the element in the llvm struct type which represents
/// \p field in \p baseType.
///
/// Returns None if \p field has an empty type and therefore has no
/// corresponding element in the llvm type.
llvm::Optional<unsigned> getPhysicalStructFieldIndex(IRGenModule &IGM,
SILType baseType,
VarDecl *field);
} // end namespace irgen
} // end namespace swift
#endif