forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnimplementedTypeInfo.cpp
167 lines (136 loc) · 5.56 KB
/
UnimplementedTypeInfo.cpp
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
//===--- UnimplementedTypeInfo.cpp - Unimplemented Type Lowering ----------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file implements a stub TypeInfo for unimplemented types.
//
//===----------------------------------------------------------------------===//
#include "IRGenModule.h"
#include "IRGenFunction.h"
#include "UnimplementedTypeInfo.h"
#include "swift/SIL/SILType.h"
using namespace swift;
using namespace irgen;
UnimplementedTypeInfo::UnimplementedTypeInfo(IRGenModule &IGM,
llvm::Type *storageTy)
: TypeInfo(storageTy,
Alignment(1),
IsNotPOD,
IsNotBitwiseTakable,
IsFixedSize,
STIK_Unimplemented)
{}
static llvm::Constant *
getUndefSize(IRGenModule &IGM) {
return llvm::UndefValue::get(IGM.SizeTy);
}
static llvm::Constant *
getUndefOpaqueAddressValue(llvm::Type *storageTy) {
return llvm::UndefValue::get(storageTy->getPointerTo());
}
static Address
getUndefOpaqueAddress(llvm::Type *storageTy) {
return Address(getUndefOpaqueAddressValue(storageTy), Alignment(1));
}
std::pair<llvm::Value*,llvm::Value*>
UnimplementedTypeInfo::getSizeAndAlignmentMask(IRGenFunction &IGF, SILType T)
const
{
llvm::Value *undef = getUndefSize(IGF.IGM);
return {undef, undef};
}
std::tuple<llvm::Value*,llvm::Value*,llvm::Value*>
UnimplementedTypeInfo::getSizeAndAlignmentMaskAndStride(IRGenFunction &IGF,
SILType T) const {
llvm::Value *undef = getUndefSize(IGF.IGM);
return std::make_tuple(undef, undef, undef);
}
llvm::Value *UnimplementedTypeInfo::getSize(IRGenFunction &IGF, SILType T)
const {
return getUndefSize(IGF.IGM);
}
llvm::Value *UnimplementedTypeInfo::getAlignmentMask(IRGenFunction &IGF,
SILType T) const {
return getUndefSize(IGF.IGM);
}
llvm::Value *UnimplementedTypeInfo::getStride(IRGenFunction &IGF, SILType T)
const {
return getUndefSize(IGF.IGM);
}
llvm::Value *UnimplementedTypeInfo::getIsPOD(IRGenFunction &IGF, SILType T)
const {
return llvm::UndefValue::get(IGF.IGM.Int1Ty);
}
llvm::Constant *UnimplementedTypeInfo::getStaticSize(IRGenModule &IGM) const {
return nullptr;
}
llvm::Constant *UnimplementedTypeInfo::getStaticAlignmentMask(IRGenModule &IGM)
const {
return nullptr;
}
llvm::Constant *UnimplementedTypeInfo::getStaticStride(IRGenModule &IGM)
const {
return nullptr;
}
void UnimplementedTypeInfo::getSchema(ExplosionSchema &schema) const {
}
ContainedAddress UnimplementedTypeInfo::allocateStack(IRGenFunction &IGF,
SILType T,
const llvm::Twine &name)
const {
return ContainedAddress(Address(llvm::UndefValue::get(IGF.IGM.getFixedBufferTy()),
IGF.IGM.getPointerAlignment()),
getUndefOpaqueAddress(getStorageType()));
}
void UnimplementedTypeInfo::deallocateStack(IRGenFunction &IGF, Address addr,
SILType T) const {
}
void UnimplementedTypeInfo::assignWithCopy(IRGenFunction &IGF, Address dest,
Address src, SILType T) const {
}
void UnimplementedTypeInfo::assignWithTake(IRGenFunction &IGF, Address dest,
Address src, SILType T) const {
}
void UnimplementedTypeInfo::initializeWithTake(IRGenFunction &IGF, Address dest,
Address src, SILType T) const {
}
void UnimplementedTypeInfo::initializeWithCopy(IRGenFunction &IGF, Address dest,
Address src, SILType T) const {
}
void UnimplementedTypeInfo::initializeFromParams(IRGenFunction &IGF,
Explosion ¶ms,
Address src, SILType T) const {
}
void UnimplementedTypeInfo::destroy(IRGenFunction &IGF, Address address,
SILType T) const {
}
bool UnimplementedTypeInfo::mayHaveExtraInhabitants(IRGenModule &IGM) const {
return false;
}
llvm::Value *UnimplementedTypeInfo::getExtraInhabitantIndex(IRGenFunction &IGF,
Address src,
SILType T) const {
return llvm::UndefValue::get(IGF.IGM.Int32Ty);
}
void UnimplementedTypeInfo::storeExtraInhabitant(IRGenFunction &IGF,
llvm::Value *index,
Address dest,
SILType T) const {
}
void UnimplementedTypeInfo::initializeMetadata(IRGenFunction &IGF,
llvm::Value *metadata,
llvm::Value *vwtable,
SILType T) const {
}
llvm::Value *UnimplementedTypeInfo::isDynamicallyPackedInline(IRGenFunction &IGF,
SILType T) const {
return llvm::UndefValue::get(IGF.IGM.Int1Ty);
}