Skip to content

Commit 26474d4

Browse files
committed
[llvm-advisor] add specialized analysis endpoints
- implement optimization remarks analysis API - add diagnostics patterns and compilation phases - add performance profiling -implement binary size analysis and optimization
1 parent e7b96e9 commit 26474d4

File tree

9 files changed

+2565
-0
lines changed

9 files changed

+2565
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# ===----------------------------------------------------------------------===//
2+
#
3+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
#
7+
# ===----------------------------------------------------------------------===//
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# ===----------------------------------------------------------------------===//
2+
#
3+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
#
7+
# ===----------------------------------------------------------------------===//
8+
9+
from typing import Dict, Any
10+
import sys
11+
from pathlib import Path
12+
from ..base import APIResponse
13+
14+
15+
class BaseSpecializedEndpoint:
16+
"""Base class for specialized file-type endpoints"""
17+
18+
def __init__(self, data_dir: str, collector):
19+
self.data_dir = data_dir
20+
self.collector = collector
21+
self._cache = {}
22+
23+
def get_compilation_units(self):
24+
if "units" not in self._cache:
25+
self._cache["units"] = self.collector.discover_compilation_units(
26+
self.data_dir
27+
)
28+
return self._cache["units"]
29+
30+
def get_parsed_data(self):
31+
if "parsed_data" not in self._cache:
32+
self._cache["parsed_data"] = self.collector.parse_all_units(self.data_dir)
33+
return self._cache["parsed_data"]
34+
35+
def clear_cache(self):
36+
self._cache.clear()

0 commit comments

Comments
 (0)