mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
50 lines
1.7 KiB
C++
50 lines
1.7 KiB
C++
//===--- BasicBlock.cpp - Basic blocks for high-level SIL code -------------==//
|
|
//
|
|
// 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 defines the high-level BasicBlocks used for Swift SIL code.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "swift/SIL/SILBasicBlock.h"
|
|
#include "swift/SIL/SILBBArgument.h"
|
|
#include "swift/SIL/SILFunction.h"
|
|
using namespace swift;
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// BBArgument Implementation
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
BBArgument::BBArgument(SILType Ty, BasicBlock *ParentBB)
|
|
: ValueBase(ValueKind::BBArgument, Ty), ParentBB(ParentBB) {
|
|
ParentBB->addArgument(this);
|
|
}
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// BasicBlock Implementation
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
BasicBlock::BasicBlock(SILFunction *Parent, const char *Name)
|
|
: Parent(Parent), PredList(0) {
|
|
Parent->getBlocks().push_back(this);
|
|
|
|
// FIXME: Drop the name on the floor for now.
|
|
}
|
|
BasicBlock::~BasicBlock() {}
|
|
|
|
|
|
/// eraseFromParent - This method unlinks 'this' from the containing SIL and
|
|
/// deletes it.
|
|
///
|
|
void BasicBlock::eraseFromParent() {
|
|
getParent()->getBlocks().erase(this);
|
|
}
|