Files
ldc/gen/structs.h
David Nadlinger 0a96aea868 Sort includes according to style guidelines:
1. Main include corresponding to .cpp file, if any.
 2. DMD and LDC includes.
 3. LLVM includes.
 4. System includes.

Also updated a few include guards to match the default format.
2013-02-07 21:20:55 +01:00

67 lines
2.1 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//===-- 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.
//
//===----------------------------------------------------------------------===//
#ifndef LDC_GEN_STRUCTS_H
#define LDC_GEN_STRUCTS_H
#include "lexer.h"
#include <vector>
struct DValue;
struct StructDeclaration;
struct StructInitializer;
struct Type;
struct 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.
*/
void DtoResolveStruct(StructDeclaration* sd);
/// Build constant struct initializer.
llvm::Constant* DtoConstStructInitializer(StructInitializer* si);
/// Build values for a struct literal.
std::vector<llvm::Value*> DtoStructLiteralValues(const StructDeclaration* sd,
const std::vector<llvm::Value*>& inits, bool isConst = false);
/// Returns a boolean=true if the two structs are equal.
llvm::Value* DtoStructEquals(TOK op, DValue* lhs, DValue* rhs);
/// index a struct one level
llvm::Value* DtoIndexStruct(llvm::Value* src, StructDeclaration* sd, VarDeclaration* vd);
/// 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);
#endif