mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Redesign the BuiltinFunctionRefInst to contain an Identifier instead of
a FuncDecl. This makes it much more straight-forward for SIL passes to introduce a new one - without doing name lookup in the builtin module! Swift SVN r10694
This commit is contained in:
@@ -1755,10 +1755,10 @@ builtin_function_ref
|
||||
````````````````````
|
||||
::
|
||||
|
||||
sil-instruction ::= 'builtin_function_ref' sil-decl-ref ':' sil-type
|
||||
sil-instruction ::= 'builtin_function_ref' sil-identifier ':' sil-type
|
||||
|
||||
%1 = builtin_function_ref #Builtin.foo : $@thin T -> U
|
||||
// #Builtin.foo must name a function in the Builtin module
|
||||
%1 = builtin_function_ref "foo" : $@thin T -> U
|
||||
// "foo" must name a function in the Builtin module
|
||||
// $@thin T -> U must be a thin function type
|
||||
// %1 has type $@thin T -> U
|
||||
|
||||
|
||||
@@ -203,10 +203,9 @@ public:
|
||||
}
|
||||
|
||||
BuiltinFunctionRefInst *createBuiltinFunctionRef(SILLocation loc,
|
||||
FuncDecl *f,
|
||||
Identifier Id,
|
||||
SILType ty) {
|
||||
return insert(new (F.getModule())
|
||||
BuiltinFunctionRefInst(loc, f, ty));
|
||||
return insert(new (F.getModule()) BuiltinFunctionRefInst(loc, Id, ty));
|
||||
}
|
||||
FunctionRefInst *createFunctionRef(SILLocation loc, SILFunction *f) {
|
||||
return insert(new (F.getModule())
|
||||
|
||||
@@ -234,7 +234,7 @@ void
|
||||
SILCloner<ImplClass>::visitBuiltinFunctionRefInst(BuiltinFunctionRefInst *Inst){
|
||||
doPostProcess(Inst,
|
||||
Builder.createBuiltinFunctionRef(getOpLocation(Inst->getLoc()),
|
||||
Inst->getReferencedFunction(),
|
||||
Inst->getName(),
|
||||
getOpType(Inst->getType())));
|
||||
}
|
||||
|
||||
|
||||
@@ -512,15 +512,15 @@ public:
|
||||
/// BuiltinFunctionRefInst - Represents a reference to a primitive function from
|
||||
/// the Builtin module.
|
||||
class BuiltinFunctionRefInst : public SILInstruction {
|
||||
FuncDecl *Function;
|
||||
Identifier Name;
|
||||
public:
|
||||
BuiltinFunctionRefInst(SILLocation Loc, FuncDecl *Function, SILType Ty)
|
||||
BuiltinFunctionRefInst(SILLocation Loc, Identifier Name, SILType Ty)
|
||||
: SILInstruction(ValueKind::BuiltinFunctionRefInst, Loc, Ty),
|
||||
Function(Function)
|
||||
Name(Name)
|
||||
{}
|
||||
|
||||
/// Return the referenced function.
|
||||
FuncDecl *getReferencedFunction() const { return Function; }
|
||||
Identifier getName() const { return Name; }
|
||||
|
||||
SILType getType(unsigned i = 0) const { return ValueBase::getType(i); }
|
||||
|
||||
|
||||
@@ -1141,11 +1141,10 @@ Address IRGenModule::getAddrOfSILGlobalVariable(SILGlobalVariable *var) {
|
||||
}
|
||||
|
||||
void IRGenSILFunction::visitBuiltinFunctionRefInst(BuiltinFunctionRefInst *i) {
|
||||
auto *FD = cast<FuncDecl>(i->getReferencedFunction());
|
||||
setLoweredBuiltinValue(SILValue(i, 0), FD->getName());
|
||||
setLoweredBuiltinValue(SILValue(i, 0), i->getName());
|
||||
}
|
||||
|
||||
void IRGenSILFunction::visitFunctionRefInst(swift::FunctionRefInst *i) {
|
||||
void IRGenSILFunction::visitFunctionRefInst(FunctionRefInst *i) {
|
||||
// FIXME: pick the best available explosion level
|
||||
ExplosionKind explosionLevel = ExplosionKind::Minimal;
|
||||
llvm::Function *fnptr =
|
||||
|
||||
@@ -1210,13 +1210,18 @@ bool SILParser::parseSILInstruction(SILBasicBlock *BB) {
|
||||
break;
|
||||
case ValueKind::BuiltinFunctionRefInst: {
|
||||
SILType Ty;
|
||||
SILDeclRef FuncRef;
|
||||
if (parseSILDeclRef(FuncRef) ||
|
||||
P.parseToken(tok::colon, diag::expected_tok_in_sil_instr, ":") ||
|
||||
if (P.Tok.getKind() != tok::string_literal) {
|
||||
P.diagnose(P.Tok, diag::expected_tok_in_sil_instr,"builtin_function_ref");
|
||||
return true;
|
||||
}
|
||||
StringRef Str = P.Tok.getText();
|
||||
Identifier Id = P.Context.getIdentifier(Str.substr(1, Str.size()-2));
|
||||
P.consumeToken(tok::string_literal);
|
||||
|
||||
if (P.parseToken(tok::colon, diag::expected_tok_in_sil_instr, ":") ||
|
||||
parseSILType(Ty))
|
||||
return true;
|
||||
ResultVal = B.createBuiltinFunctionRef(InstLoc,
|
||||
cast<FuncDecl>(FuncRef.getDecl()), Ty);
|
||||
ResultVal = B.createBuiltinFunctionRef(InstLoc, Id, Ty);
|
||||
break;
|
||||
}
|
||||
case ValueKind::ProjectExistentialInst:
|
||||
|
||||
@@ -371,11 +371,11 @@ SILGlobalAddrInst::SILGlobalAddrInst(SILLocation Loc, SILGlobalVariable *Global)
|
||||
{}
|
||||
|
||||
const IntrinsicInfo &BuiltinFunctionRefInst::getIntrinsicInfo() const {
|
||||
return getModule().getIntrinsicInfo(Function->getName());
|
||||
return getModule().getIntrinsicInfo(getName());
|
||||
}
|
||||
|
||||
const BuiltinInfo &BuiltinFunctionRefInst::getBuiltinInfo() const {
|
||||
return getModule().getBuiltinInfo(Function->getName());
|
||||
return getModule().getBuiltinInfo(getName());
|
||||
}
|
||||
|
||||
static unsigned getWordsForBitWidth(unsigned bits) {
|
||||
|
||||
@@ -43,6 +43,35 @@ struct ID {
|
||||
int ResultNumber;
|
||||
};
|
||||
|
||||
static void printEscapedString(raw_ostream &OS, StringRef value) {
|
||||
OS << '"';
|
||||
for (auto C : value) {
|
||||
switch (C) {
|
||||
case '\\': OS << "\\\\"; break;
|
||||
case '\t': OS << "\\t"; break;
|
||||
case '\n': OS << "\\n"; break;
|
||||
case '\r': OS << "\\r"; break;
|
||||
case '"': OS << "\\\""; break;
|
||||
case '\'': OS << '\''; break; // no need to escape these
|
||||
case '\0': OS << "\\0"; break;
|
||||
default:
|
||||
auto c = (unsigned char)C;
|
||||
// Other ASCII control characters should get escaped.
|
||||
if (c < 0x20) {
|
||||
static const char hexdigit[] = {
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G'
|
||||
};
|
||||
OS << "\\x" << hexdigit[c >> 4] << hexdigit[c & 0xF];
|
||||
} else {
|
||||
OS << c;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
OS << '"';
|
||||
}
|
||||
|
||||
enum SILColorKind {
|
||||
SC_Type,
|
||||
};
|
||||
@@ -555,8 +584,9 @@ public:
|
||||
}
|
||||
|
||||
void visitBuiltinFunctionRefInst(BuiltinFunctionRefInst *BFI) {
|
||||
OS << "builtin_function_ref " << SILDeclRef(BFI->getReferencedFunction())
|
||||
<< " : " << BFI->getType();
|
||||
OS << "builtin_function_ref ";
|
||||
printEscapedString(OS, BFI->getName().str());
|
||||
OS << " : " << BFI->getType();
|
||||
}
|
||||
|
||||
void visitGlobalAddrInst(GlobalAddrInst *GAI) {
|
||||
@@ -583,34 +613,8 @@ public:
|
||||
OS << " // " << decimal;
|
||||
}
|
||||
void visitStringLiteralInst(StringLiteralInst *SLI) {
|
||||
OS << "string_literal \"";
|
||||
|
||||
auto value = SLI->getValue();
|
||||
for (size_t i = 0, e = value.size(); i != e; ++i) {
|
||||
switch (value[i]) {
|
||||
case '\\': OS << "\\\\"; break;
|
||||
case '\t': OS << "\\t"; break;
|
||||
case '\n': OS << "\\n"; break;
|
||||
case '\r': OS << "\\r"; break;
|
||||
case '"': OS << "\\\""; break;
|
||||
case '\'': OS << '\''; break; // no need to escape these
|
||||
case '\0': OS << "\\0"; break;
|
||||
default:
|
||||
auto c = (unsigned char) value[i];
|
||||
// Other ASCII control characters should get escaped.
|
||||
if (c < 0x20) {
|
||||
static const char hexdigit[] = {
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G'
|
||||
};
|
||||
OS << "\\x" << hexdigit[c >> 4] << hexdigit[c & 0xF];
|
||||
} else {
|
||||
OS << c;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
OS << "\"";
|
||||
OS << "string_literal ";
|
||||
printEscapedString(OS, SLI->getValue());
|
||||
}
|
||||
void visitLoadInst(LoadInst *LI) {
|
||||
OS << "load " << getIDAndType(LI->getOperand());
|
||||
|
||||
@@ -366,8 +366,6 @@ public:
|
||||
}
|
||||
|
||||
void checkBuiltinFunctionRefInst(BuiltinFunctionRefInst *BFI) {
|
||||
require(isa<BuiltinModule>(BFI->getReferencedFunction()->getDeclContext()),
|
||||
"builtin_function_ref must refer to a function in the Builtin module");
|
||||
auto fnType = requireObjectType(SILFunctionType, BFI,
|
||||
"result of builtin_function_ref");
|
||||
require(fnType->isThin(),
|
||||
|
||||
@@ -265,7 +265,7 @@ SILValue SILGenFunction::emitGlobalFunctionRef(SILLocation loc,
|
||||
"emitting ref to local constant without context?!");
|
||||
if (constant.hasDecl() &&
|
||||
isa<BuiltinModule>(constant.getDecl()->getDeclContext())) {
|
||||
return B.createBuiltinFunctionRef(loc, cast<FuncDecl>(constant.getDecl()),
|
||||
return B.createBuiltinFunctionRef(loc, constant.getDecl()->getName(),
|
||||
constantInfo.getSILType());
|
||||
}
|
||||
|
||||
@@ -2537,7 +2537,8 @@ void SILGenFunction::emitGlobalAccessor(VarDecl *global,
|
||||
// Emit a reference to Builtin.once.
|
||||
SILDeclRef builtinOnceConstant(builtinOnceDecl, SILDeclRef::Kind::Func);
|
||||
auto builtinOnceSILTy = SGM.Types.getConstantType(builtinOnceConstant);
|
||||
auto builtinOnce = B.createBuiltinFunctionRef(global, builtinOnceDecl,
|
||||
auto builtinOnce = B.createBuiltinFunctionRef(global,
|
||||
builtinOnceDecl->getName(),
|
||||
builtinOnceSILTy);
|
||||
|
||||
SILType rawPointerSILTy
|
||||
|
||||
@@ -634,8 +634,7 @@ bool SILDeserializer::readSILInstruction(SILFunction *Fn, SILBasicBlock *BB,
|
||||
case ValueKind::BuiltinFunctionRefInst: {
|
||||
// Format: FuncDecl and type. Use SILOneOperandLayout.
|
||||
auto Ty = MF->getType(TyID);
|
||||
ResultVal = Builder.createBuiltinFunctionRef(Loc,
|
||||
cast<FuncDecl>(MF->getDecl(ValID)),
|
||||
ResultVal = Builder.createBuiltinFunctionRef(Loc, MF->getIdentifier(ValID),
|
||||
getSILType(Ty, (SILValueCategory)TyCategory));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ void SILSerializer::writeSILInstruction(const SILInstruction &SI) {
|
||||
(unsigned)SI.getKind(), 0,
|
||||
S.addTypeRef(BFR->getType().getSwiftRValueType()),
|
||||
(unsigned)BFR->getType().getCategory(),
|
||||
S.addDeclRef(BFR->getReferencedFunction()), 0);
|
||||
S.addIdentifierRef(BFR->getName()), 0);
|
||||
break;
|
||||
}
|
||||
case ValueKind::GlobalAddrInst: {
|
||||
|
||||
@@ -671,8 +671,8 @@ bb0(%0 : $Builtin.Int1, %1 : $Builtin.Int1):
|
||||
%3 = alloc_box $Builtin.Int1
|
||||
store %0 to %2#1 : $*Builtin.Int1
|
||||
store %1 to %3#1 : $*Builtin.Int1
|
||||
// CHECK: builtin_function_ref #Builtin.cmp_eq_Int1 : $@thin (Builtin.Int1, Builtin.Int1) -> Builtin.Int1
|
||||
%7 = builtin_function_ref #Builtin.cmp_eq_Int1 : $@thin (Builtin.Int1, Builtin.Int1) -> Builtin.Int1
|
||||
// CHECK: builtin_function_ref "cmp_eq_Int1" : $@thin (Builtin.Int1, Builtin.Int1) -> Builtin.Int1
|
||||
%7 = builtin_function_ref "cmp_eq_Int1" : $@thin (Builtin.Int1, Builtin.Int1) -> Builtin.Int1
|
||||
%8 = load %2#1 : $*Builtin.Int1
|
||||
%9 = load %3#1 : $*Builtin.Int1
|
||||
%10 = apply %7(%8, %9) : $@thin (Builtin.Int1, Builtin.Int1) -> Builtin.Int1
|
||||
|
||||
@@ -5,9 +5,9 @@ import swift
|
||||
// Compute an expression using a chain of arithmetic with overflow instructions: 2 * (2 + 3) - 3
|
||||
sil @fold_arithmetic_with_overflow : $@thin () -> Builtin.Int64 {
|
||||
bb0:
|
||||
%1 = builtin_function_ref #Builtin.int_sadd_with_overflow_Int64 : $@thin (Builtin.Int64, Builtin.Int64) -> (Builtin.Int64, Builtin.Int1)
|
||||
%2 = builtin_function_ref #Builtin.int_smul_with_overflow_Int64 : $@thin (Builtin.Int64, Builtin.Int64) -> (Builtin.Int64, Builtin.Int1)
|
||||
%3 = builtin_function_ref #Builtin.int_ssub_with_overflow_Int64 : $@thin (Builtin.Int64, Builtin.Int64) -> (Builtin.Int64, Builtin.Int1)
|
||||
%1 = builtin_function_ref "int_sadd_with_overflow_Int64" : $@thin (Builtin.Int64, Builtin.Int64) -> (Builtin.Int64, Builtin.Int1)
|
||||
%2 = builtin_function_ref "int_smul_with_overflow_Int64" : $@thin (Builtin.Int64, Builtin.Int64) -> (Builtin.Int64, Builtin.Int1)
|
||||
%3 = builtin_function_ref "int_ssub_with_overflow_Int64" : $@thin (Builtin.Int64, Builtin.Int64) -> (Builtin.Int64, Builtin.Int1)
|
||||
%0 = integer_literal $Builtin.Int64, 2
|
||||
%110 = integer_literal $Builtin.Int64, 3
|
||||
%18 = apply %1(%0, %110) : $@thin (Builtin.Int64, Builtin.Int64) -> (Builtin.Int64, Builtin.Int1)
|
||||
@@ -19,9 +19,9 @@ bb0:
|
||||
return %23 : $Builtin.Int64
|
||||
|
||||
// CHECK-LABEL: sil @fold_arithmetic_with_overflow
|
||||
// CHECK-NOT: builtin_function_ref #Builtin.int_sadd_with_overflow_Int64
|
||||
// CHECK-NOT: builtin_function_ref #Builtin.int_smul_with_overflow_Int64
|
||||
// CHECK-NOT: builtin_function_ref #Builtin.int_ssub_with_overflow_Int64
|
||||
// CHECK-NOT: builtin_function_ref "int_sadd_with_overflow_Int64"
|
||||
// CHECK-NOT: builtin_function_ref "int_smul_with_overflow_Int64"
|
||||
// CHECK-NOT: builtin_function_ref "int_ssub_with_overflow_Int64"
|
||||
// CHECK-NOT: integer_literal $Builtin.Int64, 2
|
||||
// CHECK-NOT: integer_literal $Builtin.Int64, 3
|
||||
// CHECK-NOT: integer_literal $Builtin.Int64, 0
|
||||
@@ -34,19 +34,19 @@ bb0:
|
||||
sil @fold_trunc : $@thin () -> Builtin.Int64 {
|
||||
bb0:
|
||||
%0 = integer_literal $Builtin.Int128, 22
|
||||
%1 = builtin_function_ref #Builtin.trunc_Int128_Int64 : $@thin Builtin.Int128 -> Builtin.Int64
|
||||
%1 = builtin_function_ref "trunc_Int128_Int64" : $@thin Builtin.Int128 -> Builtin.Int64
|
||||
%2 = apply %1(%0) : $@thin Builtin.Int128 -> Builtin.Int64
|
||||
br bb4(%2 : $Builtin.Int64)
|
||||
|
||||
bb1:
|
||||
%3 = integer_literal $Builtin.Int8, 23
|
||||
%4 = builtin_function_ref #Builtin.sext_Int8_Int64 : $@thin Builtin.Int8 -> Builtin.Int64
|
||||
%4 = builtin_function_ref "sext_Int8_Int64" : $@thin Builtin.Int8 -> Builtin.Int64
|
||||
%5 = apply %4(%3) : $@thin Builtin.Int8 -> Builtin.Int64
|
||||
br bb4(%5 : $Builtin.Int64)
|
||||
|
||||
bb2:
|
||||
%6 = integer_literal $Builtin.Int8, 24
|
||||
%7 = builtin_function_ref #Builtin.zext_Int8_Int64 : $@thin Builtin.Int8 -> Builtin.Int64
|
||||
%7 = builtin_function_ref "zext_Int8_Int64" : $@thin Builtin.Int8 -> Builtin.Int64
|
||||
%8 = apply %7(%6) : $@thin Builtin.Int8 -> Builtin.Int64
|
||||
br bb4(%8 : $Builtin.Int64)
|
||||
|
||||
@@ -126,7 +126,7 @@ bb0:
|
||||
|
||||
sil @testChainingCCP : $@thin () -> Builtin.Int1 {
|
||||
bb0:
|
||||
%1 = builtin_function_ref #Builtin.trunc_Int64_Int1 : $@thin Builtin.Int64 -> Builtin.Int1
|
||||
%1 = builtin_function_ref "trunc_Int64_Int1" : $@thin Builtin.Int64 -> Builtin.Int1
|
||||
%2 = integer_literal $Builtin.Int64, 0
|
||||
%3 = struct $Int64 (%2 : $Builtin.Int64)
|
||||
%4 = struct_extract %3 : $Int64, #value
|
||||
@@ -142,7 +142,7 @@ bb0:
|
||||
|
||||
sil @testDivision : $@thin () -> Builtin.Int8 {
|
||||
bb0:
|
||||
%0 = builtin_function_ref #Builtin.sdiv_Int8 : $@thin (Builtin.Int8, Builtin.Int8) -> Builtin.Int8
|
||||
%0 = builtin_function_ref "sdiv_Int8" : $@thin (Builtin.Int8, Builtin.Int8) -> Builtin.Int8
|
||||
%1 = integer_literal $Builtin.Int8, 6
|
||||
%2 = integer_literal $Builtin.Int8, 3
|
||||
%3 = apply [transparent] %0(%1, %2) : $@thin (Builtin.Int8, Builtin.Int8) -> Builtin.Int8
|
||||
@@ -157,7 +157,7 @@ bb0:
|
||||
|
||||
sil @testRem : $@thin () -> Builtin.Int64 {
|
||||
bb0:
|
||||
%0 = builtin_function_ref #Builtin.urem_Int64 : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64
|
||||
%0 = builtin_function_ref "urem_Int64" : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64
|
||||
%1 = integer_literal $Builtin.Int64, 10
|
||||
%2 = integer_literal $Builtin.Int64, 2
|
||||
%3 = apply [transparent] %0(%1, %2) : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64
|
||||
@@ -174,15 +174,15 @@ sil @testFoldingIntBinaryPredicates : $@thin () -> () {
|
||||
bb0:
|
||||
%1 = integer_literal $Builtin.Int1, 1
|
||||
%2 = integer_literal $Builtin.Int1, 0
|
||||
%3 = builtin_function_ref #Builtin.cmp_eq_Int1 : $@thin (Builtin.Int1, Builtin.Int1) -> Builtin.Int1
|
||||
%3 = builtin_function_ref "cmp_eq_Int1" : $@thin (Builtin.Int1, Builtin.Int1) -> Builtin.Int1
|
||||
%4 = apply %3(%1, %2) : $@thin (Builtin.Int1, Builtin.Int1) -> Builtin.Int1
|
||||
%11 = integer_literal $Builtin.Int32, 21
|
||||
%12 = integer_literal $Builtin.Int32, 12
|
||||
%13 = builtin_function_ref #Builtin.cmp_ne_Int32 : $@thin (Builtin.Int32, Builtin.Int32) -> Builtin.Int1
|
||||
%13 = builtin_function_ref "cmp_ne_Int32" : $@thin (Builtin.Int32, Builtin.Int32) -> Builtin.Int1
|
||||
%14 = apply %13(%11, %12) : $@thin (Builtin.Int32, Builtin.Int32) -> Builtin.Int1
|
||||
%15 = builtin_function_ref #Builtin.cmp_sgt_Int32 : $@thin (Builtin.Int32, Builtin.Int32) -> Builtin.Int1
|
||||
%15 = builtin_function_ref "cmp_sgt_Int32" : $@thin (Builtin.Int32, Builtin.Int32) -> Builtin.Int1
|
||||
%16 = apply %15(%12, %11) : $@thin (Builtin.Int32, Builtin.Int32) -> Builtin.Int1
|
||||
%17 = builtin_function_ref #Builtin.cmp_ult_Int32 : $@thin (Builtin.Int32, Builtin.Int32) -> Builtin.Int1
|
||||
%17 = builtin_function_ref "cmp_ult_Int32" : $@thin (Builtin.Int32, Builtin.Int32) -> Builtin.Int1
|
||||
%18 = apply %17(%12, %11) : $@thin (Builtin.Int32, Builtin.Int32) -> Builtin.Int1
|
||||
%5 = tuple ()
|
||||
return %5 : $()
|
||||
@@ -201,9 +201,9 @@ sil @fold_binary_bitwise : $@thin () -> Builtin.Int64 {
|
||||
bb0:
|
||||
%0 = integer_literal $Builtin.Int64, 1 // users: %7, %6, %5
|
||||
%1 = integer_literal $Builtin.Int64, 0 // users: %7, %6, %5
|
||||
%2 = builtin_function_ref #Builtin.and_Int64 : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64 // user: %5
|
||||
%3 = builtin_function_ref #Builtin.or_Int64 : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64 // user: %6
|
||||
%4 = builtin_function_ref #Builtin.xor_Int64 : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64 // user: %7
|
||||
%2 = builtin_function_ref "and_Int64" : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64 // user: %5
|
||||
%3 = builtin_function_ref "or_Int64" : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64 // user: %6
|
||||
%4 = builtin_function_ref "xor_Int64" : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64 // user: %7
|
||||
%5 = apply %2(%0, %1) : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64
|
||||
%6 = apply %3(%0, %1) : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64
|
||||
%7 = apply %4(%0, %1) : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64 // user: %8
|
||||
@@ -225,9 +225,9 @@ bb0:
|
||||
%2 = integer_literal $Builtin.Int64, 3 // users: %11, %10, %9, %8
|
||||
%3 = integer_literal $Builtin.Int64, 1 // user: %12
|
||||
%4 = integer_literal $Builtin.Int64, 5 // user: %12
|
||||
%5 = builtin_function_ref #Builtin.ashr_Int64 : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64 // users: %10, %8
|
||||
%6 = builtin_function_ref #Builtin.lshr_Int64 : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64 // users: %11, %9
|
||||
%7 = builtin_function_ref #Builtin.shl_Int64 : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64 // user: %12
|
||||
%5 = builtin_function_ref "ashr_Int64" : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64 // users: %10, %8
|
||||
%6 = builtin_function_ref "lshr_Int64" : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64 // users: %11, %9
|
||||
%7 = builtin_function_ref "shl_Int64" : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64 // user: %12
|
||||
%8 = apply %5(%0, %2) : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64
|
||||
%9 = apply %6(%0, %2) : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64
|
||||
%10 = apply %5(%1, %2) : $@thin (Builtin.Int64, Builtin.Int64) -> Builtin.Int64
|
||||
@@ -250,10 +250,10 @@ sil @fold_float_operations : $@thin () -> Builtin.FPIEEE64 {
|
||||
bb0:
|
||||
%4 = float_literal $Builtin.FPIEEE64, 0x402E4CCCCCCCCCCD // 15.15
|
||||
%11 = float_literal $Builtin.FPIEEE64, 0x400A666666666666 // 3.2999999999999998 // user: %12
|
||||
%0 = builtin_function_ref #Builtin.fadd_FPIEEE64 : $@thin (Builtin.FPIEEE64, Builtin.FPIEEE64) -> Builtin.FPIEEE64
|
||||
%1 = builtin_function_ref #Builtin.fdiv_FPIEEE64 : $@thin (Builtin.FPIEEE64, Builtin.FPIEEE64) -> Builtin.FPIEEE64
|
||||
%2 = builtin_function_ref #Builtin.fsub_FPIEEE64 : $@thin (Builtin.FPIEEE64, Builtin.FPIEEE64) -> Builtin.FPIEEE64
|
||||
%3 = builtin_function_ref #Builtin.fmul_FPIEEE64 : $@thin (Builtin.FPIEEE64, Builtin.FPIEEE64) -> Builtin.FPIEEE64
|
||||
%0 = builtin_function_ref "fadd_FPIEEE64" : $@thin (Builtin.FPIEEE64, Builtin.FPIEEE64) -> Builtin.FPIEEE64
|
||||
%1 = builtin_function_ref "fdiv_FPIEEE64" : $@thin (Builtin.FPIEEE64, Builtin.FPIEEE64) -> Builtin.FPIEEE64
|
||||
%2 = builtin_function_ref "fsub_FPIEEE64" : $@thin (Builtin.FPIEEE64, Builtin.FPIEEE64) -> Builtin.FPIEEE64
|
||||
%3 = builtin_function_ref "fmul_FPIEEE64" : $@thin (Builtin.FPIEEE64, Builtin.FPIEEE64) -> Builtin.FPIEEE64
|
||||
%8 = apply %0(%4, %11) : $@thin (Builtin.FPIEEE64, Builtin.FPIEEE64) -> Builtin.FPIEEE64
|
||||
%9 = apply %1(%4, %11) : $@thin (Builtin.FPIEEE64, Builtin.FPIEEE64) -> Builtin.FPIEEE64
|
||||
%10 = apply %2(%4, %11) : $@thin (Builtin.FPIEEE64, Builtin.FPIEEE64) -> Builtin.FPIEEE64
|
||||
|
||||
@@ -4,7 +4,7 @@ import Builtin
|
||||
// fold_sadd_with_overflow_Overflow
|
||||
sil @fold_sadd_with_overflow_Overflow : $@thin (Builtin.RawPointer) -> Builtin.Int64 {
|
||||
bb0(%0 : $Builtin.RawPointer):
|
||||
%1 = builtin_function_ref #Builtin.sadd_with_overflow_Int64 : $@thin (Builtin.Int64, Builtin.Int64, Builtin.Int1) -> (Builtin.Int64, Builtin.Int1)
|
||||
%1 = builtin_function_ref "sadd_with_overflow_Int64" : $@thin (Builtin.Int64, Builtin.Int64, Builtin.Int1) -> (Builtin.Int64, Builtin.Int1)
|
||||
%2 = integer_literal $Builtin.Int64, 9223372036854775807
|
||||
%3 = integer_literal $Builtin.Int64, 9223372036854775807
|
||||
%21 = integer_literal $Builtin.Int1, 1
|
||||
|
||||
@@ -538,7 +538,7 @@ bb0(%0 : $Bool, %1 : $Bool):
|
||||
|
||||
sil [transparent] @convertFromBultinIntegerLiteral : $@thin (Builtin.Int2048, Int64.metatype) -> Int64 {
|
||||
bb0(%0 : $Builtin.Int2048, %1 : $Int64.metatype):
|
||||
%2 = builtin_function_ref #Builtin.s_to_s_checked_trunc_Int2048_Int64 : $@thin Builtin.Int2048 -> (Builtin.Int64, Builtin.Int1)
|
||||
%2 = builtin_function_ref "s_to_s_checked_trunc_Int2048_Int64" : $@thin Builtin.Int2048 -> (Builtin.Int64, Builtin.Int1)
|
||||
%3 = apply %2(%0) : $@thin Builtin.Int2048 -> (Builtin.Int64, Builtin.Int1)
|
||||
%4 = tuple_extract %3 : $(Builtin.Int64, Builtin.Int1), 0
|
||||
%5 = struct $Int64 (%4 : $Builtin.Int64)
|
||||
|
||||
@@ -5,7 +5,7 @@ import Builtin
|
||||
sil @sil_test_static_report : $@thin (Builtin.RawPointer) -> Builtin.RawPointer {
|
||||
bb0(%0 : $Builtin.RawPointer):
|
||||
%1 = integer_literal $Builtin.Int1, 1
|
||||
%2 = builtin_function_ref #Builtin.staticReport : $@thin (Builtin.Int1, Builtin.Int1, Builtin.RawPointer) -> ()
|
||||
%2 = builtin_function_ref "staticReport" : $@thin (Builtin.Int1, Builtin.Int1, Builtin.RawPointer) -> ()
|
||||
%3 = apply %2(%1, %1, %0) : $@thin (Builtin.Int1, Builtin.Int1, Builtin.RawPointer) -> () // expected-error {{static report error}}
|
||||
return %0 : $Builtin.RawPointer
|
||||
}
|
||||
|
||||
@@ -664,8 +664,8 @@ bb0(%0 : $Builtin.Int1, %1 : $Builtin.Int1):
|
||||
%3 = alloc_box $Builtin.Int1
|
||||
store %0 to %2#1 : $*Builtin.Int1
|
||||
store %1 to %3#1 : $*Builtin.Int1
|
||||
// CHECK: builtin_function_ref #Builtin.cmp_eq_Int1 : $@thin (Builtin.Int1, Builtin.Int1) -> Builtin.Int1
|
||||
%7 = builtin_function_ref #Builtin.cmp_eq_Int1 : $@thin (Builtin.Int1, Builtin.Int1) -> Builtin.Int1
|
||||
// CHECK: builtin_function_ref "cmp_eq_Int1" : $@thin (Builtin.Int1, Builtin.Int1) -> Builtin.Int1
|
||||
%7 = builtin_function_ref "cmp_eq_Int1" : $@thin (Builtin.Int1, Builtin.Int1) -> Builtin.Int1
|
||||
%8 = load %2#1 : $*Builtin.Int1
|
||||
%9 = load %3#1 : $*Builtin.Int1
|
||||
%10 = apply %7(%8, %9) : $@thin (Builtin.Int1, Builtin.Int1) -> Builtin.Int1
|
||||
|
||||
Reference in New Issue
Block a user