Skip to content

Commit

Permalink
Remove utils since all iterators were upstreamed
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Saveau <[email protected]>
  • Loading branch information
SUPERCILEX authored and jamesmth committed Feb 2, 2024
1 parent 7fe29ca commit de1975b
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 98 deletions.
3 changes: 1 addition & 2 deletions examples/opcode_counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
use std::collections::HashMap;

use llvm_plugin::inkwell::values::{FunctionValue, InstructionOpcode};
use llvm_plugin::utils::InstructionIterator;
use llvm_plugin::{
AnalysisKey, FunctionAnalysisManager, LlvmFunctionAnalysis, LlvmFunctionPass, PassBuilder,
PipelineParsing, PreservedAnalyses,
Expand Down Expand Up @@ -57,7 +56,7 @@ impl LlvmFunctionAnalysis for OpcodeCounterAnalysis {
let mut opcode_map = HashMap::new();

for bb in function.get_basic_blocks() {
for instr in InstructionIterator::new(&bb) {
for instr in bb.get_instructions() {
opcode_map
.entry(instr.get_opcode())
.and_modify(|e| *e += 1)
Expand Down
3 changes: 1 addition & 2 deletions examples/static_call_counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use either::Either;

use llvm_plugin::inkwell::module::Module;
use llvm_plugin::inkwell::values::{BasicValueEnum, InstructionOpcode};
use llvm_plugin::utils::InstructionIterator;
use llvm_plugin::{
AnalysisKey, LlvmModuleAnalysis, LlvmModulePass, ModuleAnalysisManager, PassBuilder,
PipelineParsing, PreservedAnalyses,
Expand Down Expand Up @@ -47,7 +46,7 @@ impl LlvmModuleAnalysis for StaticCallCounterAnalysis {

for func in module.get_functions() {
for bb in func.get_basic_blocks() {
for instr in InstructionIterator::new(&bb) {
for instr in bb.get_instructions() {
if !matches!(instr.get_opcode(), InstructionOpcode::Call) {
continue;
}
Expand Down
3 changes: 1 addition & 2 deletions examples/strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use llvm_plugin::inkwell::basic_block::BasicBlock;
use llvm_plugin::inkwell::module::{Linkage, Module};
use llvm_plugin::inkwell::values::{BasicValueEnum, FunctionValue, GlobalValue};
use llvm_plugin::inkwell::{AddressSpace, IntPredicate};
use llvm_plugin::utils::GlobalIterator;
use llvm_plugin::{
LlvmModulePass, ModuleAnalysisManager, PassBuilder, PipelineParsing, PreservedAnalyses,
};
Expand Down Expand Up @@ -59,7 +58,7 @@ fn encode_global_strings<'a>(module: &mut Module<'a>) -> Vec<GlobalString<'a>> {
let mut global_strings = Vec::new();
let cx = module.get_context();

for global in GlobalIterator::new(module) {
for global in module.get_globals() {
// ignore external globals
if matches!(global.get_linkage(), Linkage::External) {
continue;
Expand Down
3 changes: 0 additions & 3 deletions llvm-plugin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ pub use pass_manager::*;
mod pass_builder;
pub use pass_builder::*;

/// Utilities.
pub mod utils;

/// Enum specifying whether analyses on an IR unit are not preserved due
/// to the modification of such unit by a transformation pass.
#[repr(C)]
Expand Down
87 changes: 0 additions & 87 deletions llvm-plugin/src/utils.rs

This file was deleted.

3 changes: 1 addition & 2 deletions tests/plugins/plugin5/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use llvm_plugin::inkwell::basic_block::BasicBlock;
use llvm_plugin::inkwell::module::Module;
use llvm_plugin::inkwell::values::{FunctionValue, InstructionOpcode, InstructionValue};
use llvm_plugin::utils::FunctionIterator;
use llvm_plugin::{
AnalysisKey, FunctionAnalysisManager, LlvmFunctionAnalysis, LlvmFunctionPass, LlvmModulePass,
ModuleAnalysisManager, PassBuilder, PipelineParsing, PreservedAnalyses,
Expand Down Expand Up @@ -39,7 +38,7 @@ impl LlvmModulePass for Pass1 {
.get_function_analysis_manager_proxy(&module)
.get_manager();

for function in FunctionIterator::new(module) {
for function in module.get_functions() {
let result = manager.get_cached_result::<Ana1>(&function);
assert!(result.is_none());

Expand Down

0 comments on commit de1975b

Please sign in to comment.