diff options
author | David Greene <greened@obbligato.org> | 2009-08-05 21:00:52 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2009-08-05 21:00:52 +0000 |
commit | fdd2519eb5cb5615d25bd61817020f75845d7f77 (patch) | |
tree | 3bdcb64d20b639bd9126e2428862c98552e3ebca /llvm/lib | |
parent | 39fb546b9e2296abf69d5a61007b7bbf656a3270 (diff) | |
download | bcm5719-llvm-fdd2519eb5cb5615d25bd61817020f75845d7f77.tar.gz bcm5719-llvm-fdd2519eb5cb5615d25bd61817020f75845d7f77.zip |
Fix some column padding bugs, reorganize things as suggested by Chris
and eliminate complexity. Yay!
llvm-svn: 78243
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 3102bdae017..ec62822e627 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -782,6 +782,20 @@ void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV, } O << '\n'; } + +/// getOperandColumn - Return the output column number (zero-based) +/// for operand % "operand." If TargetAsmInfo has FirstOperandColumn +/// == 0 or MaxOperandLength == 0, return 0, meaning column alignment +/// is disabled. +unsigned AsmPrinter::getOperandColumn(int operand) const { + if (TAI->getFirstOperandColumn() > 0 && TAI->getMaxOperandLength() > 0) { + return TAI->getFirstOperandColumn() + + (TAI->getMaxOperandLength()+1)*(operand-1); + } + else { + return 0; + } +} /// PadToColumn - This gets called every time a tab is emitted. If /// column padding is turned on, we replace the tab with the @@ -789,8 +803,8 @@ void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV, /// space, except for the first operand so that initial operands are /// always lined up by tabs. void AsmPrinter::PadToColumn(unsigned Operand) const { - if (TAI->getOperandColumn(Operand) > 0) { - O.PadToColumn(TAI->getOperandColumn(Operand), 1); + if (getOperandColumn(Operand) > 0) { + O.PadToColumn(getOperandColumn(Operand), 1); } else { if (Operand == 1) { |