2014-03-06 00:22:06 +00:00
|
|
|
//===- DIBuilder.h - Debug Information Builder ------------------*- C++ -*-===//
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2013-04-19 20:37:09 +00:00
|
|
|
// This file defines a DIBuilder that is useful for creating debugging
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
// information entries in LLVM IR form.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-03-06 00:22:06 +00:00
|
|
|
#ifndef LLVM_IR_DIBUILDER_H
|
|
|
|
#define LLVM_IR_DIBUILDER_H
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
|
2011-04-24 10:11:03 +00:00
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
2014-03-06 00:46:21 +00:00
|
|
|
#include "llvm/IR/DebugInfo.h"
|
IR: Split Metadata from Value
Split `Metadata` away from the `Value` class hierarchy, as part of
PR21532. Assembly and bitcode changes are in the wings, but this is the
bulk of the change for the IR C++ API.
I have a follow-up patch prepared for `clang`. If this breaks other
sub-projects, I apologize in advance :(. Help me compile it on Darwin
I'll try to fix it. FWIW, the errors should be easy to fix, so it may
be simpler to just fix it yourself.
This breaks the build for all metadata-related code that's out-of-tree.
Rest assured the transition is mechanical and the compiler should catch
almost all of the problems.
Here's a quick guide for updating your code:
- `Metadata` is the root of a class hierarchy with three main classes:
`MDNode`, `MDString`, and `ValueAsMetadata`. It is distinct from
the `Value` class hierarchy. It is typeless -- i.e., instances do
*not* have a `Type`.
- `MDNode`'s operands are all `Metadata *` (instead of `Value *`).
- `TrackingVH<MDNode>` and `WeakVH` referring to metadata can be
replaced with `TrackingMDNodeRef` and `TrackingMDRef`, respectively.
If you're referring solely to resolved `MDNode`s -- post graph
construction -- just use `MDNode*`.
- `MDNode` (and the rest of `Metadata`) have only limited support for
`replaceAllUsesWith()`.
As long as an `MDNode` is pointing at a forward declaration -- the
result of `MDNode::getTemporary()` -- it maintains a side map of its
uses and can RAUW itself. Once the forward declarations are fully
resolved RAUW support is dropped on the ground. This means that
uniquing collisions on changing operands cause nodes to become
"distinct". (This already happened fairly commonly, whenever an
operand went to null.)
If you're constructing complex (non self-reference) `MDNode` cycles,
you need to call `MDNode::resolveCycles()` on each node (or on a
top-level node that somehow references all of the nodes). Also,
don't do that. Metadata cycles (and the RAUW machinery needed to
construct them) are expensive.
- An `MDNode` can only refer to a `Constant` through a bridge called
`ConstantAsMetadata` (one of the subclasses of `ValueAsMetadata`).
As a side effect, accessing an operand of an `MDNode` that is known
to be, e.g., `ConstantInt`, takes three steps: first, cast from
`Metadata` to `ConstantAsMetadata`; second, extract the `Constant`;
third, cast down to `ConstantInt`.
The eventual goal is to introduce `MDInt`/`MDFloat`/etc. and have
metadata schema owners transition away from using `Constant`s when
the type isn't important (and they don't care about referring to
`GlobalValue`s).
In the meantime, I've added transitional API to the `mdconst`
namespace that matches semantics with the old code, in order to
avoid adding the error-prone three-step equivalent to every call
site. If your old code was:
MDNode *N = foo();
bar(isa <ConstantInt>(N->getOperand(0)));
baz(cast <ConstantInt>(N->getOperand(1)));
bak(cast_or_null <ConstantInt>(N->getOperand(2)));
bat(dyn_cast <ConstantInt>(N->getOperand(3)));
bay(dyn_cast_or_null<ConstantInt>(N->getOperand(4)));
you can trivially match its semantics with:
MDNode *N = foo();
bar(mdconst::hasa <ConstantInt>(N->getOperand(0)));
baz(mdconst::extract <ConstantInt>(N->getOperand(1)));
bak(mdconst::extract_or_null <ConstantInt>(N->getOperand(2)));
bat(mdconst::dyn_extract <ConstantInt>(N->getOperand(3)));
bay(mdconst::dyn_extract_or_null<ConstantInt>(N->getOperand(4)));
and when you transition your metadata schema to `MDInt`:
MDNode *N = foo();
bar(isa <MDInt>(N->getOperand(0)));
baz(cast <MDInt>(N->getOperand(1)));
bak(cast_or_null <MDInt>(N->getOperand(2)));
bat(dyn_cast <MDInt>(N->getOperand(3)));
bay(dyn_cast_or_null<MDInt>(N->getOperand(4)));
- A `CallInst` -- specifically, intrinsic instructions -- can refer to
metadata through a bridge called `MetadataAsValue`. This is a
subclass of `Value` where `getType()->isMetadataTy()`.
`MetadataAsValue` is the *only* class that can legally refer to a
`LocalAsMetadata`, which is a bridged form of non-`Constant` values
like `Argument` and `Instruction`. It can also refer to any other
`Metadata` subclass.
(I'll break all your testcases in a follow-up commit, when I propagate
this change to assembly.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223802 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-09 18:38:53 +00:00
|
|
|
#include "llvm/IR/TrackingMDRef.h"
|
2014-03-04 11:17:44 +00:00
|
|
|
#include "llvm/IR/ValueHandle.h"
|
2012-12-03 17:02:12 +00:00
|
|
|
#include "llvm/Support/DataTypes.h"
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
2010-12-07 23:25:47 +00:00
|
|
|
class BasicBlock;
|
|
|
|
class Instruction;
|
|
|
|
class Function;
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
class Module;
|
2010-12-07 23:25:47 +00:00
|
|
|
class Value;
|
2014-11-15 00:23:49 +00:00
|
|
|
class Constant;
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
class LLVMContext;
|
|
|
|
class StringRef;
|
|
|
|
|
|
|
|
class DIBuilder {
|
|
|
|
Module &M;
|
2014-02-27 00:15:44 +00:00
|
|
|
LLVMContext &VMContext;
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
|
2015-04-10 18:01:58 +00:00
|
|
|
TempMDTuple TempEnumTypes;
|
|
|
|
TempMDTuple TempRetainTypes;
|
|
|
|
TempMDTuple TempSubprograms;
|
|
|
|
TempMDTuple TempGVs;
|
|
|
|
TempMDTuple TempImportedModules;
|
2011-08-16 22:09:43 +00:00
|
|
|
|
2010-12-07 23:25:47 +00:00
|
|
|
Function *DeclareFn; // llvm.dbg.declare
|
|
|
|
Function *ValueFn; // llvm.dbg.value
|
|
|
|
|
IR: Split Metadata from Value
Split `Metadata` away from the `Value` class hierarchy, as part of
PR21532. Assembly and bitcode changes are in the wings, but this is the
bulk of the change for the IR C++ API.
I have a follow-up patch prepared for `clang`. If this breaks other
sub-projects, I apologize in advance :(. Help me compile it on Darwin
I'll try to fix it. FWIW, the errors should be easy to fix, so it may
be simpler to just fix it yourself.
This breaks the build for all metadata-related code that's out-of-tree.
Rest assured the transition is mechanical and the compiler should catch
almost all of the problems.
Here's a quick guide for updating your code:
- `Metadata` is the root of a class hierarchy with three main classes:
`MDNode`, `MDString`, and `ValueAsMetadata`. It is distinct from
the `Value` class hierarchy. It is typeless -- i.e., instances do
*not* have a `Type`.
- `MDNode`'s operands are all `Metadata *` (instead of `Value *`).
- `TrackingVH<MDNode>` and `WeakVH` referring to metadata can be
replaced with `TrackingMDNodeRef` and `TrackingMDRef`, respectively.
If you're referring solely to resolved `MDNode`s -- post graph
construction -- just use `MDNode*`.
- `MDNode` (and the rest of `Metadata`) have only limited support for
`replaceAllUsesWith()`.
As long as an `MDNode` is pointing at a forward declaration -- the
result of `MDNode::getTemporary()` -- it maintains a side map of its
uses and can RAUW itself. Once the forward declarations are fully
resolved RAUW support is dropped on the ground. This means that
uniquing collisions on changing operands cause nodes to become
"distinct". (This already happened fairly commonly, whenever an
operand went to null.)
If you're constructing complex (non self-reference) `MDNode` cycles,
you need to call `MDNode::resolveCycles()` on each node (or on a
top-level node that somehow references all of the nodes). Also,
don't do that. Metadata cycles (and the RAUW machinery needed to
construct them) are expensive.
- An `MDNode` can only refer to a `Constant` through a bridge called
`ConstantAsMetadata` (one of the subclasses of `ValueAsMetadata`).
As a side effect, accessing an operand of an `MDNode` that is known
to be, e.g., `ConstantInt`, takes three steps: first, cast from
`Metadata` to `ConstantAsMetadata`; second, extract the `Constant`;
third, cast down to `ConstantInt`.
The eventual goal is to introduce `MDInt`/`MDFloat`/etc. and have
metadata schema owners transition away from using `Constant`s when
the type isn't important (and they don't care about referring to
`GlobalValue`s).
In the meantime, I've added transitional API to the `mdconst`
namespace that matches semantics with the old code, in order to
avoid adding the error-prone three-step equivalent to every call
site. If your old code was:
MDNode *N = foo();
bar(isa <ConstantInt>(N->getOperand(0)));
baz(cast <ConstantInt>(N->getOperand(1)));
bak(cast_or_null <ConstantInt>(N->getOperand(2)));
bat(dyn_cast <ConstantInt>(N->getOperand(3)));
bay(dyn_cast_or_null<ConstantInt>(N->getOperand(4)));
you can trivially match its semantics with:
MDNode *N = foo();
bar(mdconst::hasa <ConstantInt>(N->getOperand(0)));
baz(mdconst::extract <ConstantInt>(N->getOperand(1)));
bak(mdconst::extract_or_null <ConstantInt>(N->getOperand(2)));
bat(mdconst::dyn_extract <ConstantInt>(N->getOperand(3)));
bay(mdconst::dyn_extract_or_null<ConstantInt>(N->getOperand(4)));
and when you transition your metadata schema to `MDInt`:
MDNode *N = foo();
bar(isa <MDInt>(N->getOperand(0)));
baz(cast <MDInt>(N->getOperand(1)));
bak(cast_or_null <MDInt>(N->getOperand(2)));
bat(dyn_cast <MDInt>(N->getOperand(3)));
bay(dyn_cast_or_null<MDInt>(N->getOperand(4)));
- A `CallInst` -- specifically, intrinsic instructions -- can refer to
metadata through a bridge called `MetadataAsValue`. This is a
subclass of `Value` where `getType()->isMetadataTy()`.
`MetadataAsValue` is the *only* class that can legally refer to a
`LocalAsMetadata`, which is a bridged form of non-`Constant` values
like `Argument` and `Instruction`. It can also refer to any other
`Metadata` subclass.
(I'll break all your testcases in a follow-up commit, when I propagate
this change to assembly.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223802 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-09 18:38:53 +00:00
|
|
|
SmallVector<Metadata *, 4> AllEnumTypes;
|
|
|
|
/// Track the RetainTypes, since they can be updated later on.
|
|
|
|
SmallVector<TrackingMDNodeRef, 4> AllRetainTypes;
|
|
|
|
SmallVector<Metadata *, 4> AllSubprograms;
|
|
|
|
SmallVector<Metadata *, 4> AllGVs;
|
|
|
|
SmallVector<TrackingMDNodeRef, 4> AllImportedModules;
|
|
|
|
|
|
|
|
/// \brief Track nodes that may be unresolved.
|
|
|
|
SmallVector<TrackingMDNodeRef, 4> UnresolvedNodes;
|
|
|
|
bool AllowUnresolvedNodes;
|
2011-08-16 22:09:43 +00:00
|
|
|
|
2014-10-15 16:11:41 +00:00
|
|
|
/// Each subprogram's preserved local variables.
|
IR: Split Metadata from Value
Split `Metadata` away from the `Value` class hierarchy, as part of
PR21532. Assembly and bitcode changes are in the wings, but this is the
bulk of the change for the IR C++ API.
I have a follow-up patch prepared for `clang`. If this breaks other
sub-projects, I apologize in advance :(. Help me compile it on Darwin
I'll try to fix it. FWIW, the errors should be easy to fix, so it may
be simpler to just fix it yourself.
This breaks the build for all metadata-related code that's out-of-tree.
Rest assured the transition is mechanical and the compiler should catch
almost all of the problems.
Here's a quick guide for updating your code:
- `Metadata` is the root of a class hierarchy with three main classes:
`MDNode`, `MDString`, and `ValueAsMetadata`. It is distinct from
the `Value` class hierarchy. It is typeless -- i.e., instances do
*not* have a `Type`.
- `MDNode`'s operands are all `Metadata *` (instead of `Value *`).
- `TrackingVH<MDNode>` and `WeakVH` referring to metadata can be
replaced with `TrackingMDNodeRef` and `TrackingMDRef`, respectively.
If you're referring solely to resolved `MDNode`s -- post graph
construction -- just use `MDNode*`.
- `MDNode` (and the rest of `Metadata`) have only limited support for
`replaceAllUsesWith()`.
As long as an `MDNode` is pointing at a forward declaration -- the
result of `MDNode::getTemporary()` -- it maintains a side map of its
uses and can RAUW itself. Once the forward declarations are fully
resolved RAUW support is dropped on the ground. This means that
uniquing collisions on changing operands cause nodes to become
"distinct". (This already happened fairly commonly, whenever an
operand went to null.)
If you're constructing complex (non self-reference) `MDNode` cycles,
you need to call `MDNode::resolveCycles()` on each node (or on a
top-level node that somehow references all of the nodes). Also,
don't do that. Metadata cycles (and the RAUW machinery needed to
construct them) are expensive.
- An `MDNode` can only refer to a `Constant` through a bridge called
`ConstantAsMetadata` (one of the subclasses of `ValueAsMetadata`).
As a side effect, accessing an operand of an `MDNode` that is known
to be, e.g., `ConstantInt`, takes three steps: first, cast from
`Metadata` to `ConstantAsMetadata`; second, extract the `Constant`;
third, cast down to `ConstantInt`.
The eventual goal is to introduce `MDInt`/`MDFloat`/etc. and have
metadata schema owners transition away from using `Constant`s when
the type isn't important (and they don't care about referring to
`GlobalValue`s).
In the meantime, I've added transitional API to the `mdconst`
namespace that matches semantics with the old code, in order to
avoid adding the error-prone three-step equivalent to every call
site. If your old code was:
MDNode *N = foo();
bar(isa <ConstantInt>(N->getOperand(0)));
baz(cast <ConstantInt>(N->getOperand(1)));
bak(cast_or_null <ConstantInt>(N->getOperand(2)));
bat(dyn_cast <ConstantInt>(N->getOperand(3)));
bay(dyn_cast_or_null<ConstantInt>(N->getOperand(4)));
you can trivially match its semantics with:
MDNode *N = foo();
bar(mdconst::hasa <ConstantInt>(N->getOperand(0)));
baz(mdconst::extract <ConstantInt>(N->getOperand(1)));
bak(mdconst::extract_or_null <ConstantInt>(N->getOperand(2)));
bat(mdconst::dyn_extract <ConstantInt>(N->getOperand(3)));
bay(mdconst::dyn_extract_or_null<ConstantInt>(N->getOperand(4)));
and when you transition your metadata schema to `MDInt`:
MDNode *N = foo();
bar(isa <MDInt>(N->getOperand(0)));
baz(cast <MDInt>(N->getOperand(1)));
bak(cast_or_null <MDInt>(N->getOperand(2)));
bat(dyn_cast <MDInt>(N->getOperand(3)));
bay(dyn_cast_or_null<MDInt>(N->getOperand(4)));
- A `CallInst` -- specifically, intrinsic instructions -- can refer to
metadata through a bridge called `MetadataAsValue`. This is a
subclass of `Value` where `getType()->isMetadataTy()`.
`MetadataAsValue` is the *only* class that can legally refer to a
`LocalAsMetadata`, which is a bridged form of non-`Constant` values
like `Argument` and `Instruction`. It can also refer to any other
`Metadata` subclass.
(I'll break all your testcases in a follow-up commit, when I propagate
this change to assembly.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223802 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-09 18:38:53 +00:00
|
|
|
DenseMap<MDNode *, std::vector<TrackingMDNodeRef>> PreservedVariables;
|
2014-10-15 16:11:41 +00:00
|
|
|
|
2015-02-15 22:54:22 +00:00
|
|
|
DIBuilder(const DIBuilder &) = delete;
|
|
|
|
void operator=(const DIBuilder &) = delete;
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
|
IR: Split Metadata from Value
Split `Metadata` away from the `Value` class hierarchy, as part of
PR21532. Assembly and bitcode changes are in the wings, but this is the
bulk of the change for the IR C++ API.
I have a follow-up patch prepared for `clang`. If this breaks other
sub-projects, I apologize in advance :(. Help me compile it on Darwin
I'll try to fix it. FWIW, the errors should be easy to fix, so it may
be simpler to just fix it yourself.
This breaks the build for all metadata-related code that's out-of-tree.
Rest assured the transition is mechanical and the compiler should catch
almost all of the problems.
Here's a quick guide for updating your code:
- `Metadata` is the root of a class hierarchy with three main classes:
`MDNode`, `MDString`, and `ValueAsMetadata`. It is distinct from
the `Value` class hierarchy. It is typeless -- i.e., instances do
*not* have a `Type`.
- `MDNode`'s operands are all `Metadata *` (instead of `Value *`).
- `TrackingVH<MDNode>` and `WeakVH` referring to metadata can be
replaced with `TrackingMDNodeRef` and `TrackingMDRef`, respectively.
If you're referring solely to resolved `MDNode`s -- post graph
construction -- just use `MDNode*`.
- `MDNode` (and the rest of `Metadata`) have only limited support for
`replaceAllUsesWith()`.
As long as an `MDNode` is pointing at a forward declaration -- the
result of `MDNode::getTemporary()` -- it maintains a side map of its
uses and can RAUW itself. Once the forward declarations are fully
resolved RAUW support is dropped on the ground. This means that
uniquing collisions on changing operands cause nodes to become
"distinct". (This already happened fairly commonly, whenever an
operand went to null.)
If you're constructing complex (non self-reference) `MDNode` cycles,
you need to call `MDNode::resolveCycles()` on each node (or on a
top-level node that somehow references all of the nodes). Also,
don't do that. Metadata cycles (and the RAUW machinery needed to
construct them) are expensive.
- An `MDNode` can only refer to a `Constant` through a bridge called
`ConstantAsMetadata` (one of the subclasses of `ValueAsMetadata`).
As a side effect, accessing an operand of an `MDNode` that is known
to be, e.g., `ConstantInt`, takes three steps: first, cast from
`Metadata` to `ConstantAsMetadata`; second, extract the `Constant`;
third, cast down to `ConstantInt`.
The eventual goal is to introduce `MDInt`/`MDFloat`/etc. and have
metadata schema owners transition away from using `Constant`s when
the type isn't important (and they don't care about referring to
`GlobalValue`s).
In the meantime, I've added transitional API to the `mdconst`
namespace that matches semantics with the old code, in order to
avoid adding the error-prone three-step equivalent to every call
site. If your old code was:
MDNode *N = foo();
bar(isa <ConstantInt>(N->getOperand(0)));
baz(cast <ConstantInt>(N->getOperand(1)));
bak(cast_or_null <ConstantInt>(N->getOperand(2)));
bat(dyn_cast <ConstantInt>(N->getOperand(3)));
bay(dyn_cast_or_null<ConstantInt>(N->getOperand(4)));
you can trivially match its semantics with:
MDNode *N = foo();
bar(mdconst::hasa <ConstantInt>(N->getOperand(0)));
baz(mdconst::extract <ConstantInt>(N->getOperand(1)));
bak(mdconst::extract_or_null <ConstantInt>(N->getOperand(2)));
bat(mdconst::dyn_extract <ConstantInt>(N->getOperand(3)));
bay(mdconst::dyn_extract_or_null<ConstantInt>(N->getOperand(4)));
and when you transition your metadata schema to `MDInt`:
MDNode *N = foo();
bar(isa <MDInt>(N->getOperand(0)));
baz(cast <MDInt>(N->getOperand(1)));
bak(cast_or_null <MDInt>(N->getOperand(2)));
bat(dyn_cast <MDInt>(N->getOperand(3)));
bay(dyn_cast_or_null<MDInt>(N->getOperand(4)));
- A `CallInst` -- specifically, intrinsic instructions -- can refer to
metadata through a bridge called `MetadataAsValue`. This is a
subclass of `Value` where `getType()->isMetadataTy()`.
`MetadataAsValue` is the *only* class that can legally refer to a
`LocalAsMetadata`, which is a bridged form of non-`Constant` values
like `Argument` and `Instruction`. It can also refer to any other
`Metadata` subclass.
(I'll break all your testcases in a follow-up commit, when I propagate
this change to assembly.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223802 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-09 18:38:53 +00:00
|
|
|
/// \brief Create a temporary.
|
|
|
|
///
|
IR: Remove MDNodeFwdDecl
Remove `MDNodeFwdDecl` (as promised in r226481). Aside from API
changes, there's no real functionality change here.
`MDNode::getTemporary()` now forwards to `MDTuple::getTemporary()`,
which returns a tuple with `isTemporary()` equal to true.
The main point is that we can now add temporaries of other `MDNode`
subclasses, needed for PR22235 (I introduced `MDNodeFwdDecl` in the
first place because I didn't recognize this need, and thought they were
only needed to handle forward references).
A few things left out of (or highlighted by) this commit:
- I've had to remove the (few) uses of `std::unique_ptr<>` to deal
with temporaries, since the destructor is no longer public.
`getTemporary()` should probably return the equivalent of
`std::unique_ptr<T, MDNode::deleteTemporary>`.
- `MDLocation::getTemporary()` doesn't exist yet (worse, it actually
does exist, but does the wrong thing: `MDNode::getTemporary()` is
inherited and returns an `MDTuple`).
- `MDNode` now only has one subclass, `UniquableMDNode`, and the
distinction between them is actually somewhat confusing.
I'll fix those up next.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226501 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 20:36:39 +00:00
|
|
|
/// Create an \a temporary node and track it in \a UnresolvedNodes.
|
IR: Split Metadata from Value
Split `Metadata` away from the `Value` class hierarchy, as part of
PR21532. Assembly and bitcode changes are in the wings, but this is the
bulk of the change for the IR C++ API.
I have a follow-up patch prepared for `clang`. If this breaks other
sub-projects, I apologize in advance :(. Help me compile it on Darwin
I'll try to fix it. FWIW, the errors should be easy to fix, so it may
be simpler to just fix it yourself.
This breaks the build for all metadata-related code that's out-of-tree.
Rest assured the transition is mechanical and the compiler should catch
almost all of the problems.
Here's a quick guide for updating your code:
- `Metadata` is the root of a class hierarchy with three main classes:
`MDNode`, `MDString`, and `ValueAsMetadata`. It is distinct from
the `Value` class hierarchy. It is typeless -- i.e., instances do
*not* have a `Type`.
- `MDNode`'s operands are all `Metadata *` (instead of `Value *`).
- `TrackingVH<MDNode>` and `WeakVH` referring to metadata can be
replaced with `TrackingMDNodeRef` and `TrackingMDRef`, respectively.
If you're referring solely to resolved `MDNode`s -- post graph
construction -- just use `MDNode*`.
- `MDNode` (and the rest of `Metadata`) have only limited support for
`replaceAllUsesWith()`.
As long as an `MDNode` is pointing at a forward declaration -- the
result of `MDNode::getTemporary()` -- it maintains a side map of its
uses and can RAUW itself. Once the forward declarations are fully
resolved RAUW support is dropped on the ground. This means that
uniquing collisions on changing operands cause nodes to become
"distinct". (This already happened fairly commonly, whenever an
operand went to null.)
If you're constructing complex (non self-reference) `MDNode` cycles,
you need to call `MDNode::resolveCycles()` on each node (or on a
top-level node that somehow references all of the nodes). Also,
don't do that. Metadata cycles (and the RAUW machinery needed to
construct them) are expensive.
- An `MDNode` can only refer to a `Constant` through a bridge called
`ConstantAsMetadata` (one of the subclasses of `ValueAsMetadata`).
As a side effect, accessing an operand of an `MDNode` that is known
to be, e.g., `ConstantInt`, takes three steps: first, cast from
`Metadata` to `ConstantAsMetadata`; second, extract the `Constant`;
third, cast down to `ConstantInt`.
The eventual goal is to introduce `MDInt`/`MDFloat`/etc. and have
metadata schema owners transition away from using `Constant`s when
the type isn't important (and they don't care about referring to
`GlobalValue`s).
In the meantime, I've added transitional API to the `mdconst`
namespace that matches semantics with the old code, in order to
avoid adding the error-prone three-step equivalent to every call
site. If your old code was:
MDNode *N = foo();
bar(isa <ConstantInt>(N->getOperand(0)));
baz(cast <ConstantInt>(N->getOperand(1)));
bak(cast_or_null <ConstantInt>(N->getOperand(2)));
bat(dyn_cast <ConstantInt>(N->getOperand(3)));
bay(dyn_cast_or_null<ConstantInt>(N->getOperand(4)));
you can trivially match its semantics with:
MDNode *N = foo();
bar(mdconst::hasa <ConstantInt>(N->getOperand(0)));
baz(mdconst::extract <ConstantInt>(N->getOperand(1)));
bak(mdconst::extract_or_null <ConstantInt>(N->getOperand(2)));
bat(mdconst::dyn_extract <ConstantInt>(N->getOperand(3)));
bay(mdconst::dyn_extract_or_null<ConstantInt>(N->getOperand(4)));
and when you transition your metadata schema to `MDInt`:
MDNode *N = foo();
bar(isa <MDInt>(N->getOperand(0)));
baz(cast <MDInt>(N->getOperand(1)));
bak(cast_or_null <MDInt>(N->getOperand(2)));
bat(dyn_cast <MDInt>(N->getOperand(3)));
bay(dyn_cast_or_null<MDInt>(N->getOperand(4)));
- A `CallInst` -- specifically, intrinsic instructions -- can refer to
metadata through a bridge called `MetadataAsValue`. This is a
subclass of `Value` where `getType()->isMetadataTy()`.
`MetadataAsValue` is the *only* class that can legally refer to a
`LocalAsMetadata`, which is a bridged form of non-`Constant` values
like `Argument` and `Instruction`. It can also refer to any other
`Metadata` subclass.
(I'll break all your testcases in a follow-up commit, when I propagate
this change to assembly.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223802 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-09 18:38:53 +00:00
|
|
|
void trackIfUnresolved(MDNode *N);
|
|
|
|
|
2014-11-14 23:55:52 +00:00
|
|
|
public:
|
IR: Split Metadata from Value
Split `Metadata` away from the `Value` class hierarchy, as part of
PR21532. Assembly and bitcode changes are in the wings, but this is the
bulk of the change for the IR C++ API.
I have a follow-up patch prepared for `clang`. If this breaks other
sub-projects, I apologize in advance :(. Help me compile it on Darwin
I'll try to fix it. FWIW, the errors should be easy to fix, so it may
be simpler to just fix it yourself.
This breaks the build for all metadata-related code that's out-of-tree.
Rest assured the transition is mechanical and the compiler should catch
almost all of the problems.
Here's a quick guide for updating your code:
- `Metadata` is the root of a class hierarchy with three main classes:
`MDNode`, `MDString`, and `ValueAsMetadata`. It is distinct from
the `Value` class hierarchy. It is typeless -- i.e., instances do
*not* have a `Type`.
- `MDNode`'s operands are all `Metadata *` (instead of `Value *`).
- `TrackingVH<MDNode>` and `WeakVH` referring to metadata can be
replaced with `TrackingMDNodeRef` and `TrackingMDRef`, respectively.
If you're referring solely to resolved `MDNode`s -- post graph
construction -- just use `MDNode*`.
- `MDNode` (and the rest of `Metadata`) have only limited support for
`replaceAllUsesWith()`.
As long as an `MDNode` is pointing at a forward declaration -- the
result of `MDNode::getTemporary()` -- it maintains a side map of its
uses and can RAUW itself. Once the forward declarations are fully
resolved RAUW support is dropped on the ground. This means that
uniquing collisions on changing operands cause nodes to become
"distinct". (This already happened fairly commonly, whenever an
operand went to null.)
If you're constructing complex (non self-reference) `MDNode` cycles,
you need to call `MDNode::resolveCycles()` on each node (or on a
top-level node that somehow references all of the nodes). Also,
don't do that. Metadata cycles (and the RAUW machinery needed to
construct them) are expensive.
- An `MDNode` can only refer to a `Constant` through a bridge called
`ConstantAsMetadata` (one of the subclasses of `ValueAsMetadata`).
As a side effect, accessing an operand of an `MDNode` that is known
to be, e.g., `ConstantInt`, takes three steps: first, cast from
`Metadata` to `ConstantAsMetadata`; second, extract the `Constant`;
third, cast down to `ConstantInt`.
The eventual goal is to introduce `MDInt`/`MDFloat`/etc. and have
metadata schema owners transition away from using `Constant`s when
the type isn't important (and they don't care about referring to
`GlobalValue`s).
In the meantime, I've added transitional API to the `mdconst`
namespace that matches semantics with the old code, in order to
avoid adding the error-prone three-step equivalent to every call
site. If your old code was:
MDNode *N = foo();
bar(isa <ConstantInt>(N->getOperand(0)));
baz(cast <ConstantInt>(N->getOperand(1)));
bak(cast_or_null <ConstantInt>(N->getOperand(2)));
bat(dyn_cast <ConstantInt>(N->getOperand(3)));
bay(dyn_cast_or_null<ConstantInt>(N->getOperand(4)));
you can trivially match its semantics with:
MDNode *N = foo();
bar(mdconst::hasa <ConstantInt>(N->getOperand(0)));
baz(mdconst::extract <ConstantInt>(N->getOperand(1)));
bak(mdconst::extract_or_null <ConstantInt>(N->getOperand(2)));
bat(mdconst::dyn_extract <ConstantInt>(N->getOperand(3)));
bay(mdconst::dyn_extract_or_null<ConstantInt>(N->getOperand(4)));
and when you transition your metadata schema to `MDInt`:
MDNode *N = foo();
bar(isa <MDInt>(N->getOperand(0)));
baz(cast <MDInt>(N->getOperand(1)));
bak(cast_or_null <MDInt>(N->getOperand(2)));
bat(dyn_cast <MDInt>(N->getOperand(3)));
bay(dyn_cast_or_null<MDInt>(N->getOperand(4)));
- A `CallInst` -- specifically, intrinsic instructions -- can refer to
metadata through a bridge called `MetadataAsValue`. This is a
subclass of `Value` where `getType()->isMetadataTy()`.
`MetadataAsValue` is the *only* class that can legally refer to a
`LocalAsMetadata`, which is a bridged form of non-`Constant` values
like `Argument` and `Instruction`. It can also refer to any other
`Metadata` subclass.
(I'll break all your testcases in a follow-up commit, when I propagate
this change to assembly.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223802 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-09 18:38:53 +00:00
|
|
|
/// \brief Construct a builder for a module.
|
|
|
|
///
|
|
|
|
/// If \c AllowUnresolved, collect unresolved nodes attached to the module
|
|
|
|
/// in order to resolve cycles during \a finalize().
|
|
|
|
explicit DIBuilder(Module &M, bool AllowUnresolved = true);
|
2014-02-27 01:24:56 +00:00
|
|
|
enum DebugEmissionKind { FullDebug=1, LineTablesOnly };
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
|
2011-08-15 23:00:00 +00:00
|
|
|
/// finalize - Construct any deferred debug info descriptors.
|
|
|
|
void finalize();
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createCompileUnit - A CompileUnit provides an anchor for all debugging
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
/// information generated during this instance of compilation.
|
2010-11-08 18:28:34 +00:00
|
|
|
/// @param Lang Source programming language, eg. dwarf::DW_LANG_C99
|
|
|
|
/// @param File File name
|
|
|
|
/// @param Dir Directory
|
2014-02-26 23:54:42 +00:00
|
|
|
/// @param Producer Identify the producer of debugging information and code.
|
|
|
|
/// Usually this is a compiler version string.
|
2010-11-08 18:28:34 +00:00
|
|
|
/// @param isOptimized A boolean flag which indicates whether optimization
|
|
|
|
/// is ON or not.
|
2013-04-19 20:37:09 +00:00
|
|
|
/// @param Flags This string lists command line options. This string is
|
2010-11-08 18:28:34 +00:00
|
|
|
/// directly embedded in debug info output which may be used
|
|
|
|
/// by a tool analyzing generated debugging information.
|
2013-04-19 20:37:09 +00:00
|
|
|
/// @param RV This indicates runtime version for languages like
|
2010-11-08 18:28:34 +00:00
|
|
|
/// Objective-C.
|
2013-02-22 23:50:04 +00:00
|
|
|
/// @param SplitName The name of the file that we'll split debug info out
|
|
|
|
/// into.
|
2014-06-24 17:02:03 +00:00
|
|
|
/// @param Kind The kind of debug information to generate.
|
2015-05-21 20:37:30 +00:00
|
|
|
/// @param DWOId The DWOId if this is a split skeleton compile unit.
|
2014-06-24 17:02:03 +00:00
|
|
|
/// @param EmitDebugInfo A boolean flag which indicates whether debug
|
|
|
|
/// information should be written to the final
|
|
|
|
/// output or not. When this is false, debug
|
|
|
|
/// information annotations will be present in
|
|
|
|
/// the IL but they are not written to the final
|
|
|
|
/// assembly or object file. This supports tracking
|
|
|
|
/// source location information in the back end
|
|
|
|
/// without actually changing the output (e.g.,
|
|
|
|
/// when using optimization remarks).
|
2015-05-21 20:37:30 +00:00
|
|
|
DICompileUnit *
|
|
|
|
createCompileUnit(unsigned Lang, StringRef File, StringRef Dir,
|
|
|
|
StringRef Producer, bool isOptimized, StringRef Flags,
|
|
|
|
unsigned RV, StringRef SplitName = StringRef(),
|
|
|
|
DebugEmissionKind Kind = FullDebug, uint64_t DWOId = 0,
|
|
|
|
bool EmitDebugInfo = true);
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createFile - Create a file descriptor to hold debugging information
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
/// for a file.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIFile *createFile(StringRef Filename, StringRef Directory);
|
2013-04-19 20:37:09 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createEnumerator - Create a single enumerator value.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIEnumerator *createEnumerator(StringRef Name, int64_t Val);
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
|
2013-06-27 22:50:59 +00:00
|
|
|
/// \brief Create a DWARF unspecified type.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIBasicType *createUnspecifiedType(StringRef Name);
|
2013-06-27 22:50:59 +00:00
|
|
|
|
|
|
|
/// \brief Create C++11 nullptr type.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIBasicType *createNullPtrType();
|
2011-09-14 23:13:28 +00:00
|
|
|
|
2013-04-19 20:37:09 +00:00
|
|
|
/// createBasicType - Create debugging information entry for a basic
|
2010-11-08 18:28:34 +00:00
|
|
|
/// type.
|
|
|
|
/// @param Name Type name.
|
|
|
|
/// @param SizeInBits Size of the type.
|
|
|
|
/// @param AlignInBits Type alignment.
|
|
|
|
/// @param Encoding DWARF encoding code, e.g. dwarf::DW_ATE_float.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIBasicType *createBasicType(StringRef Name, uint64_t SizeInBits,
|
2015-04-16 16:36:23 +00:00
|
|
|
uint64_t AlignInBits, unsigned Encoding);
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createQualifiedType - Create debugging information entry for a qualified
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
/// type, e.g. 'const int'.
|
2010-11-08 18:28:34 +00:00
|
|
|
/// @param Tag Tag identifing type, e.g. dwarf::TAG_volatile_type
|
|
|
|
/// @param FromTy Base Type.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIDerivedType *createQualifiedType(unsigned Tag, DIType *FromTy);
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createPointerType - Create debugging information entry for a pointer.
|
2010-12-07 23:25:47 +00:00
|
|
|
/// @param PointeeTy Type pointed by this pointer.
|
|
|
|
/// @param SizeInBits Size.
|
|
|
|
/// @param AlignInBits Alignment. (optional)
|
|
|
|
/// @param Name Pointer type name. (optional)
|
2015-04-29 16:38:44 +00:00
|
|
|
DIDerivedType *createPointerType(DIType *PointeeTy, uint64_t SizeInBits,
|
2015-04-16 16:36:23 +00:00
|
|
|
uint64_t AlignInBits = 0,
|
|
|
|
StringRef Name = "");
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
|
2013-01-07 05:51:15 +00:00
|
|
|
/// \brief Create debugging information entry for a pointer to member.
|
|
|
|
/// @param PointeeTy Type pointed to by this pointer.
|
2014-12-23 19:11:47 +00:00
|
|
|
/// @param SizeInBits Size.
|
|
|
|
/// @param AlignInBits Alignment. (optional)
|
2013-01-07 05:51:15 +00:00
|
|
|
/// @param Class Type for which this pointer points to members of.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIDerivedType *createMemberPointerType(DIType *PointeeTy, DIType *Class,
|
2015-04-16 16:36:23 +00:00
|
|
|
uint64_t SizeInBits,
|
|
|
|
uint64_t AlignInBits = 0);
|
2013-01-07 05:51:15 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createReferenceType - Create debugging information entry for a c++
|
2012-05-19 01:36:37 +00:00
|
|
|
/// style reference or rvalue reference type.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIDerivedType *createReferenceType(unsigned Tag, DIType *RTy);
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createTypedef - Create debugging information entry for a typedef.
|
2010-12-07 23:25:47 +00:00
|
|
|
/// @param Ty Original type.
|
|
|
|
/// @param Name Typedef name.
|
|
|
|
/// @param File File where this type is defined.
|
|
|
|
/// @param LineNo Line number.
|
2011-06-03 17:04:51 +00:00
|
|
|
/// @param Context The surrounding context for the typedef.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIDerivedType *createTypedef(DIType *Ty, StringRef Name, DIFile *File,
|
|
|
|
unsigned LineNo, DIScope *Context);
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createFriend - Create debugging information entry for a 'friend'.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIDerivedType *createFriend(DIType *Ty, DIType *FriendTy);
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createInheritance - Create debugging information entry to establish
|
2010-11-08 18:28:34 +00:00
|
|
|
/// inheritance relationship between two types.
|
2010-12-07 23:25:47 +00:00
|
|
|
/// @param Ty Original type.
|
|
|
|
/// @param BaseTy Base type. Ty is inherits from base.
|
|
|
|
/// @param BaseOffset Base offset.
|
2013-04-19 20:37:09 +00:00
|
|
|
/// @param Flags Flags to describe inheritance attribute,
|
2010-12-07 23:25:47 +00:00
|
|
|
/// e.g. private
|
2015-04-29 16:38:44 +00:00
|
|
|
DIDerivedType *createInheritance(DIType *Ty, DIType *BaseTy,
|
2015-04-16 16:36:23 +00:00
|
|
|
uint64_t BaseOffset, unsigned Flags);
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createMemberType - Create debugging information entry for a member.
|
2011-06-24 22:00:39 +00:00
|
|
|
/// @param Scope Member scope.
|
2010-12-07 23:25:47 +00:00
|
|
|
/// @param Name Member name.
|
|
|
|
/// @param File File where this member is defined.
|
|
|
|
/// @param LineNo Line number.
|
|
|
|
/// @param SizeInBits Member size.
|
|
|
|
/// @param AlignInBits Member alignment.
|
|
|
|
/// @param OffsetInBits Member offset.
|
|
|
|
/// @param Flags Flags to encode member attribute, e.g. private
|
|
|
|
/// @param Ty Parent type.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIDerivedType *createMemberType(DIScope *Scope, StringRef Name,
|
|
|
|
DIFile *File, unsigned LineNo,
|
2015-04-16 16:36:23 +00:00
|
|
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
|
|
|
uint64_t OffsetInBits, unsigned Flags,
|
2015-04-29 16:38:44 +00:00
|
|
|
DIType *Ty);
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
|
2013-01-16 01:22:23 +00:00
|
|
|
/// createStaticMemberType - Create debugging information entry for a
|
|
|
|
/// C++ static data member.
|
|
|
|
/// @param Scope Member scope.
|
|
|
|
/// @param Name Member name.
|
|
|
|
/// @param File File where this member is declared.
|
|
|
|
/// @param LineNo Line number.
|
|
|
|
/// @param Ty Type of the static member.
|
|
|
|
/// @param Flags Flags to encode member attribute, e.g. private.
|
|
|
|
/// @param Val Const initializer of the member.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIDerivedType *createStaticMemberType(DIScope *Scope, StringRef Name,
|
|
|
|
DIFile *File, unsigned LineNo,
|
|
|
|
DIType *Ty, unsigned Flags,
|
2015-04-16 16:36:23 +00:00
|
|
|
llvm::Constant *Val);
|
2013-01-16 01:22:23 +00:00
|
|
|
|
2012-02-06 17:49:43 +00:00
|
|
|
/// createObjCIVar - Create debugging information entry for Objective-C
|
|
|
|
/// instance variable.
|
|
|
|
/// @param Name Member name.
|
|
|
|
/// @param File File where this member is defined.
|
|
|
|
/// @param LineNo Line number.
|
|
|
|
/// @param SizeInBits Member size.
|
|
|
|
/// @param AlignInBits Member alignment.
|
|
|
|
/// @param OffsetInBits Member offset.
|
|
|
|
/// @param Flags Flags to encode member attribute, e.g. private
|
|
|
|
/// @param Ty Parent type.
|
2012-08-23 16:54:08 +00:00
|
|
|
/// @param PropertyNode Property associated with this ivar.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIDerivedType *createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo,
|
2015-04-16 16:36:23 +00:00
|
|
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
|
|
|
uint64_t OffsetInBits, unsigned Flags,
|
2015-04-29 16:38:44 +00:00
|
|
|
DIType *Ty, MDNode *PropertyNode);
|
2012-02-06 17:49:43 +00:00
|
|
|
|
2012-02-04 00:59:25 +00:00
|
|
|
/// createObjCProperty - Create debugging information entry for Objective-C
|
|
|
|
/// property.
|
|
|
|
/// @param Name Property name.
|
2012-03-29 08:42:56 +00:00
|
|
|
/// @param File File where this property is defined.
|
|
|
|
/// @param LineNumber Line number.
|
2012-02-04 00:59:25 +00:00
|
|
|
/// @param GetterName Name of the Objective C property getter selector.
|
|
|
|
/// @param SetterName Name of the Objective C property setter selector.
|
|
|
|
/// @param PropertyAttributes Objective C property attributes.
|
2012-03-29 08:42:56 +00:00
|
|
|
/// @param Ty Type.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIObjCProperty *createObjCProperty(StringRef Name, DIFile *File,
|
2015-04-16 16:36:23 +00:00
|
|
|
unsigned LineNumber,
|
|
|
|
StringRef GetterName,
|
|
|
|
StringRef SetterName,
|
2015-04-29 16:38:44 +00:00
|
|
|
unsigned PropertyAttributes, DIType *Ty);
|
2013-04-19 20:37:09 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createClassType - Create debugging information entry for a class.
|
2010-12-08 20:18:20 +00:00
|
|
|
/// @param Scope Scope in which this class is defined.
|
|
|
|
/// @param Name class name.
|
|
|
|
/// @param File File where this member is defined.
|
2012-08-23 16:54:08 +00:00
|
|
|
/// @param LineNumber Line number.
|
2010-12-08 20:18:20 +00:00
|
|
|
/// @param SizeInBits Member size.
|
|
|
|
/// @param AlignInBits Member alignment.
|
|
|
|
/// @param OffsetInBits Member offset.
|
|
|
|
/// @param Flags Flags to encode member attribute, e.g. private
|
|
|
|
/// @param Elements class members.
|
|
|
|
/// @param VTableHolder Debug info of the base class that contains vtable
|
2013-04-19 20:37:09 +00:00
|
|
|
/// for this type. This is used in
|
2010-12-08 20:18:20 +00:00
|
|
|
/// DW_AT_containing_type. See DWARF documentation
|
|
|
|
/// for more info.
|
2011-02-02 21:38:25 +00:00
|
|
|
/// @param TemplateParms Template type parameters.
|
2013-08-27 23:06:40 +00:00
|
|
|
/// @param UniqueIdentifier A unique identifier for the class.
|
2015-04-29 16:38:44 +00:00
|
|
|
DICompositeType *createClassType(DIScope *Scope, StringRef Name,
|
|
|
|
DIFile *File, unsigned LineNumber,
|
|
|
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
|
|
|
uint64_t OffsetInBits, unsigned Flags,
|
|
|
|
DIType *DerivedFrom, DINodeArray Elements,
|
|
|
|
DIType *VTableHolder = nullptr,
|
|
|
|
MDNode *TemplateParms = nullptr,
|
|
|
|
StringRef UniqueIdentifier = "");
|
2010-12-08 20:18:20 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createStructType - Create debugging information entry for a struct.
|
2010-12-08 01:50:15 +00:00
|
|
|
/// @param Scope Scope in which this struct is defined.
|
|
|
|
/// @param Name Struct name.
|
|
|
|
/// @param File File where this member is defined.
|
2012-08-23 16:54:08 +00:00
|
|
|
/// @param LineNumber Line number.
|
2010-12-08 01:50:15 +00:00
|
|
|
/// @param SizeInBits Member size.
|
|
|
|
/// @param AlignInBits Member alignment.
|
|
|
|
/// @param Flags Flags to encode member attribute, e.g. private
|
|
|
|
/// @param Elements Struct elements.
|
|
|
|
/// @param RunTimeLang Optional parameter, Objective-C runtime version.
|
2013-08-27 23:06:40 +00:00
|
|
|
/// @param UniqueIdentifier A unique identifier for the struct.
|
2015-04-29 16:38:44 +00:00
|
|
|
DICompositeType *createStructType(
|
|
|
|
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
|
2015-04-16 16:36:23 +00:00
|
|
|
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
|
2015-04-29 16:38:44 +00:00
|
|
|
DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0,
|
|
|
|
DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = "");
|
2010-12-07 23:25:47 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createUnionType - Create debugging information entry for an union.
|
2010-12-08 01:50:15 +00:00
|
|
|
/// @param Scope Scope in which this union is defined.
|
|
|
|
/// @param Name Union name.
|
|
|
|
/// @param File File where this member is defined.
|
2012-08-23 16:54:08 +00:00
|
|
|
/// @param LineNumber Line number.
|
2010-12-08 01:50:15 +00:00
|
|
|
/// @param SizeInBits Member size.
|
|
|
|
/// @param AlignInBits Member alignment.
|
|
|
|
/// @param Flags Flags to encode member attribute, e.g. private
|
|
|
|
/// @param Elements Union elements.
|
|
|
|
/// @param RunTimeLang Optional parameter, Objective-C runtime version.
|
2013-08-27 23:06:40 +00:00
|
|
|
/// @param UniqueIdentifier A unique identifier for the union.
|
2015-04-29 16:38:44 +00:00
|
|
|
DICompositeType *createUnionType(DIScope *Scope, StringRef Name,
|
|
|
|
DIFile *File, unsigned LineNumber,
|
2015-04-16 16:36:23 +00:00
|
|
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
2015-04-29 16:38:44 +00:00
|
|
|
unsigned Flags, DINodeArray Elements,
|
2015-04-16 16:36:23 +00:00
|
|
|
unsigned RunTimeLang = 0,
|
|
|
|
StringRef UniqueIdentifier = "");
|
2010-12-08 01:50:15 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createTemplateTypeParameter - Create debugging information for template
|
2011-02-02 21:38:25 +00:00
|
|
|
/// type parameter.
|
2011-02-02 22:35:53 +00:00
|
|
|
/// @param Scope Scope in which this type is defined.
|
2011-02-02 21:38:25 +00:00
|
|
|
/// @param Name Type parameter name.
|
|
|
|
/// @param Ty Parameter type.
|
2015-04-29 16:38:44 +00:00
|
|
|
DITemplateTypeParameter *
|
|
|
|
createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty);
|
2011-02-02 21:38:25 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createTemplateValueParameter - Create debugging information for template
|
2011-02-02 22:35:53 +00:00
|
|
|
/// value parameter.
|
|
|
|
/// @param Scope Scope in which this type is defined.
|
|
|
|
/// @param Name Value parameter name.
|
|
|
|
/// @param Ty Parameter type.
|
2013-05-11 19:14:10 +00:00
|
|
|
/// @param Val Constant parameter value.
|
2015-04-29 16:38:44 +00:00
|
|
|
DITemplateValueParameter *createTemplateValueParameter(DIScope *Scope,
|
2015-04-16 16:36:23 +00:00
|
|
|
StringRef Name,
|
2015-04-29 16:38:44 +00:00
|
|
|
DIType *Ty,
|
2015-04-16 16:36:23 +00:00
|
|
|
Constant *Val);
|
2013-06-22 18:59:11 +00:00
|
|
|
|
|
|
|
/// \brief Create debugging information for a template template parameter.
|
|
|
|
/// @param Scope Scope in which this type is defined.
|
|
|
|
/// @param Name Value parameter name.
|
|
|
|
/// @param Ty Parameter type.
|
|
|
|
/// @param Val The fully qualified name of the template.
|
2015-04-29 16:38:44 +00:00
|
|
|
DITemplateValueParameter *createTemplateTemplateParameter(DIScope *Scope,
|
2015-04-16 16:36:23 +00:00
|
|
|
StringRef Name,
|
2015-04-29 16:38:44 +00:00
|
|
|
DIType *Ty,
|
2015-04-16 16:36:23 +00:00
|
|
|
StringRef Val);
|
2013-06-22 18:59:11 +00:00
|
|
|
|
|
|
|
/// \brief Create debugging information for a template parameter pack.
|
|
|
|
/// @param Scope Scope in which this type is defined.
|
|
|
|
/// @param Name Value parameter name.
|
|
|
|
/// @param Ty Parameter type.
|
|
|
|
/// @param Val An array of types in the pack.
|
2015-04-29 16:38:44 +00:00
|
|
|
DITemplateValueParameter *createTemplateParameterPack(DIScope *Scope,
|
2015-04-16 16:36:23 +00:00
|
|
|
StringRef Name,
|
2015-04-29 16:38:44 +00:00
|
|
|
DIType *Ty,
|
|
|
|
DINodeArray Val);
|
2011-02-02 22:35:53 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createArrayType - Create debugging information entry for an array.
|
2010-12-08 01:50:15 +00:00
|
|
|
/// @param Size Array size.
|
|
|
|
/// @param AlignInBits Alignment.
|
|
|
|
/// @param Ty Element type.
|
|
|
|
/// @param Subscripts Subscripts.
|
2015-04-29 16:38:44 +00:00
|
|
|
DICompositeType *createArrayType(uint64_t Size, uint64_t AlignInBits,
|
|
|
|
DIType *Ty, DINodeArray Subscripts);
|
2010-12-08 01:50:15 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createVectorType - Create debugging information entry for a vector type.
|
2010-12-08 01:50:15 +00:00
|
|
|
/// @param Size Array size.
|
|
|
|
/// @param AlignInBits Alignment.
|
|
|
|
/// @param Ty Element type.
|
|
|
|
/// @param Subscripts Subscripts.
|
2015-04-29 16:38:44 +00:00
|
|
|
DICompositeType *createVectorType(uint64_t Size, uint64_t AlignInBits,
|
|
|
|
DIType *Ty, DINodeArray Subscripts);
|
2010-12-08 01:50:15 +00:00
|
|
|
|
2013-04-19 19:56:02 +00:00
|
|
|
/// createEnumerationType - Create debugging information entry for an
|
2010-12-08 01:50:15 +00:00
|
|
|
/// enumeration.
|
2013-04-19 19:56:02 +00:00
|
|
|
/// @param Scope Scope in which this enumeration is defined.
|
|
|
|
/// @param Name Union name.
|
|
|
|
/// @param File File where this member is defined.
|
|
|
|
/// @param LineNumber Line number.
|
|
|
|
/// @param SizeInBits Member size.
|
|
|
|
/// @param AlignInBits Member alignment.
|
|
|
|
/// @param Elements Enumeration elements.
|
|
|
|
/// @param UnderlyingType Underlying type of a C++11/ObjC fixed enum.
|
2013-08-27 23:06:40 +00:00
|
|
|
/// @param UniqueIdentifier A unique identifier for the enum.
|
2015-04-29 16:38:44 +00:00
|
|
|
DICompositeType *createEnumerationType(
|
|
|
|
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
|
|
|
|
uint64_t SizeInBits, uint64_t AlignInBits, DINodeArray Elements,
|
|
|
|
DIType *UnderlyingType, StringRef UniqueIdentifier = "");
|
2010-12-08 01:50:15 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createSubroutineType - Create subroutine type.
|
2013-12-18 21:48:19 +00:00
|
|
|
/// @param File File in which this subroutine is defined.
|
|
|
|
/// @param ParameterTypes An array of subroutine parameter types. This
|
|
|
|
/// includes return type at 0th index.
|
|
|
|
/// @param Flags E.g.: LValueReference.
|
|
|
|
/// These flags are used to emit dwarf attributes.
|
2015-04-29 16:38:44 +00:00
|
|
|
DISubroutineType *createSubroutineType(DIFile *File,
|
|
|
|
DITypeRefArray ParameterTypes,
|
2015-04-16 16:36:23 +00:00
|
|
|
unsigned Flags = 0);
|
2010-12-08 01:50:15 +00:00
|
|
|
|
2015-04-29 16:38:44 +00:00
|
|
|
/// createArtificialType - Create a new DIType* with "artificial" flag set.
|
|
|
|
DIType *createArtificialType(DIType *Ty);
|
2010-12-07 23:25:47 +00:00
|
|
|
|
2015-04-29 16:38:44 +00:00
|
|
|
/// createObjectPointerType - Create a new DIType* with the "object pointer"
|
2012-09-12 23:36:19 +00:00
|
|
|
/// flag set.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIType *createObjectPointerType(DIType *Ty);
|
2012-09-12 23:36:19 +00:00
|
|
|
|
2014-05-06 03:41:57 +00:00
|
|
|
/// \brief Create a permanent forward-declared type.
|
2015-04-29 16:38:44 +00:00
|
|
|
DICompositeType *createForwardDecl(unsigned Tag, StringRef Name,
|
|
|
|
DIScope *Scope, DIFile *F, unsigned Line,
|
2015-04-16 16:36:23 +00:00
|
|
|
unsigned RuntimeLang = 0,
|
|
|
|
uint64_t SizeInBits = 0,
|
|
|
|
uint64_t AlignInBits = 0,
|
|
|
|
StringRef UniqueIdentifier = "");
|
2012-02-08 00:22:26 +00:00
|
|
|
|
2014-05-06 03:41:57 +00:00
|
|
|
/// \brief Create a temporary forward-declared type.
|
2015-04-29 16:38:44 +00:00
|
|
|
DICompositeType *createReplaceableCompositeType(
|
|
|
|
unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
|
2015-04-16 16:36:23 +00:00
|
|
|
unsigned RuntimeLang = 0, uint64_t SizeInBits = 0,
|
2015-04-29 16:38:44 +00:00
|
|
|
uint64_t AlignInBits = 0, unsigned Flags = DINode::FlagFwdDecl,
|
2015-04-16 16:36:23 +00:00
|
|
|
StringRef UniqueIdentifier = "");
|
2014-05-06 03:41:57 +00:00
|
|
|
|
2015-04-29 16:38:44 +00:00
|
|
|
/// retainType - Retain DIType* in a module even if it is not referenced
|
2010-12-08 01:50:15 +00:00
|
|
|
/// through debug info anchors.
|
2015-04-29 16:38:44 +00:00
|
|
|
void retainType(DIType *T);
|
2010-12-08 01:50:15 +00:00
|
|
|
|
2014-07-28 18:52:30 +00:00
|
|
|
/// createUnspecifiedParameter - Create unspecified parameter type
|
2010-12-08 01:50:15 +00:00
|
|
|
/// for a subroutine type.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIBasicType *createUnspecifiedParameter();
|
2010-12-08 01:50:15 +00:00
|
|
|
|
2015-04-29 16:38:44 +00:00
|
|
|
/// getOrCreateArray - Get a DINodeArray, create one if required.
|
|
|
|
DINodeArray getOrCreateArray(ArrayRef<Metadata *> Elements);
|
2010-12-07 23:25:47 +00:00
|
|
|
|
2015-04-29 16:38:44 +00:00
|
|
|
/// getOrCreateTypeArray - Get a DITypeRefArray, create one if required.
|
|
|
|
DITypeRefArray getOrCreateTypeArray(ArrayRef<Metadata *> Elements);
|
2014-07-28 19:33:20 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// getOrCreateSubrange - Create a descriptor for a value range. This
|
2010-12-08 01:50:15 +00:00
|
|
|
/// implicitly uniques the values returned.
|
2015-04-29 16:38:44 +00:00
|
|
|
DISubrange *getOrCreateSubrange(int64_t Lo, int64_t Count);
|
2010-12-07 23:25:47 +00:00
|
|
|
|
2014-09-29 06:32:54 +00:00
|
|
|
/// createGlobalVariable - Create a new descriptor for the specified
|
2010-12-07 23:25:47 +00:00
|
|
|
/// variable.
|
2012-08-23 16:54:08 +00:00
|
|
|
/// @param Context Variable scope.
|
2010-12-07 23:25:47 +00:00
|
|
|
/// @param Name Name of the variable.
|
2012-08-23 16:54:08 +00:00
|
|
|
/// @param LinkageName Mangled name of the variable.
|
2010-12-07 23:25:47 +00:00
|
|
|
/// @param File File where this variable is defined.
|
|
|
|
/// @param LineNo Line number.
|
|
|
|
/// @param Ty Variable Type.
|
|
|
|
/// @param isLocalToUnit Boolean flag indicate whether this variable is
|
|
|
|
/// externally visible or not.
|
|
|
|
/// @param Val llvm::Value of the variable.
|
2013-01-16 01:22:23 +00:00
|
|
|
/// @param Decl Reference to the corresponding declaration.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIGlobalVariable *createGlobalVariable(DIScope *Context, StringRef Name,
|
|
|
|
StringRef LinkageName, DIFile *File,
|
|
|
|
unsigned LineNo, DIType *Ty,
|
2015-04-16 16:36:23 +00:00
|
|
|
bool isLocalToUnit,
|
|
|
|
llvm::Constant *Val,
|
|
|
|
MDNode *Decl = nullptr);
|
2010-12-07 23:25:47 +00:00
|
|
|
|
2014-09-29 06:32:54 +00:00
|
|
|
/// createTempGlobalVariableFwdDecl - Identical to createGlobalVariable
|
2014-09-17 09:28:34 +00:00
|
|
|
/// except that the resulting DbgNode is temporary and meant to be RAUWed.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIGlobalVariable *createTempGlobalVariableFwdDecl(
|
|
|
|
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
|
|
|
|
unsigned LineNo, DIType *Ty, bool isLocalToUnit, llvm::Constant *Val,
|
2015-04-16 16:36:23 +00:00
|
|
|
MDNode *Decl = nullptr);
|
2010-12-07 23:25:47 +00:00
|
|
|
|
2013-04-19 20:37:09 +00:00
|
|
|
/// createLocalVariable - Create a new descriptor for the specified
|
2010-12-07 23:58:00 +00:00
|
|
|
/// local variable.
|
|
|
|
/// @param Tag Dwarf TAG. Usually DW_TAG_auto_variable or
|
|
|
|
/// DW_TAG_arg_variable.
|
|
|
|
/// @param Scope Variable scope.
|
|
|
|
/// @param Name Variable name.
|
|
|
|
/// @param File File where this variable is defined.
|
|
|
|
/// @param LineNo Line number.
|
|
|
|
/// @param Ty Variable Type
|
|
|
|
/// @param AlwaysPreserve Boolean. Set to true if debug info for this
|
|
|
|
/// variable should be preserved in optimized build.
|
2013-12-18 21:48:11 +00:00
|
|
|
/// @param Flags Flags, e.g. artificial variable.
|
2013-10-21 23:55:19 +00:00
|
|
|
/// @param ArgNo If this variable is an argument then this argument's
|
2011-03-01 22:58:13 +00:00
|
|
|
/// number. 1 indicates 1st argument.
|
2015-04-29 16:38:44 +00:00
|
|
|
DILocalVariable *createLocalVariable(unsigned Tag, DIScope *Scope,
|
|
|
|
StringRef Name, DIFile *File,
|
|
|
|
unsigned LineNo, DIType *Ty,
|
2015-04-16 16:36:23 +00:00
|
|
|
bool AlwaysPreserve = false,
|
|
|
|
unsigned Flags = 0,
|
|
|
|
unsigned ArgNo = 0);
|
2010-12-07 23:58:00 +00:00
|
|
|
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218787 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 18:55:02 +00:00
|
|
|
/// createExpression - Create a new descriptor for the specified
|
2010-12-07 23:25:47 +00:00
|
|
|
/// variable which has a complex address expression for its address.
|
2011-04-24 10:11:03 +00:00
|
|
|
/// @param Addr An array of complex address operations.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIExpression *createExpression(ArrayRef<uint64_t> Addr = None);
|
|
|
|
DIExpression *createExpression(ArrayRef<int64_t> Addr);
|
2010-12-07 23:25:47 +00:00
|
|
|
|
2015-02-09 23:57:15 +00:00
|
|
|
/// createBitPieceExpression - Create a descriptor to describe one part
|
2014-10-01 21:32:12 +00:00
|
|
|
/// of aggregate variable that is fragmented across multiple Values.
|
|
|
|
///
|
2015-02-09 23:57:15 +00:00
|
|
|
/// @param OffsetInBits Offset of the piece in bits.
|
|
|
|
/// @param SizeInBits Size of the piece in bits.
|
2015-04-29 16:38:44 +00:00
|
|
|
DIExpression *createBitPieceExpression(unsigned OffsetInBits,
|
2015-04-16 16:36:23 +00:00
|
|
|
unsigned SizeInBits);
|
2014-10-01 21:32:12 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createFunction - Create a new descriptor for the specified subprogram.
|
2015-04-29 16:38:44 +00:00
|
|
|
/// See comments in DISubprogram* for descriptions of these fields.
|
2010-12-08 20:42:44 +00:00
|
|
|
/// @param Scope Function scope.
|
|
|
|
/// @param Name Function name.
|
|
|
|
/// @param LinkageName Mangled function name.
|
|
|
|
/// @param File File where this variable is defined.
|
|
|
|
/// @param LineNo Line number.
|
|
|
|
/// @param Ty Function type.
|
2014-01-18 02:12:10 +00:00
|
|
|
/// @param isLocalToUnit True if this function is not externally visible.
|
2010-12-08 20:42:44 +00:00
|
|
|
/// @param isDefinition True if this is a function definition.
|
2012-04-03 00:43:49 +00:00
|
|
|
/// @param ScopeLine Set to the beginning of the scope this starts
|
2010-12-08 20:42:44 +00:00
|
|
|
/// @param Flags e.g. is this function prototyped or not.
|
2013-12-18 21:48:11 +00:00
|
|
|
/// These flags are used to emit dwarf attributes.
|
2010-12-08 20:42:44 +00:00
|
|
|
/// @param isOptimized True if optimization is ON.
|
|
|
|
/// @param Fn llvm::Function pointer.
|
2011-04-05 22:52:06 +00:00
|
|
|
/// @param TParam Function template parameters.
|
2015-04-29 16:38:44 +00:00
|
|
|
DISubprogram *
|
|
|
|
createFunction(DIScope *Scope, StringRef Name, StringRef LinkageName,
|
|
|
|
DIFile *File, unsigned LineNo, DISubroutineType *Ty,
|
2015-04-16 16:36:23 +00:00
|
|
|
bool isLocalToUnit, bool isDefinition, unsigned ScopeLine,
|
|
|
|
unsigned Flags = 0, bool isOptimized = false,
|
|
|
|
Function *Fn = nullptr, MDNode *TParam = nullptr,
|
|
|
|
MDNode *Decl = nullptr);
|
2013-10-10 18:40:01 +00:00
|
|
|
|
2014-09-17 09:28:34 +00:00
|
|
|
/// createTempFunctionFwdDecl - Identical to createFunction,
|
|
|
|
/// except that the resulting DbgNode is meant to be RAUWed.
|
2015-04-29 16:38:44 +00:00
|
|
|
DISubprogram *createTempFunctionFwdDecl(
|
|
|
|
DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
|
|
|
|
unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
|
2015-04-16 16:36:23 +00:00
|
|
|
bool isDefinition, unsigned ScopeLine, unsigned Flags = 0,
|
|
|
|
bool isOptimized = false, Function *Fn = nullptr,
|
|
|
|
MDNode *TParam = nullptr, MDNode *Decl = nullptr);
|
2014-09-17 09:28:34 +00:00
|
|
|
|
2013-10-10 18:40:01 +00:00
|
|
|
/// FIXME: this is added for dragonegg. Once we update dragonegg
|
|
|
|
/// to call resolve function, this will be removed.
|
2015-04-29 16:38:44 +00:00
|
|
|
DISubprogram *
|
|
|
|
createFunction(DIScopeRef Scope, StringRef Name, StringRef LinkageName,
|
|
|
|
DIFile *File, unsigned LineNo, DISubroutineType *Ty,
|
2015-04-16 16:36:23 +00:00
|
|
|
bool isLocalToUnit, bool isDefinition, unsigned ScopeLine,
|
|
|
|
unsigned Flags = 0, bool isOptimized = false,
|
|
|
|
Function *Fn = nullptr, MDNode *TParam = nullptr,
|
|
|
|
MDNode *Decl = nullptr);
|
2010-12-08 20:42:44 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createMethod - Create a new descriptor for the specified C++ method.
|
2015-04-29 16:38:44 +00:00
|
|
|
/// See comments in DISubprogram* for descriptions of these fields.
|
2010-12-08 20:42:44 +00:00
|
|
|
/// @param Scope Function scope.
|
|
|
|
/// @param Name Function name.
|
|
|
|
/// @param LinkageName Mangled function name.
|
|
|
|
/// @param File File where this variable is defined.
|
|
|
|
/// @param LineNo Line number.
|
|
|
|
/// @param Ty Function type.
|
|
|
|
/// @param isLocalToUnit True if this function is not externally visible..
|
|
|
|
/// @param isDefinition True if this is a function definition.
|
2013-04-19 20:37:09 +00:00
|
|
|
/// @param Virtuality Attributes describing virtualness. e.g. pure
|
2010-12-08 20:42:44 +00:00
|
|
|
/// virtual function.
|
|
|
|
/// @param VTableIndex Index no of this method in virtual table.
|
|
|
|
/// @param VTableHolder Type that holds vtable.
|
|
|
|
/// @param Flags e.g. is this function prototyped or not.
|
|
|
|
/// This flags are used to emit dwarf attributes.
|
|
|
|
/// @param isOptimized True if optimization is ON.
|
|
|
|
/// @param Fn llvm::Function pointer.
|
2011-04-05 22:52:06 +00:00
|
|
|
/// @param TParam Function template parameters.
|
2015-04-29 16:38:44 +00:00
|
|
|
DISubprogram *
|
|
|
|
createMethod(DIScope *Scope, StringRef Name, StringRef LinkageName,
|
|
|
|
DIFile *File, unsigned LineNo, DISubroutineType *Ty,
|
2015-04-16 16:36:23 +00:00
|
|
|
bool isLocalToUnit, bool isDefinition, unsigned Virtuality = 0,
|
2015-04-29 16:38:44 +00:00
|
|
|
unsigned VTableIndex = 0, DIType *VTableHolder = nullptr,
|
2015-04-16 16:36:23 +00:00
|
|
|
unsigned Flags = 0, bool isOptimized = false,
|
|
|
|
Function *Fn = nullptr, MDNode *TParam = nullptr);
|
2010-12-07 23:25:47 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createNameSpace - This creates new descriptor for a namespace
|
2010-12-07 23:25:47 +00:00
|
|
|
/// with the specified parent scope.
|
|
|
|
/// @param Scope Namespace scope
|
|
|
|
/// @param Name Name of this namespace
|
|
|
|
/// @param File Source file
|
|
|
|
/// @param LineNo Line number
|
2015-04-29 16:38:44 +00:00
|
|
|
DINamespace *createNameSpace(DIScope *Scope, StringRef Name, DIFile *File,
|
2015-04-16 16:36:23 +00:00
|
|
|
unsigned LineNo);
|
2010-12-07 23:25:47 +00:00
|
|
|
|
2015-06-29 23:03:47 +00:00
|
|
|
/// createModule - This creates new descriptor for a module
|
|
|
|
/// with the specified parent scope.
|
|
|
|
/// @param Scope Parent scope
|
|
|
|
/// @param Name Name of this module
|
|
|
|
/// @param ConfigurationMacros
|
|
|
|
/// A space-separated shell-quoted list of -D macro
|
|
|
|
/// definitions as they would appear on a command line.
|
|
|
|
/// @param IncludePath The path to the module map file.
|
|
|
|
/// @param ISysRoot The clang system root (value of -isysroot).
|
|
|
|
DIModule *createModule(DIScope *Scope, StringRef Name,
|
|
|
|
StringRef ConfigurationMacros,
|
|
|
|
StringRef IncludePath,
|
|
|
|
StringRef ISysRoot);
|
|
|
|
|
2011-10-11 22:59:11 +00:00
|
|
|
/// createLexicalBlockFile - This creates a descriptor for a lexical
|
|
|
|
/// block with a new file attached. This merely extends the existing
|
|
|
|
/// lexical block as it crosses a file.
|
|
|
|
/// @param Scope Lexical block.
|
|
|
|
/// @param File Source file.
|
2014-08-21 22:45:21 +00:00
|
|
|
/// @param Discriminator DWARF path discriminator value.
|
2015-04-29 16:38:44 +00:00
|
|
|
DILexicalBlockFile *createLexicalBlockFile(DIScope *Scope, DIFile *File,
|
2015-04-16 16:36:23 +00:00
|
|
|
unsigned Discriminator = 0);
|
2013-04-19 20:37:09 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createLexicalBlock - This creates a descriptor for a lexical block
|
2010-12-08 01:50:15 +00:00
|
|
|
/// with the specified parent context.
|
2014-03-03 18:53:17 +00:00
|
|
|
/// @param Scope Parent lexical scope.
|
|
|
|
/// @param File Source file.
|
|
|
|
/// @param Line Line number.
|
|
|
|
/// @param Col Column number.
|
2015-04-29 16:38:44 +00:00
|
|
|
DILexicalBlock *createLexicalBlock(DIScope *Scope, DIFile *File,
|
2015-04-16 16:36:23 +00:00
|
|
|
unsigned Line, unsigned Col);
|
2010-12-08 01:50:15 +00:00
|
|
|
|
2013-04-22 06:12:31 +00:00
|
|
|
/// \brief Create a descriptor for an imported module.
|
|
|
|
/// @param Context The scope this module is imported into
|
|
|
|
/// @param NS The namespace being imported here
|
2013-04-22 15:21:03 +00:00
|
|
|
/// @param Line Line number
|
2015-04-29 16:38:44 +00:00
|
|
|
DIImportedEntity *createImportedModule(DIScope *Context, DINamespace *NS,
|
2015-04-16 16:36:23 +00:00
|
|
|
unsigned Line);
|
2013-04-22 06:12:31 +00:00
|
|
|
|
2013-05-20 22:50:35 +00:00
|
|
|
/// \brief Create a descriptor for an imported module.
|
|
|
|
/// @param Context The scope this module is imported into
|
|
|
|
/// @param NS An aliased namespace
|
|
|
|
/// @param Line Line number
|
2015-04-29 16:38:44 +00:00
|
|
|
DIImportedEntity *createImportedModule(DIScope *Context,
|
|
|
|
DIImportedEntity *NS, unsigned Line);
|
2013-05-20 22:50:35 +00:00
|
|
|
|
2015-06-29 23:03:47 +00:00
|
|
|
/// \brief Create a descriptor for an imported module.
|
|
|
|
/// @param Context The scope this module is imported into
|
|
|
|
/// @param M The module being imported here
|
|
|
|
/// @param Line Line number
|
|
|
|
DIImportedEntity *createImportedModule(DIScope *Context, DIModule *M,
|
|
|
|
unsigned Line);
|
|
|
|
|
2013-05-07 21:35:53 +00:00
|
|
|
/// \brief Create a descriptor for an imported function.
|
|
|
|
/// @param Context The scope this module is imported into
|
|
|
|
/// @param Decl The declaration (or definition) of a function, type, or
|
|
|
|
/// variable
|
|
|
|
/// @param Line Line number
|
2015-04-29 16:38:44 +00:00
|
|
|
DIImportedEntity *createImportedDeclaration(DIScope *Context, DINode *Decl,
|
|
|
|
unsigned Line,
|
2015-04-16 16:36:23 +00:00
|
|
|
StringRef Name = "");
|
2013-05-07 21:35:53 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
|
2010-12-07 23:25:47 +00:00
|
|
|
/// @param Storage llvm::Value of the variable
|
|
|
|
/// @param VarInfo Variable's debug info descriptor.
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218787 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 18:55:02 +00:00
|
|
|
/// @param Expr A complex location expression.
|
2015-04-15 21:18:07 +00:00
|
|
|
/// @param DL Debug info location.
|
2010-12-07 23:25:47 +00:00
|
|
|
/// @param InsertAtEnd Location for the new intrinsic.
|
2015-04-29 16:38:44 +00:00
|
|
|
Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
|
|
|
|
DIExpression *Expr, const DILocation *DL,
|
2015-04-15 21:18:07 +00:00
|
|
|
BasicBlock *InsertAtEnd);
|
2010-12-07 23:25:47 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
|
2010-12-07 23:25:47 +00:00
|
|
|
/// @param Storage llvm::Value of the variable
|
|
|
|
/// @param VarInfo Variable's debug info descriptor.
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218787 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 18:55:02 +00:00
|
|
|
/// @param Expr A complex location expression.
|
2015-04-15 21:18:07 +00:00
|
|
|
/// @param DL Debug info location.
|
2010-12-07 23:25:47 +00:00
|
|
|
/// @param InsertBefore Location for the new intrinsic.
|
2015-04-29 16:38:44 +00:00
|
|
|
Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
|
|
|
|
DIExpression *Expr, const DILocation *DL,
|
2015-04-15 21:18:07 +00:00
|
|
|
Instruction *InsertBefore);
|
2010-12-07 23:25:47 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
|
2010-12-07 23:25:47 +00:00
|
|
|
/// @param Val llvm::Value of the variable
|
|
|
|
/// @param Offset Offset
|
|
|
|
/// @param VarInfo Variable's debug info descriptor.
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218787 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 18:55:02 +00:00
|
|
|
/// @param Expr A complex location expression.
|
2015-04-15 21:18:07 +00:00
|
|
|
/// @param DL Debug info location.
|
2010-12-07 23:25:47 +00:00
|
|
|
/// @param InsertAtEnd Location for the new intrinsic.
|
2011-02-22 18:56:12 +00:00
|
|
|
Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
|
2015-04-29 16:38:44 +00:00
|
|
|
DILocalVariable *VarInfo,
|
|
|
|
DIExpression *Expr,
|
|
|
|
const DILocation *DL,
|
2010-12-07 23:25:47 +00:00
|
|
|
BasicBlock *InsertAtEnd);
|
2013-04-19 20:37:09 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
|
2010-12-07 23:25:47 +00:00
|
|
|
/// @param Val llvm::Value of the variable
|
|
|
|
/// @param Offset Offset
|
|
|
|
/// @param VarInfo Variable's debug info descriptor.
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218787 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 18:55:02 +00:00
|
|
|
/// @param Expr A complex location expression.
|
2015-04-15 21:18:07 +00:00
|
|
|
/// @param DL Debug info location.
|
2010-12-07 23:25:47 +00:00
|
|
|
/// @param InsertBefore Location for the new intrinsic.
|
2011-02-22 18:56:12 +00:00
|
|
|
Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
|
2015-04-29 16:38:44 +00:00
|
|
|
DILocalVariable *VarInfo,
|
|
|
|
DIExpression *Expr,
|
|
|
|
const DILocation *DL,
|
2010-12-07 23:25:47 +00:00
|
|
|
Instruction *InsertBefore);
|
2014-12-18 00:46:16 +00:00
|
|
|
|
|
|
|
/// \brief Replace the vtable holder in the given composite type.
|
|
|
|
///
|
|
|
|
/// If this creates a self reference, it may orphan some unresolved cycles
|
|
|
|
/// in the operands of \c T, so \a DIBuilder needs to track that.
|
2015-04-29 16:38:44 +00:00
|
|
|
void replaceVTableHolder(DICompositeType *&T,
|
|
|
|
DICompositeType *VTableHolder);
|
2014-12-18 00:46:16 +00:00
|
|
|
|
|
|
|
/// \brief Replace arrays on a composite type.
|
|
|
|
///
|
|
|
|
/// If \c T is resolved, but the arrays aren't -- which can happen if \c T
|
|
|
|
/// has a self-reference -- \a DIBuilder needs to track the array to
|
|
|
|
/// resolve cycles.
|
2015-04-29 16:38:44 +00:00
|
|
|
void replaceArrays(DICompositeType *&T, DINodeArray Elements,
|
|
|
|
DINodeArray TParems = DINodeArray());
|
2015-04-11 19:04:09 +00:00
|
|
|
|
|
|
|
/// \brief Replace a temporary node.
|
|
|
|
///
|
|
|
|
/// Call \a MDNode::replaceAllUsesWith() on \c N, replacing it with \c
|
|
|
|
/// Replacement.
|
|
|
|
///
|
|
|
|
/// If \c Replacement is the same as \c N.get(), instead call \a
|
|
|
|
/// MDNode::replaceWithUniqued(). In this case, the uniqued node could
|
|
|
|
/// have a different address, so we return the final address.
|
|
|
|
template <class NodeTy>
|
|
|
|
NodeTy *replaceTemporary(TempMDNode &&N, NodeTy *Replacement) {
|
|
|
|
if (N.get() == Replacement)
|
|
|
|
return cast<NodeTy>(MDNode::replaceWithUniqued(std::move(N)));
|
|
|
|
|
|
|
|
N->replaceAllUsesWith(Replacement);
|
|
|
|
return Replacement;
|
|
|
|
}
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
};
|
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|