Enzyme
main
Loading...
Searching...
No Matches
TypeAnalysis
TypeTree.cpp
Go to the documentation of this file.
1
//===- TypeTree.cpp - Implementation of Type Analysis Type Trees-----------===//
2
//
3
// Enzyme Project
4
//
5
// Part of the Enzyme Project, under the Apache License v2.0 with LLVM
6
// Exceptions. See https://llvm.org/LICENSE.txt for license information.
7
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8
//
9
// If using this code in an academic setting, please cite the following:
10
// @incollection{enzymeNeurips,
11
// title = {Instead of Rewriting Foreign Code for Machine Learning,
12
// Automatically Synthesize Fast Gradients},
13
// author = {Moses, William S. and Churavy, Valentin},
14
// booktitle = {Advances in Neural Information Processing Systems 33},
15
// year = {2020},
16
// note = {To appear in},
17
// }
18
//
19
//===----------------------------------------------------------------------===//
20
//
21
// This file contains the implementation TypeTrees -- a class
22
// representing all of the underlying types of a particular LLVM value. This
23
// consists of a map of memory offsets to an underlying ConcreteType. This
24
// permits TypeTrees to represent distinct underlying types at different
25
// locations. Presently, TypeTree's have both a fixed depth of memory lookups
26
// and a maximum offset to ensure that Type Analysis eventually terminates.
27
// In the future this should be modified to better represent recursive types
28
// rather than limiting the depth.
29
//
30
//===----------------------------------------------------------------------===//
31
#include "llvm/IR/DataLayout.h"
32
#include "llvm/IR/DerivedTypes.h"
33
34
#include "llvm/Support/CommandLine.h"
35
36
#include "
TypeTree.h
"
37
38
using namespace
llvm
;
39
40
extern
"C"
{
41
/// Maximum offset for type trees to keep
42
llvm::cl::opt<int>
MaxTypeOffset
(
"enzyme-max-type-offset"
, cl::init(500),
43
cl::Hidden,
44
cl::desc(
"Maximum type tree offset"
));
45
llvm::cl::opt<bool>
EnzymeTypeWarning
(
"enzyme-type-warning"
, cl::init(
true
),
46
cl::Hidden,
47
cl::desc(
"Print Type Depth Warning"
));
48
}
TypeTree.h
EnzymeTypeWarning
llvm::cl::opt< bool > EnzymeTypeWarning
MaxTypeOffset
llvm::cl::opt< int > MaxTypeOffset
Maximum offset for type trees to keep.
llvm
Definition
ActivityAnalysisPrinter.h:34
Generated on Fri May 8 2026 19:56:26 for Enzyme by
1.12.0