[LLVMbugs] [Bug 9805] New: Folding arbitrary expressions on symbol refs with MC
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Apr 28 06:17:16 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9805
Summary: Folding arbitrary expressions on symbol refs with MC
Product: libraries
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: Common Code Generator Code
AssignedTo: unassignedbugs at nondot.org
ReportedBy: borja.ferav at gmail.com
CC: llvmbugs at cs.uiuc.edu
With the current implementation only additions and subtractions on symbol
references are folded. However, this could be enhanced to allow folding
arbitrary expressions over symbols so they're performed at compilation time
(link stage) instead of doing it in execution time. The MC API has support for
all the operations over the symbols so basically it's about translating the
piece of DAG that operates on the symbol to a chain of MCExpr's.
This is very useful for static addresses that aren't going to be relocated
since the addr is known at link time.
Consider this trivial example (int here is 16bits):
unsigned int g_var[20];
unsigned int foo() {(unsigned int)&g_var[0] & 0x1234;}
this could get compiled into (in pseudo asm):
move retreg, (g_var & 0x1234)
instead of:
move retreg, g_var
andi retreg, 0x1234
For much longer expressions the benefits impact is much higher in code size and
execution time.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list