Commit b5447a04 by Jan Voung

Omit textual emitConstPool in MINIMAL build.

Noticed the "Note: Still used by emit IAS" and decided to check if we can omit it. Saves about 3KB. There's also the "Note: Still used by emit IAS" CFG text header, but I haven't looked at that. This would silently cripple the -filetype=asm or -filetype=iasm in the MINIMAL build, but that isn't supposed to be supported. Had to conditionalize some more of the tests. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4080 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/952993006
parent c6ead20c
...@@ -56,6 +56,9 @@ def main(): ...@@ -56,6 +56,9 @@ def main():
argparser.add_argument('--dis-flags', required=False, argparser.add_argument('--dis-flags', required=False,
action='append', default=[], action='append', default=[],
help='Add a disassembler flag') help='Add a disassembler flag')
argparser.add_argument('--filetype', default='iasm', dest='filetype',
choices=['obj', 'asm', 'iasm'],
help='Output file type. Default %(default)s.')
argparser.add_argument('--echo-cmd', required=False, argparser.add_argument('--echo-cmd', required=False,
action='store_true', action='store_true',
help='Trace command that generates ICE instructions') help='Trace command that generates ICE instructions')
...@@ -96,6 +99,7 @@ def main(): ...@@ -96,6 +99,7 @@ def main():
cmd += ['--build-on-read=0'] cmd += ['--build-on-read=0']
else: else:
cmd += ['--build-on-read=1'] cmd += ['--build-on-read=1']
cmd += ['--filetype=' + args.filetype]
cmd += args.args cmd += args.args
if args.llvm_source: if args.llvm_source:
cmd += [llfile] cmd += [llfile]
...@@ -106,10 +110,12 @@ def main(): ...@@ -106,10 +110,12 @@ def main():
# and instead manually delete. # and instead manually delete.
asm_temp = tempfile.NamedTemporaryFile(delete=False) asm_temp = tempfile.NamedTemporaryFile(delete=False)
asm_temp.close() asm_temp.close()
if args.assemble: if args.assemble and args.filetype != 'obj':
cmd += ['|', os.path.join(llvm_bin_path, 'llvm-mc'), cmd += ['|', os.path.join(llvm_bin_path, 'llvm-mc'),
'-triple=i686-none-nacl', '-triple=i686-none-nacl',
'-filetype=obj', '-o', asm_temp.name] '-filetype=obj', '-o', asm_temp.name]
elif asm_temp:
cmd += ['-o', asm_temp.name]
if args.disassemble: if args.disassemble:
# Show wide instruction encodings, diassemble, and show relocs. # Show wide instruction encodings, diassemble, and show relocs.
cmd += (['&&', os.path.join(binutils_bin_path, 'objdump')] + cmd += (['&&', os.path.join(binutils_bin_path, 'objdump')] +
......
...@@ -4723,7 +4723,8 @@ const char *PoolTypeConverter<double>::PrintfString = "0x%llx"; ...@@ -4723,7 +4723,8 @@ const char *PoolTypeConverter<double>::PrintfString = "0x%llx";
template <typename T> template <typename T>
void TargetDataX8632::emitConstantPool(GlobalContext *Ctx) { void TargetDataX8632::emitConstantPool(GlobalContext *Ctx) {
// Note: Still used by emit IAS. if (!ALLOW_DUMP)
return;
Ostream &Str = Ctx->getStrEmit(); Ostream &Str = Ctx->getStrEmit();
Type Ty = T::Ty; Type Ty = T::Ty;
SizeT Align = typeAlignInBytes(Ty); SizeT Align = typeAlignInBytes(Ty);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
; REQUIRES: allow_dump ; REQUIRES: allow_dump
; RUN: %p2i -i %s --args --verbose inst -threads=0 -filetype=asm | FileCheck %s ; RUN: %p2i -i %s --filetype=asm --args --verbose inst -threads=0 | FileCheck %s
define i32 @Add(i32 %a, i32 %b) { define i32 @Add(i32 %a, i32 %b) {
; CHECK: define i32 @Add ; CHECK: define i32 @Add
......
...@@ -3,17 +3,19 @@ ...@@ -3,17 +3,19 @@
; For the integrated ELF writer, we can't pipe the output because we need ; For the integrated ELF writer, we can't pipe the output because we need
; to seek backward and patch up the file headers. So, use a temporary file. ; to seek backward and patch up the file headers. So, use a temporary file.
; RUN: %p2i -i %s --args -O2 --verbose none -filetype=obj -o %t \ ; RUN: %p2i -i %s --filetype=obj --args -O2 --verbose none -o %t \
; RUN: && llvm-readobj -file-headers -sections -section-data \ ; RUN: && llvm-readobj -file-headers -sections -section-data \
; RUN: -relocations -symbols %t | FileCheck %s ; RUN: -relocations -symbols %t | FileCheck %s
; RUN: %p2i -i %s --args -O2 --verbose none \ ; RUN: %if --need=allow_dump --command %p2i -i %s --args -O2 --verbose none \
; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj -o - \ ; RUN: | %if --need=allow_dump --command llvm-mc -triple=i686-none-nacl \
; RUN: | llvm-readobj -file-headers -sections -section-data \ ; RUN: -filetype=obj -o - \
; RUN: -relocations -symbols - | FileCheck %s ; RUN: | %if --need=allow_dump --command llvm-readobj -file-headers \
; RUN: -sections -section-data -relocations -symbols - \
; RUN: | %if --need=allow_dump --command FileCheck %s
; Add a run that shows relocations in code inline. ; Add a run that shows relocations in code inline.
; RUN: %p2i -i %s --args -O2 --verbose none -filetype=obj -o %t \ ; RUN: %p2i -i %s --filetype=obj --args -O2 --verbose none -o %t \
; RUN: && objdump -w -d -r -Mintel %t \ ; RUN: && objdump -w -d -r -Mintel %t \
; RUN: | FileCheck --check-prefix=TEXT-RELOCS %s ; RUN: | FileCheck --check-prefix=TEXT-RELOCS %s
......
; Tests filetype=obj with -ffunction-sections. ; Tests filetype=obj with -ffunction-sections.
; RUN: %p2i -i %s --args -O2 --verbose none -filetype=obj -o %t \ ; RUN: %p2i -i %s --filetype=obj --args -O2 --verbose none -o %t \
; RUN: -ffunction-sections && \ ; RUN: -ffunction-sections && \
; RUN: llvm-readobj -file-headers -sections -section-data \ ; RUN: llvm-readobj -file-headers -sections -section-data \
; RUN: -relocations -symbols %t | FileCheck %s ; RUN: -relocations -symbols %t | FileCheck %s
......
; Tests that we generate an ELF container correctly when there ; Tests that we generate an ELF container correctly when there
; is no data section. ; is no data section.
; For the integrated ELF writer, we can't pipe the output because we need ; RUN: %p2i -i %s --filetype=obj --args -O2 --verbose none -o %t \
; to seek backward and patch up the file headers. So, use a temporary file.
; RUN: %p2i -i %s --args -O2 --verbose none -filetype=obj -o %t \
; RUN: && llvm-readobj -file-headers -sections -section-data \ ; RUN: && llvm-readobj -file-headers -sections -section-data \
; RUN: -relocations -symbols %t | FileCheck %s ; RUN: -relocations -symbols %t | FileCheck %s
......
...@@ -6,10 +6,17 @@ ...@@ -6,10 +6,17 @@
; number in a reasonable number of digits". See ; number in a reasonable number of digits". See
; http://llvm.org/docs/LangRef.html#simple-constants . ; http://llvm.org/docs/LangRef.html#simple-constants .
; RUN: %p2i --assemble --disassemble --dis-flags=-s -i %s --args -O2 \ ; RUN: %p2i --assemble --disassemble --filetype=obj --dis-flags=-s \
; RUN: --verbose none | FileCheck %s ; RUN: -i %s --args -O2 --verbose none | FileCheck %s
; RUN: %p2i --assemble --disassemble --dis-flags=-s -i %s --args -Om1 \ ; RUN: %p2i --assemble --disassemble --filetype=obj --dis-flags=-s \
; RUN: --verbose none | FileCheck %s ; RUN: -i %s --args -Om1 --verbose none | FileCheck %s
; RUN: %if --need allow_dump --command %p2i --assemble --disassemble \
; RUN: --dis-flags=-s -i %s --args -O2 --verbose none \
; RUN: | %if --need allow_dump --command FileCheck %s
; RUN: %if --need allow_dump --command %p2i --assemble --disassemble \
; RUN: --dis-flags=-s -i %s --args -Om1 --verbose none \
; RUN: | %if --need allow_dump --command FileCheck %s
@__init_array_start = internal constant [0 x i8] zeroinitializer, align 4 @__init_array_start = internal constant [0 x i8] zeroinitializer, align 4
@__fini_array_start = internal constant [0 x i8] zeroinitializer, align 4 @__fini_array_start = internal constant [0 x i8] zeroinitializer, align 4
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
; Test -filetype=asm to test the lea "hack" until we are fully confident ; Test -filetype=asm to test the lea "hack" until we are fully confident
; in -filetype=iasm . ; in -filetype=iasm .
; RUN: %p2i -i %s --args --verbose none -filetype=asm | FileCheck %s ; RUN: %p2i -i %s --filetype=asm --args --verbose none | FileCheck %s
; Test -filetype=iasm and try to cross reference instructions w/ the ; Test -filetype=iasm and try to cross reference instructions w/ the
; symbol table. ; symbol table.
......
...@@ -2,16 +2,16 @@ ...@@ -2,16 +2,16 @@
; REQUIRES: allow_dump ; REQUIRES: allow_dump
; Don't use filetype=iasm because this currently depends on the # variant ; Use filetype=asm because this currently depends on the # variant
; assembler comment. ; assembler comment.
; RUN: %p2i -i %s -a -sz-seed=1 -nop-insertion -nop-insertion-percentage=50 \ ; RUN: %p2i -i %s --filetype=asm -a -sz-seed=1 -nop-insertion \
; RUN: -max-nops-per-instruction=1 -filetype=asm \ ; RUN: -nop-insertion-percentage=50 -max-nops-per-instruction=1 \
; RUN: | FileCheck %s --check-prefix=PROB50 ; RUN: | FileCheck %s --check-prefix=PROB50
; RUN: %p2i -i %s -a -sz-seed=1 -nop-insertion -nop-insertion-percentage=90 \ ; RUN: %p2i -i %s --filetype=asm -a -sz-seed=1 -nop-insertion \
; RUN: -max-nops-per-instruction=1 -filetype=asm \ ; RUN: -nop-insertion-percentage=90 -max-nops-per-instruction=1 \
; RUN: | FileCheck %s --check-prefix=PROB90 ; RUN: | FileCheck %s --check-prefix=PROB90
; RUN: %p2i -i %s -a -sz-seed=1 -nop-insertion -nop-insertion-percentage=50 \ ; RUN: %p2i -i %s --filetype=asm -a -sz-seed=1 -nop-insertion \
; RUN: -max-nops-per-instruction=2 -filetype=asm \ ; RUN: -nop-insertion-percentage=50 -max-nops-per-instruction=2 \
; RUN: | FileCheck %s --check-prefix=MAXNOPS2 ; RUN: | FileCheck %s --check-prefix=MAXNOPS2
define <4 x i32> @mul_v4i32(<4 x i32> %a, <4 x i32> %b) { define <4 x i32> @mul_v4i32(<4 x i32> %a, <4 x i32> %b) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment