File: structs.h

package info (click to toggle)
ldc 1%3A1.30.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 59,248 kB
  • sloc: cpp: 61,598; ansic: 14,545; sh: 1,014; makefile: 972; asm: 510; objc: 135; exp: 48; python: 12
file content (56 lines) | stat: -rw-r--r-- 1,824 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//===-- gen/structs.h - D struct codegen ------------------------*- C++ -*-===//
//
//                         LDC – the LLVM D compiler
//
// This file is distributed under the BSD-style LDC license. See the LICENSE
// file for details.
//
//===----------------------------------------------------------------------===//
//
// Functions for D struct codegen.
//
//===----------------------------------------------------------------------===//

#pragma once

#include "dmd/tokens.h"
#include <vector>

class DValue;
class StructDeclaration;
class StructInitializer;
class Type;
class VarDeclaration;
namespace llvm {
class Constant;
class Type;
class Value;
}

/**
 * Sets up codegen metadata and emits global data (.init, etc.), if needed.
 *
 * Has no effect on already resolved struct declarations.
 *
 * callerLoc is the location of the expression which requires the struct type
 * (only for better diagnosis)
 */
void DtoResolveStruct(StructDeclaration *sd);
void DtoResolveStruct(StructDeclaration *sd, const Loc &callerLoc);

/// Returns a boolean=true if the two structs are equal.
llvm::Value *DtoStructEquals(EXP op, DValue *lhs, DValue *rhs);

/// Return the type returned by DtoUnpaddedStruct called on a value of the
/// specified type.
/// Union types will get expanded into a struct, with a type for each member.
llvm::Type *DtoUnpaddedStructType(Type *dty);

/// Return the struct value represented by v without the padding fields.
/// Unions will be expanded, with a value for each member.
/// Note: v must be a pointer to a struct, but the return value will be a
///       first-class struct value.
llvm::Value *DtoUnpaddedStruct(Type *dty, llvm::Value *v);

/// Undo the transformation performed by DtoUnpaddedStruct, writing to lval.
void DtoPaddedStruct(Type *dty, llvm::Value *v, llvm::Value *lval);