Are immediate values extracted from the ALU(Arithmetic logic unit)?
More code seems to be created (and hence program file size) when using many immediate values, but I assume it is stored in the program duration memory stack.
Jump to content
Posted 24 February 2014 - 03:41 PM
They are embedded in the machine code opcodes. On a CISC architecture they follow the opcode whereas on a RISC processor where all instructions are the same size some of the bits in the opcode are used for parts of the immediate value (so in 32 bit RISC architecture loading a 32 bit immediate value needs 2 instructions, one to load 16 bits and zero the other half of a 32 but register and another to logical-OR in the other 16 bits to the register). Static memory locations are immediate values too (kind of), but accessing values from registers (e.g. the stack pointer) uses indexed addressing (something like: load reg, contents of (sp+8)), so are usually shorter since the offset is usually restricted in range (-128 to +127, perhaps).
Posted 24 February 2014 - 04:16 PM
Why is this thread tagged "C Language" and "C++"? I am pretty sure in the context of those languages there is no such thing as an ALU, and even "immediate value" is a foreign concept (although there are constants, which are related).
Posted 24 February 2014 - 07:37 PM
Posted 25 February 2014 - 01:10 AM