diff options
author | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2009-01-30 04:25:10 +0000 |
---|---|---|
committer | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2009-01-30 04:25:10 +0000 |
commit | 964a29f6717b1c29d0f74a56a1e23d77bdc8b1d0 (patch) | |
tree | 958b12086832997777dab57f7749c74087d3c1e4 /llvm/lib/Target/PIC16/PIC16AsmPrinter.cpp | |
parent | 9b3407e5bb5f6fbe5a6fbf4559989426abfd58a8 (diff) | |
download | bcm5719-llvm-964a29f6717b1c29d0f74a56a1e23d77bdc8b1d0.tar.gz bcm5719-llvm-964a29f6717b1c29d0f74a56a1e23d77bdc8b1d0.zip |
Enable emitting of constant values in non-default address space as well. The APIs emitting constants now take an additional parameter signifying the address space in which to emit. The APIs like getData8BitsDirective() etc are made virtual enabling targets to be able to define appropirate directivers for various sizes and address spaces.
llvm-svn: 63377
Diffstat (limited to 'llvm/lib/Target/PIC16/PIC16AsmPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/PIC16/PIC16AsmPrinter.cpp | 41 |
1 files changed, 2 insertions, 39 deletions
diff --git a/llvm/lib/Target/PIC16/PIC16AsmPrinter.cpp b/llvm/lib/Target/PIC16/PIC16AsmPrinter.cpp index dc91128d5a3..63ad6e4f448 100644 --- a/llvm/lib/Target/PIC16/PIC16AsmPrinter.cpp +++ b/llvm/lib/Target/PIC16/PIC16AsmPrinter.cpp @@ -242,48 +242,11 @@ void PIC16AsmPrinter::EmitInitData (Module &M) { continue; O << name; - EmitGlobalConstant(C); + EmitGlobalConstant(C, AddrSpace); } } } -void PIC16AsmPrinter::EmitConstantValueOnly(const Constant* CV) { - if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) { - unsigned BitWidth = CI->getBitWidth(); - int Val = CI->getZExtValue(); - if (BitWidth == 8) { - // Expecting db directive here. In case of romdata we need to pad the - // word with zeros. - if (IsRomData) - O << 0 <<", "; - O << Val; - } - else if (BitWidth == 16) { - unsigned Element1, Element2; - Element1 = 0x00ff & Val; - Element2 = 0x00ff & (Val >> 8); - if (IsRomData) - O << 0 <<", "<<Element1 <<", "<< 0 <<", "<< Element2; - else - O << Element1 <<", "<< Element2; - } - else if (BitWidth == 32) { - unsigned Element1, Element2, Element3, Element4; - Element1 = 0x00ff & Val; - Element2 = 0x00ff & (Val >> 8); - Element3 = 0x00ff & (Val >> 16); - Element4 = 0x00ff & (Val >> 24); - if (IsRomData) - O << 0 <<", "<< Element1 <<", "<< 0 <<", "<< Element2 <<", "<< 0 - <<", "<< Element3 <<", "<< 0 <<", "<< Element4; - else - O << Element1 <<", "<< Element2 <<", "<< Element3 <<", "<< Element4; - } - return; - } - AsmPrinter::EmitConstantValueOnly(CV); -} - void PIC16AsmPrinter::EmitRomData (Module &M) { SwitchToSection(TAI->getReadOnlySection()); @@ -308,7 +271,7 @@ void PIC16AsmPrinter::EmitRomData (Module &M) continue; O << name; - EmitGlobalConstant(C); + EmitGlobalConstant(C, AddrSpace); O << "\n"; } } |