Skip to content

Commit

Permalink
blah
Browse files Browse the repository at this point in the history
  • Loading branch information
ragusaa committed Jan 26, 2024
1 parent 5fdad8a commit 738d3a8
Showing 1 changed file with 19 additions and 28 deletions.
47 changes: 19 additions & 28 deletions clambcc/clambc-compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,6 @@
OPEN_SOURCE_GENERATED_EXTENSION = "generated.c"
OPTIMIZED_TMP_BYTECODE_FILE_EXTENSION = "optimized.tmp.ll"


COMMON_WARNING_OPTIONS = "-Wno-backslash-newline-escape \
-Wno-pointer-sign \
-Wno-return-type \
-Wno-incompatible-pointer-types \
-Wno-unused-value \
-Wno-shift-negative-value \
-Wno-implicit-function-declaration \
-Wno-incompatible-library-redeclaration \
-Wno-implicit-int \
-Wno-constant-conversion \
"

COMMON_WARNING_OPTIONS = [
"-Wno-backslash-newline-escape"
, "-Wno-pointer-sign"
Expand Down Expand Up @@ -284,7 +271,9 @@ def linkIRFiles(clangLLVM: ClangLLVM, linkedFile: str, irFiles: list) -> int:
cmd.append(linkedFile)
cmd += irFiles

#TODO: Remove (FUTURE VERSION)
#TODO: Remove this in a future version, since it is a depracated option
# that will no longer be supported. For a detailed explanation, see
# https://llvm.org/docs/OpaquePointers.html
cmd.append("-opaque-pointers=0")

return run(cmd)
Expand Down Expand Up @@ -468,14 +457,6 @@ def getOutputString(linked: IRFile, ignore: IRFile) -> str:
def createOptimizedTmpFile(clangLLVM: ClangLLVM, linkedFile: str) -> str:
name = getOptimizedTmpFileName(linkedFile)

cmd = f'{clangLLVM.getOpt()} \
-S \
{linkedFile} \
-o {name} \
-internalize-public-api-list=entrypoint \
--passes="internalize,globalopt" \
'

cmd = []
cmd.append(clangLLVM.getOpt())
cmd.append("-S")
Expand All @@ -487,8 +468,6 @@ def createOptimizedTmpFile(clangLLVM: ClangLLVM, linkedFile: str) -> str:

ret = run(cmd)
if None == ret:
print ("remoev me")
import pdb ; pdb.set_trace()
return None

return name
Expand Down Expand Up @@ -556,7 +535,13 @@ def createInputSourceFile(clangLLVM: ClangLLVM, name: str, args: list, options:

OPTIMIZE_PASSES = ["function(mem2reg)"
, 'verify'
# , 'clambc-remove-undefs' #TODO: MAY NOT BE NEEDED
# , 'clambc-remove-undefs' #TODO: This was added because the optimizer in llvm-8 was replacing unused
# parameters with 'undef' values in the IR. This was causing issues in
# the writer, not knowing what value to put in the signature. The llvm-16
# optimizer no longer does this, so this value does not appear to still be
# needed. I have already done work upgrading the pass to the new
# pass manager, so I want to leave it in place throughout the -rc phase
# in case someone comes up with a testcase that re-introduces this bug.
# , 'verify'
, 'clambc-preserve-abis'
, 'verify'
Expand Down Expand Up @@ -594,7 +579,13 @@ def createInputSourceFile(clangLLVM: ClangLLVM, name: str, args: list, options:
, 'verify'
, 'clambc-outline-endianness-calls'
, 'verify'
# , 'clambc-change-malloc-arg-size' #TODO: MAY NOT BE NEEDED
# , 'clambc-change-malloc-arg-size' #TODO: This was added because the legacy llvm runtime
# had issues with 32-bit phi nodes being used in
# calls to malloc. I already did the work to
# update it to the new pass manager, but it appears
# to no longer be necessary. I will remove it
# after the -rc phase if nobody has a testcase
# that requires it.
# , 'verify'
, 'clambc-extend-phis-to-64-bit'
, 'verify'
Expand All @@ -608,12 +599,12 @@ def createInputSourceFile(clangLLVM: ClangLLVM, name: str, args: list, options:
]

OPTIMIZE_LOADS=[ f"--load {SHARED_OBJ_DIR}/libclambccommon.so"
# , f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcremoveundefs.so"
# , f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcremoveundefs.so" #Not needed, since clambc-remove-undefs is not being used.
, f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcpreserveabis.so"
, f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcremoveunsupportedicmpintrinsics.so"
, f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcremoveusub.so"
, f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcremovefshl.so"
# , f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcremovepointerphis.so"
# , f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcremovepointerphis.so" #Not needed, since clambc-remove-pointer-phis is not being used.
, f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcloweringnf.so"
, f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcremoveicmpsle.so"
, f"--load-pass-plugin {SHARED_OBJ_DIR}/libclambcverifier.so"
Expand Down

0 comments on commit 738d3a8

Please sign in to comment.