module LLVM.Internal.FFI.Transforms where
import LLVM.Prelude
needsTargetMachine :: String -> Bool
needsTargetMachine :: String -> Bool
needsTargetMachine "CodeGenPrepare" = Bool
True
needsTargetMachine _ = Bool
False
cName :: String -> String
cName :: String -> String
cName n :: String
n =
let core :: String
core = case String
n of
"AddressSanitizer" -> "AddressSanitizerFunction"
"AggressiveDeadCodeElimination" -> "AggressiveDCE"
"AlwaysInline" -> "AlwaysInliner"
"DeadInstructionElimination" -> "DeadInstElimination"
"EarlyCommonSubexpressionElimination" -> "EarlyCSE"
"FunctionAttributes" -> "FunctionAttrs"
"GlobalDeadCodeElimination" -> "GlobalDCE"
"InductionVariableSimplify" -> "IndVarSimplify"
"InternalizeFunctions" -> "Internalize"
"InterproceduralConstantPropagation" -> "IPConstantPropagation"
"InterproceduralSparseConditionalConstantPropagation" -> "IPSCCP"
"LoopClosedSingleStaticAssignment" -> "LCSSA"
"LoopInvariantCodeMotion" -> "LICM"
"LoopInstructionSimplify" -> "LoopInstSimplify"
"MemcpyOptimization" -> "MemCpyOpt"
"PruneExceptionHandling" -> "PruneEH"
"ScalarReplacementOfAggregates" -> "SROA"
"OldScalarReplacementOfAggregates" -> "ScalarReplAggregates"
"SimplifyControlFlowGraph" -> "CFGSimplification"
"SparseConditionalConstantPropagation" -> "SCCP"
"SuperwordLevelParallelismVectorize" -> "SLPVectorize"
h :: String
h -> String
h
patchImpls :: [String]
patchImpls = [
"AddressSanitizer",
"AddressSanitizerModule",
"BoundsChecking",
"CodeGenPrepare",
"GlobalValueNumbering",
"InternalizeFunctions",
"BasicBlockVectorize",
"BlockPlacement",
"BreakCriticalEdges",
"DeadCodeElimination",
"DeadInstructionElimination",
"DemoteRegisterToMemory",
"EdgeProfiler",
"GCOVProfiler",
"LoopClosedSingleStaticAssignment",
"LoopInstructionSimplify",
"LoopStrengthReduce",
"LoopVectorize",
"LowerAtomic",
"LowerInvoke",
"LowerSwitch",
"MemorySanitizer",
"MergeFunctions",
"OptimalEdgeProfiler",
"PathProfiler",
"PartialInlining",
"ScalarReplacementOfAggregates",
"Sinking",
"StripDeadDebugInfo",
"StripDebugDeclare",
"StripNonDebugSymbols",
"ThreadSanitizer"
]
in
(if (String
n String -> [String] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [String]
patchImpls) then "LLVM_Hs_" else "LLVM") String -> String -> String
forall a. [a] -> [a] -> [a]
++ "Add" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
core String -> String -> String
forall a. [a] -> [a] -> [a]
++ "Pass"