Skip to content

Commit

Permalink
[AggressiveInstCombine] Add aggressive inst combiner to the LLVM C API.
Browse files Browse the repository at this point in the history
I just tried to copy what was done for regular InstCombine. Hopefully I didn't miss anything.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330668 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
topperc committed Apr 24, 2018
1 parent 557491f commit f7d7c68
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bindings/python/llvm/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,9 @@ def register_library(library):
library.LLVMInitializeInstCombine.argtypes = [PassRegistry]
library.LLVMInitializeInstCombine.restype = None

library.LLVMInitializeAggressiveInstCombiner.argtypes = [PassRegistry]
library.LLVMInitializeAggressiveInstCombiner.restype = None

library.LLVMInitializeIPO.argtypes = [PassRegistry]
library.LLVMInitializeIPO.restype = None

Expand Down
1 change: 1 addition & 0 deletions include/llvm-c/Initialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ void LLVMInitializeScalarOpts(LLVMPassRegistryRef R);
void LLVMInitializeObjCARCOpts(LLVMPassRegistryRef R);
void LLVMInitializeVectorization(LLVMPassRegistryRef R);
void LLVMInitializeInstCombine(LLVMPassRegistryRef R);
void LLVMInitializeAggressiveInstCombiner(LLVMPassRegistryRef R);
void LLVMInitializeIPO(LLVMPassRegistryRef R);
void LLVMInitializeInstrumentation(LLVMPassRegistryRef R);
void LLVMInitializeAnalysis(LLVMPassRegistryRef R);
Expand Down
3 changes: 3 additions & 0 deletions include/llvm-c/Transforms/Scalar.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ extern "C" {
/** See llvm::createAggressiveDCEPass function. */
void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM);

/** See llvm::createAggressiveInstCombinerPass function. */
void LLVMAddAggressiveInstCombinerPass(LLVMPassManagerRef PM);

/** See llvm::createBitTrackingDCEPass function. */
void LLVMAddBitTrackingDCEPass(LLVMPassManagerRef PM);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ void llvm::initializeAggressiveInstCombine(PassRegistry &Registry) {
initializeAggressiveInstCombinerLegacyPassPass(Registry);
}

void LLVMInitializeAggressiveInstCombiner(LLVMPassRegistryRef R) {
initializeAggressiveInstCombinerLegacyPassPass(*unwrap(R));
}

FunctionPass *llvm::createAggressiveInstCombinerPass() {
return new AggressiveInstCombinerLegacyPass();
}
4 changes: 4 additions & 0 deletions lib/Transforms/Scalar/Scalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM) {
unwrap(PM)->add(createAggressiveDCEPass());
}

void LLVMAddAggressiveInstCombinerPass(LLVMPassManagerRef PM) {
unwrap(PM)->add(createAggressiveInstCombinerPass());
}

void LLVMAddBitTrackingDCEPass(LLVMPassManagerRef PM) {
unwrap(PM)->add(createBitTrackingDCEPass());
}
Expand Down

0 comments on commit f7d7c68

Please sign in to comment.